@purpurds/accordion 0.0.1
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 +214 -0
- package/dist/accordion-item.d.ts +22 -0
- package/dist/accordion-item.d.ts.map +1 -0
- package/dist/accordion.cjs.js +18 -0
- package/dist/accordion.cjs.js.map +1 -0
- package/dist/accordion.d.ts +25 -0
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.es.js +1044 -0
- package/dist/accordion.es.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +62 -0
- package/readme.mdx +76 -0
- package/src/accordion-item.module.scss +150 -0
- package/src/accordion-item.stories.tsx +36 -0
- package/src/accordion-item.tsx +81 -0
- package/src/accordion.module.scss +22 -0
- package/src/accordion.stories.tsx +48 -0
- package/src/accordion.test.tsx +65 -0
- package/src/accordion.tsx +66 -0
- package/src/global.d.ts +4 -0
package/dist/LICENSE.txt
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
Name: @purpurds/heading
|
2
|
+
Version: 5.0.0
|
3
|
+
License: AGPL-3.0-only
|
4
|
+
Private: false
|
5
|
+
|
6
|
+
---
|
7
|
+
|
8
|
+
Name: @babel/runtime
|
9
|
+
Version: 7.23.5
|
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
|
+
Name: classnames
|
171
|
+
Version: 2.5.1
|
172
|
+
License: MIT
|
173
|
+
Private: false
|
174
|
+
Description: A simple utility for conditionally joining classNames together
|
175
|
+
Repository: git+https://github.com/JedWatson/classnames.git
|
176
|
+
Author: Jed Watson
|
177
|
+
License Copyright:
|
178
|
+
===
|
179
|
+
|
180
|
+
The MIT License (MIT)
|
181
|
+
|
182
|
+
Copyright (c) 2018 Jed Watson
|
183
|
+
|
184
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
185
|
+
of this software and associated documentation files (the "Software"), to deal
|
186
|
+
in the Software without restriction, including without limitation the rights
|
187
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
188
|
+
copies of the Software, and to permit persons to whom the Software is
|
189
|
+
furnished to do so, subject to the following conditions:
|
190
|
+
|
191
|
+
The above copyright notice and this permission notice shall be included in all
|
192
|
+
copies or substantial portions of the Software.
|
193
|
+
|
194
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
195
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
196
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
197
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
198
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
199
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
200
|
+
SOFTWARE.
|
201
|
+
|
202
|
+
---
|
203
|
+
|
204
|
+
Name: @purpurds/icon
|
205
|
+
Version: 5.0.0
|
206
|
+
License: AGPL-3.0-only
|
207
|
+
Private: false
|
208
|
+
|
209
|
+
---
|
210
|
+
|
211
|
+
Name: @purpurds/paragraph
|
212
|
+
Version: 5.0.0
|
213
|
+
License: AGPL-3.0-only
|
214
|
+
Private: false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { default as React, ReactElement, ReactNode, ReactPortal } from 'react';
|
2
|
+
|
3
|
+
export type AccordionItemProps = {
|
4
|
+
["data-testid"]?: string;
|
5
|
+
children: ReactNode;
|
6
|
+
/**
|
7
|
+
* Different accordion styling
|
8
|
+
* */
|
9
|
+
negative?: boolean;
|
10
|
+
className?: string;
|
11
|
+
/**
|
12
|
+
* Title of the accordion item
|
13
|
+
* */
|
14
|
+
title: string;
|
15
|
+
/**
|
16
|
+
* Value is used to identify the accordion. By default title is used for that purpose. If there are identical titles in the accordion, then value should be defined.
|
17
|
+
* */
|
18
|
+
value?: string;
|
19
|
+
};
|
20
|
+
export declare const AccordionItem: ({ children, className, title, negative, ...props }: AccordionItemProps) => React.JSX.Element;
|
21
|
+
export declare const isAccordionItem: (child: ReactElement | Iterable<ReactNode> | ReactPortal | string | number | boolean | null | undefined) => child is React.ReactElement<AccordionItemProps, string | React.JSXElementConstructor<any>>;
|
22
|
+
//# sourceMappingURL=accordion-item.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"accordion-item.d.ts","sourceRoot":"","sources":["../src/accordion-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkB,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAapF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB;;SAEK;IACL,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;SAEK;IACL,KAAK,EAAE,MAAM,CAAC;IACd;;SAEK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,uDAMvB,kBAAkB,sBA8BpB,CAAC;AAEF,eAAO,MAAM,eAAe,UAEtB,YAAY,GACZ,SAAS,SAAS,CAAC,GACnB,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,+FAE6D,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),a=require("react"),Ee=require("react-dom");function Ne(e){const r=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(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const ne=Ne(a);function Ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}};/*!
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
3
|
+
Licensed under the MIT License (MIT), see
|
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})()})(re);var Pe=re.exports;const we=Ie(Pe),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"},Se={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",oe=({["data-testid"]:e,children:r,className:n="",enableHyphenation:o=!1,negative:i=!1,tag:t,variant:c=Se.TITLE100,...s})=>{const l=t,u=we([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})};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 F(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,Re(i,...r)]}function Re(...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 Oe(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ae(...e){return r=>e.forEach(n=>Oe(n,r))}function S(...e){return a.useCallback(ae(...e),e)}const k=a.forwardRef((e,r)=>{const{children:n,...o}=e,i=a.Children.toArray(n),t=i.find(Me);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(G,h({},o,{ref:r}),a.isValidElement(c)?a.cloneElement(c,void 0,s):null)}return a.createElement(G,h({},o,{ref:r}),n)});k.displayName="Slot";const G=a.forwardRef((e,r)=>{const{children:n,...o}=e;return a.isValidElement(n)?a.cloneElement(n,{...ke(o,n.props),ref:r?ae(r,n.ref):n.ref}):a.Children.count(n)>1?a.Children.only(null):null});G.displayName="SlotClone";const Te=({children:e})=>a.createElement(a.Fragment,null,e);function Me(e){return a.isValidElement(e)&&e.type===Te}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]=F(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(k,{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(k,{[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 ce(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 ie(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 K({prop:e,defaultProp:r,onChange:n=()=>{}}){const[o,i]=je({defaultProp:r,onChange:n}),t=e!==void 0,c=t?e:o,s=ie(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 je({defaultProp:e,onChange:r}){const n=a.useState(e),[o]=n,i=a.useRef(o),t=ie(r);return a.useEffect(()=>{i.current!==o&&(t(o),i.current=o)},[o,i,t]),n}const Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],R=Le.reduce((e,r)=>{const n=a.forwardRef((o,i)=>{const{asChild:t,...c}=o,s=t?k: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}},{}),D=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{};function qe(e,r){return a.useReducer((n,o)=>{const i=r[n][o];return i??n},e)}const se=e=>{const{present:r,children:n}=e,o=Ve(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};se.displayName="Presence";function Ve(e){const[r,n]=a.useState(),o=a.useRef({}),i=a.useRef(e),t=a.useRef("none"),c=e?"mounted":"unmounted",[s,l]=qe(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]),D(()=>{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]),D(()=>{if(r){const u=p=>{const f=M(o.current).includes(p.animationName);p.target===r&&f&&Ee.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 Ue=ne.useId||(()=>{});let Be=0;function le(e){const[r,n]=ne.useState(Ue());return D(()=>{n(o=>o??String(Be++))},[e]),r?`radix-${r}`:""}const ue="Collapsible",[He,pe]=F(ue),[Ge,Z]=He(ue),ze=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:t,onOpenChange:c,...s}=e,[l=!1,u]=K({prop:o,defaultProp:i,onChange:c});return a.createElement(Ge,{scope:n,disabled:t,contentId:le(),open:l,onOpenToggle:a.useCallback(()=>u(d=>!d),[u])},a.createElement(R.div,h({"data-state":Y(l),"data-disabled":t?"":void 0},s,{ref:r})))}),Fe="CollapsibleTrigger",Ke=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,...o}=e,i=Z(Fe,n);return a.createElement(R.button,h({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Y(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},o,{ref:r,onClick:ce(e.onClick,i.onOpenToggle)}))}),de="CollapsibleContent",Ze=a.forwardRef((e,r)=>{const{forceMount:n,...o}=e,i=Z(de,e.__scopeCollapsible);return a.createElement(se,{present:n||i.open},({present:t})=>a.createElement(Ye,h({},o,{ref:r,present:t})))}),Ye=a.forwardRef((e,r)=>{const{__scopeCollapsible:n,present:o,children:i,...t}=e,c=Z(de,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)},[]),D(()=>{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":Y(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 Y(e){return e?"open":"closed"}const Je=ze,Qe=Ke,We=Ze,Xe=a.createContext(void 0);function et(e){const r=a.useContext(Xe);return e||r||"ltr"}const E="Accordion",tt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[J,nt,rt]=De(E),[j,zt]=F(E,[rt,pe]),Q=pe(),fe=a.forwardRef((e,r)=>{const{type:n,...o}=e,i=o,t=o;return a.createElement(J.Provider,{scope:e.__scopeAccordion},n==="multiple"?a.createElement(it,h({},t,{ref:r})):a.createElement(ct,h({},i,{ref:r})))});fe.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[be,ot]=j(E),[me,at]=j(E,{collapsible:!1}),ct=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:t=!1,...c}=e,[s,l]=K({prop:n,defaultProp:o,onChange:i});return a.createElement(be,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:l,onItemClose:a.useCallback(()=>t&&l(""),[t,l])},a.createElement(me,{scope:e.__scopeAccordion,collapsible:t},a.createElement($e,h({},c,{ref:r}))))}),it=a.forwardRef((e,r)=>{const{value:n,defaultValue:o,onValueChange:i=()=>{},...t}=e,[c=[],s]=K({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(be,{scope:e.__scopeAccordion,value:c,onItemOpen:l,onItemClose:u},a.createElement(me,{scope:e.__scopeAccordion,collapsible:!0},a.createElement($e,h({},t,{ref:r}))))}),[st,L]=j(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=nt(n),p=et(i)==="ltr",$=ce(e.onKeyDown,f=>{var b;if(!tt.includes(f.key))return;const x=f.target,g=u().filter(U=>{var B;return!((B=U.ref.current)!==null&&B!==void 0&&B.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 Ae=v%m;(b=g[Ae].ref.current)===null||b===void 0||b.focus()});return a.createElement(st,{scope:n,disabled:o,direction:i,orientation:t},a.createElement(J.Slot,{scope:n},a.createElement(R.div,h({},c,{"data-orientation":t,ref:l,onKeyDown:o?void 0:$}))))}),z="AccordionItem",[lt,W]=j(z),ut=a.forwardRef((e,r)=>{const{__scopeAccordion:n,value:o,...i}=e,t=L(z,n),c=ot(z,n),s=Q(n),l=le(),u=o&&c.value.includes(o)||!1,d=t.disabled||e.disabled;return a.createElement(lt,{scope:n,open:u,disabled:d,triggerId:l},a.createElement(Je,h({"data-orientation":t.orientation,"data-state":_e(u)},s,i,{ref:r,disabled:d,open:u,onOpenChange:p=>{p?c.onItemOpen(o):c.onItemClose(o)}})))}),pt="AccordionHeader",dt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(pt,n);return a.createElement(R.h3,h({"data-orientation":i.orientation,"data-state":_e(t.open),"data-disabled":t.disabled?"":void 0},o,{ref:r}))}),X="AccordionTrigger",ft=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(X,n),c=at(X,n),s=Q(n);return a.createElement(J.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})))}),bt="AccordionContent",mt=a.forwardRef((e,r)=>{const{__scopeAccordion:n,...o}=e,i=L(E,n),t=W(bt,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 _e(e){return e?"open":"closed"}const $t=fe,_t=ut,ht=dt,gt=ft,vt=mt;function xt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he={exports:{}};/*!
|
6
|
+
Copyright (c) 2018 Jed Watson.
|
7
|
+
Licensed under the MIT License (MIT), see
|
8
|
+
http://jedwatson.github.io/classnames
|
9
|
+
*/(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.call(this,s)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return this&&this[t]||t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(this,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,this&&this[s]||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})()})(he);var yt=he.exports;const ge=xt(yt),Ct={"purpur-accordion__title":"_purpur-accordion__title_1ower_1","purpur-accordion--negative":"_purpur-accordion--negative_1ower_10"};function At(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ve={exports:{}};/*!
|
10
|
+
Copyright (c) 2018 Jed Watson.
|
11
|
+
Licensed under the MIT License (MIT), see
|
12
|
+
http://jedwatson.github.io/classnames
|
13
|
+
*/(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.call(this,s)))}return t}function o(t){if(typeof t=="string"||typeof t=="number")return this&&this[t]||t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(this,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,this&&this[s]||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})()})(ve);var Et=ve.exports;const Nt=At(Et),It={"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"},Pt={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"},xe=e=>y.jsx(Mt,{...e,svg:Pt});xe.displayName="IconChevronDown";const wt=Nt.bind(It),ee="purpur-icon",St="md",Rt=e=>e.filter(r=>Object.keys(r).length>=1).map(r=>`${r.name}="${r.value}"`).join(" "),Ot=({content:e="",title:r}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},r?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],o=r?`<title>${r}</title>`:"";return`<svg ${Rt(n)}>${o}${e}</svg>`},Tt=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),Mt=({["data-testid"]:e,svg:r,allyTitle:n,className:o="",size:i=St,...t})=>{const c=Ot({content:Tt(r.svg),title:n}),s=wt(o,ee,`${ee}--${i}`);return y.jsx("span",{"aria-label":n,className:s,"data-testid":e,dangerouslySetInnerHTML:{__html:c},...t})};function kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}};/*!
|
14
|
+
Copyright (c) 2018 Jed Watson.
|
15
|
+
Licensed under the MIT License (MIT), see
|
16
|
+
http://jedwatson.github.io/classnames
|
17
|
+
*/(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})()})(ye);var Dt=ye.exports;const jt=kt(Dt),P={"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"},Lt={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"},w="purpur-paragraph",qt=({["data-testid"]:e,children:r,className:n="",disabled:o,enableHyphenation:i=!1,negative:t=!1,variant:c=Lt.PARAGRAPH100,...s})=>{const l=jt([n,P[w],P[`${w}--${c}`],{[P[`${w}--hyphens`]]:i,[P[`${w}--disabled`]]:o,[P[`${w}--negative`]]:t}]);return y.jsx("p",{...s,className:l,"data-testid":e,children:r})},Vt="_slideDown_8k8nf_1",Ut="_slideUp_8k8nf_1",Bt={"purpur-accordion-item":"_purpur-accordion-item_8k8nf_1","purpur-accordion-item__header":"_purpur-accordion-item__header_8k8nf_8","purpur-accordion-item__trigger":"_purpur-accordion-item__trigger_8k8nf_11","purpur-accordion-item__content":"_purpur-accordion-item__content_8k8nf_35",slideDown:Vt,slideUp:Ut,"purpur-accordion-item__contentText":"_purpur-accordion-item__contentText_8k8nf_44","purpur-accordion-item__icon":"_purpur-accordion-item__icon_8k8nf_48","purpur-accordion-item__title":"_purpur-accordion-item__title_8k8nf_60","purpur-accordion-item--negative":"_purpur-accordion-item--negative_8k8nf_78"},N=ge.bind(Bt),A="purpur-accordion-item",Ht=({children:e,className:r,title:n,negative:o,...i})=>{const t=N([r,A,{[`${A}--negative`]:o}]);return y.jsxs(_t,{className:t,value:n,...i,children:[y.jsx(ht,{className:N(`${A}__header`),asChild:!0,children:y.jsxs(gt,{className:N(`${A}__trigger`,r),children:[y.jsx(oe,{tag:"h3",variant:"title-100",className:N(`${A}__title`),children:n}),y.jsx(xe,{size:"md",className:N(`${A}__icon`),"aria-hidden":!0})]})}),y.jsx(vt,{className:N(`${A}__content`,r),children:y.jsx("div",{className:N(`${A}__contentText`),children:typeof e=="string"?y.jsx(qt,{variant:"paragraph-200",children:e}):e})})]})},Gt=e=>a.isValidElement(e)&&(e==null?void 0:e.type)===Ht,te=ge.bind(Ct),H="purpur-accordion",Ce=({["data-testid"]:e,children:r,className:n,negative:o=!1,title:i,titleVariant:t="title-300"})=>{const c=te([n,H,{[`${H}--negative`]:o}]),s=()=>a.Children.map(r,l=>{if(Gt(l))return a.cloneElement(l,{negative:o})});return y.jsxs($t,{className:c,type:"multiple","data-testid":e,children:[i?y.jsx(oe,{tag:"h2",variant:t,className:te(`${H}__title`),children:i}):null,s()]})};Ce.displayName="Accordion";exports.Accordion=Ce;
|
18
|
+
//# sourceMappingURL=accordion.cjs.js.map
|