@versaur/react 1.0.18 → 1.0.20

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