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