@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.js CHANGED
@@ -1,98 +1,98 @@
1
- import { jsx as o, jsxs as I } from "react/jsx-runtime";
2
- import { labelStyles as Ee, helperTextStyles as je, errorTextStyles as Te, textInputStyles as T, textAreaStyles as ee, selectStyles as te, radioStyles as U, checkboxStyles as H, radioGroupStyles as ne, checkboxGroupStyles as oe, chipInputStyles as Y, comboboxInputStyles as C, selectableInputStyles as F, currencyInputStyles as L } from "@versaur/core/forms";
3
- import { forwardRef as f, useId as D, createContext as P, useContext as Q, useState as j, useEffect as M, useCallback as K, useRef as Le, useMemo as ae } from "react";
4
- import { u as g, I as Z, c as Fe, F as Pe } from "./helpers-D23F5WBX.js";
5
- import { c as x } from "./cx-B9vmfsc1.js";
6
- import { SearchIcon as Qe, MailIcon as Me, LockIcon as Ve, ChevronDownIcon as ze, CheckIcon as Ue } from "@versaur/icons";
7
- import { D as se } from "./drawer-BjNHPqBr.js";
8
- const k = f(
9
- ({ required: e = !1, disabled: i = !1, children: n, className: c, ...a }, s) => {
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: i,
11
+ disabled: a,
12
12
  required: e
13
13
  });
14
- return /* @__PURE__ */ o("label", { ref: s, className: x(Ee.label, c), ...t, ...a, children: n });
14
+ return /* @__PURE__ */ s("label", { ref: o, className: y(Te.label, c), ...t, ...i, children: n });
15
15
  }
16
16
  );
17
- k.displayName = "Label";
18
- const R = f(({ children: e, className: i, ...n }, c) => /* @__PURE__ */ o("p", { ref: c, className: x(je.helper, i), ...n, children: e }));
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 A = f(({ children: e, className: i, ...n }, c) => /* @__PURE__ */ o("p", { ref: c, className: x(Te.error, i), role: "alert", "aria-live": "polite", ...n, children: e }));
21
- A.displayName = "ErrorText";
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: i,
25
+ helper: a,
26
26
  error: n,
27
27
  required: c = !1,
