@midas-ds/components 1.0.3 → 1.2.3

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/accordion/Accordion.d.ts +8 -8
  3. package/accordion/AccordionItem.d.ts +11 -3
  4. package/accordion/index.d.ts +0 -3
  5. package/global.css +1 -0
  6. package/index.cjs +138 -0
  7. package/index.css +1 -1
  8. package/index.d.ts +0 -1
  9. package/index.js +27067 -110
  10. package/package.json +21 -4
  11. package/theme.cjs +1 -0
  12. package/tokens-BskyMDHv.cjs +1 -0
  13. package/Breadcrumbs.css +0 -1
  14. package/Button-B4vMZbC6.js +0 -182
  15. package/Button.css +0 -1
  16. package/ButtonGroup.css +0 -1
  17. package/Card.css +0 -1
  18. package/Checkbox-DnKWanep.js +0 -402
  19. package/Checkbox.css +0 -1
  20. package/Collection-COLWgm24.js +0 -510
  21. package/ComboBox.css +0 -1
  22. package/DatePicker.css +0 -1
  23. package/Dialog-Cb6toyXO.js +0 -1951
  24. package/DragAndDrop-B0T3WgjL.js +0 -40
  25. package/Dropdown.css +0 -1
  26. package/FileUpload.css +0 -1
  27. package/Flex.css +0 -1
  28. package/Flex.module-CpoxBzQX.js +0 -37
  29. package/FocusScope-C8i7CH6y.js +0 -513
  30. package/Form-BQQs3jUk.js +0 -238
  31. package/Grid.css +0 -1
  32. package/Grid.module-Ia0e9Dix.js +0 -36
  33. package/Group-CdwXhx8Q.js +0 -42
  34. package/Hidden-DngIphiL.js +0 -37
  35. package/InfoBanner.css +0 -1
  36. package/Layout.css +0 -1
  37. package/Link-iAZLB3RI.js +0 -75
  38. package/Link.css +0 -1
  39. package/LinkButton.css +0 -1
  40. package/ListBox-BKWkIIm6.js +0 -474
  41. package/ListKeyboardDelegate-BH-K5hyq.js +0 -172
  42. package/Logo.css +0 -1
  43. package/Modal.css +0 -1
  44. package/MultiSelect.css +0 -1
  45. package/PressResponder-Cz-TRBHO.js +0 -31
  46. package/RSPContexts-EOiWkKOf.js +0 -11
  47. package/Radio.css +0 -1
  48. package/SearchField.css +0 -1
  49. package/Select.css +0 -1
  50. package/SelectionManager-8o40f7mx.js +0 -1047
  51. package/Separator-BlvmQjwz.js +0 -49
  52. package/Spinner.css +0 -1
  53. package/Table.css +0 -1
  54. package/Tabs.css +0 -1
  55. package/Tag--W5TgxmK.js +0 -728
  56. package/Tag.css +0 -1
  57. package/Text-CQPW6xs7.js +0 -15
  58. package/TextArea.css +0 -1
  59. package/TextField-DeK_yiK-.js +0 -225
  60. package/TextField.css +0 -1
  61. package/TextField.module-0-u4LVPp.js +0 -143
  62. package/Toast.css +0 -1
  63. package/VisuallyHidden-CFx06Bae.js +0 -39
  64. package/accordion/AccordionContent.d.ts +0 -3
  65. package/accordion/AccordionTagContext.d.ts +0 -3
  66. package/accordion/AccordionTrigger.d.ts +0 -3
  67. package/chevron-down-Cd1bkzXT.js +0 -13
  68. package/chevron-right-DBMc9VMi.js +0 -23
  69. package/clsx-OuTLNxxd.js +0 -16
  70. package/context-Bnqknrce.js +0 -80
  71. package/createLucideIcon-DeWljiyi.js +0 -79
  72. package/index-B-jHjTDC.js +0 -120
  73. package/index-BPdc9gJ8.js +0 -3122
  74. package/index-DK9ZACEc.js +0 -642
  75. package/index-KSgQWWiy.js +0 -26984
  76. package/index10.js +0 -4
  77. package/index11.js +0 -5
  78. package/index12.js +0 -4
  79. package/index13.js +0 -4
  80. package/index14.js +0 -4
  81. package/index15.js +0 -6
  82. package/index16.js +0 -6
  83. package/index17.js +0 -6
  84. package/index18.js +0 -4
  85. package/index19.js +0 -6
  86. package/index2.js +0 -8
  87. package/index20.js +0 -6
  88. package/index21.js +0 -4
  89. package/index22.js +0 -5
  90. package/index23.js +0 -5
  91. package/index24.js +0 -5
  92. package/index25.js +0 -6
  93. package/index26.js +0 -6
  94. package/index27.js +0 -6
  95. package/index28.js +0 -4
  96. package/index29.js +0 -12
  97. package/index3.js +0 -6
  98. package/index31.js +0 -22
  99. package/index32.js +0 -14
  100. package/index33.js +0 -11
  101. package/index34.js +0 -31
  102. package/index35.js +0 -8
  103. package/index36.js +0 -9
  104. package/index37.js +0 -19
  105. package/index38.js +0 -9
  106. package/index39.js +0 -9
  107. package/index4.js +0 -4
  108. package/index40.js +0 -16
  109. package/index41.js +0 -16
  110. package/index42.js +0 -31
  111. package/index43.js +0 -16
  112. package/index44.js +0 -6
  113. package/index45.js +0 -53
  114. package/index46.js +0 -18
  115. package/index47.js +0 -27
  116. package/index48.js +0 -18
  117. package/index49.js +0 -21
  118. package/index5.js +0 -5
  119. package/index50.js +0 -49
  120. package/index51.js +0 -5
  121. package/index52.js +0 -25
  122. package/index53.js +0 -18
  123. package/index54.js +0 -9
  124. package/index55.js +0 -25
  125. package/index56.js +0 -18
  126. package/index57.js +0 -11
  127. package/index58.js +0 -12
  128. package/index59.js +0 -15
  129. package/index6.js +0 -4
  130. package/index60.js +0 -9
  131. package/index61.js +0 -9
  132. package/index62.js +0 -19
  133. package/index63.js +0 -22
  134. package/index64.js +0 -61
  135. package/index65.js +0 -15
  136. package/index66.js +0 -11
  137. package/index67.js +0 -63
  138. package/index68.js +0 -85
  139. package/index69.js +0 -74
  140. package/index7.js +0 -9
  141. package/index70.js +0 -24
  142. package/index71.js +0 -69
  143. package/index72.js +0 -80
  144. package/index73.js +0 -140
  145. package/index74.js +0 -70
  146. package/index75.js +0 -42
  147. package/index76.js +0 -82
  148. package/index77.js +0 -71
  149. package/index78.js +0 -104
  150. package/index79.js +0 -274
  151. package/index8.js +0 -4
  152. package/index80.js +0 -723
  153. package/index81.js +0 -489
  154. package/index82.js +0 -314
  155. package/index83.js +0 -389
  156. package/index84.js +0 -252
  157. package/index85.js +0 -1363
  158. package/index86.js +0 -1009
  159. package/index87.js +0 -386
  160. package/index88.js +0 -2101
  161. package/index89.js +0 -2369
  162. package/index9.js +0 -5
  163. package/index90.js +0 -6836
  164. package/index91.js +0 -17
  165. package/index92.js +0 -14
  166. package/index93.js +0 -6
  167. package/index94.js +0 -9
  168. package/intlStrings-Cd44R5hT.js +0 -278
  169. package/react.esm-sMU8Z7rL.js +0 -11060
  170. package/triangle-alert-1OYl9KWz.js +0 -56
  171. package/useControlledState-DrAoodI6.js +0 -45
  172. package/useDescription-BPs7eRff.js +0 -32
  173. package/useField-Dz62UHCP.js +0 -67
  174. package/useFilter-ViwzkzZe.js +0 -35
  175. package/useFocusRing-BKGhL91C.js +0 -1297
  176. package/useFocusable-CRSmYEQc.js +0 -59
  177. package/useGridSelectionCheckbox-CVEvUCJL.js +0 -22
  178. package/useHasTabbableChild-C8y4fwiY.js +0 -34
  179. package/useHighlightSelectionDescription-CD74uzLh.js +0 -552
  180. package/useListState-DKnP5TB5.js +0 -119
  181. package/useLocalizedStringFormatter-DsZ-ZWSk.js +0 -96
  182. package/useSingleSelectListState-BHTLh8Ob.js +0 -34
  183. package/useUpdateEffect-Dtz-i14F.js +0 -12
  184. package/x-JK7i-TQC.js +0 -14
  185. /package/{index30.js → theme.js} +0 -0
