@midas-ds/components 1.0.2 → 1.0.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 (125) hide show
  1. package/Button-B4vMZbC6.js +182 -0
  2. package/CHANGELOG.md +10 -0
  3. package/Checkbox-DnKWanep.js +402 -0
  4. package/{Collection-B3xUVWPF.js → Collection-COLWgm24.js} +179 -152
  5. package/Dialog-Cb6toyXO.js +1951 -0
  6. package/DragAndDrop-B0T3WgjL.js +40 -0
  7. package/FocusScope-C8i7CH6y.js +513 -0
  8. package/Form-BQQs3jUk.js +238 -0
  9. package/Group-CdwXhx8Q.js +42 -0
  10. package/{Hidden-BQWDvze4.js → Hidden-DngIphiL.js} +1 -1
  11. package/Link-iAZLB3RI.js +75 -0
  12. package/ListBox-BKWkIIm6.js +474 -0
  13. package/ListKeyboardDelegate-BH-K5hyq.js +172 -0
  14. package/{PressResponder-DP8ZDNGy.js → PressResponder-Cz-TRBHO.js} +10 -10
  15. package/README.md +21 -3
  16. package/SelectionManager-8o40f7mx.js +1047 -0
  17. package/Separator-BlvmQjwz.js +49 -0
  18. package/Tag--W5TgxmK.js +728 -0
  19. package/Text-CQPW6xs7.js +15 -0
  20. package/TextField-DeK_yiK-.js +225 -0
  21. package/TextField.module-0-u4LVPp.js +143 -0
  22. package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-CFx06Bae.js} +1 -1
  23. package/{context-ScOIq_Gu.js → context-Bnqknrce.js} +1 -1
  24. package/index-B-jHjTDC.js +120 -0
  25. package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
  26. package/index-DK9ZACEc.js +642 -0
  27. package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
  28. package/index.js +45 -47
  29. package/index15.js +1 -1
  30. package/index16.js +1 -1
  31. package/index25.js +1 -1
  32. package/index26.js +1 -1
  33. package/index3.js +2 -4
  34. package/index31.js +3 -3
  35. package/index32.js +2 -2
  36. package/index33.js +2 -2
  37. package/index34.js +1 -1
  38. package/index35.js +1 -1
  39. package/index36.js +1 -1
  40. package/index37.js +1 -1
  41. package/index38.js +1 -1
  42. package/index39.js +1 -1
  43. package/index40.js +1 -1
  44. package/index41.js +1 -1
  45. package/index42.js +1 -1
  46. package/index43.js +1 -1
  47. package/index45.js +3 -3
  48. package/index5.js +1 -1
  49. package/index50.js +1 -1
  50. package/index52.js +3 -3
  51. package/index53.js +3 -3
  52. package/index54.js +1 -1
  53. package/index55.js +4 -4
  54. package/index56.js +1 -1
  55. package/index57.js +1 -1
  56. package/index58.js +1 -1
  57. package/index59.js +3 -3
  58. package/index60.js +1 -1
  59. package/index61.js +1 -1
  60. package/index62.js +1 -1
  61. package/index63.js +4 -4
  62. package/index64.js +3 -3
  63. package/index65.js +3 -3
  64. package/index66.js +1 -1
  65. package/index67.js +3 -3
  66. package/index68.js +2 -2
  67. package/index69.js +1 -1
  68. package/index71.js +1 -1
  69. package/index76.js +5 -5
  70. package/index77.js +2 -2
  71. package/index78.js +2 -2
  72. package/index79.js +1 -1
  73. package/index80.js +226 -227
  74. package/index81.js +197 -199
  75. package/index82.js +192 -195
  76. package/index83.js +181 -183
  77. package/index84.js +52 -54
  78. package/index85.js +261 -262
  79. package/index86.js +262 -262
  80. package/index87.js +209 -211
  81. package/index88.js +436 -440
  82. package/index89.js +962 -964
  83. package/index90.js +2401 -2399
  84. package/index92.js +5 -5
  85. package/index93.js +1 -1
  86. package/index94.js +1 -1
  87. package/link/Link.d.ts +2 -2
  88. package/link-button/LinkButton.d.ts +1 -1
  89. package/package.json +7 -1
  90. package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
  91. package/textfield/index.d.ts +0 -2
  92. package/{useControlledState-S_TYcV_c.js → useControlledState-DrAoodI6.js} +1 -1
  93. package/{useDescription-D4_zk_sA.js → useDescription-BPs7eRff.js} +1 -1
  94. package/useField-Dz62UHCP.js +67 -0
  95. package/{useFilter-BnJDBCkt.js → useFilter-ViwzkzZe.js} +1 -1
  96. package/useFocusRing-BKGhL91C.js +1297 -0
  97. package/{useFocusable-C-N9wcwm.js → useFocusable-CRSmYEQc.js} +11 -8
  98. package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-CVEvUCJL.js} +3 -3
  99. package/useHasTabbableChild-C8y4fwiY.js +34 -0
  100. package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-CD74uzLh.js} +19 -19
  101. package/useListState-DKnP5TB5.js +119 -0
  102. package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-DsZ-ZWSk.js} +29 -29
  103. package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-BHTLh8Ob.js} +5 -5
  104. package/Button-CCevm2s3.js +0 -183
  105. package/Checkbox-CllWDBxF.js +0 -405
  106. package/Dialog-CLTyYwkS.js +0 -1889
  107. package/DragAndDrop-OTN7La7U.js +0 -42
  108. package/FocusScope-BR0SJ-cZ.js +0 -512
  109. package/Form-DXLoQL91.js +0 -240
  110. package/Group-DPMuN3h8.js +0 -44
  111. package/Label-C18A_4Z5.js +0 -69
  112. package/Link-BU1h3K2a.js +0 -77
  113. package/ListBox-D21tdwTs.js +0 -463
  114. package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
  115. package/SelectionManager-D4WtKtey.js +0 -988
  116. package/Separator-DLUHK9vv.js +0 -48
  117. package/Tag-CEd6WWSc.js +0 -725
  118. package/Text-DGLaY3HR.js +0 -17
  119. package/TextField-C_hq9WeT.js +0 -226
  120. package/TextField.module-Cwq1FAm7.js +0 -141
  121. package/index-CEg5vZQH.js +0 -132
  122. package/index-CgfokhRq.js +0 -674
  123. package/useFocusRing-D97-G3fT.js +0 -1324
  124. package/useHasTabbableChild-DeuCnGGv.js +0 -34
  125. package/useListState-DSOTbsL3.js +0 -119
@@ -0,0 +1,642 @@
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
+ };