@versaur/react 1.0.7 → 1.0.8
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 +32 -0
- package/dist/blocks.js +448 -386
- package/dist/forms.d.ts +47 -100
- package/dist/forms.js +297 -400
- package/dist/primitive.d.ts +40 -0
- package/dist/primitive.js +127 -113
- package/package.json +2 -2
package/dist/forms.js
CHANGED
|
@@ -1,578 +1,475 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { labelStyles as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { u as
|
|
5
|
-
import { c as
|
|
6
|
-
const k =
|
|
7
|
-
({ required: e = !1, disabled:
|
|
8
|
-
const c =
|
|
9
|
-
disabled:
|
|
1
|
+
import { jsx as i, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { labelStyles as ie, helperTextStyles as ae, errorTextStyles as se, textInputStyles as w, textAreaStyles as D, selectStyles as F, radioStyles as R, checkboxStyles as $, radioGroupStyles as P, checkboxGroupStyles as V, chipInputStyles as j } from "@versaur/core/forms";
|
|
3
|
+
import { forwardRef as v, useId as S, createContext as T, useContext as E } from "react";
|
|
4
|
+
import { u as I } from "./use-data-attrs-iPFyfiKN.js";
|
|
5
|
+
import { c as b } from "./cx-B9vmfsc1.js";
|
|
6
|
+
const k = v(
|
|
7
|
+
({ required: e = !1, disabled: n = !1, children: t, className: d, ...a }, o) => {
|
|
8
|
+
const c = I({
|
|
9
|
+
disabled: n,
|
|
10
10
|
required: e
|
|
11
11
|
});
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ i("label", { ref: o, className: b(ie.label, d), ...c, ...a, children: t });
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
k.displayName = "Label";
|
|
16
|
-
const B =
|
|
16
|
+
const B = v(({ children: e, className: n, ...t }, d) => /* @__PURE__ */ i("p", { ref: d, className: b(ae.helper, n), ...t, children: e }));
|
|
17
17
|
B.displayName = "HelperText";
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
18
|
+
const O = v(({ children: e, className: n, ...t }, d) => /* @__PURE__ */ i("p", { ref: d, className: b(se.error, n), role: "alert", "aria-live": "polite", ...t, children: e }));
|
|
19
|
+
O.displayName = "ErrorText";
|
|
20
|
+
const de = v(
|
|
21
21
|
({
|
|
22
22
|
label: e,
|
|
23
|
-
helper:
|
|
23
|
+
helper: n,
|
|
24
24
|
error: t,
|
|
25
|
-
required:
|
|
25
|
+
required: d = !1,
|
|
26
26
|
disabled: a = !1,
|
|
27
|
-
readOnly:
|
|
27
|
+
readOnly: o = !1,
|
|
28
28
|
leftIcon: c,
|
|
29
|
-
rightIcon:
|
|
29
|
+
rightIcon: s,
|
|
30
30
|
id: l,
|
|
31
|
-
className:
|
|
32
|
-
...
|
|
33
|
-
},
|
|
34
|
-
const
|
|
31
|
+
className: f,
|
|
32
|
+
...p
|
|
33
|
+
}, x) => {
|
|
34
|
+
const m = S(), u = l || m, r = n ? `${u}-helper` : void 0, h = t ? `${u}-error` : void 0, y = [r, h].filter(Boolean).join(" "), N = I({
|
|
35
35
|
disabled: a,
|
|
36
36
|
hasLeftIcon: !!c,
|
|
37
|
-
hasRightIcon: !!
|
|
37
|
+
hasRightIcon: !!s,
|
|
38
38
|
invalid: !!t,
|
|
39
|
-
readOnly:
|
|
39
|
+
readOnly: o
|
|
40
40
|
});
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
e && /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
c && /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ C("div", { className: b(w.field, f), children: [
|
|
42
|
+
e && /* @__PURE__ */ i(k, { htmlFor: u, required: d, disabled: a, children: e }),
|
|
43
|
+
/* @__PURE__ */ C("div", { className: w.wrapper, ...N, children: [
|
|
44
|
+
c && /* @__PURE__ */ i("span", { className: w["left-icon"], children: c }),
|
|
45
|
+
/* @__PURE__ */ i(
|
|
46
46
|
"input",
|
|
47
47
|
{
|
|
48
|
-
ref:
|
|
49
|
-
id:
|
|
48
|
+
ref: x,
|
|
49
|
+
id: u,
|
|
50
50
|
type: "text",
|
|
51
|
-
className:
|
|
51
|
+
className: w.input,
|
|
52
52
|
disabled: a,
|
|
53
|
-
readOnly:
|
|
54
|
-
required:
|
|
53
|
+
readOnly: o,
|
|
54
|
+
required: d,
|
|
55
55
|
"aria-invalid": t ? "true" : void 0,
|
|
56
56
|
"aria-disabled": a ? "true" : void 0,
|
|
57
|
-
"aria-describedby":
|
|
58
|
-
...
|
|
57
|
+
"aria-describedby": y || void 0,
|
|
58
|
+
...p
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
|
|
61
|
+
s && /* @__PURE__ */ i("span", { className: w["right-icon"], children: s })
|
|
62
62
|
] }),
|
|
63
|
-
t && /* @__PURE__ */
|
|
64
|
-
!t &&
|
|
63
|
+
t && /* @__PURE__ */ i(O, { id: h, children: t }),
|
|
64
|
+
!t && n && /* @__PURE__ */ i(B, { id: r, children: n })
|
|
65
65
|
] });
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
|
-
|
|
69
|
-
const
|
|
68
|
+
de.displayName = "TextInput";
|
|
69
|
+
const ce = v(
|
|
70
70
|
({
|
|
71
71
|
label: e,
|
|
72
|
-
helper:
|
|
72
|
+
helper: n,
|
|
73
73
|
error: t,
|
|
74
|
-
required:
|
|
74
|
+
required: d = !1,
|
|
75
75
|
disabled: a = !1,
|
|
76
|
-
readOnly:
|
|
76
|
+
readOnly: o = !1,
|
|
77
77
|
resizable: c = !0,
|
|
78
|
-
minRows:
|
|
78
|
+
minRows: s = 3,
|
|
79
79
|
maxRows: l,
|
|
80
|
-
id:
|
|
81
|
-
className:
|
|
82
|
-
...
|
|
83
|
-
},
|
|
84
|
-
const
|
|
80
|
+
id: f,
|
|
81
|
+
className: p,
|
|
82
|
+
...x
|
|
83
|
+
}, m) => {
|
|
84
|
+
const u = S(), r = f || u, h = n ? `${r}-helper` : void 0, y = t ? `${r}-error` : void 0, N = [h, y].filter(Boolean).join(" "), g = I({
|
|
85
85
|
disabled: a,
|
|
86
86
|
invalid: !!t,
|
|
87
|
-
readOnly:
|
|
87
|
+
readOnly: o,
|
|
88
88
|
resizable: c ? "true" : "false",
|
|
89
89
|
minRows: "true",
|
|
90
90
|
...l && { maxRows: "true" }
|
|
91
|
-
}),
|
|
92
|
-
"--_min-rows-count":
|
|
91
|
+
}), G = {
|
|
92
|
+
"--_min-rows-count": s,
|
|
93
93
|
...l && { "--_max-rows-count": l }
|
|
94
94
|
};
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
e && /* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ C("div", { className: b(D.field, p), children: [
|
|
96
|
+
e && /* @__PURE__ */ i(k, { htmlFor: r, required: d, disabled: a, children: e }),
|
|
97
|
+
/* @__PURE__ */ i(
|
|
98
98
|
"textarea",
|
|
99
99
|
{
|
|
100
|
-
ref:
|
|
101
|
-
id:
|
|
102
|
-
className:
|
|
100
|
+
ref: m,
|
|
101
|
+
id: r,
|
|
102
|
+
className: D.textarea,
|
|
103
103
|
disabled: a,
|
|
104
|
-
readOnly:
|
|
105
|
-
required:
|
|
106
|
-
style:
|
|
104
|
+
readOnly: o,
|
|
105
|
+
required: d,
|
|
106
|
+
style: G,
|
|
107
107
|
"aria-invalid": t ? "true" : void 0,
|
|
108
108
|
"aria-disabled": a ? "true" : void 0,
|
|
109
109
|
"aria-describedby": N || void 0,
|
|
110
110
|
...g,
|
|
111
|
-
...
|
|
111
|
+
...x
|
|
112
112
|
}
|
|
113
113
|
),
|
|
114
|
-
t && /* @__PURE__ */
|
|
115
|
-
!t &&
|
|
114
|
+
t && /* @__PURE__ */ i(O, { id: y, children: t }),
|
|
115
|
+
!t && n && /* @__PURE__ */ i(B, { id: h, children: n })
|
|
116
116
|
] });
|
|
117
117
|
}
|
|
118
118
|
);
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
({ label: e, children:
|
|
119
|
+
ce.displayName = "TextArea";
|
|
120
|
+
const H = v(({ children: e, ...n }, t) => /* @__PURE__ */ i("option", { ref: t, ...n, children: e }));
|
|
121
|
+
H.displayName = "Select.Option";
|
|
122
|
+
const L = v(
|
|
123
|
+
({ label: e, children: n, ...t }, d) => /* @__PURE__ */ i("optgroup", { ref: d, label: e, ...t, children: n })
|
|
124
124
|
);
|
|
125
|
-
|
|
126
|
-
const
|
|
125
|
+
L.displayName = "Select.OptionGroup";
|
|
126
|
+
const _ = v(
|
|
127
127
|
({
|
|
128
128
|
label: e,
|
|
129
|
-
helper:
|
|
129
|
+
helper: n,
|
|
130
130
|
error: t,
|
|
131
|
-
required:
|
|
131
|
+
required: d = !1,
|
|
132
132
|
disabled: a = !1,
|
|
133
|
-
placeholder:
|
|
133
|
+
placeholder: o,
|
|
134
134
|
children: c,
|
|
135
|
-
id:
|
|
135
|
+
id: s,
|
|
136
136
|
className: l,
|
|
137
|
-
...
|
|
138
|
-
},
|
|
139
|
-
const
|
|
137
|
+
...f
|
|
138
|
+
}, p) => {
|
|
139
|
+
const x = S(), m = s || x, u = n ? `${m}-helper` : void 0, r = t ? `${m}-error` : void 0, h = [u, r].filter(Boolean).join(" "), y = I({
|
|
140
140
|
disabled: a,
|
|
141
141
|
invalid: !!t
|
|
142
142
|
});
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
e && /* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ C("div", { className: b(F.field, l), children: [
|
|
144
|
+
e && /* @__PURE__ */ i(k, { htmlFor: m, required: d, disabled: a, children: e }),
|
|
145
|
+
/* @__PURE__ */ C(
|
|
146
146
|
"select",
|
|
147
147
|
{
|
|
148
|
-
ref:
|
|
149
|
-
id:
|
|
150
|
-
className:
|
|
148
|
+
ref: p,
|
|
149
|
+
id: m,
|
|
150
|
+
className: F.select,
|
|
151
151
|
disabled: a,
|
|
152
|
-
required:
|
|
152
|
+
required: d,
|
|
153
153
|
"aria-invalid": t ? "true" : void 0,
|
|
154
154
|
"aria-disabled": a ? "true" : void 0,
|
|
155
|
-
"aria-describedby":
|
|
156
|
-
...
|
|
157
|
-
...
|
|
155
|
+
"aria-describedby": h || void 0,
|
|
156
|
+
...y,
|
|
157
|
+
...f,
|
|
158
158
|
children: [
|
|
159
|
-
|
|
159
|
+
o && /* @__PURE__ */ i("option", { value: "", disabled: !0, children: o }),
|
|
160
160
|
c
|
|
161
161
|
]
|
|
162
162
|
}
|
|
163
163
|
),
|
|
164
|
-
t && /* @__PURE__ */
|
|
165
|
-
!t &&
|
|
164
|
+
t && /* @__PURE__ */ i(O, { id: r, children: t }),
|
|
165
|
+
!t && n && /* @__PURE__ */ i(B, { id: u, children: n })
|
|
166
166
|
] });
|
|
167
167
|
}
|
|
168
168
|
);
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
({
|
|
175
|
-
const
|
|
176
|
-
disabled:
|
|
177
|
-
invalid: t,
|
|
178
|
-
size: o,
|
|
179
|
-
variant: e
|
|
169
|
+
_.displayName = "Select";
|
|
170
|
+
const z = _;
|
|
171
|
+
z.Option = H;
|
|
172
|
+
z.OptionGroup = L;
|
|
173
|
+
const J = v(
|
|
174
|
+
({ disabled: e = !1, children: n, className: t, ...d }, a) => {
|
|
175
|
+
const o = I({
|
|
176
|
+
disabled: e
|
|
180
177
|
});
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ C("label", { className: b(R.radio, t), ...o, children: [
|
|
179
|
+
/* @__PURE__ */ i(
|
|
183
180
|
"input",
|
|
184
181
|
{
|
|
185
|
-
ref:
|
|
182
|
+
ref: a,
|
|
186
183
|
type: "radio",
|
|
187
|
-
className:
|
|
188
|
-
disabled:
|
|
189
|
-
|
|
190
|
-
...c
|
|
184
|
+
className: R.input,
|
|
185
|
+
disabled: e,
|
|
186
|
+
...d
|
|
191
187
|
}
|
|
192
188
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
189
|
+
/* @__PURE__ */ i("span", { className: R.indicator }),
|
|
190
|
+
n && /* @__PURE__ */ i("span", { className: R.label, children: n })
|
|
195
191
|
] });
|
|
196
192
|
}
|
|
197
193
|
);
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
({
|
|
201
|
-
const
|
|
202
|
-
disabled:
|
|
203
|
-
|
|
204
|
-
required: t
|
|
194
|
+
J.displayName = "Radio";
|
|
195
|
+
const K = v(
|
|
196
|
+
({ disabled: e = !1, required: n = !1, children: t, className: d, ...a }, o) => {
|
|
197
|
+
const c = I({
|
|
198
|
+
disabled: e,
|
|
199
|
+
required: n
|
|
205
200
|
});
|
|
206
|
-
return /* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
201
|
+
return /* @__PURE__ */ C("label", { className: b($.checkbox, d), ...c, children: [
|
|
202
|
+
/* @__PURE__ */ i(
|
|
208
203
|
"input",
|
|
209
204
|
{
|
|
210
|
-
ref:
|
|
205
|
+
ref: o,
|
|
211
206
|
type: "checkbox",
|
|
212
|
-
className:
|
|
213
|
-
disabled:
|
|
214
|
-
required:
|
|
215
|
-
"aria-
|
|
216
|
-
|
|
217
|
-
...i
|
|
207
|
+
className: $.input,
|
|
208
|
+
disabled: e,
|
|
209
|
+
required: n,
|
|
210
|
+
"aria-required": n || void 0,
|
|
211
|
+
...a
|
|
218
212
|
}
|
|
219
213
|
),
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
|
|
214
|
+
/* @__PURE__ */ i("span", { className: $.indicator }),
|
|
215
|
+
t && /* @__PURE__ */ i("span", { className: $.label, "data-required": n || void 0, children: t })
|
|
222
216
|
] });
|
|
223
217
|
}
|
|
224
218
|
);
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
const e =
|
|
219
|
+
K.displayName = "Checkbox";
|
|
220
|
+
const M = T(void 0);
|
|
221
|
+
function le() {
|
|
222
|
+
const e = E(M);
|
|
229
223
|
if (!e)
|
|
230
224
|
throw new Error("RadioGroup.Option must be used within RadioGroup");
|
|
231
225
|
return e;
|
|
232
226
|
}
|
|
233
|
-
const Q =
|
|
227
|
+
const Q = v(
|
|
234
228
|
({
|
|
235
229
|
value: e,
|
|
236
|
-
onChange:
|
|
230
|
+
onChange: n,
|
|
237
231
|
name: t,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}, R = y({
|
|
253
|
-
disabled: r,
|
|
254
|
-
invalid: !!d,
|
|
255
|
-
size: a === "medium" ? void 0 : a,
|
|
256
|
-
variant: a === "medium" ? s : void 0
|
|
232
|
+
label: d,
|
|
233
|
+
helper: a,
|
|
234
|
+
error: o,
|
|
235
|
+
required: c = !1,
|
|
236
|
+
disabled: s = !1,
|
|
237
|
+
direction: l = "column",
|
|
238
|
+
children: f,
|
|
239
|
+
className: p,
|
|
240
|
+
...x
|
|
241
|
+
}, m) => {
|
|
242
|
+
const u = S(), r = x.id || u, h = a ? `${r}-helper` : void 0, y = o ? `${r}-error` : void 0, N = [h, y].filter(Boolean).join(" "), g = (A) => {
|
|
243
|
+
!s && n && n(A);
|
|
244
|
+
}, G = I({
|
|
245
|
+
disabled: s
|
|
257
246
|
});
|
|
258
|
-
return /* @__PURE__ */
|
|
259
|
-
|
|
260
|
-
/* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ C("div", { ref: m, className: b(P.field, p), ...G, ...x, children: [
|
|
248
|
+
d && /* @__PURE__ */ i(k, { required: c, disabled: s, children: d }),
|
|
249
|
+
/* @__PURE__ */ i(M.Provider, { value: { disabled: s, name: t, onChange: g, value: e }, children: /* @__PURE__ */ i(
|
|
261
250
|
"div",
|
|
262
251
|
{
|
|
263
|
-
className:
|
|
264
|
-
"data-direction":
|
|
252
|
+
className: P.options,
|
|
253
|
+
"data-direction": l,
|
|
265
254
|
role: "radiogroup",
|
|
266
|
-
"aria-describedby":
|
|
267
|
-
"aria-invalid":
|
|
268
|
-
children:
|
|
255
|
+
"aria-describedby": N || void 0,
|
|
256
|
+
"aria-invalid": o ? "true" : void 0,
|
|
257
|
+
children: f
|
|
269
258
|
}
|
|
270
259
|
) }),
|
|
271
|
-
|
|
272
|
-
!
|
|
260
|
+
o && /* @__PURE__ */ i(O, { id: y, children: o }),
|
|
261
|
+
!o && a && /* @__PURE__ */ i(B, { id: h, children: a })
|
|
273
262
|
] });
|
|
274
263
|
}
|
|
275
264
|
);
|
|
276
265
|
Q.displayName = "RadioGroup";
|
|
277
|
-
const U =
|
|
278
|
-
({ value: e, children:
|
|
279
|
-
const
|
|
280
|
-
|
|
266
|
+
const U = v(
|
|
267
|
+
({ value: e, children: n, disabled: t, ...d }, a) => {
|
|
268
|
+
const o = le(), c = o.value === e, s = o.disabled || t, l = () => {
|
|
269
|
+
s || o.onChange(e);
|
|
281
270
|
};
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
/* @__PURE__ */ n("span", { className: A.indicator }),
|
|
298
|
-
o && /* @__PURE__ */ n("span", { className: A.optionLabel, children: o })
|
|
299
|
-
] });
|
|
271
|
+
return /* @__PURE__ */ i(
|
|
272
|
+
J,
|
|
273
|
+
{
|
|
274
|
+
ref: a,
|
|
275
|
+
name: o.name,
|
|
276
|
+
value: e,
|
|
277
|
+
checked: c,
|
|
278
|
+
disabled: s,
|
|
279
|
+
onChange: l,
|
|
280
|
+
...d,
|
|
281
|
+
children: n
|
|
282
|
+
}
|
|
283
|
+
);
|
|
300
284
|
}
|
|
301
285
|
);
|
|
302
286
|
U.displayName = "RadioGroup.Option";
|
|
303
|
-
const
|
|
287
|
+
const xe = Object.assign(Q, {
|
|
304
288
|
Option: U
|
|
305
|
-
}), W =
|
|
306
|
-
function
|
|
307
|
-
const e =
|
|
289
|
+
}), W = T(void 0);
|
|
290
|
+
function re() {
|
|
291
|
+
const e = E(W);
|
|
308
292
|
if (!e)
|
|
309
293
|
throw new Error("CheckboxGroup.Option must be used within CheckboxGroup");
|
|
310
294
|
return e;
|
|
311
295
|
}
|
|
312
|
-
const X =
|
|
296
|
+
const X = v(
|
|
313
297
|
({
|
|
314
298
|
value: e,
|
|
315
|
-
onChange:
|
|
299
|
+
onChange: n,
|
|
316
300
|
name: t,
|
|
317
|
-
label:
|
|
301
|
+
label: d,
|
|
318
302
|
helper: a,
|
|
319
|
-
error:
|
|
303
|
+
error: o,
|
|
320
304
|
required: c = !1,
|
|
321
|
-
disabled:
|
|
305
|
+
disabled: s = !1,
|
|
322
306
|
direction: l = "column",
|
|
323
|
-
children:
|
|
324
|
-
className:
|
|
325
|
-
...
|
|
326
|
-
},
|
|
327
|
-
const
|
|
328
|
-
!
|
|
329
|
-
},
|
|
330
|
-
disabled:
|
|
331
|
-
invalid: !!i
|
|
307
|
+
children: f,
|
|
308
|
+
className: p,
|
|
309
|
+
...x
|
|
310
|
+
}, m) => {
|
|
311
|
+
const u = S(), r = x.id || u, h = a ? `${r}-helper` : void 0, y = o ? `${r}-error` : void 0, N = [h, y].filter(Boolean).join(" "), g = (A) => {
|
|
312
|
+
!s && n && n(A);
|
|
313
|
+
}, G = I({
|
|
314
|
+
disabled: s
|
|
332
315
|
});
|
|
333
|
-
return /* @__PURE__ */
|
|
334
|
-
|
|
335
|
-
/* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ C("div", { ref: m, className: b(V.field, p), ...G, ...x, children: [
|
|
317
|
+
d && /* @__PURE__ */ i(k, { required: c, disabled: s, children: d }),
|
|
318
|
+
/* @__PURE__ */ i(W.Provider, { value: { disabled: s, name: t, onChange: g, value: e }, children: /* @__PURE__ */ i(
|
|
336
319
|
"div",
|
|
337
320
|
{
|
|
338
|
-
className:
|
|
321
|
+
className: V.options,
|
|
339
322
|
"data-direction": l,
|
|
340
323
|
role: "group",
|
|
341
324
|
"aria-describedby": N || void 0,
|
|
342
|
-
"aria-invalid":
|
|
343
|
-
children:
|
|
325
|
+
"aria-invalid": o ? "true" : void 0,
|
|
326
|
+
children: f
|
|
344
327
|
}
|
|
345
328
|
) }),
|
|
346
|
-
|
|
347
|
-
!
|
|
329
|
+
o && /* @__PURE__ */ i(O, { id: y, children: o }),
|
|
330
|
+
!o && a && /* @__PURE__ */ i(B, { id: h, children: a })
|
|
348
331
|
] });
|
|
349
332
|
}
|
|
350
333
|
);
|
|
351
334
|
X.displayName = "CheckboxGroup";
|
|
352
|
-
const Y =
|
|
353
|
-
({ value: e, children:
|
|
354
|
-
const
|
|
355
|
-
if (!
|
|
356
|
-
const
|
|
357
|
-
|
|
335
|
+
const Y = v(
|
|
336
|
+
({ value: e, children: n, disabled: t, ...d }, a) => {
|
|
337
|
+
const o = re(), c = o.value.includes(e), s = o.disabled || t, l = () => {
|
|
338
|
+
if (!s) {
|
|
339
|
+
const f = c ? o.value.filter((p) => p !== e) : [...o.value, e];
|
|
340
|
+
o.onChange(f);
|
|
358
341
|
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
required: s,
|
|
374
|
-
onChange: v,
|
|
375
|
-
className: j.input,
|
|
376
|
-
"aria-required": s || void 0,
|
|
377
|
-
...i,
|
|
378
|
-
id: d
|
|
379
|
-
}
|
|
380
|
-
),
|
|
381
|
-
/* @__PURE__ */ n("span", { className: j.indicator }),
|
|
382
|
-
o && /* @__PURE__ */ n(k, { required: s, disabled: u, htmlFor: d, children: o })
|
|
383
|
-
] });
|
|
342
|
+
};
|
|
343
|
+
return /* @__PURE__ */ i(
|
|
344
|
+
K,
|
|
345
|
+
{
|
|
346
|
+
ref: a,
|
|
347
|
+
name: o.name,
|
|
348
|
+
value: e,
|
|
349
|
+
checked: c,
|
|
350
|
+
disabled: s,
|
|
351
|
+
onChange: l,
|
|
352
|
+
...d,
|
|
353
|
+
children: n
|
|
354
|
+
}
|
|
355
|
+
);
|
|
384
356
|
}
|
|
385
357
|
);
|
|
386
358
|
Y.displayName = "CheckboxGroup.Option";
|
|
387
359
|
const ye = Object.assign(X, {
|
|
388
360
|
Option: Y
|
|
389
|
-
}), Z =
|
|
390
|
-
function
|
|
391
|
-
const e =
|
|
361
|
+
}), Z = T(void 0);
|
|
362
|
+
function pe() {
|
|
363
|
+
const e = E(Z);
|
|
392
364
|
if (!e)
|
|
393
|
-
throw new Error("
|
|
365
|
+
throw new Error("ChipInput.Option must be used within ChipInput");
|
|
394
366
|
return e;
|
|
395
367
|
}
|
|
396
|
-
const q =
|
|
368
|
+
const q = v(
|
|
397
369
|
({
|
|
398
370
|
value: e,
|
|
399
|
-
onChange:
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
/* @__PURE__ */
|
|
371
|
+
onChange: n,
|
|
372
|
+
multiple: t = !1,
|
|
373
|
+
name: d,
|
|
374
|
+
label: a,
|
|
375
|
+
helper: o,
|
|
376
|
+
error: c,
|
|
377
|
+
required: s = !1,
|
|
378
|
+
disabled: l = !1,
|
|
379
|
+
gap: f = "2",
|
|
380
|
+
wrap: p = !0,
|
|
381
|
+
children: x,
|
|
382
|
+
className: m,
|
|
383
|
+
...u
|
|
384
|
+
}, r) => {
|
|
385
|
+
const h = S(), y = u.id || h, N = o ? `${y}-helper` : void 0, g = c ? `${y}-error` : void 0, G = [N, g].filter(Boolean).join(" "), A = (ne) => {
|
|
386
|
+
l || n(ne);
|
|
387
|
+
}, te = I({
|
|
388
|
+
invalid: !!c
|
|
389
|
+
}), oe = t ? "group" : "radiogroup";
|
|
390
|
+
return /* @__PURE__ */ C("div", { ref: r, className: b(j.field, m), ...te, ...u, children: [
|
|
391
|
+
a && /* @__PURE__ */ i(k, { required: s, disabled: l, children: a }),
|
|
392
|
+
/* @__PURE__ */ i(
|
|
420
393
|
Z.Provider,
|
|
421
394
|
{
|
|
422
395
|
value: {
|
|
423
|
-
disabled:
|
|
424
|
-
|
|
425
|
-
|
|
396
|
+
disabled: l,
|
|
397
|
+
multiple: t,
|
|
398
|
+
name: d,
|
|
399
|
+
onChange: A,
|
|
426
400
|
value: e
|
|
427
401
|
},
|
|
428
|
-
children: /* @__PURE__ */
|
|
402
|
+
children: /* @__PURE__ */ i(
|
|
429
403
|
"div",
|
|
430
404
|
{
|
|
431
|
-
className:
|
|
432
|
-
"data-gap":
|
|
433
|
-
"data-wrap":
|
|
434
|
-
role:
|
|
435
|
-
"aria-describedby":
|
|
436
|
-
"aria-invalid":
|
|
437
|
-
children:
|
|
405
|
+
className: j.options,
|
|
406
|
+
"data-gap": f,
|
|
407
|
+
"data-wrap": p,
|
|
408
|
+
role: oe,
|
|
409
|
+
"aria-describedby": G || void 0,
|
|
410
|
+
"aria-invalid": c ? "true" : void 0,
|
|
411
|
+
children: x
|
|
438
412
|
}
|
|
439
413
|
)
|
|
440
414
|
}
|
|
441
415
|
),
|
|
442
|
-
|
|
443
|
-
!
|
|
416
|
+
c && /* @__PURE__ */ i(O, { id: g, children: c }),
|
|
417
|
+
!c && o && /* @__PURE__ */ i(B, { id: N, children: o })
|
|
444
418
|
] });
|
|
445
419
|
}
|
|
446
420
|
);
|
|
447
|
-
q.displayName = "
|
|
448
|
-
const ee =
|
|
449
|
-
({ value: e, children:
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
421
|
+
q.displayName = "ChipInput";
|
|
422
|
+
const ee = v(
|
|
423
|
+
({ value: e, children: n, disabled: t, iconLeft: d, iconRight: a, ...o }, c) => {
|
|
424
|
+
const s = pe(), l = s.disabled || t, f = !!(d || a);
|
|
425
|
+
let p = !1;
|
|
426
|
+
s.multiple ? p = Array.isArray(s.value) && s.value.includes(e) : p = s.value === e;
|
|
427
|
+
const x = () => {
|
|
428
|
+
if (!l)
|
|
429
|
+
if (s.multiple) {
|
|
430
|
+
const u = Array.isArray(s.value) ? s.value : [], r = p ? u.filter((h) => h !== e) : [...u, e];
|
|
431
|
+
s.onChange(r);
|
|
432
|
+
} else
|
|
433
|
+
s.onChange(e);
|
|
434
|
+
}, m = I({
|
|
435
|
+
disabled: l,
|
|
436
|
+
selected: p,
|
|
437
|
+
...f && { "has-icon": !0 }
|
|
455
438
|
});
|
|
456
|
-
return /* @__PURE__ */
|
|
439
|
+
return /* @__PURE__ */ C(
|
|
457
440
|
"button",
|
|
458
441
|
{
|
|
459
|
-
ref:
|
|
442
|
+
ref: c,
|
|
460
443
|
type: "button",
|
|
461
|
-
className:
|
|
462
|
-
onClick:
|
|
463
|
-
disabled:
|
|
464
|
-
"aria-pressed":
|
|
465
|
-
...
|
|
466
|
-
...
|
|
467
|
-
children:
|
|
444
|
+
className: j.option,
|
|
445
|
+
onClick: x,
|
|
446
|
+
disabled: l,
|
|
447
|
+
"aria-pressed": p,
|
|
448
|
+
...m,
|
|
449
|
+
...o,
|
|
450
|
+
children: [
|
|
451
|
+
d,
|
|
452
|
+
n,
|
|
453
|
+
a
|
|
454
|
+
]
|
|
468
455
|
}
|
|
469
456
|
);
|
|
470
457
|
}
|
|
471
458
|
);
|
|
472
|
-
ee.displayName = "
|
|
473
|
-
const
|
|
459
|
+
ee.displayName = "ChipInput.Option";
|
|
460
|
+
const Ce = Object.assign(q, {
|
|
474
461
|
Option: ee
|
|
475
|
-
}), te = E(void 0);
|
|
476
|
-
function ve() {
|
|
477
|
-
const e = D(te);
|
|
478
|
-
if (!e)
|
|
479
|
-
throw new Error("ChipMultipleInput.Option must be used within ChipMultipleInput");
|
|
480
|
-
return e;
|
|
481
|
-
}
|
|
482
|
-
const ie = b(
|
|
483
|
-
({
|
|
484
|
-
value: e,
|
|
485
|
-
onChange: o,
|
|
486
|
-
name: t,
|
|
487
|
-
label: s,
|
|
488
|
-
helper: a,
|
|
489
|
-
error: i,
|
|
490
|
-
required: c = !1,
|
|
491
|
-
disabled: d = !1,
|
|
492
|
-
gap: l = "2",
|
|
493
|
-
wrap: r = !0,
|
|
494
|
-
children: u,
|
|
495
|
-
className: v,
|
|
496
|
-
...h
|
|
497
|
-
}, m) => {
|
|
498
|
-
const p = O(), f = h.id || p, C = a ? `${f}-helper` : void 0, N = i ? `${f}-error` : void 0, g = [C, N].filter(Boolean).join(" "), S = (R) => {
|
|
499
|
-
!d && o && o(R);
|
|
500
|
-
}, w = y({
|
|
501
|
-
invalid: !!i
|
|
502
|
-
});
|
|
503
|
-
return /* @__PURE__ */ I("div", { ref: m, className: x(L.field, v), ...w, ...h, children: [
|
|
504
|
-
s && /* @__PURE__ */ n(k, { required: c, disabled: d, children: s }),
|
|
505
|
-
/* @__PURE__ */ n(
|
|
506
|
-
te.Provider,
|
|
507
|
-
{
|
|
508
|
-
value: {
|
|
509
|
-
disabled: d,
|
|
510
|
-
name: t,
|
|
511
|
-
onChange: S,
|
|
512
|
-
value: e
|
|
513
|
-
},
|
|
514
|
-
children: /* @__PURE__ */ n(
|
|
515
|
-
"div",
|
|
516
|
-
{
|
|
517
|
-
className: L.options,
|
|
518
|
-
"data-gap": l,
|
|
519
|
-
"data-wrap": r,
|
|
520
|
-
role: "group",
|
|
521
|
-
"aria-describedby": g || void 0,
|
|
522
|
-
"aria-invalid": i ? "true" : void 0,
|
|
523
|
-
children: u
|
|
524
|
-
}
|
|
525
|
-
)
|
|
526
|
-
}
|
|
527
|
-
),
|
|
528
|
-
i && /* @__PURE__ */ n(G, { id: N, children: i }),
|
|
529
|
-
!i && a && /* @__PURE__ */ n(B, { id: C, children: a })
|
|
530
|
-
] });
|
|
531
|
-
}
|
|
532
|
-
);
|
|
533
|
-
ie.displayName = "ChipMultipleInput";
|
|
534
|
-
const ne = b(
|
|
535
|
-
({ value: e, children: o, disabled: t, ...s }, a) => {
|
|
536
|
-
const i = ve(), c = i.value.includes(e), d = i.disabled || t, l = () => {
|
|
537
|
-
if (!d && i.onChange) {
|
|
538
|
-
const u = c ? i.value.filter((v) => v !== e) : [...i.value, e];
|
|
539
|
-
i.onChange(u);
|
|
540
|
-
}
|
|
541
|
-
}, r = y({
|
|
542
|
-
disabled: d,
|
|
543
|
-
selected: c
|
|
544
|
-
});
|
|
545
|
-
return /* @__PURE__ */ n(
|
|
546
|
-
"button",
|
|
547
|
-
{
|
|
548
|
-
ref: a,
|
|
549
|
-
type: "button",
|
|
550
|
-
className: L.option,
|
|
551
|
-
onClick: l,
|
|
552
|
-
disabled: d,
|
|
553
|
-
"aria-pressed": c,
|
|
554
|
-
...r,
|
|
555
|
-
...s,
|
|
556
|
-
children: o
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
);
|
|
561
|
-
ne.displayName = "ChipMultipleInput.Option";
|
|
562
|
-
const Se = Object.assign(ie, {
|
|
563
|
-
Option: ne
|
|
564
462
|
});
|
|
565
463
|
export {
|
|
566
|
-
|
|
464
|
+
K as Checkbox,
|
|
567
465
|
ye as CheckboxGroup,
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
G as ErrorText,
|
|
466
|
+
Ce as ChipInput,
|
|
467
|
+
O as ErrorText,
|
|
571
468
|
B as HelperText,
|
|
572
469
|
k as Label,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
470
|
+
J as Radio,
|
|
471
|
+
xe as RadioGroup,
|
|
472
|
+
z as Select,
|
|
473
|
+
ce as TextArea,
|
|
474
|
+
de as TextInput
|
|
578
475
|
};
|