@midas-ds/components 15.0.0 → 15.1.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/AccordionItem-8UtB6O1X.js +347 -0
- package/AccordionItem-DKE794Si.cjs +1 -0
- package/CHANGELOG.md +9 -3
- package/accordion/Accordion.d.ts +5 -0
- package/accordion/AccordionContext.d.ts +2 -3
- package/accordion/AccordionItem.d.ts +5 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/assets/AccordionItem.css +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/AccordionItem-DTbu3lqx.js +0 -343
- package/AccordionItem-tWS22wDv.cjs +0 -1
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { jsx as f, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { c as y } from "./clsx-jbLnTBqA.js";
|
|
3
|
+
import { i as j } from "./icon-map-uS87FT_Q.js";
|
|
4
|
+
import b, { useRef as A, useCallback as h, useEffect as P, useMemo as K, forwardRef as v, createContext as m, useContext as w } from "react";
|
|
5
|
+
import { e as N } from "./Button-BbfVT9Yl.js";
|
|
6
|
+
import { $ as G, a as C, f as S, g as q, h as O } from "./utils-D2iKpxcZ.js";
|
|
7
|
+
import { c as E, $ as J, a as B } from "./mergeProps-Ct8m5-xW.js";
|
|
8
|
+
import { $ as D } from "./filterDOMProps-wsa9OcNI.js";
|
|
9
|
+
import { $ as M } from "./useControlledState-u436Wbp1.js";
|
|
10
|
+
import { flushSync as L } from "react-dom";
|
|
11
|
+
import { $ as Q } from "./useEvent-smuTnX4G.js";
|
|
12
|
+
import { $ as U } from "./SSRProvider-D8lZ0o6A.js";
|
|
13
|
+
import { $ as R } from "./useFocusRing-CcxI7nbg.js";
|
|
14
|
+
import { B as X } from "./Button-DdXFHfXw.js";
|
|
15
|
+
import { H as Y } from "./Heading-CCoGfKQ8.js";
|
|
16
|
+
import { C as Z } from "./chevron-down-DmZMdOiC.js";
|
|
17
|
+
import './assets/AccordionItem.css';const ee = "_root_17bdp_1", te = "_contained_17bdp_5", _ = {
|
|
18
|
+
root: ee,
|
|
19
|
+
contained: te
|
|
20
|
+
};
|
|
21
|
+
function ne(i, e, a) {
|
|
22
|
+
let { isDisabled: n } = i, s = E(), d = E(), r = U(), c = A(null), u = h(() => {
|
|
23
|
+
c.current = requestAnimationFrame(() => {
|
|
24
|
+
a.current && a.current.setAttribute("hidden", "until-found");
|
|
25
|
+
}), L(() => {
|
|
26
|
+
e.toggle();
|
|
27
|
+
});
|
|
28
|
+
}, [
|
|
29
|
+
a,
|
|
30
|
+
e
|
|
31
|
+
]);
|
|
32
|
+
Q(a, "beforematch", u);
|
|
33
|
+
let o = A(null);
|
|
34
|
+
return J(() => {
|
|
35
|
+
if (c.current && cancelAnimationFrame(c.current), a.current && !n && !r) {
|
|
36
|
+
let t = a.current;
|
|
37
|
+
o.current == null || typeof t.getAnimations != "function" ? e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto")) : (t.setAttribute("hidden", "until-found"), t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px")) : e.isExpanded !== o.current && (e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => {
|
|
38
|
+
t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto");
|
|
39
|
+
}).catch(() => {
|
|
40
|
+
})) : (t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), window.getComputedStyle(t).height, t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => t.setAttribute("hidden", "until-found")).catch(() => {
|
|
41
|
+
}))), o.current = e.isExpanded;
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
n,
|
|
45
|
+
a,
|
|
46
|
+
e.isExpanded,
|
|
47
|
+
r
|
|
48
|
+
]), P(() => () => {
|
|
49
|
+
c.current && cancelAnimationFrame(c.current);
|
|
50
|
+
}, []), {
|
|
51
|
+
buttonProps: {
|
|
52
|
+
id: s,
|
|
53
|
+
"aria-expanded": e.isExpanded,
|
|
54
|
+
"aria-controls": d,
|
|
55
|
+
onPress: (t) => {
|
|
56
|
+
!n && t.pointerType !== "keyboard" && e.toggle();
|
|
57
|
+
},
|
|
58
|
+
isDisabled: n,
|
|
59
|
+
onPressStart(t) {
|
|
60
|
+
t.pointerType === "keyboard" && !n && e.toggle();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
panelProps: {
|
|
64
|
+
id: d,
|
|
65
|
+
// This can be overridden at the panel element level.
|
|
66
|
+
role: "group",
|
|
67
|
+
"aria-labelledby": s,
|
|
68
|
+
"aria-hidden": !e.isExpanded,
|
|
69
|
+
hidden: r || n ? n || !e.isExpanded : void 0
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function ae(i) {
|
|
74
|
+
let [e, a] = M(i.isExpanded, i.defaultExpanded || !1, i.onExpandedChange);
|
|
75
|
+
const n = h(() => {
|
|
76
|
+
a(!0);
|
|
77
|
+
}, [
|
|
78
|
+
a
|
|
79
|
+
]), s = h(() => {
|
|
80
|
+
a(!1);
|
|
81
|
+
}, [
|
|
82
|
+
a
|
|
83
|
+
]), d = h(() => {
|
|
84
|
+
a(!e);
|
|
85
|
+
}, [
|
|
86
|
+
a,
|
|
87
|
+
e
|
|
88
|
+
]);
|
|
89
|
+
return {
|
|
90
|
+
isExpanded: e,
|
|
91
|
+
setExpanded: a,
|
|
92
|
+
expand: n,
|
|
93
|
+
collapse: s,
|
|
94
|
+
toggle: d
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function se(i) {
|
|
98
|
+
let { allowsMultipleExpanded: e = !1, isDisabled: a = !1 } = i, [n, s] = M(K(() => i.expandedKeys ? new Set(i.expandedKeys) : void 0, [
|
|
99
|
+
i.expandedKeys
|
|
100
|
+
]), K(() => i.defaultExpandedKeys ? new Set(i.defaultExpandedKeys) : /* @__PURE__ */ new Set(), [
|
|
101
|
+
i.defaultExpandedKeys
|
|
102
|
+
]), i.onExpandedChange);
|
|
103
|
+
return P(() => {
|
|
104
|
+
if (!e && n.size > 1) {
|
|
105
|
+
let d = n.values().next().value;
|
|
106
|
+
d != null && s(/* @__PURE__ */ new Set([
|
|
107
|
+
d
|
|
108
|
+
]));
|
|
109
|
+
}
|
|
110
|
+
}), {
|
|
111
|
+
allowsMultipleExpanded: e,
|
|
112
|
+
isDisabled: a,
|
|
113
|
+
expandedKeys: n,
|
|
114
|
+
setExpandedKeys: s,
|
|
115
|
+
toggleKey(d) {
|
|
116
|
+
let r;
|
|
117
|
+
e ? (r = new Set(n), r.has(d) ? r.delete(d) : r.add(d)) : r = new Set(n.has(d) ? [] : [
|
|
118
|
+
d
|
|
119
|
+
]), s(r);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
|
|
124
|
+
let n = se(e), s = C({
|
|
125
|
+
...e,
|
|
126
|
+
defaultClassName: "react-aria-DisclosureGroup",
|
|
127
|
+
values: {
|
|
128
|
+
isDisabled: n.isDisabled,
|
|
129
|
+
state: n
|
|
130
|
+
}
|
|
131
|
+
}), d = D(e, {
|
|
132
|
+
global: !0
|
|
133
|
+
});
|
|
134
|
+
return /* @__PURE__ */ b.createElement("div", {
|
|
135
|
+
...d,
|
|
136
|
+
...s,
|
|
137
|
+
ref: a,
|
|
138
|
+
"data-disabled": e.isDisabled || void 0
|
|
139
|
+
}, /* @__PURE__ */ b.createElement(F.Provider, {
|
|
140
|
+
value: n
|
|
141
|
+
}, s.children));
|
|
142
|
+
}), de = /* @__PURE__ */ m(null), re = /* @__PURE__ */ m(null), W = /* @__PURE__ */ m(null), oe = /* @__PURE__ */ v(function(e, a) {
|
|
143
|
+
[e, a] = G(e, a, de);
|
|
144
|
+
let n = w(F), { id: s, ...d } = e, r = E();
|
|
145
|
+
s || (s = r);
|
|
146
|
+
let c = n ? n.expandedKeys.has(s) : e.isExpanded, u = ae({
|
|
147
|
+
...e,
|
|
148
|
+
isExpanded: c,
|
|
149
|
+
onExpandedChange(H) {
|
|
150
|
+
var $;
|
|
151
|
+
n && n.toggleKey(s), ($ = e.onExpandedChange) === null || $ === void 0 || $.call(e, H);
|
|
152
|
+
}
|
|
153
|
+
}), o = b.useRef(null), t = e.isDisabled || (n == null ? void 0 : n.isDisabled) || !1, { buttonProps: p, panelProps: g } = ne({
|
|
154
|
+
...e,
|
|
155
|
+
isExpanded: c,
|
|
156
|
+
isDisabled: t
|
|
157
|
+
}, u, o), { isFocusVisible: x, focusProps: V } = R({
|
|
158
|
+
within: !0
|
|
159
|
+
}), k = C({
|
|
160
|
+
...e,
|
|
161
|
+
id: void 0,
|
|
162
|
+
defaultClassName: "react-aria-Disclosure",
|
|
163
|
+
values: {
|
|
164
|
+
isExpanded: u.isExpanded,
|
|
165
|
+
isDisabled: t,
|
|
166
|
+
isFocusVisibleWithin: x,
|
|
167
|
+
state: u
|
|
168
|
+
}
|
|
169
|
+
}), z = D(d, {
|
|
170
|
+
global: !0
|
|
171
|
+
});
|
|
172
|
+
return /* @__PURE__ */ b.createElement(S, {
|
|
173
|
+
values: [
|
|
174
|
+
[
|
|
175
|
+
N,
|
|
176
|
+
{
|
|
177
|
+
slots: {
|
|
178
|
+
[q]: {},
|
|
179
|
+
trigger: p
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
W,
|
|
185
|
+
{
|
|
186
|
+
panelProps: g,
|
|
187
|
+
panelRef: o
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
re,
|
|
192
|
+
u
|
|
193
|
+
]
|
|
194
|
+
]
|
|
195
|
+
}, /* @__PURE__ */ b.createElement("div", {
|
|
196
|
+
...B(z, k, V),
|
|
197
|
+
ref: a,
|
|
198
|
+
"data-expanded": u.isExpanded || void 0,
|
|
199
|
+
"data-disabled": t || void 0,
|
|
200
|
+
"data-focus-visible-within": x || void 0
|
|
201
|
+
}, k.children));
|
|
202
|
+
}), le = /* @__PURE__ */ v(function(e, a) {
|
|
203
|
+
let { role: n = "group" } = e, { panelProps: s, panelRef: d } = w(W), { isFocusVisible: r, focusProps: c } = R({
|
|
204
|
+
within: !0
|
|
205
|
+
}), u = C({
|
|
206
|
+
...e,
|
|
207
|
+
defaultClassName: "react-aria-DisclosurePanel",
|
|
208
|
+
values: {
|
|
209
|
+
isFocusVisibleWithin: r
|
|
210
|
+
}
|
|
211
|
+
}), o = D(e, {
|
|
212
|
+
global: !0
|
|
213
|
+
});
|
|
214
|
+
return /* @__PURE__ */ b.createElement("div", {
|
|
215
|
+
...B(o, u, s, c),
|
|
216
|
+
ref: O(a, d),
|
|
217
|
+
role: n,
|
|
218
|
+
"data-focus-visible-within": r || void 0
|
|
219
|
+
}, /* @__PURE__ */ b.createElement(S, {
|
|
220
|
+
values: [
|
|
221
|
+
[
|
|
222
|
+
N,
|
|
223
|
+
null
|
|
224
|
+
]
|
|
225
|
+
]
|
|
226
|
+
}, e.children));
|
|
227
|
+
}), T = m(void 0), je = ({
|
|
228
|
+
variant: i,
|
|
229
|
+
children: e,
|
|
230
|
+
className: a,
|
|
231
|
+
isContained: n,
|
|
232
|
+
size: s = "large",
|
|
233
|
+
...d
|
|
234
|
+
}) => {
|
|
235
|
+
const r = n || i === "contained";
|
|
236
|
+
return /* @__PURE__ */ f(T.Provider, { value: { isContained: r, size: s }, children: /* @__PURE__ */ f(
|
|
237
|
+
ie,
|
|
238
|
+
{
|
|
239
|
+
className: y(
|
|
240
|
+
_.root,
|
|
241
|
+
r ? _.contained : _.uncontained,
|
|
242
|
+
a
|
|
243
|
+
),
|
|
244
|
+
...d,
|
|
245
|
+
children: e
|
|
246
|
+
}
|
|
247
|
+
) });
|
|
248
|
+
}, ce = "_item_bbrk2_1", ue = "_contained_bbrk2_18", fe = "_medium_bbrk2_28", pe = "_success_bbrk2_33", be = "_warning_bbrk2_39", me = "_info_bbrk2_45", ge = "_important_bbrk2_51", xe = "_triggerButton_bbrk2_62", he = "_triggerText_bbrk2_66", $e = "_trigger_bbrk2_62", _e = "_triggerMainContent_bbrk2_79", ye = "_chevronIcon_bbrk2_96", Ee = "_statusIcon_bbrk2_102", Pe = "_panel_bbrk2_120", ve = "_content_bbrk2_128", we = "_hasBackground_bbrk2_133", Ce = "_header_bbrk2_137", l = {
|
|
249
|
+
item: ce,
|
|
250
|
+
contained: ue,
|
|
251
|
+
medium: fe,
|
|
252
|
+
success: pe,
|
|
253
|
+
warning: be,
|
|
254
|
+
info: me,
|
|
255
|
+
important: ge,
|
|
256
|
+
triggerButton: xe,
|
|
257
|
+
triggerText: he,
|
|
258
|
+
trigger: $e,
|
|
259
|
+
triggerMainContent: _e,
|
|
260
|
+
" ": "_ _bbrk2_1",
|
|
261
|
+
chevronIcon: ye,
|
|
262
|
+
statusIcon: Ee,
|
|
263
|
+
panel: Pe,
|
|
264
|
+
content: ve,
|
|
265
|
+
hasBackground: we,
|
|
266
|
+
header: Ce
|
|
267
|
+
}, Ge = ({
|
|
268
|
+
title: i,
|
|
269
|
+
children: e,
|
|
270
|
+
className: a,
|
|
271
|
+
headingLevel: n = "h2",
|
|
272
|
+
type: s,
|
|
273
|
+
hasBackground: d = !0,
|
|
274
|
+
size: r = "large",
|
|
275
|
+
isContained: c,
|
|
276
|
+
...u
|
|
277
|
+
}) => {
|
|
278
|
+
const o = w(T), t = c ?? (o == null ? void 0 : o.isContained) ?? !1, p = typeof i == "object";
|
|
279
|
+
P(() => {
|
|
280
|
+
s && !t && console.warn(
|
|
281
|
+
"AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency."
|
|
282
|
+
);
|
|
283
|
+
}, [s, t]);
|
|
284
|
+
const g = s ? j[s] : null, x = g ? /* @__PURE__ */ f(
|
|
285
|
+
g,
|
|
286
|
+
{
|
|
287
|
+
size: 20,
|
|
288
|
+
className: l.statusIcon
|
|
289
|
+
}
|
|
290
|
+
) : null;
|
|
291
|
+
return /* @__PURE__ */ I(
|
|
292
|
+
oe,
|
|
293
|
+
{
|
|
294
|
+
...u,
|
|
295
|
+
className: y(
|
|
296
|
+
l.item,
|
|
297
|
+
s && l[s],
|
|
298
|
+
(r === "medium" || (o == null ? void 0 : o.size) === "medium") && l.medium,
|
|
299
|
+
t && l.contained,
|
|
300
|
+
a
|
|
301
|
+
),
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ f("div", { className: l.trigger, children: /* @__PURE__ */ I(
|
|
304
|
+
X,
|
|
305
|
+
{
|
|
306
|
+
className: l.triggerButton,
|
|
307
|
+
slot: "trigger",
|
|
308
|
+
variant: "icon",
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ f(
|
|
311
|
+
Z,
|
|
312
|
+
{
|
|
313
|
+
size: 20,
|
|
314
|
+
className: l.chevronIcon
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ f("div", { className: l.triggerMainContent, children: p ? i : /* @__PURE__ */ f(
|
|
318
|
+
Y,
|
|
319
|
+
{
|
|
320
|
+
level: 3,
|
|
321
|
+
elementType: n,
|
|
322
|
+
className: l.triggerText,
|
|
323
|
+
children: i
|
|
324
|
+
}
|
|
325
|
+
) }),
|
|
326
|
+
x
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
) }),
|
|
330
|
+
/* @__PURE__ */ f(le, { className: l.panel, children: /* @__PURE__ */ f(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
className: y(
|
|
334
|
+
l.content,
|
|
335
|
+
d && l.hasBackground
|
|
336
|
+
),
|
|
337
|
+
children: e
|
|
338
|
+
}
|
|
339
|
+
) })
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
export {
|
|
345
|
+
Ge as A,
|
|
346
|
+
je as a
|
|
347
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./assets/AccordionItem.css');const b=require("react/jsx-runtime"),E=require("./clsx-DKOfLqne.cjs"),S=require("./icon-map-9XcghDra.cjs"),d=require("react"),v=require("./Button-1sEX8jKn.cjs"),p=require("./utils-CtICjCYt.cjs"),$=require("./mergeProps-Du5A8xi8.cjs"),y=require("./filterDOMProps-RRlKPKX0.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),K=require("react-dom"),M=require("./useEvent-C125NAue.cjs"),N=require("./SSRProvider-DZRLwxPS.cjs"),w=require("./useFocusRing-C-XVcAE5.cjs"),j=require("./Button-BEWKXjlP.cjs"),B=require("./Heading-x7y3xadc.cjs"),F=require("./chevron-down-5hFlg_lR.cjs"),W="_root_17bdp_1",T="_contained_17bdp_5",_={root:W,contained:T};function V(r,e,s){let{isDisabled:n}=r,a=$.$bdb11010cef70236$export$f680877a34711e37(),i=$.$bdb11010cef70236$export$f680877a34711e37(),o=N.$b5e257d569688ac6$export$535bd6ca7f90a273(),u=d.useRef(null),f=d.useCallback(()=>{u.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found")}),K.flushSync(()=>{e.toggle()})},[s,e]);M.$e9faafb641e167db$export$90fc3a17d93f704c(s,"beforematch",f);let c=d.useRef(null);return $.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(u.current&&cancelAnimationFrame(u.current),s.current&&!n&&!o){let t=s.current;c.current==null||typeof t.getAnimations!="function"?e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")):(t.setAttribute("hidden","until-found"),t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px")):e.isExpanded!==c.current&&(e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),Promise.all(t.getAnimations().map(x=>x.finished)).then(()=>{t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")}).catch(()=>{})):(t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),window.getComputedStyle(t).height,t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px"),Promise.all(t.getAnimations().map(x=>x.finished)).then(()=>t.setAttribute("hidden","until-found")).catch(()=>{}))),c.current=e.isExpanded}},[n,s,e.isExpanded,o]),d.useEffect(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[]),{buttonProps:{id:a,"aria-expanded":e.isExpanded,"aria-controls":i,onPress:t=>{!n&&t.pointerType!=="keyboard"&&e.toggle()},isDisabled:n,onPressStart(t){t.pointerType==="keyboard"&&!n&&e.toggle()}},panelProps:{id:i,role:"group","aria-labelledby":a,"aria-hidden":!e.isExpanded,hidden:o||n?n||!e.isExpanded:void 0}}}function z(r){let[e,s]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(r.isExpanded,r.defaultExpanded||!1,r.onExpandedChange);const n=d.useCallback(()=>{s(!0)},[s]),a=d.useCallback(()=>{s(!1)},[s]),i=d.useCallback(()=>{s(!e)},[s,e]);return{isExpanded:e,setExpanded:s,expand:n,collapse:a,toggle:i}}function H(r){let{allowsMultipleExpanded:e=!1,isDisabled:s=!1}=r,[n,a]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(d.useMemo(()=>r.expandedKeys?new Set(r.expandedKeys):void 0,[r.expandedKeys]),d.useMemo(()=>r.defaultExpandedKeys?new Set(r.defaultExpandedKeys):new Set,[r.defaultExpandedKeys]),r.onExpandedChange);return d.useEffect(()=>{if(!e&&n.size>1){let i=n.values().next().value;i!=null&&a(new Set([i]))}}),{allowsMultipleExpanded:e,isDisabled:s,expandedKeys:n,setExpandedKeys:a,toggleKey(i){let o;e?(o=new Set(n),o.has(i)?o.delete(i):o.add(i)):o=new Set(n.has(i)?[]:[i]),a(o)}}}const k=d.createContext(null),O=d.forwardRef(function(e,s){let n=H(e),a=p.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosureGroup",values:{isDisabled:n.isDisabled,state:n}}),i=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...i,...a,ref:s,"data-disabled":e.isDisabled||void 0},d.createElement(k.Provider,{value:n},a.children))}),G=d.createContext(null),J=d.createContext(null),D=d.createContext(null),L=d.forwardRef(function(e,s){[e,s]=p.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,G);let n=d.useContext(k),{id:a,...i}=e,o=$.$bdb11010cef70236$export$f680877a34711e37();a||(a=o);let u=n?n.expandedKeys.has(a):e.isExpanded,f=z({...e,isExpanded:u,onExpandedChange(q){var m;n&&n.toggleKey(a),(m=e.onExpandedChange)===null||m===void 0||m.call(e,q)}}),c=d.useRef(null),t=e.isDisabled||(n==null?void 0:n.isDisabled)||!1,{buttonProps:x,panelProps:g}=V({...e,isExpanded:u,isDisabled:t},f,c),{isFocusVisible:h,focusProps:I}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),P=p.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:f.isExpanded,isDisabled:t,isFocusVisibleWithin:h,state:f}}),R=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(i,{global:!0});return d.createElement(p.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,{slots:{[p.$64fa3d84918910a7$export$c62b8e45d58ddad9]:{},trigger:x}}],[D,{panelProps:g,panelRef:c}],[J,f]]},d.createElement("div",{...$.$3ef42575df84b30b$export$9d1611c77c2fe928(R,P,I),ref:s,"data-expanded":f.isExpanded||void 0,"data-disabled":t||void 0,"data-focus-visible-within":h||void 0},P.children))}),Q=d.forwardRef(function(e,s){let{role:n="group"}=e,{panelProps:a,panelRef:i}=d.useContext(D),{isFocusVisible:o,focusProps:u}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),f=p.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:o}}),c=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...$.$3ef42575df84b30b$export$9d1611c77c2fe928(c,f,a,u),ref:p.$5dc95899b306f630$export$c9058316764c140e(s,i),role:n,"data-focus-visible-within":o||void 0},d.createElement(p.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,null]]},e.children))}),A=d.createContext(void 0),U=({variant:r,children:e,className:s,isContained:n,size:a="large",...i})=>{const o=n||r==="contained";return b.jsx(A.Provider,{value:{isContained:o,size:a},children:b.jsx(O,{className:E.clsx(_.root,o?_.contained:_.uncontained,s),...i,children:e})})},X="_item_bbrk2_1",Y="_contained_bbrk2_18",Z="_medium_bbrk2_28",ee="_success_bbrk2_33",te="_warning_bbrk2_39",ne="_info_bbrk2_45",se="_important_bbrk2_51",de="_triggerButton_bbrk2_62",ae="_triggerText_bbrk2_66",re="_trigger_bbrk2_62",ie="_triggerMainContent_bbrk2_79",oe="_chevronIcon_bbrk2_96",ce="_statusIcon_bbrk2_102",le="_panel_bbrk2_120",ue="_content_bbrk2_128",fe="_hasBackground_bbrk2_133",be="_header_bbrk2_137",l={item:X,contained:Y,medium:Z,success:ee,warning:te,info:ne,important:se,triggerButton:de,triggerText:ae,trigger:re,triggerMainContent:ie," ":"_ _bbrk2_1",chevronIcon:oe,statusIcon:ce,panel:le,content:ue,hasBackground:fe,header:be},pe=({title:r,children:e,className:s,headingLevel:n="h2",type:a,hasBackground:i=!0,size:o="large",isContained:u,...f})=>{const c=d.useContext(A),t=u??(c==null?void 0:c.isContained)??!1,x=typeof r=="object";d.useEffect(()=>{a&&!t&&console.warn("AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency.")},[a,t]);const g=a?S.iconMap[a]:null,h=g?b.jsx(g,{size:20,className:l.statusIcon}):null;return b.jsxs(L,{...f,className:E.clsx(l.item,a&&l[a],(o==="medium"||(c==null?void 0:c.size)==="medium")&&l.medium,t&&l.contained,s),children:[b.jsx("div",{className:l.trigger,children:b.jsxs(j.Button,{className:l.triggerButton,slot:"trigger",variant:"icon",children:[b.jsx(F.ChevronDown,{size:20,className:l.chevronIcon}),b.jsx("div",{className:l.triggerMainContent,children:x?r:b.jsx(B.Heading,{level:3,elementType:n,className:l.triggerText,children:r})}),h]})}),b.jsx(Q,{className:l.panel,children:b.jsx("div",{className:E.clsx(l.content,i&&l.hasBackground),children:e})})]})};exports.Accordion=U;exports.AccordionItem=pe;
|
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
## 15.1.0 (2025-10-30)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **accordion:** add size prop ([#896](https://github.com/migrationsverket/midas/pull/896))
|
|
6
|
+
|
|
1
7
|
# 15.0.0 (2025-10-28)
|
|
2
8
|
|
|
3
9
|
### 🚀 Features
|
|
4
10
|
|
|
5
|
-
- ⚠️
|
|
11
|
+
- ⚠️ **select:** replace custom select with new RAC based select
|
|
6
12
|
- **select:** use midas popover
|
|
7
13
|
- **select:** update type imports
|
|
8
14
|
- **select:** add sections
|
|
@@ -17,9 +23,9 @@
|
|
|
17
23
|
- **tag:** add visible keyboard focus for all tags
|
|
18
24
|
- **field-error:** remove margin from aria hidden siblings
|
|
19
25
|
|
|
20
|
-
### ⚠️
|
|
26
|
+
### ⚠️ Breaking Changes
|
|
21
27
|
|
|
22
|
-
- ⚠️
|
|
28
|
+
- ⚠️ **select:** replace custom select with new RAC based select
|
|
23
29
|
|
|
24
30
|
## 14.1.0 (2025-10-27)
|
|
25
31
|
|
package/accordion/Accordion.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DisclosureGroupProps } from 'react-aria-components';
|
|
2
|
+
import { Size } from '../common/types';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
export interface MidasAccordion extends DisclosureGroupProps {
|
|
4
5
|
/**
|
|
@@ -9,6 +10,10 @@ export interface MidasAccordion extends DisclosureGroupProps {
|
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
isDisabled?: boolean;
|
|
11
12
|
isContained?: boolean;
|
|
13
|
+
/** Component size when used with `isContained` (large: height 48px, medium: height 40px)
|
|
14
|
+
* @default 'large'
|
|
15
|
+
**/
|
|
16
|
+
size?: Size;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Accordions help reduce visual clutter on a page by organizing content into collapsible sections.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
import { MidasAccordion } from './Accordion';
|
|
2
|
+
export type AccordionContextValue = Pick<MidasAccordion, 'isContained' | 'size'>;
|
|
4
3
|
export declare const AccordionContext: import('react').Context<AccordionContextValue | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DisclosureProps } from 'react-aria-components';
|
|
2
2
|
import { HeadingProps } from '../heading';
|
|
3
|
-
import { FeedbackStatus } from '../common/types';
|
|
3
|
+
import { FeedbackStatus, Size } from '../common/types';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
interface MidasAccordionItem extends Omit<DisclosureProps, 'children'> {
|
|
6
6
|
/** The text displayed in the collapsed state. If a ReactNode is provided, a heading will not be automatically added, and you must provide one yourself. */
|
|
@@ -16,6 +16,10 @@ interface MidasAccordionItem extends Omit<DisclosureProps, 'children'> {
|
|
|
16
16
|
**/
|
|
17
17
|
hasBackground?: boolean;
|
|
18
18
|
isContained?: boolean;
|
|
19
|
+
/** Component size when used with `isContained` (large: height 48px, medium: height 40px)
|
|
20
|
+
* @default 'large'
|
|
21
|
+
**/
|
|
22
|
+
size?: Size;
|
|
19
23
|
}
|
|
20
24
|
export declare const AccordionItem: React.FC<MidasAccordionItem>;
|
|
21
25
|
export {};
|
package/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AccordionItem-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AccordionItem-DKE794Si.cjs");exports.Accordion=o.Accordion;exports.AccordionItem=o.AccordionItem;
|
package/accordion/index.js
CHANGED
package/assets/AccordionItem.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._root_17bdp_1{--gap: .75rem;--heading-color: var(--midas-text-primary);font-family:var(--midas-typography-font-family);color:var(--midas-text-primary);width:100%;display:flex;flex-direction:column;gap:var(--gap)}._root_17bdp_1._contained_17bdp_5{--gap: .25rem}._root_17bdp_1[data-disabled]{--heading-color: var(--midas-text-disabled)}._root_17bdp_1[data-disabled] ._triggerButton_17bdp_12{background:transparent}.
|
|
1
|
+
._root_17bdp_1{--gap: .75rem;--heading-color: var(--midas-text-primary);font-family:var(--midas-typography-font-family);color:var(--midas-text-primary);width:100%;display:flex;flex-direction:column;gap:var(--gap)}._root_17bdp_1._contained_17bdp_5{--gap: .25rem}._root_17bdp_1[data-disabled]{--heading-color: var(--midas-text-disabled)}._root_17bdp_1[data-disabled] ._triggerButton_17bdp_12{background:transparent}._item_bbrk2_1{--item-padding: 0;--content-padding: var(--midas-spacing-20) var(--midas-spacing-50) var(--midas-spacing-50) 1.85rem;--border: none;--accordion-background: transparent;--accordion-background-hover: transparent;--text-color: var(--midas-text-primary);--icon-color: var(--midas-icon-primary);font-family:var(--midas-typography-font-family);color:var(--text-color);background-color:var(--accordion-background);border:var(--border);border-color:var(--border-color)}._contained_bbrk2_18{--gap: var(--midas-spacing-20);--item-padding: calc(var(--midas-spacing-40) - 2px) var(--midas-spacing-40);--content-padding: var(--midas-spacing-40) var(--midas-spacing-50) var(--midas-spacing-50) var(--midas-spacing-50);--border-color: var(--midas-border-color-secondary);--border: 1px solid;--accordion-background: var(--midas-layer-01-base);--accordion-background-hover: var(--midas-layer-01-hover)}._contained_bbrk2_18._medium_bbrk2_28{--item-padding: calc(var(--midas-spacing-30) - 2px) var(--midas-spacing-40)}._success_bbrk2_33{--accordion-background: var(--midas-support-background-success);--accordion-background-hover: var(--midas-support-background-success-hover);--border-color: var(--midas-support-border-success)}._warning_bbrk2_39{--accordion-background: var(--midas-support-background-warning);--accordion-background-hover: var(--midas-support-background-warning-hover);--border-color: var(--midas-support-border-warning)}._info_bbrk2_45{--accordion-background: var(--midas-support-background-info);--accordion-background-hover: var(--midas-support-background-info-hover);--border-color: var(--midas-support-border-info)}._important_bbrk2_51{--accordion-background: var(--midas-support-background-important);--accordion-background-hover: var(--midas-support-background-important-hover);--border-color: var(--midas-support-border-important)}._item_bbrk2_1[data-disabled]{--border-color: var(--midas-border-color-disabled);--icon-color: var(--midas-text-disabled);--text-color: var(--midas-text-disabled)}._item_bbrk2_1[data-disabled] ._triggerButton_bbrk2_62{background:transparent}._item_bbrk2_1[data-disabled] ._triggerText_bbrk2_66{color:var(--midas-text-disabled)}._trigger_bbrk2_62{border:0;cursor:pointer;margin:0;position:relative;z-index:1}._triggerMainContent_bbrk2_79{flex:1 0 0;text-align:left}._triggerText_bbrk2_66{margin:0;padding:0}:not(#_\ _bbrk2_1) ._triggerButton_bbrk2_62{width:100%;padding:var(--item-padding);align-items:flex-start;min-height:unset}._chevronIcon_bbrk2_96{transform:rotate(0);transition:transform var(--midas-transition-duration-normal) ease;padding:var(--midas-spacing-10) 0}._statusIcon_bbrk2_102{color:var(--icon-color);padding:var(--midas-spacing-10) 0}@media (forced-colors: active){._statusIcon_bbrk2_102{color:currentColor}}._triggerButton_bbrk2_62[aria-expanded=true] ._chevronIcon_bbrk2_96{transform:rotate(-180deg);transition:transform var(--midas-transition-duration-normal) ease}._triggerButton_bbrk2_62[data-hovered]{background-color:var(--accordion-background-hover)}._panel_bbrk2_120{height:var(--disclosure-panel-height);transition:height var(--midas-transition-panel-collapse);overflow:clip}._content_bbrk2_128{height:auto;padding:var(--content-padding)}._hasBackground_bbrk2_133{background-color:var(--midas-background-base)}._header_bbrk2_137{margin:0}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./AccordionItem-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./AccordionItem-DKE794Si.cjs"),l=require("./BadgeContainer-BZl6mSeb.cjs"),m=require("./Breadcrumbs-BBDGxc68.cjs"),I=require("./Button-BEWKXjlP.cjs"),D=require("./ButtonGroup-BpvDDECt.cjs"),g=require("./RangeCalendar-CH0CyBui.cjs"),e=require("./Card-Db9xdzJ0.cjs"),k=require("./CharacterCounter-CTpQ12f7.cjs"),P=require("./Checkbox-BgrLxY6P.cjs"),G=require("./CheckboxGroup-thvsvOqD.cjs"),h=require("./ColorSchemeSwitch-Ckna0otR.cjs"),u=require("./ComboBox-DFPrJUoV.cjs"),R=require("./DateField-B92Cqf9K.cjs"),s=require("./DateInputDivider-CCrXjsUB.cjs"),T=require("./DateRangePicker-COSTCOt8.cjs"),B=require("./Dropdown-_g9l5k07.cjs"),v=require("./FieldError-JWxR_EqN.cjs"),b=require("./FileUpload-C0TjNkuh.cjs"),F=require("./Grid-B6G4PWn5.cjs"),M=require("./GridItem-BZ8eOXMB.cjs"),A=require("./Heading-x7y3xadc.cjs"),$=require("./InfoBanner-_M_rGQiu.cjs"),w=require("./Label-DpY2SZdQ.cjs"),t=require("./Layout-BrEuHajQ.cjs"),f=require("./Link-BvUSTIip.cjs"),H=require("./LinkButton-DGdnbTgR.cjs"),y=require("./Logo-4tRnV4Su.cjs"),E=require("./Dialog-DtOf0vWx.cjs"),N=require("./Popover-DpB0XDBp.cjs"),Q=require("./ProgressBar-BZqAQTV3.cjs"),C=require("./Radio-B3FBTn4F.cjs"),Z=require("./SearchField-BX7P7BgV.cjs"),j=require("./Select-D4wi-0Jw.cjs"),O=require("./Select-JIDW2mN8.cjs"),U=require("./Skeleton-8onymGEG.cjs"),z=require("./Spinner-DIapnvIz.cjs"),o=require("./Table-B1nxmW14.cjs"),a=require("./TabList-DVzXuGXA.cjs"),p=require("./Tag-BL-_PONN.cjs"),J=require("./Text-D5OSv6Uv.cjs"),n=require("./TextArea-Bjf8CBp0.cjs"),r=require("./Toast-DUZ5jfG1.cjs"),q=require("./ToggleButtonGroup-dnvnzkaD.cjs"),x=require("./Tooltip-D-ATlbIM.cjs"),K=require("./ListBox-u6ZXp5Yi.cjs"),L=require("./ListBoxLoadMoreItem-DMUOzVtt.cjs"),c=require("./ListBoxSection-CBlpg0AG.cjs"),i=require("./Separator-CSyYDGNE.cjs"),V=require("./usePress-DmU79HEg.cjs"),S=require("./Dialog-DycTLpdr.cjs");exports.Accordion=d.Accordion;exports.AccordionItem=d.AccordionItem;exports.Badge=l.Badge;exports.BadgeContainer=l.BadgeContainer;exports.Breadcrumbs=m.Breadcrumbs;exports.Button=I.Button;exports.ButtonGroup=D.ButtonGroup;exports.Calendar=g.Calendar;exports.RangeCalendar=g.RangeCalendar;exports.Card=e.Card;exports.CardActionArea=e.CardActionArea;exports.CardActions=e.CardActions;exports.CardContent=e.CardContent;exports.CardImage=e.CardImage;exports.CardLink=e.CardLink;exports.CardTitle=e.CardTitle;exports.CharacterCounter=k.CharacterCounter;exports.Checkbox=P.Checkbox;exports.CheckboxGroup=G.CheckboxGroup;exports.ColorSchemeSwitch=h.ColorSchemeSwitch;exports.ComboBox=u.ComboBox;exports.ComboBoxItem=u.ComboBoxItem;exports.ComboBoxSection=u.ComboBoxSection;exports.DateField=R.DateField;exports.DateInput=s.DateInput;exports.DateInputDivider=s.DateInputDivider;exports.DateSegment=s.DateSegment;exports.DatePicker=T.DatePicker;exports.DateRangePicker=T.DateRangePicker;exports.Dropdown=B.Dropdown;exports.DropdownItem=B.DropdownItem;exports.FieldError=v.FieldError;exports.DropZone=b.DropZone;exports.FileTrigger=b.FileTrigger;exports.Grid=F.Grid;exports.GridItem=M.GridItem;exports.Heading=A.Heading;exports.InfoBanner=$.InfoBanner;exports.Label=w.Label;exports.Header=t.Header;exports.Layout=t.Layout;exports.Navbar=t.Navbar;exports.Sidebar=t.Sidebar;exports.SidebarLink=t.SidebarLink;exports.Link=f.Link;exports.LinkButton=H.LinkButton;exports.Logo=y.Logo;exports.Modal=E.Modal;exports.Popover=N.Popover;exports.ProgressBar=Q.ProgressBar;exports.Radio=C.Radio;exports.RadioGroup=C.RadioGroup;exports.SearchField=Z.SearchField;exports.Select=j.Select;exports.LegacySelect=O.Select;exports.Skeleton=U.Skeleton;exports.Spinner=z.Spinner;exports.Cell=o.Cell;exports.Column=o.Column;exports.Row=o.Row;exports.Table=o.Table;exports.TableBody=o.TableBody;exports.TableHeader=o.TableHeader;exports.Tab=a.Tab;exports.TabList=a.TabList;exports.TabPanel=a.TabPanel;exports.Tabs=a.Tabs;exports.Tag=p.Tag;exports.TagGroup=p.TagGroup;exports.Text=J.Text;exports.Input=n.Input;exports.TextArea=n.TextArea;exports.TextField=n.TextField;exports.TextFieldBase=n.TextFieldBase;exports.GlobalToastRegion=r.GlobalToastRegion;exports.Toast=r.Toast;exports.ToastProvider=r.ToastProvider;exports.ToastRegion=r.ToastRegion;exports.toastQueue=r.toastQueue;exports.useToastState=r.useToastState;exports.ToggleButton=q.ToggleButton;exports.ToggleButtonGroup=q.ToggleButtonGroup;exports.Tooltip=x.Tooltip;exports.TooltipTrigger=x.TooltipTrigger;exports.ListBox=K.ListBox;exports.ListBoxButton=L.ListBoxButton;exports.ListBoxLoadMoreItem=L.ListBoxLoadMoreItem;exports.ListBoxHeader=c.ListBoxHeader;exports.ListBoxItem=c.ListBoxItem;exports.ListBoxPopover=c.ListBoxPopover;exports.ListBoxSection=c.ListBoxSection;exports.Menu=i.Menu;exports.MenuItem=i.MenuItem;exports.MenuPopover=i.MenuPopover;exports.MenuSection=i.MenuSection;exports.Separator=i.Separator;exports.RouterProvider=V.$ea8dcbcb9ea1b556$export$323e4fc2fa4753fb;exports.DialogTrigger=S.$de32f1b87079253c$export$2e1e1122cf0cba88;exports.MenuTrigger=S.$3674c52c6b3c5bce$export$27d2ad3c5815583e;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as r, A as e } from "./AccordionItem-
|
|
1
|
+
import { a as r, A as e } from "./AccordionItem-8UtB6O1X.js";
|
|
2
2
|
import { B as s, a as p } from "./BadgeContainer-DilMiV6u.js";
|
|
3
3
|
import { B as m } from "./Breadcrumbs-BenPNv8Z.js";
|
|
4
4
|
import { B as i } from "./Button-DdXFHfXw.js";
|
package/package.json
CHANGED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import { jsx as u, jsxs as A } from "react/jsx-runtime";
|
|
2
|
-
import { c as y } from "./clsx-jbLnTBqA.js";
|
|
3
|
-
import { i as z } from "./icon-map-uS87FT_Q.js";
|
|
4
|
-
import h, { useRef as K, useCallback as g, useEffect as E, useMemo as N, forwardRef as P, createContext as x, useContext as v } from "react";
|
|
5
|
-
import { e as S } from "./Button-BbfVT9Yl.js";
|
|
6
|
-
import { $ as G, a as w, f as B, g as q, h as O } from "./utils-D2iKpxcZ.js";
|
|
7
|
-
import { c as _, $ as J, a as M } from "./mergeProps-Ct8m5-xW.js";
|
|
8
|
-
import { $ as C } from "./filterDOMProps-wsa9OcNI.js";
|
|
9
|
-
import { $ as R } from "./useControlledState-u436Wbp1.js";
|
|
10
|
-
import { flushSync as L } from "react-dom";
|
|
11
|
-
import { $ as Q } from "./useEvent-smuTnX4G.js";
|
|
12
|
-
import { $ as U } from "./SSRProvider-D8lZ0o6A.js";
|
|
13
|
-
import { $ as F } from "./useFocusRing-CcxI7nbg.js";
|
|
14
|
-
import { B as X } from "./Button-DdXFHfXw.js";
|
|
15
|
-
import { H as Y } from "./Heading-CCoGfKQ8.js";
|
|
16
|
-
import { C as Z } from "./chevron-down-DmZMdOiC.js";
|
|
17
|
-
import './assets/AccordionItem.css';const ee = "_root_17bdp_1", te = "_contained_17bdp_5", b = {
|
|
18
|
-
root: ee,
|
|
19
|
-
contained: te
|
|
20
|
-
};
|
|
21
|
-
function ne(d, e, a) {
|
|
22
|
-
let { isDisabled: n } = d, s = _(), i = _(), o = U(), l = K(null), r = g(() => {
|
|
23
|
-
l.current = requestAnimationFrame(() => {
|
|
24
|
-
a.current && a.current.setAttribute("hidden", "until-found");
|
|
25
|
-
}), L(() => {
|
|
26
|
-
e.toggle();
|
|
27
|
-
});
|
|
28
|
-
}, [
|
|
29
|
-
a,
|
|
30
|
-
e
|
|
31
|
-
]);
|
|
32
|
-
Q(a, "beforematch", r);
|
|
33
|
-
let c = K(null);
|
|
34
|
-
return J(() => {
|
|
35
|
-
if (l.current && cancelAnimationFrame(l.current), a.current && !n && !o) {
|
|
36
|
-
let t = a.current;
|
|
37
|
-
c.current == null || typeof t.getAnimations != "function" ? e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto")) : (t.setAttribute("hidden", "until-found"), t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px")) : e.isExpanded !== c.current && (e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => {
|
|
38
|
-
t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto");
|
|
39
|
-
}).catch(() => {
|
|
40
|
-
})) : (t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), window.getComputedStyle(t).height, t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => t.setAttribute("hidden", "until-found")).catch(() => {
|
|
41
|
-
}))), c.current = e.isExpanded;
|
|
42
|
-
}
|
|
43
|
-
}, [
|
|
44
|
-
n,
|
|
45
|
-
a,
|
|
46
|
-
e.isExpanded,
|
|
47
|
-
o
|
|
48
|
-
]), E(() => () => {
|
|
49
|
-
l.current && cancelAnimationFrame(l.current);
|
|
50
|
-
}, []), {
|
|
51
|
-
buttonProps: {
|
|
52
|
-
id: s,
|
|
53
|
-
"aria-expanded": e.isExpanded,
|
|
54
|
-
"aria-controls": i,
|
|
55
|
-
onPress: (t) => {
|
|
56
|
-
!n && t.pointerType !== "keyboard" && e.toggle();
|
|
57
|
-
},
|
|
58
|
-
isDisabled: n,
|
|
59
|
-
onPressStart(t) {
|
|
60
|
-
t.pointerType === "keyboard" && !n && e.toggle();
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
panelProps: {
|
|
64
|
-
id: i,
|
|
65
|
-
// This can be overridden at the panel element level.
|
|
66
|
-
role: "group",
|
|
67
|
-
"aria-labelledby": s,
|
|
68
|
-
"aria-hidden": !e.isExpanded,
|
|
69
|
-
hidden: o || n ? n || !e.isExpanded : void 0
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function ae(d) {
|
|
74
|
-
let [e, a] = R(d.isExpanded, d.defaultExpanded || !1, d.onExpandedChange);
|
|
75
|
-
const n = g(() => {
|
|
76
|
-
a(!0);
|
|
77
|
-
}, [
|
|
78
|
-
a
|
|
79
|
-
]), s = g(() => {
|
|
80
|
-
a(!1);
|
|
81
|
-
}, [
|
|
82
|
-
a
|
|
83
|
-
]), i = g(() => {
|
|
84
|
-
a(!e);
|
|
85
|
-
}, [
|
|
86
|
-
a,
|
|
87
|
-
e
|
|
88
|
-
]);
|
|
89
|
-
return {
|
|
90
|
-
isExpanded: e,
|
|
91
|
-
setExpanded: a,
|
|
92
|
-
expand: n,
|
|
93
|
-
collapse: s,
|
|
94
|
-
toggle: i
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function se(d) {
|
|
98
|
-
let { allowsMultipleExpanded: e = !1, isDisabled: a = !1 } = d, [n, s] = R(N(() => d.expandedKeys ? new Set(d.expandedKeys) : void 0, [
|
|
99
|
-
d.expandedKeys
|
|
100
|
-
]), N(() => d.defaultExpandedKeys ? new Set(d.defaultExpandedKeys) : /* @__PURE__ */ new Set(), [
|
|
101
|
-
d.defaultExpandedKeys
|
|
102
|
-
]), d.onExpandedChange);
|
|
103
|
-
return E(() => {
|
|
104
|
-
if (!e && n.size > 1) {
|
|
105
|
-
let i = n.values().next().value;
|
|
106
|
-
i != null && s(/* @__PURE__ */ new Set([
|
|
107
|
-
i
|
|
108
|
-
]));
|
|
109
|
-
}
|
|
110
|
-
}), {
|
|
111
|
-
allowsMultipleExpanded: e,
|
|
112
|
-
isDisabled: a,
|
|
113
|
-
expandedKeys: n,
|
|
114
|
-
setExpandedKeys: s,
|
|
115
|
-
toggleKey(i) {
|
|
116
|
-
let o;
|
|
117
|
-
e ? (o = new Set(n), o.has(i) ? o.delete(i) : o.add(i)) : o = new Set(n.has(i) ? [] : [
|
|
118
|
-
i
|
|
119
|
-
]), s(o);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
const W = /* @__PURE__ */ x(null), ie = /* @__PURE__ */ P(function(e, a) {
|
|
124
|
-
let n = se(e), s = w({
|
|
125
|
-
...e,
|
|
126
|
-
defaultClassName: "react-aria-DisclosureGroup",
|
|
127
|
-
values: {
|
|
128
|
-
isDisabled: n.isDisabled,
|
|
129
|
-
state: n
|
|
130
|
-
}
|
|
131
|
-
}), i = C(e, {
|
|
132
|
-
global: !0
|
|
133
|
-
});
|
|
134
|
-
return /* @__PURE__ */ h.createElement("div", {
|
|
135
|
-
...i,
|
|
136
|
-
...s,
|
|
137
|
-
ref: a,
|
|
138
|
-
"data-disabled": e.isDisabled || void 0
|
|
139
|
-
}, /* @__PURE__ */ h.createElement(W.Provider, {
|
|
140
|
-
value: n
|
|
141
|
-
}, s.children));
|
|
142
|
-
}), de = /* @__PURE__ */ x(null), oe = /* @__PURE__ */ x(null), T = /* @__PURE__ */ x(null), re = /* @__PURE__ */ P(function(e, a) {
|
|
143
|
-
[e, a] = G(e, a, de);
|
|
144
|
-
let n = v(W), { id: s, ...i } = e, o = _();
|
|
145
|
-
s || (s = o);
|
|
146
|
-
let l = n ? n.expandedKeys.has(s) : e.isExpanded, r = ae({
|
|
147
|
-
...e,
|
|
148
|
-
isExpanded: l,
|
|
149
|
-
onExpandedChange(j) {
|
|
150
|
-
var $;
|
|
151
|
-
n && n.toggleKey(s), ($ = e.onExpandedChange) === null || $ === void 0 || $.call(e, j);
|
|
152
|
-
}
|
|
153
|
-
}), c = h.useRef(null), t = e.isDisabled || (n == null ? void 0 : n.isDisabled) || !1, { buttonProps: p, panelProps: m } = ne({
|
|
154
|
-
...e,
|
|
155
|
-
isExpanded: l,
|
|
156
|
-
isDisabled: t
|
|
157
|
-
}, r, c), { isFocusVisible: D, focusProps: k } = F({
|
|
158
|
-
within: !0
|
|
159
|
-
}), I = w({
|
|
160
|
-
...e,
|
|
161
|
-
id: void 0,
|
|
162
|
-
defaultClassName: "react-aria-Disclosure",
|
|
163
|
-
values: {
|
|
164
|
-
isExpanded: r.isExpanded,
|
|
165
|
-
isDisabled: t,
|
|
166
|
-
isFocusVisibleWithin: D,
|
|
167
|
-
state: r
|
|
168
|
-
}
|
|
169
|
-
}), H = C(i, {
|
|
170
|
-
global: !0
|
|
171
|
-
});
|
|
172
|
-
return /* @__PURE__ */ h.createElement(B, {
|
|
173
|
-
values: [
|
|
174
|
-
[
|
|
175
|
-
S,
|
|
176
|
-
{
|
|
177
|
-
slots: {
|
|
178
|
-
[q]: {},
|
|
179
|
-
trigger: p
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
T,
|
|
185
|
-
{
|
|
186
|
-
panelProps: m,
|
|
187
|
-
panelRef: c
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
[
|
|
191
|
-
oe,
|
|
192
|
-
r
|
|
193
|
-
]
|
|
194
|
-
]
|
|
195
|
-
}, /* @__PURE__ */ h.createElement("div", {
|
|
196
|
-
...M(H, I, k),
|
|
197
|
-
ref: a,
|
|
198
|
-
"data-expanded": r.isExpanded || void 0,
|
|
199
|
-
"data-disabled": t || void 0,
|
|
200
|
-
"data-focus-visible-within": D || void 0
|
|
201
|
-
}, I.children));
|
|
202
|
-
}), le = /* @__PURE__ */ P(function(e, a) {
|
|
203
|
-
let { role: n = "group" } = e, { panelProps: s, panelRef: i } = v(T), { isFocusVisible: o, focusProps: l } = F({
|
|
204
|
-
within: !0
|
|
205
|
-
}), r = w({
|
|
206
|
-
...e,
|
|
207
|
-
defaultClassName: "react-aria-DisclosurePanel",
|
|
208
|
-
values: {
|
|
209
|
-
isFocusVisibleWithin: o
|
|
210
|
-
}
|
|
211
|
-
}), c = C(e, {
|
|
212
|
-
global: !0
|
|
213
|
-
});
|
|
214
|
-
return /* @__PURE__ */ h.createElement("div", {
|
|
215
|
-
...M(c, r, s, l),
|
|
216
|
-
ref: O(a, i),
|
|
217
|
-
role: n,
|
|
218
|
-
"data-focus-visible-within": o || void 0
|
|
219
|
-
}, /* @__PURE__ */ h.createElement(B, {
|
|
220
|
-
values: [
|
|
221
|
-
[
|
|
222
|
-
S,
|
|
223
|
-
null
|
|
224
|
-
]
|
|
225
|
-
]
|
|
226
|
-
}, e.children));
|
|
227
|
-
}), V = x(void 0), je = ({
|
|
228
|
-
variant: d,
|
|
229
|
-
children: e,
|
|
230
|
-
className: a,
|
|
231
|
-
isContained: n,
|
|
232
|
-
...s
|
|
233
|
-
}) => {
|
|
234
|
-
const i = n || d === "contained";
|
|
235
|
-
return /* @__PURE__ */ u(V.Provider, { value: { isContained: i }, children: /* @__PURE__ */ u(
|
|
236
|
-
ie,
|
|
237
|
-
{
|
|
238
|
-
className: y(
|
|
239
|
-
b.root,
|
|
240
|
-
i ? b.contained : b.uncontained,
|
|
241
|
-
a
|
|
242
|
-
),
|
|
243
|
-
...s,
|
|
244
|
-
children: e
|
|
245
|
-
}
|
|
246
|
-
) });
|
|
247
|
-
}, ce = "_item_1hy85_1", fe = "_contained_1hy85_18", ue = "_success_1hy85_29", pe = "_warning_1hy85_35", he = "_info_1hy85_41", xe = "_important_1hy85_47", ge = "_triggerButton_1hy85_58", me = "_triggerText_1hy85_62", $e = "_trigger_1hy85_58", be = "_triggerMainContent_1hy85_75", ye = "_chevronIcon_1hy85_92", _e = "_statusIcon_1hy85_98", Ee = "_panel_1hy85_116", Pe = "_content_1hy85_124", ve = "_hasBackground_1hy85_129", we = "_header_1hy85_133", f = {
|
|
248
|
-
item: ce,
|
|
249
|
-
contained: fe,
|
|
250
|
-
success: ue,
|
|
251
|
-
warning: pe,
|
|
252
|
-
info: he,
|
|
253
|
-
important: xe,
|
|
254
|
-
triggerButton: ge,
|
|
255
|
-
triggerText: me,
|
|
256
|
-
trigger: $e,
|
|
257
|
-
triggerMainContent: be,
|
|
258
|
-
" ": "_ _1hy85_1",
|
|
259
|
-
chevronIcon: ye,
|
|
260
|
-
statusIcon: _e,
|
|
261
|
-
panel: Ee,
|
|
262
|
-
content: Pe,
|
|
263
|
-
hasBackground: ve,
|
|
264
|
-
header: we
|
|
265
|
-
}, ze = ({
|
|
266
|
-
title: d,
|
|
267
|
-
children: e,
|
|
268
|
-
className: a,
|
|
269
|
-
headingLevel: n = "h2",
|
|
270
|
-
type: s,
|
|
271
|
-
hasBackground: i = !0,
|
|
272
|
-
isContained: o,
|
|
273
|
-
...l
|
|
274
|
-
}) => {
|
|
275
|
-
const r = v(V), c = o ?? (r == null ? void 0 : r.isContained) ?? !1, t = typeof d == "object";
|
|
276
|
-
E(() => {
|
|
277
|
-
s && !c && console.warn(
|
|
278
|
-
"AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency."
|
|
279
|
-
);
|
|
280
|
-
}, [s, c]);
|
|
281
|
-
const p = s ? z[s] : null, m = p ? /* @__PURE__ */ u(
|
|
282
|
-
p,
|
|
283
|
-
{
|
|
284
|
-
size: 20,
|
|
285
|
-
className: f.statusIcon
|
|
286
|
-
}
|
|
287
|
-
) : null;
|
|
288
|
-
return /* @__PURE__ */ A(
|
|
289
|
-
re,
|
|
290
|
-
{
|
|
291
|
-
...l,
|
|
292
|
-
className: y(
|
|
293
|
-
f.item,
|
|
294
|
-
s && f[s],
|
|
295
|
-
c && f.contained,
|
|
296
|
-
a
|
|
297
|
-
),
|
|
298
|
-
children: [
|
|
299
|
-
/* @__PURE__ */ u("div", { className: f.trigger, children: /* @__PURE__ */ A(
|
|
300
|
-
X,
|
|
301
|
-
{
|
|
302
|
-
className: f.triggerButton,
|
|
303
|
-
slot: "trigger",
|
|
304
|
-
variant: "icon",
|
|
305
|
-
children: [
|
|
306
|
-
/* @__PURE__ */ u(
|
|
307
|
-
Z,
|
|
308
|
-
{
|
|
309
|
-
size: 20,
|
|
310
|
-
className: f.chevronIcon
|
|
311
|
-
}
|
|
312
|
-
),
|
|
313
|
-
/* @__PURE__ */ u("div", { className: f.triggerMainContent, children: t ? d : /* @__PURE__ */ u(
|
|
314
|
-
Y,
|
|
315
|
-
{
|
|
316
|
-
level: 3,
|
|
317
|
-
elementType: n,
|
|
318
|
-
className: f.triggerText,
|
|
319
|
-
children: d
|
|
320
|
-
}
|
|
321
|
-
) }),
|
|
322
|
-
m
|
|
323
|
-
]
|
|
324
|
-
}
|
|
325
|
-
) }),
|
|
326
|
-
/* @__PURE__ */ u(le, { className: f.panel, children: /* @__PURE__ */ u(
|
|
327
|
-
"div",
|
|
328
|
-
{
|
|
329
|
-
className: y(
|
|
330
|
-
f.content,
|
|
331
|
-
i && f.hasBackground
|
|
332
|
-
),
|
|
333
|
-
children: e
|
|
334
|
-
}
|
|
335
|
-
) })
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
};
|
|
340
|
-
export {
|
|
341
|
-
ze as A,
|
|
342
|
-
je as a
|
|
343
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require('./assets/AccordionItem.css');const p=require("react/jsx-runtime"),_=require("./clsx-DKOfLqne.cjs"),K=require("./icon-map-9XcghDra.cjs"),d=require("react"),v=require("./Button-1sEX8jKn.cjs"),$=require("./utils-CtICjCYt.cjs"),h=require("./mergeProps-Du5A8xi8.cjs"),m=require("./filterDOMProps-RRlKPKX0.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),M=require("react-dom"),N=require("./useEvent-C125NAue.cjs"),j=require("./SSRProvider-DZRLwxPS.cjs"),w=require("./useFocusRing-C-XVcAE5.cjs"),B=require("./Button-BEWKXjlP.cjs"),F=require("./Heading-x7y3xadc.cjs"),W=require("./chevron-down-5hFlg_lR.cjs"),k="_root_17bdp_1",T="_contained_17bdp_5",y={root:k,contained:T};function V(o,e,s){let{isDisabled:n}=o,a=h.$bdb11010cef70236$export$f680877a34711e37(),i=h.$bdb11010cef70236$export$f680877a34711e37(),r=j.$b5e257d569688ac6$export$535bd6ca7f90a273(),l=d.useRef(null),c=d.useCallback(()=>{l.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found")}),M.flushSync(()=>{e.toggle()})},[s,e]);N.$e9faafb641e167db$export$90fc3a17d93f704c(s,"beforematch",c);let u=d.useRef(null);return h.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(l.current&&cancelAnimationFrame(l.current),s.current&&!n&&!r){let t=s.current;u.current==null||typeof t.getAnimations!="function"?e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")):(t.setAttribute("hidden","until-found"),t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px")):e.isExpanded!==u.current&&(e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),Promise.all(t.getAnimations().map(x=>x.finished)).then(()=>{t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")}).catch(()=>{})):(t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),window.getComputedStyle(t).height,t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px"),Promise.all(t.getAnimations().map(x=>x.finished)).then(()=>t.setAttribute("hidden","until-found")).catch(()=>{}))),u.current=e.isExpanded}},[n,s,e.isExpanded,r]),d.useEffect(()=>()=>{l.current&&cancelAnimationFrame(l.current)},[]),{buttonProps:{id:a,"aria-expanded":e.isExpanded,"aria-controls":i,onPress:t=>{!n&&t.pointerType!=="keyboard"&&e.toggle()},isDisabled:n,onPressStart(t){t.pointerType==="keyboard"&&!n&&e.toggle()}},panelProps:{id:i,role:"group","aria-labelledby":a,"aria-hidden":!e.isExpanded,hidden:r||n?n||!e.isExpanded:void 0}}}function H(o){let[e,s]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(o.isExpanded,o.defaultExpanded||!1,o.onExpandedChange);const n=d.useCallback(()=>{s(!0)},[s]),a=d.useCallback(()=>{s(!1)},[s]),i=d.useCallback(()=>{s(!e)},[s,e]);return{isExpanded:e,setExpanded:s,expand:n,collapse:a,toggle:i}}function z(o){let{allowsMultipleExpanded:e=!1,isDisabled:s=!1}=o,[n,a]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(d.useMemo(()=>o.expandedKeys?new Set(o.expandedKeys):void 0,[o.expandedKeys]),d.useMemo(()=>o.defaultExpandedKeys?new Set(o.defaultExpandedKeys):new Set,[o.defaultExpandedKeys]),o.onExpandedChange);return d.useEffect(()=>{if(!e&&n.size>1){let i=n.values().next().value;i!=null&&a(new Set([i]))}}),{allowsMultipleExpanded:e,isDisabled:s,expandedKeys:n,setExpandedKeys:a,toggleKey(i){let r;e?(r=new Set(n),r.has(i)?r.delete(i):r.add(i)):r=new Set(n.has(i)?[]:[i]),a(r)}}}const D=d.createContext(null),O=d.forwardRef(function(e,s){let n=z(e),a=$.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosureGroup",values:{isDisabled:n.isDisabled,state:n}}),i=m.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...i,...a,ref:s,"data-disabled":e.isDisabled||void 0},d.createElement(D.Provider,{value:n},a.children))}),G=d.createContext(null),J=d.createContext(null),A=d.createContext(null),L=d.forwardRef(function(e,s){[e,s]=$.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,G);let n=d.useContext(D),{id:a,...i}=e,r=h.$bdb11010cef70236$export$f680877a34711e37();a||(a=r);let l=n?n.expandedKeys.has(a):e.isExpanded,c=H({...e,isExpanded:l,onExpandedChange(S){var g;n&&n.toggleKey(a),(g=e.onExpandedChange)===null||g===void 0||g.call(e,S)}}),u=d.useRef(null),t=e.isDisabled||(n==null?void 0:n.isDisabled)||!1,{buttonProps:x,panelProps:b}=V({...e,isExpanded:l,isDisabled:t},c,u),{isFocusVisible:E,focusProps:R}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),P=$.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:c.isExpanded,isDisabled:t,isFocusVisibleWithin:E,state:c}}),q=m.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(i,{global:!0});return d.createElement($.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,{slots:{[$.$64fa3d84918910a7$export$c62b8e45d58ddad9]:{},trigger:x}}],[A,{panelProps:b,panelRef:u}],[J,c]]},d.createElement("div",{...h.$3ef42575df84b30b$export$9d1611c77c2fe928(q,P,R),ref:s,"data-expanded":c.isExpanded||void 0,"data-disabled":t||void 0,"data-focus-visible-within":E||void 0},P.children))}),Q=d.forwardRef(function(e,s){let{role:n="group"}=e,{panelProps:a,panelRef:i}=d.useContext(A),{isFocusVisible:r,focusProps:l}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),c=$.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:r}}),u=m.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...h.$3ef42575df84b30b$export$9d1611c77c2fe928(u,c,a,l),ref:$.$5dc95899b306f630$export$c9058316764c140e(s,i),role:n,"data-focus-visible-within":r||void 0},d.createElement($.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,null]]},e.children))}),I=d.createContext(void 0),U=({variant:o,children:e,className:s,isContained:n,...a})=>{const i=n||o==="contained";return p.jsx(I.Provider,{value:{isContained:i},children:p.jsx(O,{className:_.clsx(y.root,i?y.contained:y.uncontained,s),...a,children:e})})},X="_item_1hy85_1",Y="_contained_1hy85_18",Z="_success_1hy85_29",ee="_warning_1hy85_35",te="_info_1hy85_41",ne="_important_1hy85_47",se="_triggerButton_1hy85_58",de="_triggerText_1hy85_62",ae="_trigger_1hy85_58",ie="_triggerMainContent_1hy85_75",oe="_chevronIcon_1hy85_92",re="_statusIcon_1hy85_98",ce="_panel_1hy85_116",le="_content_1hy85_124",ue="_hasBackground_1hy85_129",fe="_header_1hy85_133",f={item:X,contained:Y,success:Z,warning:ee,info:te,important:ne,triggerButton:se,triggerText:de,trigger:ae,triggerMainContent:ie," ":"_ _1hy85_1",chevronIcon:oe,statusIcon:re,panel:ce,content:le,hasBackground:ue,header:fe},pe=({title:o,children:e,className:s,headingLevel:n="h2",type:a,hasBackground:i=!0,isContained:r,...l})=>{const c=d.useContext(I),u=r??(c==null?void 0:c.isContained)??!1,t=typeof o=="object";d.useEffect(()=>{a&&!u&&console.warn("AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency.")},[a,u]);const x=a?K.iconMap[a]:null,b=x?p.jsx(x,{size:20,className:f.statusIcon}):null;return p.jsxs(L,{...l,className:_.clsx(f.item,a&&f[a],u&&f.contained,s),children:[p.jsx("div",{className:f.trigger,children:p.jsxs(B.Button,{className:f.triggerButton,slot:"trigger",variant:"icon",children:[p.jsx(W.ChevronDown,{size:20,className:f.chevronIcon}),p.jsx("div",{className:f.triggerMainContent,children:t?o:p.jsx(F.Heading,{level:3,elementType:n,className:f.triggerText,children:o})}),b]})}),p.jsx(Q,{className:f.panel,children:p.jsx("div",{className:_.clsx(f.content,i&&f.hasBackground),children:e})})]})};exports.Accordion=U;exports.AccordionItem=pe;
|