@purpurds/accordion 5.24.2 → 5.25.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 +3 -165
- package/dist/accordion-item.d.ts +9 -8
- package/dist/accordion-item.d.ts.map +1 -1
- package/dist/accordion.cjs.js +5 -5
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.d.ts +10 -3
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.es.js +276 -907
- package/dist/accordion.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -6
- package/src/accordion-item.module.scss +46 -57
- package/src/accordion-item.tsx +73 -56
- package/src/accordion.module.scss +2 -2
- package/src/accordion.stories.tsx +39 -17
- package/src/accordion.test.tsx +3 -17
- package/src/accordion.tsx +25 -22
package/dist/LICENSE.txt
CHANGED
@@ -1,172 +1,10 @@
|
|
1
1
|
Name: @purpurds/heading
|
2
|
-
Version: 5.24.
|
2
|
+
Version: 5.24.3
|
3
3
|
License: AGPL-3.0-only
|
4
4
|
Private: false
|
5
5
|
|
6
6
|
---
|
7
7
|
|
8
|
-
Name: @babel/runtime
|
9
|
-
Version: 7.25.6
|
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
|
-
Name: @radix-ui/react-context
|
45
|
-
Version: 1.0.1
|
46
|
-
License: MIT
|
47
|
-
Private: false
|
48
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
49
|
-
Homepage: https://radix-ui.com/primitives
|
50
|
-
|
51
|
-
---
|
52
|
-
|
53
|
-
Name: @radix-ui/react-compose-refs
|
54
|
-
Version: 1.0.1
|
55
|
-
License: MIT
|
56
|
-
Private: false
|
57
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
58
|
-
Homepage: https://radix-ui.com/primitives
|
59
|
-
|
60
|
-
---
|
61
|
-
|
62
|
-
Name: @radix-ui/react-slot
|
63
|
-
Version: 1.0.2
|
64
|
-
License: MIT
|
65
|
-
Private: false
|
66
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
67
|
-
Homepage: https://radix-ui.com/primitives
|
68
|
-
|
69
|
-
---
|
70
|
-
|
71
|
-
Name: @radix-ui/react-collection
|
72
|
-
Version: 1.0.3
|
73
|
-
License: MIT
|
74
|
-
Private: false
|
75
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
76
|
-
Homepage: https://radix-ui.com/primitives
|
77
|
-
|
78
|
-
---
|
79
|
-
|
80
|
-
Name: @radix-ui/primitive
|
81
|
-
Version: 1.0.1
|
82
|
-
License: MIT
|
83
|
-
Private: false
|
84
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
85
|
-
Homepage: https://radix-ui.com/primitives
|
86
|
-
|
87
|
-
---
|
88
|
-
|
89
|
-
Name: @radix-ui/react-use-callback-ref
|
90
|
-
Version: 1.0.1
|
91
|
-
License: MIT
|
92
|
-
Private: false
|
93
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
94
|
-
Homepage: https://radix-ui.com/primitives
|
95
|
-
|
96
|
-
---
|
97
|
-
|
98
|
-
Name: @radix-ui/react-use-controllable-state
|
99
|
-
Version: 1.0.1
|
100
|
-
License: MIT
|
101
|
-
Private: false
|
102
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
103
|
-
Homepage: https://radix-ui.com/primitives
|
104
|
-
|
105
|
-
---
|
106
|
-
|
107
|
-
Name: @radix-ui/react-primitive
|
108
|
-
Version: 1.0.3
|
109
|
-
License: MIT
|
110
|
-
Private: false
|
111
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
112
|
-
Homepage: https://radix-ui.com/primitives
|
113
|
-
|
114
|
-
---
|
115
|
-
|
116
|
-
Name: @radix-ui/react-use-layout-effect
|
117
|
-
Version: 1.0.1
|
118
|
-
License: MIT
|
119
|
-
Private: false
|
120
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
121
|
-
Homepage: https://radix-ui.com/primitives
|
122
|
-
|
123
|
-
---
|
124
|
-
|
125
|
-
Name: @radix-ui/react-presence
|
126
|
-
Version: 1.0.1
|
127
|
-
License: MIT
|
128
|
-
Private: false
|
129
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
130
|
-
Homepage: https://radix-ui.com/primitives
|
131
|
-
|
132
|
-
---
|
133
|
-
|
134
|
-
Name: @radix-ui/react-id
|
135
|
-
Version: 1.0.1
|
136
|
-
License: MIT
|
137
|
-
Private: false
|
138
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
139
|
-
Homepage: https://radix-ui.com/primitives
|
140
|
-
|
141
|
-
---
|
142
|
-
|
143
|
-
Name: @radix-ui/react-collapsible
|
144
|
-
Version: 1.0.3
|
145
|
-
License: MIT
|
146
|
-
Private: false
|
147
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
148
|
-
Homepage: https://radix-ui.com/primitives
|
149
|
-
|
150
|
-
---
|
151
|
-
|
152
|
-
Name: @radix-ui/react-direction
|
153
|
-
Version: 1.0.1
|
154
|
-
License: MIT
|
155
|
-
Private: false
|
156
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
157
|
-
Homepage: https://radix-ui.com/primitives
|
158
|
-
|
159
|
-
---
|
160
|
-
|
161
|
-
Name: @radix-ui/react-accordion
|
162
|
-
Version: 1.1.2
|
163
|
-
License: MIT
|
164
|
-
Private: false
|
165
|
-
Repository: git+https://github.com/radix-ui/primitives.git
|
166
|
-
Homepage: https://radix-ui.com/primitives
|
167
|
-
|
168
|
-
---
|
169
|
-
|
170
8
|
Name: classnames
|
171
9
|
Version: 2.5.1
|
172
10
|
License: MIT
|
@@ -202,13 +40,13 @@ SOFTWARE.
|
|
202
40
|
---
|
203
41
|
|
204
42
|
Name: @purpurds/icon
|
205
|
-
Version: 5.24.
|
43
|
+
Version: 5.24.3
|
206
44
|
License: AGPL-3.0-only
|
207
45
|
Private: false
|
208
46
|
|
209
47
|
---
|
210
48
|
|
211
49
|
Name: @purpurds/paragraph
|
212
|
-
Version: 5.24.
|
50
|
+
Version: 5.24.3
|
213
51
|
License: AGPL-3.0-only
|
214
52
|
Private: false
|
package/dist/accordion-item.d.ts
CHANGED
@@ -12,13 +12,10 @@ export type AccordionItemProps = {
|
|
12
12
|
["data-testid"]?: string;
|
13
13
|
children: ReactNode;
|
14
14
|
/**
|
15
|
-
*
|
16
|
-
|
15
|
+
* @deprecated
|
16
|
+
*/
|
17
17
|
negative?: boolean;
|
18
18
|
className?: string;
|
19
|
-
/**
|
20
|
-
* Title of the accordion item
|
21
|
-
* */
|
22
19
|
title: string;
|
23
20
|
/**
|
24
21
|
* This is the heading tag used for the accordion item title. Defaults to h3.
|
@@ -26,14 +23,18 @@ export type AccordionItemProps = {
|
|
26
23
|
*/
|
27
24
|
titleTag?: HeadingTagType;
|
28
25
|
/**
|
29
|
-
*
|
30
|
-
|
26
|
+
* @deprecated
|
27
|
+
*/
|
31
28
|
value?: string;
|
29
|
+
/**
|
30
|
+
* Makes it possible to set the initial state to opened.
|
31
|
+
* */
|
32
|
+
initialOpen?: boolean;
|
32
33
|
/**
|
33
34
|
* onClick is called when accordion item is expanded or collapsed
|
34
35
|
* event.currentTarget.dataset.state will be either "open" or "closed"
|
35
36
|
*/
|
36
37
|
onClick?: (event: AccordionItemOnClickEvent) => void;
|
37
38
|
};
|
38
|
-
export declare const AccordionItem:
|
39
|
+
export declare const AccordionItem: ({ children, className, title, titleTag, initialOpen, onClick, ...props }: AccordionItemProps) => React.JSX.Element;
|
39
40
|
//# sourceMappingURL=accordion-item.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accordion-item.d.ts","sourceRoot":"","sources":["../src/accordion-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"accordion-item.d.ts","sourceRoot":"","sources":["../src/accordion-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAaxD,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;IACxF,aAAa,EAAE;QAAE,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAA;SAAE,CAAA;KAAE,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;SAEK;IACL,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,aAAa,6EAQvB,kBAAkB,sBAuDpB,CAAC"}
|
package/dist/accordion.cjs.js
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),m=require("react");function R(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var j={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 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 Se=ae.exports;const Re=we(Se),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"},Oe={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=Oe.TITLE100,...s})=>{const l=t,u=Re([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,Te(i,...r)]}function Te(...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 Me(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ce(...e){return r=>e.forEach(n=>Me(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(ke);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,{...De(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 je=({children:e})=>a.createElement(a.Fragment,null,e);function ke(e){return a.isValidElement(e)&&e.type===je}function De(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 Le(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,I)=>_.indexOf(C.ref.current)-_.indexOf(I.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]=qe({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 qe({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 Ve=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],R=Ve.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 Ue(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=ze(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 ze(e){const[r,n]=a.useState(),o=a.useRef({}),i=a.useRef(e),t=a.useRef("none"),c=e?"mounted":"unmounted",[s,l]=Ue(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&&Ie.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 Be=oe.useId||(()=>{});let He=0;function ue(e){const[r,n]=oe.useState(Be());return k(()=>{n(o=>o??String(He++))},[e]),r?`radix-${r}`:""}const pe="Collapsible",[Ge,de]=K(pe),[Fe,Z]=Ge(pe),Ke=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(Fe,{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})))}),Ye="CollapsibleTrigger",Ze=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,...o}=e,i=Z(Ye,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",Je=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(Xe,h({},o,{ref:r,present:t})))}),Xe=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 Qe=Ke,We=Ze,et=Je,tt=a.createContext(void 0);function nt(e){const r=a.useContext(tt);return e||r||"ltr"}const E="Accordion",rt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[X,ot,at]=Le(E),[D,Ht]=K(E,[at,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(lt,h({},t,{ref:r})):a.createElement(st,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,ct]=D(E),[$e,it]=D(E,{collapsible:!1}),st=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}))))}),lt=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}))))}),[ut,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=ot(n),p=nt(i)==="ltr",$=ie(e.onKeyDown,f=>{var b;if(!rt.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,I=m-1,q=()=>{v=_+1,v>I&&(v=C)},V=()=>{v=_-1,v<C&&(v=I)};switch(f.key){case"Home":v=C;break;case"End":v=I;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 Ne=v%m;(b=g[Ne].ref.current)===null||b===void 0||b.focus()});return a.createElement(ut,{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",[pt,W]=D(G),dt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,value:o,...i}=e,t=L(G,n),c=ct(G,n),s=Q(n),l=ue(),u=o&&c.value.includes(o)||!1,d=t.disabled||e.disabled;return a.createElement(pt,{scope:n,open:u,disabled:d,triggerId:l},a.createElement(Qe,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)}})))}),ft="AccordionHeader",bt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(ft,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",mt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(te,n),c=it(te,n),s=Q(n);return a.createElement(X.ItemSlot,{scope:n},a.createElement(We,h({"aria-disabled":t.open&&!c.collapsible||void 0,"data-orientation":i.orientation,id:t.triggerId},s,o,{ref:r})))}),$t="AccordionContent",_t=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W($t,n),c=Q(n);return a.createElement(et,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 ht=be,gt=dt,vt=bt,xt=mt,yt=_t;function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={exports:{}};/*!
|
5
|
+
*/(function(t){(function(){var n={}.hasOwnProperty;function p(){for(var r="",e=0;e<arguments.length;e++){var a=arguments[e];a&&(r=i(r,u(a)))}return r}function u(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return p.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var e="";for(var a in r)n.call(r,a)&&r[a]&&(e=i(e,a));return e}function i(r,e){return e?r?r+" "+e:r+e:r}t.exports?(p.default=p,t.exports=p):window.classNames=p})()})(j);var k=j.exports;const M=R(k),g={"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"},H={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},f="purpur-heading",y=({["data-testid"]:t,children:n,className:p="",enableHyphenation:u=!1,negative:i=!1,tag:r,variant:e=H.TITLE100,...a})=>{const s=r,c=M([p,g[f],g[`${f}--${e}`],{[g[`${f}--hyphens`]]:u,[g[`${f}--negative`]]:i}]);return o.jsx(s,{...a,className:c,"data-testid":t,children:n})};y.displayName="Heading";function C(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var N={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(
|
9
|
+
*/(function(t){(function(){var n={}.hasOwnProperty;function p(){for(var r="",e=0;e<arguments.length;e++){var a=arguments[e];a&&(r=i(r,u.call(this,a)))}return r}function u(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return p.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var e="";for(var a in r)n.call(r,a)&&r[a]&&(e=i(e,this&&this[a]||a));return e}function i(r,e){return e?r?r+" "+e:r+e:r}t.exports?(p.default=p,t.exports=p):window.classNames=p})()})(N);var D=N.exports;const w=C(D),B={"purpur-accordion":"_purpur-accordion_u887g_1","purpur-accordion__title":"_purpur-accordion__title_u887g_4","purpur-accordion--negative":"_purpur-accordion--negative_u887g_13"};function G(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var S={exports:{}};/*!
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
11
11
|
Licensed under the MIT License (MIT), see
|
12
12
|
http://jedwatson.github.io/classnames
|
13
|
-
*/(function(
|
13
|
+
*/(function(t){(function(){var n={}.hasOwnProperty;function p(){for(var r="",e=0;e<arguments.length;e++){var a=arguments[e];a&&(r=i(r,u.call(this,a)))}return r}function u(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return p.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var e="";for(var a in r)n.call(r,a)&&r[a]&&(e=i(e,this&&this[a]||a));return e}function i(r,e){return e?r?r+" "+e:r+e:r}t.exports?(p.default=p,t.exports=p):window.classNames=p})()})(S);var V=S.exports;const U=G(V),z={"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"},F={name:"chevron-down",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M20.136 7.864a.9.9 0 0 0-1.272 0L12 14.727 5.136 7.864a.9.9 0 0 0-1.272 1.272l7.5 7.5a.9.9 0 0 0 1.272 0l7.5-7.5a.9.9 0 0 0 0-1.272Z" clip-rule="evenodd"/></svg>',keywords:["chevron-down"],category:"utility"},T=t=>o.jsx(O,{...t,svg:F});T.displayName="IconChevronDown";const J=U.bind(z),$="purpur-icon",X="md",Y=t=>t.filter(n=>Object.keys(n).length>=1).map(n=>`${n.name}="${n.value}"`).join(" "),Z=({content:t="",title:n}={})=>{const p=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},n?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],u=n?`<title>${n}</title>`:"";return`<svg ${Y(p)}>${u}${t}</svg>`},K=t=>t.replace(/<(\/?)svg([^>]*)>/g,"").trim(),O=({["data-testid"]:t,svg:n,allyTitle:p,className:u,size:i=X,...r})=>{const e=Z({content:K(n.svg),title:p}),a=J(u,$,`${$}--${i}`);return o.jsx("span",{"aria-label":p,className:a,"data-testid":t,dangerouslySetInnerHTML:{__html:e},...r})};O.displayName="Icon";function Q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var q={exports:{}};/*!
|
14
14
|
Copyright (c) 2018 Jed Watson.
|
15
15
|
Licensed under the MIT License (MIT), see
|
16
16
|
http://jedwatson.github.io/classnames
|
17
|
-
*/(function(
|
17
|
+
*/(function(t){(function(){var n={}.hasOwnProperty;function p(){for(var r="",e=0;e<arguments.length;e++){var a=arguments[e];a&&(r=i(r,u(a)))}return r}function u(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return p.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var e="";for(var a in r)n.call(r,a)&&r[a]&&(e=i(e,a));return e}function i(r,e){return e?r?r+" "+e:r+e:r}t.exports?(p.default=p,t.exports=p):window.classNames=p})()})(q);var W=q.exports;const rr=Q(W),_={"purpur-paragraph":"_purpur-paragraph_1rh57_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_1rh57_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_1rh57_10","purpur-paragraph--negative":"_purpur-paragraph--negative_1rh57_13","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_1rh57_16","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_1rh57_22","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_1rh57_29","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_1rh57_36","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_1rh57_42","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_1rh57_48","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_1rh57_54","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_1rh57_60","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_1rh57_67","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_1rh57_75"},er={PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"},h="purpur-paragraph",I=({["data-testid"]:t,children:n,className:p,disabled:u,enableHyphenation:i=!1,negative:r=!1,variant:e=er.PARAGRAPH100,...a})=>{const s=rr([p,_[h],_[`${h}--${e}`],{[_[`${h}--hyphens`]]:i,[_[`${h}--disabled`]]:u,[_[`${h}--negative`]]:r}]);return o.jsx("p",{...a,className:s,"data-testid":t,children:n})};I.displayName="Paragraph";const tr={"purpur-accordion-item":"_purpur-accordion-item_29ds4_1","purpur-accordion-item__header":"_purpur-accordion-item__header_29ds4_10","purpur-accordion-item__trigger":"_purpur-accordion-item__trigger_29ds4_13","purpur-accordion-item__trigger__icon":"_purpur-accordion-item__trigger__icon_29ds4_43","purpur-accordion-item__title":"_purpur-accordion-item__title_29ds4_49","purpur-accordion-item__rotate":"_purpur-accordion-item__rotate_29ds4_63","purpur-accordion-item__icon":"_purpur-accordion-item__icon_29ds4_63","purpur-accordion-item__content":"_purpur-accordion-item__content_29ds4_66","purpur-accordion-item__contentText":"_purpur-accordion-item__contentText_29ds4_79","purpur-accordion-item--negative":"_purpur-accordion-item--negative_29ds4_98"},d=w.bind(tr),l="purpur-accordion-item",ar=({children:t,className:n,title:p,titleTag:u="h3",initialOpen:i=!1,onClick:r,...e})=>{const a=m.useContext(x),s=m.useId(),[c,P]=m.useState(!i),E=d([n,l,{[`${l}--negative`]:a}]);return o.jsxs("div",{className:E,...e,children:[o.jsx(y,{tag:u,variant:"title-100",className:d([`${l}__header`,`${l}__title`]),children:o.jsxs("button",{type:"button","data-state":c?"open":"close",onClick:L=>{r&&r(L),P(!c)},className:d(`${l}__trigger`,n,{[`${l}__rotate`]:!c}),"aria-expanded":!c,"aria-controls":s,id:s+"button",children:[p,o.jsx(T,{size:"md",className:d(`${l}__icon`),"aria-hidden":!0})]})}),o.jsx("div",{className:d(`${l}__content`,n),"aria-hidden":c,id:s,"aria-labelledby":s+"button",role:"region",children:o.jsx("div",{className:d(`${l}__contentText`),children:typeof t=="string"?o.jsx(I,{variant:"paragraph-200",children:t}):t})})]})},A=w.bind(B),v="purpur-accordion",x=m.createContext(!1),b=({["data-testid"]:t,children:n,className:p,negative:u=!1,title:i,titleTag:r="h2",titleVariant:e="title-300",schema:a,...s})=>{const c=A([p,v,{[`${v}--negative`]:u}]);return o.jsxs("div",{className:c,"data-testid":t,...s,children:[i&&o.jsx(y,{tag:r,variant:e,className:A(`${v}__title`),children:i}),o.jsx(x.Provider,{value:u,children:n}),a&&o.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:a}})]})};b.Item=ar;b.displayName="Accordion";exports.Accordion=b;exports.NegativeContext=x;
|
18
18
|
//# sourceMappingURL=accordion.cjs.js.map
|