beth-clarity 1.1.0 → 1.1.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as t, jsxs as C, Fragment as
|
|
2
|
-
import O, { useState as T, useRef as
|
|
1
|
+
import { jsx as t, jsxs as C, Fragment as Me } from "react/jsx-runtime";
|
|
2
|
+
import O, { useState as T, useRef as M, useEffect as D, forwardRef as Ve, isValidElement as X, createContext as q, cloneElement as W, useContext as G, useMemo as te, useCallback as ae, useLayoutEffect as We } from "react";
|
|
3
3
|
import Fe from "react-dom";
|
|
4
4
|
const dt = ({
|
|
5
5
|
variant: e = "primary",
|
|
@@ -7,25 +7,25 @@ const dt = ({
|
|
|
7
7
|
tone: l,
|
|
8
8
|
size: a = "medium",
|
|
9
9
|
bgColor: i,
|
|
10
|
-
textColor:
|
|
10
|
+
textColor: n,
|
|
11
11
|
children: c,
|
|
12
12
|
className: f = "",
|
|
13
|
-
rounded:
|
|
14
|
-
outlined:
|
|
13
|
+
rounded: r = !1,
|
|
14
|
+
outlined: u = !1,
|
|
15
15
|
...p
|
|
16
16
|
}) => {
|
|
17
|
-
const y = "clarity-badge",
|
|
17
|
+
const y = "clarity-badge", m = !!i, d = s && l && !m;
|
|
18
18
|
let o = "";
|
|
19
|
-
|
|
19
|
+
m ? o = `${y}--custom-bg` : d ? o = `${y}--custom` : o = `${y}--${e}`;
|
|
20
20
|
const N = [
|
|
21
21
|
y,
|
|
22
22
|
o,
|
|
23
23
|
`${y}--${a}`,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
r ? `${y}--rounded` : "",
|
|
25
|
+
u ? `${y}--outlined` : "",
|
|
26
26
|
f
|
|
27
27
|
].filter(Boolean).join(" "), v = {};
|
|
28
|
-
|
|
28
|
+
m && (v.backgroundColor = i, n && (v.color = n));
|
|
29
29
|
const b = d && s && l ? {
|
|
30
30
|
"--custom-bg-color": `var(--clarity-${s}-${l})`,
|
|
31
31
|
"--custom-text-color": l && parseInt(l) >= 500 ? "white" : `var(--clarity-${s}-800)`
|
|
@@ -48,21 +48,21 @@ const dt = ({
|
|
|
48
48
|
tone: l,
|
|
49
49
|
hoverTone: a,
|
|
50
50
|
size: i = "medium",
|
|
51
|
-
disabled:
|
|
51
|
+
disabled: n = !1,
|
|
52
52
|
loading: c = !1,
|
|
53
53
|
children: f,
|
|
54
|
-
onClick:
|
|
55
|
-
type:
|
|
54
|
+
onClick: r,
|
|
55
|
+
type: u = "button",
|
|
56
56
|
className: p = "",
|
|
57
57
|
title: y,
|
|
58
|
-
...
|
|
58
|
+
...m
|
|
59
59
|
}) => {
|
|
60
60
|
const d = "clarity-button", o = s && l, N = o ? `${d}--custom` : `${d}--${e}`, v = [
|
|
61
61
|
d,
|
|
62
62
|
N,
|
|
63
63
|
`${d}--${i}`,
|
|
64
64
|
c && `${d}--loading`,
|
|
65
|
-
|
|
65
|
+
n && `${d}--disabled`,
|
|
66
66
|
p
|
|
67
67
|
].filter(Boolean).join(" "), b = (j) => {
|
|
68
68
|
const g = parseInt(j);
|
|
@@ -76,11 +76,11 @@ const dt = ({
|
|
|
76
76
|
{
|
|
77
77
|
className: v,
|
|
78
78
|
style: w,
|
|
79
|
-
disabled:
|
|
80
|
-
onClick:
|
|
81
|
-
type:
|
|
79
|
+
disabled: n || c,
|
|
80
|
+
onClick: r,
|
|
81
|
+
type: u,
|
|
82
82
|
title: y,
|
|
83
|
-
...
|
|
83
|
+
...m,
|
|
84
84
|
children: [
|
|
85
85
|
c && /* @__PURE__ */ t("div", { className: `${d}__spinner` }),
|
|
86
86
|
f
|
|
@@ -93,40 +93,41 @@ const dt = ({
|
|
|
93
93
|
label: l,
|
|
94
94
|
helperText: a,
|
|
95
95
|
error: i = !1,
|
|
96
|
-
errorMessage:
|
|
96
|
+
errorMessage: n,
|
|
97
97
|
startIcon: c,
|
|
98
98
|
endIcon: f,
|
|
99
|
-
className:
|
|
100
|
-
disabled:
|
|
99
|
+
className: r = "",
|
|
100
|
+
disabled: u = !1,
|
|
101
101
|
value: p,
|
|
102
102
|
defaultValue: y,
|
|
103
|
-
onFocus:
|
|
103
|
+
onFocus: m,
|
|
104
104
|
onBlur: d,
|
|
105
105
|
...o
|
|
106
106
|
}, N) => {
|
|
107
|
-
const [v, b] = T(!1), [w, j] = T(!1), g =
|
|
107
|
+
const [v, b] = T(!1), [w, j] = T(!1), g = M(null);
|
|
108
108
|
O.useImperativeHandle(N, () => g.current), D(() => {
|
|
109
109
|
const x = g.current;
|
|
110
110
|
x && j(x.value.length > 0);
|
|
111
111
|
}, [p, y]);
|
|
112
112
|
const _ = (x) => {
|
|
113
|
-
b(!0),
|
|
113
|
+
b(!0), m == null || m(x);
|
|
114
114
|
}, k = (x) => {
|
|
115
115
|
b(!1), j(x.target.value.length > 0), d == null || d(x);
|
|
116
|
-
},
|
|
116
|
+
}, L = [
|
|
117
117
|
"clarity-input",
|
|
118
118
|
"clarity-input--outlined",
|
|
119
119
|
`clarity-input--${s}`,
|
|
120
120
|
e && `clarity-input--${e}`,
|
|
121
121
|
i && "clarity-input--error",
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
u && "clarity-input--disabled",
|
|
123
|
+
v && "clarity-input--focused",
|
|
124
|
+
w && "clarity-input--has-value",
|
|
124
125
|
c && "clarity-input--with-start-icon",
|
|
125
126
|
f && "clarity-input--with-end-icon",
|
|
126
|
-
|
|
127
|
+
r
|
|
127
128
|
].filter(Boolean).join(" ");
|
|
128
129
|
return /* @__PURE__ */ C("div", { className: "clarity-input-wrapper", children: [
|
|
129
|
-
/* @__PURE__ */ C("div", { className:
|
|
130
|
+
/* @__PURE__ */ C("div", { className: L, children: [
|
|
130
131
|
c && /* @__PURE__ */ t("div", { className: "clarity-input__start-icon", children: c }),
|
|
131
132
|
/* @__PURE__ */ C("div", { className: "clarity-input__field", children: [
|
|
132
133
|
/* @__PURE__ */ t(
|
|
@@ -134,7 +135,7 @@ const dt = ({
|
|
|
134
135
|
{
|
|
135
136
|
ref: g,
|
|
136
137
|
className: "clarity-input__element",
|
|
137
|
-
disabled:
|
|
138
|
+
disabled: u,
|
|
138
139
|
value: p,
|
|
139
140
|
defaultValue: y,
|
|
140
141
|
onFocus: _,
|
|
@@ -146,7 +147,7 @@ const dt = ({
|
|
|
146
147
|
] }),
|
|
147
148
|
f && /* @__PURE__ */ t("div", { className: "clarity-input__end-icon", children: f })
|
|
148
149
|
] }),
|
|
149
|
-
(a || i &&
|
|
150
|
+
(a || i && n) && /* @__PURE__ */ t("div", { className: "clarity-input__helper-text", children: i && n ? n : a })
|
|
150
151
|
] });
|
|
151
152
|
});
|
|
152
153
|
Ue.displayName = "Input";
|
|
@@ -156,14 +157,14 @@ const ze = O.forwardRef(({
|
|
|
156
157
|
label: l,
|
|
157
158
|
helperText: a,
|
|
158
159
|
error: i = !1,
|
|
159
|
-
errorMessage:
|
|
160
|
+
errorMessage: n,
|
|
160
161
|
startIcon: c,
|
|
161
162
|
endIcon: f,
|
|
162
|
-
className:
|
|
163
|
-
disabled:
|
|
163
|
+
className: r = "",
|
|
164
|
+
disabled: u = !1,
|
|
164
165
|
value: p,
|
|
165
166
|
defaultValue: y,
|
|
166
|
-
onFocus:
|
|
167
|
+
onFocus: m,
|
|
167
168
|
onBlur: d,
|
|
168
169
|
rows: o = 3,
|
|
169
170
|
minHeight: N,
|
|
@@ -171,27 +172,28 @@ const ze = O.forwardRef(({
|
|
|
171
172
|
resizable: b = !0,
|
|
172
173
|
...w
|
|
173
174
|
}, j) => {
|
|
174
|
-
const [g, _] = T(!1), [k,
|
|
175
|
+
const [g, _] = T(!1), [k, L] = T(!1), x = M(null);
|
|
175
176
|
O.useImperativeHandle(j, () => x.current), D(() => {
|
|
176
177
|
const $ = x.current;
|
|
177
|
-
$ &&
|
|
178
|
+
$ && L($.value.length > 0);
|
|
178
179
|
}, [p, y]);
|
|
179
180
|
const B = ($) => {
|
|
180
|
-
_(!0),
|
|
181
|
+
_(!0), m == null || m($);
|
|
181
182
|
}, I = ($) => {
|
|
182
|
-
_(!1),
|
|
183
|
+
_(!1), L($.target.value.length > 0), d == null || d($);
|
|
183
184
|
}, A = [
|
|
184
185
|
"clarity-textarea",
|
|
185
186
|
"clarity-textarea--outlined",
|
|
186
187
|
`clarity-textarea--${s}`,
|
|
187
188
|
e && `clarity-textarea--${e}`,
|
|
188
189
|
i && "clarity-textarea--error",
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
u && "clarity-textarea--disabled",
|
|
191
|
+
g && "clarity-textarea--focused",
|
|
192
|
+
k && "clarity-textarea--has-value",
|
|
191
193
|
c && "clarity-textarea--with-start-icon",
|
|
192
194
|
f && "clarity-textarea--with-end-icon",
|
|
193
|
-
|
|
194
|
-
].filter(Boolean).join(" "),
|
|
195
|
+
r
|
|
196
|
+
].filter(Boolean).join(" "), E = {
|
|
195
197
|
resize: b ? "vertical" : "none",
|
|
196
198
|
minHeight: N ? `${N}px` : void 0,
|
|
197
199
|
maxHeight: v ? `${v}px` : void 0
|
|
@@ -205,13 +207,13 @@ const ze = O.forwardRef(({
|
|
|
205
207
|
{
|
|
206
208
|
ref: x,
|
|
207
209
|
className: "clarity-textarea__element",
|
|
208
|
-
disabled:
|
|
210
|
+
disabled: u,
|
|
209
211
|
value: p,
|
|
210
212
|
defaultValue: y,
|
|
211
213
|
onFocus: B,
|
|
212
214
|
onBlur: I,
|
|
213
215
|
rows: o,
|
|
214
|
-
style:
|
|
216
|
+
style: E,
|
|
215
217
|
...w
|
|
216
218
|
}
|
|
217
219
|
),
|
|
@@ -219,7 +221,7 @@ const ze = O.forwardRef(({
|
|
|
219
221
|
] }),
|
|
220
222
|
f && /* @__PURE__ */ t("div", { className: "clarity-textarea__end-icon", children: f })
|
|
221
223
|
] }),
|
|
222
|
-
(a || i &&
|
|
224
|
+
(a || i && n) && /* @__PURE__ */ t("div", { className: "clarity-textarea__helper-text", children: i && n ? n : a })
|
|
223
225
|
] });
|
|
224
226
|
});
|
|
225
227
|
ze.displayName = "Textarea";
|
|
@@ -229,14 +231,14 @@ const qe = O.forwardRef(({
|
|
|
229
231
|
label: l,
|
|
230
232
|
helperText: a,
|
|
231
233
|
error: i = !1,
|
|
232
|
-
errorMessage:
|
|
234
|
+
errorMessage: n,
|
|
233
235
|
startIcon: c,
|
|
234
236
|
endIcon: f,
|
|
235
|
-
className:
|
|
236
|
-
disabled:
|
|
237
|
+
className: r = "",
|
|
238
|
+
disabled: u = !1,
|
|
237
239
|
value: p,
|
|
238
240
|
defaultValue: y,
|
|
239
|
-
onFocus:
|
|
241
|
+
onFocus: m,
|
|
240
242
|
onBlur: d,
|
|
241
243
|
onChange: o,
|
|
242
244
|
options: N,
|
|
@@ -245,7 +247,7 @@ const qe = O.forwardRef(({
|
|
|
245
247
|
isSearchable: w = !1,
|
|
246
248
|
...j
|
|
247
249
|
}, g) => {
|
|
248
|
-
const [_, k] = T(!1), [
|
|
250
|
+
const [_, k] = T(!1), [L, x] = T(!1), [B, I] = T(p || y || ""), [A, E] = T(""), $ = M(null), V = M(null);
|
|
249
251
|
O.useImperativeHandle(g, () => $.current), D(() => {
|
|
250
252
|
p !== void 0 && I(p);
|
|
251
253
|
}, [p]), D(() => {
|
|
@@ -257,44 +259,44 @@ const qe = O.forwardRef(({
|
|
|
257
259
|
const H = w && A ? N.filter(
|
|
258
260
|
(h) => h.label.toLowerCase().includes(A.toLowerCase())
|
|
259
261
|
) : N, F = () => {
|
|
260
|
-
|
|
262
|
+
u || (k(!_), x(!_), _ ? (d == null || d(), w && E("")) : (m == null || m(), w && setTimeout(() => {
|
|
261
263
|
var h;
|
|
262
|
-
(h =
|
|
264
|
+
(h = V.current) == null || h.focus();
|
|
263
265
|
}, 0)));
|
|
264
266
|
}, Q = (h) => {
|
|
265
|
-
h.disabled || (I(h.value), k(!1), x(!1),
|
|
267
|
+
h.disabled || (I(h.value), k(!1), x(!1), E(""), o == null || o(h.value), d == null || d());
|
|
266
268
|
}, K = (h) => {
|
|
267
|
-
|
|
269
|
+
E(h.target.value);
|
|
268
270
|
}, U = (h) => {
|
|
269
|
-
h.key === "Escape" ? (k(!1), x(!1),
|
|
271
|
+
h.key === "Escape" ? (k(!1), x(!1), E("")) : h.key === "Enter" && H.length > 0 && H[0] && Q(H[0]);
|
|
270
272
|
}, P = N.find((h) => h.value === B), le = B !== "" && B !== void 0, ie = (h) => {
|
|
271
273
|
h.stopPropagation(), I(""), o == null || o("");
|
|
272
|
-
},
|
|
274
|
+
}, re = le || L || v || w && A, ne = [
|
|
273
275
|
"clarity-select",
|
|
274
276
|
"clarity-select--outlined",
|
|
275
277
|
`clarity-select--${s}`,
|
|
276
278
|
e && `clarity-select--${e}`,
|
|
277
279
|
i && "clarity-select--error",
|
|
278
|
-
|
|
279
|
-
(
|
|
280
|
-
|
|
280
|
+
u && "clarity-select--disabled",
|
|
281
|
+
(L || _) && "clarity-select--focused",
|
|
282
|
+
re && "clarity-select--label-up",
|
|
281
283
|
_ && "clarity-select--open",
|
|
282
284
|
w && "clarity-select--searchable",
|
|
283
285
|
c && "clarity-select--with-start-icon",
|
|
284
286
|
(f || b) && "clarity-select--with-end-icon",
|
|
285
|
-
|
|
287
|
+
r
|
|
286
288
|
].filter(Boolean).join(" ");
|
|
287
289
|
return /* @__PURE__ */ C("div", { className: "clarity-select-wrapper", children: [
|
|
288
290
|
/* @__PURE__ */ C(
|
|
289
291
|
"div",
|
|
290
292
|
{
|
|
291
293
|
ref: $,
|
|
292
|
-
className:
|
|
294
|
+
className: ne,
|
|
293
295
|
onClick: w ? void 0 : F,
|
|
294
296
|
role: "combobox",
|
|
295
297
|
"aria-expanded": _,
|
|
296
298
|
"aria-haspopup": "listbox",
|
|
297
|
-
tabIndex:
|
|
299
|
+
tabIndex: u || w ? -1 : 0,
|
|
298
300
|
...j,
|
|
299
301
|
children: [
|
|
300
302
|
c && /* @__PURE__ */ t("div", { className: "clarity-select__start-icon", children: c }),
|
|
@@ -302,17 +304,17 @@ const qe = O.forwardRef(({
|
|
|
302
304
|
w ? /* @__PURE__ */ t(
|
|
303
305
|
"input",
|
|
304
306
|
{
|
|
305
|
-
ref:
|
|
307
|
+
ref: V,
|
|
306
308
|
type: "text",
|
|
307
309
|
className: "clarity-select__search-input",
|
|
308
310
|
value: _ ? A : P ? P.label : "",
|
|
309
311
|
onChange: K,
|
|
310
312
|
onKeyDown: U,
|
|
311
313
|
onFocus: () => {
|
|
312
|
-
_ || (k(!0), x(!0),
|
|
314
|
+
_ || (k(!0), x(!0), m == null || m());
|
|
313
315
|
},
|
|
314
316
|
placeholder: P ? P.label : v,
|
|
315
|
-
disabled:
|
|
317
|
+
disabled: u,
|
|
316
318
|
readOnly: !_
|
|
317
319
|
}
|
|
318
320
|
) : /* @__PURE__ */ t("div", { className: "clarity-select__display", children: P ? P.label : v }),
|
|
@@ -391,24 +393,24 @@ const qe = O.forwardRef(({
|
|
|
391
393
|
]
|
|
392
394
|
}
|
|
393
395
|
),
|
|
394
|
-
(a || i &&
|
|
396
|
+
(a || i && n) && /* @__PURE__ */ t("div", { className: "clarity-select__helper-text", children: i && n ? n : a })
|
|
395
397
|
] });
|
|
396
398
|
});
|
|
397
399
|
qe.displayName = "Select";
|
|
398
|
-
const Ge =
|
|
400
|
+
const Ge = Ve(({
|
|
399
401
|
options: e = [],
|
|
400
402
|
value: s = [],
|
|
401
403
|
onChange: l,
|
|
402
404
|
placeholder: a = "Selecione opções",
|
|
403
405
|
label: i,
|
|
404
|
-
helperText:
|
|
406
|
+
helperText: n,
|
|
405
407
|
error: c = !1,
|
|
406
408
|
errorMessage: f,
|
|
407
|
-
disabled:
|
|
408
|
-
variant:
|
|
409
|
+
disabled: r = !1,
|
|
410
|
+
variant: u = "primary",
|
|
409
411
|
size: p = "medium",
|
|
410
412
|
maxSelectedLabels: y = 3,
|
|
411
|
-
selectionLimit:
|
|
413
|
+
selectionLimit: m,
|
|
412
414
|
className: d = "",
|
|
413
415
|
id: o,
|
|
414
416
|
name: N,
|
|
@@ -416,39 +418,39 @@ const Ge = Me(({
|
|
|
416
418
|
"data-testid": b,
|
|
417
419
|
...w
|
|
418
420
|
}, j) => {
|
|
419
|
-
const [g, _] = T(!1), [k,
|
|
421
|
+
const [g, _] = T(!1), [k, L] = T(""), [x, B] = T(!1), I = M(null), A = M(null), E = M(null), $ = (h) => {
|
|
420
422
|
I.current = h, j && (typeof j == "function" ? j(h) : j.current = h);
|
|
421
423
|
};
|
|
422
424
|
D(() => {
|
|
423
425
|
const h = (S) => {
|
|
424
|
-
I.current && !I.current.contains(S.target) && (_(!1), B(!1),
|
|
426
|
+
I.current && !I.current.contains(S.target) && (_(!1), B(!1), L(""));
|
|
425
427
|
};
|
|
426
428
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
427
429
|
}, []);
|
|
428
|
-
const
|
|
430
|
+
const V = e.filter(
|
|
429
431
|
(h) => h.label.toLowerCase().includes(k.toLowerCase())
|
|
430
432
|
), H = () => {
|
|
431
|
-
|
|
433
|
+
r || (_(!g), B(!g), g ? L("") : setTimeout(() => {
|
|
432
434
|
var h;
|
|
433
435
|
(h = A.current) == null || h.focus();
|
|
434
436
|
}, 100));
|
|
435
437
|
}, F = (h, S) => {
|
|
436
|
-
if (
|
|
438
|
+
if (r)
|
|
437
439
|
return;
|
|
438
440
|
S && (S.stopPropagation(), S.preventDefault());
|
|
439
441
|
const z = s.includes(h);
|
|
440
442
|
let R;
|
|
441
443
|
z ? R = s.filter((ee) => ee !== h) : R = [...s, h], l && l(R);
|
|
442
444
|
}, Q = (h, S) => {
|
|
443
|
-
if (S.stopPropagation(),
|
|
445
|
+
if (S.stopPropagation(), r) return;
|
|
444
446
|
const z = s.filter((R) => R !== h);
|
|
445
447
|
l == null || l(z);
|
|
446
448
|
}, K = (h) => {
|
|
447
|
-
h.stopPropagation(), !
|
|
449
|
+
h.stopPropagation(), !r && (l == null || l([]));
|
|
448
450
|
}, U = (h) => {
|
|
449
|
-
|
|
451
|
+
L(h.target.value);
|
|
450
452
|
}, P = (h) => {
|
|
451
|
-
h.key === "Escape" && (_(!1), B(!1),
|
|
453
|
+
h.key === "Escape" && (_(!1), B(!1), L(""));
|
|
452
454
|
}, le = x || g || s.length > 0, ie = () => {
|
|
453
455
|
if (s.length === 0) return null;
|
|
454
456
|
const h = s.map(
|
|
@@ -457,7 +459,7 @@ const Ge = Me(({
|
|
|
457
459
|
return /* @__PURE__ */ C("div", { className: "clarity-multiselect__chips", children: [
|
|
458
460
|
S.map((R) => /* @__PURE__ */ C("div", { className: "clarity-multiselect__chip", children: [
|
|
459
461
|
/* @__PURE__ */ t("span", { className: "clarity-multiselect__chip-label", children: R.label }),
|
|
460
|
-
!
|
|
462
|
+
!r && /* @__PURE__ */ t(
|
|
461
463
|
"button",
|
|
462
464
|
{
|
|
463
465
|
type: "button",
|
|
@@ -474,26 +476,26 @@ const Ge = Me(({
|
|
|
474
476
|
" mais"
|
|
475
477
|
] })
|
|
476
478
|
] });
|
|
477
|
-
},
|
|
479
|
+
}, re = [
|
|
478
480
|
"clarity-multiselect-wrapper",
|
|
479
481
|
d
|
|
480
|
-
].filter(Boolean).join(" "),
|
|
482
|
+
].filter(Boolean).join(" "), ne = [
|
|
481
483
|
"clarity-multiselect",
|
|
482
|
-
`clarity-multiselect--${
|
|
484
|
+
`clarity-multiselect--${u}`,
|
|
483
485
|
`clarity-multiselect--${p}`,
|
|
484
486
|
g && "clarity-multiselect--open",
|
|
485
487
|
x && "clarity-multiselect--focused",
|
|
486
488
|
le && "clarity-multiselect--label-up",
|
|
487
489
|
c && "clarity-multiselect--error",
|
|
488
|
-
|
|
490
|
+
r && "clarity-multiselect--disabled",
|
|
489
491
|
s.length > 0 && "clarity-multiselect--has-value"
|
|
490
492
|
].filter(Boolean).join(" ");
|
|
491
|
-
return /* @__PURE__ */ C("div", { className:
|
|
493
|
+
return /* @__PURE__ */ C("div", { className: re, children: [
|
|
492
494
|
/* @__PURE__ */ C(
|
|
493
495
|
"div",
|
|
494
496
|
{
|
|
495
497
|
ref: $,
|
|
496
|
-
className:
|
|
498
|
+
className: ne,
|
|
497
499
|
"data-testid": b,
|
|
498
500
|
...w,
|
|
499
501
|
children: [
|
|
@@ -509,7 +511,7 @@ const Ge = Me(({
|
|
|
509
511
|
] }),
|
|
510
512
|
/* @__PURE__ */ t("div", { className: "clarity-multiselect__content", children: s.length > 0 ? ie() : /* @__PURE__ */ t("span", { className: "clarity-multiselect__placeholder", children: a }) }),
|
|
511
513
|
/* @__PURE__ */ C("div", { className: "clarity-multiselect__icons", children: [
|
|
512
|
-
s.length > 0 && !
|
|
514
|
+
s.length > 0 && !r && /* @__PURE__ */ t(
|
|
513
515
|
"button",
|
|
514
516
|
{
|
|
515
517
|
type: "button",
|
|
@@ -533,7 +535,7 @@ const Ge = Me(({
|
|
|
533
535
|
]
|
|
534
536
|
}
|
|
535
537
|
),
|
|
536
|
-
g && /* @__PURE__ */ C("div", { ref:
|
|
538
|
+
g && /* @__PURE__ */ C("div", { ref: E, className: "clarity-multiselect__dropdown", children: [
|
|
537
539
|
/* @__PURE__ */ t("div", { className: "clarity-multiselect__search", children: /* @__PURE__ */ t(
|
|
538
540
|
"input",
|
|
539
541
|
{
|
|
@@ -546,8 +548,8 @@ const Ge = Me(({
|
|
|
546
548
|
onKeyDown: P
|
|
547
549
|
}
|
|
548
550
|
) }),
|
|
549
|
-
/* @__PURE__ */ t("ul", { className: "clarity-multiselect__options", children:
|
|
550
|
-
const S = s.includes(h.value), z = h.disabled ||
|
|
551
|
+
/* @__PURE__ */ t("ul", { className: "clarity-multiselect__options", children: V.length > 0 ? V.map((h) => {
|
|
552
|
+
const S = s.includes(h.value), z = h.disabled || r;
|
|
551
553
|
return /* @__PURE__ */ C(
|
|
552
554
|
"li",
|
|
553
555
|
{
|
|
@@ -581,7 +583,7 @@ const Ge = Me(({
|
|
|
581
583
|
]
|
|
582
584
|
}
|
|
583
585
|
),
|
|
584
|
-
(
|
|
586
|
+
(n || c && f) && /* @__PURE__ */ t("div", { className: "clarity-multiselect__helper", children: c && f ? /* @__PURE__ */ t("span", { className: "clarity-multiselect__error-message", children: f }) : n && /* @__PURE__ */ t("span", { className: "clarity-multiselect__helper-text", children: n }) })
|
|
585
587
|
] });
|
|
586
588
|
});
|
|
587
589
|
Ge.displayName = "MultiSelect";
|
|
@@ -595,7 +597,7 @@ const ue = q(null), me = () => {
|
|
|
595
597
|
className: s = "",
|
|
596
598
|
title: l
|
|
597
599
|
}) => {
|
|
598
|
-
const { onClose: a, variant: i, showCloseButton:
|
|
600
|
+
const { onClose: a, variant: i, showCloseButton: n } = me(), c = [
|
|
599
601
|
"clarity-modal-header",
|
|
600
602
|
s,
|
|
601
603
|
i && `clarity-modal-header--${i}`
|
|
@@ -606,8 +608,8 @@ const ue = q(null), me = () => {
|
|
|
606
608
|
return /* @__PURE__ */ C("div", { className: c, children: [
|
|
607
609
|
l && /* @__PURE__ */ t("h2", { className: "clarity-modal-title", children: l }),
|
|
608
610
|
e,
|
|
609
|
-
|
|
610
|
-
|
|
611
|
+
n && /* @__PURE__ */ t("button", { className: f, onClick: (r) => {
|
|
612
|
+
r.stopPropagation(), a();
|
|
611
613
|
}, children: "×" })
|
|
612
614
|
] });
|
|
613
615
|
};
|
|
@@ -621,8 +623,8 @@ const pe = ({ children: e, className: s = "" }) => /* @__PURE__ */ C("div", { cl
|
|
|
621
623
|
pe.displayName = "Modal.Footer";
|
|
622
624
|
const ye = ({ children: e, onClick: s, variant: l }) => W(e, {
|
|
623
625
|
onClick: (a) => {
|
|
624
|
-
var i,
|
|
625
|
-
s == null || s(), (
|
|
626
|
+
var i, n;
|
|
627
|
+
s == null || s(), (n = (i = e.props).onClick) == null || n.call(i, a);
|
|
626
628
|
},
|
|
627
629
|
variant: l
|
|
628
630
|
});
|
|
@@ -643,34 +645,34 @@ const Y = ({
|
|
|
643
645
|
onOpen: l,
|
|
644
646
|
children: a,
|
|
645
647
|
className: i = "",
|
|
646
|
-
variant:
|
|
648
|
+
variant: n,
|
|
647
649
|
size: c = "medium",
|
|
648
650
|
showCloseButton: f = !0,
|
|
649
|
-
closeOnOverlayClick:
|
|
651
|
+
closeOnOverlayClick: r = !0
|
|
650
652
|
}) => {
|
|
651
|
-
const [
|
|
653
|
+
const [u, p] = T(!1), m = e !== void 0 ? e : u, d = s || (() => {
|
|
652
654
|
p(!1);
|
|
653
655
|
});
|
|
654
656
|
D(() => {
|
|
655
|
-
|
|
656
|
-
}, [
|
|
657
|
+
m && (l == null || l());
|
|
658
|
+
}, [m, l]), D(() => {
|
|
657
659
|
const w = (j) => {
|
|
658
660
|
j.key === "Escape" && d();
|
|
659
661
|
};
|
|
660
|
-
return
|
|
662
|
+
return m ? (document.addEventListener("keydown", w), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => {
|
|
661
663
|
document.removeEventListener("keydown", w), document.body.style.overflow = "unset";
|
|
662
664
|
};
|
|
663
|
-
}, [
|
|
665
|
+
}, [m, d]);
|
|
664
666
|
const o = (w) => {
|
|
665
|
-
|
|
667
|
+
r && w.target === w.currentTarget && d();
|
|
666
668
|
}, N = O.Children.toArray(a).find(
|
|
667
669
|
(w) => X(w) && w.type.displayName === "Modal.Trigger"
|
|
668
670
|
), v = O.Children.toArray(a).filter(
|
|
669
671
|
(w) => X(w) && w.type.displayName !== "Modal.Trigger"
|
|
670
672
|
), b = ["clarity-modal", i, `clarity-modal--${c}`].filter(Boolean).join(" ");
|
|
671
|
-
return /* @__PURE__ */ C(ue.Provider, { value: { onClose: d, variant:
|
|
672
|
-
N && W(N, { onClick: () => p(!0), variant:
|
|
673
|
-
|
|
673
|
+
return /* @__PURE__ */ C(ue.Provider, { value: { onClose: d, variant: n, showCloseButton: f }, children: [
|
|
674
|
+
N && W(N, { onClick: () => p(!0), variant: n }),
|
|
675
|
+
m && /* @__PURE__ */ t("div", { className: "clarity-modal-overlay", onClick: o, children: /* @__PURE__ */ t("div", { className: b, children: v }) })
|
|
674
676
|
] });
|
|
675
677
|
};
|
|
676
678
|
Y.Header = fe;
|
|
@@ -684,33 +686,33 @@ const Ne = q(void 0), mt = () => {
|
|
|
684
686
|
if (!e)
|
|
685
687
|
throw new Error("useToast must be used within a ToastProvider");
|
|
686
688
|
return e;
|
|
687
|
-
}, Je = ({ id: e, message: s, variant: l, duration: a, onClose: i, invertColors:
|
|
688
|
-
const [c, f] = T(
|
|
689
|
+
}, Je = ({ id: e, message: s, variant: l, duration: a, onClose: i, invertColors: n }) => {
|
|
690
|
+
const [c, f] = T("entering");
|
|
689
691
|
D(() => {
|
|
690
|
-
f(!0);
|
|
691
692
|
const u = setTimeout(() => {
|
|
692
|
-
|
|
693
|
+
f("visible");
|
|
694
|
+
}, 10), p = setTimeout(() => {
|
|
695
|
+
f("exiting");
|
|
696
|
+
}, a * 1e3 - 300), y = setTimeout(() => {
|
|
697
|
+
i(e);
|
|
693
698
|
}, a * 1e3);
|
|
694
699
|
return () => {
|
|
695
|
-
clearTimeout(u);
|
|
700
|
+
clearTimeout(u), clearTimeout(p), clearTimeout(y);
|
|
696
701
|
};
|
|
697
|
-
}, [a]);
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
}, y = [
|
|
701
|
-
"toast",
|
|
702
|
+
}, [e, a, i]);
|
|
703
|
+
const r = [
|
|
704
|
+
"cl-toast",
|
|
702
705
|
l,
|
|
703
|
-
|
|
704
|
-
c
|
|
705
|
-
n ? "toast-exiting" : ""
|
|
706
|
+
n ? "colored-background" : "",
|
|
707
|
+
`cl-toast-${c}`
|
|
706
708
|
].filter(Boolean).join(" ");
|
|
707
|
-
return /* @__PURE__ */ C("div", { className:
|
|
708
|
-
/* @__PURE__ */ t("div", { className: "toast-message", children: s }),
|
|
709
|
-
/* @__PURE__ */ t("button", { onClick: () =>
|
|
709
|
+
return /* @__PURE__ */ C("div", { className: r, children: [
|
|
710
|
+
/* @__PURE__ */ t("div", { className: "cl-toast-message", children: s }),
|
|
711
|
+
/* @__PURE__ */ t("button", { onClick: () => f("exiting"), className: "cl-toast-close-button", children: "×" }),
|
|
710
712
|
/* @__PURE__ */ t(
|
|
711
713
|
"div",
|
|
712
714
|
{
|
|
713
|
-
className: "toast-progress-bar",
|
|
715
|
+
className: "cl-toast-progress-bar",
|
|
714
716
|
style: { animationDuration: `${a}s` }
|
|
715
717
|
}
|
|
716
718
|
)
|
|
@@ -718,8 +720,8 @@ const Ne = q(void 0), mt = () => {
|
|
|
718
720
|
}, ft = ({ children: e }) => {
|
|
719
721
|
const [s, l] = T([]), a = te(() => {
|
|
720
722
|
if (typeof document < "u") {
|
|
721
|
-
const
|
|
722
|
-
return
|
|
723
|
+
const r = document.createElement("div");
|
|
724
|
+
return r.id = "toast-portal-root", r;
|
|
723
725
|
}
|
|
724
726
|
return null;
|
|
725
727
|
}, []);
|
|
@@ -729,24 +731,24 @@ const Ne = q(void 0), mt = () => {
|
|
|
729
731
|
document.body.removeChild(a);
|
|
730
732
|
};
|
|
731
733
|
}, [a]);
|
|
732
|
-
const i = ae((
|
|
734
|
+
const i = ae((r) => {
|
|
733
735
|
const p = {
|
|
734
736
|
id: (/* @__PURE__ */ new Date()).toISOString() + Math.random(),
|
|
735
737
|
// duration: 5,
|
|
736
738
|
// position: 'right-top',
|
|
737
|
-
...
|
|
739
|
+
...r
|
|
738
740
|
};
|
|
739
741
|
l((y) => {
|
|
740
|
-
const
|
|
741
|
-
return
|
|
742
|
+
const m = [p, ...y];
|
|
743
|
+
return m.length > 4 ? m.slice(0, 4) : m;
|
|
742
744
|
});
|
|
743
|
-
}, []),
|
|
744
|
-
l((
|
|
745
|
-
}, []), c = te(() => s.reduce((
|
|
745
|
+
}, []), n = ae((r) => {
|
|
746
|
+
l((u) => u.filter((p) => p.id !== r));
|
|
747
|
+
}, []), c = te(() => s.reduce((r, u) => (r[u.position] || (r[u.position] = []), r[u.position].push(u), r), {}), [s]), f = te(() => ({ show: i }), [i]);
|
|
746
748
|
return /* @__PURE__ */ C(Ne.Provider, { value: f, children: [
|
|
747
749
|
e,
|
|
748
750
|
a && Fe.createPortal(
|
|
749
|
-
Object.entries(c).map(([
|
|
751
|
+
Object.entries(c).map(([r, u]) => /* @__PURE__ */ t("div", { className: `cl-toast-container ${r}`, children: u.map((p) => /* @__PURE__ */ t(Je, { ...p, onClose: n }, p.id)) }, r)),
|
|
750
752
|
a
|
|
751
753
|
)
|
|
752
754
|
] });
|
|
@@ -759,21 +761,21 @@ const Ne = q(void 0), mt = () => {
|
|
|
759
761
|
children: e,
|
|
760
762
|
className: s = ""
|
|
761
763
|
}) => {
|
|
762
|
-
const { onClose: l, variant: a, showCloseButton: i, title:
|
|
764
|
+
const { onClose: l, variant: a, showCloseButton: i, title: n } = _e(), c = [
|
|
763
765
|
"clarity-offcanvas-header",
|
|
764
766
|
s
|
|
765
767
|
].filter(Boolean).join(" "), f = [
|
|
766
768
|
"clarity-offcanvas-close",
|
|
767
769
|
a && `clarity-offcanvas-close--${a}`
|
|
768
|
-
].filter(Boolean).join(" "),
|
|
770
|
+
].filter(Boolean).join(" "), r = [
|
|
769
771
|
"clarity-offcanvas-title",
|
|
770
772
|
a && `clarity-offcanvas-title--${a}`
|
|
771
773
|
].filter(Boolean).join(" ");
|
|
772
774
|
return /* @__PURE__ */ C("div", { className: c, children: [
|
|
773
|
-
|
|
775
|
+
n && /* @__PURE__ */ t("h2", { className: r, children: n }),
|
|
774
776
|
e,
|
|
775
|
-
i && /* @__PURE__ */ t("button", { className: f, onClick: (
|
|
776
|
-
|
|
777
|
+
i && /* @__PURE__ */ t("button", { className: f, onClick: (u) => {
|
|
778
|
+
u.stopPropagation(), l();
|
|
777
779
|
}, children: "×" })
|
|
778
780
|
] });
|
|
779
781
|
};
|
|
@@ -782,8 +784,8 @@ const Ce = ({ children: e, className: s = "" }) => /* @__PURE__ */ t("div", { cl
|
|
|
782
784
|
Ce.displayName = "Offcanvas.Content";
|
|
783
785
|
const ge = ({ children: e, onClick: s, variant: l }) => W(e, {
|
|
784
786
|
onClick: (a) => {
|
|
785
|
-
var i,
|
|
786
|
-
s == null || s(), (
|
|
787
|
+
var i, n;
|
|
788
|
+
s == null || s(), (n = (i = e.props).onClick) == null || n.call(i, a);
|
|
787
789
|
},
|
|
788
790
|
variant: l
|
|
789
791
|
});
|
|
@@ -806,13 +808,13 @@ const Z = ({
|
|
|
806
808
|
onOpen: l,
|
|
807
809
|
children: a,
|
|
808
810
|
className: i = "",
|
|
809
|
-
variant:
|
|
811
|
+
variant: n,
|
|
810
812
|
placement: c = "right",
|
|
811
813
|
closeOnOverlayClick: f = !0,
|
|
812
|
-
showCloseButton:
|
|
813
|
-
title:
|
|
814
|
+
showCloseButton: r = !0,
|
|
815
|
+
title: u
|
|
814
816
|
}) => {
|
|
815
|
-
const [p, y] = T(!1), [
|
|
817
|
+
const [p, y] = T(!1), [m, d] = T(!1), [o, N] = T(!1), v = e !== void 0, b = v ? e : p, w = ae(() => {
|
|
816
818
|
s ? s() : y(!1);
|
|
817
819
|
}, [s]), j = ae(() => {
|
|
818
820
|
v || y(!0), l == null || l();
|
|
@@ -832,8 +834,8 @@ const Z = ({
|
|
|
832
834
|
return () => clearTimeout($);
|
|
833
835
|
}
|
|
834
836
|
}, [b]), D(() => {
|
|
835
|
-
const $ = (
|
|
836
|
-
|
|
837
|
+
const $ = (V) => {
|
|
838
|
+
V.key === "Escape" && w();
|
|
837
839
|
};
|
|
838
840
|
return b ? (document.addEventListener("keydown", $), document.body.style.overflow = "hidden") : (document.removeEventListener("keydown", $), document.body.style.overflow = "unset"), () => {
|
|
839
841
|
document.removeEventListener("keydown", $), document.body.style.overflow = "unset";
|
|
@@ -842,20 +844,20 @@ const Z = ({
|
|
|
842
844
|
const g = ($) => {
|
|
843
845
|
f && $.target === $.currentTarget && w();
|
|
844
846
|
}, _ = O.Children.toArray(a);
|
|
845
|
-
let k,
|
|
847
|
+
let k, L, x, B, I;
|
|
846
848
|
_.forEach(($) => {
|
|
847
849
|
if (X($))
|
|
848
850
|
if ($.type.displayName === "Offcanvas.Trigger")
|
|
849
851
|
k = $;
|
|
850
852
|
else if ($.type.displayName === "Offcanvas.Header")
|
|
851
|
-
|
|
853
|
+
L = $;
|
|
852
854
|
else if ($.type.displayName === "Offcanvas.Content") {
|
|
853
855
|
x = $;
|
|
854
856
|
const H = O.Children.toArray(x.props.children).filter((F) => X(F) && F.type.displayName === "Offcanvas.Close" ? (I = F, !1) : !0);
|
|
855
857
|
x = W(x, { children: H });
|
|
856
858
|
} else $.type.displayName === "Offcanvas.Footer" && (B = $);
|
|
857
859
|
}), I && (B ? B = W(B, {
|
|
858
|
-
children: /* @__PURE__ */ C(
|
|
860
|
+
children: /* @__PURE__ */ C(Me, { children: [
|
|
859
861
|
B.props.children,
|
|
860
862
|
I
|
|
861
863
|
] })
|
|
@@ -864,17 +866,17 @@ const Z = ({
|
|
|
864
866
|
"clarity-offcanvas",
|
|
865
867
|
i,
|
|
866
868
|
`clarity-offcanvas--${c}`,
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
].filter(Boolean).join(" "),
|
|
869
|
+
n && `clarity-offcanvas--${n}`,
|
|
870
|
+
m ? "clarity-offcanvas--open" : "clarity-offcanvas--closed"
|
|
871
|
+
].filter(Boolean).join(" "), E = [
|
|
870
872
|
"clarity-offcanvas-overlay",
|
|
871
|
-
|
|
873
|
+
m ? "clarity-offcanvas-overlay--visible" : ""
|
|
872
874
|
].filter(Boolean).join(" ");
|
|
873
|
-
return /* @__PURE__ */ C(be.Provider, { value: { onClose: w, variant:
|
|
874
|
-
k && W(k, { onClick: j, variant:
|
|
875
|
+
return /* @__PURE__ */ C(be.Provider, { value: { onClose: w, variant: n, showCloseButton: r, placement: c, title: u }, children: [
|
|
876
|
+
k && W(k, { onClick: j, variant: n }),
|
|
875
877
|
o && // Only render if shouldRender is true
|
|
876
|
-
/* @__PURE__ */ t("div", { className:
|
|
877
|
-
|
|
878
|
+
/* @__PURE__ */ t("div", { className: E, onClick: g, children: /* @__PURE__ */ C("div", { className: A, children: [
|
|
879
|
+
L,
|
|
878
880
|
x,
|
|
879
881
|
B && /* @__PURE__ */ t("div", { className: "clarity-offcanvas-scroll-indicator" }),
|
|
880
882
|
" ",
|
|
@@ -894,32 +896,32 @@ const Qe = O.forwardRef(({
|
|
|
894
896
|
size: l = "medium",
|
|
895
897
|
label: a,
|
|
896
898
|
helperText: i,
|
|
897
|
-
error:
|
|
899
|
+
error: n = !1,
|
|
898
900
|
errorMessage: c,
|
|
899
901
|
labelPosition: f = "right",
|
|
900
|
-
className:
|
|
901
|
-
disabled:
|
|
902
|
+
className: r = "",
|
|
903
|
+
disabled: u = !1,
|
|
902
904
|
checked: p,
|
|
903
905
|
id: y,
|
|
904
|
-
...
|
|
906
|
+
...m
|
|
905
907
|
}, d) => {
|
|
906
908
|
const o = y || `check-input-${Math.random().toString(36).substr(2, 9)}`, N = [
|
|
907
909
|
"clarity-check-input-wrapper",
|
|
908
910
|
`clarity-check-input-wrapper--${f}`,
|
|
909
|
-
|
|
910
|
-
|
|
911
|
+
u && "clarity-check-input-wrapper--disabled",
|
|
912
|
+
n && "clarity-check-input-wrapper--error"
|
|
911
913
|
].filter(Boolean).join(" "), v = [
|
|
912
914
|
"clarity-check-input",
|
|
913
915
|
`clarity-check-input--${e}`,
|
|
914
916
|
`clarity-check-input--${l}`,
|
|
915
917
|
s && `clarity-check-input--${s}`,
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
918
|
+
n && "clarity-check-input--error",
|
|
919
|
+
u && "clarity-check-input--disabled",
|
|
920
|
+
r
|
|
919
921
|
].filter(Boolean).join(" "), b = [
|
|
920
922
|
"clarity-check-input__label",
|
|
921
923
|
`clarity-check-input__label--${l}`,
|
|
922
|
-
|
|
924
|
+
u && "clarity-check-input__label--disabled"
|
|
923
925
|
].filter(Boolean).join(" ");
|
|
924
926
|
return /* @__PURE__ */ C("div", { className: "clarity-check-input-container", children: [
|
|
925
927
|
/* @__PURE__ */ C("label", { className: N, htmlFor: o, children: [
|
|
@@ -930,9 +932,9 @@ const Qe = O.forwardRef(({
|
|
|
930
932
|
id: o,
|
|
931
933
|
type: e,
|
|
932
934
|
className: v,
|
|
933
|
-
disabled:
|
|
935
|
+
disabled: u,
|
|
934
936
|
checked: p,
|
|
935
|
-
...
|
|
937
|
+
...m
|
|
936
938
|
}
|
|
937
939
|
),
|
|
938
940
|
/* @__PURE__ */ C("div", { className: "clarity-check-input__custom", children: [
|
|
@@ -959,7 +961,7 @@ const Qe = O.forwardRef(({
|
|
|
959
961
|
] }),
|
|
960
962
|
a && /* @__PURE__ */ t("span", { className: b, children: a })
|
|
961
963
|
] }),
|
|
962
|
-
(i ||
|
|
964
|
+
(i || n && c) && /* @__PURE__ */ t("div", { className: "clarity-check-input__helper-text", children: n && c ? c : i })
|
|
963
965
|
] });
|
|
964
966
|
});
|
|
965
967
|
Qe.displayName = "CheckInput";
|
|
@@ -969,49 +971,49 @@ const Xe = O.forwardRef(({
|
|
|
969
971
|
label: l,
|
|
970
972
|
helperText: a,
|
|
971
973
|
error: i = !1,
|
|
972
|
-
errorMessage:
|
|
974
|
+
errorMessage: n,
|
|
973
975
|
labelPosition: c = "right",
|
|
974
976
|
className: f = "",
|
|
975
|
-
disabled:
|
|
976
|
-
checked:
|
|
977
|
+
disabled: r = !1,
|
|
978
|
+
checked: u,
|
|
977
979
|
id: p,
|
|
978
980
|
...y
|
|
979
|
-
},
|
|
981
|
+
}, m) => {
|
|
980
982
|
const d = p || `input-switch-${Math.random().toString(36).substr(2, 9)}`, o = [
|
|
981
983
|
"clarity-input-switch-wrapper",
|
|
982
984
|
`clarity-input-switch-wrapper--${c}`,
|
|
983
|
-
|
|
985
|
+
r && "clarity-input-switch-wrapper--disabled",
|
|
984
986
|
i && "clarity-input-switch-wrapper--error"
|
|
985
987
|
].filter(Boolean).join(" "), N = [
|
|
986
988
|
"clarity-input-switch",
|
|
987
989
|
`clarity-input-switch--${s}`,
|
|
988
990
|
e && `clarity-input-switch--${e}`,
|
|
989
991
|
i && "clarity-input-switch--error",
|
|
990
|
-
|
|
992
|
+
r && "clarity-input-switch--disabled",
|
|
991
993
|
f
|
|
992
994
|
].filter(Boolean).join(" "), v = [
|
|
993
995
|
"clarity-input-switch__label",
|
|
994
996
|
`clarity-input-switch__label--${s}`,
|
|
995
|
-
|
|
997
|
+
r && "clarity-input-switch__label--disabled"
|
|
996
998
|
].filter(Boolean).join(" ");
|
|
997
999
|
return /* @__PURE__ */ C("div", { className: "clarity-input-switch-container", children: [
|
|
998
1000
|
/* @__PURE__ */ C("label", { className: o, htmlFor: d, children: [
|
|
999
1001
|
/* @__PURE__ */ t(
|
|
1000
1002
|
"input",
|
|
1001
1003
|
{
|
|
1002
|
-
ref:
|
|
1004
|
+
ref: m,
|
|
1003
1005
|
id: d,
|
|
1004
1006
|
type: "checkbox",
|
|
1005
1007
|
className: N,
|
|
1006
|
-
disabled:
|
|
1007
|
-
checked:
|
|
1008
|
+
disabled: r,
|
|
1009
|
+
checked: u,
|
|
1008
1010
|
...y
|
|
1009
1011
|
}
|
|
1010
1012
|
),
|
|
1011
1013
|
/* @__PURE__ */ t("div", { className: "clarity-input-switch__track", children: /* @__PURE__ */ t("div", { className: "clarity-input-switch__thumb" }) }),
|
|
1012
1014
|
l && /* @__PURE__ */ t("span", { className: v, children: l })
|
|
1013
1015
|
] }),
|
|
1014
|
-
(a || i &&
|
|
1016
|
+
(a || i && n) && /* @__PURE__ */ t("div", { className: "clarity-input-switch__helper-text", children: i && n ? n : a })
|
|
1015
1017
|
] });
|
|
1016
1018
|
});
|
|
1017
1019
|
Xe.displayName = "InputSwitch";
|
|
@@ -1036,7 +1038,7 @@ const Be = ({ children: e }) => W(e, {
|
|
|
1036
1038
|
}
|
|
1037
1039
|
});
|
|
1038
1040
|
Be.displayName = "ConfirmationDialog.Trigger";
|
|
1039
|
-
const
|
|
1041
|
+
const Le = ({ children: e }) => {
|
|
1040
1042
|
const { onClose: s } = oe();
|
|
1041
1043
|
return W(e, {
|
|
1042
1044
|
onClick: (l) => {
|
|
@@ -1045,8 +1047,8 @@ const Ee = ({ children: e }) => {
|
|
|
1045
1047
|
}
|
|
1046
1048
|
});
|
|
1047
1049
|
};
|
|
1048
|
-
|
|
1049
|
-
const
|
|
1050
|
+
Le.displayName = "ConfirmationDialog.Close";
|
|
1051
|
+
const Ee = ({ children: e }) => {
|
|
1050
1052
|
const { onConfirm: s } = oe();
|
|
1051
1053
|
return W(e, {
|
|
1052
1054
|
onClick: (l) => {
|
|
@@ -1055,7 +1057,7 @@ const Le = ({ children: e }) => {
|
|
|
1055
1057
|
}
|
|
1056
1058
|
});
|
|
1057
1059
|
};
|
|
1058
|
-
|
|
1060
|
+
Ee.displayName = "ConfirmationDialog.Confirm";
|
|
1059
1061
|
const J = ({
|
|
1060
1062
|
isOpen: e,
|
|
1061
1063
|
onClose: s,
|
|
@@ -1063,7 +1065,7 @@ const J = ({
|
|
|
1063
1065
|
variant: a = "clarity-primary",
|
|
1064
1066
|
children: i
|
|
1065
1067
|
}) => {
|
|
1066
|
-
const [
|
|
1068
|
+
const [n, c] = T(!1), f = e !== void 0, r = f ? e : n, u = () => {
|
|
1067
1069
|
f || c(!0);
|
|
1068
1070
|
}, p = () => {
|
|
1069
1071
|
s ? s() : c(!1);
|
|
@@ -1074,26 +1076,26 @@ const J = ({
|
|
|
1074
1076
|
const N = (v) => {
|
|
1075
1077
|
v.key === "Escape" && p();
|
|
1076
1078
|
};
|
|
1077
|
-
return
|
|
1079
|
+
return r ? (document.addEventListener("keydown", N), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => {
|
|
1078
1080
|
document.removeEventListener("keydown", N), document.body.style.overflow = "unset";
|
|
1079
1081
|
};
|
|
1080
|
-
}, [
|
|
1081
|
-
const
|
|
1082
|
+
}, [r, p]);
|
|
1083
|
+
const m = O.Children.toArray(i).find(
|
|
1082
1084
|
(N) => X(N) && N.type.displayName === "ConfirmationDialog.Trigger"
|
|
1083
1085
|
), d = O.Children.toArray(i).filter(
|
|
1084
1086
|
(N) => X(N) && N.type.displayName !== "ConfirmationDialog.Trigger"
|
|
1085
1087
|
), o = `clarity-confirmation-dialog clarity-confirmation-dialog--${a}`;
|
|
1086
|
-
return /* @__PURE__ */ C(ke.Provider, { value: { variant: a, onClose: p, onConfirm: y, onOpen:
|
|
1087
|
-
|
|
1088
|
-
|
|
1088
|
+
return /* @__PURE__ */ C(ke.Provider, { value: { variant: a, onClose: p, onConfirm: y, onOpen: u }, children: [
|
|
1089
|
+
m,
|
|
1090
|
+
r && /* @__PURE__ */ t("div", { className: "clarity-modal-overlay", children: /* @__PURE__ */ t("div", { className: o, children: d }) })
|
|
1089
1091
|
] });
|
|
1090
1092
|
};
|
|
1091
1093
|
J.Header = xe;
|
|
1092
1094
|
J.Content = Te;
|
|
1093
1095
|
J.Footer = je;
|
|
1094
1096
|
J.Trigger = Be;
|
|
1095
|
-
J.Close =
|
|
1096
|
-
J.Confirm =
|
|
1097
|
+
J.Close = Le;
|
|
1098
|
+
J.Confirm = Ee;
|
|
1097
1099
|
J.displayName = "ConfirmationDialog";
|
|
1098
1100
|
const ht = ({
|
|
1099
1101
|
variant: e = "primary",
|
|
@@ -1101,14 +1103,14 @@ const ht = ({
|
|
|
1101
1103
|
tone: l,
|
|
1102
1104
|
hoverTone: a,
|
|
1103
1105
|
size: i = "medium",
|
|
1104
|
-
disabled:
|
|
1106
|
+
disabled: n = !1,
|
|
1105
1107
|
loading: c = !1,
|
|
1106
1108
|
children: f,
|
|
1107
|
-
onClick:
|
|
1108
|
-
type:
|
|
1109
|
+
onClick: r,
|
|
1110
|
+
type: u = "button",
|
|
1109
1111
|
className: p = "",
|
|
1110
1112
|
"aria-label": y,
|
|
1111
|
-
title:
|
|
1113
|
+
title: m,
|
|
1112
1114
|
...d
|
|
1113
1115
|
}) => {
|
|
1114
1116
|
const o = "clarity-button-icon", N = s && l, v = N ? `${o}--custom` : `${o}--${e}`, b = [
|
|
@@ -1116,7 +1118,7 @@ const ht = ({
|
|
|
1116
1118
|
v,
|
|
1117
1119
|
`${o}--${i}`,
|
|
1118
1120
|
c && `${o}--loading`,
|
|
1119
|
-
|
|
1121
|
+
n && `${o}--disabled`,
|
|
1120
1122
|
p
|
|
1121
1123
|
].filter(Boolean).join(" "), w = (g) => {
|
|
1122
1124
|
const _ = parseInt(g);
|
|
@@ -1130,11 +1132,11 @@ const ht = ({
|
|
|
1130
1132
|
{
|
|
1131
1133
|
className: b,
|
|
1132
1134
|
style: j,
|
|
1133
|
-
disabled:
|
|
1134
|
-
onClick:
|
|
1135
|
-
type:
|
|
1135
|
+
disabled: n || c,
|
|
1136
|
+
onClick: r,
|
|
1137
|
+
type: u,
|
|
1136
1138
|
"aria-label": y,
|
|
1137
|
-
title:
|
|
1139
|
+
title: m,
|
|
1138
1140
|
...d,
|
|
1139
1141
|
children: [
|
|
1140
1142
|
c && /* @__PURE__ */ t("div", { className: `${o}__spinner` }),
|
|
@@ -1148,20 +1150,20 @@ const ht = ({
|
|
|
1148
1150
|
tone: l,
|
|
1149
1151
|
hoverTone: a,
|
|
1150
1152
|
size: i = "medium",
|
|
1151
|
-
disabled:
|
|
1153
|
+
disabled: n = !1,
|
|
1152
1154
|
children: c,
|
|
1153
1155
|
onClick: f,
|
|
1154
|
-
href:
|
|
1155
|
-
target:
|
|
1156
|
+
href: r,
|
|
1157
|
+
target: u,
|
|
1156
1158
|
rel: p,
|
|
1157
1159
|
className: y = "",
|
|
1158
|
-
...
|
|
1160
|
+
...m
|
|
1159
1161
|
}) => {
|
|
1160
1162
|
const d = "clarity-button-link", o = s && l, N = o ? `${d}--custom` : `${d}--${e}`, v = [
|
|
1161
1163
|
d,
|
|
1162
1164
|
N,
|
|
1163
1165
|
`${d}--${i}`,
|
|
1164
|
-
|
|
1166
|
+
n && `${d}--disabled`,
|
|
1165
1167
|
y
|
|
1166
1168
|
].filter(Boolean).join(" "), b = (j) => {
|
|
1167
1169
|
const g = parseInt(j);
|
|
@@ -1170,16 +1172,16 @@ const ht = ({
|
|
|
1170
1172
|
"--custom-color": `var(--clarity-${s}-${l})`,
|
|
1171
1173
|
"--custom-hover-color": `var(--clarity-${s}-${a || b(l)})`
|
|
1172
1174
|
} : {};
|
|
1173
|
-
return
|
|
1175
|
+
return r ? /* @__PURE__ */ t(
|
|
1174
1176
|
"a",
|
|
1175
1177
|
{
|
|
1176
|
-
href:
|
|
1177
|
-
target:
|
|
1178
|
-
rel: p || (
|
|
1178
|
+
href: r,
|
|
1179
|
+
target: u,
|
|
1180
|
+
rel: p || (u === "_blank" ? "noopener noreferrer" : void 0),
|
|
1179
1181
|
className: v,
|
|
1180
1182
|
style: w,
|
|
1181
|
-
onClick:
|
|
1182
|
-
...
|
|
1183
|
+
onClick: n ? void 0 : f,
|
|
1184
|
+
...m,
|
|
1183
1185
|
children: c
|
|
1184
1186
|
}
|
|
1185
1187
|
) : /* @__PURE__ */ t(
|
|
@@ -1187,9 +1189,9 @@ const ht = ({
|
|
|
1187
1189
|
{
|
|
1188
1190
|
className: v,
|
|
1189
1191
|
style: w,
|
|
1190
|
-
disabled:
|
|
1192
|
+
disabled: n,
|
|
1191
1193
|
onClick: f,
|
|
1192
|
-
...
|
|
1194
|
+
...m,
|
|
1193
1195
|
children: c
|
|
1194
1196
|
}
|
|
1195
1197
|
);
|
|
@@ -1204,16 +1206,16 @@ const ht = ({
|
|
|
1204
1206
|
tone: l,
|
|
1205
1207
|
hoverTone: a,
|
|
1206
1208
|
defaultActiveKey: i,
|
|
1207
|
-
alwaysOpen:
|
|
1209
|
+
alwaysOpen: n = !1,
|
|
1208
1210
|
flush: c = !1,
|
|
1209
1211
|
className: f = "",
|
|
1210
|
-
children:
|
|
1211
|
-
onSelect:
|
|
1212
|
+
children: r,
|
|
1213
|
+
onSelect: u,
|
|
1212
1214
|
...p
|
|
1213
1215
|
}) => {
|
|
1214
|
-
const [y,
|
|
1216
|
+
const [y, m] = T(() => i ? Array.isArray(i) ? i : [i] : []), d = (_) => {
|
|
1215
1217
|
let k;
|
|
1216
|
-
|
|
1218
|
+
n ? k = y.includes(_) ? y.filter((L) => L !== _) : [...y, _] : k = y.includes(_) ? [] : [_], m(k), u && u(y.includes(_) ? null : _, {});
|
|
1217
1219
|
}, o = "clarity-accordion", N = s && l, v = N ? `${o}--custom` : `${o}--${e}`, b = [
|
|
1218
1220
|
o,
|
|
1219
1221
|
v,
|
|
@@ -1229,14 +1231,14 @@ const ht = ({
|
|
|
1229
1231
|
} : {}, g = {
|
|
1230
1232
|
activeKeys: y,
|
|
1231
1233
|
toggleItem: d,
|
|
1232
|
-
alwaysOpen:
|
|
1234
|
+
alwaysOpen: n,
|
|
1233
1235
|
variant: e,
|
|
1234
1236
|
product: s,
|
|
1235
1237
|
tone: l,
|
|
1236
1238
|
hoverTone: a,
|
|
1237
1239
|
flush: c
|
|
1238
1240
|
};
|
|
1239
|
-
return /* @__PURE__ */ t(Oe.Provider, { value: g, children: /* @__PURE__ */ t("div", { className: b, style: j, ...p, children:
|
|
1241
|
+
return /* @__PURE__ */ t(Oe.Provider, { value: g, children: /* @__PURE__ */ t("div", { className: b, style: j, ...p, children: r }) });
|
|
1240
1242
|
}, Ze = ({
|
|
1241
1243
|
eventKey: e,
|
|
1242
1244
|
disabled: s = !1,
|
|
@@ -1244,49 +1246,49 @@ const ht = ({
|
|
|
1244
1246
|
children: a,
|
|
1245
1247
|
...i
|
|
1246
1248
|
}) => {
|
|
1247
|
-
const { activeKeys:
|
|
1249
|
+
const { activeKeys: n } = Ie(), c = "clarity-accordion", f = n.includes(e), r = [
|
|
1248
1250
|
`${c}__item`,
|
|
1249
1251
|
f && `${c}__item--active`,
|
|
1250
1252
|
s && `${c}__item--disabled`,
|
|
1251
1253
|
l
|
|
1252
1254
|
].filter(Boolean).join(" ");
|
|
1253
|
-
return /* @__PURE__ */ t("div", { className:
|
|
1254
|
-
...
|
|
1255
|
+
return /* @__PURE__ */ t("div", { className: r, ...i, children: O.Children.map(a, (u) => O.isValidElement(u) ? O.cloneElement(u, {
|
|
1256
|
+
...u.props,
|
|
1255
1257
|
eventKey: e,
|
|
1256
1258
|
disabled: s,
|
|
1257
1259
|
isActive: f
|
|
1258
|
-
}) :
|
|
1260
|
+
}) : u) });
|
|
1259
1261
|
}, Ke = ({
|
|
1260
1262
|
className: e = "",
|
|
1261
1263
|
children: s,
|
|
1262
1264
|
onClick: l,
|
|
1263
1265
|
eventKey: a,
|
|
1264
1266
|
disabled: i = !1,
|
|
1265
|
-
isActive:
|
|
1267
|
+
isActive: n = !1,
|
|
1266
1268
|
...c
|
|
1267
1269
|
}) => {
|
|
1268
|
-
const { toggleItem: f } = Ie(),
|
|
1270
|
+
const { toggleItem: f } = Ie(), r = "clarity-accordion", u = (p) => {
|
|
1269
1271
|
!i && a && f(a), l == null || l(p);
|
|
1270
1272
|
};
|
|
1271
1273
|
return /* @__PURE__ */ C(
|
|
1272
1274
|
"button",
|
|
1273
1275
|
{
|
|
1274
|
-
className: [`${
|
|
1275
|
-
onClick:
|
|
1276
|
+
className: [`${r}__header`, e].filter(Boolean).join(" "),
|
|
1277
|
+
onClick: u,
|
|
1276
1278
|
disabled: i,
|
|
1277
|
-
"aria-expanded":
|
|
1278
|
-
"aria-controls": a ? `${
|
|
1279
|
+
"aria-expanded": n,
|
|
1280
|
+
"aria-controls": a ? `${r}-collapse-${a}` : void 0,
|
|
1279
1281
|
...c,
|
|
1280
1282
|
children: [
|
|
1281
|
-
/* @__PURE__ */ t("span", { className: `${
|
|
1282
|
-
/* @__PURE__ */ t("span", { className: `${
|
|
1283
|
+
/* @__PURE__ */ t("span", { className: `${r}__title`, children: s }),
|
|
1284
|
+
/* @__PURE__ */ t("span", { className: `${r}__icon`, children: /* @__PURE__ */ t(
|
|
1283
1285
|
"svg",
|
|
1284
1286
|
{
|
|
1285
1287
|
width: "16",
|
|
1286
1288
|
height: "16",
|
|
1287
1289
|
viewBox: "0 0 16 16",
|
|
1288
1290
|
fill: "currentColor",
|
|
1289
|
-
className:
|
|
1291
|
+
className: n ? `${r}__icon--rotated` : "",
|
|
1290
1292
|
children: /* @__PURE__ */ t("path", { d: "M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z" })
|
|
1291
1293
|
}
|
|
1292
1294
|
) })
|
|
@@ -1300,16 +1302,16 @@ const ht = ({
|
|
|
1300
1302
|
isActive: a = !1,
|
|
1301
1303
|
...i
|
|
1302
1304
|
}) => {
|
|
1303
|
-
const
|
|
1305
|
+
const n = "clarity-accordion";
|
|
1304
1306
|
return /* @__PURE__ */ t(
|
|
1305
1307
|
"div",
|
|
1306
1308
|
{
|
|
1307
|
-
id: l ? `${
|
|
1309
|
+
id: l ? `${n}-collapse-${l}` : void 0,
|
|
1308
1310
|
className: [
|
|
1309
|
-
`${
|
|
1310
|
-
a && `${
|
|
1311
|
+
`${n}__collapse`,
|
|
1312
|
+
a && `${n}__collapse--show`
|
|
1311
1313
|
].filter(Boolean).join(" "),
|
|
1312
|
-
children: /* @__PURE__ */ t("div", { className: [`${
|
|
1314
|
+
children: /* @__PURE__ */ t("div", { className: [`${n}__body`, e].filter(Boolean).join(" "), ...i, children: s })
|
|
1313
1315
|
}
|
|
1314
1316
|
);
|
|
1315
1317
|
}, yt = Object.assign(Ye, {
|
|
@@ -1340,28 +1342,28 @@ const ht = ({
|
|
|
1340
1342
|
const { isOpen: s, contentRef: l, styles: a } = Re();
|
|
1341
1343
|
return s ? /* @__PURE__ */ t("div", { ref: l, className: "dropdown__content", style: a, children: e }) : null;
|
|
1342
1344
|
}, lt = ({ children: e }) => /* @__PURE__ */ t("div", { className: "dropdown__menu", children: e }), at = ({ href: e, children: s }) => /* @__PURE__ */ t("a", { href: e, className: "dropdown__item", children: s }), it = () => /* @__PURE__ */ t("hr", { className: "dropdown__separator" }), se = ({ title: e, position: s = "bottom", children: l }) => {
|
|
1343
|
-
const [a, i] = T(!1), [
|
|
1345
|
+
const [a, i] = T(!1), [n, c] = T({}), f = M(null), r = M(null), u = M(null);
|
|
1344
1346
|
return We(() => {
|
|
1345
1347
|
if (a) {
|
|
1346
|
-
const p =
|
|
1348
|
+
const p = r.current, y = u.current;
|
|
1347
1349
|
if (!p || !y) return;
|
|
1348
|
-
const
|
|
1350
|
+
const m = p.getBoundingClientRect(), d = y.getBoundingClientRect(), o = window.innerHeight, N = window.innerWidth;
|
|
1349
1351
|
let v = s;
|
|
1350
|
-
s === "bottom" &&
|
|
1352
|
+
s === "bottom" && m.bottom + d.height > o && (v = "top"), s === "top" && m.top - d.height < 0 && (v = "bottom"), s === "right" && m.right + d.width > N && (v = "left"), s === "left" && m.left - d.width < 0 && (v = "right");
|
|
1351
1353
|
const b = {};
|
|
1352
1354
|
switch (v) {
|
|
1353
1355
|
case "top":
|
|
1354
|
-
b.bottom =
|
|
1356
|
+
b.bottom = m.height + 4, b.left = m.width / 2 - d.width / 2;
|
|
1355
1357
|
break;
|
|
1356
1358
|
case "right":
|
|
1357
|
-
b.left =
|
|
1359
|
+
b.left = m.width + 4, b.top = m.height / 2 - d.height / 2;
|
|
1358
1360
|
break;
|
|
1359
1361
|
case "left":
|
|
1360
|
-
b.right =
|
|
1362
|
+
b.right = m.width + 4, b.top = m.height / 2 - d.height / 2;
|
|
1361
1363
|
break;
|
|
1362
1364
|
case "bottom":
|
|
1363
1365
|
default:
|
|
1364
|
-
b.top =
|
|
1366
|
+
b.top = m.height + 4, b.left = m.width / 2 - d.width / 2;
|
|
1365
1367
|
break;
|
|
1366
1368
|
}
|
|
1367
1369
|
c(b);
|
|
@@ -1373,7 +1375,7 @@ const ht = ({
|
|
|
1373
1375
|
return document.addEventListener("mousedown", p), () => {
|
|
1374
1376
|
document.removeEventListener("mousedown", p);
|
|
1375
1377
|
};
|
|
1376
|
-
}, []), /* @__PURE__ */ t(Se.Provider, { value: { isOpen: a, setIsOpen: i, triggerRef:
|
|
1378
|
+
}, []), /* @__PURE__ */ t(Se.Provider, { value: { isOpen: a, setIsOpen: i, triggerRef: r, contentRef: u, styles: n }, children: /* @__PURE__ */ t(
|
|
1377
1379
|
"div",
|
|
1378
1380
|
{
|
|
1379
1381
|
ref: f,
|
|
@@ -1394,17 +1396,17 @@ const De = q(null), Ae = () => {
|
|
|
1394
1396
|
throw new Error("useTabs must be used within a Tabs provider");
|
|
1395
1397
|
return e;
|
|
1396
1398
|
}, He = ({ id: e, label: s, className: l = "" }) => {
|
|
1397
|
-
const { activeTab: a, setActiveTab: i, variant:
|
|
1399
|
+
const { activeTab: a, setActiveTab: i, variant: n, orientation: c } = Ae(), f = a === e, r = [
|
|
1398
1400
|
"clarity-tab",
|
|
1399
1401
|
l,
|
|
1400
1402
|
f ? "active" : "",
|
|
1401
|
-
f ? `variant-${
|
|
1403
|
+
f ? `variant-${n}` : "",
|
|
1402
1404
|
`orientation-${c}`
|
|
1403
1405
|
].filter(Boolean).join(" ");
|
|
1404
1406
|
return /* @__PURE__ */ t(
|
|
1405
1407
|
"button",
|
|
1406
1408
|
{
|
|
1407
|
-
className:
|
|
1409
|
+
className: r,
|
|
1408
1410
|
onClick: () => i(e),
|
|
1409
1411
|
role: "tab",
|
|
1410
1412
|
"aria-selected": f,
|
|
@@ -1414,11 +1416,11 @@ const De = q(null), Ae = () => {
|
|
|
1414
1416
|
};
|
|
1415
1417
|
He.displayName = "Tabs.Tab";
|
|
1416
1418
|
const Pe = ({ id: e, children: s, className: l = "" }) => {
|
|
1417
|
-
const { activeTab: a } = Ae(), i = a === e,
|
|
1419
|
+
const { activeTab: a } = Ae(), i = a === e, n = {
|
|
1418
1420
|
visibility: i ? "visible" : "hidden",
|
|
1419
1421
|
gridArea: "1 / 1"
|
|
1420
1422
|
};
|
|
1421
|
-
return i || (
|
|
1423
|
+
return i || (n.pointerEvents = "none"), /* @__PURE__ */ t("div", { className: `clarity-tab-content ${l}`, role: "tabpanel", style: n, children: s });
|
|
1422
1424
|
};
|
|
1423
1425
|
Pe.displayName = "Tabs.Content";
|
|
1424
1426
|
const de = ({
|
|
@@ -1428,17 +1430,17 @@ const de = ({
|
|
|
1428
1430
|
orientation: a = "horizontal",
|
|
1429
1431
|
className: i = ""
|
|
1430
1432
|
}) => {
|
|
1431
|
-
const [
|
|
1432
|
-
activeTab:
|
|
1433
|
+
const [n, c] = T(s), f = te(() => ({
|
|
1434
|
+
activeTab: n,
|
|
1433
1435
|
setActiveTab: c,
|
|
1434
1436
|
variant: l,
|
|
1435
1437
|
orientation: a
|
|
1436
|
-
}), [
|
|
1438
|
+
}), [n, l, a]), r = [
|
|
1437
1439
|
"clarity-tabs-container",
|
|
1438
1440
|
i,
|
|
1439
1441
|
`orientation-${a}`
|
|
1440
1442
|
].filter(Boolean).join(" ");
|
|
1441
|
-
return /* @__PURE__ */ t(De.Provider, { value: f, children: /* @__PURE__ */ t("div", { className:
|
|
1443
|
+
return /* @__PURE__ */ t(De.Provider, { value: f, children: /* @__PURE__ */ t("div", { className: r, children: e }) });
|
|
1442
1444
|
};
|
|
1443
1445
|
de.Tab = He;
|
|
1444
1446
|
de.Content = Pe;
|
|
@@ -1449,35 +1451,35 @@ const vt = ({
|
|
|
1449
1451
|
variant: l = "primary",
|
|
1450
1452
|
product: a,
|
|
1451
1453
|
tone: i,
|
|
1452
|
-
bgColor:
|
|
1454
|
+
bgColor: n,
|
|
1453
1455
|
textColor: c,
|
|
1454
1456
|
children: f,
|
|
1455
|
-
className:
|
|
1456
|
-
disabled:
|
|
1457
|
+
className: r = "",
|
|
1458
|
+
disabled: u = !1,
|
|
1457
1459
|
delay: p = 200,
|
|
1458
1460
|
hideDelay: y = 100,
|
|
1459
|
-
trigger:
|
|
1461
|
+
trigger: m = "hover",
|
|
1460
1462
|
arrow: d = !0,
|
|
1461
1463
|
...o
|
|
1462
1464
|
}) => {
|
|
1463
|
-
const [N, v] = T(!1), [b, w] = T(null), j =
|
|
1465
|
+
const [N, v] = T(!1), [b, w] = T(null), j = M(null), g = M(null), _ = "clarity-tooltip", k = !!n, L = a && i && !k;
|
|
1464
1466
|
let x = "";
|
|
1465
|
-
k ? x = `${_}__content--custom-bg` :
|
|
1467
|
+
k ? x = `${_}__content--custom-bg` : L ? x = `${_}__content--custom` : x = `${_}__content--${l}`;
|
|
1466
1468
|
const B = [
|
|
1467
1469
|
_,
|
|
1468
1470
|
`${_}--${s}`,
|
|
1469
|
-
|
|
1471
|
+
r
|
|
1470
1472
|
].filter(Boolean).join(" "), I = [
|
|
1471
1473
|
`${_}__content`,
|
|
1472
1474
|
x,
|
|
1473
1475
|
d && `${_}__content--arrow`
|
|
1474
|
-
].filter(Boolean).join(" "), A = {},
|
|
1475
|
-
k &&
|
|
1476
|
+
].filter(Boolean).join(" "), A = {}, E = {};
|
|
1477
|
+
k && n && (E["--tooltip-bg-color"] = n), c && (E["--tooltip-text-color"] = c), L && a && i && (E["--tooltip-product"] = a, E["--tooltip-tone"] = i);
|
|
1476
1478
|
const $ = {
|
|
1477
1479
|
...A,
|
|
1478
|
-
...Object.keys(
|
|
1479
|
-
},
|
|
1480
|
-
if (
|
|
1480
|
+
...Object.keys(E).length > 0 ? E : {}
|
|
1481
|
+
}, V = () => {
|
|
1482
|
+
if (u) return;
|
|
1481
1483
|
b && clearTimeout(b);
|
|
1482
1484
|
const P = setTimeout(() => {
|
|
1483
1485
|
v(!0);
|
|
@@ -1490,9 +1492,9 @@ const vt = ({
|
|
|
1490
1492
|
}, y);
|
|
1491
1493
|
w(P);
|
|
1492
1494
|
}, F = () => {
|
|
1493
|
-
|
|
1495
|
+
u || v(!N);
|
|
1494
1496
|
}, Q = () => {
|
|
1495
|
-
|
|
1497
|
+
u || V();
|
|
1496
1498
|
}, K = () => {
|
|
1497
1499
|
H();
|
|
1498
1500
|
};
|
|
@@ -1500,7 +1502,7 @@ const vt = ({
|
|
|
1500
1502
|
b && clearTimeout(b);
|
|
1501
1503
|
}, [b]);
|
|
1502
1504
|
const U = {};
|
|
1503
|
-
return
|
|
1505
|
+
return m === "hover" ? (U.onMouseEnter = V, U.onMouseLeave = H) : m === "click" ? U.onClick = F : m === "focus" && (U.onFocus = Q, U.onBlur = K), /* @__PURE__ */ C(
|
|
1504
1506
|
"div",
|
|
1505
1507
|
{
|
|
1506
1508
|
ref: g,
|
|
@@ -1523,7 +1525,7 @@ const vt = ({
|
|
|
1523
1525
|
]
|
|
1524
1526
|
}
|
|
1525
1527
|
);
|
|
1526
|
-
},
|
|
1528
|
+
}, rt = ({ columns: e, viewMode: s }) => {
|
|
1527
1529
|
const l = Array.from({ length: 5 }, (a, i) => i);
|
|
1528
1530
|
return s === "card" ? /* @__PURE__ */ C("div", { className: "card-view-wrapper is-loading", children: [
|
|
1529
1531
|
/* @__PURE__ */ t("div", { className: "skeleton card-view-header" }),
|
|
@@ -1538,16 +1540,16 @@ const vt = ({
|
|
|
1538
1540
|
data: l,
|
|
1539
1541
|
viewMode: a = "table",
|
|
1540
1542
|
isScrollable: i = !1,
|
|
1541
|
-
isLoading:
|
|
1543
|
+
isLoading: n = !1
|
|
1542
1544
|
}) => {
|
|
1543
|
-
const [c, f] = T(null), [
|
|
1544
|
-
o.sortable && (c === o.key ?
|
|
1545
|
-
}, y = te(() =>
|
|
1545
|
+
const [c, f] = T(null), [r, u] = T("none"), p = (o) => {
|
|
1546
|
+
o.sortable && (c === o.key ? u((N) => N === "asc" ? "desc" : N === "desc" ? "none" : "asc") : (f(o.key), u("asc")));
|
|
1547
|
+
}, y = te(() => r === "none" || !c ? l : [...l].sort((o, N) => {
|
|
1546
1548
|
const v = o[c], b = N[c];
|
|
1547
|
-
return v < b ?
|
|
1548
|
-
}), [l, c,
|
|
1549
|
-
if (
|
|
1550
|
-
return /* @__PURE__ */ t(
|
|
1549
|
+
return v < b ? r === "asc" ? -1 : 1 : v > b ? r === "asc" ? 1 : -1 : 0;
|
|
1550
|
+
}), [l, c, r]), m = (o) => o.sortable ? c !== o.key || r === "none" ? /* @__PURE__ */ t("span", { className: "sort-icon", children: "↕" }) : r === "asc" ? /* @__PURE__ */ t("span", { className: "sort-icon", children: "↑" }) : /* @__PURE__ */ t("span", { className: "sort-icon", children: "↓" }) : null;
|
|
1551
|
+
if (n)
|
|
1552
|
+
return /* @__PURE__ */ t(rt, { columns: s, viewMode: a });
|
|
1551
1553
|
const d = `table-variant-${e} ${i ? "is-scrollable" : ""}`;
|
|
1552
1554
|
return a === "card" ? /* @__PURE__ */ C("div", { className: `card-view-wrapper ${d}`, children: [
|
|
1553
1555
|
/* @__PURE__ */ t("div", { className: `card-view-header table-header-cell-${e}`, children: s.map((o) => /* @__PURE__ */ C(
|
|
@@ -1558,7 +1560,7 @@ const vt = ({
|
|
|
1558
1560
|
style: { minWidth: o.minWidth },
|
|
1559
1561
|
children: [
|
|
1560
1562
|
o.header,
|
|
1561
|
-
|
|
1563
|
+
m(o)
|
|
1562
1564
|
]
|
|
1563
1565
|
},
|
|
1564
1566
|
o.key
|
|
@@ -1573,7 +1575,7 @@ const vt = ({
|
|
|
1573
1575
|
style: { minWidth: o.minWidth },
|
|
1574
1576
|
children: [
|
|
1575
1577
|
o.header,
|
|
1576
|
-
|
|
1578
|
+
m(o)
|
|
1577
1579
|
]
|
|
1578
1580
|
},
|
|
1579
1581
|
o.key
|
|
@@ -1586,34 +1588,34 @@ const vt = ({
|
|
|
1586
1588
|
tone: l,
|
|
1587
1589
|
size: a = "medium",
|
|
1588
1590
|
color: i,
|
|
1589
|
-
className:
|
|
1591
|
+
className: n = "",
|
|
1590
1592
|
"aria-label": c = "Carregando...",
|
|
1591
1593
|
...f
|
|
1592
1594
|
}) => {
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
`${
|
|
1595
|
+
const r = "clarity-spinner", y = i ? `${r}--custom` : s && l ? `${r}--custom` : `${r}--${e}`, m = [
|
|
1596
|
+
r,
|
|
1597
|
+
`${r}--${a}`,
|
|
1596
1598
|
y,
|
|
1597
|
-
|
|
1599
|
+
n
|
|
1598
1600
|
].filter(Boolean).join(" "), d = {};
|
|
1599
1601
|
return i ? d["--spinner-color"] = i : s && l && (d["--spinner-color"] = `var(--clarity-${s}-${l})`), /* @__PURE__ */ t(
|
|
1600
1602
|
"div",
|
|
1601
1603
|
{
|
|
1602
|
-
className:
|
|
1604
|
+
className: m,
|
|
1603
1605
|
style: d,
|
|
1604
1606
|
role: "status",
|
|
1605
1607
|
"aria-label": c,
|
|
1606
1608
|
...f,
|
|
1607
|
-
children: /* @__PURE__ */ t("div", { className: `${
|
|
1609
|
+
children: /* @__PURE__ */ t("div", { className: `${r}__container`, children: /* @__PURE__ */ t(
|
|
1608
1610
|
"svg",
|
|
1609
1611
|
{
|
|
1610
|
-
className: `${
|
|
1612
|
+
className: `${r}__svg`,
|
|
1611
1613
|
viewBox: "0 0 50 50",
|
|
1612
1614
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1613
1615
|
children: /* @__PURE__ */ t(
|
|
1614
1616
|
"circle",
|
|
1615
1617
|
{
|
|
1616
|
-
className: `${
|
|
1618
|
+
className: `${r}__circle`,
|
|
1617
1619
|
cx: "25",
|
|
1618
1620
|
cy: "25",
|
|
1619
1621
|
r: "20",
|