@purpurds/tabs 6.0.1 → 6.0.2
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 +15 -51
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.es.js +629 -682
- package/dist/tabs.es.js.map +1 -1
- package/package.json +6 -6
package/dist/LICENSE.txt
CHANGED
|
@@ -1,48 +1,12 @@
|
|
|
1
1
|
Name: @purpurds/icon
|
|
2
|
-
Version: 6.0.
|
|
2
|
+
Version: 6.0.1
|
|
3
3
|
License: AGPL-3.0-only
|
|
4
4
|
Private: false
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Name: @babel/runtime
|
|
9
|
-
Version: 7.26.0
|
|
10
|
-
License: MIT
|
|
11
|
-
Private: false
|
|
12
|
-
Description: babel's modular runtime helpers
|
|
13
|
-
Repository: https://github.com/babel/babel.git
|
|
14
|
-
Homepage: https://babel.dev/docs/en/next/babel-runtime
|
|
15
|
-
Author: The Babel Team (https://babel.dev/team)
|
|
16
|
-
License Copyright:
|
|
17
|
-
===
|
|
18
|
-
|
|
19
|
-
MIT License
|
|
20
|
-
|
|
21
|
-
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
22
|
-
|
|
23
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
24
|
-
a copy of this software and associated documentation files (the
|
|
25
|
-
"Software"), to deal in the Software without restriction, including
|
|
26
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
27
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
28
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
29
|
-
the following conditions:
|
|
30
|
-
|
|
31
|
-
The above copyright notice and this permission notice shall be
|
|
32
|
-
included in all copies or substantial portions of the Software.
|
|
33
|
-
|
|
34
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
35
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
36
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
37
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
38
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
39
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
40
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
8
|
Name: @radix-ui/primitive
|
|
45
|
-
Version: 1.
|
|
9
|
+
Version: 1.1.1
|
|
46
10
|
License: MIT
|
|
47
11
|
Private: false
|
|
48
12
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -51,7 +15,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
51
15
|
---
|
|
52
16
|
|
|
53
17
|
Name: @radix-ui/react-context
|
|
54
|
-
Version: 1.
|
|
18
|
+
Version: 1.1.1
|
|
55
19
|
License: MIT
|
|
56
20
|
Private: false
|
|
57
21
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -60,7 +24,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
60
24
|
---
|
|
61
25
|
|
|
62
26
|
Name: @radix-ui/react-compose-refs
|
|
63
|
-
Version: 1.
|
|
27
|
+
Version: 1.1.1
|
|
64
28
|
License: MIT
|
|
65
29
|
Private: false
|
|
66
30
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -69,7 +33,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
69
33
|
---
|
|
70
34
|
|
|
71
35
|
Name: @radix-ui/react-slot
|
|
72
|
-
Version: 1.
|
|
36
|
+
Version: 1.1.2
|
|
73
37
|
License: MIT
|
|
74
38
|
Private: false
|
|
75
39
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -78,7 +42,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
78
42
|
---
|
|
79
43
|
|
|
80
44
|
Name: @radix-ui/react-collection
|
|
81
|
-
Version: 1.
|
|
45
|
+
Version: 1.1.2
|
|
82
46
|
License: MIT
|
|
83
47
|
Private: false
|
|
84
48
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -87,7 +51,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
87
51
|
---
|
|
88
52
|
|
|
89
53
|
Name: @radix-ui/react-use-layout-effect
|
|
90
|
-
Version: 1.0
|
|
54
|
+
Version: 1.1.0
|
|
91
55
|
License: MIT
|
|
92
56
|
Private: false
|
|
93
57
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -96,7 +60,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
96
60
|
---
|
|
97
61
|
|
|
98
62
|
Name: @radix-ui/react-id
|
|
99
|
-
Version: 1.0
|
|
63
|
+
Version: 1.1.0
|
|
100
64
|
License: MIT
|
|
101
65
|
Private: false
|
|
102
66
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -105,7 +69,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
105
69
|
---
|
|
106
70
|
|
|
107
71
|
Name: @radix-ui/react-primitive
|
|
108
|
-
Version:
|
|
72
|
+
Version: 2.0.2
|
|
109
73
|
License: MIT
|
|
110
74
|
Private: false
|
|
111
75
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -114,7 +78,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
114
78
|
---
|
|
115
79
|
|
|
116
80
|
Name: @radix-ui/react-use-callback-ref
|
|
117
|
-
Version: 1.0
|
|
81
|
+
Version: 1.1.0
|
|
118
82
|
License: MIT
|
|
119
83
|
Private: false
|
|
120
84
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -123,7 +87,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
123
87
|
---
|
|
124
88
|
|
|
125
89
|
Name: @radix-ui/react-use-controllable-state
|
|
126
|
-
Version: 1.0
|
|
90
|
+
Version: 1.1.0
|
|
127
91
|
License: MIT
|
|
128
92
|
Private: false
|
|
129
93
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -132,7 +96,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
132
96
|
---
|
|
133
97
|
|
|
134
98
|
Name: @radix-ui/react-direction
|
|
135
|
-
Version: 1.0
|
|
99
|
+
Version: 1.1.0
|
|
136
100
|
License: MIT
|
|
137
101
|
Private: false
|
|
138
102
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -141,7 +105,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
141
105
|
---
|
|
142
106
|
|
|
143
107
|
Name: @radix-ui/react-roving-focus
|
|
144
|
-
Version: 1.
|
|
108
|
+
Version: 1.1.2
|
|
145
109
|
License: MIT
|
|
146
110
|
Private: false
|
|
147
111
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -150,7 +114,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
150
114
|
---
|
|
151
115
|
|
|
152
116
|
Name: @radix-ui/react-presence
|
|
153
|
-
Version: 1.
|
|
117
|
+
Version: 1.1.2
|
|
154
118
|
License: MIT
|
|
155
119
|
Private: false
|
|
156
120
|
Repository: git+https://github.com/radix-ui/primitives.git
|
|
@@ -159,7 +123,7 @@ Homepage: https://radix-ui.com/primitives
|
|
|
159
123
|
---
|
|
160
124
|
|
|
161
125
|
Name: @radix-ui/react-tabs
|
|
162
|
-
Version: 1.
|
|
126
|
+
Version: 1.1.3
|
|
163
127
|
License: MIT
|
|
164
128
|
Private: false
|
|
165
129
|
Repository: git+https://github.com/radix-ui/primitives.git
|
package/dist/tabs.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),y=require("react");require("react-dom");function De(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 a=De(y);function qe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ae={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 u=arguments[s];u&&(c=a(c,o.call(this,u)))}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 u in c)t.call(c,u)&&c[u]&&(s=a(s,this&&this[u]||u));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})()})(ae);var Re=ae.exports;const Ae=Ne(Re),Pe={"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"},Me=Ae.bind(Pe),re="purpur-icon",Oe="md",Fe=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),De=({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 ${Fe(n)}>${o}${e}</svg>`},je=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ue=({["data-testid"]:e,svg:t,allyTitle:n,className:o,size:a=Oe,...c})=>{const s=De({content:je(t.svg),title:n}),u=Me(o,re,`${re}--${a}`);return E.jsx("span",{"aria-label":n,className:u,"data-testid":e,dangerouslySetInnerHTML:{__html:s},...c})};ue.displayName="Icon";const qe={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"},Ve={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"};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 u=r.createContext(s),l=n.length;n=[...n,s];function i(f){const{scope:_,children:v,...p}=f,h=(_==null?void 0:_[e][l])||u,m=r.useMemo(()=>p,Object.values(p));return r.createElement(h.Provider,{value:m},v)}function b(f,_){const v=(_==null?void 0:_[e][l])||u,p=r.useContext(v);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${c}\``)}return i.displayName=c+"Provider",[i,b]}const a=()=>{const c=n.map(s=>r.createContext(s));return function(u){const l=(u==null?void 0:u[e])||c;return r.useMemo(()=>({[`__scope${e}`]:{...u,[e]:l}}),[u,l])}};return a.scopeName=e,[o,Le(a,...t)]}function Le(...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((u,{useScope:l,scopeName:i})=>{const f=l(c)[`__scope${i}`];return{...u,...f}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ue(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ie(...e){return t=>e.forEach(n=>Ue(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(Be);if(c){const s=c.props.children,u=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,u):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,{...Ge(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 ke=({children:e})=>r.createElement(r.Fragment,null,e);function Be(e){return r.isValidElement(e)&&e.type===ke}function Ge(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]=(...u)=>{c(...u),a(...u)}:a&&(n[o]=a):o==="style"?n[o]={...a,...c}:o==="className"&&(n[o]=[a,c].filter(Boolean).join(" "))}return{...e,...n}}function ze(e){const t=e+"CollectionProvider",[n,o]=Z(t),[a,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:p,children:h}=v,m=r.useRef(null),$=r.useRef(new Map).current;return r.createElement(a,{scope:p,itemMap:$,collectionRef:m},h)},u=e+"CollectionSlot",l=r.forwardRef((v,p)=>{const{scope:h,children:m}=v,$=c(u,h),g=k(p,$.collectionRef);return r.createElement(B,{ref:g},m)}),i=e+"CollectionItemSlot",b="data-radix-collection-item",f=r.forwardRef((v,p)=>{const{scope:h,children:m,...$}=v,g=r.useRef(null),P=k(p,g),I=c(i,h);return r.useEffect(()=>(I.itemMap.set(g,{ref:g,...$}),()=>void I.itemMap.delete(g))),r.createElement(B,{[b]:"",ref:P},m)});function _(v){const p=c(e+"CollectionConsumer",v);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},_,o]}const W=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{},Ke=se.useId||(()=>{});let We=0;function le(e){const[t,n]=se.useState(Ke());return W(()=>{e||n(o=>o??String(We++))},[e]),e||(t?`radix-${t}`:"")}const Ye=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],F=Ye.reduce((e,t)=>{const n=r.forwardRef((o,a)=>{const{asChild:c,...s}=o,u=c?B:t;return r.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),r.createElement(u,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 de({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,a]=Ze({defaultProp:t,onChange:n}),c=e!==void 0,s=c?e:o,u=H(n),l=r.useCallback(i=>{if(c){const f=typeof i=="function"?i(e):i;f!==e&&u(f)}else a(i)},[c,e,a,u]);return[s,l]}function Ze({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 He=r.createContext(void 0);function fe(e){const t=r.useContext(He);return e||t||"ltr"}const z="rovingFocusGroup.onEntryFocus",Xe={bubbles:!1,cancelable:!0},X="RovingFocusGroup",[Y,pe,Je]=ze(X),[Qe,be]=Z(X,[Je]),[et,tt]=Qe(X),nt=r.forwardRef((e,t)=>r.createElement(Y.Provider,{scope:e.__scopeRovingFocusGroup},r.createElement(Y.Slot,{scope:e.__scopeRovingFocusGroup},r.createElement(rt,y({},e,{ref:t}))))),rt=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:l,onEntryFocus:i,...b}=e,f=r.useRef(null),_=k(t,f),v=fe(c),[p=null,h]=de({prop:s,defaultProp:u,onChange:l}),[m,$]=r.useState(!1),g=H(i),P=pe(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(et,{scope:n,orientation:o,dir:v,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:_,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,Xe);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const R=P().filter(d=>d.focusable),q=R.find(d=>d.active),G=R.find(d=>d.id===p),L=[q,G,...R].filter(Boolean).map(d=>d.ref.current);$e(L)}}I.current=!1}),onBlur:N(e.onBlur,()=>$(!1))})))}),ot="RovingFocusGroupItem",ct=r.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:c,...s}=e,u=le(),l=c||u,i=tt(ot,n),b=i.currentTabStopId===l,f=pe(n),{onFocusableItemAdd:_,onFocusableItemRemove:v}=i;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":i.orientation},s,{ref:t,onMouseDown:N(e.onMouseDown,p=>{o?i.onItemFocus(l):p.preventDefault()}),onFocus:N(e.onFocus,()=>i.onItemFocus(l)),onKeyDown:N(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){i.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const h=ut(p,i.orientation,i.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);$=i.loop?it($,g+1):$.slice(g+1)}setTimeout(()=>$e($))}})})))}),st={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function at(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ut(e,t,n){const o=at(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return st[o]}function $e(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 lt=nt,dt=ct;function ft(e,t){return r.useReducer((n,o)=>{const a=t[n][o];return a??n},e)}const me=e=>{const{present:t,children:n}=e,o=pt(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};me.displayName="Presence";function pt(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),c=r.useRef("none"),s=e?"mounted":"unmounted",[u,l]=ft(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const i=U(o.current);c.current=u==="mounted"?i:"none"},[u]),W(()=>{const i=o.current,b=a.current;if(b!==e){const _=c.current,v=U(i);e?l("MOUNT"):v==="none"||(i==null?void 0:i.display)==="none"?l("UNMOUNT"):l(b&&_!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),W(()=>{if(t){const i=f=>{const v=U(o.current).includes(f.animationName);f.target===t&&v&&Se.flushSync(()=>l("ANIMATION_END"))},b=f=>{f.target===t&&(c.current=U(o.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:r.useCallback(i=>{i&&(o.current=getComputedStyle(i)),n(i)},[])}}function U(e){return(e==null?void 0:e.animationName)||"none"}const _e="Tabs",[bt,Vt]=Z(_e,[be]),ve=be(),[$t,J]=bt(_e),mt=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:a,defaultValue:c,orientation:s="horizontal",dir:u,activationMode:l="automatic",...i}=e,b=fe(u),[f,_]=de({prop:o,onChange:a,defaultProp:c});return r.createElement($t,{scope:n,baseId:le(),value:f,onValueChange:_,orientation:s,dir:b,activationMode:l},r.createElement(F.div,y({dir:b,"data-orientation":s},i,{ref:t})))}),_t="TabsList",vt=r.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...a}=e,c=J(_t,n),s=ve(n);return r.createElement(lt,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})))}),gt="TabsTrigger",ht=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:a=!1,...c}=e,s=J(gt,n),u=ve(n),l=ge(s.baseId,o),i=he(s.baseId,o),b=o===s.value;return r.createElement(dt,y({asChild:!0},u,{focusable:!a,active:b}),r.createElement(F.button,y({type:"button",role:"tab","aria-selected":b,"aria-controls":i,"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)})})))}),xt="TabsContent",Ct=r.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:a,children:c,...s}=e,u=J(xt,n),l=ge(u.baseId,o),i=he(u.baseId,o),b=o===u.value,f=r.useRef(b);return r.useEffect(()=>{const _=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(_)},[]),r.createElement(me,{present:a||b},({present:_})=>r.createElement(F.div,y({"data-state":b?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":l,hidden:!_,id:i,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),_&&c))});function ge(e,t){return`${e}-trigger-${t}`}function he(e,t){return`${e}-content-${t}`}const Et=mt,yt=vt,It=ht,wt=Ct;function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xe={exports:{}};/*!
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(r=s(r,o.call(this,c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var c in r)t.call(r,c)&&r[c]&&(i=s(i,this&&this[c]||c));return i}function s(r,i){return i?r?r+" "+i:r+i:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ae);var Le=ae.exports;const Ve=qe(Le),Ue={"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"},Be=Ve.bind(Ue),oe="purpur-icon",Ge="md",We=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),ke=({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 ${We(n)}>${o}${e}</svg>`},Ke=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ue=({["data-testid"]:e,svg:t,allyTitle:n,className:o,size:s=Ge,...r})=>{const i=ke({content:Ke(t.svg),title:n}),c=Be(o,oe,`${oe}--${s}`);return d.jsx("span",{"aria-label":n,className:c,"data-testid":e,dangerouslySetInnerHTML:{__html:i},...r})};ue.displayName="Icon";const ze={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"},Ye={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"};function E(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function J(e,t=[]){let n=[];function o(r,i){const c=a.createContext(i),u=n.length;n=[...n,i];const l=f=>{var _;const{scope:g,children:h,...p}=f,C=((_=g==null?void 0:g[e])==null?void 0:_[u])||c,v=a.useMemo(()=>p,Object.values(p));return d.jsx(C.Provider,{value:v,children:h})};l.displayName=r+"Provider";function b(f,g){var C;const h=((C=g==null?void 0:g[e])==null?void 0:C[u])||c,p=a.useContext(h);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[l,b]}const s=()=>{const r=n.map(i=>a.createContext(i));return function(c){const u=(c==null?void 0:c[e])||r;return a.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[o,Ze(s,...t)]}function Ze(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const i=o.reduce((c,{useScope:u,scopeName:l})=>{const f=u(r)[`__scope${l}`];return{...c,...f}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function se(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function le(...e){return t=>{let n=!1;const o=e.map(s=>{const r=se(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s<o.length;s++){const r=o[s];typeof r=="function"?r():se(e[s],null)}}}}function U(...e){return a.useCallback(le(...e),e)}var B=a.forwardRef((e,t)=>{const{children:n,...o}=e,s=a.Children.toArray(n),r=s.find(Je);if(r){const i=r.props.children,c=s.map(u=>u===r?a.Children.count(i)>1?a.Children.only(null):a.isValidElement(i)?i.props.children:null:u);return d.jsx(Y,{...o,ref:t,children:a.isValidElement(i)?a.cloneElement(i,void 0,c):null})}return d.jsx(Y,{...o,ref:t,children:n})});B.displayName="Slot";var Y=a.forwardRef((e,t)=>{const{children:n,...o}=e;if(a.isValidElement(n)){const s=He(n),r=Qe(o,n.props);return n.type!==a.Fragment&&(r.ref=t?le(t,s):s),a.cloneElement(n,r)}return a.Children.count(n)>1?a.Children.only(null):null});Y.displayName="SlotClone";var Xe=({children:e})=>d.jsx(d.Fragment,{children:e});function Je(e){return a.isValidElement(e)&&e.type===Xe}function Qe(e,t){const n={...t};for(const o in t){const s=e[o],r=t[o];/^on[A-Z]/.test(o)?s&&r?n[o]=(...c)=>{r(...c),s(...c)}:s&&(n[o]=s):o==="style"?n[o]={...s,...r}:o==="className"&&(n[o]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}function He(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function et(e){const t=e+"CollectionProvider",[n,o]=J(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:p,children:C}=h,v=y.useRef(null),_=y.useRef(new Map).current;return d.jsx(s,{scope:p,itemMap:_,collectionRef:v,children:C})};i.displayName=t;const c=e+"CollectionSlot",u=y.forwardRef((h,p)=>{const{scope:C,children:v}=h,_=r(c,C),w=U(p,_.collectionRef);return d.jsx(B,{ref:w,children:v})});u.displayName=c;const l=e+"CollectionItemSlot",b="data-radix-collection-item",f=y.forwardRef((h,p)=>{const{scope:C,children:v,..._}=h,w=y.useRef(null),A=U(p,w),N=r(l,C);return y.useEffect(()=>(N.itemMap.set(w,{ref:w,..._}),()=>void N.itemMap.delete(w))),d.jsx(B,{[b]:"",ref:A,children:v})});f.displayName=l;function g(h){const p=r(e+"CollectionConsumer",h);return y.useCallback(()=>{const v=p.collectionRef.current;if(!v)return[];const _=Array.from(v.querySelectorAll(`[${b}]`));return Array.from(p.itemMap.values()).sort((N,O)=>_.indexOf(N.ref.current)-_.indexOf(O.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},g,o]}var Z=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{},tt=a.useId||(()=>{}),nt=0;function de(e){const[t,n]=a.useState(tt());return Z(()=>{e||n(o=>o??String(nt++))},[e]),e||(t?`radix-${t}`:"")}var rt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$=rt.reduce((e,t)=>{const n=a.forwardRef((o,s)=>{const{asChild:r,...i}=o,c=r?B:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(c,{...i,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Q(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function fe({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,s]=ot({defaultProp:t,onChange:n}),r=e!==void 0,i=r?e:o,c=Q(n),u=a.useCallback(l=>{if(r){const f=typeof l=="function"?l(e):l;f!==e&&c(f)}else s(l)},[r,e,s,c]);return[i,u]}function ot({defaultProp:e,onChange:t}){const n=a.useState(e),[o]=n,s=a.useRef(o),r=Q(t);return a.useEffect(()=>{s.current!==o&&(r(o),s.current=o)},[o,s,r]),n}var st=a.createContext(void 0);function pe(e){const t=a.useContext(st);return e||t||"ltr"}var z="rovingFocusGroup.onEntryFocus",it={bubbles:!1,cancelable:!0},G="RovingFocusGroup",[X,me,ct]=et(G),[at,_e]=J(G,[ct]),[ut,lt]=at(G),be=a.forwardRef((e,t)=>d.jsx(X.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(X.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(dt,{...e,ref:t})})}));be.displayName=G;var dt=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:b=!1,...f}=e,g=a.useRef(null),h=U(t,g),p=pe(r),[C=null,v]=fe({prop:i,defaultProp:c,onChange:u}),[_,w]=a.useState(!1),A=Q(l),N=me(n),O=a.useRef(!1),[D,q]=a.useState(0);return a.useEffect(()=>{const S=g.current;if(S)return S.addEventListener(z,A),()=>S.removeEventListener(z,A)},[A]),d.jsx(ut,{scope:n,orientation:o,dir:p,loop:s,currentTabStopId:C,onItemFocus:a.useCallback(S=>v(S),[v]),onItemShiftTab:a.useCallback(()=>w(!0),[]),onFocusableItemAdd:a.useCallback(()=>q(S=>S+1),[]),onFocusableItemRemove:a.useCallback(()=>q(S=>S-1),[]),children:d.jsx($.div,{tabIndex:_||D===0?-1:0,"data-orientation":o,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:E(e.onMouseDown,()=>{O.current=!0}),onFocus:E(e.onFocus,S=>{const L=!O.current;if(S.target===S.currentTarget&&L&&!_){const j=new CustomEvent(z,it);if(S.currentTarget.dispatchEvent(j),!j.defaultPrevented){const M=N().filter(x=>x.focusable),W=M.find(x=>x.active),k=M.find(x=>x.id===C),m=[W,k,...M].filter(Boolean).map(x=>x.ref.current);he(m,b)}}O.current=!1}),onBlur:E(e.onBlur,()=>w(!1))})})}),ge="RovingFocusGroupItem",ve=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:r,...i}=e,c=de(),u=r||c,l=lt(ge,n),b=l.currentTabStopId===u,f=me(n),{onFocusableItemAdd:g,onFocusableItemRemove:h}=l;return a.useEffect(()=>{if(o)return g(),()=>h()},[o,g,h]),d.jsx(X.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:d.jsx($.span,{tabIndex:b?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:E(e.onMouseDown,p=>{o?l.onItemFocus(u):p.preventDefault()}),onFocus:E(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:E(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const C=mt(p,l.orientation,l.dir);if(C!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let _=f().filter(w=>w.focusable).map(w=>w.ref.current);if(C==="last")_.reverse();else if(C==="prev"||C==="next"){C==="prev"&&_.reverse();const w=_.indexOf(p.currentTarget);_=l.loop?_t(_,w+1):_.slice(w+1)}setTimeout(()=>he(_))}})})})});ve.displayName=ge;var ft={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pt(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mt(e,t,n){const o=pt(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ft[o]}function he(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function _t(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var bt=be,gt=ve;function vt(e,t){return a.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=ht(t),s=typeof n=="function"?n({present:o.isPresent}):a.Children.only(n),r=U(o.ref,yt(s));return typeof n=="function"||o.isPresent?a.cloneElement(s,{ref:r}):null};ye.displayName="Presence";function ht(e){const[t,n]=a.useState(),o=a.useRef({}),s=a.useRef(e),r=a.useRef("none"),i=e?"mounted":"unmounted",[c,u]=vt(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const l=V(o.current);r.current=c==="mounted"?l:"none"},[c]),Z(()=>{const l=o.current,b=s.current;if(b!==e){const g=r.current,h=V(l);e?u("MOUNT"):h==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(b&&g!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),Z(()=>{if(t){let l;const b=t.ownerDocument.defaultView??window,f=h=>{const C=V(o.current).includes(h.animationName);if(h.target===t&&C&&(u("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},g=h=>{h.target===t&&(r.current=V(o.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{b.clearTimeout(l),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(l=>{l&&(o.current=getComputedStyle(l)),n(l)},[])}}function V(e){return(e==null?void 0:e.animationName)||"none"}function yt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H="Tabs",[Ct,Lt]=J(H,[_e]),Ce=_e(),[xt,ee]=Ct(H),xe=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:s,defaultValue:r,orientation:i="horizontal",dir:c,activationMode:u="automatic",...l}=e,b=pe(c),[f,g]=fe({prop:o,onChange:s,defaultProp:r});return d.jsx(xt,{scope:n,baseId:de(),value:f,onValueChange:g,orientation:i,dir:b,activationMode:u,children:d.jsx($.div,{dir:b,"data-orientation":i,...l,ref:t})})});xe.displayName=H;var we="TabsList",Se=a.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...s}=e,r=ee(we,n),i=Ce(n);return d.jsx(bt,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:o,children:d.jsx($.div,{role:"tablist","aria-orientation":r.orientation,...s,ref:t})})});Se.displayName=we;var Ie="TabsTrigger",Ne=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:s=!1,...r}=e,i=ee(Ie,n),c=Ce(n),u=Ee(i.baseId,o),l=Ae(i.baseId,o),b=o===i.value;return d.jsx(gt,{asChild:!0,...c,focusable:!s,active:b,children:d.jsx($.button,{type:"button",role:"tab","aria-selected":b,"aria-controls":l,"data-state":b?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...r,ref:t,onMouseDown:E(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(o):f.preventDefault()}),onKeyDown:E(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(o)}),onFocus:E(e.onFocus,()=>{const f=i.activationMode!=="manual";!b&&!s&&f&&i.onValueChange(o)})})})});Ne.displayName=Ie;var Re="TabsContent",Te=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:s,children:r,...i}=e,c=ee(Re,n),u=Ee(c.baseId,o),l=Ae(c.baseId,o),b=o===c.value,f=a.useRef(b);return a.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),d.jsx(ye,{present:s||b,children:({present:g})=>d.jsx($.div,{"data-state":b?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:l,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:g&&r})})});Te.displayName=Re;function Ee(e,t){return`${e}-trigger-${t}`}function Ae(e,t){return`${e}-content-${t}`}var wt=xe,St=Se,It=Ne,Nt=Te;function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oe={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
|
|
9
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(r=s(r,o.call(this,c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var c in r)t.call(r,c)&&r[c]&&(i=s(i,this&&this[c]||c));return i}function s(r,i){return i?r?r+" "+i:r+i:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Oe);var Tt=Oe.exports;const te=Rt(Tt),Et={"purpur-tab-content":"_purpur-tab-content_1ugbi_1","purpur-tab-content--force-mount":"_purpur-tab-content--force-mount_1ugbi_15"},At=te.bind(Et),ie="purpur-tab-content",Ot=y.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,disableForceMount:s,...r},i)=>d.jsx(Nt,{ref:i,className:At([ie,o,{[`${ie}--force-mount`]:!s}]),"data-testid":n,value:t,forceMount:!s||void 0,...r,children:e})),Mt=e=>!!e&&y.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Pt={"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"},jt=te.bind(Pt),ce="purpur-tab-header",Ft=y.forwardRef(({index:e,tabId:t,variant:n,negative:o,onFocus:s,"data-testid":r,children:i},c)=>d.jsx(It,{id:`${t}-trigger`,className:jt([ce,`${ce}--${n}${o?"-negative":""}`]),value:t,"data-testid":r,"data-index":e,ref:c,onFocus:s,children:i})),$t={"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"},Dt=["line","contained"],Me=e=>new CustomEvent("tabChangeDetail",{detail:{value:e}}),P=te.bind($t),I="purpur-tabs",qt=(e,t)=>{var u;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(),s=t.clientWidth,r=parseInt((u=getComputedStyle(t).borderLeftWidth)==null?void 0:u.split("px")[0],10),i=o.left+(isNaN(r)?0:r);let c;n.right>o.right&&(c=n.left+t.scrollLeft,c=c+n.width-s+s*.1,c=c-i),n.left<o.left&&(c=n.left+t.scrollLeft,c=c-s*.1,c=c-i),c!==void 0&&t.scroll({left:c,behavior:"smooth"})},Pe=({children:e,variant:t="line",negative:n=!1,fullWidth:o=!1,onChange:s,className:r,defaultValue:i,"data-testid":c,value:u,...l})=>{const[b,f]=y.useState({}),[g,h]=y.useState(0),[p,C]=y.useState(0),v=y.Children.toArray(e).filter(Mt),_=y.useRef(),w=y.useRef(new Array(v.length)),A=200,N=t==="line",O=P([I,`${I}--${t}${n?"-negative":""}`,{[`${I}--fullWidth`]:o},r]),D=y.Children.map(v,({props:{tabId:m}})=>m),q=()=>{const m=D.findIndex(x=>x===i);return m>=0?m:0};y.useEffect(()=>{u&&L(v.findIndex(m=>m.props.tabId===u))},[v,u]);const[S,L]=y.useState(q);if(new Set(D).size!==D.length)throw new Error("tabId must be unique");const j=(m,x)=>x||c?`${x||c}-${m}`:void 0,M=()=>{if(!N)return;const m=w.current[S];h((m==null?void 0:m.offsetLeft)||0),C((m==null?void 0:m.getBoundingClientRect().width)||0)},W=m=>{N&&!u&&L(v.findIndex(x=>x.props.tabId===m)),s==null||s(Me(m))},k=m=>{if(_!=null&&_.current){const{scrollLeft:x}=_.current,F=m==="left"?-200:A;_.current.scroll({left:x+F,behavior:"smooth"})}},K=({side:m})=>d.jsx("button",{className:P(`${I}__scroll-button`,`${I}__scroll-button--${m}`),onClick:()=>k(m),type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":j("scroll-button"),children:d.jsx(ue,{svg:m==="left"?ze:Ye,size:"md"})});return y.useEffect(()=>(window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}),[]),y.useEffect(()=>{M()},[S,o,v.length,t]),y.useEffect(()=>{const m=T=>{if(T.every(R=>R.isIntersecting)&&T.length===v.length){f({});return}T.forEach(R=>{const re=Number(R.target.getAttribute("data-index")),je=re===0,Fe=re===v.length-1;f($e=>({...$e,...je&&{[`${I}__wrapper--scroll-end`]:!R.isIntersecting},...Fe&&{[`${I}__wrapper--scroll-start`]:!R.isIntersecting}}))})},x=new IntersectionObserver(m,{threshold:[.99],root:_.current}),F=w.current;return F.forEach(T=>x.observe(T)),()=>{F.forEach(T=>x.unobserve(T))}},[v.length]),d.jsx(wt,{defaultValue:i??v[0].props.tabId,onValueChange:W,"data-testid":c,className:O,value:u,...l,children:d.jsxs("div",{className:P(`${I}__container`),children:[d.jsxs("div",{className:P([`${I}__wrapper`,b]),children:[d.jsxs(St,{ref:m=>{_.current=m},className:P(`${I}__list`),children:[y.Children.map(v,(m,x)=>{const{name:F,tabId:T,"data-testid":ne}=m.props;return d.jsx(Ft,{"data-testid":j("header",ne),index:x,tabId:T,ref:R=>{R&&(w.current[x]=R)},onFocus:R=>{qt(R.target,_.current)},variant:t,negative:n,children:F})}),N&&d.jsx("div",{className:P(`${I}__selected-border`),style:{width:p,transform:`translateX(${g}px)`},"data-testid":j("selected-border")})]}),d.jsx(K,{side:"left"}),d.jsx(K,{side:"right"})]}),d.jsx("div",{className:P(`${I}__content-container`),children:y.Children.map(v,m=>m)})]})})};Pe.Content=Ot;exports.Tabs=Pe;exports.createTabChangeDetailEvent=Me;exports.tabsVariants=Dt;
|
|
10
10
|
//# sourceMappingURL=tabs.cjs.js.map
|