@purpurds/tabs 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/tabs.cjs.js +2 -2
- package/dist/tabs.es.js +50 -50
- package/package.json +4 -4
package/dist/LICENSE.txt
CHANGED
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._purpur-tab-content_rbfjg_1{position:relative}._purpur-tab-content_rbfjg_1:focus{outline:0}._purpur-tab-content_rbfjg_1:focus:before{content:"";position:absolute;inset:calc(-1 * var(--purpur-border-width-sm) * 2);display:block;border:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);border-radius:var(--purpur-border-radius-sm)}._purpur-tab-content_rbfjg_1:focus:not(:focus-visible):before{border:0}._purpur-tab-
|
|
1
|
+
._purpur-tab-content_rbfjg_1{position:relative}._purpur-tab-content_rbfjg_1:focus{outline:0}._purpur-tab-content_rbfjg_1:focus:before{content:"";position:absolute;inset:calc(-1 * var(--purpur-border-width-sm) * 2);display:block;border:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);border-radius:var(--purpur-border-radius-sm)}._purpur-tab-content_rbfjg_1:focus:not(:focus-visible):before{border:0}._purpur-tab-header_ls5xt_1{position:relative;width:100%;padding:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25)) var(--purpur-spacing-200);border:0;border-radius:var(--purpur-border-radius-sm) var(--purpur-border-radius-sm) 0 0;background:transparent;font-family:var(--purpur-typography-family-default);font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-loose);font-weight:500;white-space:nowrap;cursor:pointer;transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}._purpur-tab-header_ls5xt_1[aria-selected=true]{cursor:auto}._purpur-tab-header_ls5xt_1:focus{outline:0}._purpur-tab-header_ls5xt_1:focus:focus-visible:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:20;border:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);border-radius:var(--purpur-border-radius-sm);pointer-events:none}._purpur-tab-header--contained_ls5xt_32:focus:focus-visible:after,._purpur-tab-header--contained-negative_ls5xt_32:focus:focus-visible:after{top:calc(-1 * var(--purpur-border-width-sm))}._purpur-tab-header--line_ls5xt_35{color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-functional-transparent)}._purpur-tab-header--line_ls5xt_35:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover);background:var(--purpur-color-background-interactive-transparent-hover)}._purpur-tab-header--line_ls5xt_35:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active);background:var(--purpur-color-background-interactive-transparent-active)}._purpur-tab-header--line-negative_ls5xt_47{color:var(--purpur-color-text-interactive-primary-negative);background:var(--purpur-color-functional-transparent)}._purpur-tab-header--line-negative_ls5xt_47:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-negative-hover);background:var(--purpur-color-background-interactive-transparent-negative-hover)}._purpur-tab-header--line-negative_ls5xt_47:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-negative-active);background:var(--purpur-color-background-interactive-transparent-negative-active)}._purpur-tab-header--contained_ls5xt_32{padding-top:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25) - var(--purpur-border-width-sm));border-top:var(--purpur-border-width-sm) solid transparent;color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-background-interactive-inactive)}._purpur-tab-header--contained_ls5xt_32._purpur-tab-header_ls5xt_1[aria-selected=true]{border-color:var(--purpur-color-border-interactive-primary);background:var(--purpur-color-background-primary)}._purpur-tab-header--contained_ls5xt_32:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover);background:var(--purpur-color-background-interactive-transparent-hover)}._purpur-tab-header--contained_ls5xt_32:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active);background:var(--purpur-color-background-interactive-transparent-active)}._purpur-tab-header--contained-negative_ls5xt_32{padding-top:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25) - var(--purpur-border-width-sm));border-top:var(--purpur-border-width-sm) solid transparent;color:var(--purpur-color-text-interactive-primary-negative);background:var(--purpur-color-background-interactive-inactive-negative)}._purpur-tab-header--contained-negative_ls5xt_32._purpur-tab-header_ls5xt_1[aria-selected=true]{border-color:var(--purpur-color-border-interactive-primary-negative);color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-background-primary)}._purpur-tab-header--contained-negative_ls5xt_32:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-negative-hover);background:var(--purpur-color-background-interactive-transparent-negative-hover)}._purpur-tab-header--contained-negative_ls5xt_32:not(._purpur-tab-header_ls5xt_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-negative-active);background:var(--purpur-color-background-interactive-transparent-negative-active)}._purpur-tabs__wrapper_1dpqy_1{position:relative;-ms-overflow-style:none;scrollbar-width:none}._purpur-tabs__wrapper_1dpqy_1 ::-webkit-scrollbar{display:none}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9{display:none;align-items:center;position:absolute;top:0;z-index:10;height:100%;padding:0;border:var(--purpur-border-width-xs) solid var(--purpur-color-border-interactive-subtle);border-radius:var(--purpur-border-radius-xs);color:var(--purpur-color-text-default);background:var(--purpur-color-background-primary);box-shadow:var(--purpur-shadow-md);transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out);cursor:pointer}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:after{content:"";position:absolute;inset:calc(-1 * var(--purpur-border-width-xs));border:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-subtle-hover);border-radius:var(--purpur-border-radius-xs);box-sizing:border-box;opacity:0;transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:hover{box-shadow:none;border-color:transparent;color:var(--purpur-color-text-interactive-primary-hover)}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:hover:after{opacity:1}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:active:after{border-width:var(--purpur-border-width-xs)}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:focus{outline:0}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:focus-visible{outline:0;border-color:var(--purpur-color-border-interactive-subtle);box-shadow:none}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button_1dpqy_9:focus-visible:after{left:calc(-1 * var(--purpur-border-width-sm) * 2);top:calc(-1 * var(--purpur-border-width-sm) * 2);width:calc(100% + var(--purpur-border-width-sm) * 4);height:calc(100% + var(--purpur-border-width-sm) * 4);border-color:var(--purpur-color-border-interactive-focus);opacity:1;pointer-events:none}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button--left_1dpqy_63{left:0}._purpur-tabs__wrapper_1dpqy_1 ._purpur-tabs__scroll-button--right_1dpqy_66{right:0}._purpur-tabs__wrapper--scroll-end_1dpqy_69 ._purpur-tabs__scroll-button--left_1dpqy_63,._purpur-tabs__wrapper--scroll-start_1dpqy_72 ._purpur-tabs__scroll-button--right_1dpqy_66{display:flex}._purpur-tabs--line_1dpqy_75 ._purpur-tabs__wrapper_1dpqy_1:after,._purpur-tabs--line-negative_1dpqy_75 ._purpur-tabs__wrapper_1dpqy_1:after{content:"";position:absolute;bottom:0;left:0;width:100%;height:var(--purpur-border-width-sm)}._purpur-tabs--line_1dpqy_75 ._purpur-tabs__selected-border_1dpqy_83,._purpur-tabs--line-negative_1dpqy_75 ._purpur-tabs__selected-border_1dpqy_83{position:absolute;bottom:0;left:0;z-index:10;height:var(--purpur-border-width-sm);transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}._purpur-tabs--line_1dpqy_75 ._purpur-tabs__wrapper_1dpqy_1:after{background:var(--purpur-color-border-weak)}._purpur-tabs--line_1dpqy_75 ._purpur-tabs__selected-border_1dpqy_83{background:var(--purpur-color-border-interactive-primary)}._purpur-tabs--line-negative_1dpqy_75 ._purpur-tabs__wrapper_1dpqy_1:after{background:var(--purpur-color-border-weak-negative)}._purpur-tabs--line-negative_1dpqy_75 ._purpur-tabs__selected-border_1dpqy_83{background:var(--purpur-color-border-interactive-primary-negative)}._purpur-tabs--contained_1dpqy_103 ._purpur-tabs__list_1dpqy_103,._purpur-tabs--contained-negative_1dpqy_103 ._purpur-tabs__list_1dpqy_103{gap:var(--purpur-spacing-100)}._purpur-tabs--contained_1dpqy_103 ._purpur-tabs__content-container_1dpqy_106,._purpur-tabs--contained-negative_1dpqy_103 ._purpur-tabs__content-container_1dpqy_106{background:var(--purpur-color-background-primary)}._purpur-tabs__list_1dpqy_103{position:relative;display:inline-flex;max-width:100%;overflow:auto}._purpur-tabs--fullWidth_1dpqy_115 ._purpur-tabs__list_1dpqy_103{min-width:100%}
|
package/dist/tabs.cjs.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var c="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(c=a(c,o.call(this,i)))}return c}function o(c){if(typeof c=="string"||typeof c=="number")return this&&this[c]||c;if(typeof c!="object")return"";if(Array.isArray(c))return n.apply(this,c);if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]"))return c.toString();var s="";for(var i in c)t.call(c,i)&&c[i]&&(s=a(s,this&&this[i]||i));return s}function a(c,s){return s?c?c+" "+s:c+s:c}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(re);var ye=re.exports;const Se=we(ye),Ie={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},Te={name:"chevron-left",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M16.175 3.905a.9.9 0 0 1-.08 1.27L8.36 12l7.736 6.825a.9.9 0 0 1-1.191 1.35l-8.5-7.5a.9.9 0 0 1 0-1.35l8.5-7.5a.9.9 0 0 1 1.27.08Z" clip-rule="evenodd"/></svg>',keywords:["chevron-left"],category:"utility"},Ne={name:"chevron-right",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.809 3.924a.9.9 0 0 0 .115 1.267L16.094 12l-8.17 6.809a.9.9 0 0 0 1.152 1.382l9-7.5a.9.9 0 0 0 0-1.382l-9-7.5a.9.9 0 0 0-1.267.115Z" clip-rule="evenodd"/></svg>',keywords:["chevron-right"],category:"utility"},Re=Se.bind(Ie),ee="purpur-icon",Ae="md",Me=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),Pe=({content:e="",title:t}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},t?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],o=t?`<title>${t}</title>`:"";return`<svg ${Me(n)}>${o}${e}</svg>`},Oe=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),Fe=({["data-testid"]:e,svg:t,allyTitle:n,className:o="",size:a=Ae,...c})=>{const s=Pe({content:Oe(t.svg),title:n}),i=Re(o,ee,`${ee}--${a}`);return w.jsx("span",{"aria-label":n,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:s},...c})};function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y.apply(this,arguments)}function T(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Y(e,t=[]){let n=[];function o(c,s){const i=r.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:$,children:v,...d}=f,m=($==null?void 0:$[e][l])||i,g=r.useMemo(()=>d,Object.values(d));return r.createElement(m.Provider,{value:g},v)}function p(f,$){const v=($==null?void 0:$[e][l])||i,d=r.useContext(v);if(d)return d;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${c}\``)}return u.displayName=c+"Provider",[u,p]}const a=()=>{const c=n.map(s=>r.createContext(s));return function(i){const l=(i==null?void 0:i[e])||c;return r.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[o,De(a,...t)]}function De(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(c){const s=o.reduce((i,{useScope:l,scopeName:u})=>{const f=l(c)[`__scope${u}`];return{...i,...f}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function je(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function oe(...e){return t=>e.forEach(n=>je(n,t))}function L(...e){return r.useCallback(oe(...e),e)}const U=r.forwardRef((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),c=a.find(Ve);if(c){const s=c.props.children,i=a.map(l=>l===c?r.Children.count(s)>1?r.Children.only(null):r.isValidElement(s)?s.props.children:null:l);return r.createElement(z,y({},o,{ref:t}),r.isValidElement(s)?r.cloneElement(s,void 0,i):null)}return r.createElement(z,y({},o,{ref:t}),n)});U.displayName="Slot";const z=r.forwardRef((e,t)=>{const{children:n,...o}=e;return r.isValidElement(n)?r.cloneElement(n,{...ke(o,n.props),ref:t?oe(t,n.ref):n.ref}):r.Children.count(n)>1?r.Children.only(null):null});z.displayName="SlotClone";const qe=({children:e})=>r.createElement(r.Fragment,null,e);function Ve(e){return r.isValidElement(e)&&e.type===qe}function ke(e,t){const n={...t};for(const o in t){const a=e[o],c=t[o];/^on[A-Z]/.test(o)?a&&c?n[o]=(...i)=>{c(...i),a(...i)}:a&&(n[o]=a):o==="style"?n[o]={...a,...c}:o==="className"&&(n[o]=[a,c].filter(Boolean).join(" "))}return{...e,...n}}function Le(e){const t=e+"CollectionProvider",[n,o]=Y(t),[a,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:d,children:m}=v,g=r.useRef(null),_=r.useRef(new Map).current;return r.createElement(a,{scope:d,itemMap:_,collectionRef:g},m)},i=e+"CollectionSlot",l=r.forwardRef((v,d)=>{const{scope:m,children:g}=v,_=c(i,m),h=L(d,_.collectionRef);return r.createElement(U,{ref:h},g)}),u=e+"CollectionItemSlot",p="data-radix-collection-item",f=r.forwardRef((v,d)=>{const{scope:m,children:g,..._}=v,h=r.useRef(null),M=L(d,h),S=c(u,m);return r.useEffect(()=>(S.itemMap.set(h,{ref:h,..._}),()=>void S.itemMap.delete(h))),r.createElement(U,{[p]:"",ref:M},g)});function $(v){const d=c(e+"CollectionConsumer",v);return r.useCallback(()=>{const g=d.collectionRef.current;if(!g)return[];const _=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(d.itemMap.values()).sort((S,F)=>_.indexOf(S.ref.current)-_.indexOf(F.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},$,o]}const K=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{},Ue=ne.useId||(()=>{});let Be=0;function ce(e){const[t,n]=ne.useState(Ue());return K(()=>{e||n(o=>o??String(Be++))},[e]),e||(t?`radix-${t}`:"")}const Ge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],O=Ge.reduce((e,t)=>{const n=r.forwardRef((o,a)=>{const{asChild:c,...s}=o,i=c?U:t;return r.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),r.createElement(i,y({},s,{ref:a}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Z(e){const t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...n)=>{var o;return(o=t.current)===null||o===void 0?void 0:o.call(t,...n)},[])}function se({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,a]=ze({defaultProp:t,onChange:n}),c=e!==void 0,s=c?e:o,i=Z(n),l=r.useCallback(u=>{if(c){const f=typeof u=="function"?u(e):u;f!==e&&i(f)}else a(u)},[c,e,a,i]);return[s,l]}function ze({defaultProp:e,onChange:t}){const n=r.useState(e),[o]=n,a=r.useRef(o),c=Z(t);return r.useEffect(()=>{a.current!==o&&(c(o),a.current=o)},[o,a,c]),n}const Ke=r.createContext(void 0);function ae(e){const t=r.useContext(Ke);return e||t||"ltr"}const G="rovingFocusGroup.onEntryFocus",We={bubbles:!1,cancelable:!0},H="RovingFocusGroup",[W,ie,Ye]=Le(H),[Ze,ue]=Y(H,[Ye]),[He,Xe]=Ze(H),Je=r.forwardRef((e,t)=>r.createElement(W.Provider,{scope:e.__scopeRovingFocusGroup},r.createElement(W.Slot,{scope:e.__scopeRovingFocusGroup},r.createElement(Qe,y({},e,{ref:t}))))),Qe=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:l,onEntryFocus:u,...p}=e,f=r.useRef(null),$=L(t,f),v=ae(c),[d=null,m]=se({prop:s,defaultProp:i,onChange:l}),[g,_]=r.useState(!1),h=Z(u),M=ie(n),S=r.useRef(!1),[F,D]=r.useState(0);return r.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(G,h),()=>C.removeEventListener(G,h)},[h]),r.createElement(He,{scope:n,orientation:o,dir:v,loop:a,currentTabStopId:d,onItemFocus:r.useCallback(C=>m(C),[m]),onItemShiftTab:r.useCallback(()=>_(!0),[]),onFocusableItemAdd:r.useCallback(()=>D(C=>C+1),[]),onFocusableItemRemove:r.useCallback(()=>D(C=>C-1),[])},r.createElement(O.div,y({tabIndex:g||F===0?-1:0,"data-orientation":o},p,{ref:$,style:{outline:"none",...e.style},onMouseDown:T(e.onMouseDown,()=>{S.current=!0}),onFocus:T(e.onFocus,C=>{const j=!S.current;if(C.target===C.currentTarget&&j&&!g){const P=new CustomEvent(G,We);if(C.currentTarget.dispatchEvent(P),!P.defaultPrevented){const q=M().filter(x=>x.focusable),B=q.find(x=>x.active),V=q.find(x=>x.id===d),E=[B,V,...q].filter(Boolean).map(x=>x.ref.current);le(E)}}S.current=!1}),onBlur:T(e.onBlur,()=>_(!1))})))}),et="RovingFocusGroupItem",tt=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:c,...s}=e,i=ce(),l=c||i,u=Xe(et,n),p=u.currentTabStopId===l,f=ie(n),{onFocusableItemAdd:$,onFocusableItemRemove:v}=u;return r.useEffect(()=>{if(o)return $(),()=>v()},[o,$,v]),r.createElement(W.ItemSlot,{scope:n,id:l,focusable:o,active:a},r.createElement(O.span,y({tabIndex:p?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:T(e.onMouseDown,d=>{o?u.onItemFocus(l):d.preventDefault()}),onFocus:T(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:T(e.onKeyDown,d=>{if(d.key==="Tab"&&d.shiftKey){u.onItemShiftTab();return}if(d.target!==d.currentTarget)return;const m=ot(d,u.orientation,u.dir);if(m!==void 0){d.preventDefault();let _=f().filter(h=>h.focusable).map(h=>h.ref.current);if(m==="last")_.reverse();else if(m==="prev"||m==="next"){m==="prev"&&_.reverse();const h=_.indexOf(d.currentTarget);_=u.loop?ct(_,h+1):_.slice(h+1)}setTimeout(()=>le(_))}})})))}),nt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rt(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ot(e,t,n){const o=rt(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return nt[o]}function le(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ct(e,t){return e.map((n,o)=>e[(t+o)%e.length])}const st=Je,at=tt;function it(e,t){return r.useReducer((n,o)=>{const a=t[n][o];return a??n},e)}const de=e=>{const{present:t,children:n}=e,o=ut(t),a=typeof n=="function"?n({present:o.isPresent}):r.Children.only(n),c=L(o.ref,a.ref);return typeof n=="function"||o.isPresent?r.cloneElement(a,{ref:c}):null};de.displayName="Presence";function ut(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),c=r.useRef("none"),s=e?"mounted":"unmounted",[i,l]=it(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const u=k(o.current);c.current=i==="mounted"?u:"none"},[i]),K(()=>{const u=o.current,p=a.current;if(p!==e){const $=c.current,v=k(u);e?l("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(p&&$!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),K(()=>{if(t){const u=f=>{const v=k(o.current).includes(f.animationName);f.target===t&&v&&Ce.flushSync(()=>l("ANIMATION_END"))},p=f=>{f.target===t&&(c.current=k(o.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:r.useCallback(u=>{u&&(o.current=getComputedStyle(u)),n(u)},[])}}function k(e){return(e==null?void 0:e.animationName)||"none"}const fe="Tabs",[lt,Dt]=Y(fe,[ue]),pe=ue(),[dt,X]=lt(fe),ft=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:a,defaultValue:c,orientation:s="horizontal",dir:i,activationMode:l="automatic",...u}=e,p=ae(i),[f,$]=se({prop:o,onChange:a,defaultProp:c});return r.createElement(dt,{scope:n,baseId:ce(),value:f,onValueChange:$,orientation:s,dir:p,activationMode:l},r.createElement(O.div,y({dir:p,"data-orientation":s},u,{ref:t})))}),pt="TabsList",bt=r.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...a}=e,c=X(pt,n),s=pe(n);return r.createElement(st,y({asChild:!0},s,{orientation:c.orientation,dir:c.dir,loop:o}),r.createElement(O.div,y({role:"tablist","aria-orientation":c.orientation},a,{ref:t})))}),$t="TabsTrigger",mt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:a=!1,...c}=e,s=X($t,n),i=pe(n),l=be(s.baseId,o),u=$e(s.baseId,o),p=o===s.value;return r.createElement(at,y({asChild:!0},i,{focusable:!a,active:p}),r.createElement(O.button,y({type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l},c,{ref:t,onMouseDown:T(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(o):f.preventDefault()}),onKeyDown:T(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(o)}),onFocus:T(e.onFocus,()=>{const f=s.activationMode!=="manual";!p&&!a&&f&&s.onValueChange(o)})})))}),vt="TabsContent",_t=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:a,children:c,...s}=e,i=X(vt,n),l=be(i.baseId,o),u=$e(i.baseId,o),p=o===i.value,f=r.useRef(p);return r.useEffect(()=>{const $=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame($)},[]),r.createElement(de,{present:a||p},({present:$})=>r.createElement(O.div,y({"data-state":p?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!$,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),$&&c))});function be(e,t){return`${e}-trigger-${t}`}function $e(e,t){return`${e}-content-${t}`}const ht=ft,gt=bt,xt=mt,Ct=_t;function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var me={exports:{}};/*!
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var c="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(c=a(c,o.call(this,i)))}return c}function o(c){if(typeof c=="string"||typeof c=="number")return this&&this[c]||c;if(typeof c!="object")return"";if(Array.isArray(c))return n.apply(this,c);if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]"))return c.toString();var s="";for(var i in c)t.call(c,i)&&c[i]&&(s=a(s,this&&this[i]||i));return s}function a(c,s){return s?c?c+" "+s:c+s:c}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(re);var ye=re.exports;const Se=we(ye),Ie={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},Te={name:"chevron-left",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M16.175 3.905a.9.9 0 0 1-.08 1.27L8.36 12l7.736 6.825a.9.9 0 0 1-1.191 1.35l-8.5-7.5a.9.9 0 0 1 0-1.35l8.5-7.5a.9.9 0 0 1 1.27.08Z" clip-rule="evenodd"/></svg>',keywords:["chevron-left"],category:"utility"},Ne={name:"chevron-right",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.809 3.924a.9.9 0 0 0 .115 1.267L16.094 12l-8.17 6.809a.9.9 0 0 0 1.152 1.382l9-7.5a.9.9 0 0 0 0-1.382l-9-7.5a.9.9 0 0 0-1.267.115Z" clip-rule="evenodd"/></svg>',keywords:["chevron-right"],category:"utility"},Re=Se.bind(Ie),ee="purpur-icon",Ae="md",Me=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),Pe=({content:e="",title:t}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},t?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],o=t?`<title>${t}</title>`:"";return`<svg ${Me(n)}>${o}${e}</svg>`},Oe=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),Fe=({["data-testid"]:e,svg:t,allyTitle:n,className:o="",size:a=Ae,...c})=>{const s=Pe({content:Oe(t.svg),title:n}),i=Re(o,ee,`${ee}--${a}`);return w.jsx("span",{"aria-label":n,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:s},...c})};function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y.apply(this,arguments)}function T(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Y(e,t=[]){let n=[];function o(c,s){const i=r.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:$,children:v,...d}=f,m=($==null?void 0:$[e][l])||i,h=r.useMemo(()=>d,Object.values(d));return r.createElement(m.Provider,{value:h},v)}function p(f,$){const v=($==null?void 0:$[e][l])||i,d=r.useContext(v);if(d)return d;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${c}\``)}return u.displayName=c+"Provider",[u,p]}const a=()=>{const c=n.map(s=>r.createContext(s));return function(i){const l=(i==null?void 0:i[e])||c;return r.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[o,De(a,...t)]}function De(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(c){const s=o.reduce((i,{useScope:l,scopeName:u})=>{const f=l(c)[`__scope${u}`];return{...i,...f}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function je(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function oe(...e){return t=>e.forEach(n=>je(n,t))}function U(...e){return r.useCallback(oe(...e),e)}const B=r.forwardRef((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),c=a.find(Ve);if(c){const s=c.props.children,i=a.map(l=>l===c?r.Children.count(s)>1?r.Children.only(null):r.isValidElement(s)?s.props.children:null:l);return r.createElement(z,y({},o,{ref:t}),r.isValidElement(s)?r.cloneElement(s,void 0,i):null)}return r.createElement(z,y({},o,{ref:t}),n)});B.displayName="Slot";const z=r.forwardRef((e,t)=>{const{children:n,...o}=e;return r.isValidElement(n)?r.cloneElement(n,{...Le(o,n.props),ref:t?oe(t,n.ref):n.ref}):r.Children.count(n)>1?r.Children.only(null):null});z.displayName="SlotClone";const qe=({children:e})=>r.createElement(r.Fragment,null,e);function Ve(e){return r.isValidElement(e)&&e.type===qe}function Le(e,t){const n={...t};for(const o in t){const a=e[o],c=t[o];/^on[A-Z]/.test(o)?a&&c?n[o]=(...i)=>{c(...i),a(...i)}:a&&(n[o]=a):o==="style"?n[o]={...a,...c}:o==="className"&&(n[o]=[a,c].filter(Boolean).join(" "))}return{...e,...n}}function Ue(e){const t=e+"CollectionProvider",[n,o]=Y(t),[a,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:d,children:m}=v,h=r.useRef(null),_=r.useRef(new Map).current;return r.createElement(a,{scope:d,itemMap:_,collectionRef:h},m)},i=e+"CollectionSlot",l=r.forwardRef((v,d)=>{const{scope:m,children:h}=v,_=c(i,m),g=U(d,_.collectionRef);return r.createElement(B,{ref:g},h)}),u=e+"CollectionItemSlot",p="data-radix-collection-item",f=r.forwardRef((v,d)=>{const{scope:m,children:h,..._}=v,g=r.useRef(null),M=U(d,g),S=c(u,m);return r.useEffect(()=>(S.itemMap.set(g,{ref:g,..._}),()=>void S.itemMap.delete(g))),r.createElement(B,{[p]:"",ref:M},h)});function $(v){const d=c(e+"CollectionConsumer",v);return r.useCallback(()=>{const h=d.collectionRef.current;if(!h)return[];const _=Array.from(h.querySelectorAll(`[${p}]`));return Array.from(d.itemMap.values()).sort((S,F)=>_.indexOf(S.ref.current)-_.indexOf(F.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},$,o]}const K=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{},Be=ne.useId||(()=>{});let ke=0;function ce(e){const[t,n]=ne.useState(Be());return K(()=>{e||n(o=>o??String(ke++))},[e]),e||(t?`radix-${t}`:"")}const Ge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],O=Ge.reduce((e,t)=>{const n=r.forwardRef((o,a)=>{const{asChild:c,...s}=o,i=c?B:t;return r.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),r.createElement(i,y({},s,{ref:a}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Z(e){const t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...n)=>{var o;return(o=t.current)===null||o===void 0?void 0:o.call(t,...n)},[])}function se({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,a]=ze({defaultProp:t,onChange:n}),c=e!==void 0,s=c?e:o,i=Z(n),l=r.useCallback(u=>{if(c){const f=typeof u=="function"?u(e):u;f!==e&&i(f)}else a(u)},[c,e,a,i]);return[s,l]}function ze({defaultProp:e,onChange:t}){const n=r.useState(e),[o]=n,a=r.useRef(o),c=Z(t);return r.useEffect(()=>{a.current!==o&&(c(o),a.current=o)},[o,a,c]),n}const Ke=r.createContext(void 0);function ae(e){const t=r.useContext(Ke);return e||t||"ltr"}const G="rovingFocusGroup.onEntryFocus",We={bubbles:!1,cancelable:!0},H="RovingFocusGroup",[W,ie,Ye]=Ue(H),[Ze,ue]=Y(H,[Ye]),[He,Xe]=Ze(H),Je=r.forwardRef((e,t)=>r.createElement(W.Provider,{scope:e.__scopeRovingFocusGroup},r.createElement(W.Slot,{scope:e.__scopeRovingFocusGroup},r.createElement(Qe,y({},e,{ref:t}))))),Qe=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:l,onEntryFocus:u,...p}=e,f=r.useRef(null),$=U(t,f),v=ae(c),[d=null,m]=se({prop:s,defaultProp:i,onChange:l}),[h,_]=r.useState(!1),g=Z(u),M=ie(n),S=r.useRef(!1),[F,D]=r.useState(0);return r.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(G,g),()=>C.removeEventListener(G,g)},[g]),r.createElement(He,{scope:n,orientation:o,dir:v,loop:a,currentTabStopId:d,onItemFocus:r.useCallback(C=>m(C),[m]),onItemShiftTab:r.useCallback(()=>_(!0),[]),onFocusableItemAdd:r.useCallback(()=>D(C=>C+1),[]),onFocusableItemRemove:r.useCallback(()=>D(C=>C-1),[])},r.createElement(O.div,y({tabIndex:h||F===0?-1:0,"data-orientation":o},p,{ref:$,style:{outline:"none",...e.style},onMouseDown:T(e.onMouseDown,()=>{S.current=!0}),onFocus:T(e.onFocus,C=>{const j=!S.current;if(C.target===C.currentTarget&&j&&!h){const P=new CustomEvent(G,We);if(C.currentTarget.dispatchEvent(P),!P.defaultPrevented){const q=M().filter(x=>x.focusable),k=q.find(x=>x.active),V=q.find(x=>x.id===d),E=[k,V,...q].filter(Boolean).map(x=>x.ref.current);le(E)}}S.current=!1}),onBlur:T(e.onBlur,()=>_(!1))})))}),et="RovingFocusGroupItem",tt=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:c,...s}=e,i=ce(),l=c||i,u=Xe(et,n),p=u.currentTabStopId===l,f=ie(n),{onFocusableItemAdd:$,onFocusableItemRemove:v}=u;return r.useEffect(()=>{if(o)return $(),()=>v()},[o,$,v]),r.createElement(W.ItemSlot,{scope:n,id:l,focusable:o,active:a},r.createElement(O.span,y({tabIndex:p?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:T(e.onMouseDown,d=>{o?u.onItemFocus(l):d.preventDefault()}),onFocus:T(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:T(e.onKeyDown,d=>{if(d.key==="Tab"&&d.shiftKey){u.onItemShiftTab();return}if(d.target!==d.currentTarget)return;const m=ot(d,u.orientation,u.dir);if(m!==void 0){d.preventDefault();let _=f().filter(g=>g.focusable).map(g=>g.ref.current);if(m==="last")_.reverse();else if(m==="prev"||m==="next"){m==="prev"&&_.reverse();const g=_.indexOf(d.currentTarget);_=u.loop?ct(_,g+1):_.slice(g+1)}setTimeout(()=>le(_))}})})))}),nt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rt(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ot(e,t,n){const o=rt(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return nt[o]}function le(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ct(e,t){return e.map((n,o)=>e[(t+o)%e.length])}const st=Je,at=tt;function it(e,t){return r.useReducer((n,o)=>{const a=t[n][o];return a??n},e)}const de=e=>{const{present:t,children:n}=e,o=ut(t),a=typeof n=="function"?n({present:o.isPresent}):r.Children.only(n),c=U(o.ref,a.ref);return typeof n=="function"||o.isPresent?r.cloneElement(a,{ref:c}):null};de.displayName="Presence";function ut(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),c=r.useRef("none"),s=e?"mounted":"unmounted",[i,l]=it(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const u=L(o.current);c.current=i==="mounted"?u:"none"},[i]),K(()=>{const u=o.current,p=a.current;if(p!==e){const $=c.current,v=L(u);e?l("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(p&&$!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),K(()=>{if(t){const u=f=>{const v=L(o.current).includes(f.animationName);f.target===t&&v&&Ce.flushSync(()=>l("ANIMATION_END"))},p=f=>{f.target===t&&(c.current=L(o.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:r.useCallback(u=>{u&&(o.current=getComputedStyle(u)),n(u)},[])}}function L(e){return(e==null?void 0:e.animationName)||"none"}const fe="Tabs",[lt,Dt]=Y(fe,[ue]),pe=ue(),[dt,X]=lt(fe),ft=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:a,defaultValue:c,orientation:s="horizontal",dir:i,activationMode:l="automatic",...u}=e,p=ae(i),[f,$]=se({prop:o,onChange:a,defaultProp:c});return r.createElement(dt,{scope:n,baseId:ce(),value:f,onValueChange:$,orientation:s,dir:p,activationMode:l},r.createElement(O.div,y({dir:p,"data-orientation":s},u,{ref:t})))}),pt="TabsList",bt=r.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...a}=e,c=X(pt,n),s=pe(n);return r.createElement(st,y({asChild:!0},s,{orientation:c.orientation,dir:c.dir,loop:o}),r.createElement(O.div,y({role:"tablist","aria-orientation":c.orientation},a,{ref:t})))}),$t="TabsTrigger",mt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:a=!1,...c}=e,s=X($t,n),i=pe(n),l=be(s.baseId,o),u=$e(s.baseId,o),p=o===s.value;return r.createElement(at,y({asChild:!0},i,{focusable:!a,active:p}),r.createElement(O.button,y({type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l},c,{ref:t,onMouseDown:T(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(o):f.preventDefault()}),onKeyDown:T(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(o)}),onFocus:T(e.onFocus,()=>{const f=s.activationMode!=="manual";!p&&!a&&f&&s.onValueChange(o)})})))}),vt="TabsContent",_t=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:a,children:c,...s}=e,i=X(vt,n),l=be(i.baseId,o),u=$e(i.baseId,o),p=o===i.value,f=r.useRef(p);return r.useEffect(()=>{const $=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame($)},[]),r.createElement(de,{present:a||p},({present:$})=>r.createElement(O.div,y({"data-state":p?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!$,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),$&&c))});function be(e,t){return`${e}-trigger-${t}`}function $e(e,t){return`${e}-content-${t}`}const gt=ft,ht=bt,xt=mt,Ct=_t;function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var me={exports:{}};/*!
|
|
6
6
|
Copyright (c) 2018 Jed Watson.
|
|
7
7
|
Licensed under the MIT License (MIT), see
|
|
8
8
|
http://jedwatson.github.io/classnames
|
|
9
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var c="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(c=a(c,o.call(this,i)))}return c}function o(c){if(typeof c=="string"||typeof c=="number")return this&&this[c]||c;if(typeof c!="object")return"";if(Array.isArray(c))return n.apply(this,c);if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]"))return c.toString();var s="";for(var i in c)t.call(c,i)&&c[i]&&(s=a(s,this&&this[i]||i));return s}function a(c,s){return s?c?c+" "+s:c+s:c}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(me);var wt=me.exports;const J=Et(wt),yt={"purpur-tab-content":"_purpur-tab-content_rbfjg_1"},St=J.bind(yt),It="purpur-tab-content",Tt=r.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,...a},c)=>w.jsx(Ct,{ref:c,className:St([It,o]),"data-testid":n,value:t,...a,children:e})),Nt=e=>!!e&&r.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Rt={"purpur-tab-header":"_purpur-tab-
|
|
9
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var c="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(c=a(c,o.call(this,i)))}return c}function o(c){if(typeof c=="string"||typeof c=="number")return this&&this[c]||c;if(typeof c!="object")return"";if(Array.isArray(c))return n.apply(this,c);if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]"))return c.toString();var s="";for(var i in c)t.call(c,i)&&c[i]&&(s=a(s,this&&this[i]||i));return s}function a(c,s){return s?c?c+" "+s:c+s:c}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(me);var wt=me.exports;const J=Et(wt),yt={"purpur-tab-content":"_purpur-tab-content_rbfjg_1"},St=J.bind(yt),It="purpur-tab-content",Tt=r.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,...a},c)=>w.jsx(Ct,{ref:c,className:St([It,o]),"data-testid":n,value:t,...a,children:e})),Nt=e=>!!e&&r.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Rt={"purpur-tab-header":"_purpur-tab-header_ls5xt_1","purpur-tab-header--contained":"_purpur-tab-header--contained_ls5xt_32","purpur-tab-header--contained-negative":"_purpur-tab-header--contained-negative_ls5xt_32","purpur-tab-header--line":"_purpur-tab-header--line_ls5xt_35","purpur-tab-header--line-negative":"_purpur-tab-header--line-negative_ls5xt_47"},At=J.bind(Rt),te="purpur-tab-header",Mt=r.forwardRef(({index:e,tabId:t,variant:n,onFocus:o,"data-testid":a,children:c},s)=>w.jsx(xt,{id:`${t}-trigger`,className:At([te,`${te}--${n}`]),value:t,"data-testid":a,"data-index":e,ref:s,onFocus:o,children:c})),Pt={"purpur-tabs__wrapper":"_purpur-tabs__wrapper_1dpqy_1","purpur-tabs__scroll-button":"_purpur-tabs__scroll-button_1dpqy_9","purpur-tabs__scroll-button--left":"_purpur-tabs__scroll-button--left_1dpqy_63","purpur-tabs__scroll-button--right":"_purpur-tabs__scroll-button--right_1dpqy_66","purpur-tabs__wrapper--scroll-end":"_purpur-tabs__wrapper--scroll-end_1dpqy_69","purpur-tabs__wrapper--scroll-start":"_purpur-tabs__wrapper--scroll-start_1dpqy_72","purpur-tabs--line":"_purpur-tabs--line_1dpqy_75","purpur-tabs--line-negative":"_purpur-tabs--line-negative_1dpqy_75","purpur-tabs__selected-border":"_purpur-tabs__selected-border_1dpqy_83","purpur-tabs--contained":"_purpur-tabs--contained_1dpqy_103","purpur-tabs__list":"_purpur-tabs__list_1dpqy_103","purpur-tabs--contained-negative":"_purpur-tabs--contained-negative_1dpqy_103","purpur-tabs__content-container":"_purpur-tabs__content-container_1dpqy_106","purpur-tabs--fullWidth":"_purpur-tabs--fullWidth_1dpqy_115"},Ot=["line","line-negative","contained","contained-negative"],ve=e=>new CustomEvent("tabChangeDetail",{detail:{value:e}}),A=J.bind(Pt),I="purpur-tabs",Ft=(e,t)=>{var l;if(typeof(e==null?void 0:e.getBoundingClientRect)!="function"||typeof(t==null?void 0:t.scroll)!="function")return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),a=t.clientWidth,c=parseInt((l=getComputedStyle(t).borderLeftWidth)==null?void 0:l.split("px")[0],10),s=o.left+(isNaN(c)?0:c);let i;n.right>o.right&&(i=n.left+t.scrollLeft,i=i+n.width-a+a*.1,i=i-s),n.left<o.left&&(i=n.left+t.scrollLeft,i=i-a*.1,i=i-s),i!==void 0&&t.scroll({left:i,behavior:"smooth"})},_e=({children:e,variant:t="line",fullWidth:n=!1,onChange:o,className:a,defaultValue:c,"data-testid":s,...i})=>{const[l,u]=r.useState({}),[p,f]=r.useState(0),[$,v]=r.useState(0),d=r.Children.toArray(e).filter(Nt),m=r.useRef(),h=r.useRef(new Array(d.length)),_=200,g=t==="line"||t==="line-negative",M=A([I,`${I}--${t}`,{[`${I}--fullWidth`]:n},a]),S=r.Children.map(d,({props:{tabId:b}})=>b),F=()=>S.findIndex(b=>b===c)||0,[D,C]=r.useState(F);if(new Set(S).size!==S.length)throw new Error("tabId must be unique");const j=(b,E)=>E||s?`${E||s}-${b}`:void 0,P=()=>{if(!g)return;const b=h.current[D];f((b==null?void 0:b.offsetLeft)||0),v((b==null?void 0:b.getBoundingClientRect().width)||0)},q=b=>{g&&C(d.findIndex(E=>E.props.tabId===b)),o==null||o(ve(b))},k=b=>{if(m!=null&&m.current){const{scrollLeft:E}=m.current,x=b==="left"?-_:_;m.current.scroll({left:E+x,behavior:"smooth"})}},V=({side:b})=>w.jsx("button",{className:A(`${I}__scroll-button`,`${I}__scroll-button--${b}`),onClick:()=>k(b),type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":j("scroll-button"),children:w.jsx(Fe,{svg:b==="left"?Te:Ne,size:"md"})});return r.useEffect(()=>(window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)}),[]),r.useEffect(()=>{P()},[D,n,d,t]),r.useEffect(()=>{const b=x=>{if(x.every(N=>N.isIntersecting)&&x.length===d.length){u({});return}x.forEach(N=>{const R=Number(N.target.getAttribute("data-index")),ge=R===0,he=R===d.length-1;u(xe=>({...xe,...ge&&{[`${I}__wrapper--scroll-end`]:!N.isIntersecting},...he&&{[`${I}__wrapper--scroll-start`]:!N.isIntersecting}}))})},E=new IntersectionObserver(b,{threshold:[.99],root:m.current});return h.current.forEach(x=>E.observe(x)),()=>{h.current.forEach(x=>E.unobserve(x))}},[d.length]),w.jsx(gt,{defaultValue:c,onValueChange:q,"data-testid":s,className:M,...i,children:w.jsxs("div",{className:A(`${I}__container`),children:[w.jsxs("div",{className:A([`${I}__wrapper`,l]),children:[w.jsxs(ht,{ref:b=>{m.current=b},className:A(`${I}__list`),children:[r.Children.map(d,(b,E)=>{const{name:x,tabId:Q,"data-testid":N}=b.props;return w.jsx(Mt,{"data-testid":j("header",N),index:E,tabId:Q,ref:R=>{R&&(h.current[E]=R)},onFocus:R=>{Ft(R.target,m.current)},variant:t,children:x})}),g&&w.jsx("div",{className:A(`${I}__selected-border`),style:{width:$,transform:`translateX(${p}px)`},"data-testid":j("selected-border")})]}),w.jsx(V,{side:"left"}),w.jsx(V,{side:"right"})]}),w.jsx("div",{className:A(`${I}__content-container`),children:r.Children.map(d,b=>b)})]})})};_e.Content=Tt;exports.Tabs=_e;exports.createTabChangeDetailEvent=ve;exports.tabsVariants=Ot;
|
|
10
10
|
//# sourceMappingURL=tabs.cjs.js.map
|
package/dist/tabs.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as N, jsxs as Q } from "react/jsx-runtime";
|
|
2
2
|
import * as be from "react";
|
|
3
|
-
import A, { createContext as te, useMemo as Z, createElement as
|
|
3
|
+
import A, { createContext as te, useMemo as Z, createElement as g, useContext as $e, useCallback as L, forwardRef as T, Children as E, isValidElement as K, cloneElement as ce, Fragment as Me, useLayoutEffect as Oe, useEffect as R, useRef as P, useState as O, useReducer as Fe } from "react";
|
|
4
4
|
import { flushSync as De } from "react-dom";
|
|
5
5
|
function qe(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -116,12 +116,12 @@ function se(e, t = []) {
|
|
|
116
116
|
c
|
|
117
117
|
];
|
|
118
118
|
function i(d) {
|
|
119
|
-
const { scope: b, children: v, ...l } = d, $ = (b == null ? void 0 : b[e][u]) || a,
|
|
119
|
+
const { scope: b, children: v, ...l } = d, $ = (b == null ? void 0 : b[e][u]) || a, h = Z(
|
|
120
120
|
() => l,
|
|
121
121
|
Object.values(l)
|
|
122
122
|
);
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
value:
|
|
123
|
+
return /* @__PURE__ */ g($.Provider, {
|
|
124
|
+
value: h
|
|
125
125
|
}, v);
|
|
126
126
|
}
|
|
127
127
|
function f(d, b) {
|
|
@@ -206,11 +206,11 @@ const X = /* @__PURE__ */ T((e, t) => {
|
|
|
206
206
|
const { children: n, ...o } = e, s = E.toArray(n), r = s.find(Je);
|
|
207
207
|
if (r) {
|
|
208
208
|
const c = r.props.children, a = s.map((u) => u === r ? E.count(c) > 1 ? E.only(null) : /* @__PURE__ */ K(c) ? c.props.children : null : u);
|
|
209
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ g(ne, y({}, o, {
|
|
210
210
|
ref: t
|
|
211
211
|
}), /* @__PURE__ */ K(c) ? /* @__PURE__ */ ce(c, void 0, a) : null);
|
|
212
212
|
}
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ g(ne, y({}, o, {
|
|
214
214
|
ref: t
|
|
215
215
|
}), n);
|
|
216
216
|
});
|
|
@@ -223,7 +223,7 @@ const ne = /* @__PURE__ */ T((e, t) => {
|
|
|
223
223
|
}) : E.count(n) > 1 ? E.only(null) : null;
|
|
224
224
|
});
|
|
225
225
|
ne.displayName = "SlotClone";
|
|
226
|
-
const Xe = ({ children: e }) => /* @__PURE__ */
|
|
226
|
+
const Xe = ({ children: e }) => /* @__PURE__ */ g(Me, null, e);
|
|
227
227
|
function Je(e) {
|
|
228
228
|
return /* @__PURE__ */ K(e) && e.type === Xe;
|
|
229
229
|
}
|
|
@@ -255,34 +255,34 @@ function et(e) {
|
|
|
255
255
|
},
|
|
256
256
|
itemMap: /* @__PURE__ */ new Map()
|
|
257
257
|
}), c = (v) => {
|
|
258
|
-
const { scope: l, children: $ } = v,
|
|
258
|
+
const { scope: l, children: $ } = v, h = A.useRef(null), m = A.useRef(/* @__PURE__ */ new Map()).current;
|
|
259
259
|
return /* @__PURE__ */ A.createElement(s, {
|
|
260
260
|
scope: l,
|
|
261
261
|
itemMap: m,
|
|
262
|
-
collectionRef:
|
|
262
|
+
collectionRef: h
|
|
263
263
|
}, $);
|
|
264
264
|
}, a = e + "CollectionSlot", u = /* @__PURE__ */ A.forwardRef((v, l) => {
|
|
265
|
-
const { scope: $, children:
|
|
265
|
+
const { scope: $, children: h } = v, m = r(a, $), _ = H(l, m.collectionRef);
|
|
266
266
|
return /* @__PURE__ */ A.createElement(X, {
|
|
267
267
|
ref: _
|
|
268
|
-
},
|
|
268
|
+
}, h);
|
|
269
269
|
}), i = e + "CollectionItemSlot", f = "data-radix-collection-item", d = /* @__PURE__ */ A.forwardRef((v, l) => {
|
|
270
|
-
const { scope: $, children:
|
|
270
|
+
const { scope: $, children: h, ...m } = v, _ = A.useRef(null), U = H(l, _), S = r(i, $);
|
|
271
271
|
return A.useEffect(() => (S.itemMap.set(_, {
|
|
272
272
|
ref: _,
|
|
273
273
|
...m
|
|
274
274
|
}), () => void S.itemMap.delete(_))), /* @__PURE__ */ A.createElement(X, {
|
|
275
275
|
[f]: "",
|
|
276
276
|
ref: U
|
|
277
|
-
},
|
|
277
|
+
}, h);
|
|
278
278
|
});
|
|
279
279
|
function b(v) {
|
|
280
280
|
const l = r(e + "CollectionConsumer", v);
|
|
281
281
|
return A.useCallback(() => {
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
282
|
+
const h = l.collectionRef.current;
|
|
283
|
+
if (!h)
|
|
284
284
|
return [];
|
|
285
|
-
const m = Array.from(
|
|
285
|
+
const m = Array.from(h.querySelectorAll(`[${f}]`));
|
|
286
286
|
return Array.from(l.itemMap.values()).sort(
|
|
287
287
|
(S, j) => m.indexOf(S.ref.current) - m.indexOf(j.ref.current)
|
|
288
288
|
);
|
|
@@ -337,7 +337,7 @@ const rt = [
|
|
|
337
337
|
const { asChild: r, ...c } = o, a = r ? X : t;
|
|
338
338
|
return R(() => {
|
|
339
339
|
window[Symbol.for("radix-ui")] = !0;
|
|
340
|
-
}, []), /* @__PURE__ */
|
|
340
|
+
}, []), /* @__PURE__ */ g(a, y({}, c, {
|
|
341
341
|
ref: s
|
|
342
342
|
}));
|
|
343
343
|
});
|
|
@@ -358,7 +358,7 @@ function ae(e) {
|
|
|
358
358
|
[]
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function ge({ prop: e, defaultProp: t, onChange: n = () => {
|
|
362
362
|
} }) {
|
|
363
363
|
const [o, s] = ot({
|
|
364
364
|
defaultProp: t,
|
|
@@ -391,7 +391,7 @@ function ot({ defaultProp: e, onChange: t }) {
|
|
|
391
391
|
]), n;
|
|
392
392
|
}
|
|
393
393
|
const ct = /* @__PURE__ */ te(void 0);
|
|
394
|
-
function
|
|
394
|
+
function he(e) {
|
|
395
395
|
const t = $e(ct);
|
|
396
396
|
return e || t || "ltr";
|
|
397
397
|
}
|
|
@@ -400,25 +400,25 @@ const ee = "rovingFocusGroup.onEntryFocus", st = {
|
|
|
400
400
|
cancelable: !0
|
|
401
401
|
}, ie = "RovingFocusGroup", [oe, xe, at] = et(ie), [it, Ce] = se(ie, [
|
|
402
402
|
at
|
|
403
|
-
]), [ut, lt] = it(ie), dt = /* @__PURE__ */ T((e, t) => /* @__PURE__ */
|
|
403
|
+
]), [ut, lt] = it(ie), dt = /* @__PURE__ */ T((e, t) => /* @__PURE__ */ g(oe.Provider, {
|
|
404
404
|
scope: e.__scopeRovingFocusGroup
|
|
405
|
-
}, /* @__PURE__ */
|
|
405
|
+
}, /* @__PURE__ */ g(oe.Slot, {
|
|
406
406
|
scope: e.__scopeRovingFocusGroup
|
|
407
|
-
}, /* @__PURE__ */
|
|
407
|
+
}, /* @__PURE__ */ g(ft, y({}, e, {
|
|
408
408
|
ref: t
|
|
409
409
|
}))))), ft = /* @__PURE__ */ T((e, t) => {
|
|
410
|
-
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...f } = e, d = P(null), b = H(t, d), v =
|
|
410
|
+
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...f } = e, d = P(null), b = H(t, d), v = he(r), [l = null, $] = ge({
|
|
411
411
|
prop: c,
|
|
412
412
|
defaultProp: a,
|
|
413
413
|
onChange: u
|
|
414
|
-
}), [
|
|
414
|
+
}), [h, m] = O(!1), _ = ae(i), U = xe(n), S = P(!1), [j, G] = O(0);
|
|
415
415
|
return R(() => {
|
|
416
416
|
const C = d.current;
|
|
417
417
|
if (C)
|
|
418
418
|
return C.addEventListener(ee, _), () => C.removeEventListener(ee, _);
|
|
419
419
|
}, [
|
|
420
420
|
_
|
|
421
|
-
]), /* @__PURE__ */
|
|
421
|
+
]), /* @__PURE__ */ g(ut, {
|
|
422
422
|
scope: n,
|
|
423
423
|
orientation: o,
|
|
424
424
|
dir: v,
|
|
@@ -446,8 +446,8 @@ const ee = "rovingFocusGroup.onEntryFocus", st = {
|
|
|
446
446
|
),
|
|
447
447
|
[]
|
|
448
448
|
)
|
|
449
|
-
}, /* @__PURE__ */
|
|
450
|
-
tabIndex:
|
|
449
|
+
}, /* @__PURE__ */ g(B.div, y({
|
|
450
|
+
tabIndex: h || j === 0 ? -1 : 0,
|
|
451
451
|
"data-orientation": o
|
|
452
452
|
}, f, {
|
|
453
453
|
ref: b,
|
|
@@ -460,7 +460,7 @@ const ee = "rovingFocusGroup.onEntryFocus", st = {
|
|
|
460
460
|
}),
|
|
461
461
|
onFocus: M(e.onFocus, (C) => {
|
|
462
462
|
const k = !S.current;
|
|
463
|
-
if (C.target === C.currentTarget && k && !
|
|
463
|
+
if (C.target === C.currentTarget && k && !h) {
|
|
464
464
|
const V = new CustomEvent(ee, st);
|
|
465
465
|
if (C.currentTarget.dispatchEvent(V), !V.defaultPrevented) {
|
|
466
466
|
const z = U().filter(
|
|
@@ -495,12 +495,12 @@ const ee = "rovingFocusGroup.onEntryFocus", st = {
|
|
|
495
495
|
o,
|
|
496
496
|
b,
|
|
497
497
|
v
|
|
498
|
-
]), /* @__PURE__ */
|
|
498
|
+
]), /* @__PURE__ */ g(oe.ItemSlot, {
|
|
499
499
|
scope: n,
|
|
500
500
|
id: u,
|
|
501
501
|
focusable: o,
|
|
502
502
|
active: s
|
|
503
|
-
}, /* @__PURE__ */
|
|
503
|
+
}, /* @__PURE__ */ g(B.span, y({
|
|
504
504
|
tabIndex: f ? 0 : -1,
|
|
505
505
|
"data-orientation": i.orientation
|
|
506
506
|
}, c, {
|
|
@@ -575,7 +575,7 @@ function _t(e, t) {
|
|
|
575
575
|
(n, o) => e[(t + o) % e.length]
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
|
-
const
|
|
578
|
+
const gt = dt, ht = bt;
|
|
579
579
|
function xt(e, t) {
|
|
580
580
|
return Fe((n, o) => {
|
|
581
581
|
const s = t[n][o];
|
|
@@ -653,12 +653,12 @@ function Y(e) {
|
|
|
653
653
|
const Se = "Tabs", [It, Qt] = se(Se, [
|
|
654
654
|
Ce
|
|
655
655
|
]), we = Ce(), [yt, ue] = It(Se), St = /* @__PURE__ */ T((e, t) => {
|
|
656
|
-
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, f =
|
|
656
|
+
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, f = he(a), [d, b] = ge({
|
|
657
657
|
prop: o,
|
|
658
658
|
onChange: s,
|
|
659
659
|
defaultProp: r
|
|
660
660
|
});
|
|
661
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ g(yt, {
|
|
662
662
|
scope: n,
|
|
663
663
|
baseId: _e(),
|
|
664
664
|
value: d,
|
|
@@ -666,7 +666,7 @@ const Se = "Tabs", [It, Qt] = se(Se, [
|
|
|
666
666
|
orientation: c,
|
|
667
667
|
dir: f,
|
|
668
668
|
activationMode: u
|
|
669
|
-
}, /* @__PURE__ */
|
|
669
|
+
}, /* @__PURE__ */ g(B.div, y({
|
|
670
670
|
dir: f,
|
|
671
671
|
"data-orientation": c
|
|
672
672
|
}, i, {
|
|
@@ -674,13 +674,13 @@ const Se = "Tabs", [It, Qt] = se(Se, [
|
|
|
674
674
|
})));
|
|
675
675
|
}), wt = "TabsList", Tt = /* @__PURE__ */ T((e, t) => {
|
|
676
676
|
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = ue(wt, n), c = we(n);
|
|
677
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ g(gt, y({
|
|
678
678
|
asChild: !0
|
|
679
679
|
}, c, {
|
|
680
680
|
orientation: r.orientation,
|
|
681
681
|
dir: r.dir,
|
|
682
682
|
loop: o
|
|
683
|
-
}), /* @__PURE__ */
|
|
683
|
+
}), /* @__PURE__ */ g(B.div, y({
|
|
684
684
|
role: "tablist",
|
|
685
685
|
"aria-orientation": r.orientation
|
|
686
686
|
}, s, {
|
|
@@ -688,12 +688,12 @@ const Se = "Tabs", [It, Qt] = se(Se, [
|
|
|
688
688
|
})));
|
|
689
689
|
}), Nt = "TabsTrigger", At = /* @__PURE__ */ T((e, t) => {
|
|
690
690
|
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c = ue(Nt, n), a = we(n), u = Te(c.baseId, o), i = Ne(c.baseId, o), f = o === c.value;
|
|
691
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ g(ht, y({
|
|
692
692
|
asChild: !0
|
|
693
693
|
}, a, {
|
|
694
694
|
focusable: !s,
|
|
695
695
|
active: f
|
|
696
|
-
}), /* @__PURE__ */
|
|
696
|
+
}), /* @__PURE__ */ g(B.button, y({
|
|
697
697
|
type: "button",
|
|
698
698
|
role: "tab",
|
|
699
699
|
"aria-selected": f,
|
|
@@ -725,12 +725,12 @@ const Se = "Tabs", [It, Qt] = se(Se, [
|
|
|
725
725
|
() => d.current = !1
|
|
726
726
|
);
|
|
727
727
|
return () => cancelAnimationFrame(b);
|
|
728
|
-
}, []), /* @__PURE__ */
|
|
728
|
+
}, []), /* @__PURE__ */ g(
|
|
729
729
|
ye,
|
|
730
730
|
{
|
|
731
731
|
present: s || f
|
|
732
732
|
},
|
|
733
|
-
({ present: b }) => /* @__PURE__ */
|
|
733
|
+
({ present: b }) => /* @__PURE__ */ g(B.div, y({
|
|
734
734
|
"data-state": f ? "active" : "inactive",
|
|
735
735
|
"data-orientation": a.orientation,
|
|
736
736
|
role: "tabpanel",
|
|
@@ -809,11 +809,11 @@ const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
|
809
809
|
}
|
|
810
810
|
)
|
|
811
811
|
), jt = (e) => !!e && K(e) && !!e.props.name && !!e.props.tabId, Gt = {
|
|
812
|
-
"purpur-tab-header": "_purpur-tab-
|
|
813
|
-
"purpur-tab-header--contained": "_purpur-tab-header--
|
|
814
|
-
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-
|
|
815
|
-
"purpur-tab-header--line": "_purpur-tab-header--
|
|
816
|
-
"purpur-tab-header--line-negative": "_purpur-tab-header--line-
|
|
812
|
+
"purpur-tab-header": "_purpur-tab-header_ls5xt_1",
|
|
813
|
+
"purpur-tab-header--contained": "_purpur-tab-header--contained_ls5xt_32",
|
|
814
|
+
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_ls5xt_32",
|
|
815
|
+
"purpur-tab-header--line": "_purpur-tab-header--line_ls5xt_35",
|
|
816
|
+
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_ls5xt_47"
|
|
817
817
|
}, kt = le.bind(Gt), pe = "purpur-tab-header", zt = T(
|
|
818
818
|
({ index: e, tabId: t, variant: n, onFocus: o, "data-testid": s, children: r }, c) => /* @__PURE__ */ N(
|
|
819
819
|
Ot,
|
|
@@ -860,7 +860,7 @@ const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
|
860
860
|
"data-testid": c,
|
|
861
861
|
...a
|
|
862
862
|
}) => {
|
|
863
|
-
const [u, i] = O({}), [f, d] = O(0), [b, v] = O(0), l = E.toArray(e).filter(jt), $ = P(),
|
|
863
|
+
const [u, i] = O({}), [f, d] = O(0), [b, v] = O(0), l = E.toArray(e).filter(jt), $ = P(), h = P(new Array(l.length)), m = 200, _ = t === "line" || t === "line-negative", U = q([
|
|
864
864
|
w,
|
|
865
865
|
`${w}--${t}`,
|
|
866
866
|
{ [`${w}--fullWidth`]: n },
|
|
@@ -871,7 +871,7 @@ const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
|
871
871
|
const k = (p, I) => I || c ? `${I || c}-${p}` : void 0, V = () => {
|
|
872
872
|
if (!_)
|
|
873
873
|
return;
|
|
874
|
-
const p =
|
|
874
|
+
const p = h.current[G];
|
|
875
875
|
d((p == null ? void 0 : p.offsetLeft) || 0), v((p == null ? void 0 : p.getBoundingClientRect().width) || 0);
|
|
876
876
|
}, z = (p) => {
|
|
877
877
|
_ && C(l.findIndex((I) => I.props.tabId === p)), o == null || o(Wt(p));
|
|
@@ -918,8 +918,8 @@ const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
|
918
918
|
threshold: [0.99],
|
|
919
919
|
root: $.current
|
|
920
920
|
});
|
|
921
|
-
return
|
|
922
|
-
|
|
921
|
+
return h.current.forEach((x) => I.observe(x)), () => {
|
|
922
|
+
h.current.forEach((x) => I.unobserve(x));
|
|
923
923
|
};
|
|
924
924
|
}, [l.length]), /* @__PURE__ */ N(
|
|
925
925
|
Pt,
|
|
@@ -948,7 +948,7 @@ const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
|
948
948
|
index: I,
|
|
949
949
|
tabId: de,
|
|
950
950
|
ref: (D) => {
|
|
951
|
-
D && (
|
|
951
|
+
D && (h.current[I] = D);
|
|
952
952
|
},
|
|
953
953
|
onFocus: (D) => {
|
|
954
954
|
Yt(D.target, $.current);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/tabs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/tabs.cjs.js",
|
|
6
6
|
"types": "./dist/tabs.d.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"classnames": "~2.5.0",
|
|
18
18
|
"@radix-ui/react-tabs": "~1.0.4",
|
|
19
|
-
"@purpurds/tokens": "4.
|
|
20
|
-
"@purpurds/
|
|
21
|
-
"@purpurds/
|
|
19
|
+
"@purpurds/tokens": "4.5.0",
|
|
20
|
+
"@purpurds/paragraph": "4.5.0",
|
|
21
|
+
"@purpurds/icon": "4.5.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@rushstack/eslint-patch": "~1.10.0",
|