@purpurds/accordion 5.25.0 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.txt +3 -3
- package/dist/accordion.cjs.js +5 -5
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.es.js +113 -129
- package/dist/accordion.es.js.map +1 -1
- package/package.json +5 -5
package/dist/accordion.es.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as o, jsxs as v } from "react/jsx-runtime";
|
2
|
-
import { useContext as
|
3
|
-
function
|
4
|
-
return
|
2
|
+
import { useContext as H, useId as M, useState as L, createContext as E } from "react";
|
3
|
+
function R(e) {
|
4
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
5
5
|
}
|
6
6
|
var $ = { exports: {} };
|
7
7
|
/*!
|
@@ -9,12 +9,12 @@ var $ = { exports: {} };
|
|
9
9
|
Licensed under the MIT License (MIT), see
|
10
10
|
http://jedwatson.github.io/classnames
|
11
11
|
*/
|
12
|
-
(function(
|
12
|
+
(function(e) {
|
13
13
|
(function() {
|
14
14
|
var n = {}.hasOwnProperty;
|
15
15
|
function p() {
|
16
|
-
for (var r = "",
|
17
|
-
var a = arguments[
|
16
|
+
for (var r = "", t = 0; t < arguments.length; t++) {
|
17
|
+
var a = arguments[t];
|
18
18
|
a && (r = i(r, u(a)));
|
19
19
|
}
|
20
20
|
return r;
|
@@ -28,19 +28,19 @@ var $ = { exports: {} };
|
|
28
28
|
return p.apply(null, r);
|
29
29
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
30
30
|
return r.toString();
|
31
|
-
var
|
31
|
+
var t = "";
|
32
32
|
for (var a in r)
|
33
|
-
n.call(r, a) && r[a] && (
|
34
|
-
return
|
33
|
+
n.call(r, a) && r[a] && (t = i(t, a));
|
34
|
+
return t;
|
35
35
|
}
|
36
|
-
function i(r,
|
37
|
-
return
|
36
|
+
function i(r, t) {
|
37
|
+
return t ? r ? r + " " + t : r + t : r;
|
38
38
|
}
|
39
|
-
|
39
|
+
e.exports ? (p.default = p, e.exports = p) : window.classNames = p;
|
40
40
|
})();
|
41
41
|
})($);
|
42
|
-
var
|
43
|
-
const B = /* @__PURE__ */
|
42
|
+
var z = $.exports;
|
43
|
+
const B = /* @__PURE__ */ R(z), g = {
|
44
44
|
"purpur-heading": "_purpur-heading_k9fhq_1",
|
45
45
|
"purpur-heading--hyphens": "_purpur-heading--hyphens_k9fhq_8",
|
46
46
|
"purpur-heading--negative": "_purpur-heading--negative_k9fhq_11",
|
@@ -56,52 +56,45 @@ const B = /* @__PURE__ */ C(D), g = {
|
|
56
56
|
"purpur-heading--display-50": "_purpur-heading--display-50_k9fhq_68",
|
57
57
|
"purpur-heading--display-100": "_purpur-heading--display-100_k9fhq_74",
|
58
58
|
"purpur-heading--display-200": "_purpur-heading--display-200_k9fhq_80"
|
59
|
-
},
|
60
|
-
TITLE100: "title-100"
|
61
|
-
TITLE200: "title-200",
|
62
|
-
TITLE300: "title-300",
|
63
|
-
TITLE400: "title-400",
|
64
|
-
TITLE500: "title-500",
|
65
|
-
TITLE600: "title-600",
|
66
|
-
TITLE700: "title-700",
|
67
|
-
SUBSECTION100: "subsection-100"
|
59
|
+
}, D = {
|
60
|
+
TITLE100: "title-100"
|
68
61
|
}, f = "purpur-heading", y = ({
|
69
|
-
["data-testid"]:
|
62
|
+
["data-testid"]: e,
|
70
63
|
children: n,
|
71
64
|
className: p = "",
|
72
65
|
enableHyphenation: u = !1,
|
73
66
|
negative: i = !1,
|
74
67
|
tag: r,
|
75
|
-
variant:
|
68
|
+
variant: t = D.TITLE100,
|
76
69
|
...a
|
77
70
|
}) => {
|
78
71
|
const s = r, c = B([
|
79
72
|
p,
|
80
73
|
g[f],
|
81
|
-
g[`${f}--${
|
74
|
+
g[`${f}--${t}`],
|
82
75
|
{
|
83
76
|
[g[`${f}--hyphens`]]: u,
|
84
77
|
[g[`${f}--negative`]]: i
|
85
78
|
}
|
86
79
|
]);
|
87
|
-
return /* @__PURE__ */ o(s, { ...a, className: c, "data-testid":
|
80
|
+
return /* @__PURE__ */ o(s, { ...a, className: c, "data-testid": e, children: n });
|
88
81
|
};
|
89
82
|
y.displayName = "Heading";
|
90
|
-
function
|
91
|
-
return
|
83
|
+
function G(e) {
|
84
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
92
85
|
}
|
93
|
-
var
|
86
|
+
var w = { exports: {} };
|
94
87
|
/*!
|
95
88
|
Copyright (c) 2018 Jed Watson.
|
96
89
|
Licensed under the MIT License (MIT), see
|
97
90
|
http://jedwatson.github.io/classnames
|
98
91
|
*/
|
99
|
-
(function(
|
92
|
+
(function(e) {
|
100
93
|
(function() {
|
101
94
|
var n = {}.hasOwnProperty;
|
102
95
|
function p() {
|
103
|
-
for (var r = "",
|
104
|
-
var a = arguments[
|
96
|
+
for (var r = "", t = 0; t < arguments.length; t++) {
|
97
|
+
var a = arguments[t];
|
105
98
|
a && (r = i(r, u.call(this, a)));
|
106
99
|
}
|
107
100
|
return r;
|
@@ -115,38 +108,38 @@ var A = { exports: {} };
|
|
115
108
|
return p.apply(this, r);
|
116
109
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
117
110
|
return r.toString();
|
118
|
-
var
|
111
|
+
var t = "";
|
119
112
|
for (var a in r)
|
120
|
-
n.call(r, a) && r[a] && (
|
121
|
-
return
|
113
|
+
n.call(r, a) && r[a] && (t = i(t, this && this[a] || a));
|
114
|
+
return t;
|
122
115
|
}
|
123
|
-
function i(r,
|
124
|
-
return
|
116
|
+
function i(r, t) {
|
117
|
+
return t ? r ? r + " " + t : r + t : r;
|
125
118
|
}
|
126
|
-
|
119
|
+
e.exports ? (p.default = p, e.exports = p) : window.classNames = p;
|
127
120
|
})();
|
128
|
-
})(
|
129
|
-
var
|
130
|
-
const N = /* @__PURE__ */ V
|
121
|
+
})(w);
|
122
|
+
var V = w.exports;
|
123
|
+
const N = /* @__PURE__ */ G(V), F = {
|
131
124
|
"purpur-accordion": "_purpur-accordion_u887g_1",
|
132
125
|
"purpur-accordion__title": "_purpur-accordion__title_u887g_4",
|
133
126
|
"purpur-accordion--negative": "_purpur-accordion--negative_u887g_13"
|
134
127
|
};
|
135
|
-
function
|
136
|
-
return
|
128
|
+
function J(e) {
|
129
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
137
130
|
}
|
138
|
-
var
|
131
|
+
var S = { exports: {} };
|
139
132
|
/*!
|
140
133
|
Copyright (c) 2018 Jed Watson.
|
141
134
|
Licensed under the MIT License (MIT), see
|
142
135
|
http://jedwatson.github.io/classnames
|
143
136
|
*/
|
144
|
-
(function(
|
137
|
+
(function(e) {
|
145
138
|
(function() {
|
146
139
|
var n = {}.hasOwnProperty;
|
147
140
|
function p() {
|
148
|
-
for (var r = "",
|
149
|
-
var a = arguments[
|
141
|
+
for (var r = "", t = 0; t < arguments.length; t++) {
|
142
|
+
var a = arguments[t];
|
150
143
|
a && (r = i(r, u.call(this, a)));
|
151
144
|
}
|
152
145
|
return r;
|
@@ -160,19 +153,19 @@ var w = { exports: {} };
|
|
160
153
|
return p.apply(this, r);
|
161
154
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
162
155
|
return r.toString();
|
163
|
-
var
|
156
|
+
var t = "";
|
164
157
|
for (var a in r)
|
165
|
-
n.call(r, a) && r[a] && (
|
166
|
-
return
|
158
|
+
n.call(r, a) && r[a] && (t = i(t, this && this[a] || a));
|
159
|
+
return t;
|
167
160
|
}
|
168
|
-
function i(r,
|
169
|
-
return
|
161
|
+
function i(r, t) {
|
162
|
+
return t ? r ? r + " " + t : r + t : r;
|
170
163
|
}
|
171
|
-
|
164
|
+
e.exports ? (p.default = p, e.exports = p) : window.classNames = p;
|
172
165
|
})();
|
173
|
-
})(
|
174
|
-
var
|
175
|
-
const
|
166
|
+
})(S);
|
167
|
+
var X = S.exports;
|
168
|
+
const Y = /* @__PURE__ */ J(X), Z = {
|
176
169
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
177
170
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
178
171
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
@@ -180,66 +173,66 @@ const X = /* @__PURE__ */ F(J), Y = {
|
|
180
173
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
181
174
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
182
175
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
183
|
-
},
|
176
|
+
}, K = {
|
184
177
|
name: "chevron-down",
|
185
178
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M20.136 7.864a.9.9 0 0 0-1.272 0L12 14.727 5.136 7.864a.9.9 0 0 0-1.272 1.272l7.5 7.5a.9.9 0 0 0 1.272 0l7.5-7.5a.9.9 0 0 0 0-1.272Z" clip-rule="evenodd"/></svg>',
|
186
179
|
keywords: ["chevron-down"],
|
187
180
|
category: "utility"
|
188
|
-
},
|
189
|
-
|
181
|
+
}, q = (e) => /* @__PURE__ */ o(
|
182
|
+
j,
|
190
183
|
{
|
191
|
-
...
|
192
|
-
svg:
|
184
|
+
...e,
|
185
|
+
svg: K
|
193
186
|
}
|
194
187
|
);
|
195
|
-
|
196
|
-
const
|
188
|
+
q.displayName = "IconChevronDown";
|
189
|
+
const Q = Y.bind(Z), b = "purpur-icon", U = "md", W = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), rr = ({ content: e = "", title: n } = {}) => {
|
197
190
|
const p = [
|
198
191
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
199
192
|
{ name: "fill", value: "currentColor" },
|
200
193
|
{ name: "viewBox", value: "0 0 24 24" },
|
201
194
|
n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
202
195
|
], u = n ? `<title>${n}</title>` : "";
|
203
|
-
return `<svg ${W(p)}>${u}${
|
204
|
-
},
|
205
|
-
["data-testid"]:
|
196
|
+
return `<svg ${W(p)}>${u}${e}</svg>`;
|
197
|
+
}, tr = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), j = ({
|
198
|
+
["data-testid"]: e,
|
206
199
|
svg: n,
|
207
200
|
allyTitle: p,
|
208
201
|
className: u,
|
209
|
-
size: i =
|
202
|
+
size: i = U,
|
210
203
|
...r
|
211
204
|
}) => {
|
212
|
-
const
|
213
|
-
content:
|
205
|
+
const t = rr({
|
206
|
+
content: tr(n.svg),
|
214
207
|
title: p
|
215
|
-
}), a =
|
208
|
+
}), a = Q(u, b, `${b}--${i}`);
|
216
209
|
return /* @__PURE__ */ o(
|
217
210
|
"span",
|
218
211
|
{
|
219
212
|
"aria-label": p,
|
220
213
|
className: a,
|
221
|
-
"data-testid":
|
222
|
-
dangerouslySetInnerHTML: { __html:
|
214
|
+
"data-testid": e,
|
215
|
+
dangerouslySetInnerHTML: { __html: t },
|
223
216
|
...r
|
224
217
|
}
|
225
218
|
);
|
226
219
|
};
|
227
|
-
|
228
|
-
function
|
229
|
-
return
|
220
|
+
j.displayName = "Icon";
|
221
|
+
function er(e) {
|
222
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
230
223
|
}
|
231
|
-
var
|
224
|
+
var A = { exports: {} };
|
232
225
|
/*!
|
233
226
|
Copyright (c) 2018 Jed Watson.
|
234
227
|
Licensed under the MIT License (MIT), see
|
235
228
|
http://jedwatson.github.io/classnames
|
236
229
|
*/
|
237
|
-
(function(
|
230
|
+
(function(e) {
|
238
231
|
(function() {
|
239
232
|
var n = {}.hasOwnProperty;
|
240
233
|
function p() {
|
241
|
-
for (var r = "",
|
242
|
-
var a = arguments[
|
234
|
+
for (var r = "", t = 0; t < arguments.length; t++) {
|
235
|
+
var a = arguments[t];
|
243
236
|
a && (r = i(r, u(a)));
|
244
237
|
}
|
245
238
|
return r;
|
@@ -253,19 +246,19 @@ var I = { exports: {} };
|
|
253
246
|
return p.apply(null, r);
|
254
247
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
255
248
|
return r.toString();
|
256
|
-
var
|
249
|
+
var t = "";
|
257
250
|
for (var a in r)
|
258
|
-
n.call(r, a) && r[a] && (
|
259
|
-
return
|
251
|
+
n.call(r, a) && r[a] && (t = i(t, a));
|
252
|
+
return t;
|
260
253
|
}
|
261
|
-
function i(r,
|
262
|
-
return
|
254
|
+
function i(r, t) {
|
255
|
+
return t ? r ? r + " " + t : r + t : r;
|
263
256
|
}
|
264
|
-
|
257
|
+
e.exports ? (p.default = p, e.exports = p) : window.classNames = p;
|
265
258
|
})();
|
266
|
-
})(
|
267
|
-
var ar =
|
268
|
-
const pr = /* @__PURE__ */
|
259
|
+
})(A);
|
260
|
+
var ar = A.exports;
|
261
|
+
const pr = /* @__PURE__ */ er(ar), l = {
|
269
262
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
270
263
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
271
264
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
@@ -281,37 +274,28 @@ const pr = /* @__PURE__ */ tr(ar), _ = {
|
|
281
274
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
282
275
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
283
276
|
}, nr = {
|
284
|
-
PARAGRAPH100: "paragraph-100"
|
285
|
-
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
286
|
-
PARAGRAPH100BOLD: "paragraph-100-bold",
|
287
|
-
PARAGRAPH200: "paragraph-200",
|
288
|
-
PREAMBLE100: "preamble-100",
|
289
|
-
PREAMBLE200: "preamble-200",
|
290
|
-
ADDITIONAL100: "additional-100",
|
291
|
-
ADDITIONAL100MEDIUM: "additional-100-medium",
|
292
|
-
OVERLINE100: "overline-100",
|
293
|
-
OVERLINE200: "overline-200"
|
277
|
+
PARAGRAPH100: "paragraph-100"
|
294
278
|
}, h = "purpur-paragraph", O = ({
|
295
|
-
["data-testid"]:
|
279
|
+
["data-testid"]: e,
|
296
280
|
children: n,
|
297
281
|
className: p,
|
298
282
|
disabled: u,
|
299
283
|
enableHyphenation: i = !1,
|
300
284
|
negative: r = !1,
|
301
|
-
variant:
|
285
|
+
variant: t = nr.PARAGRAPH100,
|
302
286
|
...a
|
303
287
|
}) => {
|
304
288
|
const s = pr([
|
305
289
|
p,
|
306
|
-
|
307
|
-
|
290
|
+
l[h],
|
291
|
+
l[`${h}--${t}`],
|
308
292
|
{
|
309
|
-
[
|
310
|
-
[
|
311
|
-
[
|
293
|
+
[l[`${h}--hyphens`]]: i,
|
294
|
+
[l[`${h}--disabled`]]: u,
|
295
|
+
[l[`${h}--negative`]]: r
|
312
296
|
}
|
313
297
|
]);
|
314
|
-
return /* @__PURE__ */ o("p", { ...a, className: s, "data-testid":
|
298
|
+
return /* @__PURE__ */ o("p", { ...a, className: s, "data-testid": e, children: n });
|
315
299
|
};
|
316
300
|
O.displayName = "Paragraph";
|
317
301
|
const ir = {
|
@@ -325,46 +309,46 @@ const ir = {
|
|
325
309
|
"purpur-accordion-item__content": "_purpur-accordion-item__content_29ds4_66",
|
326
310
|
"purpur-accordion-item__contentText": "_purpur-accordion-item__contentText_29ds4_79",
|
327
311
|
"purpur-accordion-item--negative": "_purpur-accordion-item--negative_29ds4_98"
|
328
|
-
}, d = N.bind(ir),
|
329
|
-
children:
|
312
|
+
}, d = N.bind(ir), _ = "purpur-accordion-item", ur = ({
|
313
|
+
children: e,
|
330
314
|
className: n,
|
331
315
|
title: p,
|
332
316
|
titleTag: u = "h3",
|
333
317
|
initialOpen: i = !1,
|
334
318
|
onClick: r,
|
335
|
-
...
|
319
|
+
...t
|
336
320
|
}) => {
|
337
|
-
const a = k
|
321
|
+
const a = H(k), s = M(), [c, T] = L(!i), I = d([
|
338
322
|
n,
|
339
|
-
|
323
|
+
_,
|
340
324
|
{
|
341
|
-
[`${
|
325
|
+
[`${_}--negative`]: a
|
342
326
|
}
|
343
327
|
]);
|
344
|
-
return /* @__PURE__ */ v("div", { className:
|
328
|
+
return /* @__PURE__ */ v("div", { className: I, ...t, children: [
|
345
329
|
/* @__PURE__ */ o(
|
346
330
|
y,
|
347
331
|
{
|
348
332
|
tag: u,
|
349
333
|
variant: "title-100",
|
350
|
-
className: d([`${
|
334
|
+
className: d([`${_}__header`, `${_}__title`]),
|
351
335
|
children: /* @__PURE__ */ v(
|
352
336
|
"button",
|
353
337
|
{
|
354
338
|
type: "button",
|
355
339
|
"data-state": c ? "open" : "close",
|
356
|
-
onClick: (
|
357
|
-
r && r(
|
340
|
+
onClick: (C) => {
|
341
|
+
r && r(C), T(!c);
|
358
342
|
},
|
359
|
-
className: d(`${
|
360
|
-
[`${
|
343
|
+
className: d(`${_}__trigger`, n, {
|
344
|
+
[`${_}__rotate`]: !c
|
361
345
|
}),
|
362
346
|
"aria-expanded": !c,
|
363
347
|
"aria-controls": s,
|
364
348
|
id: s + "button",
|
365
349
|
children: [
|
366
350
|
p,
|
367
|
-
/* @__PURE__ */ o(
|
351
|
+
/* @__PURE__ */ o(q, { size: "md", className: d(`${_}__icon`), "aria-hidden": !0 })
|
368
352
|
]
|
369
353
|
}
|
370
354
|
)
|
@@ -373,23 +357,23 @@ const ir = {
|
|
373
357
|
/* @__PURE__ */ o(
|
374
358
|
"div",
|
375
359
|
{
|
376
|
-
className: d(`${
|
360
|
+
className: d(`${_}__content`, n),
|
377
361
|
"aria-hidden": c,
|
378
362
|
id: s,
|
379
363
|
"aria-labelledby": s + "button",
|
380
364
|
role: "region",
|
381
|
-
children: /* @__PURE__ */ o("div", { className: d(`${
|
365
|
+
children: /* @__PURE__ */ o("div", { className: d(`${_}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ o(O, { variant: "paragraph-200", children: e }) : e })
|
382
366
|
}
|
383
367
|
)
|
384
368
|
] });
|
385
|
-
}, x = N.bind(
|
386
|
-
["data-testid"]:
|
369
|
+
}, x = N.bind(F), m = "purpur-accordion", k = E(!1), P = ({
|
370
|
+
["data-testid"]: e,
|
387
371
|
children: n,
|
388
372
|
className: p,
|
389
373
|
negative: u = !1,
|
390
374
|
title: i,
|
391
375
|
titleTag: r = "h2",
|
392
|
-
titleVariant:
|
376
|
+
titleVariant: t = "title-300",
|
393
377
|
schema: a,
|
394
378
|
...s
|
395
379
|
}) => {
|
@@ -400,9 +384,9 @@ const ir = {
|
|
400
384
|
[`${m}--negative`]: u
|
401
385
|
}
|
402
386
|
]);
|
403
|
-
return /* @__PURE__ */ v("div", { className: c, "data-testid":
|
404
|
-
i && /* @__PURE__ */ o(y, { tag: r, variant:
|
405
|
-
/* @__PURE__ */ o(
|
387
|
+
return /* @__PURE__ */ v("div", { className: c, "data-testid": e, ...s, children: [
|
388
|
+
i && /* @__PURE__ */ o(y, { tag: r, variant: t, className: x(`${m}__title`), children: i }),
|
389
|
+
/* @__PURE__ */ o(k.Provider, { value: u, children: n }),
|
406
390
|
a && /* @__PURE__ */ o(
|
407
391
|
"script",
|
408
392
|
{
|
@@ -418,6 +402,6 @@ P.Item = ur;
|
|
418
402
|
P.displayName = "Accordion";
|
419
403
|
export {
|
420
404
|
P as Accordion,
|
421
|
-
|
405
|
+
k as NegativeContext
|
422
406
|
};
|
423
407
|
//# sourceMappingURL=accordion.es.js.map
|