@purpurds/tabs 5.27.2 → 5.27.4

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 CHANGED
@@ -1,12 +1,12 @@
1
1
  Name: @purpurds/icon
2
- Version: 5.27.1
2
+ Version: 5.27.3
3
3
  License: AGPL-3.0-only
4
4
  Private: false
5
5
 
6
6
  ---
7
7
 
8
8
  Name: @babel/runtime
9
- Version: 7.26.0
9
+ Version: 7.25.6
10
10
  License: MIT
11
11
  Private: false
12
12
  Description: babel's modular runtime helpers
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})()})(se);var Ne=se.exports;const Re=Te(Ne),Ae={"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"},Pe={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"},Me={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"},Oe=Re.bind(Ae),re="purpur-icon",Fe="md",De=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),je=({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 ${De(n)}>${o}${e}</svg>`},qe=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ae=({["data-testid"]:e,svg:t,allyTitle:n,className:o,size:a=Fe,...c})=>{const s=je({content:qe(t.svg),title:n}),i=Oe(o,re,`${re}--${a}`);return E.jsx("span",{"aria-label":n,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:s},...c})};ae.displayName="Icon";function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},I.apply(null,arguments)}function N(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 Z(e,t=[]){let n=[];function o(c,s){const i=r.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:v,children:_,...p}=f,h=(v==null?void 0:v[e][l])||i,m=r.useMemo(()=>p,Object.values(p));return r.createElement(h.Provider,{value:m},_)}function b(f,v){const _=(v==null?void 0:v[e][l])||i,p=r.useContext(_);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${c}\``)}return u.displayName=c+"Provider",[u,b]}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,Ve(a,...t)]}function Ve(...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 Le(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ie(...e){return t=>e.forEach(n=>Le(n,t))}function k(...e){return r.useCallback(ie(...e),e)}const B=r.forwardRef((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),c=a.find(ke);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(K,I({},o,{ref:t}),r.isValidElement(s)?r.cloneElement(s,void 0,i):null)}return r.createElement(K,I({},o,{ref:t}),n)});B.displayName="Slot";const K=r.forwardRef((e,t)=>{const{children:n,...o}=e;return r.isValidElement(n)?r.cloneElement(n,{...Be(o,n.props),ref:t?ie(t,n.ref):n.ref}):r.Children.count(n)>1?r.Children.only(null):null});K.displayName="SlotClone";const Ue=({children:e})=>r.createElement(r.Fragment,null,e);function ke(e){return r.isValidElement(e)&&e.type===Ue}function Be(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 Ge(e){const t=e+"CollectionProvider",[n,o]=Z(t),[a,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=_=>{const{scope:p,children:h}=_,m=r.useRef(null),$=r.useRef(new Map).current;return r.createElement(a,{scope:p,itemMap:$,collectionRef:m},h)},i=e+"CollectionSlot",l=r.forwardRef((_,p)=>{const{scope:h,children:m}=_,$=c(i,h),g=k(p,$.collectionRef);return r.createElement(B,{ref:g},m)}),u=e+"CollectionItemSlot",b="data-radix-collection-item",f=r.forwardRef((_,p)=>{const{scope:h,children:m,...$}=_,g=r.useRef(null),R=k(p,g),y=c(u,h);return r.useEffect(()=>(y.itemMap.set(g,{ref:g,...$}),()=>void y.itemMap.delete(g))),r.createElement(B,{[b]:"",ref:R},m)});function v(_){const p=c(e+"CollectionConsumer",_);return r.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const $=Array.from(m.querySelectorAll(`[${b}]`));return Array.from(p.itemMap.values()).sort((y,D)=>$.indexOf(y.ref.current)-$.indexOf(D.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},v,o]}const W=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{},ze=ce.useId||(()=>{});let Ke=0;function ue(e){const[t,n]=ce.useState(ze());return W(()=>{n(o=>o??String(Ke++))},[e]),t?`radix-${t}`:""}const We=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],F=We.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,I({},s,{ref:a}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function H(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 le({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,a]=Ye({defaultProp:t,onChange:n}),c=e!==void 0,s=c?e:o,i=H(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 Ye({defaultProp:e,onChange:t}){const n=r.useState(e),[o]=n,a=r.useRef(o),c=H(t);return r.useEffect(()=>{a.current!==o&&(c(o),a.current=o)},[o,a,c]),n}const Ze=r.createContext(void 0);function de(e){const t=r.useContext(Ze);return e||t||"ltr"}const z="rovingFocusGroup.onEntryFocus",He={bubbles:!1,cancelable:!0},X="RovingFocusGroup",[Y,fe,Xe]=Ge(X),[Je,pe]=Z(X,[Xe]),[Qe,et]=Je(X),tt=r.forwardRef((e,t)=>r.createElement(Y.Provider,{scope:e.__scopeRovingFocusGroup},r.createElement(Y.Slot,{scope:e.__scopeRovingFocusGroup},r.createElement(nt,I({},e,{ref:t}))))),nt=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:l,onEntryFocus:u,...b}=e,f=r.useRef(null),v=k(t,f),_=de(c),[p=null,h]=le({prop:s,defaultProp:i,onChange:l}),[m,$]=r.useState(!1),g=H(u),R=fe(n),y=r.useRef(!1),[D,M]=r.useState(0);return r.useEffect(()=>{const x=f.current;if(x)return x.addEventListener(z,g),()=>x.removeEventListener(z,g)},[g]),r.createElement(Qe,{scope:n,orientation:o,dir:_,loop:a,currentTabStopId:p,onItemFocus:r.useCallback(x=>h(x),[h]),onItemShiftTab:r.useCallback(()=>$(!0),[]),onFocusableItemAdd:r.useCallback(()=>M(x=>x+1),[]),onFocusableItemRemove:r.useCallback(()=>M(x=>x-1),[])},r.createElement(F.div,I({tabIndex:m||D===0?-1:0,"data-orientation":o},b,{ref:v,style:{outline:"none",...e.style},onMouseDown:N(e.onMouseDown,()=>{y.current=!0}),onFocus:N(e.onFocus,x=>{const V=!y.current;if(x.target===x.currentTarget&&V&&!m){const j=new CustomEvent(z,He);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const A=R().filter(d=>d.focusable),q=A.find(d=>d.active),G=A.find(d=>d.id===p),L=[q,G,...A].filter(Boolean).map(d=>d.ref.current);be(L)}}y.current=!1}),onBlur:N(e.onBlur,()=>$(!1))})))}),rt="RovingFocusGroupItem",ot=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:c,...s}=e,i=ue(),l=c||i,u=et(rt,n),b=u.currentTabStopId===l,f=fe(n),{onFocusableItemAdd:v,onFocusableItemRemove:_}=u;return r.useEffect(()=>{if(o)return v(),()=>_()},[o,v,_]),r.createElement(Y.ItemSlot,{scope:n,id:l,focusable:o,active:a},r.createElement(F.span,I({tabIndex:b?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:N(e.onMouseDown,p=>{o?u.onItemFocus(l):p.preventDefault()}),onFocus:N(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:N(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const h=at(p,u.orientation,u.dir);if(h!==void 0){p.preventDefault();let $=f().filter(g=>g.focusable).map(g=>g.ref.current);if(h==="last")$.reverse();else if(h==="prev"||h==="next"){h==="prev"&&$.reverse();const g=$.indexOf(p.currentTarget);$=u.loop?it($,g+1):$.slice(g+1)}setTimeout(()=>be($))}})})))}),ct={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function st(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function at(e,t,n){const o=st(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ct[o]}function be(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function it(e,t){return e.map((n,o)=>e[(t+o)%e.length])}const ut=tt,lt=ot;function dt(e,t){return r.useReducer((n,o)=>{const a=t[n][o];return a??n},e)}const $e=e=>{const{present:t,children:n}=e,o=ft(t),a=typeof n=="function"?n({present:o.isPresent}):r.Children.only(n),c=k(o.ref,a.ref);return typeof n=="function"||o.isPresent?r.cloneElement(a,{ref:c}):null};$e.displayName="Presence";function ft(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),c=r.useRef("none"),s=e?"mounted":"unmounted",[i,l]=dt(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const u=U(o.current);c.current=i==="mounted"?u:"none"},[i]),W(()=>{const u=o.current,b=a.current;if(b!==e){const v=c.current,_=U(u);e?l("MOUNT"):_==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(b&&v!==_?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),W(()=>{if(t){const u=f=>{const _=U(o.current).includes(f.animationName);f.target===t&&_&&we.flushSync(()=>l("ANIMATION_END"))},b=f=>{f.target===t&&(c.current=U(o.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",b),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 U(e){return(e==null?void 0:e.animationName)||"none"}const me="Tabs",[pt,Vt]=Z(me,[pe]),ve=pe(),[bt,J]=pt(me),$t=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:a,defaultValue:c,orientation:s="horizontal",dir:i,activationMode:l="automatic",...u}=e,b=de(i),[f,v]=le({prop:o,onChange:a,defaultProp:c});return r.createElement(bt,{scope:n,baseId:ue(),value:f,onValueChange:v,orientation:s,dir:b,activationMode:l},r.createElement(F.div,I({dir:b,"data-orientation":s},u,{ref:t})))}),mt="TabsList",vt=r.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...a}=e,c=J(mt,n),s=ve(n);return r.createElement(ut,I({asChild:!0},s,{orientation:c.orientation,dir:c.dir,loop:o}),r.createElement(F.div,I({role:"tablist","aria-orientation":c.orientation},a,{ref:t})))}),_t="TabsTrigger",gt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:a=!1,...c}=e,s=J(_t,n),i=ve(n),l=_e(s.baseId,o),u=ge(s.baseId,o),b=o===s.value;return r.createElement(lt,I({asChild:!0},i,{focusable:!a,active:b}),r.createElement(F.button,I({type:"button",role:"tab","aria-selected":b,"aria-controls":u,"data-state":b?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l},c,{ref:t,onMouseDown:N(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(o):f.preventDefault()}),onKeyDown:N(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(o)}),onFocus:N(e.onFocus,()=>{const f=s.activationMode!=="manual";!b&&!a&&f&&s.onValueChange(o)})})))}),ht="TabsContent",xt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:a,children:c,...s}=e,i=J(ht,n),l=_e(i.baseId,o),u=ge(i.baseId,o),b=o===i.value,f=r.useRef(b);return r.useEffect(()=>{const v=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(v)},[]),r.createElement($e,{present:a||b},({present:v})=>r.createElement(F.div,I({"data-state":b?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),v&&c))});function _e(e,t){return`${e}-trigger-${t}`}function ge(e,t){return`${e}-content-${t}`}const Ct=$t,Et=vt,It=gt,yt=xt;function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he={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})()})(se);var Ne=se.exports;const Re=Te(Ne),Ae={"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"},Pe={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"},Me={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"},Oe=Re.bind(Ae),re="purpur-icon",Fe="md",De=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),je=({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 ${De(n)}>${o}${e}</svg>`},qe=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ae=({["data-testid"]:e,svg:t,allyTitle:n,className:o,size:a=Fe,...c})=>{const s=je({content:qe(t.svg),title:n}),i=Oe(o,re,`${re}--${a}`);return E.jsx("span",{"aria-label":n,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:s},...c})};ae.displayName="Icon";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)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y.apply(null,arguments)}function N(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 Z(e,t=[]){let n=[];function o(c,s){const i=r.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:v,children:_,...p}=f,h=(v==null?void 0:v[e][l])||i,m=r.useMemo(()=>p,Object.values(p));return r.createElement(h.Provider,{value:m},_)}function b(f,v){const _=(v==null?void 0:v[e][l])||i,p=r.useContext(_);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${c}\``)}return u.displayName=c+"Provider",[u,b]}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,Ve(a,...t)]}function Ve(...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 Le(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ie(...e){return t=>e.forEach(n=>Le(n,t))}function k(...e){return r.useCallback(ie(...e),e)}const B=r.forwardRef((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),c=a.find(ke);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(K,y({},o,{ref:t}),r.isValidElement(s)?r.cloneElement(s,void 0,i):null)}return r.createElement(K,y({},o,{ref:t}),n)});B.displayName="Slot";const K=r.forwardRef((e,t)=>{const{children:n,...o}=e;return r.isValidElement(n)?r.cloneElement(n,{...Be(o,n.props),ref:t?ie(t,n.ref):n.ref}):r.Children.count(n)>1?r.Children.only(null):null});K.displayName="SlotClone";const Ue=({children:e})=>r.createElement(r.Fragment,null,e);function ke(e){return r.isValidElement(e)&&e.type===Ue}function Be(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 Ge(e){const t=e+"CollectionProvider",[n,o]=Z(t),[a,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=_=>{const{scope:p,children:h}=_,m=r.useRef(null),$=r.useRef(new Map).current;return r.createElement(a,{scope:p,itemMap:$,collectionRef:m},h)},i=e+"CollectionSlot",l=r.forwardRef((_,p)=>{const{scope:h,children:m}=_,$=c(i,h),g=k(p,$.collectionRef);return r.createElement(B,{ref:g},m)}),u=e+"CollectionItemSlot",b="data-radix-collection-item",f=r.forwardRef((_,p)=>{const{scope:h,children:m,...$}=_,g=r.useRef(null),R=k(p,g),I=c(u,h);return r.useEffect(()=>(I.itemMap.set(g,{ref:g,...$}),()=>void I.itemMap.delete(g))),r.createElement(B,{[b]:"",ref:R},m)});function v(_){const p=c(e+"CollectionConsumer",_);return r.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const $=Array.from(m.querySelectorAll(`[${b}]`));return Array.from(p.itemMap.values()).sort((I,D)=>$.indexOf(I.ref.current)-$.indexOf(D.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},v,o]}const W=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{},ze=ce.useId||(()=>{});let Ke=0;function ue(e){const[t,n]=ce.useState(ze());return W(()=>{e||n(o=>o??String(Ke++))},[e]),e||(t?`radix-${t}`:"")}const We=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],F=We.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 H(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 le({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,a]=Ye({defaultProp:t,onChange:n}),c=e!==void 0,s=c?e:o,i=H(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 Ye({defaultProp:e,onChange:t}){const n=r.useState(e),[o]=n,a=r.useRef(o),c=H(t);return r.useEffect(()=>{a.current!==o&&(c(o),a.current=o)},[o,a,c]),n}const Ze=r.createContext(void 0);function de(e){const t=r.useContext(Ze);return e||t||"ltr"}const z="rovingFocusGroup.onEntryFocus",He={bubbles:!1,cancelable:!0},X="RovingFocusGroup",[Y,fe,Xe]=Ge(X),[Je,pe]=Z(X,[Xe]),[Qe,et]=Je(X),tt=r.forwardRef((e,t)=>r.createElement(Y.Provider,{scope:e.__scopeRovingFocusGroup},r.createElement(Y.Slot,{scope:e.__scopeRovingFocusGroup},r.createElement(nt,y({},e,{ref:t}))))),nt=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:l,onEntryFocus:u,...b}=e,f=r.useRef(null),v=k(t,f),_=de(c),[p=null,h]=le({prop:s,defaultProp:i,onChange:l}),[m,$]=r.useState(!1),g=H(u),R=fe(n),I=r.useRef(!1),[D,M]=r.useState(0);return r.useEffect(()=>{const x=f.current;if(x)return x.addEventListener(z,g),()=>x.removeEventListener(z,g)},[g]),r.createElement(Qe,{scope:n,orientation:o,dir:_,loop:a,currentTabStopId:p,onItemFocus:r.useCallback(x=>h(x),[h]),onItemShiftTab:r.useCallback(()=>$(!0),[]),onFocusableItemAdd:r.useCallback(()=>M(x=>x+1),[]),onFocusableItemRemove:r.useCallback(()=>M(x=>x-1),[])},r.createElement(F.div,y({tabIndex:m||D===0?-1:0,"data-orientation":o},b,{ref:v,style:{outline:"none",...e.style},onMouseDown:N(e.onMouseDown,()=>{I.current=!0}),onFocus:N(e.onFocus,x=>{const V=!I.current;if(x.target===x.currentTarget&&V&&!m){const j=new CustomEvent(z,He);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const A=R().filter(d=>d.focusable),q=A.find(d=>d.active),G=A.find(d=>d.id===p),L=[q,G,...A].filter(Boolean).map(d=>d.ref.current);be(L)}}I.current=!1}),onBlur:N(e.onBlur,()=>$(!1))})))}),rt="RovingFocusGroupItem",ot=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:c,...s}=e,i=ue(),l=c||i,u=et(rt,n),b=u.currentTabStopId===l,f=fe(n),{onFocusableItemAdd:v,onFocusableItemRemove:_}=u;return r.useEffect(()=>{if(o)return v(),()=>_()},[o,v,_]),r.createElement(Y.ItemSlot,{scope:n,id:l,focusable:o,active:a},r.createElement(F.span,y({tabIndex:b?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:N(e.onMouseDown,p=>{o?u.onItemFocus(l):p.preventDefault()}),onFocus:N(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:N(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const h=at(p,u.orientation,u.dir);if(h!==void 0){p.preventDefault();let $=f().filter(g=>g.focusable).map(g=>g.ref.current);if(h==="last")$.reverse();else if(h==="prev"||h==="next"){h==="prev"&&$.reverse();const g=$.indexOf(p.currentTarget);$=u.loop?it($,g+1):$.slice(g+1)}setTimeout(()=>be($))}})})))}),ct={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function st(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function at(e,t,n){const o=st(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ct[o]}function be(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function it(e,t){return e.map((n,o)=>e[(t+o)%e.length])}const ut=tt,lt=ot;function dt(e,t){return r.useReducer((n,o)=>{const a=t[n][o];return a??n},e)}const $e=e=>{const{present:t,children:n}=e,o=ft(t),a=typeof n=="function"?n({present:o.isPresent}):r.Children.only(n),c=k(o.ref,a.ref);return typeof n=="function"||o.isPresent?r.cloneElement(a,{ref:c}):null};$e.displayName="Presence";function ft(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),c=r.useRef("none"),s=e?"mounted":"unmounted",[i,l]=dt(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const u=U(o.current);c.current=i==="mounted"?u:"none"},[i]),W(()=>{const u=o.current,b=a.current;if(b!==e){const v=c.current,_=U(u);e?l("MOUNT"):_==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(b&&v!==_?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),W(()=>{if(t){const u=f=>{const _=U(o.current).includes(f.animationName);f.target===t&&_&&we.flushSync(()=>l("ANIMATION_END"))},b=f=>{f.target===t&&(c.current=U(o.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",b),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 U(e){return(e==null?void 0:e.animationName)||"none"}const me="Tabs",[pt,Vt]=Z(me,[pe]),ve=pe(),[bt,J]=pt(me),$t=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:a,defaultValue:c,orientation:s="horizontal",dir:i,activationMode:l="automatic",...u}=e,b=de(i),[f,v]=le({prop:o,onChange:a,defaultProp:c});return r.createElement(bt,{scope:n,baseId:ue(),value:f,onValueChange:v,orientation:s,dir:b,activationMode:l},r.createElement(F.div,y({dir:b,"data-orientation":s},u,{ref:t})))}),mt="TabsList",vt=r.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...a}=e,c=J(mt,n),s=ve(n);return r.createElement(ut,y({asChild:!0},s,{orientation:c.orientation,dir:c.dir,loop:o}),r.createElement(F.div,y({role:"tablist","aria-orientation":c.orientation},a,{ref:t})))}),_t="TabsTrigger",gt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:a=!1,...c}=e,s=J(_t,n),i=ve(n),l=_e(s.baseId,o),u=ge(s.baseId,o),b=o===s.value;return r.createElement(lt,y({asChild:!0},i,{focusable:!a,active:b}),r.createElement(F.button,y({type:"button",role:"tab","aria-selected":b,"aria-controls":u,"data-state":b?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l},c,{ref:t,onMouseDown:N(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(o):f.preventDefault()}),onKeyDown:N(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(o)}),onFocus:N(e.onFocus,()=>{const f=s.activationMode!=="manual";!b&&!a&&f&&s.onValueChange(o)})})))}),ht="TabsContent",xt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:a,children:c,...s}=e,i=J(ht,n),l=_e(i.baseId,o),u=ge(i.baseId,o),b=o===i.value,f=r.useRef(b);return r.useEffect(()=>{const v=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(v)},[]),r.createElement($e,{present:a||b},({present:v})=>r.createElement(F.div,y({"data-state":b?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),v&&c))});function _e(e,t){return`${e}-trigger-${t}`}function ge(e,t){return`${e}-content-${t}`}const Ct=$t,Et=vt,yt=gt,It=xt;function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he={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})()})(he);var St=he.exports;const Q=wt(St),Tt={"purpur-tab-content":"_purpur-tab-content_1x2zs_1"},Nt=Q.bind(Tt),Rt="purpur-tab-content",At=r.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,...a},c)=>E.jsx(yt,{ref:c,className:Nt([Rt,o]),"data-testid":n,value:t,...a,children:e})),Pt=e=>!!e&&r.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Mt={"purpur-tab-header":"_purpur-tab-header_18g3c_1","purpur-tab-header--contained":"_purpur-tab-header--contained_18g3c_33","purpur-tab-header--contained-negative":"_purpur-tab-header--contained-negative_18g3c_33","purpur-tab-header--line":"_purpur-tab-header--line_18g3c_36","purpur-tab-header--line-negative":"_purpur-tab-header--line-negative_18g3c_48"},Ot=Q.bind(Mt),oe="purpur-tab-header",Ft=r.forwardRef(({index:e,tabId:t,variant:n,negative:o,onFocus:a,"data-testid":c,children:s},i)=>E.jsx(It,{id:`${t}-trigger`,className:Ot([oe,`${oe}--${n}${o?"-negative":""}`]),value:t,"data-testid":c,"data-index":e,ref:i,onFocus:a,children:s})),Dt={"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"},jt=["line","contained"],xe=e=>new CustomEvent("tabChangeDetail",{detail:{value:e}}),P=Q.bind(Dt),w="purpur-tabs",qt=(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"})},Ce=({children:e,variant:t="line",negative:n=!1,fullWidth:o=!1,onChange:a,className:c,defaultValue:s,"data-testid":i,value:l,...u})=>{const[b,f]=r.useState({}),[v,_]=r.useState(0),[p,h]=r.useState(0),m=r.Children.toArray(e).filter(Pt),$=r.useRef(),g=r.useRef(new Array(m.length)),R=200,y=t==="line",D=P([w,`${w}--${t}${n?"-negative":""}`,{[`${w}--fullWidth`]:o},c]),M=r.Children.map(m,({props:{tabId:d}})=>d),x=()=>{const d=M.findIndex(C=>C===s);return d>=0?d:0};r.useEffect(()=>{l&&j(m.findIndex(d=>d.props.tabId===l))},[m,l]);const[V,j]=r.useState(x);if(new Set(M).size!==M.length)throw new Error("tabId must be unique");const A=(d,C)=>C||i?`${C||i}-${d}`:void 0,q=()=>{if(!y)return;const d=g.current[V];_((d==null?void 0:d.offsetLeft)||0),h((d==null?void 0:d.getBoundingClientRect().width)||0)},G=d=>{y&&!l&&j(m.findIndex(C=>C.props.tabId===d)),a==null||a(xe(d))},ee=d=>{if($!=null&&$.current){const{scrollLeft:C}=$.current,O=d==="left"?-R:R;$.current.scroll({left:C+O,behavior:"smooth"})}},L=({side:d})=>E.jsx("button",{className:P(`${w}__scroll-button`,`${w}__scroll-button--${d}`),onClick:()=>ee(d),type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":A("scroll-button"),children:E.jsx(ae,{svg:d==="left"?Pe:Me,size:"md"})});return r.useEffect(()=>(window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),r.useEffect(()=>{q()},[V,o,m.length,t]),r.useEffect(()=>{const d=T=>{if(T.every(S=>S.isIntersecting)&&T.length===m.length){f({});return}T.forEach(S=>{const ne=Number(S.target.getAttribute("data-index")),Ee=ne===0,Ie=ne===m.length-1;f(ye=>({...ye,...Ee&&{[`${w}__wrapper--scroll-end`]:!S.isIntersecting},...Ie&&{[`${w}__wrapper--scroll-start`]:!S.isIntersecting}}))})},C=new IntersectionObserver(d,{threshold:[.99],root:$.current}),O=g.current;return O.forEach(T=>C.observe(T)),()=>{O.forEach(T=>C.unobserve(T))}},[m.length]),E.jsx(Ct,{defaultValue:s??m[0].props.tabId,onValueChange:G,"data-testid":i,className:D,value:l,...u,children:E.jsxs("div",{className:P(`${w}__container`),children:[E.jsxs("div",{className:P([`${w}__wrapper`,b]),children:[E.jsxs(Et,{ref:d=>{$.current=d},className:P(`${w}__list`),children:[r.Children.map(m,(d,C)=>{const{name:O,tabId:T,"data-testid":te}=d.props;return E.jsx(Ft,{"data-testid":A("header",te),index:C,tabId:T,ref:S=>{S&&(g.current[C]=S)},onFocus:S=>{qt(S.target,$.current)},variant:t,negative:n,children:O})}),y&&E.jsx("div",{className:P(`${w}__selected-border`),style:{width:p,transform:`translateX(${v}px)`},"data-testid":A("selected-border")})]}),E.jsx(L,{side:"left"}),E.jsx(L,{side:"right"})]}),E.jsx("div",{className:P(`${w}__content-container`),children:r.Children.map(m,d=>d)})]})})};Ce.Content=At;exports.Tabs=Ce;exports.createTabChangeDetailEvent=xe;exports.tabsVariants=jt;
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})()})(he);var St=he.exports;const Q=wt(St),Tt={"purpur-tab-content":"_purpur-tab-content_1x2zs_1"},Nt=Q.bind(Tt),Rt="purpur-tab-content",At=r.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,...a},c)=>E.jsx(It,{ref:c,className:Nt([Rt,o]),"data-testid":n,value:t,...a,children:e})),Pt=e=>!!e&&r.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Mt={"purpur-tab-header":"_purpur-tab-header_18g3c_1","purpur-tab-header--contained":"_purpur-tab-header--contained_18g3c_33","purpur-tab-header--contained-negative":"_purpur-tab-header--contained-negative_18g3c_33","purpur-tab-header--line":"_purpur-tab-header--line_18g3c_36","purpur-tab-header--line-negative":"_purpur-tab-header--line-negative_18g3c_48"},Ot=Q.bind(Mt),oe="purpur-tab-header",Ft=r.forwardRef(({index:e,tabId:t,variant:n,negative:o,onFocus:a,"data-testid":c,children:s},i)=>E.jsx(yt,{id:`${t}-trigger`,className:Ot([oe,`${oe}--${n}${o?"-negative":""}`]),value:t,"data-testid":c,"data-index":e,ref:i,onFocus:a,children:s})),Dt={"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"},jt=["line","contained"],xe=e=>new CustomEvent("tabChangeDetail",{detail:{value:e}}),P=Q.bind(Dt),w="purpur-tabs",qt=(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"})},Ce=({children:e,variant:t="line",negative:n=!1,fullWidth:o=!1,onChange:a,className:c,defaultValue:s,"data-testid":i,value:l,...u})=>{const[b,f]=r.useState({}),[v,_]=r.useState(0),[p,h]=r.useState(0),m=r.Children.toArray(e).filter(Pt),$=r.useRef(),g=r.useRef(new Array(m.length)),R=200,I=t==="line",D=P([w,`${w}--${t}${n?"-negative":""}`,{[`${w}--fullWidth`]:o},c]),M=r.Children.map(m,({props:{tabId:d}})=>d),x=()=>{const d=M.findIndex(C=>C===s);return d>=0?d:0};r.useEffect(()=>{l&&j(m.findIndex(d=>d.props.tabId===l))},[m,l]);const[V,j]=r.useState(x);if(new Set(M).size!==M.length)throw new Error("tabId must be unique");const A=(d,C)=>C||i?`${C||i}-${d}`:void 0,q=()=>{if(!I)return;const d=g.current[V];_((d==null?void 0:d.offsetLeft)||0),h((d==null?void 0:d.getBoundingClientRect().width)||0)},G=d=>{I&&!l&&j(m.findIndex(C=>C.props.tabId===d)),a==null||a(xe(d))},ee=d=>{if($!=null&&$.current){const{scrollLeft:C}=$.current,O=d==="left"?-R:R;$.current.scroll({left:C+O,behavior:"smooth"})}},L=({side:d})=>E.jsx("button",{className:P(`${w}__scroll-button`,`${w}__scroll-button--${d}`),onClick:()=>ee(d),type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":A("scroll-button"),children:E.jsx(ae,{svg:d==="left"?Pe:Me,size:"md"})});return r.useEffect(()=>(window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),r.useEffect(()=>{q()},[V,o,m.length,t]),r.useEffect(()=>{const d=T=>{if(T.every(S=>S.isIntersecting)&&T.length===m.length){f({});return}T.forEach(S=>{const ne=Number(S.target.getAttribute("data-index")),Ee=ne===0,ye=ne===m.length-1;f(Ie=>({...Ie,...Ee&&{[`${w}__wrapper--scroll-end`]:!S.isIntersecting},...ye&&{[`${w}__wrapper--scroll-start`]:!S.isIntersecting}}))})},C=new IntersectionObserver(d,{threshold:[.99],root:$.current}),O=g.current;return O.forEach(T=>C.observe(T)),()=>{O.forEach(T=>C.unobserve(T))}},[m.length]),E.jsx(Ct,{defaultValue:s??m[0].props.tabId,onValueChange:G,"data-testid":i,className:D,value:l,...u,children:E.jsxs("div",{className:P(`${w}__container`),children:[E.jsxs("div",{className:P([`${w}__wrapper`,b]),children:[E.jsxs(Et,{ref:d=>{$.current=d},className:P(`${w}__list`),children:[r.Children.map(m,(d,C)=>{const{name:O,tabId:T,"data-testid":te}=d.props;return E.jsx(Ft,{"data-testid":A("header",te),index:C,tabId:T,ref:S=>{S&&(g.current[C]=S)},onFocus:S=>{qt(S.target,$.current)},variant:t,negative:n,children:O})}),I&&E.jsx("div",{className:P(`${w}__selected-border`),style:{width:p,transform:`translateX(${v}px)`},"data-testid":A("selected-border")})]}),E.jsx(L,{side:"left"}),E.jsx(L,{side:"right"})]}),E.jsx("div",{className:P(`${w}__content-container`),children:r.Children.map(m,d=>d)})]})})};Ce.Content=At;exports.Tabs=Ce;exports.createTabChangeDetailEvent=xe;exports.tabsVariants=jt;
10
10
  //# sourceMappingURL=tabs.cjs.js.map