@purpurds/accordion 5.14.0 → 5.15.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,12 +1,12 @@
1
1
  Name: @purpurds/heading
2
- Version: 5.13.0
2
+ Version: 5.14.0
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.23.5
9
+ Version: 7.25.6
10
10
  License: MIT
11
11
  Private: false
12
12
  Description: babel's modular runtime helpers
@@ -202,13 +202,13 @@ SOFTWARE.
202
202
  ---
203
203
 
204
204
  Name: @purpurds/icon
205
- Version: 5.13.0
205
+ Version: 5.14.0
206
206
  License: AGPL-3.0-only
207
207
  Private: false
208
208
 
209
209
  ---
210
210
 
211
211
  Name: @purpurds/paragraph
212
- Version: 5.13.0
212
+ Version: 5.14.0
213
213
  License: AGPL-3.0-only
214
214
  Private: false
@@ -1,5 +1,5 @@
1
- import { HeadingTagType } from '@purpurds/heading';
2
1
  import { ReactNode, default as React } from 'react';
2
+ import { HeadingTagType } from '@purpurds/heading';
3
3
 
4
4
  export type AccordionItemOnClickEvent = React.MouseEvent<HTMLButtonElement, MouseEvent> & {
5
5
  currentTarget: {
@@ -2,7 +2,7 @@
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 r={}.hasOwnProperty;function n(){for(var t="",c=0;c<arguments.length;c++){var s=arguments[c];s&&(t=i(t,o(s)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var c="";for(var s in t)r.call(t,s)&&t[s]&&(c=i(c,s));return c}function i(t,c){return c?t?t+" "+c:t+c:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ae);var we=ae.exports;const Se=Ie(we),O={"purpur-heading":"_purpur-heading_k9fhq_1","purpur-heading--hyphens":"_purpur-heading--hyphens_k9fhq_8","purpur-heading--negative":"_purpur-heading--negative_k9fhq_11","purpur-heading--subsection-100":"_purpur-heading--subsection-100_k9fhq_14","purpur-heading--title-100":"_purpur-heading--title-100_k9fhq_20","purpur-heading--title-200":"_purpur-heading--title-200_k9fhq_26","purpur-heading--title-300":"_purpur-heading--title-300_k9fhq_32","purpur-heading--title-400":"_purpur-heading--title-400_k9fhq_38","purpur-heading--title-500":"_purpur-heading--title-500_k9fhq_44","purpur-heading--title-600":"_purpur-heading--title-600_k9fhq_50","purpur-heading--title-700":"_purpur-heading--title-700_k9fhq_56","purpur-heading--display-25":"_purpur-heading--display-25_k9fhq_62","purpur-heading--display-50":"_purpur-heading--display-50_k9fhq_68","purpur-heading--display-100":"_purpur-heading--display-100_k9fhq_74","purpur-heading--display-200":"_purpur-heading--display-200_k9fhq_80"},Re={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},T="purpur-heading",F=({["data-testid"]:e,children:r,className:n="",enableHyphenation:o=!1,negative:i=!1,tag:t,variant:c=Re.TITLE100,...s})=>{const l=t,u=Se([n,O[T],O[`${T}--${c}`],{[O[`${T}--hyphens`]]:o,[O[`${T}--negative`]]:i}]);return y.jsx(l,{...s,className:u,"data-testid":e,children:r})};F.displayName="Heading";function h(){return h=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},h.apply(this,arguments)}function K(e,r=[]){let n=[];function o(t,c){const s=a.createContext(c),l=n.length;n=[...n,c];function u(p){const{scope:$,children:f,...b}=p,x=($==null?void 0:$[e][l])||s,g=a.useMemo(()=>b,Object.values(b));return a.createElement(x.Provider,{value:g},f)}function d(p,$){const f=($==null?void 0:$[e][l])||s,b=a.useContext(f);if(b)return b;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${t}\``)}return u.displayName=t+"Provider",[u,d]}const i=()=>{const t=n.map(c=>a.createContext(c));return function(s){const l=(s==null?void 0:s[e])||t;return a.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[o,Oe(i,...r)]}function Oe(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(t){const c=o.reduce((s,{useScope:l,scopeName:u})=>{const p=l(t)[`__scope${u}`];return{...s,...p}},{});return a.useMemo(()=>({[`__scope${r.scopeName}`]:c}),[c])}};return n.scopeName=r.scopeName,n}function Te(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ce(...e){return r=>e.forEach(n=>Te(n,r))}function S(...e){return a.useCallback(ce(...e),e)}const j=a.forwardRef((e,r)=>{const{children:n,...o}=e,i=a.Children.toArray(n),t=i.find(je);if(t){const c=t.props.children,s=i.map(l=>l===t?a.Children.count(c)>1?a.Children.only(null):a.isValidElement(c)?c.props.children:null:l);return a.createElement(H,h({},o,{ref:r}),a.isValidElement(c)?a.cloneElement(c,void 0,s):null)}return a.createElement(H,h({},o,{ref:r}),n)});j.displayName="Slot";const H=a.forwardRef((e,r)=>{const{children:n,...o}=e;return a.isValidElement(n)?a.cloneElement(n,{...ke(o,n.props),ref:r?ce(r,n.ref):n.ref}):a.Children.count(n)>1?a.Children.only(null):null});H.displayName="SlotClone";const Me=({children:e})=>a.createElement(a.Fragment,null,e);function je(e){return a.isValidElement(e)&&e.type===Me}function ke(e,r){const n={...r};for(const o in r){const i=e[o],t=r[o];/^on[A-Z]/.test(o)?i&&t?n[o]=(...s)=>{t(...s),i(...s)}:i&&(n[o]=i):o==="style"?n[o]={...i,...t}:o==="className"&&(n[o]=[i,t].filter(Boolean).join(" "))}return{...e,...n}}function De(e){const r=e+"CollectionProvider",[n,o]=K(r),[i,t]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=f=>{const{scope:b,children:x}=f,g=a.useRef(null),_=a.useRef(new Map).current;return a.createElement(i,{scope:b,itemMap:_,collectionRef:g},x)},s=e+"CollectionSlot",l=a.forwardRef((f,b)=>{const{scope:x,children:g}=f,_=t(s,x),m=S(b,_.collectionRef);return a.createElement(j,{ref:m},g)}),u=e+"CollectionItemSlot",d="data-radix-collection-item",p=a.forwardRef((f,b)=>{const{scope:x,children:g,..._}=f,m=a.useRef(null),v=S(b,m),C=t(u,x);return a.useEffect(()=>(C.itemMap.set(m,{ref:m,..._}),()=>void C.itemMap.delete(m))),a.createElement(j,{[d]:"",ref:v},g)});function $(f){const b=t(e+"CollectionConsumer",f);return a.useCallback(()=>{const g=b.collectionRef.current;if(!g)return[];const _=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((C,P)=>_.indexOf(C.ref.current)-_.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:c,Slot:l,ItemSlot:p},$,o]}function ie(e,r,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return r==null?void 0:r(i)}}function se(e){const r=a.useRef(e);return a.useEffect(()=>{r.current=e}),a.useMemo(()=>(...n)=>{var o;return(o=r.current)===null||o===void 0?void 0:o.call(r,...n)},[])}function Y({prop:e,defaultProp:r,onChange:n=()=>{}}){const[o,i]=Le({defaultProp:r,onChange:n}),t=e!==void 0,c=t?e:o,s=se(n),l=a.useCallback(u=>{if(t){const p=typeof u=="function"?u(e):u;p!==e&&s(p)}else i(u)},[t,e,i,s]);return[c,l]}function Le({defaultProp:e,onChange:r}){const n=a.useState(e),[o]=n,i=a.useRef(o),t=se(r);return a.useEffect(()=>{i.current!==o&&(t(o),i.current=o)},[o,i,t]),n}const qe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],R=qe.reduce((e,r)=>{const n=a.forwardRef((o,i)=>{const{asChild:t,...c}=o,s=t?j:r;return a.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),a.createElement(s,h({},c,{ref:i}))});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{}),k=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{};function Ve(e,r){return a.useReducer((n,o)=>{const i=r[n][o];return i??n},e)}const le=e=>{const{present:r,children:n}=e,o=Ue(r),i=typeof n=="function"?n({present:o.isPresent}):a.Children.only(n),t=S(o.ref,i.ref);return typeof n=="function"||o.isPresent?a.cloneElement(i,{ref:t}):null};le.displayName="Presence";function Ue(e){const[r,n]=a.useState(),o=a.useRef({}),i=a.useRef(e),t=a.useRef("none"),c=e?"mounted":"unmounted",[s,l]=Ve(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const u=M(o.current);t.current=s==="mounted"?u:"none"},[s]),k(()=>{const u=o.current,d=i.current;if(d!==e){const $=t.current,f=M(u);e?l("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&$!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),k(()=>{if(r){const u=p=>{const f=M(o.current).includes(p.animationName);p.target===r&&f&&Ne.flushSync(()=>l("ANIMATION_END"))},d=p=>{p.target===r&&(t.current=M(o.current))};return r.addEventListener("animationstart",d),r.addEventListener("animationcancel",u),r.addEventListener("animationend",u),()=>{r.removeEventListener("animationstart",d),r.removeEventListener("animationcancel",u),r.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[r,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:a.useCallback(u=>{u&&(o.current=getComputedStyle(u)),n(u)},[])}}function M(e){return(e==null?void 0:e.animationName)||"none"}const ze=oe.useId||(()=>{});let Be=0;function ue(e){const[r,n]=oe.useState(ze());return k(()=>{n(o=>o??String(Be++))},[e]),r?`radix-${r}`:""}const pe="Collapsible",[He,de]=K(pe),[Ge,Z]=He(pe),Fe=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:t,onOpenChange:c,...s}=e,[l=!1,u]=Y({prop:o,defaultProp:i,onChange:c});return a.createElement(Ge,{scope:n,disabled:t,contentId:ue(),open:l,onOpenToggle:a.useCallback(()=>u(d=>!d),[u])},a.createElement(R.div,h({"data-state":J(l),"data-disabled":t?"":void 0},s,{ref:r})))}),Ke="CollapsibleTrigger",Ye=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,...o}=e,i=Z(Ke,n);return a.createElement(R.button,h({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":J(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},o,{ref:r,onClick:ie(e.onClick,i.onOpenToggle)}))}),fe="CollapsibleContent",Ze=a.forwardRef((e,r)=>{const{forceMount:n,...o}=e,i=Z(fe,e.__scopeCollapsible);return a.createElement(le,{present:n||i.open},({present:t})=>a.createElement(Je,h({},o,{ref:r,present:t})))}),Je=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,present:o,children:i,...t}=e,c=Z(fe,n),[s,l]=a.useState(o),u=a.useRef(null),d=S(r,u),p=a.useRef(0),$=p.current,f=a.useRef(0),b=f.current,x=c.open||s,g=a.useRef(x),_=a.useRef();return a.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),k(()=>{const m=u.current;if(m){_.current=_.current||{transitionDuration:m.style.transitionDuration,animationName:m.style.animationName},m.style.transitionDuration="0s",m.style.animationName="none";const v=m.getBoundingClientRect();p.current=v.height,f.current=v.width,g.current||(m.style.transitionDuration=_.current.transitionDuration,m.style.animationName=_.current.animationName),l(o)}},[c.open,o]),a.createElement(R.div,h({"data-state":J(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!x},t,{ref:d,style:{"--radix-collapsible-content-height":$?`${$}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style}}),x&&i)});function J(e){return e?"open":"closed"}const Xe=Fe,Qe=Ye,We=Ze,et=a.createContext(void 0);function tt(e){const r=a.useContext(et);return e||r||"ltr"}const E="Accordion",nt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[X,rt,ot]=De(E),[D,Ht]=K(E,[ot,de]),Q=de(),be=a.forwardRef((e,r)=>{const{type:n,...o}=e,i=o,t=o;return a.createElement(X.Provider,{scope:e.__scopeAccordion},n==="multiple"?a.createElement(st,h({},t,{ref:r})):a.createElement(it,h({},i,{ref:r})))});be.propTypes={type(e){const r=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof r=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(r)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[me,at]=D(E),[$e,ct]=D(E,{collapsible:!1}),it=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:t=!1,...c}=e,[s,l]=Y({prop:n,defaultProp:o,onChange:i});return a.createElement(me,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:l,onItemClose:a.useCallback(()=>t&&l(""),[t,l])},a.createElement($e,{scope:e.__scopeAccordion,collapsible:t},a.createElement(_e,h({},c,{ref:r}))))}),st=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},...t}=e,[c=[],s]=Y({prop:n,defaultProp:o,onChange:i}),l=a.useCallback(d=>s((p=[])=>[...p,d]),[s]),u=a.useCallback(d=>s((p=[])=>p.filter($=>$!==d)),[s]);return a.createElement(me,{scope:e.__scopeAccordion,value:c,onItemOpen:l,onItemClose:u},a.createElement($e,{scope:e.__scopeAccordion,collapsible:!0},a.createElement(_e,h({},t,{ref:r}))))}),[lt,L]=D(E),_e=a.forwardRef((e,r)=>{const{__scopeAccordion:n,disabled:o,dir:i,orientation:t="vertical",...c}=e,s=a.useRef(null),l=S(s,r),u=rt(n),p=tt(i)==="ltr",$=ie(e.onKeyDown,f=>{var b;if(!nt.includes(f.key))return;const x=f.target,g=u().filter(U=>{var z;return!((z=U.ref.current)!==null&&z!==void 0&&z.disabled)}),_=g.findIndex(U=>U.ref.current===x),m=g.length;if(_===-1)return;f.preventDefault();let v=_;const C=0,P=m-1,q=()=>{v=_+1,v>P&&(v=C)},V=()=>{v=_-1,v<C&&(v=P)};switch(f.key){case"Home":v=C;break;case"End":v=P;break;case"ArrowRight":t==="horizontal"&&(p?q():V());break;case"ArrowDown":t==="vertical"&&q();break;case"ArrowLeft":t==="horizontal"&&(p?V():q());break;case"ArrowUp":t==="vertical"&&V();break}const Ee=v%m;(b=g[Ee].ref.current)===null||b===void 0||b.focus()});return a.createElement(lt,{scope:n,disabled:o,direction:i,orientation:t},a.createElement(X.Slot,{scope:n},a.createElement(R.div,h({},c,{"data-orientation":t,ref:l,onKeyDown:o?void 0:$}))))}),G="AccordionItem",[ut,W]=D(G),pt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,value:o,...i}=e,t=L(G,n),c=at(G,n),s=Q(n),l=ue(),u=o&&c.value.includes(o)||!1,d=t.disabled||e.disabled;return a.createElement(ut,{scope:n,open:u,disabled:d,triggerId:l},a.createElement(Xe,h({"data-orientation":t.orientation,"data-state":he(u)},s,i,{ref:r,disabled:d,open:u,onOpenChange:p=>{p?c.onItemOpen(o):c.onItemClose(o)}})))}),dt="AccordionHeader",ft=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(dt,n);return a.createElement(R.h3,h({"data-orientation":i.orientation,"data-state":he(t.open),"data-disabled":t.disabled?"":void 0},o,{ref:r}))}),te="AccordionTrigger",bt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(te,n),c=ct(te,n),s=Q(n);return a.createElement(X.ItemSlot,{scope:n},a.createElement(Qe,h({"aria-disabled":t.open&&!c.collapsible||void 0,"data-orientation":i.orientation,id:t.triggerId},s,o,{ref:r})))}),mt="AccordionContent",$t=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(mt,n),c=Q(n);return a.createElement(We,h({role:"region","aria-labelledby":t.triggerId,"data-orientation":i.orientation},c,o,{ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function he(e){return e?"open":"closed"}const _t=be,ht=pt,gt=ft,vt=bt,xt=$t;function yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={exports:{}};/*!
5
+ */(function(e){(function(){var r={}.hasOwnProperty;function n(){for(var t="",c=0;c<arguments.length;c++){var s=arguments[c];s&&(t=i(t,o(s)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var c="";for(var s in t)r.call(t,s)&&t[s]&&(c=i(c,s));return c}function i(t,c){return c?t?t+" "+c:t+c:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ae);var we=ae.exports;const Se=Ie(we),O={"purpur-heading":"_purpur-heading_k9fhq_1","purpur-heading--hyphens":"_purpur-heading--hyphens_k9fhq_8","purpur-heading--negative":"_purpur-heading--negative_k9fhq_11","purpur-heading--subsection-100":"_purpur-heading--subsection-100_k9fhq_14","purpur-heading--title-100":"_purpur-heading--title-100_k9fhq_20","purpur-heading--title-200":"_purpur-heading--title-200_k9fhq_26","purpur-heading--title-300":"_purpur-heading--title-300_k9fhq_32","purpur-heading--title-400":"_purpur-heading--title-400_k9fhq_38","purpur-heading--title-500":"_purpur-heading--title-500_k9fhq_44","purpur-heading--title-600":"_purpur-heading--title-600_k9fhq_50","purpur-heading--title-700":"_purpur-heading--title-700_k9fhq_56","purpur-heading--display-25":"_purpur-heading--display-25_k9fhq_62","purpur-heading--display-50":"_purpur-heading--display-50_k9fhq_68","purpur-heading--display-100":"_purpur-heading--display-100_k9fhq_74","purpur-heading--display-200":"_purpur-heading--display-200_k9fhq_80"},Re={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},T="purpur-heading",F=({["data-testid"]:e,children:r,className:n="",enableHyphenation:o=!1,negative:i=!1,tag:t,variant:c=Re.TITLE100,...s})=>{const l=t,u=Se([n,O[T],O[`${T}--${c}`],{[O[`${T}--hyphens`]]:o,[O[`${T}--negative`]]:i}]);return y.jsx(l,{...s,className:u,"data-testid":e,children:r})};F.displayName="Heading";function h(){return h=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},h.apply(null,arguments)}function K(e,r=[]){let n=[];function o(t,c){const s=a.createContext(c),l=n.length;n=[...n,c];function u(p){const{scope:$,children:f,...b}=p,x=($==null?void 0:$[e][l])||s,g=a.useMemo(()=>b,Object.values(b));return a.createElement(x.Provider,{value:g},f)}function d(p,$){const f=($==null?void 0:$[e][l])||s,b=a.useContext(f);if(b)return b;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${t}\``)}return u.displayName=t+"Provider",[u,d]}const i=()=>{const t=n.map(c=>a.createContext(c));return function(s){const l=(s==null?void 0:s[e])||t;return a.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[o,Oe(i,...r)]}function Oe(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(t){const c=o.reduce((s,{useScope:l,scopeName:u})=>{const p=l(t)[`__scope${u}`];return{...s,...p}},{});return a.useMemo(()=>({[`__scope${r.scopeName}`]:c}),[c])}};return n.scopeName=r.scopeName,n}function Te(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ce(...e){return r=>e.forEach(n=>Te(n,r))}function S(...e){return a.useCallback(ce(...e),e)}const j=a.forwardRef((e,r)=>{const{children:n,...o}=e,i=a.Children.toArray(n),t=i.find(je);if(t){const c=t.props.children,s=i.map(l=>l===t?a.Children.count(c)>1?a.Children.only(null):a.isValidElement(c)?c.props.children:null:l);return a.createElement(H,h({},o,{ref:r}),a.isValidElement(c)?a.cloneElement(c,void 0,s):null)}return a.createElement(H,h({},o,{ref:r}),n)});j.displayName="Slot";const H=a.forwardRef((e,r)=>{const{children:n,...o}=e;return a.isValidElement(n)?a.cloneElement(n,{...ke(o,n.props),ref:r?ce(r,n.ref):n.ref}):a.Children.count(n)>1?a.Children.only(null):null});H.displayName="SlotClone";const Me=({children:e})=>a.createElement(a.Fragment,null,e);function je(e){return a.isValidElement(e)&&e.type===Me}function ke(e,r){const n={...r};for(const o in r){const i=e[o],t=r[o];/^on[A-Z]/.test(o)?i&&t?n[o]=(...s)=>{t(...s),i(...s)}:i&&(n[o]=i):o==="style"?n[o]={...i,...t}:o==="className"&&(n[o]=[i,t].filter(Boolean).join(" "))}return{...e,...n}}function De(e){const r=e+"CollectionProvider",[n,o]=K(r),[i,t]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=f=>{const{scope:b,children:x}=f,g=a.useRef(null),_=a.useRef(new Map).current;return a.createElement(i,{scope:b,itemMap:_,collectionRef:g},x)},s=e+"CollectionSlot",l=a.forwardRef((f,b)=>{const{scope:x,children:g}=f,_=t(s,x),m=S(b,_.collectionRef);return a.createElement(j,{ref:m},g)}),u=e+"CollectionItemSlot",d="data-radix-collection-item",p=a.forwardRef((f,b)=>{const{scope:x,children:g,..._}=f,m=a.useRef(null),v=S(b,m),C=t(u,x);return a.useEffect(()=>(C.itemMap.set(m,{ref:m,..._}),()=>void C.itemMap.delete(m))),a.createElement(j,{[d]:"",ref:v},g)});function $(f){const b=t(e+"CollectionConsumer",f);return a.useCallback(()=>{const g=b.collectionRef.current;if(!g)return[];const _=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((C,P)=>_.indexOf(C.ref.current)-_.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:c,Slot:l,ItemSlot:p},$,o]}function ie(e,r,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return r==null?void 0:r(i)}}function se(e){const r=a.useRef(e);return a.useEffect(()=>{r.current=e}),a.useMemo(()=>(...n)=>{var o;return(o=r.current)===null||o===void 0?void 0:o.call(r,...n)},[])}function Y({prop:e,defaultProp:r,onChange:n=()=>{}}){const[o,i]=Le({defaultProp:r,onChange:n}),t=e!==void 0,c=t?e:o,s=se(n),l=a.useCallback(u=>{if(t){const p=typeof u=="function"?u(e):u;p!==e&&s(p)}else i(u)},[t,e,i,s]);return[c,l]}function Le({defaultProp:e,onChange:r}){const n=a.useState(e),[o]=n,i=a.useRef(o),t=se(r);return a.useEffect(()=>{i.current!==o&&(t(o),i.current=o)},[o,i,t]),n}const qe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],R=qe.reduce((e,r)=>{const n=a.forwardRef((o,i)=>{const{asChild:t,...c}=o,s=t?j:r;return a.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),a.createElement(s,h({},c,{ref:i}))});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{}),k=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{};function Ve(e,r){return a.useReducer((n,o)=>{const i=r[n][o];return i??n},e)}const le=e=>{const{present:r,children:n}=e,o=Ue(r),i=typeof n=="function"?n({present:o.isPresent}):a.Children.only(n),t=S(o.ref,i.ref);return typeof n=="function"||o.isPresent?a.cloneElement(i,{ref:t}):null};le.displayName="Presence";function Ue(e){const[r,n]=a.useState(),o=a.useRef({}),i=a.useRef(e),t=a.useRef("none"),c=e?"mounted":"unmounted",[s,l]=Ve(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const u=M(o.current);t.current=s==="mounted"?u:"none"},[s]),k(()=>{const u=o.current,d=i.current;if(d!==e){const $=t.current,f=M(u);e?l("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&$!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),k(()=>{if(r){const u=p=>{const f=M(o.current).includes(p.animationName);p.target===r&&f&&Ne.flushSync(()=>l("ANIMATION_END"))},d=p=>{p.target===r&&(t.current=M(o.current))};return r.addEventListener("animationstart",d),r.addEventListener("animationcancel",u),r.addEventListener("animationend",u),()=>{r.removeEventListener("animationstart",d),r.removeEventListener("animationcancel",u),r.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[r,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:a.useCallback(u=>{u&&(o.current=getComputedStyle(u)),n(u)},[])}}function M(e){return(e==null?void 0:e.animationName)||"none"}const ze=oe.useId||(()=>{});let Be=0;function ue(e){const[r,n]=oe.useState(ze());return k(()=>{n(o=>o??String(Be++))},[e]),r?`radix-${r}`:""}const pe="Collapsible",[He,de]=K(pe),[Ge,Z]=He(pe),Fe=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:t,onOpenChange:c,...s}=e,[l=!1,u]=Y({prop:o,defaultProp:i,onChange:c});return a.createElement(Ge,{scope:n,disabled:t,contentId:ue(),open:l,onOpenToggle:a.useCallback(()=>u(d=>!d),[u])},a.createElement(R.div,h({"data-state":J(l),"data-disabled":t?"":void 0},s,{ref:r})))}),Ke="CollapsibleTrigger",Ye=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,...o}=e,i=Z(Ke,n);return a.createElement(R.button,h({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":J(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},o,{ref:r,onClick:ie(e.onClick,i.onOpenToggle)}))}),fe="CollapsibleContent",Ze=a.forwardRef((e,r)=>{const{forceMount:n,...o}=e,i=Z(fe,e.__scopeCollapsible);return a.createElement(le,{present:n||i.open},({present:t})=>a.createElement(Je,h({},o,{ref:r,present:t})))}),Je=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,present:o,children:i,...t}=e,c=Z(fe,n),[s,l]=a.useState(o),u=a.useRef(null),d=S(r,u),p=a.useRef(0),$=p.current,f=a.useRef(0),b=f.current,x=c.open||s,g=a.useRef(x),_=a.useRef();return a.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),k(()=>{const m=u.current;if(m){_.current=_.current||{transitionDuration:m.style.transitionDuration,animationName:m.style.animationName},m.style.transitionDuration="0s",m.style.animationName="none";const v=m.getBoundingClientRect();p.current=v.height,f.current=v.width,g.current||(m.style.transitionDuration=_.current.transitionDuration,m.style.animationName=_.current.animationName),l(o)}},[c.open,o]),a.createElement(R.div,h({"data-state":J(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!x},t,{ref:d,style:{"--radix-collapsible-content-height":$?`${$}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style}}),x&&i)});function J(e){return e?"open":"closed"}const Xe=Fe,Qe=Ye,We=Ze,et=a.createContext(void 0);function tt(e){const r=a.useContext(et);return e||r||"ltr"}const E="Accordion",nt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[X,rt,ot]=De(E),[D,Ht]=K(E,[ot,de]),Q=de(),be=a.forwardRef((e,r)=>{const{type:n,...o}=e,i=o,t=o;return a.createElement(X.Provider,{scope:e.__scopeAccordion},n==="multiple"?a.createElement(st,h({},t,{ref:r})):a.createElement(it,h({},i,{ref:r})))});be.propTypes={type(e){const r=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof r=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(r)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[me,at]=D(E),[$e,ct]=D(E,{collapsible:!1}),it=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:t=!1,...c}=e,[s,l]=Y({prop:n,defaultProp:o,onChange:i});return a.createElement(me,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:l,onItemClose:a.useCallback(()=>t&&l(""),[t,l])},a.createElement($e,{scope:e.__scopeAccordion,collapsible:t},a.createElement(_e,h({},c,{ref:r}))))}),st=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},...t}=e,[c=[],s]=Y({prop:n,defaultProp:o,onChange:i}),l=a.useCallback(d=>s((p=[])=>[...p,d]),[s]),u=a.useCallback(d=>s((p=[])=>p.filter($=>$!==d)),[s]);return a.createElement(me,{scope:e.__scopeAccordion,value:c,onItemOpen:l,onItemClose:u},a.createElement($e,{scope:e.__scopeAccordion,collapsible:!0},a.createElement(_e,h({},t,{ref:r}))))}),[lt,L]=D(E),_e=a.forwardRef((e,r)=>{const{__scopeAccordion:n,disabled:o,dir:i,orientation:t="vertical",...c}=e,s=a.useRef(null),l=S(s,r),u=rt(n),p=tt(i)==="ltr",$=ie(e.onKeyDown,f=>{var b;if(!nt.includes(f.key))return;const x=f.target,g=u().filter(U=>{var z;return!((z=U.ref.current)!==null&&z!==void 0&&z.disabled)}),_=g.findIndex(U=>U.ref.current===x),m=g.length;if(_===-1)return;f.preventDefault();let v=_;const C=0,P=m-1,q=()=>{v=_+1,v>P&&(v=C)},V=()=>{v=_-1,v<C&&(v=P)};switch(f.key){case"Home":v=C;break;case"End":v=P;break;case"ArrowRight":t==="horizontal"&&(p?q():V());break;case"ArrowDown":t==="vertical"&&q();break;case"ArrowLeft":t==="horizontal"&&(p?V():q());break;case"ArrowUp":t==="vertical"&&V();break}const Ee=v%m;(b=g[Ee].ref.current)===null||b===void 0||b.focus()});return a.createElement(lt,{scope:n,disabled:o,direction:i,orientation:t},a.createElement(X.Slot,{scope:n},a.createElement(R.div,h({},c,{"data-orientation":t,ref:l,onKeyDown:o?void 0:$}))))}),G="AccordionItem",[ut,W]=D(G),pt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,value:o,...i}=e,t=L(G,n),c=at(G,n),s=Q(n),l=ue(),u=o&&c.value.includes(o)||!1,d=t.disabled||e.disabled;return a.createElement(ut,{scope:n,open:u,disabled:d,triggerId:l},a.createElement(Xe,h({"data-orientation":t.orientation,"data-state":he(u)},s,i,{ref:r,disabled:d,open:u,onOpenChange:p=>{p?c.onItemOpen(o):c.onItemClose(o)}})))}),dt="AccordionHeader",ft=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(dt,n);return a.createElement(R.h3,h({"data-orientation":i.orientation,"data-state":he(t.open),"data-disabled":t.disabled?"":void 0},o,{ref:r}))}),te="AccordionTrigger",bt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(te,n),c=ct(te,n),s=Q(n);return a.createElement(X.ItemSlot,{scope:n},a.createElement(Qe,h({"aria-disabled":t.open&&!c.collapsible||void 0,"data-orientation":i.orientation,id:t.triggerId},s,o,{ref:r})))}),mt="AccordionContent",$t=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(mt,n),c=Q(n);return a.createElement(We,h({role:"region","aria-labelledby":t.triggerId,"data-orientation":i.orientation},c,o,{ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function he(e){return e?"open":"closed"}const _t=be,ht=pt,gt=ft,vt=bt,xt=$t;function yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={exports:{}};/*!
6
6
  Copyright (c) 2018 Jed Watson.
7
7
  Licensed under the MIT License (MIT), see
8
8
  http://jedwatson.github.io/classnames