Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/tabs

Package Overview
Dependencies
Maintainers
1
Versions
1027
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/tabs - npm Package Compare versions

Comparing version 0.0.0-dev-20220407084218 to 0.0.0-dev-20220408111010

2

dist/index.js

@@ -1,2 +0,2 @@

var g=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var y=(e,t,n)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||(t={}))b.call(t,n)&&y(e,n,t[n]);if(h)for(var n of h(t))N.call(t,n)&&y(e,n,t[n]);return e};var W=e=>g(e,"__esModule",{value:!0});var z=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},K=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _(t))!b.call(e,a)&&(n||a!=="default")&&g(e,a,{get:()=>t[a],enumerable:!(r=H(t,a))||r.enumerable});return e};var U=(e=>(t,n)=>e&&e.get(t)||(n=K(W({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Q={};z(Q,{connect:()=>D,machine:()=>B});var p=e=>e?"":void 0;var E=new WeakMap;function q(e){var t;if(!e)return{};let n=E.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),E.set(e,n)),n}function c(e){let t=new Set;function n(r){let a=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(a))}return n(()=>n(e)),function(){t.forEach(function(r){r()})}}var te=(()=>{let e=0;return()=>(e++,e.toString(36))})();function T(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}var j=e=>(e==null?void 0:e.getAttribute("disabled"))!=null||!!(e==null?void 0:e.getAttribute("aria-disabled"));var x=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");function A(e,t){let n=q(e);if(!e||n.getPropertyValue("visibility")==="hidden")return!0;for(;e;){if(t!=null&&e===t)return!1;if(n.getPropertyValue("display")==="none")return!0;e=e.parentElement}return!1}var L=(e,t=!1)=>{if(!e)return[];let n=Array.from(e.querySelectorAll(x));return t&&T(e)&&n.unshift(e),n.filter(r=>$(r)&&!A(r))},$=e=>!T(e)||A(e)||j(e)?!1:e==null?void 0:e.matches(x);var k={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},G={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function I(e,t={}){var n;let{dir:r="ltr",orientation:a="horizontal"}=t,{key:i}=e;return i=(n=G[i])!=null?n:i,r==="rtl"&&a==="horizontal"&&i in k&&(i=k[i]),i}function C(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function v(e,t){return e.find(n=>n.id===t)}function P(e,t){let n=v(e,t);return n?e.indexOf(n):-1}function S(e,t,n=!0){let r=P(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function R(e,t,n=!0){let r=P(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function Y(e){return{button:e,label:e,input:e,output:e,element:e}}var M=Y(e=>e);var V=e=>e[0],F=e=>e[e.length-1];var re=(()=>{let e=0;return()=>(e++,e.toString(36))})();var X=e=>Z()&&e.test(navigator.userAgent);var Z=()=>typeof window!="undefined";var O=()=>X(/^((?!chrome|android).)*safari/i);var o={getDoc:e=>{var t;return(t=e.doc)!=null?t:document},getRootId:e=>`tabs-${e.uid}`,getTriggerGroupId:e=>`tabs-${e.uid}-trigger-group`,getContentId:(e,t)=>`tabs-${e.uid}-content-${t}`,getContentGroupId:e=>`tabs-${e.uid}-content-group`,getTriggerId:(e,t)=>`tabs-${e.uid}-trigger-${t}`,getIndicatorId:e=>`tabs-${e.uid}-indicator`,getTriggerGroupEl:e=>o.getDoc(e).getElementById(o.getTriggerGroupId(e)),getContentEl:(e,t)=>o.getDoc(e).getElementById(o.getContentId(e,t)),getTriggerEl:(e,t)=>o.getDoc(e).getElementById(o.getTriggerId(e,t)),getIndicatorEl:e=>o.getDoc(e).getElementById(o.getIndicatorId(e)),getElements:e=>{let n=`[role=tab][data-ownedby='${CSS.escape(o.getTriggerGroupId(e))}']:not([disabled])`;return C(o.getTriggerGroupEl(e),n)},getFirstEl:e=>V(o.getElements(e)),getLastEl:e=>F(o.getElements(e)),getNextEl:(e,t)=>S(o.getElements(e),o.getTriggerId(e,t),e.loop),getPrevEl:(e,t)=>R(o.getElements(e),o.getTriggerId(e,t),e.loop),getRectById:(e,t)=>{var a;let n={offsetLeft:0,offsetTop:0,offsetWidth:0,offsetHeight:0},r=(a=v(o.getElements(e),o.getTriggerId(e,t)))!=null?a:n;return e.isVertical?{top:`${r.offsetTop}px`,height:`${r.offsetHeight}px`}:{left:`${r.offsetLeft}px`,width:`${r.offsetWidth}px`}},getActiveContentEl:e=>{if(!e.value)return;let t=o.getContentId(e,e.value);return o.getDoc(e).getElementById(t)}};function D(e,t,n=M){let r=e.context.messages,a=e.matches("focused");return{value:e.context.value,focusedValue:e.context.focusedValue,previousValues:Array.from(e.context.previousValues),setValue(i){t({type:"SET_VALUE",value:i})},rootProps:n.element({"data-part":"root",id:o.getRootId(e.context),"data-orientation":e.context.orientation,"data-focus":p(a),dir:e.context.dir}),triggerGroupProps:n.element({"data-part":"trigger-group",id:o.getTriggerGroupId(e.context),role:"tablist","data-focus":p(a),"aria-orientation":e.context.orientation,"data-orientation":e.context.orientation,"aria-label":r.tablistLabel,onKeyDown(i){let l={ArrowDown(){t("ARROW_DOWN")},ArrowUp(){t("ARROW_UP")},ArrowLeft(){t("ARROW_LEFT")},ArrowRight(){t("ARROW_RIGHT")},Home(){t("HOME")},End(){t("END")},Enter(){t({type:"ENTER",value:e.context.focusedValue})}},s=I(i,e.context),u=l[s];u&&(i.preventDefault(),u(i))}}),getTriggerProps(i){let{value:l,disabled:s}=i,u=e.context.value===l;return n.button({"data-part":"trigger",role:"tab",type:"button",disabled:s,"data-orientation":e.context.orientation,"data-disabled":p(s),"aria-disabled":s,"data-value":l,"aria-selected":u,"data-selected":p(u),"aria-controls":o.getContentId(e.context,l),"data-ownedby":o.getTriggerGroupId(e.context),id:o.getTriggerId(e.context,l),tabIndex:u?0:-1,onFocus(){t({type:"TAB_FOCUS",value:l})},onBlur(d){let m=d.relatedTarget;(m==null?void 0:m.getAttribute("role"))!=="tab"&&t({type:"TAB_BLUR"})},onClick(d){s||(O()&&d.currentTarget.focus(),t({type:"TAB_CLICK",value:l}))}})},contentGroupProps:n.element({"data-part":"content-group",id:o.getContentGroupId(e.context),"data-orientation":e.context.orientation}),getContentProps({value:i}){let l=e.context.value===i;return n.element({"data-part":"content",id:o.getContentId(e.context,i),tabIndex:0,"aria-labelledby":o.getTriggerId(e.context,i),role:"tabpanel","data-ownedby":o.getTriggerGroupId(e.context),hidden:!l})},getDeleteButtonProps({value:i,disabled:l}){var s;return n.button({"data-part":"delete-button",type:"button",tabIndex:-1,"aria-label":(s=r.deleteLabel)==null?void 0:s.call(r,i),disabled:l,onClick(){var u,d;(d=(u=e.context).onDelete)==null||d.call(u,i)}})},indicatorProps:n.element({id:o.getIndicatorId(e.context),"data-part":"indicator","data-orientation":e.context.orientation,style:w({"--transition-duration":"200ms","--transition-property":"left, right, top, bottom, width, height",position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:e.context.hasMeasuredRect?"var(--transition-duration)":"0ms",transitionTimingFunction:"var(--transition-timing-function)"},e.context.indicatorRect)})}}var f=require("@zag-js/core");var{not:J}=f.guards,B=(0,f.createMachine)({initial:"unknown",context:{dir:"ltr",orientation:"horizontal",activationMode:"automatic",value:null,focusedValue:null,uid:"",previousValues:[],indicatorRect:{left:"0px",top:"0px",width:"0px",height:"0px"},hasMeasuredRect:!1,isIndicatorRendered:!1,loop:!0,messages:{}},computed:{isHorizontal:e=>e.orientation==="horizontal",isVertical:e=>e.orientation==="vertical"},created:["setPrevSelectedTabs"],watch:{focusedValue:"invokeOnFocus",value:["invokeOnChange","setPrevSelectedTabs","setIndicatorRect","setContentTabIndex"],dir:["clearMeasured","setIndicatorRect"]},on:{SET_VALUE:{actions:"setValue"}},states:{unknown:{on:{SETUP:{target:"idle",actions:["setupDocument","checkRenderedElements","setIndicatorRect","setContentTabIndex"]}}},idle:{on:{TAB_FOCUS:{guard:"selectOnFocus",target:"focused",actions:["setFocusedValue","setValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_LEFT:{guard:"isHorizontal",actions:"focusPrevTab"},ARROW_RIGHT:{guard:"isHorizontal",actions:"focusNextTab"},ARROW_UP:{guard:"isVertical",actions:"focusPrevTab"},ARROW_DOWN:{guard:"isVertical",actions:"focusNextTab"},HOME:{actions:"focusFirstTab"},END:{actions:"focusLastTab"},ENTER:{guard:J("selectOnFocus"),actions:"setValue"},TAB_FOCUS:[{guard:"selectOnFocus",actions:["setFocusedValue","setValue"]},{actions:"setFocusedValue"}],TAB_BLUR:{target:"idle",actions:"clearFocusedValue"}}}}},{guards:{isVertical:e=>e.isVertical,isHorizontal:e=>e.isHorizontal,selectOnFocus:e=>e.activationMode==="automatic"},actions:{setupDocument(e,t){e.uid=t.id,t.doc&&(e.doc=(0,f.ref)(t.doc))},setFocusedValue(e,t){e.focusedValue=t.value},clearFocusedValue(e){e.focusedValue=null},setValue(e,t){e.value=t.value},focusFirstTab(e){c(()=>{var t;return(t=o.getFirstEl(e))==null?void 0:t.focus()})},focusLastTab(e){c(()=>{var t;return(t=o.getLastEl(e))==null?void 0:t.focus()})},focusNextTab(e){if(!e.focusedValue)return;let t=o.getNextEl(e,e.focusedValue);c(()=>t==null?void 0:t.focus())},focusPrevTab(e){if(!e.focusedValue)return;let t=o.getPrevEl(e,e.focusedValue);c(()=>t==null?void 0:t.focus())},setIndicatorRect(e){c(()=>{!e.isIndicatorRendered||!e.value||(e.indicatorRect=o.getRectById(e,e.value),!e.hasMeasuredRect&&c(()=>{e.hasMeasuredRect=!0}))})},checkRenderedElements(e){c(()=>{e.isIndicatorRendered=!!o.getIndicatorEl(e)})},clearMeasured(e){e.hasMeasuredRect=!1},invokeOnChange(e){var t;(t=e.onChange)==null||t.call(e,e.value)},invokeOnFocus(e){var t;(t=e.onFocus)==null||t.call(e,e.focusedValue)},setPrevSelectedTabs(e){if(e.value!=null){let t=Array.from(e.previousValues).concat(e.value);e.previousValues=Array.from(new Set(t))}},setContentTabIndex(e){c(()=>{let t=o.getActiveContentEl(e);if(!t)return;L(t).length>0?t.removeAttribute("tabindex"):t.setAttribute("tabindex","0")})}}});module.exports=U(Q);
var g=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var b=(e,t,n)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&b(e,n,t[n]);if(h)for(var n of h(t))N.call(t,n)&&b(e,n,t[n]);return e};var W=e=>g(e,"__esModule",{value:!0});var z=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},K=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _(t))!y.call(e,a)&&(n||a!=="default")&&g(e,a,{get:()=>t[a],enumerable:!(r=H(t,a))||r.enumerable});return e};var U=(e=>(t,n)=>e&&e.get(t)||(n=K(W({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Q={};z(Q,{connect:()=>D,machine:()=>B});var p=e=>e?"":void 0;var E=new WeakMap;function q(e){var t;if(!e)return{};let n=E.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),E.set(e,n)),n}function c(e){let t=new Set;function n(r){let a=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(a))}return n(()=>n(e)),function(){t.forEach(function(r){r()})}}var te=(()=>{let e=0;return()=>(e++,e.toString(36))})();function T(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}var j=e=>(e==null?void 0:e.getAttribute("disabled"))!=null||!!(e==null?void 0:e.getAttribute("aria-disabled"));var x=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");function A(e,t){let n=q(e);if(!e||n.getPropertyValue("visibility")==="hidden")return!0;for(;e;){if(t!=null&&e===t)return!1;if(n.getPropertyValue("display")==="none")return!0;e=e.parentElement}return!1}var k=(e,t=!1)=>{if(!e)return[];let n=Array.from(e.querySelectorAll(x));return t&&T(e)&&n.unshift(e),n.filter(r=>$(r)&&!A(r))},$=e=>!T(e)||A(e)||j(e)?!1:e==null?void 0:e.matches(x);var L={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},G={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function I(e,t={}){var n;let{dir:r="ltr",orientation:a="horizontal"}=t,{key:i}=e;return i=(n=G[i])!=null?n:i,r==="rtl"&&a==="horizontal"&&i in L&&(i=L[i]),i}function P(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function v(e,t){return e.find(n=>n.id===t)}function C(e,t){let n=v(e,t);return n?e.indexOf(n):-1}function S(e,t,n=!0){let r=C(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function M(e,t,n=!0){let r=C(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function Y(e){return{button:e,label:e,input:e,output:e,element:e}}var R=Y(e=>e);var V=e=>e[0],F=e=>e[e.length-1];var re=(()=>{let e=0;return()=>(e++,e.toString(36))})();var X=e=>Z()&&e.test(navigator.userAgent);var Z=()=>typeof window!="undefined";var O=()=>X(/^((?!chrome|android).)*safari/i);var o={getDoc:e=>{var t;return(t=e.doc)!=null?t:document},getRootId:e=>`tabs-${e.uid}`,getTriggerGroupId:e=>`tabs-${e.uid}-trigger-group`,getContentId:(e,t)=>`tabs-${e.uid}-content-${t}`,getContentGroupId:e=>`tabs-${e.uid}-content-group`,getTriggerId:(e,t)=>`tabs-${e.uid}-trigger-${t}`,getIndicatorId:e=>`tabs-${e.uid}-indicator`,getTriggerGroupEl:e=>o.getDoc(e).getElementById(o.getTriggerGroupId(e)),getContentEl:(e,t)=>o.getDoc(e).getElementById(o.getContentId(e,t)),getTriggerEl:(e,t)=>o.getDoc(e).getElementById(o.getTriggerId(e,t)),getIndicatorEl:e=>o.getDoc(e).getElementById(o.getIndicatorId(e)),getElements:e=>{let n=`[role=tab][data-ownedby='${CSS.escape(o.getTriggerGroupId(e))}']:not([disabled])`;return P(o.getTriggerGroupEl(e),n)},getFirstEl:e=>V(o.getElements(e)),getLastEl:e=>F(o.getElements(e)),getNextEl:(e,t)=>S(o.getElements(e),o.getTriggerId(e,t),e.loop),getPrevEl:(e,t)=>M(o.getElements(e),o.getTriggerId(e,t),e.loop),getRectById:(e,t)=>{var a;let n={offsetLeft:0,offsetTop:0,offsetWidth:0,offsetHeight:0},r=(a=v(o.getElements(e),o.getTriggerId(e,t)))!=null?a:n;return e.isVertical?{top:`${r.offsetTop}px`,height:`${r.offsetHeight}px`}:{left:`${r.offsetLeft}px`,width:`${r.offsetWidth}px`}},getActiveContentEl:e=>{if(!e.value)return;let t=o.getContentId(e,e.value);return o.getDoc(e).getElementById(t)}};function D(e,t,n=R){let r=e.context.messages,a=e.matches("focused");return{value:e.context.value,focusedValue:e.context.focusedValue,previousValues:Array.from(e.context.previousValues),setValue(i){t({type:"SET_VALUE",value:i})},rootProps:n.element({"data-part":"root",id:o.getRootId(e.context),"data-orientation":e.context.orientation,"data-focus":p(a),dir:e.context.dir}),triggerGroupProps:n.element({"data-part":"trigger-group",id:o.getTriggerGroupId(e.context),role:"tablist","data-focus":p(a),"aria-orientation":e.context.orientation,"data-orientation":e.context.orientation,"aria-label":r.tablistLabel,onKeyDown(i){let l={ArrowDown(){t("ARROW_DOWN")},ArrowUp(){t("ARROW_UP")},ArrowLeft(){t("ARROW_LEFT")},ArrowRight(){t("ARROW_RIGHT")},Home(){t("HOME")},End(){t("END")},Enter(){t({type:"ENTER",value:e.context.focusedValue})}},s=I(i,e.context),u=l[s];u&&(i.preventDefault(),u(i))}}),getTriggerProps(i){let{value:l,disabled:s}=i,u=e.context.value===l;return n.button({"data-part":"trigger",role:"tab",type:"button",disabled:s,"data-orientation":e.context.orientation,"data-disabled":p(s),"aria-disabled":s,"data-value":l,"aria-selected":u,"data-selected":p(u),"aria-controls":o.getContentId(e.context,l),"data-ownedby":o.getTriggerGroupId(e.context),id:o.getTriggerId(e.context,l),tabIndex:u?0:-1,onFocus(){t({type:"TAB_FOCUS",value:l})},onBlur(d){let m=d.relatedTarget;(m==null?void 0:m.getAttribute("role"))!=="tab"&&t({type:"TAB_BLUR"})},onClick(d){s||(O()&&d.currentTarget.focus(),t({type:"TAB_CLICK",value:l}))}})},contentGroupProps:n.element({"data-part":"content-group",id:o.getContentGroupId(e.context),"data-orientation":e.context.orientation}),getContentProps({value:i}){let l=e.context.value===i;return n.element({"data-part":"content",id:o.getContentId(e.context,i),tabIndex:0,"aria-labelledby":o.getTriggerId(e.context,i),role:"tabpanel","data-ownedby":o.getTriggerGroupId(e.context),hidden:!l})},getDeleteButtonProps({value:i,disabled:l}){var s;return n.button({"data-part":"delete-button",type:"button",tabIndex:-1,"aria-label":(s=r.deleteLabel)==null?void 0:s.call(r,i),disabled:l,onClick(){var u,d;(d=(u=e.context).onDelete)==null||d.call(u,i)}})},indicatorProps:n.element({id:o.getIndicatorId(e.context),"data-part":"indicator","data-orientation":e.context.orientation,style:w({"--transition-duration":"200ms","--transition-property":"left, right, top, bottom, width, height",position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:e.context.hasMeasuredRect?"var(--transition-duration)":"0ms",transitionTimingFunction:"var(--transition-timing-function)"},e.context.indicatorRect)})}}var f=require("@zag-js/core");var{not:J}=f.guards,B=(0,f.createMachine)({initial:"unknown",context:{dir:"ltr",orientation:"horizontal",activationMode:"automatic",value:null,focusedValue:null,uid:"",previousValues:[],indicatorRect:{left:"0px",top:"0px",width:"0px",height:"0px"},hasMeasuredRect:!1,isIndicatorRendered:!1,loop:!0,messages:{}},computed:{isHorizontal:e=>e.orientation==="horizontal",isVertical:e=>e.orientation==="vertical"},created:["setPrevSelectedTabs"],watch:{focusedValue:"invokeOnFocus",value:["invokeOnChange","setPrevSelectedTabs","setIndicatorRect","setContentTabIndex"],dir:["clearMeasured","setIndicatorRect"]},on:{SET_VALUE:{actions:"setValue"}},states:{unknown:{on:{SETUP:{target:"idle",actions:["setupDocument","checkRenderedElements","setIndicatorRect","setContentTabIndex"]}}},idle:{on:{TAB_FOCUS:{guard:"selectOnFocus",target:"focused",actions:["setFocusedValue","setValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_LEFT:{guard:"isHorizontal",actions:"focusPrevTab"},ARROW_RIGHT:{guard:"isHorizontal",actions:"focusNextTab"},ARROW_UP:{guard:"isVertical",actions:"focusPrevTab"},ARROW_DOWN:{guard:"isVertical",actions:"focusNextTab"},HOME:{actions:"focusFirstTab"},END:{actions:"focusLastTab"},ENTER:{guard:J("selectOnFocus"),actions:"setValue"},TAB_FOCUS:[{guard:"selectOnFocus",actions:["setFocusedValue","setValue"]},{actions:"setFocusedValue"}],TAB_BLUR:{target:"idle",actions:"clearFocusedValue"}}}}},{guards:{isVertical:e=>e.isVertical,isHorizontal:e=>e.isHorizontal,selectOnFocus:e=>e.activationMode==="automatic"},actions:{setupDocument(e,t){e.uid=t.id,t.doc&&(e.doc=(0,f.ref)(t.doc))},setFocusedValue(e,t){e.focusedValue=t.value},clearFocusedValue(e){e.focusedValue=null},setValue(e,t){e.value=t.value},focusFirstTab(e){c(()=>{var t;return(t=o.getFirstEl(e))==null?void 0:t.focus()})},focusLastTab(e){c(()=>{var t;return(t=o.getLastEl(e))==null?void 0:t.focus()})},focusNextTab(e){if(!e.focusedValue)return;let t=o.getNextEl(e,e.focusedValue);c(()=>t==null?void 0:t.focus())},focusPrevTab(e){if(!e.focusedValue)return;let t=o.getPrevEl(e,e.focusedValue);c(()=>t==null?void 0:t.focus())},setIndicatorRect(e){c(()=>{!e.isIndicatorRendered||!e.value||(e.indicatorRect=o.getRectById(e,e.value),!e.hasMeasuredRect&&c(()=>{e.hasMeasuredRect=!0}))})},checkRenderedElements(e){c(()=>{e.isIndicatorRendered=!!o.getIndicatorEl(e)})},clearMeasured(e){e.hasMeasuredRect=!1},invokeOnChange(e){var t;(t=e.onChange)==null||t.call(e,e.value)},invokeOnFocus(e){var t;(t=e.onFocus)==null||t.call(e,e.focusedValue)},setPrevSelectedTabs(e){if(e.value!=null){let t=Array.from(e.previousValues).concat(e.value);e.previousValues=Array.from(new Set(t))}},setContentTabIndex(e){c(()=>{let t=o.getActiveContentEl(e);if(!t)return;k(t).length>0?t.removeAttribute("tabindex"):t.setAttribute("tabindex","0")})}}});module.exports=U(Q);
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/tabs",
"version": "0.0.0-dev-20220407084218",
"version": "0.0.0-dev-20220408111010",
"description": "Core logic for the tabs widget implemented as a state machine",

@@ -32,7 +32,7 @@ "keywords": [

"dependencies": {
"@zag-js/core": "^0.0.0-dev-20220407084218",
"@zag-js/dom-utils": "^0.0.0-dev-20220407084218",
"@zag-js/types": "^0.0.0-dev-20220407084218",
"@zag-js/utils": "^0.0.0-dev-20220407084218"
"@zag-js/core": "^0.0.0-dev-20220408111010",
"@zag-js/dom-utils": "^0.0.0-dev-20220408111010",
"@zag-js/types": "^0.0.0-dev-20220408111010",
"@zag-js/utils": "^0.0.0-dev-20220408111010"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc