@versaur/react 1.0.17 → 1.0.18
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/forms.d.ts +51 -5
- package/dist/forms.js +451 -455
- package/package.json +2 -2
package/dist/forms.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { labelStyles as
|
|
3
|
-
import { forwardRef as f, useId as
|
|
4
|
-
import { u as g, I as
|
|
5
|
-
import { c as
|
|
6
|
-
import { SearchIcon as
|
|
7
|
-
import { D as
|
|
8
|
-
const
|
|
9
|
-
({ required: e = !1, disabled:
|
|
1
|
+
import { jsx as s, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { labelStyles as Te, helperTextStyles as Fe, errorTextStyles as Pe, textInputStyles as T, textAreaStyles as te, selectStyles as ne, radioStyles as U, checkboxStyles as H, radioGroupStyles as oe, checkboxGroupStyles as se, chipInputStyles as Z, comboboxInputStyles as C, selectableInputStyles as P, currencyInputStyles as F } from "@versaur/core/forms";
|
|
3
|
+
import { forwardRef as f, useId as $, createContext as M, useContext as V, useState as L, useEffect as Q, useCallback as K, useRef as Me, useMemo as q } from "react";
|
|
4
|
+
import { u as g, I as ee, c as Ve, F as Qe } from "./helpers-D23F5WBX.js";
|
|
5
|
+
import { c as y } from "./cx-B9vmfsc1.js";
|
|
6
|
+
import { SearchIcon as ze, MailIcon as Ue, LockIcon as He, ChevronDownIcon as Ke, CheckIcon as _e } from "@versaur/icons";
|
|
7
|
+
import { D as ae } from "./drawer-BjNHPqBr.js";
|
|
8
|
+
const A = f(
|
|
9
|
+
({ required: e = !1, disabled: a = !1, children: n, className: c, ...i }, o) => {
|
|
10
10
|
const t = g({
|
|
11
|
-
disabled:
|
|
11
|
+
disabled: a,
|
|
12
12
|
required: e
|
|
13
13
|
});
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ s("label", { ref: o, className: y(Te.label, c), ...t, ...i, children: n });
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
|
-
|
|
18
|
-
const R = f(({ children: e, className:
|
|
17
|
+
A.displayName = "Label";
|
|
18
|
+
const R = f(({ children: e, className: a, ...n }, c) => /* @__PURE__ */ s("p", { ref: c, className: y(Fe.helper, a), ...n, children: e }));
|
|
19
19
|
R.displayName = "HelperText";
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const G = f(({ children: e, className: a, ...n }, c) => /* @__PURE__ */ s("p", { ref: c, className: y(Pe.error, a), role: "alert", "aria-live": "polite", ...n, children: e }));
|
|
21
|
+
G.displayName = "ErrorText";
|
|
22
22
|
const _ = f(
|
|
23
23
|
({
|
|
24
24
|
label: e,
|
|
25
|
-
helper:
|
|
25
|
+
helper: a,
|
|
26
26
|
error: n,
|
|
27
27
|
required: c = !1,
|
|
28
|
-
disabled:
|
|
29
|
-
readOnly:
|
|
28
|
+
disabled: i = !1,
|
|
29
|
+
readOnly: o = !1,
|
|
30
30
|
leftIcon: t,
|
|
31
31
|
rightIcon: r,
|
|
32
32
|
id: l,
|
|
33
33
|
className: d,
|
|
34
|
-
...
|
|
35
|
-
},
|
|
36
|
-
const b =
|
|
37
|
-
disabled:
|
|
34
|
+
...p
|
|
35
|
+
}, u) => {
|
|
36
|
+
const b = $(), h = l || b, m = a ? `${h}-helper` : void 0, x = n ? `${h}-error` : void 0, v = [m, x].filter(Boolean).join(" "), N = g({
|
|
37
|
+
disabled: i,
|
|
38
38
|
hasLeftIcon: !!t,
|
|
39
39
|
hasRightIcon: !!r,
|
|
40
40
|
invalid: !!n,
|
|
41
|
-
readOnly:
|
|
41
|
+
readOnly: o
|
|
42
42
|
});
|
|
43
|
-
return /* @__PURE__ */ I("div", { className:
|
|
44
|
-
e && /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ I("div", { className: y(T.field, d), children: [
|
|
44
|
+
e && /* @__PURE__ */ s(A, { htmlFor: h, required: c, disabled: i, children: e }),
|
|
45
45
|
/* @__PURE__ */ I("div", { className: T.wrapper, ...N, children: [
|
|
46
|
-
t && /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
46
|
+
t && /* @__PURE__ */ s("span", { className: T["left-icon"], children: t }),
|
|
47
|
+
/* @__PURE__ */ s(
|
|
48
48
|
"input",
|
|
49
49
|
{
|
|
50
|
-
ref:
|
|
51
|
-
id:
|
|
50
|
+
ref: u,
|
|
51
|
+
id: h,
|
|
52
52
|
type: "text",
|
|
53
53
|
className: T.input,
|
|
54
|
-
disabled:
|
|
55
|
-
readOnly:
|
|
54
|
+
disabled: i,
|
|
55
|
+
readOnly: o,
|
|
56
56
|
required: c,
|
|
57
57
|
"aria-invalid": n ? "true" : void 0,
|
|
58
|
-
"aria-disabled":
|
|
59
|
-
"aria-describedby":
|
|
60
|
-
...
|
|
58
|
+
"aria-disabled": i ? "true" : void 0,
|
|
59
|
+
"aria-describedby": v || void 0,
|
|
60
|
+
...p
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
|
-
r && /* @__PURE__ */
|
|
63
|
+
r && /* @__PURE__ */ s("span", { className: T["right-icon"], children: r })
|
|
64
64
|
] }),
|
|
65
|
-
n && /* @__PURE__ */
|
|
66
|
-
!n &&
|
|
65
|
+
n && /* @__PURE__ */ s(G, { id: x, children: n }),
|
|
66
|
+
!n && a && /* @__PURE__ */ s(R, { id: m, children: a })
|
|
67
67
|
] });
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
_.displayName = "TextInput";
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
71
|
+
const Je = f(({ leftIcon: e, ...a }, n) => /* @__PURE__ */ s(_, { ref: n, inputMode: "search", leftIcon: e ?? /* @__PURE__ */ s(ee, { as: ze }), ...a }));
|
|
72
|
+
Je.displayName = "SearchInput";
|
|
73
|
+
const We = f(({ leftIcon: e, ...a }, n) => /* @__PURE__ */ s(_, { ref: n, type: "email", inputMode: "email", leftIcon: e ?? /* @__PURE__ */ s(ee, { as: Ue }), ...a }));
|
|
74
|
+
We.displayName = "EmailInput";
|
|
75
|
+
const Xe = f(({ leftIcon: e, ...a }, n) => /* @__PURE__ */ s(_, { ref: n, type: "password", leftIcon: e ?? /* @__PURE__ */ s(ee, { as: He }), ...a }));
|
|
76
|
+
Xe.displayName = "PasswordInput";
|
|
77
|
+
const Ye = f(
|
|
78
78
|
({
|
|
79
79
|
label: e,
|
|
80
|
-
helper:
|
|
80
|
+
helper: a,
|
|
81
81
|
error: n,
|
|
82
82
|
required: c = !1,
|
|
83
|
-
disabled:
|
|
84
|
-
readOnly:
|
|
83
|
+
disabled: i = !1,
|
|
84
|
+
readOnly: o = !1,
|
|
85
85
|
resizable: t = !0,
|
|
86
86
|
minRows: r = 3,
|
|
87
87
|
maxRows: l,
|
|
88
88
|
id: d,
|
|
89
|
-
className:
|
|
90
|
-
...
|
|
89
|
+
className: p,
|
|
90
|
+
...u
|
|
91
91
|
}, b) => {
|
|
92
|
-
const
|
|
93
|
-
disabled:
|
|
92
|
+
const h = $(), m = d || h, x = a ? `${m}-helper` : void 0, v = n ? `${m}-error` : void 0, N = [x, v].filter(Boolean).join(" "), S = g({
|
|
93
|
+
disabled: i,
|
|
94
94
|
invalid: !!n,
|
|
95
|
-
readOnly:
|
|
95
|
+
readOnly: o,
|
|
96
96
|
resizable: t ? "true" : "false",
|
|
97
97
|
minRows: "true",
|
|
98
98
|
...l && { maxRows: "true" }
|
|
@@ -100,77 +100,77 @@ const Je = f(
|
|
|
100
100
|
"--_min-rows-count": r,
|
|
101
101
|
...l && { "--_max-rows-count": l }
|
|
102
102
|
};
|
|
103
|
-
return /* @__PURE__ */ I("div", { className:
|
|
104
|
-
e && /* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ I("div", { className: y(te.field, p), children: [
|
|
104
|
+
e && /* @__PURE__ */ s(A, { htmlFor: m, required: c, disabled: i, children: e }),
|
|
105
|
+
/* @__PURE__ */ s(
|
|
106
106
|
"textarea",
|
|
107
107
|
{
|
|
108
108
|
ref: b,
|
|
109
|
-
id:
|
|
110
|
-
className:
|
|
111
|
-
disabled:
|
|
112
|
-
readOnly:
|
|
109
|
+
id: m,
|
|
110
|
+
className: te.textarea,
|
|
111
|
+
disabled: i,
|
|
112
|
+
readOnly: o,
|
|
113
113
|
required: c,
|
|
114
114
|
style: B,
|
|
115
115
|
"aria-invalid": n ? "true" : void 0,
|
|
116
|
-
"aria-disabled":
|
|
116
|
+
"aria-disabled": i ? "true" : void 0,
|
|
117
117
|
"aria-describedby": N || void 0,
|
|
118
|
-
...
|
|
119
|
-
...
|
|
118
|
+
...S,
|
|
119
|
+
...u
|
|
120
120
|
}
|
|
121
121
|
),
|
|
122
|
-
n && /* @__PURE__ */
|
|
123
|
-
!n &&
|
|
122
|
+
n && /* @__PURE__ */ s(G, { id: v, children: n }),
|
|
123
|
+
!n && a && /* @__PURE__ */ s(R, { id: x, children: a })
|
|
124
124
|
] });
|
|
125
125
|
}
|
|
126
126
|
);
|
|
127
|
-
|
|
128
|
-
const ie = f(({ children: e, ...
|
|
127
|
+
Ye.displayName = "TextArea";
|
|
128
|
+
const ie = f(({ children: e, ...a }, n) => /* @__PURE__ */ s("option", { ref: n, ...a, children: e }));
|
|
129
129
|
ie.displayName = "Select.Option";
|
|
130
130
|
const ce = f(
|
|
131
|
-
({ label: e, children:
|
|
131
|
+
({ label: e, children: a, ...n }, c) => /* @__PURE__ */ s("optgroup", { ref: c, label: e, ...n, children: a })
|
|
132
132
|
);
|
|
133
133
|
ce.displayName = "Select.OptionGroup";
|
|
134
134
|
const re = f(
|
|
135
135
|
({
|
|
136
136
|
label: e,
|
|
137
|
-
helper:
|
|
137
|
+
helper: a,
|
|
138
138
|
error: n,
|
|
139
139
|
required: c = !1,
|
|
140
|
-
disabled:
|
|
141
|
-
placeholder:
|
|
140
|
+
disabled: i = !1,
|
|
141
|
+
placeholder: o,
|
|
142
142
|
children: t,
|
|
143
143
|
id: r,
|
|
144
144
|
className: l,
|
|
145
145
|
...d
|
|
146
|
-
},
|
|
147
|
-
const
|
|
148
|
-
disabled:
|
|
146
|
+
}, p) => {
|
|
147
|
+
const u = $(), b = r || u, h = a ? `${b}-helper` : void 0, m = n ? `${b}-error` : void 0, x = [h, m].filter(Boolean).join(" "), v = g({
|
|
148
|
+
disabled: i,
|
|
149
149
|
invalid: !!n
|
|
150
150
|
});
|
|
151
|
-
return /* @__PURE__ */ I("div", { className:
|
|
152
|
-
e && /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ I("div", { className: y(ne.field, l), children: [
|
|
152
|
+
e && /* @__PURE__ */ s(A, { htmlFor: b, required: c, disabled: i, children: e }),
|
|
153
153
|
/* @__PURE__ */ I(
|
|
154
154
|
"select",
|
|
155
155
|
{
|
|
156
|
-
ref:
|
|
156
|
+
ref: p,
|
|
157
157
|
id: b,
|
|
158
|
-
className:
|
|
159
|
-
disabled:
|
|
158
|
+
className: ne.select,
|
|
159
|
+
disabled: i,
|
|
160
160
|
required: c,
|
|
161
161
|
"aria-invalid": n ? "true" : void 0,
|
|
162
|
-
"aria-disabled":
|
|
163
|
-
"aria-describedby":
|
|
164
|
-
...
|
|
162
|
+
"aria-disabled": i ? "true" : void 0,
|
|
163
|
+
"aria-describedby": x || void 0,
|
|
164
|
+
...v,
|
|
165
165
|
...d,
|
|
166
166
|
children: [
|
|
167
|
-
|
|
167
|
+
o && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: o }),
|
|
168
168
|
t
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
n && /* @__PURE__ */
|
|
173
|
-
!n &&
|
|
172
|
+
n && /* @__PURE__ */ s(G, { id: m, children: n }),
|
|
173
|
+
!n && a && /* @__PURE__ */ s(R, { id: h, children: a })
|
|
174
174
|
] });
|
|
175
175
|
}
|
|
176
176
|
);
|
|
@@ -179,46 +179,46 @@ const le = re;
|
|
|
179
179
|
le.Option = ie;
|
|
180
180
|
le.OptionGroup = ce;
|
|
181
181
|
const de = f(
|
|
182
|
-
({ disabled: e = !1, children:
|
|
183
|
-
const
|
|
182
|
+
({ disabled: e = !1, children: a, className: n, ...c }, i) => {
|
|
183
|
+
const o = g({
|
|
184
184
|
disabled: e
|
|
185
185
|
});
|
|
186
|
-
return /* @__PURE__ */ I("label", { className:
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
|
|
186
|
+
return /* @__PURE__ */ I("label", { className: y(U.radio, n), ...o, children: [
|
|
187
|
+
/* @__PURE__ */ s("input", { ref: i, type: "radio", className: U.input, disabled: e, ...c }),
|
|
188
|
+
/* @__PURE__ */ s("span", { className: U.indicator }),
|
|
189
|
+
a && /* @__PURE__ */ s("span", { className: U.label, children: a })
|
|
190
190
|
] });
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
193
|
de.displayName = "Radio";
|
|
194
194
|
const pe = f(
|
|
195
|
-
({ disabled: e = !1, required:
|
|
195
|
+
({ disabled: e = !1, required: a = !1, children: n, className: c, ...i }, o) => {
|
|
196
196
|
const t = g({
|
|
197
197
|
disabled: e,
|
|
198
|
-
required:
|
|
198
|
+
required: a
|
|
199
199
|
});
|
|
200
|
-
return /* @__PURE__ */ I("label", { className:
|
|
201
|
-
/* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ I("label", { className: y(H.checkbox, c), ...t, children: [
|
|
201
|
+
/* @__PURE__ */ s(
|
|
202
202
|
"input",
|
|
203
203
|
{
|
|
204
|
-
ref:
|
|
204
|
+
ref: o,
|
|
205
205
|
type: "checkbox",
|
|
206
206
|
className: H.input,
|
|
207
207
|
disabled: e,
|
|
208
|
-
required:
|
|
209
|
-
"aria-required":
|
|
210
|
-
...
|
|
208
|
+
required: a,
|
|
209
|
+
"aria-required": a || void 0,
|
|
210
|
+
...i
|
|
211
211
|
}
|
|
212
212
|
),
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
n && /* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ s("span", { className: H.indicator }),
|
|
214
|
+
n && /* @__PURE__ */ s("span", { className: H.label, "data-required": a || void 0, children: n })
|
|
215
215
|
] });
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
218
|
pe.displayName = "Checkbox";
|
|
219
|
-
const ue =
|
|
220
|
-
function
|
|
221
|
-
const e =
|
|
219
|
+
const ue = M(void 0);
|
|
220
|
+
function Ze() {
|
|
221
|
+
const e = V(ue);
|
|
222
222
|
if (!e)
|
|
223
223
|
throw new Error("RadioGroup.Option must be used within RadioGroup");
|
|
224
224
|
return e;
|
|
@@ -226,68 +226,68 @@ function We() {
|
|
|
226
226
|
const he = f(
|
|
227
227
|
({
|
|
228
228
|
value: e,
|
|
229
|
-
onChange:
|
|
229
|
+
onChange: a,
|
|
230
230
|
name: n,
|
|
231
231
|
label: c,
|
|
232
|
-
helper:
|
|
233
|
-
error:
|
|
232
|
+
helper: i,
|
|
233
|
+
error: o,
|
|
234
234
|
required: t = !1,
|
|
235
235
|
disabled: r = !1,
|
|
236
236
|
direction: l = "column",
|
|
237
237
|
children: d,
|
|
238
|
-
className:
|
|
239
|
-
...
|
|
238
|
+
className: p,
|
|
239
|
+
...u
|
|
240
240
|
}, b) => {
|
|
241
|
-
const
|
|
242
|
-
!r &&
|
|
241
|
+
const h = $(), m = u.id || h, x = i ? `${m}-helper` : void 0, v = o ? `${m}-error` : void 0, N = [x, v].filter(Boolean).join(" "), S = (w) => {
|
|
242
|
+
!r && a && a(w);
|
|
243
243
|
}, B = g({
|
|
244
244
|
disabled: r
|
|
245
245
|
});
|
|
246
|
-
return /* @__PURE__ */ I("div", { ref: b, className:
|
|
247
|
-
c && /* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ I("div", { ref: b, className: y(oe.field, p), ...B, ...u, children: [
|
|
247
|
+
c && /* @__PURE__ */ s(A, { required: t, disabled: r, children: c }),
|
|
248
|
+
/* @__PURE__ */ s(ue.Provider, { value: { disabled: r, name: n, onChange: S, value: e }, children: /* @__PURE__ */ s(
|
|
249
249
|
"div",
|
|
250
250
|
{
|
|
251
|
-
className:
|
|
251
|
+
className: oe.options,
|
|
252
252
|
"data-direction": l,
|
|
253
253
|
role: "radiogroup",
|
|
254
254
|
"aria-describedby": N || void 0,
|
|
255
|
-
"aria-invalid":
|
|
255
|
+
"aria-invalid": o ? "true" : void 0,
|
|
256
256
|
children: d
|
|
257
257
|
}
|
|
258
258
|
) }),
|
|
259
|
-
|
|
260
|
-
!
|
|
259
|
+
o && /* @__PURE__ */ s(G, { id: v, children: o }),
|
|
260
|
+
!o && i && /* @__PURE__ */ s(R, { id: x, children: i })
|
|
261
261
|
] });
|
|
262
262
|
}
|
|
263
263
|
);
|
|
264
264
|
he.displayName = "RadioGroup";
|
|
265
265
|
const me = f(
|
|
266
|
-
({ value: e, children:
|
|
267
|
-
const
|
|
268
|
-
r ||
|
|
266
|
+
({ value: e, children: a, disabled: n, ...c }, i) => {
|
|
267
|
+
const o = Ze(), t = o.value === e, r = o.disabled || n, l = () => {
|
|
268
|
+
r || o.onChange(e);
|
|
269
269
|
};
|
|
270
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ s(
|
|
271
271
|
de,
|
|
272
272
|
{
|
|
273
|
-
ref:
|
|
274
|
-
name:
|
|
273
|
+
ref: i,
|
|
274
|
+
name: o.name,
|
|
275
275
|
value: e,
|
|
276
276
|
checked: t,
|
|
277
277
|
disabled: r,
|
|
278
278
|
onChange: l,
|
|
279
279
|
...c,
|
|
280
|
-
children:
|
|
280
|
+
children: a
|
|
281
281
|
}
|
|
282
282
|
);
|
|
283
283
|
}
|
|
284
284
|
);
|
|
285
285
|
me.displayName = "RadioGroup.Option";
|
|
286
|
-
const
|
|
286
|
+
const ht = Object.assign(he, {
|
|
287
287
|
Option: me
|
|
288
|
-
}), be =
|
|
289
|
-
function
|
|
290
|
-
const e =
|
|
288
|
+
}), be = M(void 0);
|
|
289
|
+
function qe() {
|
|
290
|
+
const e = V(be);
|
|
291
291
|
if (!e)
|
|
292
292
|
throw new Error("CheckboxGroup.Option must be used within CheckboxGroup");
|
|
293
293
|
return e;
|
|
@@ -295,144 +295,144 @@ function Xe() {
|
|
|
295
295
|
const fe = f(
|
|
296
296
|
({
|
|
297
297
|
value: e,
|
|
298
|
-
onChange:
|
|
298
|
+
onChange: a,
|
|
299
299
|
name: n,
|
|
300
300
|
label: c,
|
|
301
|
-
helper:
|
|
302
|
-
error:
|
|
301
|
+
helper: i,
|
|
302
|
+
error: o,
|
|
303
303
|
required: t = !1,
|
|
304
304
|
disabled: r = !1,
|
|
305
305
|
direction: l = "column",
|
|
306
306
|
children: d,
|
|
307
|
-
className:
|
|
308
|
-
...
|
|
307
|
+
className: p,
|
|
308
|
+
...u
|
|
309
309
|
}, b) => {
|
|
310
|
-
const
|
|
311
|
-
!r &&
|
|
310
|
+
const h = $(), m = u.id || h, x = i ? `${m}-helper` : void 0, v = o ? `${m}-error` : void 0, N = [x, v].filter(Boolean).join(" "), S = (w) => {
|
|
311
|
+
!r && a && a(w);
|
|
312
312
|
}, B = g({
|
|
313
313
|
disabled: r
|
|
314
314
|
});
|
|
315
|
-
return /* @__PURE__ */ I("div", { ref: b, className:
|
|
316
|
-
c && /* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ I("div", { ref: b, className: y(se.field, p), ...B, ...u, children: [
|
|
316
|
+
c && /* @__PURE__ */ s(A, { required: t, disabled: r, children: c }),
|
|
317
|
+
/* @__PURE__ */ s(be.Provider, { value: { disabled: r, name: n, onChange: S, value: e }, children: /* @__PURE__ */ s(
|
|
318
318
|
"div",
|
|
319
319
|
{
|
|
320
|
-
className:
|
|
320
|
+
className: se.options,
|
|
321
321
|
"data-direction": l,
|
|
322
322
|
role: "group",
|
|
323
323
|
"aria-describedby": N || void 0,
|
|
324
|
-
"aria-invalid":
|
|
324
|
+
"aria-invalid": o ? "true" : void 0,
|
|
325
325
|
children: d
|
|
326
326
|
}
|
|
327
327
|
) }),
|
|
328
|
-
|
|
329
|
-
!
|
|
328
|
+
o && /* @__PURE__ */ s(G, { id: v, children: o }),
|
|
329
|
+
!o && i && /* @__PURE__ */ s(R, { id: x, children: i })
|
|
330
330
|
] });
|
|
331
331
|
}
|
|
332
332
|
);
|
|
333
333
|
fe.displayName = "CheckboxGroup";
|
|
334
|
-
const
|
|
335
|
-
({ value: e, children:
|
|
336
|
-
const
|
|
334
|
+
const xe = f(
|
|
335
|
+
({ value: e, children: a, disabled: n, ...c }, i) => {
|
|
336
|
+
const o = qe(), t = o.value.includes(e), r = o.disabled || n, l = () => {
|
|
337
337
|
if (!r) {
|
|
338
|
-
const d = t ?
|
|
339
|
-
|
|
338
|
+
const d = t ? o.value.filter((p) => p !== e) : [...o.value, e];
|
|
339
|
+
o.onChange(d);
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ s(
|
|
343
343
|
pe,
|
|
344
344
|
{
|
|
345
|
-
ref:
|
|
346
|
-
name:
|
|
345
|
+
ref: i,
|
|
346
|
+
name: o.name,
|
|
347
347
|
value: e,
|
|
348
348
|
checked: t,
|
|
349
349
|
disabled: r,
|
|
350
350
|
onChange: l,
|
|
351
351
|
...c,
|
|
352
|
-
children:
|
|
352
|
+
children: a
|
|
353
353
|
}
|
|
354
354
|
);
|
|
355
355
|
}
|
|
356
356
|
);
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
Option:
|
|
360
|
-
}),
|
|
361
|
-
function
|
|
362
|
-
const e =
|
|
357
|
+
xe.displayName = "CheckboxGroup.Option";
|
|
358
|
+
const mt = Object.assign(fe, {
|
|
359
|
+
Option: xe
|
|
360
|
+
}), ve = M(void 0);
|
|
361
|
+
function et() {
|
|
362
|
+
const e = V(ve);
|
|
363
363
|
if (!e)
|
|
364
364
|
throw new Error("ChipInput.Option must be used within ChipInput");
|
|
365
365
|
return e;
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const ye = f(
|
|
368
368
|
({
|
|
369
369
|
value: e,
|
|
370
|
-
onChange:
|
|
370
|
+
onChange: a,
|
|
371
371
|
multiple: n = !1,
|
|
372
372
|
name: c,
|
|
373
|
-
label:
|
|
374
|
-
helper:
|
|
373
|
+
label: i,
|
|
374
|
+
helper: o,
|
|
375
375
|
error: t,
|
|
376
376
|
required: r = !1,
|
|
377
377
|
disabled: l = !1,
|
|
378
378
|
gap: d = "2",
|
|
379
|
-
wrap:
|
|
380
|
-
children:
|
|
379
|
+
wrap: p = !0,
|
|
380
|
+
children: u,
|
|
381
381
|
className: b,
|
|
382
|
-
...
|
|
383
|
-
},
|
|
384
|
-
const
|
|
385
|
-
l ||
|
|
386
|
-
},
|
|
382
|
+
...h
|
|
383
|
+
}, m) => {
|
|
384
|
+
const x = $(), v = h.id || x, N = o ? `${v}-helper` : void 0, S = t ? `${v}-error` : void 0, B = [N, S].filter(Boolean).join(" "), w = (D) => {
|
|
385
|
+
l || a(D);
|
|
386
|
+
}, E = g({
|
|
387
387
|
invalid: !!t
|
|
388
|
-
}),
|
|
389
|
-
return /* @__PURE__ */ I("div", { ref:
|
|
390
|
-
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
|
|
388
|
+
}), k = n ? "group" : "radiogroup";
|
|
389
|
+
return /* @__PURE__ */ I("div", { ref: m, className: y(Z.field, b), ...E, ...h, children: [
|
|
390
|
+
i && /* @__PURE__ */ s(A, { required: r, disabled: l, children: i }),
|
|
391
|
+
/* @__PURE__ */ s(
|
|
392
|
+
ve.Provider,
|
|
393
393
|
{
|
|
394
394
|
value: {
|
|
395
395
|
disabled: l,
|
|
396
396
|
multiple: n,
|
|
397
397
|
name: c,
|
|
398
|
-
onChange:
|
|
398
|
+
onChange: w,
|
|
399
399
|
value: e
|
|
400
400
|
},
|
|
401
|
-
children: /* @__PURE__ */
|
|
401
|
+
children: /* @__PURE__ */ s(
|
|
402
402
|
"div",
|
|
403
403
|
{
|
|
404
|
-
className:
|
|
404
|
+
className: Z.options,
|
|
405
405
|
"data-gap": d,
|
|
406
|
-
"data-wrap":
|
|
407
|
-
role:
|
|
406
|
+
"data-wrap": p,
|
|
407
|
+
role: k,
|
|
408
408
|
"aria-describedby": B || void 0,
|
|
409
409
|
"aria-invalid": t ? "true" : void 0,
|
|
410
|
-
children:
|
|
410
|
+
children: u
|
|
411
411
|
}
|
|
412
412
|
)
|
|
413
413
|
}
|
|
414
414
|
),
|
|
415
|
-
t && /* @__PURE__ */
|
|
416
|
-
!t &&
|
|
415
|
+
t && /* @__PURE__ */ s(G, { id: S, children: t }),
|
|
416
|
+
!t && o && /* @__PURE__ */ s(R, { id: N, children: o })
|
|
417
417
|
] });
|
|
418
418
|
}
|
|
419
419
|
);
|
|
420
|
-
|
|
420
|
+
ye.displayName = "ChipInput";
|
|
421
421
|
const Ie = f(
|
|
422
|
-
({ value: e, children:
|
|
423
|
-
const r =
|
|
424
|
-
let
|
|
425
|
-
r.multiple ?
|
|
426
|
-
const
|
|
422
|
+
({ value: e, children: a, disabled: n, iconLeft: c, iconRight: i, ...o }, t) => {
|
|
423
|
+
const r = et(), l = r.disabled || n, d = !!(c || i);
|
|
424
|
+
let p = !1;
|
|
425
|
+
r.multiple ? p = Array.isArray(r.value) && r.value.includes(e) : p = r.value === e;
|
|
426
|
+
const u = () => {
|
|
427
427
|
if (!l)
|
|
428
428
|
if (r.multiple) {
|
|
429
|
-
const
|
|
430
|
-
r.onChange(
|
|
429
|
+
const h = Array.isArray(r.value) ? r.value : [], m = p ? h.filter((x) => x !== e) : [...h, e];
|
|
430
|
+
r.onChange(m);
|
|
431
431
|
} else
|
|
432
432
|
r.onChange(e);
|
|
433
433
|
}, b = g({
|
|
434
434
|
disabled: l,
|
|
435
|
-
selected:
|
|
435
|
+
selected: p,
|
|
436
436
|
...d && { "has-icon": !0 }
|
|
437
437
|
});
|
|
438
438
|
return /* @__PURE__ */ I(
|
|
@@ -440,161 +440,135 @@ const Ie = f(
|
|
|
440
440
|
{
|
|
441
441
|
ref: t,
|
|
442
442
|
type: "button",
|
|
443
|
-
className:
|
|
444
|
-
onClick:
|
|
443
|
+
className: Z.option,
|
|
444
|
+
onClick: u,
|
|
445
445
|
disabled: l,
|
|
446
|
-
"aria-pressed":
|
|
446
|
+
"aria-pressed": p,
|
|
447
447
|
...b,
|
|
448
|
-
...
|
|
448
|
+
...o,
|
|
449
449
|
children: [
|
|
450
450
|
c,
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
a,
|
|
452
|
+
i
|
|
453
453
|
]
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
457
|
);
|
|
458
458
|
Ie.displayName = "ChipInput.Option";
|
|
459
|
-
const
|
|
459
|
+
const bt = Object.assign(ye, {
|
|
460
460
|
Option: Ie
|
|
461
|
-
}), Ce =
|
|
462
|
-
function
|
|
463
|
-
const e =
|
|
461
|
+
}), Ce = M(void 0);
|
|
462
|
+
function j() {
|
|
463
|
+
const e = V(Ce);
|
|
464
464
|
if (!e)
|
|
465
465
|
throw new Error("ComboboxInput subcomponents must be used within ComboboxInput");
|
|
466
466
|
return e;
|
|
467
467
|
}
|
|
468
468
|
const ge = f(
|
|
469
|
-
({
|
|
470
|
-
const
|
|
471
|
-
return /* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
|
|
474
|
-
{
|
|
475
|
-
type: "text",
|
|
476
|
-
className: C["drawer-input"],
|
|
477
|
-
placeholder: "Search options...",
|
|
478
|
-
value: a.searchQuery || "",
|
|
479
|
-
onChange: (s) => {
|
|
480
|
-
var t;
|
|
481
|
-
return (t = a.setSearchQuery) == null ? void 0 : t.call(a, s.currentTarget.value);
|
|
482
|
-
},
|
|
483
|
-
"aria-label": "Search options"
|
|
484
|
-
}
|
|
485
|
-
) }),
|
|
486
|
-
/* @__PURE__ */ o(
|
|
469
|
+
({ search: e, children: a, className: n, ...c }, i) => {
|
|
470
|
+
const o = j();
|
|
471
|
+
return /* @__PURE__ */ s(ae, { open: o.isOpen, onOpenChange: (t) => !t && o.closeListbox(), placement: "right", children: /* @__PURE__ */ s(ae.Body, { children: /* @__PURE__ */ I("div", { className: C["drawer-container"], children: [
|
|
472
|
+
/* @__PURE__ */ s("div", { className: C["drawer-input-wrapper"], children: e }),
|
|
473
|
+
/* @__PURE__ */ s(
|
|
487
474
|
"ul",
|
|
488
475
|
{
|
|
489
|
-
ref:
|
|
476
|
+
ref: i,
|
|
490
477
|
role: "listbox",
|
|
491
478
|
"aria-multiselectable": "true",
|
|
492
|
-
className:
|
|
493
|
-
...
|
|
494
|
-
children:
|
|
479
|
+
className: y(C["drawer-listbox"], n),
|
|
480
|
+
...c,
|
|
481
|
+
children: a
|
|
495
482
|
}
|
|
496
483
|
)
|
|
497
484
|
] }) }) });
|
|
498
485
|
}
|
|
499
486
|
);
|
|
500
487
|
ge.displayName = "ComboboxInput.Drawer";
|
|
501
|
-
function
|
|
502
|
-
const [
|
|
503
|
-
|
|
488
|
+
function tt(e) {
|
|
489
|
+
const [a, n] = L(e), [c, i] = L(!1), [o, t] = L(() => /* @__PURE__ */ new Map());
|
|
490
|
+
Q(() => {
|
|
504
491
|
n(e);
|
|
505
492
|
}, [e]);
|
|
506
493
|
const r = K(() => {
|
|
507
|
-
|
|
494
|
+
i((u) => !u);
|
|
508
495
|
}, []), l = K(() => {
|
|
509
|
-
|
|
510
|
-
}, []), d = K((
|
|
511
|
-
t((
|
|
512
|
-
const
|
|
513
|
-
return
|
|
496
|
+
i(!1);
|
|
497
|
+
}, []), d = K((u, b) => {
|
|
498
|
+
t((h) => {
|
|
499
|
+
const m = new Map(h);
|
|
500
|
+
return m.set(u, b), m;
|
|
514
501
|
});
|
|
515
|
-
}, []),
|
|
502
|
+
}, []), p = K((u) => {
|
|
516
503
|
t((b) => {
|
|
517
|
-
const
|
|
518
|
-
return
|
|
504
|
+
const h = new Map(b);
|
|
505
|
+
return h.delete(u), h;
|
|
519
506
|
});
|
|
520
507
|
}, []);
|
|
521
508
|
return {
|
|
522
|
-
internalValue:
|
|
509
|
+
internalValue: a,
|
|
523
510
|
setInternalValue: n,
|
|
524
511
|
isOpen: c,
|
|
525
512
|
toggleOpen: r,
|
|
526
513
|
closeListbox: l,
|
|
527
|
-
optionRegistry:
|
|
514
|
+
optionRegistry: o,
|
|
528
515
|
registerOption: d,
|
|
529
|
-
unregisterOption:
|
|
516
|
+
unregisterOption: p
|
|
530
517
|
};
|
|
531
518
|
}
|
|
532
|
-
function
|
|
533
|
-
const [n, c] =
|
|
534
|
-
return
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
if (!
|
|
538
|
-
|
|
539
|
-
const r =
|
|
519
|
+
function nt(e, a) {
|
|
520
|
+
const [n, c] = L("bottom"), i = Me(null);
|
|
521
|
+
return Q(() => {
|
|
522
|
+
if (a !== "popup" || !e) return;
|
|
523
|
+
const o = i.current;
|
|
524
|
+
if (!o) return;
|
|
525
|
+
o.matches(":popover-open") || o.showPopover(), requestAnimationFrame(() => {
|
|
526
|
+
const r = o.previousElementSibling;
|
|
540
527
|
if (!r) return;
|
|
541
|
-
const l = r.getBoundingClientRect(), d =
|
|
528
|
+
const l = r.getBoundingClientRect(), d = o.getBoundingClientRect(), p = {
|
|
542
529
|
width: d.width,
|
|
543
530
|
height: d.height
|
|
544
|
-
},
|
|
531
|
+
}, u = Ve(
|
|
545
532
|
l,
|
|
546
|
-
|
|
533
|
+
p,
|
|
547
534
|
100,
|
|
548
535
|
["top", "bottom"]
|
|
549
536
|
);
|
|
550
|
-
c(
|
|
537
|
+
c(u);
|
|
551
538
|
});
|
|
552
|
-
}, [e,
|
|
539
|
+
}, [e, a]), { internalRef: i, placement: n };
|
|
553
540
|
}
|
|
554
541
|
const Ne = f(
|
|
555
|
-
({
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const
|
|
561
|
-
|
|
542
|
+
({ search: e, children: a, className: n, ...c }, i) => {
|
|
543
|
+
const o = j(), { internalRef: t, placement: r } = nt(o.isOpen, o.variant);
|
|
544
|
+
Q(() => {
|
|
545
|
+
const d = t.current;
|
|
546
|
+
if (!d) return;
|
|
547
|
+
const p = () => {
|
|
548
|
+
d.matches(":popover-open") || o.closeListbox();
|
|
562
549
|
};
|
|
563
|
-
return
|
|
564
|
-
}, [
|
|
565
|
-
const
|
|
566
|
-
return /* @__PURE__ */
|
|
550
|
+
return d.addEventListener("toggle", p), () => d.removeEventListener("toggle", p);
|
|
551
|
+
}, [o, t]);
|
|
552
|
+
const l = g({ placement: r });
|
|
553
|
+
return /* @__PURE__ */ I(
|
|
567
554
|
"ul",
|
|
568
555
|
{
|
|
569
|
-
ref: (
|
|
570
|
-
|
|
556
|
+
ref: (d) => {
|
|
557
|
+
t.current = d, typeof i == "function" ? i(d) : i && (i.current = d);
|
|
571
558
|
},
|
|
572
559
|
role: "listbox",
|
|
573
560
|
"aria-multiselectable": "true",
|
|
574
|
-
className:
|
|
561
|
+
className: y(C.listbox, n),
|
|
575
562
|
popover: "auto",
|
|
576
|
-
...
|
|
563
|
+
...l,
|
|
577
564
|
style: {
|
|
578
|
-
positionAnchor:
|
|
565
|
+
positionAnchor: o.anchorName
|
|
579
566
|
},
|
|
580
|
-
...
|
|
581
|
-
children:
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
type: "text",
|
|
586
|
-
className: C["drawer-input"],
|
|
587
|
-
placeholder: "Search options...",
|
|
588
|
-
value: a.searchQuery || "",
|
|
589
|
-
onChange: (l) => {
|
|
590
|
-
var d;
|
|
591
|
-
return (d = a.setSearchQuery) == null ? void 0 : d.call(a, l.currentTarget.value);
|
|
592
|
-
},
|
|
593
|
-
"aria-label": "Search options"
|
|
594
|
-
}
|
|
595
|
-
) }),
|
|
596
|
-
e
|
|
597
|
-
] })
|
|
567
|
+
...c,
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ s("div", { className: C["listbox-search"], children: /* @__PURE__ */ s("div", { className: C["drawer-input-wrapper"], children: e }) }),
|
|
570
|
+
/* @__PURE__ */ s("div", { className: C["listbox-inner"], children: a })
|
|
571
|
+
]
|
|
598
572
|
}
|
|
599
573
|
);
|
|
600
574
|
}
|
|
@@ -603,95 +577,98 @@ Ne.displayName = "ComboboxInput.Listbox";
|
|
|
603
577
|
const Se = f(
|
|
604
578
|
({
|
|
605
579
|
value: e,
|
|
606
|
-
onChange:
|
|
580
|
+
onChange: a,
|
|
607
581
|
variant: n = "popup",
|
|
608
582
|
disabled: c = !1,
|
|
609
|
-
invalid:
|
|
610
|
-
label:
|
|
583
|
+
invalid: i = !1,
|
|
584
|
+
label: o,
|
|
611
585
|
helper: t,
|
|
612
586
|
error: r,
|
|
613
587
|
required: l = !1,
|
|
614
|
-
|
|
588
|
+
multiple: d = !1,
|
|
589
|
+
children: p,
|
|
615
590
|
className: u,
|
|
616
|
-
...
|
|
617
|
-
},
|
|
618
|
-
const m =
|
|
619
|
-
internalValue:
|
|
620
|
-
setInternalValue:
|
|
621
|
-
isOpen:
|
|
622
|
-
toggleOpen:
|
|
623
|
-
closeListbox:
|
|
624
|
-
optionRegistry:
|
|
625
|
-
registerOption:
|
|
626
|
-
unregisterOption:
|
|
627
|
-
} =
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}, [
|
|
631
|
-
const
|
|
632
|
-
c || (
|
|
633
|
-
},
|
|
634
|
-
invalid: !!(r ||
|
|
591
|
+
...b
|
|
592
|
+
}, h) => {
|
|
593
|
+
const m = $(), x = b.id || m, v = `${x}-button`, N = t ? `${x}-helper` : void 0, S = r ? `${x}-error` : void 0, B = [N, S].filter(Boolean).join(" "), w = `--combobox-anchor-${x.replace(/[^a-z0-9-]/gi, "")}`, E = q(() => d ? Array.isArray(e) ? e : [] : e === null ? [] : [e], [e, d]), {
|
|
594
|
+
internalValue: k,
|
|
595
|
+
setInternalValue: D,
|
|
596
|
+
isOpen: z,
|
|
597
|
+
toggleOpen: J,
|
|
598
|
+
closeListbox: W,
|
|
599
|
+
optionRegistry: X,
|
|
600
|
+
registerOption: O,
|
|
601
|
+
unregisterOption: De
|
|
602
|
+
} = tt(E), [$e, Ee] = L("");
|
|
603
|
+
Q(() => {
|
|
604
|
+
D(E);
|
|
605
|
+
}, [E, D]);
|
|
606
|
+
const Le = (Y) => {
|
|
607
|
+
c || (D(Y), a(d ? Y : Y[0] ?? null));
|
|
608
|
+
}, je = g({
|
|
609
|
+
invalid: !!(r || i),
|
|
635
610
|
disabled: c
|
|
636
611
|
});
|
|
637
|
-
return /* @__PURE__ */ I("div", { ref:
|
|
638
|
-
|
|
639
|
-
/* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ I("div", { ref: h, className: y(C.field, u), ...je, ...b, children: [
|
|
613
|
+
o && /* @__PURE__ */ s(A, { required: l, disabled: c, htmlFor: v, children: o }),
|
|
614
|
+
/* @__PURE__ */ s(
|
|
640
615
|
Ce.Provider,
|
|
641
616
|
{
|
|
642
617
|
value: {
|
|
643
|
-
value:
|
|
644
|
-
onChange:
|
|
645
|
-
isOpen:
|
|
646
|
-
toggleOpen:
|
|
647
|
-
closeListbox:
|
|
618
|
+
value: k,
|
|
619
|
+
onChange: Le,
|
|
620
|
+
isOpen: z,
|
|
621
|
+
toggleOpen: J,
|
|
622
|
+
closeListbox: W,
|
|
648
623
|
variant: n,
|
|
649
|
-
anchorName:
|
|
624
|
+
anchorName: w,
|
|
650
625
|
buttonId: v,
|
|
651
|
-
optionRegistry:
|
|
652
|
-
registerOption:
|
|
653
|
-
unregisterOption:
|
|
626
|
+
optionRegistry: X,
|
|
627
|
+
registerOption: O,
|
|
628
|
+
unregisterOption: De,
|
|
654
629
|
disabled: c,
|
|
655
|
-
|
|
656
|
-
|
|
630
|
+
multiple: d,
|
|
631
|
+
searchQuery: $e,
|
|
632
|
+
setSearchQuery: Ee
|
|
657
633
|
},
|
|
658
|
-
children: /* @__PURE__ */
|
|
634
|
+
children: /* @__PURE__ */ s("div", { className: C.root, "aria-describedby": B || void 0, children: p })
|
|
659
635
|
}
|
|
660
636
|
),
|
|
661
|
-
r && /* @__PURE__ */
|
|
662
|
-
!r && t &&
|
|
637
|
+
r && /* @__PURE__ */ s(G, { id: S, children: r }),
|
|
638
|
+
!r && t && k.length === 0 && /* @__PURE__ */ s(R, { id: N, children: t })
|
|
663
639
|
] });
|
|
664
640
|
}
|
|
665
641
|
);
|
|
666
642
|
Se.displayName = "ComboboxInput";
|
|
667
643
|
const we = f(
|
|
668
|
-
({ children: e, className:
|
|
669
|
-
const t =
|
|
644
|
+
({ children: e, className: a, iconLeft: n, iconRight: c, ...i }, o) => {
|
|
645
|
+
const t = j(), r = t.value.length === 0, l = g({
|
|
670
646
|
open: t.isOpen,
|
|
671
647
|
disabled: t.disabled,
|
|
672
648
|
"has-left-icon": !!n,
|
|
673
649
|
"has-right-icon": !0
|
|
674
650
|
}), d = {
|
|
675
651
|
anchorName: t.anchorName
|
|
676
|
-
},
|
|
652
|
+
}, p = e || // oxlint-disable-next-line no-nested-ternary
|
|
653
|
+
(r ? "Select" : t.multiple ? `${t.value.length} selected` : t.optionRegistry.get(t.value[0]) ?? t.value[0]);
|
|
677
654
|
return /* @__PURE__ */ I(
|
|
678
655
|
"button",
|
|
679
656
|
{
|
|
680
|
-
ref:
|
|
657
|
+
ref: o,
|
|
681
658
|
id: t.buttonId,
|
|
682
659
|
type: "button",
|
|
683
|
-
className:
|
|
660
|
+
className: y(C.button, a),
|
|
684
661
|
onClick: () => !t.disabled && t.toggleOpen(),
|
|
685
662
|
disabled: t.disabled,
|
|
686
663
|
"aria-expanded": t.isOpen,
|
|
687
664
|
"aria-haspopup": "listbox",
|
|
688
665
|
style: d,
|
|
689
666
|
...l,
|
|
690
|
-
...
|
|
667
|
+
...i,
|
|
691
668
|
children: [
|
|
692
|
-
n && /* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
c ? /* @__PURE__ */
|
|
669
|
+
n && /* @__PURE__ */ s("span", { className: C["left-icon"], children: n }),
|
|
670
|
+
/* @__PURE__ */ s("span", { className: C["button-content"], ...r && { "data-placeholder": "" }, children: p }),
|
|
671
|
+
c ? /* @__PURE__ */ s("span", { className: C["right-icon"], children: c }) : /* @__PURE__ */ s("span", { className: C["right-icon"], "data-chevron": !0, children: /* @__PURE__ */ s(Ke, {}) })
|
|
695
672
|
]
|
|
696
673
|
}
|
|
697
674
|
);
|
|
@@ -699,31 +676,34 @@ const we = f(
|
|
|
699
676
|
);
|
|
700
677
|
we.displayName = "ComboboxInput.Button";
|
|
701
678
|
const Oe = f(
|
|
702
|
-
({ value: e, children:
|
|
703
|
-
const t =
|
|
704
|
-
|
|
705
|
-
const
|
|
706
|
-
if (r)
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
679
|
+
({ value: e, children: a, disabled: n = !1, className: c, ...i }, o) => {
|
|
680
|
+
const t = j(), r = t.disabled || n, l = t.value.includes(e), d = typeof a == "string" ? a : String(e), p = !t.searchQuery || d.toLowerCase().includes(t.searchQuery.toLowerCase()) || e.toLowerCase().includes(t.searchQuery.toLowerCase());
|
|
681
|
+
Q(() => (t.registerOption(e, d), () => t.unregisterOption(e)), [e, d, t.registerOption, t.unregisterOption]);
|
|
682
|
+
const u = () => {
|
|
683
|
+
if (!r)
|
|
684
|
+
if (t.multiple) {
|
|
685
|
+
const m = l ? t.value.filter((x) => x !== e) : [...t.value, e];
|
|
686
|
+
t.onChange(m);
|
|
687
|
+
} else
|
|
688
|
+
t.onChange(l ? [] : [e]), t.closeListbox();
|
|
689
|
+
}, b = (m) => {
|
|
690
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), u());
|
|
691
|
+
}, h = g({ active: l, disabled: r });
|
|
692
|
+
return p ? /* @__PURE__ */ I(
|
|
713
693
|
"li",
|
|
714
694
|
{
|
|
715
|
-
ref:
|
|
695
|
+
ref: o,
|
|
716
696
|
role: "option",
|
|
717
|
-
className:
|
|
718
|
-
onClick:
|
|
697
|
+
className: y(C.option, c),
|
|
698
|
+
onClick: u,
|
|
719
699
|
onKeyDown: b,
|
|
720
700
|
"aria-selected": l,
|
|
721
701
|
tabIndex: r ? -1 : 0,
|
|
722
|
-
...
|
|
723
|
-
...
|
|
702
|
+
...h,
|
|
703
|
+
...i,
|
|
724
704
|
children: [
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ s("span", { className: C["option-check"], children: /* @__PURE__ */ s(_e, { width: "1em", height: "1em" }) }),
|
|
706
|
+
/* @__PURE__ */ s("span", { children: a })
|
|
727
707
|
]
|
|
728
708
|
}
|
|
729
709
|
) : null;
|
|
@@ -731,36 +711,52 @@ const Oe = f(
|
|
|
731
711
|
);
|
|
732
712
|
Oe.displayName = "ComboboxInput.Option";
|
|
733
713
|
const Be = f(
|
|
734
|
-
({ className: e, ...
|
|
735
|
-
const c =
|
|
714
|
+
({ className: e, ...a }, n) => {
|
|
715
|
+
const c = j();
|
|
736
716
|
if (c.value.length === 0) return null;
|
|
737
|
-
const
|
|
738
|
-
c.onChange(c.value.filter((t) => t !==
|
|
717
|
+
const i = (o) => {
|
|
718
|
+
c.onChange(c.value.filter((t) => t !== o));
|
|
739
719
|
};
|
|
740
|
-
return /* @__PURE__ */
|
|
741
|
-
const t = c.optionRegistry.get(
|
|
742
|
-
return /* @__PURE__ */ o
|
|
743
|
-
Pe,
|
|
744
|
-
{
|
|
745
|
-
disabled: c.disabled,
|
|
746
|
-
onClick: () => a(s),
|
|
747
|
-
children: t
|
|
748
|
-
},
|
|
749
|
-
s
|
|
750
|
-
);
|
|
720
|
+
return /* @__PURE__ */ s("div", { ref: n, className: y(C.chips, e), role: "group", ...a, children: c.value.map((o) => {
|
|
721
|
+
const t = c.optionRegistry.get(o) ?? o;
|
|
722
|
+
return /* @__PURE__ */ s(Qe, { disabled: c.disabled, onClick: () => i(o), children: t }, o);
|
|
751
723
|
}) });
|
|
752
724
|
}
|
|
753
725
|
);
|
|
754
726
|
Be.displayName = "ComboboxInput.SelectionChips";
|
|
755
|
-
const
|
|
727
|
+
const ke = f(
|
|
728
|
+
({ name: e, value: a, onChange: n, placeholder: c = "Search options...", ...i }, o) => {
|
|
729
|
+
const t = j(), r = (l) => {
|
|
730
|
+
var d;
|
|
731
|
+
n(l), (d = t.setSearchQuery) == null || d.call(t, l.currentTarget.value);
|
|
732
|
+
};
|
|
733
|
+
return /* @__PURE__ */ s(
|
|
734
|
+
"input",
|
|
735
|
+
{
|
|
736
|
+
ref: o,
|
|
737
|
+
type: "text",
|
|
738
|
+
name: e,
|
|
739
|
+
className: C["drawer-input"],
|
|
740
|
+
placeholder: c,
|
|
741
|
+
value: a,
|
|
742
|
+
onChange: r,
|
|
743
|
+
"aria-label": "Search options",
|
|
744
|
+
...i
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
ke.displayName = "ComboboxInput.ListboxSearch";
|
|
750
|
+
const ft = Object.assign(Se, {
|
|
756
751
|
Button: we,
|
|
757
752
|
Listbox: Ne,
|
|
758
753
|
Drawer: ge,
|
|
759
754
|
Option: Oe,
|
|
760
|
-
SelectionChips: Be
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
755
|
+
SelectionChips: Be,
|
|
756
|
+
ListboxSearch: ke
|
|
757
|
+
}), Ae = M(void 0);
|
|
758
|
+
function ot() {
|
|
759
|
+
const e = V(Ae);
|
|
764
760
|
if (!e)
|
|
765
761
|
throw new Error("SelectableInput.Option must be used within SelectableInput");
|
|
766
762
|
return e;
|
|
@@ -768,50 +764,50 @@ function et() {
|
|
|
768
764
|
const Re = f(
|
|
769
765
|
({
|
|
770
766
|
value: e,
|
|
771
|
-
onChange:
|
|
767
|
+
onChange: a,
|
|
772
768
|
multiple: n = !1,
|
|
773
769
|
name: c,
|
|
774
|
-
disabled:
|
|
775
|
-
placement:
|
|
770
|
+
disabled: i = !1,
|
|
771
|
+
placement: o = "top",
|
|
776
772
|
children: t,
|
|
777
773
|
className: r,
|
|
778
774
|
...l
|
|
779
775
|
}, d) => {
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
disabled:
|
|
776
|
+
const p = (h) => {
|
|
777
|
+
i || a(h);
|
|
778
|
+
}, u = g({
|
|
779
|
+
disabled: i
|
|
784
780
|
}), b = n ? "group" : "radiogroup";
|
|
785
|
-
return /* @__PURE__ */
|
|
786
|
-
|
|
781
|
+
return /* @__PURE__ */ s("div", { ref: d, className: y(P.field, r), ...u, ...l, children: /* @__PURE__ */ s(
|
|
782
|
+
Ae.Provider,
|
|
787
783
|
{
|
|
788
784
|
value: {
|
|
789
|
-
disabled:
|
|
785
|
+
disabled: i,
|
|
790
786
|
multiple: n,
|
|
791
787
|
name: c,
|
|
792
|
-
onChange:
|
|
788
|
+
onChange: p,
|
|
793
789
|
value: e,
|
|
794
|
-
placement:
|
|
790
|
+
placement: o
|
|
795
791
|
},
|
|
796
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ s("div", { role: b, children: t })
|
|
797
793
|
}
|
|
798
794
|
) });
|
|
799
795
|
}
|
|
800
796
|
);
|
|
801
797
|
Re.displayName = "SelectableInput";
|
|
802
|
-
const
|
|
803
|
-
({ value: e, children:
|
|
804
|
-
const t =
|
|
798
|
+
const Ge = f(
|
|
799
|
+
({ value: e, children: a, disabled: n, className: c, ...i }, o) => {
|
|
800
|
+
const t = ot(), r = t.disabled || n;
|
|
805
801
|
let l = !1;
|
|
806
802
|
t.multiple ? l = Array.isArray(t.value) && t.value.includes(e) : l = t.value === e;
|
|
807
803
|
const d = () => {
|
|
808
804
|
if (!r)
|
|
809
805
|
if (t.multiple) {
|
|
810
|
-
const
|
|
806
|
+
const u = Array.isArray(t.value) ? t.value : [], b = l ? u.filter((h) => h !== e) : [...u, e];
|
|
811
807
|
t.onChange(b);
|
|
812
808
|
} else
|
|
813
809
|
t.onChange(e);
|
|
814
|
-
},
|
|
810
|
+
}, p = g({
|
|
815
811
|
disabled: r,
|
|
816
812
|
selected: l,
|
|
817
813
|
placement: t.placement
|
|
@@ -819,16 +815,16 @@ const Ae = f(
|
|
|
819
815
|
return /* @__PURE__ */ I(
|
|
820
816
|
"label",
|
|
821
817
|
{
|
|
822
|
-
ref:
|
|
823
|
-
className:
|
|
824
|
-
...
|
|
825
|
-
...
|
|
818
|
+
ref: o,
|
|
819
|
+
className: y(P.option, c),
|
|
820
|
+
...p,
|
|
821
|
+
...i,
|
|
826
822
|
children: [
|
|
827
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ s(
|
|
828
824
|
"input",
|
|
829
825
|
{
|
|
830
826
|
type: "checkbox",
|
|
831
|
-
className:
|
|
827
|
+
className: P.input,
|
|
832
828
|
name: t.name,
|
|
833
829
|
value: e,
|
|
834
830
|
checked: l,
|
|
@@ -837,118 +833,118 @@ const Ae = f(
|
|
|
837
833
|
"aria-disabled": r
|
|
838
834
|
}
|
|
839
835
|
),
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ s("span", { className: P.indicator }),
|
|
837
|
+
/* @__PURE__ */ s("div", { className: P.content, children: a })
|
|
842
838
|
]
|
|
843
839
|
}
|
|
844
840
|
);
|
|
845
841
|
}
|
|
846
842
|
);
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
Option:
|
|
843
|
+
Ge.displayName = "SelectableInput.Option";
|
|
844
|
+
const xt = Object.assign(Re, {
|
|
845
|
+
Option: Ge
|
|
850
846
|
});
|
|
851
|
-
function
|
|
847
|
+
function st() {
|
|
852
848
|
try {
|
|
853
|
-
return Intl.supportedValuesOf("currency").map((
|
|
854
|
-
code:
|
|
855
|
-
label:
|
|
849
|
+
return Intl.supportedValuesOf("currency").map((a) => ({
|
|
850
|
+
code: a,
|
|
851
|
+
label: a
|
|
856
852
|
}));
|
|
857
853
|
} catch {
|
|
858
854
|
return [{ code: "USD", label: "USD" }];
|
|
859
855
|
}
|
|
860
856
|
}
|
|
861
|
-
const
|
|
857
|
+
const at = f(
|
|
862
858
|
({
|
|
863
859
|
label: e,
|
|
864
|
-
helper:
|
|
860
|
+
helper: a,
|
|
865
861
|
error: n,
|
|
866
862
|
required: c = !1,
|
|
867
|
-
disabled:
|
|
868
|
-
readOnly:
|
|
863
|
+
disabled: i = !1,
|
|
864
|
+
readOnly: o = !1,
|
|
869
865
|
name: t,
|
|
870
866
|
amountValue: r = "",
|
|
871
867
|
onAmountChange: l,
|
|
872
868
|
currencyValue: d = "USD",
|
|
873
|
-
onCurrencyChange:
|
|
874
|
-
currencies:
|
|
869
|
+
onCurrencyChange: p,
|
|
870
|
+
currencies: u,
|
|
875
871
|
currencyName: b,
|
|
876
|
-
id:
|
|
877
|
-
className:
|
|
878
|
-
...
|
|
879
|
-
},
|
|
880
|
-
const N =
|
|
872
|
+
id: h,
|
|
873
|
+
className: m,
|
|
874
|
+
...x
|
|
875
|
+
}, v) => {
|
|
876
|
+
const N = q(() => st(), []), S = q(() => u ? u.map((O) => ({
|
|
881
877
|
code: O,
|
|
882
878
|
label: O
|
|
883
|
-
})) : N, [
|
|
884
|
-
disabled:
|
|
879
|
+
})) : N, [u, N]), [B, w] = L(!1), E = $(), k = h || E, D = a ? `${k}-helper` : void 0, z = n ? `${k}-error` : void 0, J = [D, z].filter(Boolean).join(" "), W = b || (t ? `${t}-currency` : void 0), X = g({
|
|
880
|
+
disabled: i,
|
|
885
881
|
invalid: !!n,
|
|
886
|
-
readOnly:
|
|
882
|
+
readOnly: o,
|
|
887
883
|
focused: B
|
|
888
884
|
});
|
|
889
|
-
return /* @__PURE__ */ I("div", { className:
|
|
890
|
-
e && /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */ I("div", { className:
|
|
892
|
-
/* @__PURE__ */
|
|
885
|
+
return /* @__PURE__ */ I("div", { className: y(F.field, m), children: [
|
|
886
|
+
e && /* @__PURE__ */ s(A, { htmlFor: k, required: c, disabled: i, children: e }),
|
|
887
|
+
/* @__PURE__ */ I("div", { className: F.wrapper, ...X, children: [
|
|
888
|
+
/* @__PURE__ */ s(
|
|
893
889
|
"select",
|
|
894
890
|
{
|
|
895
|
-
className:
|
|
891
|
+
className: F["currency-select"],
|
|
896
892
|
name: W,
|
|
897
893
|
value: d,
|
|
898
|
-
onChange: (O) =>
|
|
899
|
-
onFocus: () =>
|
|
900
|
-
onBlur: () =>
|
|
901
|
-
disabled:
|
|
902
|
-
"aria-disabled":
|
|
903
|
-
children:
|
|
894
|
+
onChange: (O) => p == null ? void 0 : p(O.target.value),
|
|
895
|
+
onFocus: () => w(!0),
|
|
896
|
+
onBlur: () => w(!1),
|
|
897
|
+
disabled: i,
|
|
898
|
+
"aria-disabled": i ? "true" : void 0,
|
|
899
|
+
children: S.map((O) => /* @__PURE__ */ s("option", { value: O.code, children: O.label }, O.code))
|
|
904
900
|
}
|
|
905
901
|
),
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ s("span", { className: F.divider, "aria-hidden": !0 }),
|
|
903
|
+
/* @__PURE__ */ s(
|
|
908
904
|
"input",
|
|
909
905
|
{
|
|
910
|
-
ref:
|
|
911
|
-
id:
|
|
906
|
+
ref: v,
|
|
907
|
+
id: k,
|
|
912
908
|
type: "text",
|
|
913
909
|
inputMode: "decimal",
|
|
914
|
-
className:
|
|
910
|
+
className: F["amount-input"],
|
|
915
911
|
name: t,
|
|
916
912
|
value: r,
|
|
917
913
|
onChange: (O) => l == null ? void 0 : l(O.target.value),
|
|
918
|
-
onFocus: () =>
|
|
919
|
-
onBlur: () =>
|
|
920
|
-
disabled:
|
|
921
|
-
readOnly:
|
|
914
|
+
onFocus: () => w(!0),
|
|
915
|
+
onBlur: () => w(!1),
|
|
916
|
+
disabled: i,
|
|
917
|
+
readOnly: o,
|
|
922
918
|
required: c,
|
|
923
919
|
"aria-invalid": n ? "true" : void 0,
|
|
924
|
-
"aria-disabled":
|
|
920
|
+
"aria-disabled": i ? "true" : void 0,
|
|
925
921
|
"aria-describedby": J || void 0,
|
|
926
|
-
...
|
|
922
|
+
...x
|
|
927
923
|
}
|
|
928
924
|
)
|
|
929
925
|
] }),
|
|
930
|
-
n && /* @__PURE__ */
|
|
931
|
-
!n &&
|
|
926
|
+
n && /* @__PURE__ */ s(G, { id: z, children: n }),
|
|
927
|
+
!n && a && /* @__PURE__ */ s(R, { id: D, children: a })
|
|
932
928
|
] });
|
|
933
929
|
}
|
|
934
930
|
);
|
|
935
|
-
|
|
931
|
+
at.displayName = "CurrencyInput";
|
|
936
932
|
export {
|
|
937
933
|
pe as Checkbox,
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
934
|
+
mt as CheckboxGroup,
|
|
935
|
+
bt as ChipInput,
|
|
936
|
+
ft as ComboboxInput,
|
|
937
|
+
at as CurrencyInput,
|
|
938
|
+
We as EmailInput,
|
|
939
|
+
G as ErrorText,
|
|
944
940
|
R as HelperText,
|
|
945
|
-
|
|
946
|
-
|
|
941
|
+
A as Label,
|
|
942
|
+
Xe as PasswordInput,
|
|
947
943
|
de as Radio,
|
|
948
|
-
|
|
949
|
-
|
|
944
|
+
ht as RadioGroup,
|
|
945
|
+
Je as SearchInput,
|
|
950
946
|
le as Select,
|
|
951
|
-
|
|
952
|
-
|
|
947
|
+
xt as SelectableInput,
|
|
948
|
+
Ye as TextArea,
|
|
953
949
|
_ as TextInput
|
|
954
950
|
};
|