package/index-DK9ZACEc.js DELETED
@@ -1,642 +0,0 @@
1
- import * as i from "react";
2
- import R from "react";
3
- import { jsx as u, Fragment as he } from "react/jsx-runtime";
4
- import "react-dom";
5
- import './index.css';const Ae = '"../theme/tokens.css"', be = '"Inter", sans-serif', Re = "#bfbfbf", _e = "#e6e6e6", Ne = "#000000", ye = "300ms", Ie = "400", xe = "_root_nq4cs_4", Pe = "_trigger_nq4cs_8", we = "_item_nq4cs_34", Se = "_content_nq4cs_52", Ee = "_slideDown_nq4cs_1", Me = "_slideUp_nq4cs_1", Oe = "_header_nq4cs_90", Te = "_triggerText_nq4cs_94", mn = {
6
- tokens: Ae,
7
- display: be,
8
- gray50: Re,
9
- gray20: _e,
10
- black: Ne,
11
- normalTransition: ye,
12
- regularWeight: Ie,
13
- root: xe,
14
- trigger: Pe,
15
- item: we,
16
- content: Se,
17
- slideDown: Ee,
18
- slideUp: Me,
19
- header: Oe,
20
- triggerText: Te
21
- };
22
- function V(e, n = []) {
23
- let t = [];
24
- function o(c, s) {
25
- const a = i.createContext(s), d = t.length;
26
- t = [...t, s];
27
- const l = (f) => {
28
- var b;
29
- const { scope: v, children: m, ...g } = f, h = ((b = v == null ? void 0 : v[e]) == null ? void 0 : b[d]) || a, A = i.useMemo(() => g, Object.values(g));
30
- return /* @__PURE__ */ u(h.Provider, { value: A, children: m });
31
- };
32
- l.displayName = c + "Provider";
33
- function C(f, v) {
34
- var h;
35
- const m = ((h = v == null ? void 0 : v[e]) == null ? void 0 : h[d]) || a, g = i.useContext(m);
36
- if (g) return g;
37
- if (s !== void 0) return s;
38
- throw new Error(`\`${f}\` must be used within \`${c}\``);
39
- }
40
- return [l, C];
41
- }
42
- const r = () => {
43
- const c = t.map((s) => i.createContext(s));
44
- return function(a) {
45
- const d = (a == null ? void 0 : a[e]) || c;
46
- return i.useMemo(
47
- () => ({ [`__scope${e}`]: { ...a, [e]: d } }),
48
- [a, d]
49
- );
50
- };
51
- };
52
- return r.scopeName = e, [o, De(r, ...n)];
53
- }
54
- function De(...e) {
55
- const n = e[0];
56
- if (e.length === 1) return n;
57
- const t = () => {
58
- const o = e.map((r) => ({
59
- useScope: r(),
60
- scopeName: r.scopeName
61
- }));
62
- return function(c) {
63
- const s = o.reduce((a, { useScope: d, scopeName: l }) => {
64
- const f = d(c)[`__scope${l}`];
65
- return { ...a, ...f };
66
- }, {});
67
- return i.useMemo(() => ({ [`__scope${n.scopeName}`]: s }), [s]);
68
- };
69
- };
70
- return t.scopeName = n.scopeName, t;
71
- }
72
- function Y(e, n) {
73
- if (typeof e == "function")
74
- return e(n);
75
- e != null && (e.current = n);
76
- }
77
- function Z(...e) {
78
- return (n) => {
79
- let t = !1;
80
- const o = e.map((r) => {
81
- const c = Y(r, n);
82
- return !t && typeof c == "function" && (t = !0), c;
83
- });
84
- if (t)
85
- return () => {
86
- for (let r = 0; r < o.length; r++) {
87
- const c = o[r];
88
- typeof c == "function" ? c() : Y(e[r], null);
89
- }
90
- };
91
- };
92
- }
93
- function x(...e) {
94
- return i.useCallback(Z(...e), e);
95
- }
96
- var S = i.forwardRef((e, n) => {
97
- const { children: t, ...o } = e, r = i.Children.toArray(t), c = r.find(Le);
98
- if (c) {
99
- const s = c.props.children, a = r.map((d) => d === c ? i.Children.count(s) > 1 ? i.Children.only(null) : i.isValidElement(s) ? s.props.children : null : d);
100
- return /* @__PURE__ */ u(L, { ...o, ref: n, children: i.isValidElement(s) ? i.cloneElement(s, void 0, a) : null });
101
- }
102
- return /* @__PURE__ */ u(L, { ...o, ref: n, children: t });
103
- });
104
- S.displayName = "Slot";
105
- var L = i.forwardRef((e, n) => {
106
- const { children: t, ...o } = e;
107
- if (i.isValidElement(t)) {
108
- const r = Ve(t);
109
- return i.cloneElement(t, {
110
- ...Ue(o, t.props),
111
- // @ts-ignore
112
- ref: n ? Z(n, r) : r
113
- });
114
- }
115
- return i.Children.count(t) > 1 ? i.Children.only(null) : null;
116
- });
117
- L.displayName = "SlotClone";
118
- var ke = ({ children: e }) => /* @__PURE__ */ u(he, { children: e });
119
- function Le(e) {
120
- return i.isValidElement(e) && e.type === ke;
121
- }
122
- function Ue(e, n) {
123
- const t = { ...n };
124
- for (const o in n) {
125
- const r = e[o], c = n[o];
126
- /^on[A-Z]/.test(o) ? r && c ? t[o] = (...a) => {
127
- c(...a), r(...a);
128
- } : r && (t[o] = r) : o === "style" ? t[o] = { ...r, ...c } : o === "className" && (t[o] = [r, c].filter(Boolean).join(" "));
129
- }
130
- return { ...e, ...t };
131
- }
132
- function Ve(e) {
133
- var o, r;
134
- let n = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, t = n && "isReactWarning" in n && n.isReactWarning;
135
- return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
136
- }
137
- function $e(e) {
138
- const n = e + "CollectionProvider", [t, o] = V(n), [r, c] = t(
139
- n,
140
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
141
- ), s = (m) => {
142
- const { scope: g, children: h } = m, A = R.useRef(null), b = R.useRef(/* @__PURE__ */ new Map()).current;
143
- return /* @__PURE__ */ u(r, { scope: g, itemMap: b, collectionRef: A, children: h });
144
- };
145
- s.displayName = n;
146
- const a = e + "CollectionSlot", d = R.forwardRef(
147
- (m, g) => {
148
- const { scope: h, children: A } = m, b = c(a, h), p = x(g, b.collectionRef);
149
- return /* @__PURE__ */ u(S, { ref: p, children: A });
150
- }
151
- );
152
- d.displayName = a;
153
- const l = e + "CollectionItemSlot", C = "data-radix-collection-item", f = R.forwardRef(
154
- (m, g) => {
155
- const { scope: h, children: A, ...b } = m, p = R.useRef(null), _ = x(g, p), y = c(l, h);
156
- return R.useEffect(() => (y.itemMap.set(p, { ref: p, ...b }), () => void y.itemMap.delete(p))), /* @__PURE__ */ u(S, { [C]: "", ref: _, children: A });
157
- }
158
- );
159
- f.displayName = l;
160
- function v(m) {
161
- const g = c(e + "CollectionConsumer", m);
162
- return R.useCallback(() => {
163
- const A = g.collectionRef.current;
164
- if (!A) return [];
165
- const b = Array.from(A.querySelectorAll(`[${C}]`));
166
- return Array.from(g.itemMap.values()).sort(
167
- (y, I) => b.indexOf(y.ref.current) - b.indexOf(I.ref.current)
168
- );
169
- }, [g.collectionRef, g.itemMap]);
170
- }
171
- return [
172
- { Provider: s, Slot: d, ItemSlot: f },
173
- v,
174
- o
175
- ];
176
- }
177
- function J(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
178
- return function(r) {
179
- if (e == null || e(r), t === !1 || !r.defaultPrevented)
180
- return n == null ? void 0 : n(r);
181
- };
182
- }
183
- function Q(e) {
184
- const n = i.useRef(e);
185
- return i.useEffect(() => {
186
- n.current = e;
187
- }), i.useMemo(() => (...t) => {
188
- var o;
189
- return (o = n.current) == null ? void 0 : o.call(n, ...t);
190
- }, []);
191
- }
192
- function $({
193
- prop: e,
194
- defaultProp: n,
195
- onChange: t = () => {
196
- }
197
- }) {
198
- const [o, r] = We({ defaultProp: n, onChange: t }), c = e !== void 0, s = c ? e : o, a = Q(t), d = i.useCallback(
199
- (l) => {
200
- if (c) {
201
- const f = typeof l == "function" ? l(e) : l;
202
- f !== e && a(f);
203
- } else
204
- r(l);
205
- },
206
- [c, e, r, a]
207
- );
208
- return [s, d];
209
- }
210
- function We({
211
- defaultProp: e,
212
- onChange: n
213
- }) {
214
- const t = i.useState(e), [o] = t, r = i.useRef(o), c = Q(n);
215
- return i.useEffect(() => {
216
- r.current !== o && (c(o), r.current = o);
217
- }, [o, r, c]), t;
218
- }
219
- var qe = [
220
- "a",
221
- "button",
222
- "div",
223
- "form",
224
- "h2",
225
- "h3",
226
- "img",
227
- "input",
228
- "label",
229
- "li",
230
- "nav",
231
- "ol",
232
- "p",
233
- "span",
234
- "svg",
235
- "ul"
236
- ], P = qe.reduce((e, n) => {
237
- const t = i.forwardRef((o, r) => {
238
- const { asChild: c, ...s } = o, a = c ? S : n;
239
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(a, { ...s, ref: r });
240
- });
241
- return t.displayName = `Primitive.${n}`, { ...e, [n]: t };
242
- }, {}), E = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
243
- };
244
- function Fe(e, n) {
245
- return i.useReducer((t, o) => n[t][o] ?? t, e);
246
- }
247
- var X = (e) => {
248
- const { present: n, children: t } = e, o = je(n), r = typeof t == "function" ? t({ present: o.isPresent }) : i.Children.only(t), c = x(o.ref, Be(r));
249
- return typeof t == "function" || o.isPresent ? i.cloneElement(r, { ref: c }) : null;
250
- };
251
- X.displayName = "Presence";
252
- function je(e) {
253
- const [n, t] = i.useState(), o = i.useRef({}), r = i.useRef(e), c = i.useRef("none"), s = e ? "mounted" : "unmounted", [a, d] = Fe(s, {
254
- mounted: {
255
- UNMOUNT: "unmounted",
256
- ANIMATION_OUT: "unmountSuspended"
257
- },
258
- unmountSuspended: {
259
- MOUNT: "mounted",
260
- ANIMATION_END: "unmounted"
261
- },
262
- unmounted: {
263
- MOUNT: "mounted"
264
- }
265
- });
266
- return i.useEffect(() => {
267
- const l = w(o.current);
268
- c.current = a === "mounted" ? l : "none";
269
- }, [a]), E(() => {
270
- const l = o.current, C = r.current;
271
- if (C !== e) {
272
- const v = c.current, m = w(l);
273
- e ? d("MOUNT") : m === "none" || (l == null ? void 0 : l.display) === "none" ? d("UNMOUNT") : d(C && v !== m ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
274
- }
275
- }, [e, d]), E(() => {
276
- if (n) {
277
- let l;
278
- const C = n.ownerDocument.defaultView ?? window, f = (m) => {
279
- const h = w(o.current).includes(m.animationName);
280
- if (m.target === n && h && (d("ANIMATION_END"), !r.current)) {
281
- const A = n.style.animationFillMode;
282
- n.style.animationFillMode = "forwards", l = C.setTimeout(() => {
283
- n.style.animationFillMode === "forwards" && (n.style.animationFillMode = A);
284
- });
285
- }
286
- }, v = (m) => {
287
- m.target === n && (c.current = w(o.current));
288
- };
289
- return n.addEventListener("animationstart", v), n.addEventListener("animationcancel", f), n.addEventListener("animationend", f), () => {
290
- C.clearTimeout(l), n.removeEventListener("animationstart", v), n.removeEventListener("animationcancel", f), n.removeEventListener("animationend", f);
291
- };
292
- } else
293
- d("ANIMATION_END");
294
- }, [n, d]), {
295
- isPresent: ["mounted", "unmountSuspended"].includes(a),
296
- ref: i.useCallback((l) => {
297
- l && (o.current = getComputedStyle(l)), t(l);
298
- }, [])
299
- };
300
- }
301
- function w(e) {
302
- return (e == null ? void 0 : e.animationName) || "none";
303
- }
304
- function Be(e) {
305
- var o, r;
306
- let n = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, t = n && "isReactWarning" in n && n.isReactWarning;
307
- return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
308
- }
309
- var Ge = i.useId || (() => {
310
- }), Ke = 0;
311
- function ee(e) {
312
- const [n, t] = i.useState(Ge());
313
- return E(() => {
314
- t((o) => o ?? String(Ke++));
315
- }, [e]), n ? `radix-${n}` : "";
316
- }
317
- var W = "Collapsible", [He, ne] = V(W), [ze, q] = He(W), te = i.forwardRef(
318
- (e, n) => {
319
- const {
320
- __scopeCollapsible: t,
321
- open: o,
322
- defaultOpen: r,
323
- disabled: c,
324
- onOpenChange: s,
325
- ...a
326
- } = e, [d = !1, l] = $({
327
- prop: o,
328
- defaultProp: r,
329
- onChange: s
330
- });
331
- return /* @__PURE__ */ u(
332
- ze,
333
- {
334
- scope: t,
335
- disabled: c,
336
- contentId: ee(),
337
- open: d,
338
- onOpenToggle: i.useCallback(() => l((C) => !C), [l]),
339
- children: /* @__PURE__ */ u(
340
- P.div,
341
- {
342
- "data-state": j(d),
343
- "data-disabled": c ? "" : void 0,
344
- ...a,
345
- ref: n
346
- }
347
- )
348
- }
349
- );
350
- }
351
- );
352
- te.displayName = W;
353
- var oe = "CollapsibleTrigger", re = i.forwardRef(
354
- (e, n) => {
355
- const { __scopeCollapsible: t, ...o } = e, r = q(oe, t);
356
- return /* @__PURE__ */ u(
357
- P.button,
358
- {
359
- type: "button",
360
- "aria-controls": r.contentId,
361
- "aria-expanded": r.open || !1,
362
- "data-state": j(r.open),
363
- "data-disabled": r.disabled ? "" : void 0,
364
- disabled: r.disabled,
365
- ...o,
366
- ref: n,
367
- onClick: J(e.onClick, r.onOpenToggle)
368
- }
369
- );
370
- }
371
- );
372
- re.displayName = oe;
373
- var F = "CollapsibleContent", ce = i.forwardRef(
374
- (e, n) => {
375
- const { forceMount: t, ...o } = e, r = q(F, e.__scopeCollapsible);
376
- return /* @__PURE__ */ u(X, { present: t || r.open, children: ({ present: c }) => /* @__PURE__ */ u(Ye, { ...o, ref: n, present: c }) });
377
- }
378
- );
379
- ce.displayName = F;
380
- var Ye = i.forwardRef((e, n) => {
381
- const { __scopeCollapsible: t, present: o, children: r, ...c } = e, s = q(F, t), [a, d] = i.useState(o), l = i.useRef(null), C = x(n, l), f = i.useRef(0), v = f.current, m = i.useRef(0), g = m.current, h = s.open || a, A = i.useRef(h), b = i.useRef(void 0);
382
- return i.useEffect(() => {
383
- const p = requestAnimationFrame(() => A.current = !1);
384
- return () => cancelAnimationFrame(p);
385
- }, []), E(() => {
386
- const p = l.current;
387
- if (p) {
388
- b.current = b.current || {
389
- transitionDuration: p.style.transitionDuration,
390
- animationName: p.style.animationName
391
- }, p.style.transitionDuration = "0s", p.style.animationName = "none";
392
- const _ = p.getBoundingClientRect();
393
- f.current = _.height, m.current = _.width, A.current || (p.style.transitionDuration = b.current.transitionDuration, p.style.animationName = b.current.animationName), d(o);
394
- }
395
- }, [s.open, o]), /* @__PURE__ */ u(
396
- P.div,
397
- {
398
- "data-state": j(s.open),
399
- "data-disabled": s.disabled ? "" : void 0,
400
- id: s.contentId,
401
- hidden: !h,
402
- ...c,
403
- ref: C,
404
- style: {
405
- "--radix-collapsible-content-height": v ? `${v}px` : void 0,
406
- "--radix-collapsible-content-width": g ? `${g}px` : void 0,
407
- ...e.style
408
- },
409
- children: h && r
410
- }
411
- );
412
- });
413
- function j(e) {
414
- return e ? "open" : "closed";
415
- }
416
- var Ze = te, Je = re, Qe = ce, Xe = i.createContext(void 0);
417
- function en(e) {
418
- const n = i.useContext(Xe);
419
- return e || n || "ltr";
420
- }
421
- var N = "Accordion", nn = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"], [B, tn, on] = $e(N), [O, Cn] = V(N, [
422
- on,
423
- ne
424
- ]), G = ne(), ie = R.forwardRef(
425
- (e, n) => {
426
- const { type: t, ...o } = e, r = o, c = o;
427
- return /* @__PURE__ */ u(B.Provider, { scope: e.__scopeAccordion, children: t === "multiple" ? /* @__PURE__ */ u(an, { ...c, ref: n }) : /* @__PURE__ */ u(sn, { ...r, ref: n }) });
428
- }
429
- );
430
- ie.displayName = N;
431
- var [se, rn] = O(N), [ae, cn] = O(
432
- N,
433
- { collapsible: !1 }
434
- ), sn = R.forwardRef(
435
- (e, n) => {
436
- const {
437
- value: t,
438
- defaultValue: o,
439
- onValueChange: r = () => {
440
- },
441
- collapsible: c = !1,
442
- ...s
443
- } = e, [a, d] = $({
444
- prop: t,
445
- defaultProp: o,
446
- onChange: r
447
- });
448
- return /* @__PURE__ */ u(
449
- se,
450
- {
451
- scope: e.__scopeAccordion,
452
- value: a ? [a] : [],
453
- onItemOpen: d,
454
- onItemClose: R.useCallback(() => c && d(""), [c, d]),
455
- children: /* @__PURE__ */ u(ae, { scope: e.__scopeAccordion, collapsible: c, children: /* @__PURE__ */ u(le, { ...s, ref: n }) })
456
- }
457
- );
458
- }
459
- ), an = R.forwardRef((e, n) => {
460
- const {
461
- value: t,
462
- defaultValue: o,
463
- onValueChange: r = () => {
464
- },
465
- ...c
466
- } = e, [s = [], a] = $({
467
- prop: t,
468
- defaultProp: o,
469
- onChange: r
470
- }), d = R.useCallback(
471
- (C) => a((f = []) => [...f, C]),
472
- [a]
473
- ), l = R.useCallback(
474
- (C) => a((f = []) => f.filter((v) => v !== C)),
475
- [a]
476
- );
477
- return /* @__PURE__ */ u(
478
- se,
479
- {
480
- scope: e.__scopeAccordion,
481
- value: s,
482
- onItemOpen: d,
483
- onItemClose: l,
484
- children: /* @__PURE__ */ u(ae, { scope: e.__scopeAccordion, collapsible: !0, children: /* @__PURE__ */ u(le, { ...c, ref: n }) })
485
- }
486
- );
487
- }), [ln, T] = O(N), le = R.forwardRef(
488
- (e, n) => {
489
- const { __scopeAccordion: t, disabled: o, dir: r, orientation: c = "vertical", ...s } = e, a = R.useRef(null), d = x(a, n), l = tn(t), f = en(r) === "ltr", v = J(e.onKeyDown, (m) => {
490
- var H;
491
- if (!nn.includes(m.key)) return;
492
- const g = m.target, h = l().filter((k) => {
493
- var z;
494
- return !((z = k.ref.current) != null && z.disabled);
495
- }), A = h.findIndex((k) => k.ref.current === g), b = h.length;
496
- if (A === -1) return;
497
- m.preventDefault();
498
- let p = A;
499
- const _ = 0, y = b - 1, I = () => {
500
- p = A + 1, p > y && (p = _);
501
- }, D = () => {
502
- p = A - 1, p < _ && (p = y);
503
- };
504
- switch (m.key) {
505
- case "Home":
506
- p = _;
507
- break;
508
- case "End":
509
- p = y;
510
- break;
511
- case "ArrowRight":
512
- c === "horizontal" && (f ? I() : D());
513
- break;
514
- case "ArrowDown":
515
- c === "vertical" && I();
516
- break;
517
- case "ArrowLeft":
518
- c === "horizontal" && (f ? D() : I());
519
- break;
520
- case "ArrowUp":
521
- c === "vertical" && D();
522
- break;
523
- }
524
- const ve = p % b;
525
- (H = h[ve].ref.current) == null || H.focus();
526
- });
527
- return /* @__PURE__ */ u(
528
- ln,
529
- {
530
- scope: t,
531
- disabled: o,
532
- direction: r,
533
- orientation: c,
534
- children: /* @__PURE__ */ u(B.Slot, { scope: t, children: /* @__PURE__ */ u(
535
- P.div,
536
- {
537
- ...s,
538
- "data-orientation": c,
539
- ref: d,
540
- onKeyDown: o ? void 0 : v
541
- }
542
- ) })
543
- }
544
- );
545
- }
546
- ), M = "AccordionItem", [dn, K] = O(M), de = R.forwardRef(
547
- (e, n) => {
548
- const { __scopeAccordion: t, value: o, ...r } = e, c = T(M, t), s = rn(M, t), a = G(t), d = ee(), l = o && s.value.includes(o) || !1, C = c.disabled || e.disabled;
549
- return /* @__PURE__ */ u(
550
- dn,
551
- {
552
- scope: t,
553
- open: l,
554
- disabled: C,
555
- triggerId: d,
556
- children: /* @__PURE__ */ u(
557
- Ze,
558
- {
559
- "data-orientation": c.orientation,
560
- "data-state": ge(l),
561
- ...a,
562
- ...r,
563
- ref: n,
564
- disabled: C,
565
- open: l,
566
- onOpenChange: (f) => {
567
- f ? s.onItemOpen(o) : s.onItemClose(o);
568
- }
569
- }
570
- )
571
- }
572
- );
573
- }
574
- );
575
- de.displayName = M;
576
- var ue = "AccordionHeader", fe = R.forwardRef(
577
- (e, n) => {
578
- const { __scopeAccordion: t, ...o } = e, r = T(N, t), c = K(ue, t);
579
- return /* @__PURE__ */ u(
580
- P.h3,
581
- {
582
- "data-orientation": r.orientation,
583
- "data-state": ge(c.open),
584
- "data-disabled": c.disabled ? "" : void 0,
585
- ...o,
586
- ref: n
587
- }
588
- );
589
- }
590
- );
591
- fe.displayName = ue;
592
- var U = "AccordionTrigger", pe = R.forwardRef(
593
- (e, n) => {
594
- const { __scopeAccordion: t, ...o } = e, r = T(N, t), c = K(U, t), s = cn(U, t), a = G(t);
595
- return /* @__PURE__ */ u(B.ItemSlot, { scope: t, children: /* @__PURE__ */ u(
596
- Je,
597
- {
598
- "aria-disabled": c.open && !s.collapsible || void 0,
599
- "data-orientation": r.orientation,
600
- id: c.triggerId,
601
- ...a,
602
- ...o,
603
- ref: n
604
- }
605
- ) });
606
- }
607
- );
608
- pe.displayName = U;
609
- var me = "AccordionContent", Ce = R.forwardRef(
610
- (e, n) => {
611
- const { __scopeAccordion: t, ...o } = e, r = T(N, t), c = K(me, t), s = G(t);
612
- return /* @__PURE__ */ u(
613
- Qe,
614
- {
615
- role: "region",
616
- "aria-labelledby": c.triggerId,
617
- "data-orientation": r.orientation,
618
- ...s,
619
- ...o,
620
- ref: n,
621
- style: {
622
- "--radix-accordion-content-height": "var(--radix-collapsible-content-height)",
623
- "--radix-accordion-content-width": "var(--radix-collapsible-content-width)",
624
- ...e.style
625
- }
626
- }
627
- );
628
- }
629
- );
630
- Ce.displayName = me;
631
- function ge(e) {
632
- return e ? "open" : "closed";
633
- }
634
- var gn = ie, vn = de, hn = fe, An = pe, bn = Ce;
635
- export {
636
- bn as C,
637
- hn as H,
638
- vn as I,
639
- gn as R,
640
- An as T,
641
- mn as s
642
- };