28
- disabled: a = !1,
29
- readOnly: s = !1,
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
- ...u
35
- }, p) => {
36
- const b = D(), m = l || b, h = i ? `${m}-helper` : void 0, v = n ? `${m}-error` : void 0, y = [h, v].filter(Boolean).join(" "), N = g({
37
- disabled: a,
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: s
41
+ readOnly: o
42
42
  });
43
- return /* @__PURE__ */ I("div", { className: x(T.field, d), children: [
44
- e && /* @__PURE__ */ o(k, { htmlFor: m, required: c, disabled: a, children: e }),
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__ */ o("span", { className: T["left-icon"], children: t }),
47
- /* @__PURE__ */ o(
46
+ t && /* @__PURE__ */ s("span", { className: T["left-icon"], children: t }),
47
+ /* @__PURE__ */ s(
48
48
  "input",
49
49
  {
50
- ref: p,
51
- id: m,
50
+ ref: u,
51
+ id: h,
52
52
  type: "text",
53
53
  className: T.input,
54
- disabled: a,
55
- readOnly: s,
54
+ disabled: i,
55
+ readOnly: o,
56
56
  required: c,
57
57
  "aria-invalid": n ? "true" : void 0,
58
- "aria-disabled": a ? "true" : void 0,
59
- "aria-describedby": y || void 0,
60
- ...u
58
+ "aria-disabled": i ? "true" : void 0,
59
+ "aria-describedby": v || void 0,
60
+ ...p
61
61
  }
62
62
  ),
63
- r && /* @__PURE__ */ o("span", { className: T["right-icon"], children: r })
63
+ r && /* @__PURE__ */ s("span", { className: T["right-icon"], children: r })
64
64
  ] }),
65
- n && /* @__PURE__ */ o(A, { id: v, children: n }),
66
- !n && i && /* @__PURE__ */ o(R, { id: h, children: i })
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 He = f(({ leftIcon: e, ...i }, n) => /* @__PURE__ */ o(_, { ref: n, inputMode: "search", leftIcon: e ?? /* @__PURE__ */ o(Z, { as: Qe }), ...i }));
72
- He.displayName = "SearchInput";
73
- const Ke = f(({ leftIcon: e, ...i }, n) => /* @__PURE__ */ o(_, { ref: n, type: "email", inputMode: "email", leftIcon: e ?? /* @__PURE__ */ o(Z, { as: Me }), ...i }));
74
- Ke.displayName = "EmailInput";
75
- const _e = f(({ leftIcon: e, ...i }, n) => /* @__PURE__ */ o(_, { ref: n, type: "password", leftIcon: e ?? /* @__PURE__ */ o(Z, { as: Ve }), ...i }));
76
- _e.displayName = "PasswordInput";
77
- const Je = f(
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: i,
80
+ helper: a,
81
81
  error: n,
82
82
  required: c = !1,
83
- disabled: a = !1,
84
- readOnly: s = !1,
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: u,
90
- ...p
89
+ className: p,
90
+ ...u
91
91
  }, b) => {
92
- const m = D(), h = d || m, v = i ? `${h}-helper` : void 0, y = n ? `${h}-error` : void 0, N = [v, y].filter(Boolean).join(" "), w = g({
93
- disabled: a,
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: s,
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: x(ee.field, u), children: [
104
- e && /* @__PURE__ */ o(k, { htmlFor: h, required: c, disabled: a, children: e }),
105
- /* @__PURE__ */ o(
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: h,
110
- className: ee.textarea,
111
- disabled: a,
112
- readOnly: s,
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": a ? "true" : void 0,
116
+ "aria-disabled": i ? "true" : void 0,
117
117
  "aria-describedby": N || void 0,
118
- ...w,
119
- ...p
118
+ ...S,
119
+ ...u
120
120
  }
121
121
  ),
122
- n && /* @__PURE__ */ o(A, { id: y, children: n }),
123
- !n && i && /* @__PURE__ */ o(R, { id: v, children: i })
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
- Je.displayName = "TextArea";
128
- const ie = f(({ children: e, ...i }, n) => /* @__PURE__ */ o("option", { ref: n, ...i, 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: i, ...n }, c) => /* @__PURE__ */ o("optgroup", { ref: c, label: e, ...n, children: i })
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: i,
137
+ helper: a,
138
138
  error: n,
139
139
  required: c = !1,
140
- disabled: a = !1,
141
- placeholder: s,
140
+ disabled: i = !1,
141
+ placeholder: o,
142
142
  children: t,
143
143
  id: r,
144
144
  className: l,
145
145
  ...d
146
- }, u) => {
147
- const p = D(), b = r || p, m = i ? `${b}-helper` : void 0, h = n ? `${b}-error` : void 0, v = [m, h].filter(Boolean).join(" "), y = g({
148
- disabled: a,
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: x(te.field, l), children: [
152
- e && /* @__PURE__ */ o(k, { htmlFor: b, required: c, disabled: a, children: e }),
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: u,
156
+ ref: p,
157
157
  id: b,
158
- className: te.select,
159
- disabled: a,
158
+ className: ne.select,
159
+ disabled: i,
160
160
  required: c,
161
161
  "aria-invalid": n ? "true" : void 0,
162
- "aria-disabled": a ? "true" : void 0,
163
- "aria-describedby": v || void 0,
164
- ...y,
162
+ "aria-disabled": i ? "true" : void 0,
163
+ "aria-describedby": x || void 0,
164
+ ...v,
165
165
  ...d,
166
166
  children: [
167
- s && /* @__PURE__ */ o("option", { value: "", disabled: !0, children: s }),
167
+ o && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: o }),
168
168
  t
169
169
  ]
170
170
  }
171
171
  ),
172
- n && /* @__PURE__ */ o(A, { id: h, children: n }),
173
- !n && i && /* @__PURE__ */ o(R, { id: m, children: i })
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: i, className: n, ...c }, a) => {
183
- const s = g({
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: x(U.radio, n), ...s, children: [
187
- /* @__PURE__ */ o("input", { ref: a, type: "radio", className: U.input, disabled: e, ...c }),
188
- /* @__PURE__ */ o("span", { className: U.indicator }),
189
- i && /* @__PURE__ */ o("span", { className: U.label, children: i })
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: i = !1, children: n, className: c, ...a }, s) => {
195
+ ({ disabled: e = !1, required: a = !1, children: n, className: c, ...i }, o) => {
196
196
  const t = g({
197
197
  disabled: e,
198
- required: i
198
+ required: a
199
199
  });
200
- return /* @__PURE__ */ I("label", { className: x(H.checkbox, c), ...t, children: [
201
- /* @__PURE__ */ o(
200
+ return /* @__PURE__ */ I("label", { className: y(H.checkbox, c), ...t, children: [
201
+ /* @__PURE__ */ s(
202
202
  "input",
203
203
  {
204
- ref: s,
204
+ ref: o,
205
205
  type: "checkbox",
206
206
  className: H.input,
207
207
  disabled: e,
208
- required: i,
209
- "aria-required": i || void 0,
210
- ...a
208
+ required: a,
209
+ "aria-required": a || void 0,
210
+ ...i
211
211
  }
212
212
  ),
213
- /* @__PURE__ */ o("span", { className: H.indicator }),
214
- n && /* @__PURE__ */ o("span", { className: H.label, "data-required": i || void 0, children: n })
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 = P(void 0);
220
- function We() {
221
- const e = Q(ue);
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: i,
229
+ onChange: a,
230
230
  name: n,
231
231
  label: c,
232
- helper: a,
233
- error: s,
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: u,
239
- ...p
238
+ className: p,
239
+ ...u
240
240
  }, b) => {
241
- const m = D(), h = p.id || m, v = a ? `${h}-helper` : void 0, y = s ? `${h}-error` : void 0, N = [v, y].filter(Boolean).join(" "), w = (S) => {
242
- !r && i && i(S);
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: x(ne.field, u), ...B, ...p, children: [
247
- c && /* @__PURE__ */ o(k, { required: t, disabled: r, children: c }),
248
- /* @__PURE__ */ o(ue.Provider, { value: { disabled: r, name: n, onChange: w, value: e }, children: /* @__PURE__ */ o(
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: ne.options,
251
+ className: oe.options,
252
252
  "data-direction": l,
253
253
  role: "radiogroup",
254
254
  "aria-describedby": N || void 0,
255
- "aria-invalid": s ? "true" : void 0,
255
+ "aria-invalid": o ? "true" : void 0,
256
256
  children: d
257
257
  }
258
258
  ) }),
259
- s && /* @__PURE__ */ o(A, { id: y, children: s }),
260
- !s && a && /* @__PURE__ */ o(R, { id: v, children: a })
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: i, disabled: n, ...c }, a) => {
267
- const s = We(), t = s.value === e, r = s.disabled || n, l = () => {
268
- r || s.onChange(e);
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__ */ o(
270
+ return /* @__PURE__ */ s(
271
271
  de,
272
272
  {
273
- ref: a,
274
- name: s.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: i
280
+ children: a
281
281
  }
282
282
  );
283
283
  }
284
284
  );
285
285
  me.displayName = "RadioGroup.Option";
286
- const dt = Object.assign(he, {
286
+ const ht = Object.assign(he, {
287
287
  Option: me
288
- }), be = P(void 0);
289
- function Xe() {
290
- const e = Q(be);
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: i,
298
+ onChange: a,
299
299
  name: n,
300
300
  label: c,
301
- helper: a,
302
- error: s,
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: u,
308
- ...p
307
+ className: p,
308
+ ...u
309
309
  }, b) => {
310
- const m = D(), h = p.id || m, v = a ? `${h}-helper` : void 0, y = s ? `${h}-error` : void 0, N = [v, y].filter(Boolean).join(" "), w = (S) => {
311
- !r && i && i(S);
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: x(oe.field, u), ...B, ...p, children: [
316
- c && /* @__PURE__ */ o(k, { required: t, disabled: r, children: c }),
317
- /* @__PURE__ */ o(be.Provider, { value: { disabled: r, name: n, onChange: w, value: e }, children: /* @__PURE__ */ o(
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: oe.options,
320
+ className: se.options,
321
321
  "data-direction": l,
322
322
  role: "group",
323
323
  "aria-describedby": N || void 0,
324
- "aria-invalid": s ? "true" : void 0,
324
+ "aria-invalid": o ? "true" : void 0,
325
325
  children: d
326
326
  }
327
327
  ) }),
328
- s && /* @__PURE__ */ o(A, { id: y, children: s }),
329
- !s && a && /* @__PURE__ */ o(R, { id: v, children: a })
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 ve = f(
335
- ({ value: e, children: i, disabled: n, ...c }, a) => {
336
- const s = Xe(), t = s.value.includes(e), r = s.disabled || n, l = () => {
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 ? s.value.filter((u) => u !== e) : [...s.value, e];
339
- s.onChange(d);
338
+ const d = t ? o.value.filter((p) => p !== e) : [...o.value, e];
339
+ o.onChange(d);
340
340
  }
341
341
  };
342
- return /* @__PURE__ */ o(
342
+ return /* @__PURE__ */ s(
343
343
  pe,
344
344
  {
345
- ref: a,
346
- name: s.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: i
352
+ children: a
353
353
  }
354
354
  );
355
355
  }
356
356
  );
357
- ve.displayName = "CheckboxGroup.Option";
358
- const pt = Object.assign(fe, {
359
- Option: ve
360
- }), ye = P(void 0);
361
- function Ye() {
362
- const e = Q(ye);
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 xe = f(
367
+ const ye = f(
368
368
  ({
369
369
  value: e,
370
- onChange: i,
370
+ onChange: a,
371
371
  multiple: n = !1,
372
372
  name: c,
373
- label: a,
374
- helper: s,
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: u = !0,
380
- children: p,
379
+ wrap: p = !0,
380
+ children: u,
381
381
  className: b,
382
- ...m
383
- }, h) => {
384
- const v = D(), y = m.id || v, N = s ? `${y}-helper` : void 0, w = t ? `${y}-error` : void 0, B = [N, w].filter(Boolean).join(" "), S = (E) => {
385
- l || i(E);
386
- }, $ = g({
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
- }), G = n ? "group" : "radiogroup";
389
- return /* @__PURE__ */ I("div", { ref: h, className: x(Y.field, b), ...$, ...m, children: [
390
- a && /* @__PURE__ */ o(k, { required: r, disabled: l, children: a }),
391
- /* @__PURE__ */ o(
392
- ye.Provider,
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: S,
398
+ onChange: w,
399
399
  value: e
400
400
  },
401
- children: /* @__PURE__ */ o(
401
+ children: /* @__PURE__ */ s(
402
402
  "div",
403
403
  {
404
- className: Y.options,
404
+ className: Z.options,
405
405
  "data-gap": d,
406
- "data-wrap": u,
407
- role: G,
406
+ "data-wrap": p,
407
+ role: k,
408
408
  "aria-describedby": B || void 0,
409
409
  "aria-invalid": t ? "true" : void 0,
410
- children: p
410
+ children: u
411
411
  }
412
412
  )
413
413
  }
414
414
  ),
415
- t && /* @__PURE__ */ o(A, { id: w, children: t }),
416
- !t && s && /* @__PURE__ */ o(R, { id: N, children: s })
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
- xe.displayName = "ChipInput";
420
+ ye.displayName = "ChipInput";
421
421
  const Ie = f(
422
- ({ value: e, children: i, disabled: n, iconLeft: c, iconRight: a, ...s }, t) => {
423
- const r = Ye(), l = r.disabled || n, d = !!(c || a);
424
- let u = !1;
425
- r.multiple ? u = Array.isArray(r.value) && r.value.includes(e) : u = r.value === e;
426
- const p = () => {
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 m = Array.isArray(r.value) ? r.value : [], h = u ? m.filter((v) => v !== e) : [...m, e];
430
- r.onChange(h);
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: u,
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: Y.option,
444
- onClick: p,
443
+ className: Z.option,
444
+ onClick: u,
445
445
  disabled: l,
446
- "aria-pressed": u,
446
+ "aria-pressed": p,
447
447
  ...b,
448
- ...s,
448
+ ...o,
449
449
  children: [
450
450
  c,
451
- i,
452
- a
451
+ a,
452
+ i
453
453
  ]
454
454
  }
455
455
  );
456
456
  }
457
457
  );
458
458
  Ie.displayName = "ChipInput.Option";
459
- const ut = Object.assign(xe, {
459
+ const bt = Object.assign(ye, {
460
460
  Option: Ie
461
- }), Ce = P(void 0);
462
- function V() {
463
- const e = Q(Ce);
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
- ({ children: e, className: i, ...n }, c) => {
470
- const a = V();
471
- return /* @__PURE__ */ o(se, { open: a.isOpen, onOpenChange: (s) => !s && a.closeListbox(), placement: "right", children: /* @__PURE__ */ o(se.Body, { children: /* @__PURE__ */ I("div", { className: C["drawer-container"], children: [
472
- /* @__PURE__ */ o("div", { className: C["drawer-input-wrapper"], children: /* @__PURE__ */ o(
473
- "input",
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: c,
476
+ ref: i,
490
477
  role: "listbox",
491
478
  "aria-multiselectable": "true",
492
- className: x(C["drawer-listbox"], i),
493
- ...n,
494
- children: e
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 Ze(e) {
502
- const [i, n] = j(e), [c, a] = j(!1), [s, t] = j(() => /* @__PURE__ */ new Map());
503
- M(() => {
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
- a((p) => !p);
494
+ i((u) => !u);
508
495
  }, []), l = K(() => {
509
- a(!1);
510
- }, []), d = K((p, b) => {
511
- t((m) => {
512
- const h = new Map(m);
513
- return h.set(p, b), h;
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
- }, []), u = K((p) => {
502
+ }, []), p = K((u) => {
516
503
  t((b) => {
517
- const m = new Map(b);
518
- return m.delete(p), m;
504
+ const h = new Map(b);
505
+ return h.delete(u), h;
519
506
  });
520
507
  }, []);
521
508
  return {
522
- internalValue: i,
509
+ internalValue: a,
523
510
  setInternalValue: n,
524
511
  isOpen: c,
525
512
  toggleOpen: r,
526
513
  closeListbox: l,
527
- optionRegistry: s,
514
+ optionRegistry: o,
528
515
  registerOption: d,
529
- unregisterOption: u
516
+ unregisterOption: p
530
517
  };
531
518
  }
532
- function qe(e, i) {
533
- const [n, c] = j("bottom"), a = Le(null);
534
- return M(() => {
535
- if (i !== "popup" || !e) return;
536
- const s = a.current;
537
- if (!s) return;
538
- s.matches(":popover-open") || s.showPopover(), requestAnimationFrame(() => {
539
- const r = s.previousElementSibling;
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 = s.getBoundingClientRect(), u = {
528
+ const l = r.getBoundingClientRect(), d = o.getBoundingClientRect(), p = {
542
529
  width: d.width,
543
530
  height: d.height
544
- }, p = Fe(
531
+ }, u = Ve(
545
532
  l,
546
- u,
533
+ p,
547
534
  100,
548
535
  ["top", "bottom"]
549
536
  );
550
- c(p);
537
+ c(u);
551
538
  });
552
- }, [e, i]), { internalRef: a, placement: n };
539
+ }, [e, a]), { internalRef: i, placement: n };
553
540
  }
554
541
  const Ne = f(
555
- ({ children: e, className: i, ...n }, c) => {
556
- const a = V(), { internalRef: s, placement: t } = qe(a.isOpen, a.variant);
557
- M(() => {
558
- const l = s.current;
559
- if (!l) return;
560
- const d = () => {
561
- l.matches(":popover-open") || a.closeListbox();
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 l.addEventListener("toggle", d), () => l.removeEventListener("toggle", d);
564
- }, [a, s]);
565
- const r = g({ placement: t });
566
- return /* @__PURE__ */ o(
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: (l) => {
570
- s.current = l, typeof c == "function" ? c(l) : c && (c.current = l);
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: x(C.listbox, i),
561
+ className: y(C.listbox, n),
575
562
  popover: "auto",
576
- ...r,
563
+ ...l,
577
564
  style: {
578
- positionAnchor: a.anchorName
565
+ positionAnchor: o.anchorName
579
566
  },
580
- ...n,
581
- children: /* @__PURE__ */ I("div", { className: C["listbox-inner"], children: [
582
- /* @__PURE__ */ o("div", { className: C["drawer-input-wrapper"], children: /* @__PURE__ */ o(
583
- "input",
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: i,
580
+ onChange: a,
607
581
  variant: n = "popup",
608
582
  disabled: c = !1,
609
- invalid: a = !1,
610
- label: s,
583
+ invalid: i = !1,
584
+ label: o,
611
585
  helper: t,
612
586
  error: r,
613
587
  required: l = !1,
614
- children: d,
588
+ multiple: d = !1,
589
+ children: p,
615
590
  className: u,
616
- ...p
617
- }, b) => {
618
- const m = D(), h = p.id || m, v = `${h}-button`, y = t ? `${h}-helper` : void 0, N = r ? `${h}-error` : void 0, w = [y, N].filter(Boolean).join(" "), B = `--combobox-anchor-${h.replace(/[^a-z0-9-]/gi, "")}`, {
619
- internalValue: S,
620
- setInternalValue: $,
621
- isOpen: G,
622
- toggleOpen: E,
623
- closeListbox: z,
624
- optionRegistry: J,
625
- registerOption: W,
626
- unregisterOption: X
627
- } = Ze(e), [O, Ge] = j("");
628
- M(() => {
629
- $(e);
630
- }, [e, $]);
631
- const De = (q) => {
632
- c || ($(q), i(q));
633
- }, $e = g({
634
- invalid: !!(r || a),
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: b, className: x(C.field, u), ...$e, ...p, children: [
638
- s && /* @__PURE__ */ o(k, { required: l, disabled: c, htmlFor: v, children: s }),
639
- /* @__PURE__ */ o(
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: S,
644
- onChange: De,
645
- isOpen: G,
646
- toggleOpen: E,
647
- closeListbox: z,
618
+ value: k,
619
+ onChange: Le,
620
+ isOpen: z,
621
+ toggleOpen: J,
622
+ closeListbox: W,
648
623
  variant: n,
649
- anchorName: B,
624
+ anchorName: w,
650
625
  buttonId: v,
651
- optionRegistry: J,
652
- registerOption: W,
653
- unregisterOption: X,
626
+ optionRegistry: X,
627
+ registerOption: O,
628
+ unregisterOption: De,
654
629
  disabled: c,
655
- searchQuery: O,
656
- setSearchQuery: Ge
630
+ multiple: d,
631
+ searchQuery: $e,
632
+ setSearchQuery: Ee
657
633
  },
658
- children: /* @__PURE__ */ o("div", { className: C.root, "aria-describedby": w || void 0, children: d })
634
+ children: /* @__PURE__ */ s("div", { className: C.root, "aria-describedby": B || void 0, children: p })
659
635
  }
660
636
  ),
661
- r && /* @__PURE__ */ o(A, { id: N, children: r }),
662
- !r && t && S.length === 0 && /* @__PURE__ */ o(R, { id: y, children: 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: i, iconLeft: n, iconRight: c, ...a }, s) => {
669
- const t = V(), r = t.value.length === 0, l = g({
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
- }, u = e || (r ? "Select" : `${t.value.length} selected`);
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: s,
657
+ ref: o,
681
658
  id: t.buttonId,
682
659
  type: "button",
683
- className: x(C.button, i),
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
- ...a,
667
+ ...i,
691
668
  children: [
692
- n && /* @__PURE__ */ o("span", { className: C["left-icon"], children: n }),
693
- /* @__PURE__ */ o("span", { className: C["button-content"], ...r && { "data-placeholder": "" }, children: u }),
694
- c ? /* @__PURE__ */ o("span", { className: C["right-icon"], children: c }) : /* @__PURE__ */ o("span", { className: C["right-icon"], "data-chevron": !0, children: /* @__PURE__ */ o(ze, {}) })
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: i, disabled: n = !1, className: c, ...a }, s) => {
703
- const t = V(), r = t.disabled || n, l = t.value.includes(e), d = typeof i == "string" ? i : String(e), u = !t.searchQuery || d.toLowerCase().includes(t.searchQuery.toLowerCase()) || e.toLowerCase().includes(t.searchQuery.toLowerCase());
704
- M(() => (t.registerOption(e, d), () => t.unregisterOption(e)), [e, d, t.registerOption, t.unregisterOption]);
705
- const p = () => {
706
- if (r) return;
707
- const h = l ? t.value.filter((v) => v !== e) : [...t.value, e];
708
- t.onChange(h);
709
- }, b = (h) => {
710
- (h.key === "Enter" || h.key === " ") && (h.preventDefault(), p());
711
- }, m = g({ active: l, disabled: r });
712
- return u ? /* @__PURE__ */ I(
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: s,
695
+ ref: o,
716
696
  role: "option",
717
- className: x(C.option, c),
718
- onClick: p,
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
- ...m,
723
- ...a,
702
+ ...h,
703
+ ...i,
724
704
  children: [
725
- /* @__PURE__ */ o("span", { className: C["option-check"], children: /* @__PURE__ */ o(Ue, { width: "1em", height: "1em" }) }),
726
- /* @__PURE__ */ o("span", { children: i })
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, ...i }, n) => {
735
- const c = V();
714
+ ({ className: e, ...a }, n) => {
715
+ const c = j();
736
716
  if (c.value.length === 0) return null;
737
- const a = (s) => {
738
- c.onChange(c.value.filter((t) => t !== s));
717
+ const i = (o) => {
718
+ c.onChange(c.value.filter((t) => t !== o));
739
719
  };
740
- return /* @__PURE__ */ o("div", { ref: n, className: x(C.chips, e), role: "group", ...i, children: c.value.map((s) => {
741
- const t = c.optionRegistry.get(s) ?? s;
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 ht = Object.assign(Se, {
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
- }), ke = P(void 0);
762
- function et() {
763
- const e = Q(ke);
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: i,
767
+ onChange: a,
772
768
  multiple: n = !1,
773
769
  name: c,
774
- disabled: a = !1,
775
- placement: s = "top",
770
+ disabled: i = !1,
771
+ placement: o = "top",
776
772
  children: t,
777
773
  className: r,
778
774
  ...l
779
775
  }, d) => {
780
- const u = (m) => {
781
- a || i(m);
782
- }, p = g({
783
- disabled: a
776
+ const p = (h) => {
777
+ i || a(h);
778
+ }, u = g({
779
+ disabled: i
784
780
  }), b = n ? "group" : "radiogroup";
785
- return /* @__PURE__ */ o("div", { ref: d, className: x(F.field, r), ...p, ...l, children: /* @__PURE__ */ o(
786
- ke.Provider,
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: a,
785
+ disabled: i,
790
786
  multiple: n,
791
787
  name: c,
792
- onChange: u,
788
+ onChange: p,
793
789
  value: e,
794
- placement: s
790
+ placement: o
795
791
  },
796
- children: /* @__PURE__ */ o("div", { role: b, children: t })
792
+ children: /* @__PURE__ */ s("div", { role: b, children: t })
797
793
  }
798
794
  ) });
799
795
  }
800
796
  );
801
797
  Re.displayName = "SelectableInput";
802
- const Ae = f(
803
- ({ value: e, children: i, disabled: n, className: c, ...a }, s) => {
804
- const t = et(), r = t.disabled || n;
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 p = Array.isArray(t.value) ? t.value : [], b = l ? p.filter((m) => m !== e) : [...p, e];
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
- }, u = g({
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: s,
823
- className: x(F.option, c),
824
- ...u,
825
- ...a,
818
+ ref: o,
819
+ className: y(P.option, c),
820
+ ...p,
821
+ ...i,
826
822
  children: [
827
- /* @__PURE__ */ o(
823
+ /* @__PURE__ */ s(
828
824
  "input",
829
825
  {
830
826
  type: "checkbox",
831
- className: F.input,
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__ */ o("span", { className: F.indicator }),
841
- /* @__PURE__ */ o("div", { className: F.content, children: i })
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
- Ae.displayName = "SelectableInput.Option";
848
- const mt = Object.assign(Re, {
849
- Option: Ae
843
+ Ge.displayName = "SelectableInput.Option";
844
+ const xt = Object.assign(Re, {
845
+ Option: Ge
850
846
  });
851
- function tt() {
847
+ function st() {
852
848
  try {
853
- return Intl.supportedValuesOf("currency").map((i) => ({
854
- code: i,
855
- label: i
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 nt = f(
857
+ const at = f(
862
858
  ({
863
859
  label: e,
864
- helper: i,
860
+ helper: a,
865
861
  error: n,
866
862
  required: c = !1,
867
- disabled: a = !1,
868
- readOnly: s = !1,
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: u,
874
- currencies: p,
869
+ onCurrencyChange: p,
870
+ currencies: u,
875
871
  currencyName: b,
876
- id: m,
877
- className: h,
878
- ...v
879
- }, y) => {
880
- const N = ae(() => tt(), []), w = ae(() => p ? p.map((O) => ({
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, [p, N]), [B, S] = j(!1), $ = D(), G = m || $, E = i ? `${G}-helper` : void 0, z = n ? `${G}-error` : void 0, J = [E, z].filter(Boolean).join(" "), W = b || (t ? `${t}-currency` : void 0), X = g({
884
- disabled: a,
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: s,
882
+ readOnly: o,
887
883
  focused: B
888
884
  });
889
- return /* @__PURE__ */ I("div", { className: x(L.field, h), children: [
890
- e && /* @__PURE__ */ o(k, { htmlFor: G, required: c, disabled: a, children: e }),
891
- /* @__PURE__ */ I("div", { className: L.wrapper, ...X, children: [
892
- /* @__PURE__ */ o(
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: L["currency-select"],
891
+ className: F["currency-select"],
896
892
  name: W,
897
893
  value: d,
898
- onChange: (O) => u == null ? void 0 : u(O.target.value),
899
- onFocus: () => S(!0),
900
- onBlur: () => S(!1),
901
- disabled: a,
902
- "aria-disabled": a ? "true" : void 0,
903
- children: w.map((O) => /* @__PURE__ */ o("option", { value: O.code, children: O.label }, O.code))
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__ */ o("span", { className: L.divider, "aria-hidden": !0 }),
907
- /* @__PURE__ */ o(
902
+ /* @__PURE__ */ s("span", { className: F.divider, "aria-hidden": !0 }),
903
+ /* @__PURE__ */ s(
908
904
  "input",
909
905
  {
910
- ref: y,
911
- id: G,
906
+ ref: v,
907
+ id: k,
912
908
  type: "text",
913
909
  inputMode: "decimal",
914
- className: L["amount-input"],
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: () => S(!0),
919
- onBlur: () => S(!1),
920
- disabled: a,
921
- readOnly: s,
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": a ? "true" : void 0,
920
+ "aria-disabled": i ? "true" : void 0,
925
921
  "aria-describedby": J || void 0,
926
- ...v
922
+ ...x
927
923
  }
928
924
  )
929
925
  ] }),
930
- n && /* @__PURE__ */ o(A, { id: z, children: n }),
931
- !n && i && /* @__PURE__ */ o(R, { id: E, children: i })
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
- nt.displayName = "CurrencyInput";
931
+ at.displayName = "CurrencyInput";
936
932
  export {
937
933
  pe as Checkbox,
938
- pt as CheckboxGroup,
939
- ut as ChipInput,
940
- ht as ComboboxInput,
941
- nt as CurrencyInput,
942
- Ke as EmailInput,
943
- A as ErrorText,
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
- k as Label,
946
- _e as PasswordInput,
941
+ A as Label,
942
+ Xe as PasswordInput,
947
943
  de as Radio,
948
- dt as RadioGroup,
949
- He as SearchInput,
944
+ ht as RadioGroup,
945
+ Je as SearchInput,
950
946
  le as Select,
951
- mt as SelectableInput,
952
- Je as TextArea,
947
+ xt as SelectableInput,
948
+ Ye as TextArea,
953
949
  _ as TextInput
954
950
  };