@versaur/react 1.0.14 → 1.0.15
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/blocks.d.ts +37 -0
- package/dist/blocks.js +495 -452
- package/dist/{drawer-DRv9k7lp.js → drawer-BjNHPqBr.js} +2 -2
- package/dist/forms.js +136 -139
- package/dist/helpers-D23F5WBX.js +159 -0
- package/dist/{overlay-parts-CFeD8VN0.js → overlay-parts-BtD-Qj_k.js} +3 -3
- package/dist/primitive.d.ts +11 -0
- package/dist/primitive.js +16 -204
- package/dist/tooltip-Cn7Ml9vw.js +364 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/helpers-DTL6qrTe.js +0 -129
- package/dist/tooltip-BMKVL6jz.js +0 -170
|
@@ -3,9 +3,9 @@ import { drawerStyles as L } from "@versaur/core/blocks";
|
|
|
3
3
|
import { overlayPartsStyles as i } from "@versaur/core/utils";
|
|
4
4
|
import { XIcon as j } from "@versaur/icons";
|
|
5
5
|
import F, { useRef as H, useEffect as n, useCallback as A, createContext as I, forwardRef as u, useContext as P } from "react";
|
|
6
|
-
import { u as S, B as M } from "./helpers-
|
|
6
|
+
import { u as S, B as M } from "./helpers-D23F5WBX.js";
|
|
7
7
|
import { c as D } from "./cx-B9vmfsc1.js";
|
|
8
|
-
import { O as X,
|
|
8
|
+
import { O as X, a as q, b as z } from "./overlay-parts-BtD-Qj_k.js";
|
|
9
9
|
const y = F.forwardRef(
|
|
10
10
|
({ isOpen: e, onOpenChange: t, children: a, onClick: s, ...d }, l) => {
|
|
11
11
|
const m = H(null), c = l || m;
|
package/dist/forms.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { labelStyles as
|
|
3
|
-
import { forwardRef as f, useId as A, createContext as
|
|
4
|
-
import { u as N, c as
|
|
5
|
-
import { c as
|
|
6
|
-
import { ChevronDownIcon as
|
|
7
|
-
import { D as
|
|
1
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { labelStyles as Se, helperTextStyles as ke, errorTextStyles as Be, textInputStyles as D, textAreaStyles as K, selectStyles as _, radioStyles as j, checkboxStyles as L, radioGroupStyles as J, checkboxGroupStyles as U, chipInputStyles as M, comboboxInputStyles as v } from "@versaur/core/forms";
|
|
3
|
+
import { forwardRef as f, useId as A, createContext as Q, useContext as F, useState as $, useEffect as E, useCallback as P, useRef as Re } from "react";
|
|
4
|
+
import { u as N, c as Ae, F as Ge } from "./helpers-D23F5WBX.js";
|
|
5
|
+
import { c as g } from "./cx-B9vmfsc1.js";
|
|
6
|
+
import { ChevronDownIcon as De, CheckIcon as $e } from "@versaur/icons";
|
|
7
|
+
import { D as W } from "./drawer-BjNHPqBr.js";
|
|
8
8
|
const k = f(
|
|
9
9
|
({ required: e = !1, disabled: c = !1, children: i, className: a, ...n }, t) => {
|
|
10
10
|
const o = N({
|
|
11
11
|
disabled: c,
|
|
12
12
|
required: e
|
|
13
13
|
});
|
|
14
|
-
return /* @__PURE__ */ s("label", { ref: t, className:
|
|
14
|
+
return /* @__PURE__ */ s("label", { ref: t, className: g(Se.label, a), ...o, ...n, children: i });
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
17
|
k.displayName = "Label";
|
|
18
|
-
const B = f(({ children: e, className: c, ...i }, a) => /* @__PURE__ */ s("p", { ref: a, className:
|
|
18
|
+
const B = f(({ children: e, className: c, ...i }, a) => /* @__PURE__ */ s("p", { ref: a, className: g(ke.helper, c), ...i, children: e }));
|
|
19
19
|
B.displayName = "HelperText";
|
|
20
|
-
const R = f(({ children: e, className: c, ...i }, a) => /* @__PURE__ */ s("p", { ref: a, className:
|
|
20
|
+
const R = f(({ children: e, className: c, ...i }, a) => /* @__PURE__ */ s("p", { ref: a, className: g(Be.error, c), role: "alert", "aria-live": "polite", ...i, children: e }));
|
|
21
21
|
R.displayName = "ErrorText";
|
|
22
|
-
const
|
|
22
|
+
const Ee = f(
|
|
23
23
|
({
|
|
24
24
|
label: e,
|
|
25
25
|
helper: c,
|
|
@@ -40,17 +40,17 @@ const $e = f(
|
|
|
40
40
|
invalid: !!i,
|
|
41
41
|
readOnly: t
|
|
42
42
|
});
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ y("div", { className: g(D.field, d), children: [
|
|
44
44
|
e && /* @__PURE__ */ s(k, { htmlFor: m, required: a, disabled: n, children: e }),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
o && /* @__PURE__ */ s("span", { className:
|
|
45
|
+
/* @__PURE__ */ y("div", { className: D.wrapper, ...I, children: [
|
|
46
|
+
o && /* @__PURE__ */ s("span", { className: D["left-icon"], children: o }),
|
|
47
47
|
/* @__PURE__ */ s(
|
|
48
48
|
"input",
|
|
49
49
|
{
|
|
50
50
|
ref: h,
|
|
51
51
|
id: m,
|
|
52
52
|
type: "text",
|
|
53
|
-
className:
|
|
53
|
+
className: D.input,
|
|
54
54
|
disabled: n,
|
|
55
55
|
readOnly: t,
|
|
56
56
|
required: a,
|
|
@@ -60,15 +60,15 @@ const $e = f(
|
|
|
60
60
|
...u
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
|
-
r && /* @__PURE__ */ s("span", { className:
|
|
63
|
+
r && /* @__PURE__ */ s("span", { className: D["right-icon"], children: r })
|
|
64
64
|
] }),
|
|
65
65
|
i && /* @__PURE__ */ s(R, { id: x, children: i }),
|
|
66
66
|
!i && c && /* @__PURE__ */ s(B, { id: p, children: c })
|
|
67
67
|
] });
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
-
|
|
71
|
-
const
|
|
70
|
+
Ee.displayName = "TextInput";
|
|
71
|
+
const Te = f(
|
|
72
72
|
({
|
|
73
73
|
label: e,
|
|
74
74
|
helper: c,
|
|
@@ -94,7 +94,7 @@ const Ee = f(
|
|
|
94
94
|
"--_min-rows-count": r,
|
|
95
95
|
...l && { "--_max-rows-count": l }
|
|
96
96
|
};
|
|
97
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ y("div", { className: g(K.field, u), children: [
|
|
98
98
|
e && /* @__PURE__ */ s(k, { htmlFor: p, required: a, disabled: n, children: e }),
|
|
99
99
|
/* @__PURE__ */ s(
|
|
100
100
|
"textarea",
|
|
@@ -118,9 +118,9 @@ const Ee = f(
|
|
|
118
118
|
] });
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
Te.displayName = "TextArea";
|
|
122
|
+
const X = f(({ children: e, ...c }, i) => /* @__PURE__ */ s("option", { ref: i, ...c, children: e }));
|
|
123
|
+
X.displayName = "Select.Option";
|
|
124
124
|
const Y = f(
|
|
125
125
|
({ label: e, children: c, ...i }, a) => /* @__PURE__ */ s("optgroup", { ref: a, label: e, ...i, children: c })
|
|
126
126
|
);
|
|
@@ -142,9 +142,9 @@ const Z = f(
|
|
|
142
142
|
disabled: n,
|
|
143
143
|
invalid: !!i
|
|
144
144
|
});
|
|
145
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ y("div", { className: g(_.field, l), children: [
|
|
146
146
|
e && /* @__PURE__ */ s(k, { htmlFor: b, required: a, disabled: n, children: e }),
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ y(
|
|
148
148
|
"select",
|
|
149
149
|
{
|
|
150
150
|
ref: u,
|
|
@@ -170,17 +170,17 @@ const Z = f(
|
|
|
170
170
|
);
|
|
171
171
|
Z.displayName = "Select";
|
|
172
172
|
const q = Z;
|
|
173
|
-
q.Option =
|
|
173
|
+
q.Option = X;
|
|
174
174
|
q.OptionGroup = Y;
|
|
175
175
|
const ee = f(
|
|
176
176
|
({ disabled: e = !1, children: c, className: i, ...a }, n) => {
|
|
177
177
|
const t = N({
|
|
178
178
|
disabled: e
|
|
179
179
|
});
|
|
180
|
-
return /* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */ s("input", { ref: n, type: "radio", className:
|
|
182
|
-
/* @__PURE__ */ s("span", { className:
|
|
183
|
-
c && /* @__PURE__ */ s("span", { className:
|
|
180
|
+
return /* @__PURE__ */ y("label", { className: g(j.radio, i), ...t, children: [
|
|
181
|
+
/* @__PURE__ */ s("input", { ref: n, type: "radio", className: j.input, disabled: e, ...a }),
|
|
182
|
+
/* @__PURE__ */ s("span", { className: j.indicator }),
|
|
183
|
+
c && /* @__PURE__ */ s("span", { className: j.label, children: c })
|
|
184
184
|
] });
|
|
185
185
|
}
|
|
186
186
|
);
|
|
@@ -191,28 +191,28 @@ const te = f(
|
|
|
191
191
|
disabled: e,
|
|
192
192
|
required: c
|
|
193
193
|
});
|
|
194
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ y("label", { className: g(L.checkbox, a), ...o, children: [
|
|
195
195
|
/* @__PURE__ */ s(
|
|
196
196
|
"input",
|
|
197
197
|
{
|
|
198
198
|
ref: t,
|
|
199
199
|
type: "checkbox",
|
|
200
|
-
className:
|
|
200
|
+
className: L.input,
|
|
201
201
|
disabled: e,
|
|
202
202
|
required: c,
|
|
203
203
|
"aria-required": c || void 0,
|
|
204
204
|
...n
|
|
205
205
|
}
|
|
206
206
|
),
|
|
207
|
-
/* @__PURE__ */ s("span", { className:
|
|
208
|
-
i && /* @__PURE__ */ s("span", { className:
|
|
207
|
+
/* @__PURE__ */ s("span", { className: L.indicator }),
|
|
208
|
+
i && /* @__PURE__ */ s("span", { className: L.label, "data-required": c || void 0, children: i })
|
|
209
209
|
] });
|
|
210
210
|
}
|
|
211
211
|
);
|
|
212
212
|
te.displayName = "Checkbox";
|
|
213
|
-
const oe =
|
|
214
|
-
function
|
|
215
|
-
const e =
|
|
213
|
+
const oe = Q(void 0);
|
|
214
|
+
function je() {
|
|
215
|
+
const e = F(oe);
|
|
216
216
|
if (!e)
|
|
217
217
|
throw new Error("RadioGroup.Option must be used within RadioGroup");
|
|
218
218
|
return e;
|
|
@@ -237,12 +237,12 @@ const ne = f(
|
|
|
237
237
|
}, O = N({
|
|
238
238
|
disabled: r
|
|
239
239
|
});
|
|
240
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ y("div", { ref: b, className: g(J.field, u), ...O, ...h, children: [
|
|
241
241
|
a && /* @__PURE__ */ s(k, { required: o, disabled: r, children: a }),
|
|
242
242
|
/* @__PURE__ */ s(oe.Provider, { value: { disabled: r, name: i, onChange: w, value: e }, children: /* @__PURE__ */ s(
|
|
243
243
|
"div",
|
|
244
244
|
{
|
|
245
|
-
className:
|
|
245
|
+
className: J.options,
|
|
246
246
|
"data-direction": l,
|
|
247
247
|
role: "radiogroup",
|
|
248
248
|
"aria-describedby": I || void 0,
|
|
@@ -258,7 +258,7 @@ const ne = f(
|
|
|
258
258
|
ne.displayName = "RadioGroup";
|
|
259
259
|
const ie = f(
|
|
260
260
|
({ value: e, children: c, disabled: i, ...a }, n) => {
|
|
261
|
-
const t =
|
|
261
|
+
const t = je(), o = t.value === e, r = t.disabled || i, l = () => {
|
|
262
262
|
r || t.onChange(e);
|
|
263
263
|
};
|
|
264
264
|
return /* @__PURE__ */ s(
|
|
@@ -277,11 +277,11 @@ const ie = f(
|
|
|
277
277
|
}
|
|
278
278
|
);
|
|
279
279
|
ie.displayName = "RadioGroup.Option";
|
|
280
|
-
const
|
|
280
|
+
const Ue = Object.assign(ne, {
|
|
281
281
|
Option: ie
|
|
282
|
-
}), se =
|
|
283
|
-
function
|
|
284
|
-
const e =
|
|
282
|
+
}), se = Q(void 0);
|
|
283
|
+
function Le() {
|
|
284
|
+
const e = F(se);
|
|
285
285
|
if (!e)
|
|
286
286
|
throw new Error("CheckboxGroup.Option must be used within CheckboxGroup");
|
|
287
287
|
return e;
|
|
@@ -306,12 +306,12 @@ const ae = f(
|
|
|
306
306
|
}, O = N({
|
|
307
307
|
disabled: r
|
|
308
308
|
});
|
|
309
|
-
return /* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ y("div", { ref: b, className: g(U.field, u), ...O, ...h, children: [
|
|
310
310
|
a && /* @__PURE__ */ s(k, { required: o, disabled: r, children: a }),
|
|
311
311
|
/* @__PURE__ */ s(se.Provider, { value: { disabled: r, name: i, onChange: w, value: e }, children: /* @__PURE__ */ s(
|
|
312
312
|
"div",
|
|
313
313
|
{
|
|
314
|
-
className:
|
|
314
|
+
className: U.options,
|
|
315
315
|
"data-direction": l,
|
|
316
316
|
role: "group",
|
|
317
317
|
"aria-describedby": I || void 0,
|
|
@@ -327,7 +327,7 @@ const ae = f(
|
|
|
327
327
|
ae.displayName = "CheckboxGroup";
|
|
328
328
|
const ce = f(
|
|
329
329
|
({ value: e, children: c, disabled: i, ...a }, n) => {
|
|
330
|
-
const t =
|
|
330
|
+
const t = Le(), o = t.value.includes(e), r = t.disabled || i, l = () => {
|
|
331
331
|
if (!r) {
|
|
332
332
|
const d = o ? t.value.filter((u) => u !== e) : [...t.value, e];
|
|
333
333
|
t.onChange(d);
|
|
@@ -349,11 +349,11 @@ const ce = f(
|
|
|
349
349
|
}
|
|
350
350
|
);
|
|
351
351
|
ce.displayName = "CheckboxGroup.Option";
|
|
352
|
-
const
|
|
352
|
+
const We = Object.assign(ae, {
|
|
353
353
|
Option: ce
|
|
354
|
-
}), re =
|
|
355
|
-
function
|
|
356
|
-
const e =
|
|
354
|
+
}), re = Q(void 0);
|
|
355
|
+
function Pe() {
|
|
356
|
+
const e = F(re);
|
|
357
357
|
if (!e)
|
|
358
358
|
throw new Error("ChipInput.Option must be used within ChipInput");
|
|
359
359
|
return e;
|
|
@@ -377,10 +377,10 @@ const le = f(
|
|
|
377
377
|
}, p) => {
|
|
378
378
|
const x = A(), C = m.id || x, I = t ? `${C}-helper` : void 0, w = o ? `${C}-error` : void 0, O = [I, w].filter(Boolean).join(" "), S = (z) => {
|
|
379
379
|
l || c(z);
|
|
380
|
-
},
|
|
380
|
+
}, G = N({
|
|
381
381
|
invalid: !!o
|
|
382
|
-
}),
|
|
383
|
-
return /* @__PURE__ */
|
|
382
|
+
}), V = i ? "group" : "radiogroup";
|
|
383
|
+
return /* @__PURE__ */ y("div", { ref: p, className: g(M.field, b), ...G, ...m, children: [
|
|
384
384
|
n && /* @__PURE__ */ s(k, { required: r, disabled: l, children: n }),
|
|
385
385
|
/* @__PURE__ */ s(
|
|
386
386
|
re.Provider,
|
|
@@ -398,7 +398,7 @@ const le = f(
|
|
|
398
398
|
className: M.options,
|
|
399
399
|
"data-gap": d,
|
|
400
400
|
"data-wrap": u,
|
|
401
|
-
role:
|
|
401
|
+
role: V,
|
|
402
402
|
"aria-describedby": O || void 0,
|
|
403
403
|
"aria-invalid": o ? "true" : void 0,
|
|
404
404
|
children: h
|
|
@@ -414,7 +414,7 @@ const le = f(
|
|
|
414
414
|
le.displayName = "ChipInput";
|
|
415
415
|
const de = f(
|
|
416
416
|
({ value: e, children: c, disabled: i, iconLeft: a, iconRight: n, ...t }, o) => {
|
|
417
|
-
const r =
|
|
417
|
+
const r = Pe(), l = r.disabled || i, d = !!(a || n);
|
|
418
418
|
let u = !1;
|
|
419
419
|
r.multiple ? u = Array.isArray(r.value) && r.value.includes(e) : u = r.value === e;
|
|
420
420
|
const h = () => {
|
|
@@ -429,7 +429,7 @@ const de = f(
|
|
|
429
429
|
selected: u,
|
|
430
430
|
...d && { "has-icon": !0 }
|
|
431
431
|
});
|
|
432
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ y(
|
|
433
433
|
"button",
|
|
434
434
|
{
|
|
435
435
|
ref: o,
|
|
@@ -450,19 +450,19 @@ const de = f(
|
|
|
450
450
|
}
|
|
451
451
|
);
|
|
452
452
|
de.displayName = "ChipInput.Option";
|
|
453
|
-
const
|
|
453
|
+
const Xe = Object.assign(le, {
|
|
454
454
|
Option: de
|
|
455
|
-
}), pe =
|
|
456
|
-
function
|
|
457
|
-
const e =
|
|
455
|
+
}), pe = Q(void 0);
|
|
456
|
+
function T() {
|
|
457
|
+
const e = F(pe);
|
|
458
458
|
if (!e)
|
|
459
459
|
throw new Error("ComboboxInput subcomponents must be used within ComboboxInput");
|
|
460
460
|
return e;
|
|
461
461
|
}
|
|
462
462
|
const ue = f(
|
|
463
463
|
({ children: e, className: c, ...i }, a) => {
|
|
464
|
-
const n =
|
|
465
|
-
return /* @__PURE__ */ s(
|
|
464
|
+
const n = T();
|
|
465
|
+
return /* @__PURE__ */ s(W, { open: n.isOpen, onOpenChange: (t) => !t && n.closeListbox(), placement: "right", children: /* @__PURE__ */ s(W.Body, { children: /* @__PURE__ */ y("div", { className: v["drawer-container"], children: [
|
|
466
466
|
/* @__PURE__ */ s("div", { className: v["drawer-input-wrapper"], children: /* @__PURE__ */ s(
|
|
467
467
|
"input",
|
|
468
468
|
{
|
|
@@ -483,7 +483,7 @@ const ue = f(
|
|
|
483
483
|
ref: a,
|
|
484
484
|
role: "listbox",
|
|
485
485
|
"aria-multiselectable": "true",
|
|
486
|
-
className:
|
|
486
|
+
className: g(v["drawer-listbox"], c),
|
|
487
487
|
...i,
|
|
488
488
|
children: e
|
|
489
489
|
}
|
|
@@ -492,21 +492,21 @@ const ue = f(
|
|
|
492
492
|
}
|
|
493
493
|
);
|
|
494
494
|
ue.displayName = "ComboboxInput.Drawer";
|
|
495
|
-
function
|
|
496
|
-
const [c, i] =
|
|
497
|
-
|
|
495
|
+
function Qe(e) {
|
|
496
|
+
const [c, i] = $(e), [a, n] = $(!1), [t, o] = $(() => /* @__PURE__ */ new Map());
|
|
497
|
+
E(() => {
|
|
498
498
|
i(e);
|
|
499
499
|
}, [e]);
|
|
500
|
-
const r =
|
|
500
|
+
const r = P(() => {
|
|
501
501
|
n((h) => !h);
|
|
502
|
-
}, []), l =
|
|
502
|
+
}, []), l = P(() => {
|
|
503
503
|
n(!1);
|
|
504
|
-
}, []), d =
|
|
504
|
+
}, []), d = P((h, b) => {
|
|
505
505
|
o((m) => {
|
|
506
506
|
const p = new Map(m);
|
|
507
507
|
return p.set(h, b), p;
|
|
508
508
|
});
|
|
509
|
-
}, []), u =
|
|
509
|
+
}, []), u = P((h) => {
|
|
510
510
|
o((b) => {
|
|
511
511
|
const m = new Map(b);
|
|
512
512
|
return m.delete(h), m;
|
|
@@ -523,9 +523,9 @@ function Pe(e) {
|
|
|
523
523
|
unregisterOption: u
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
function
|
|
527
|
-
const [i, a] =
|
|
528
|
-
return
|
|
526
|
+
function Fe(e, c) {
|
|
527
|
+
const [i, a] = $("bottom"), n = Re(null);
|
|
528
|
+
return E(() => {
|
|
529
529
|
if (c !== "popup" || !e) return;
|
|
530
530
|
const t = n.current;
|
|
531
531
|
if (!t) return;
|
|
@@ -535,7 +535,7 @@ function Qe(e, c) {
|
|
|
535
535
|
const l = r.getBoundingClientRect(), d = t.getBoundingClientRect(), u = {
|
|
536
536
|
width: d.width,
|
|
537
537
|
height: d.height
|
|
538
|
-
}, h =
|
|
538
|
+
}, h = Ae(
|
|
539
539
|
l,
|
|
540
540
|
u,
|
|
541
541
|
100,
|
|
@@ -547,8 +547,8 @@ function Qe(e, c) {
|
|
|
547
547
|
}
|
|
548
548
|
const he = f(
|
|
549
549
|
({ children: e, className: c, ...i }, a) => {
|
|
550
|
-
const n =
|
|
551
|
-
|
|
550
|
+
const n = T(), { internalRef: t, placement: o } = Fe(n.isOpen, n.variant);
|
|
551
|
+
E(() => {
|
|
552
552
|
const l = t.current;
|
|
553
553
|
if (!l) return;
|
|
554
554
|
const d = () => {
|
|
@@ -565,14 +565,14 @@ const he = f(
|
|
|
565
565
|
},
|
|
566
566
|
role: "listbox",
|
|
567
567
|
"aria-multiselectable": "true",
|
|
568
|
-
className:
|
|
568
|
+
className: g(v.listbox, c),
|
|
569
569
|
popover: "auto",
|
|
570
570
|
...r,
|
|
571
571
|
style: {
|
|
572
572
|
positionAnchor: n.anchorName
|
|
573
573
|
},
|
|
574
574
|
...i,
|
|
575
|
-
children: /* @__PURE__ */
|
|
575
|
+
children: /* @__PURE__ */ y("div", { className: v["listbox-inner"], children: [
|
|
576
576
|
/* @__PURE__ */ s("div", { className: v["drawer-input-wrapper"], children: /* @__PURE__ */ s(
|
|
577
577
|
"input",
|
|
578
578
|
{
|
|
@@ -609,57 +609,58 @@ const me = f(
|
|
|
609
609
|
className: u,
|
|
610
610
|
...h
|
|
611
611
|
}, b) => {
|
|
612
|
-
const m = A(), p = h.id || m, x = o ? `${p}-helper` : void 0,
|
|
613
|
-
internalValue:
|
|
614
|
-
setInternalValue:
|
|
612
|
+
const m = A(), p = h.id || m, x = `${p}-button`, C = o ? `${p}-helper` : void 0, I = r ? `${p}-error` : void 0, w = [C, I].filter(Boolean).join(" "), O = `--combobox-anchor-${p.replace(/[^a-z0-9-]/gi, "")}`, {
|
|
613
|
+
internalValue: S,
|
|
614
|
+
setInternalValue: G,
|
|
615
615
|
isOpen: V,
|
|
616
|
-
toggleOpen:
|
|
617
|
-
closeListbox:
|
|
616
|
+
toggleOpen: z,
|
|
617
|
+
closeListbox: Ce,
|
|
618
618
|
optionRegistry: ve,
|
|
619
|
-
registerOption:
|
|
620
|
-
unregisterOption:
|
|
621
|
-
} =
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}, [e,
|
|
625
|
-
const
|
|
626
|
-
a || (
|
|
627
|
-
},
|
|
619
|
+
registerOption: ge,
|
|
620
|
+
unregisterOption: ye
|
|
621
|
+
} = Qe(e), [Ne, Ie] = $("");
|
|
622
|
+
E(() => {
|
|
623
|
+
G(e);
|
|
624
|
+
}, [e, G]);
|
|
625
|
+
const we = (H) => {
|
|
626
|
+
a || (G(H), c(H));
|
|
627
|
+
}, Oe = N({
|
|
628
628
|
invalid: !!(r || n),
|
|
629
629
|
disabled: a
|
|
630
630
|
});
|
|
631
|
-
return /* @__PURE__ */
|
|
632
|
-
t && /* @__PURE__ */ s(k, { required: l, disabled: a, children: t }),
|
|
631
|
+
return /* @__PURE__ */ y("div", { ref: b, className: g(v.field, u), ...Oe, ...h, children: [
|
|
632
|
+
t && /* @__PURE__ */ s(k, { required: l, disabled: a, htmlFor: x, children: t }),
|
|
633
633
|
/* @__PURE__ */ s(
|
|
634
634
|
pe.Provider,
|
|
635
635
|
{
|
|
636
636
|
value: {
|
|
637
|
-
value:
|
|
638
|
-
onChange:
|
|
637
|
+
value: S,
|
|
638
|
+
onChange: we,
|
|
639
639
|
isOpen: V,
|
|
640
|
-
toggleOpen:
|
|
641
|
-
closeListbox:
|
|
640
|
+
toggleOpen: z,
|
|
641
|
+
closeListbox: Ce,
|
|
642
642
|
variant: i,
|
|
643
|
-
anchorName:
|
|
643
|
+
anchorName: O,
|
|
644
|
+
buttonId: x,
|
|
644
645
|
optionRegistry: ve,
|
|
645
|
-
registerOption:
|
|
646
|
-
unregisterOption:
|
|
646
|
+
registerOption: ge,
|
|
647
|
+
unregisterOption: ye,
|
|
647
648
|
disabled: a,
|
|
648
|
-
searchQuery:
|
|
649
|
-
setSearchQuery:
|
|
649
|
+
searchQuery: Ne,
|
|
650
|
+
setSearchQuery: Ie
|
|
650
651
|
},
|
|
651
|
-
children: /* @__PURE__ */ s("div", { className: v.root, "aria-describedby":
|
|
652
|
+
children: /* @__PURE__ */ s("div", { className: v.root, "aria-describedby": w || void 0, children: d })
|
|
652
653
|
}
|
|
653
654
|
),
|
|
654
|
-
r && /* @__PURE__ */ s(R, { id:
|
|
655
|
-
!r && o && /* @__PURE__ */ s(B, { id:
|
|
655
|
+
r && /* @__PURE__ */ s(R, { id: I, children: r }),
|
|
656
|
+
!r && o && S.length === 0 && /* @__PURE__ */ s(B, { id: C, children: o })
|
|
656
657
|
] });
|
|
657
658
|
}
|
|
658
659
|
);
|
|
659
660
|
me.displayName = "ComboboxInput";
|
|
660
661
|
const be = f(
|
|
661
662
|
({ children: e, className: c, iconLeft: i, iconRight: a, ...n }, t) => {
|
|
662
|
-
const o =
|
|
663
|
+
const o = T(), r = o.value.length === 0, l = N({
|
|
663
664
|
open: o.isOpen,
|
|
664
665
|
disabled: o.disabled,
|
|
665
666
|
"has-left-icon": !!i,
|
|
@@ -667,12 +668,13 @@ const be = f(
|
|
|
667
668
|
}), d = {
|
|
668
669
|
anchorName: o.anchorName
|
|
669
670
|
}, u = e || (r ? "Select" : `${o.value.length} selected`);
|
|
670
|
-
return /* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ y(
|
|
671
672
|
"button",
|
|
672
673
|
{
|
|
673
674
|
ref: t,
|
|
675
|
+
id: o.buttonId,
|
|
674
676
|
type: "button",
|
|
675
|
-
className:
|
|
677
|
+
className: g(v.button, c),
|
|
676
678
|
onClick: () => !o.disabled && o.toggleOpen(),
|
|
677
679
|
disabled: o.disabled,
|
|
678
680
|
"aria-expanded": o.isOpen,
|
|
@@ -683,7 +685,7 @@ const be = f(
|
|
|
683
685
|
children: [
|
|
684
686
|
i && /* @__PURE__ */ s("span", { className: v["left-icon"], children: i }),
|
|
685
687
|
/* @__PURE__ */ s("span", { className: v["button-content"], ...r && { "data-placeholder": "" }, children: u }),
|
|
686
|
-
a ? /* @__PURE__ */ s("span", { className: v["right-icon"], children: a }) : /* @__PURE__ */ s("span", { className: v["right-icon"], "data-chevron": !0, children: /* @__PURE__ */ s(
|
|
688
|
+
a ? /* @__PURE__ */ s("span", { className: v["right-icon"], children: a }) : /* @__PURE__ */ s("span", { className: v["right-icon"], "data-chevron": !0, children: /* @__PURE__ */ s(De, {}) })
|
|
687
689
|
]
|
|
688
690
|
}
|
|
689
691
|
);
|
|
@@ -692,21 +694,21 @@ const be = f(
|
|
|
692
694
|
be.displayName = "ComboboxInput.Button";
|
|
693
695
|
const xe = f(
|
|
694
696
|
({ value: e, children: c, disabled: i = !1, className: a, ...n }, t) => {
|
|
695
|
-
const o =
|
|
696
|
-
|
|
697
|
+
const o = T(), r = o.disabled || i, l = o.value.includes(e), d = typeof c == "string" ? c : String(e), u = !o.searchQuery || d.toLowerCase().includes(o.searchQuery.toLowerCase()) || e.toLowerCase().includes(o.searchQuery.toLowerCase());
|
|
698
|
+
E(() => (o.registerOption(e, d), () => o.unregisterOption(e)), [e, d, o.registerOption, o.unregisterOption]);
|
|
697
699
|
const h = () => {
|
|
698
700
|
if (r) return;
|
|
699
701
|
const p = l ? o.value.filter((x) => x !== e) : [...o.value, e];
|
|
700
702
|
o.onChange(p);
|
|
701
703
|
}, b = (p) => {
|
|
702
704
|
(p.key === "Enter" || p.key === " ") && (p.preventDefault(), h());
|
|
703
|
-
}, m = N({
|
|
704
|
-
return u ? /* @__PURE__ */
|
|
705
|
+
}, m = N({ active: l, disabled: r });
|
|
706
|
+
return u ? /* @__PURE__ */ y(
|
|
705
707
|
"li",
|
|
706
708
|
{
|
|
707
709
|
ref: t,
|
|
708
710
|
role: "option",
|
|
709
|
-
className:
|
|
711
|
+
className: g(v.option, a),
|
|
710
712
|
onClick: h,
|
|
711
713
|
onKeyDown: b,
|
|
712
714
|
"aria-selected": l,
|
|
@@ -714,7 +716,7 @@ const xe = f(
|
|
|
714
716
|
...m,
|
|
715
717
|
...n,
|
|
716
718
|
children: [
|
|
717
|
-
/* @__PURE__ */ s("span", { className: v["option-check"], children: /* @__PURE__ */ s(
|
|
719
|
+
/* @__PURE__ */ s("span", { className: v["option-check"], children: /* @__PURE__ */ s($e, { width: "1em", height: "1em" }) }),
|
|
718
720
|
/* @__PURE__ */ s("span", { children: c })
|
|
719
721
|
]
|
|
720
722
|
}
|
|
@@ -724,32 +726,27 @@ const xe = f(
|
|
|
724
726
|
xe.displayName = "ComboboxInput.Option";
|
|
725
727
|
const fe = f(
|
|
726
728
|
({ className: e, ...c }, i) => {
|
|
727
|
-
const a =
|
|
729
|
+
const a = T();
|
|
728
730
|
if (a.value.length === 0) return null;
|
|
729
731
|
const n = (t) => {
|
|
730
732
|
a.onChange(a.value.filter((o) => o !== t));
|
|
731
733
|
};
|
|
732
|
-
return /* @__PURE__ */ s("div", { ref: i, className:
|
|
734
|
+
return /* @__PURE__ */ s("div", { ref: i, className: g(v.chips, e), role: "group", ...c, children: a.value.map((t) => {
|
|
733
735
|
const o = a.optionRegistry.get(t) ?? t;
|
|
734
|
-
return /* @__PURE__ */
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
"aria-label": `Remove ${o}`,
|
|
744
|
-
children: /* @__PURE__ */ s(De, { width: "1em", height: "1em" })
|
|
745
|
-
}
|
|
746
|
-
)
|
|
747
|
-
] }, t);
|
|
736
|
+
return /* @__PURE__ */ s(
|
|
737
|
+
Ge,
|
|
738
|
+
{
|
|
739
|
+
disabled: a.disabled,
|
|
740
|
+
onClick: () => n(t),
|
|
741
|
+
children: o
|
|
742
|
+
},
|
|
743
|
+
t
|
|
744
|
+
);
|
|
748
745
|
}) });
|
|
749
746
|
}
|
|
750
747
|
);
|
|
751
748
|
fe.displayName = "ComboboxInput.SelectionChips";
|
|
752
|
-
const
|
|
749
|
+
const Ye = Object.assign(me, {
|
|
753
750
|
Button: be,
|
|
754
751
|
Listbox: he,
|
|
755
752
|
Drawer: ue,
|
|
@@ -758,15 +755,15 @@ const We = Object.assign(me, {
|
|
|
758
755
|
});
|
|
759
756
|
export {
|
|
760
757
|
te as Checkbox,
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
758
|
+
We as CheckboxGroup,
|
|
759
|
+
Xe as ChipInput,
|
|
760
|
+
Ye as ComboboxInput,
|
|
764
761
|
R as ErrorText,
|
|
765
762
|
B as HelperText,
|
|
766
763
|
k as Label,
|
|
767
764
|
ee as Radio,
|
|
768
|
-
|
|
765
|
+
Ue as RadioGroup,
|
|
769
766
|
q as Select,
|
|
770
|
-
|
|
771
|
-
|
|
767
|
+
Te as TextArea,
|
|
768
|
+
Ee as TextInput
|
|
772
769
|
};
|