@overdoser/react-toolkit 0.0.1 → 0.0.2

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/index.js CHANGED
@@ -1,350 +1,358 @@
1
- import { forwardRef as $, createElement as he, useState as oe, useCallback as C, useMemo as X, useEffect as O, useRef as j, createContext as ae, useContext as Z, cloneElement as ke } from "react";
2
- import { jsxs as b, jsx as c } from "react/jsx-runtime";
3
- import { FormProvider as fe, useFormContext as ge, useController as be } from "react-hook-form";
4
- import { createPortal as ye } from "react-dom";
5
- function le(e) {
6
- var r, t, o = "";
7
- if (typeof e == "string" || typeof e == "number") o += e;
1
+ import { forwardRef as W, createElement as Ie, useState as X, useCallback as L, useMemo as ee, useEffect as F, useRef as O, useId as ne, createContext as fe, useContext as ae, cloneElement as $e } from "react";
2
+ import { jsxs as I, jsx as c } from "react/jsx-runtime";
3
+ import { FormProvider as Ce, useFormContext as Re, useController as De } from "react-hook-form";
4
+ import { createPortal as Ee } from "react-dom";
5
+ function ge(e) {
6
+ var r, t, n = "";
7
+ if (typeof e == "string" || typeof e == "number") n += e;
8
8
  else if (typeof e == "object") if (Array.isArray(e)) {
9
- var n = e.length;
10
- for (r = 0; r < n; r++) e[r] && (t = le(e[r])) && (o && (o += " "), o += t);
11
- } else for (t in e) e[t] && (o && (o += " "), o += t);
12
- return o;
9
+ var o = e.length;
10
+ for (r = 0; r < o; r++) e[r] && (t = ge(e[r])) && (n && (n += " "), n += t);
11
+ } else for (t in e) e[t] && (n && (n += " "), n += t);
12
+ return n;
13
13
  }
14
- function s() {
15
- for (var e, r, t = 0, o = "", n = arguments.length; t < n; t++) (e = arguments[t]) && (r = le(e)) && (o && (o += " "), o += r);
16
- return o;
14
+ function l() {
15
+ for (var e, r, t = 0, n = "", o = arguments.length; t < o; t++) (e = arguments[t]) && (r = ge(e)) && (n && (n += " "), n += r);
16
+ return n;
17
17
  }
18
- const Ne = "crk-root-8RX49", ve = "crk-loading-QfItr", we = "crk-primary-st6yY", xe = "crk-secondary-j-3rj", $e = "crk-danger-Hxs5n", Se = "crk-ghost-kQ0A8", Ce = "crk-sm-RXFPY", Ie = "crk-md-nDnOD", Be = "crk-lg-qD-Qh", De = "crk-fullWidth-AHpSl", Ae = "crk-content-PpYVU", Le = "crk-shimmer-8iQSU", Re = "crk-loadingShimmer-BVvFw", Ee = "crk-shimmerSweep-uiZ01", Te = "crk-dots-U8wss", Fe = "crk-loadingDots-eKv64", Pe = "crk-dot-Owuk1", Me = "crk-dotBounce-FwdcC", We = "crk-loadingBorder-9ULFw", ze = "crk-borderSpin-EJ2gW", x = {
19
- root: Ne,
20
- loading: ve,
21
- primary: we,
22
- secondary: xe,
23
- danger: $e,
24
- ghost: Se,
25
- sm: Ce,
26
- md: Ie,
27
- lg: Be,
28
- fullWidth: De,
29
- content: Ae,
30
- shimmer: Le,
31
- loadingShimmer: Re,
32
- shimmerSweep: Ee,
33
- dots: Te,
34
- loadingDots: Fe,
35
- dot: Pe,
36
- dotBounce: Me,
37
- loadingBorder: We,
38
- borderSpin: ze
39
- }, qe = {
40
- dots: x.loadingDots,
41
- shimmer: x.loadingShimmer,
42
- border: x.loadingBorder
43
- }, Oe = $(
18
+ const Le = "crk-root-8RX49", Be = "crk-loading-QfItr", Te = "crk-primary-st6yY", Ae = "crk-secondary-j-3rj", Oe = "crk-danger-Hxs5n", Pe = "crk-ghost-kQ0A8", Me = "crk-sm-RXFPY", We = "crk-md-nDnOD", He = "crk-lg-qD-Qh", qe = "crk-fullWidth-AHpSl", Fe = "crk-content-PpYVU", je = "crk-shimmer-8iQSU", ze = "crk-loadingShimmer-BVvFw", Ke = "crk-shimmerSweep-uiZ01", Ue = "crk-dots-U8wss", Ge = "crk-loadingDots-eKv64", Ve = "crk-dot-Owuk1", Qe = "crk-dotBounce-FwdcC", Xe = "crk-loadingBorder-9ULFw", Ye = "crk-borderSpin-EJ2gW", H = {
19
+ root: Le,
20
+ loading: Be,
21
+ primary: Te,
22
+ secondary: Ae,
23
+ danger: Oe,
24
+ ghost: Pe,
25
+ sm: Me,
26
+ md: We,
27
+ lg: He,
28
+ fullWidth: qe,
29
+ content: Fe,
30
+ shimmer: je,
31
+ loadingShimmer: ze,
32
+ shimmerSweep: Ke,
33
+ dots: Ue,
34
+ loadingDots: Ge,
35
+ dot: Ve,
36
+ dotBounce: Qe,
37
+ loadingBorder: Xe,
38
+ borderSpin: Ye
39
+ }, Je = {
40
+ dots: H.loadingDots,
41
+ shimmer: H.loadingShimmer,
42
+ border: H.loadingBorder
43
+ }, Ze = W(
44
44
  ({
45
45
  variant: e = "primary",
46
46
  size: r = "md",
47
47
  loading: t = !1,
48
- loadingStyle: o = "dots",
49
- fullWidth: n = !1,
50
- disabled: i,
51
- classes: l,
52
- className: u,
53
- style: d,
54
- children: m,
55
- ...a
56
- }, p) => /* @__PURE__ */ b(
48
+ loadingStyle: n = "dots",
49
+ fullWidth: o = !1,
50
+ disabled: m,
51
+ classes: a,
52
+ className: h,
53
+ style: i,
54
+ children: y,
55
+ ...u
56
+ }, g) => /* @__PURE__ */ I(
57
57
  "button",
58
58
  {
59
- ref: p,
60
- className: s(
61
- x.root,
62
- x[e],
63
- x[r],
64
- n && x.fullWidth,
65
- t && x.loading,
66
- t && qe[o],
67
- l?.root,
68
- u
59
+ ref: g,
60
+ className: l(
61
+ H.root,
62
+ H[e],
63
+ H[r],
64
+ o && H.fullWidth,
65
+ t && H.loading,
66
+ t && Je[n],
67
+ a?.root,
68
+ h
69
69
  ),
70
- style: d,
71
- disabled: i || t,
72
- ...a,
70
+ style: i,
71
+ disabled: m || t,
72
+ "aria-busy": t || void 0,
73
+ ...u,
73
74
  children: [
74
- /* @__PURE__ */ c("div", { className: s(x.shimmer, l?.shimmer) }),
75
- /* @__PURE__ */ c("span", { className: s(x.content, l?.content), children: m }),
76
- /* @__PURE__ */ b("span", { className: s(x.dots, l?.dots), "aria-hidden": "true", children: [
77
- /* @__PURE__ */ c("span", { className: s(x.dot, l?.dot) }),
78
- /* @__PURE__ */ c("span", { className: s(x.dot, l?.dot) }),
79
- /* @__PURE__ */ c("span", { className: s(x.dot, l?.dot) })
75
+ /* @__PURE__ */ c("div", { className: l(H.shimmer, a?.shimmer) }),
76
+ /* @__PURE__ */ c("span", { className: l(H.content, a?.content), children: y }),
77
+ /* @__PURE__ */ I("span", { className: l(H.dots, a?.dots), "aria-hidden": "true", children: [
78
+ /* @__PURE__ */ c("span", { className: l(H.dot, a?.dot) }),
79
+ /* @__PURE__ */ c("span", { className: l(H.dot, a?.dot) }),
80
+ /* @__PURE__ */ c("span", { className: l(H.dot, a?.dot) })
80
81
  ] })
81
82
  ]
82
83
  }
83
84
  )
84
85
  );
85
- Oe.displayName = "Button";
86
- const je = "crk-root-2j4Vp", He = "crk-muted-vReNc", Ue = "crk-danger-ugf9r", ce = {
87
- root: je,
86
+ Ze.displayName = "Button";
87
+ const _e = "crk-root-2j4Vp", er = "crk-muted-vReNc", rr = "crk-danger-ugf9r", tr = "crk-srOnly-LGQgs", me = {
88
+ root: _e,
88
89
  default: "crk-default-3TBlr",
89
- muted: He,
90
- danger: Ue
91
- }, Ge = $(
90
+ muted: er,
91
+ danger: rr,
92
+ srOnly: tr
93
+ }, nr = W(
92
94
  ({
93
95
  variant: e = "default",
94
96
  external: r = !1,
95
97
  className: t,
96
- style: o,
97
- children: n,
98
- ...i
99
- }, l) => /* @__PURE__ */ c(
98
+ style: n,
99
+ children: o,
100
+ ...m
101
+ }, a) => /* @__PURE__ */ I(
100
102
  "a",
101
103
  {
102
- ref: l,
103
- className: s(ce.root, ce[e], t),
104
- style: o,
104
+ ref: a,
105
+ className: l(me.root, me[e], t),
106
+ style: n,
105
107
  ...r && {
106
108
  target: "_blank",
107
109
  rel: "noopener noreferrer"
108
110
  },
109
- ...i,
110
- children: n
111
+ ...m,
112
+ children: [
113
+ o,
114
+ r && /* @__PURE__ */ c("span", { className: me.srOnly, children: " (opens in a new tab)" })
115
+ ]
111
116
  }
112
117
  )
113
118
  );
114
- Ge.displayName = "Link";
115
- const Ke = "crk-root-U-oiq", Qe = "crk-h1-Aivwz", Ve = "crk-h2-CV8Oo", Ye = "crk-h3-lrbrK", Xe = "crk-h4--jkC1", Ze = "crk-h5-GnQvD", Je = "crk-h6-MKlIN", _e = "crk-p-FzRtm", er = "crk-span-NZvLx", rr = "crk-label-Cwi6a", tr = "crk-normal-7AeZz", or = "crk-medium-36OXr", nr = "crk-semibold-oQixc", cr = "crk-bold-bk4b4", sr = "crk-muted-itOSW", ar = "crk-primary-rp36t", lr = "crk-danger-SyOy-", ir = "crk-success-w8PpD", dr = "crk-align-left-3AGYw", ur = "crk-align-center-h-x--", mr = "crk-align-right-IXFhK", pr = "crk-truncate-eqr85", W = {
116
- root: Ke,
117
- h1: Qe,
118
- h2: Ve,
119
- h3: Ye,
120
- h4: Xe,
121
- h5: Ze,
122
- h6: Je,
123
- p: _e,
124
- span: er,
125
- label: rr,
126
- normal: tr,
127
- medium: or,
128
- semibold: nr,
129
- bold: cr,
119
+ nr.displayName = "Link";
120
+ const or = "crk-root-U-oiq", cr = "crk-h1-Aivwz", lr = "crk-h2-CV8Oo", sr = "crk-h3-lrbrK", ar = "crk-h4--jkC1", ir = "crk-h5-GnQvD", dr = "crk-h6-MKlIN", ur = "crk-p-FzRtm", mr = "crk-span-NZvLx", hr = "crk-label-Cwi6a", pr = "crk-normal-7AeZz", fr = "crk-medium-36OXr", gr = "crk-semibold-oQixc", br = "crk-bold-bk4b4", kr = "crk-muted-itOSW", vr = "crk-primary-rp36t", yr = "crk-danger-SyOy-", Nr = "crk-success-w8PpD", wr = "crk-align-left-3AGYw", xr = "crk-align-center-h-x--", Sr = "crk-align-right-IXFhK", Ir = "crk-truncate-eqr85", _ = {
121
+ root: or,
122
+ h1: cr,
123
+ h2: lr,
124
+ h3: sr,
125
+ h4: ar,
126
+ h5: ir,
127
+ h6: dr,
128
+ p: ur,
129
+ span: mr,
130
+ label: hr,
131
+ normal: pr,
132
+ medium: fr,
133
+ semibold: gr,
134
+ bold: br,
130
135
  default: "crk-default-79lKR",
131
- muted: sr,
132
- primary: ar,
133
- danger: lr,
134
- success: ir,
135
- alignLeft: dr,
136
- alignCenter: ur,
137
- alignRight: mr,
138
- truncate: pr
139
- }, hr = $(
136
+ muted: kr,
137
+ primary: vr,
138
+ danger: yr,
139
+ success: Nr,
140
+ alignLeft: wr,
141
+ alignCenter: xr,
142
+ alignRight: Sr,
143
+ truncate: Ir
144
+ }, $r = W(
140
145
  ({
141
146
  variant: e = "p",
142
147
  weight: r,
143
148
  color: t,
144
- align: o,
145
- truncate: n = !1,
146
- className: i,
147
- style: l,
148
- children: u,
149
- ...d
150
- }, m) => he(
149
+ align: n,
150
+ truncate: o = !1,
151
+ className: m,
152
+ style: a,
153
+ children: h,
154
+ ...i
155
+ }, y) => Ie(
151
156
  e,
152
157
  {
153
- ref: m,
154
- className: s(
155
- W.root,
156
- W[e],
157
- r && W[r],
158
- t && W[t],
159
- o && W[`align-${o}`],
160
- n && W.truncate,
161
- i
158
+ ref: y,
159
+ className: l(
160
+ _.root,
161
+ _[e],
162
+ r && _[r],
163
+ t && _[t],
164
+ n && _[`align-${n}`],
165
+ o && _.truncate,
166
+ m
162
167
  ),
163
- style: l,
164
- ...d
168
+ style: a,
169
+ ...i
165
170
  },
166
- u
171
+ h
167
172
  )
168
173
  );
169
- hr.displayName = "Typography";
170
- const kr = "crk-root-PVrgx", fr = "crk-unordered-FhCWT", gr = "crk-item-TfW82", br = "crk-ordered-8x4YC", yr = "crk-none-f03Kx", Nr = "crk-sm-Rg4Mv", vr = "crk-md-X4Icb", wr = "crk-lg-JjNKZ", V = {
171
- root: kr,
172
- unordered: fr,
173
- item: gr,
174
- ordered: br,
175
- none: yr,
176
- sm: Nr,
177
- md: vr,
178
- lg: wr
179
- }, xr = $(
174
+ $r.displayName = "Typography";
175
+ const Cr = "crk-root-PVrgx", Rr = "crk-unordered-FhCWT", Dr = "crk-item-TfW82", Er = "crk-ordered-8x4YC", Lr = "crk-none-f03Kx", Br = "crk-sm-Rg4Mv", Tr = "crk-md-X4Icb", Ar = "crk-lg-JjNKZ", le = {
176
+ root: Cr,
177
+ unordered: Rr,
178
+ item: Dr,
179
+ ordered: Er,
180
+ none: Lr,
181
+ sm: Br,
182
+ md: Tr,
183
+ lg: Ar
184
+ }, Or = W(
180
185
  ({
181
186
  variant: e = "unordered",
182
187
  spacing: r = "md",
183
188
  className: t,
184
- style: o,
185
- children: n,
186
- ...i
187
- }, l) => /* @__PURE__ */ c(
189
+ style: n,
190
+ children: o,
191
+ ...m
192
+ }, a) => /* @__PURE__ */ c(
188
193
  e === "ordered" ? "ol" : "ul",
189
194
  {
190
- ref: l,
191
- className: s(
192
- V.root,
193
- V[e],
194
- V[r],
195
+ ref: a,
196
+ className: l(
197
+ le.root,
198
+ le[e],
199
+ le[r],
195
200
  t
196
201
  ),
197
- style: o,
198
- ...i,
199
- children: n
202
+ style: n,
203
+ ...m,
204
+ children: o
200
205
  }
201
206
  )
202
207
  );
203
- xr.displayName = "List";
204
- const $r = $(
205
- ({ className: e, style: r, children: t, ...o }, n) => /* @__PURE__ */ c(
208
+ Or.displayName = "List";
209
+ const Pr = W(
210
+ ({ className: e, style: r, children: t, ...n }, o) => /* @__PURE__ */ c(
206
211
  "li",
207
212
  {
208
- ref: n,
209
- className: s(V.item, e),
213
+ ref: o,
214
+ className: l(le.item, e),
210
215
  style: r,
211
- ...o,
216
+ ...n,
212
217
  children: t
213
218
  }
214
219
  )
215
220
  );
216
- $r.displayName = "ListItem";
217
- const Sr = "crk-wrapper-zxjMt", Cr = "crk-root-Gf85-", Ir = "crk-headerCell-ePPZW", Br = "crk-headerCellSortable-NMybk", Dr = "crk-sortIndicator-WGD2S", Ar = "crk-sortArrow-1-ok4", Lr = "crk-sortArrowActive-yhWrO", Rr = "crk-sortIndex-HGoca", Er = "crk-row-H0wL1", Tr = "crk-cell-ZfnbG", Fr = "crk-emptyRow-AoPfj", Pr = "crk-emptyCell-99-7C", Mr = "crk-striped-6Qckq", Wr = "crk-hoverable-ljU9B", zr = "crk-compact-2-UWr", qr = "crk-paginator-UlYIY", Or = "crk-paginatorInfo-BVca4", jr = "crk-paginatorText-sqWS0", Hr = "crk-pageSizeSelect-yhqJQ", Ur = "crk-paginatorNav-MDSui", Gr = "crk-pageButton-1PX-g", Kr = "crk-pageButtonActive--D7Q7", Qr = "crk-pageEllipsis-en59J", g = {
218
- wrapper: Sr,
219
- root: Cr,
220
- headerCell: Ir,
221
- headerCellSortable: Br,
222
- sortIndicator: Dr,
223
- sortArrow: Ar,
224
- sortArrowActive: Lr,
225
- sortIndex: Rr,
226
- row: Er,
227
- cell: Tr,
228
- emptyRow: Fr,
229
- emptyCell: Pr,
230
- striped: Mr,
231
- hoverable: Wr,
232
- compact: zr,
233
- paginator: qr,
234
- paginatorInfo: Or,
235
- paginatorText: jr,
236
- pageSizeSelect: Hr,
237
- paginatorNav: Ur,
238
- pageButton: Gr,
239
- pageButtonActive: Kr,
240
- pageEllipsis: Qr
221
+ Pr.displayName = "ListItem";
222
+ const Mr = "crk-wrapper-zxjMt", Wr = "crk-root-Gf85-", Hr = "crk-headerCell-ePPZW", qr = "crk-headerCellSortable-NMybk", Fr = "crk-sortIndicator-WGD2S", jr = "crk-sortArrow-1-ok4", zr = "crk-sortArrowActive-yhWrO", Kr = "crk-sortIndex-HGoca", Ur = "crk-row-H0wL1", Gr = "crk-cell-ZfnbG", Vr = "crk-emptyRow-AoPfj", Qr = "crk-emptyCell-99-7C", Xr = "crk-striped-6Qckq", Yr = "crk-hoverable-ljU9B", Jr = "crk-compact-2-UWr", Zr = "crk-paginator-UlYIY", _r = "crk-paginatorInfo-BVca4", et = "crk-paginatorText-sqWS0", rt = "crk-pageSizeSelect-yhqJQ", tt = "crk-paginatorNav-MDSui", nt = "crk-pageButton-1PX-g", ot = "crk-pageButtonActive--D7Q7", ct = "crk-pageEllipsis-en59J", C = {
223
+ wrapper: Mr,
224
+ root: Wr,
225
+ headerCell: Hr,
226
+ headerCellSortable: qr,
227
+ sortIndicator: Fr,
228
+ sortArrow: jr,
229
+ sortArrowActive: zr,
230
+ sortIndex: Kr,
231
+ row: Ur,
232
+ cell: Gr,
233
+ emptyRow: Vr,
234
+ emptyCell: Qr,
235
+ striped: Xr,
236
+ hoverable: Yr,
237
+ compact: Jr,
238
+ paginator: Zr,
239
+ paginatorInfo: _r,
240
+ paginatorText: et,
241
+ pageSizeSelect: rt,
242
+ paginatorNav: tt,
243
+ pageButton: nt,
244
+ pageButtonActive: ot,
245
+ pageEllipsis: ct
241
246
  };
242
- function Vr(e, r) {
247
+ function lt(e, r) {
243
248
  return e == null && r == null ? 0 : e == null ? -1 : r == null ? 1 : typeof e == "number" && typeof r == "number" ? e - r : String(e).localeCompare(String(r));
244
249
  }
245
- function Yr(e, r = []) {
246
- const [t, o] = oe(r), n = C((d) => {
247
- o((m) => {
248
- const a = m.find((p) => p.key === d);
249
- return a ? a.direction === "asc" ? [{ key: d, direction: "desc" }] : [] : [{ key: d, direction: "asc" }];
250
+ function st(e, r = []) {
251
+ const [t, n] = X(r), o = L((i) => {
252
+ n((y) => {
253
+ const u = y.find((g) => g.key === i);
254
+ return u ? u.direction === "asc" ? [{ key: i, direction: "desc" }] : [] : [{ key: i, direction: "asc" }];
250
255
  });
251
- }, []), i = C((d) => {
252
- o((m) => {
253
- const a = m.findIndex((h) => h.key === d);
254
- if (a === -1)
255
- return [...m, { key: d, direction: "asc" }];
256
- if (m[a].direction === "asc") {
257
- const h = [...m];
258
- return h[a] = { key: d, direction: "desc" }, h;
256
+ }, []), m = L((i) => {
257
+ n((y) => {
258
+ const u = y.findIndex((v) => v.key === i);
259
+ if (u === -1)
260
+ return [...y, { key: i, direction: "asc" }];
261
+ if (y[u].direction === "asc") {
262
+ const v = [...y];
263
+ return v[u] = { key: i, direction: "desc" }, v;
259
264
  }
260
- return m.filter((h, f) => f !== a);
265
+ return y.filter((v, b) => b !== u);
261
266
  });
262
- }, []), l = C(() => {
263
- o([]);
267
+ }, []), a = L(() => {
268
+ n([]);
264
269
  }, []);
265
- return { sortedData: X(() => t.length === 0 ? e : [...e].sort((d, m) => {
266
- for (const { key: a, direction: p } of t) {
267
- const h = Vr(d[a], m[a]);
268
- if (h !== 0)
269
- return p === "asc" ? h : -h;
270
+ return { sortedData: ee(() => t.length === 0 ? e : [...e].sort((i, y) => {
271
+ for (const { key: u, direction: g } of t) {
272
+ const v = lt(i[u], y[u]);
273
+ if (v !== 0)
274
+ return g === "asc" ? v : -v;
270
275
  }
271
276
  return 0;
272
- }), [e, t]), sortConfig: t, requestSort: n, requestMultiSort: i, resetSort: l };
277
+ }), [e, t]), sortConfig: t, requestSort: o, requestMultiSort: m, resetSort: a };
273
278
  }
274
- function Xr({ direction: e, sortIndex: r }) {
275
- return /* @__PURE__ */ b("span", { className: g.sortIndicator, children: [
276
- /* @__PURE__ */ c("span", { className: s(g.sortArrow, e === "asc" && g.sortArrowActive), children: "▲" }),
277
- /* @__PURE__ */ c("span", { className: s(g.sortArrow, e === "desc" && g.sortArrowActive), children: "▼" }),
278
- r !== void 0 && r >= 0 && /* @__PURE__ */ c("span", { className: g.sortIndex, children: r + 1 })
279
+ function at({ direction: e, sortIndex: r }) {
280
+ return /* @__PURE__ */ I("span", { className: C.sortIndicator, "aria-hidden": "true", children: [
281
+ /* @__PURE__ */ c("span", { className: l(C.sortArrow, e === "asc" && C.sortArrowActive), children: "▲" }),
282
+ /* @__PURE__ */ c("span", { className: l(C.sortArrow, e === "desc" && C.sortArrowActive), children: "▼" }),
283
+ r !== void 0 && r >= 0 && /* @__PURE__ */ c("span", { className: C.sortIndex, children: r + 1 })
279
284
  ] });
280
285
  }
281
- function Zr({
286
+ function it({
282
287
  page: e,
283
288
  pageSize: r,
284
289
  totalRows: t,
285
- pageSizeOptions: o = [10, 25, 50, 100],
286
- onPageChange: n,
287
- paginatorClasses: i
290
+ pageSizeOptions: n = [10, 25, 50, 100],
291
+ onPageChange: o,
292
+ paginatorClasses: m
288
293
  }) {
289
- const l = Math.max(1, Math.ceil(t / r)), u = (e - 1) * r + 1, d = Math.min(e * r, t), m = X(() => {
290
- const a = [];
291
- if (l <= 7)
292
- for (let p = 1; p <= l; p++) a.push(p);
294
+ const a = Math.max(1, Math.ceil(t / r)), h = (e - 1) * r + 1, i = Math.min(e * r, t), y = ee(() => {
295
+ const u = [];
296
+ if (a <= 7)
297
+ for (let g = 1; g <= a; g++) u.push(g);
293
298
  else {
294
- a.push(1), e > 3 && a.push("ellipsis");
295
- for (let p = Math.max(2, e - 1); p <= Math.min(l - 1, e + 1); p++)
296
- a.push(p);
297
- e < l - 2 && a.push("ellipsis"), a.push(l);
299
+ u.push(1), e > 3 && u.push("ellipsis");
300
+ for (let g = Math.max(2, e - 1); g <= Math.min(a - 1, e + 1); g++)
301
+ u.push(g);
302
+ e < a - 2 && u.push("ellipsis"), u.push(a);
298
303
  }
299
- return a;
300
- }, [e, l]);
301
- return /* @__PURE__ */ b("div", { className: s(g.paginator, i?.paginator), children: [
302
- /* @__PURE__ */ b("div", { className: g.paginatorInfo, children: [
303
- /* @__PURE__ */ c("span", { className: g.paginatorText, children: t > 0 ? `${u}–${d} of ${t}` : "No results" }),
304
- o.length > 1 && /* @__PURE__ */ c(
304
+ return u;
305
+ }, [e, a]);
306
+ return /* @__PURE__ */ I("nav", { className: l(C.paginator, m?.paginator), "aria-label": "Table pagination", children: [
307
+ /* @__PURE__ */ I("div", { className: C.paginatorInfo, children: [
308
+ /* @__PURE__ */ c("span", { className: C.paginatorText, children: t > 0 ? `${h}–${i} of ${t}` : "No results" }),
309
+ n.length > 1 && /* @__PURE__ */ c(
305
310
  "select",
306
311
  {
307
- className: g.pageSizeSelect,
312
+ className: C.pageSizeSelect,
308
313
  value: r,
309
- onChange: (a) => n(1, Number(a.target.value)),
310
- children: o.map((a) => /* @__PURE__ */ b("option", { value: a, children: [
311
- a,
314
+ onChange: (u) => o(1, Number(u.target.value)),
315
+ "aria-label": "Rows per page",
316
+ children: n.map((u) => /* @__PURE__ */ I("option", { value: u, children: [
317
+ u,
312
318
  " / page"
313
- ] }, a))
319
+ ] }, u))
314
320
  }
315
321
  )
316
322
  ] }),
317
- /* @__PURE__ */ b("div", { className: g.paginatorNav, children: [
323
+ /* @__PURE__ */ I("div", { className: C.paginatorNav, children: [
318
324
  /* @__PURE__ */ c(
319
325
  "button",
320
326
  {
321
327
  type: "button",
322
- className: s(g.pageButton, i?.pageButton),
328
+ className: l(C.pageButton, m?.pageButton),
323
329
  disabled: e <= 1,
324
- onClick: () => n(e - 1, r),
330
+ onClick: () => o(e - 1, r),
325
331
  "aria-label": "Previous page",
326
332
  children: "‹"
327
333
  }
328
334
  ),
329
- m.map(
330
- (a, p) => a === "ellipsis" ? /* @__PURE__ */ c("span", { className: g.pageEllipsis, children: "…" }, `ellipsis-${p}`) : /* @__PURE__ */ c(
335
+ y.map(
336
+ (u, g) => u === "ellipsis" ? /* @__PURE__ */ c("span", { className: C.pageEllipsis, children: "…" }, `ellipsis-${g}`) : /* @__PURE__ */ c(
331
337
  "button",
332
338
  {
333
339
  type: "button",
334
- className: s(g.pageButton, a === e && g.pageButtonActive, i?.pageButton),
335
- onClick: () => n(a, r),
336
- children: a
340
+ className: l(C.pageButton, u === e && C.pageButtonActive, m?.pageButton),
341
+ onClick: () => o(u, r),
342
+ "aria-label": `Page ${u}`,
343
+ "aria-current": u === e ? "page" : void 0,
344
+ children: u
337
345
  },
338
- a
346
+ u
339
347
  )
340
348
  ),
341
349
  /* @__PURE__ */ c(
342
350
  "button",
343
351
  {
344
352
  type: "button",
345
- className: s(g.pageButton, i?.pageButton),
346
- disabled: e >= l,
347
- onClick: () => n(e + 1, r),
353
+ className: l(C.pageButton, m?.pageButton),
354
+ disabled: e >= a,
355
+ onClick: () => o(e + 1, r),
348
356
  "aria-label": "Next page",
349
357
  children: "›"
350
358
  }
@@ -352,259 +360,271 @@ function Zr({
352
360
  ] })
353
361
  ] });
354
362
  }
355
- function Jr({
363
+ function dt({
356
364
  data: e,
357
365
  columns: r,
358
366
  sortConfig: t,
359
- onSort: o,
360
- multiSort: n = !0,
361
- striped: i = !1,
362
- hoverable: l = !1,
363
- compact: u = !1,
364
- className: d,
365
- style: m,
366
- rowKey: a,
367
- emptyMessage: p = "No data",
368
- pagination: h,
369
- classes: f
367
+ onSort: n,
368
+ multiSort: o = !0,
369
+ striped: m = !1,
370
+ hoverable: a = !1,
371
+ compact: h = !1,
372
+ className: i,
373
+ style: y,
374
+ rowKey: u,
375
+ emptyMessage: g = "No data",
376
+ pagination: v,
377
+ classes: b
370
378
  }) {
371
- const y = o !== void 0, {
372
- sortedData: D,
373
- sortConfig: P,
374
- requestSort: A,
375
- requestMultiSort: E
376
- } = Yr(e, t), S = y ? t ?? [] : P, T = y ? e : D, q = X(() => {
377
- if (!h || y) return T;
378
- const k = (h.page - 1) * h.pageSize;
379
- return T.slice(k, k + h.pageSize);
380
- }, [T, h, y]), ee = h?.totalRows ?? T.length, re = C(
381
- (k, I) => {
382
- const L = n && (I.ctrlKey || I.metaKey);
383
- if (y)
384
- if (L) {
385
- const w = S.findIndex((U) => U.key === k);
386
- let M;
387
- w === -1 ? M = [...S, { key: k, direction: "asc" }] : S[w].direction === "asc" ? M = S.map(
388
- (U, te) => te === w ? { key: k, direction: "desc" } : U
389
- ) : M = S.filter((U, te) => te !== w), o(M);
379
+ const p = n !== void 0, {
380
+ sortedData: $,
381
+ sortConfig: w,
382
+ requestSort: R,
383
+ requestMultiSort: D
384
+ } = st(e, t), S = p ? t ?? [] : w, E = p ? e : $, K = ee(() => {
385
+ if (!v || p) return E;
386
+ const k = (v.page - 1) * v.pageSize;
387
+ return E.slice(k, k + v.pageSize);
388
+ }, [E, v, p]), q = v?.totalRows ?? E.length, V = L(
389
+ (k, P) => {
390
+ const x = o && (P.ctrlKey || P.metaKey);
391
+ if (p)
392
+ if (x) {
393
+ const B = S.findIndex((A) => A.key === k);
394
+ let z;
395
+ B === -1 ? z = [...S, { key: k, direction: "asc" }] : S[B].direction === "asc" ? z = S.map(
396
+ (A, Z) => Z === B ? { key: k, direction: "desc" } : A
397
+ ) : z = S.filter((A, Z) => Z !== B), n(z);
390
398
  } else {
391
- const w = S.find((M) => M.key === k);
392
- w ? w.direction === "asc" ? o([{ key: k, direction: "desc" }]) : o([]) : o([{ key: k, direction: "asc" }]);
399
+ const B = S.find((z) => z.key === k);
400
+ B ? B.direction === "asc" ? n([{ key: k, direction: "desc" }]) : n([]) : n([{ key: k, direction: "asc" }]);
393
401
  }
394
402
  else
395
- L ? E(k) : A(k);
403
+ x ? D(k) : R(k);
396
404
  },
397
405
  [
398
- y,
399
- n,
400
- S,
406
+ p,
401
407
  o,
402
- A,
403
- E
408
+ S,
409
+ n,
410
+ R,
411
+ D
404
412
  ]
405
- ), v = (k) => S.find((L) => L.key === k)?.direction, H = (k) => {
413
+ ), j = (k) => S.find((x) => x.key === k)?.direction, Y = (k) => {
406
414
  if (S.length <= 1) return;
407
- const I = S.findIndex((L) => L.key === k);
408
- return I >= 0 ? I : void 0;
415
+ const P = S.findIndex((x) => x.key === k);
416
+ return P >= 0 ? P : void 0;
409
417
  };
410
- return /* @__PURE__ */ b("div", { className: s(g.wrapper, f?.wrapper), children: [
411
- /* @__PURE__ */ b(
418
+ return /* @__PURE__ */ I("div", { className: l(C.wrapper, b?.wrapper), children: [
419
+ /* @__PURE__ */ I(
412
420
  "table",
413
421
  {
414
- className: s(
415
- g.root,
416
- i && g.striped,
417
- l && g.hoverable,
418
- u && g.compact,
419
- f?.root,
420
- d
422
+ className: l(
423
+ C.root,
424
+ m && C.striped,
425
+ a && C.hoverable,
426
+ h && C.compact,
427
+ b?.root,
428
+ i
421
429
  ),
422
- style: m,
430
+ style: y,
423
431
  children: [
424
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: r.map((k) => /* @__PURE__ */ b(
432
+ /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: r.map((k) => /* @__PURE__ */ I(
425
433
  "th",
426
434
  {
427
- className: s(
428
- g.headerCell,
429
- k.sortable && g.headerCellSortable,
430
- f?.headerCell
435
+ className: l(
436
+ C.headerCell,
437
+ k.sortable && C.headerCellSortable,
438
+ b?.headerCell
431
439
  ),
432
440
  style: {
433
441
  width: k.width,
434
442
  textAlign: k.align
435
443
  },
436
- onClick: k.sortable ? (I) => re(k.key, I) : void 0,
444
+ onClick: k.sortable ? (P) => V(k.key, P) : void 0,
445
+ "aria-sort": k.sortable ? j(k.key) === "asc" ? "ascending" : j(k.key) === "desc" ? "descending" : "none" : void 0,
437
446
  children: [
438
447
  k.header,
439
448
  k.sortable && /* @__PURE__ */ c(
440
- Xr,
449
+ at,
441
450
  {
442
- direction: v(k.key),
443
- sortIndex: H(k.key)
451
+ direction: j(k.key),
452
+ sortIndex: Y(k.key)
444
453
  }
445
454
  )
446
455
  ]
447
456
  },
448
457
  k.key
449
458
  )) }) }),
450
- /* @__PURE__ */ c("tbody", { children: q.length === 0 ? /* @__PURE__ */ c("tr", { className: g.emptyRow, children: /* @__PURE__ */ c("td", { className: s(g.emptyCell, f?.emptyCell), colSpan: r.length, children: p }) }) : q.map((k, I) => {
451
- const L = a ? String(k[a]) : I;
452
- return /* @__PURE__ */ c("tr", { className: s(g.row, f?.row), children: r.map((w) => /* @__PURE__ */ c(
459
+ /* @__PURE__ */ c("tbody", { children: K.length === 0 ? /* @__PURE__ */ c("tr", { className: C.emptyRow, children: /* @__PURE__ */ c("td", { className: l(C.emptyCell, b?.emptyCell), colSpan: r.length, children: g }) }) : K.map((k, P) => {
460
+ const x = u ? String(k[u]) : P;
461
+ return /* @__PURE__ */ c("tr", { className: l(C.row, b?.row), children: r.map((B) => /* @__PURE__ */ c(
453
462
  "td",
454
463
  {
455
- className: s(g.cell, f?.cell),
456
- style: { textAlign: w.align },
457
- children: w.render ? w.render(k[w.key], k, I) : k[w.key]
464
+ className: l(C.cell, b?.cell),
465
+ style: { textAlign: B.align },
466
+ children: B.render ? B.render(k[B.key], k, P) : k[B.key]
458
467
  },
459
- w.key
460
- )) }, L);
468
+ B.key
469
+ )) }, x);
461
470
  }) })
462
471
  ]
463
472
  }
464
473
  ),
465
- h && /* @__PURE__ */ c(
466
- Zr,
474
+ v && /* @__PURE__ */ c(
475
+ it,
467
476
  {
468
- ...h,
469
- totalRows: ee,
470
- paginatorClasses: { paginator: f?.paginator, pageButton: f?.pageButton }
477
+ ...v,
478
+ totalRows: q,
479
+ paginatorClasses: { paginator: b?.paginator, pageButton: b?.pageButton }
471
480
  }
472
481
  )
473
482
  ] });
474
483
  }
475
- const Mo = Jr, _r = "crk-root-an8Cf", et = "crk-fullWidth-S-uVk", rt = "crk-trigger-LwPaD", tt = "crk-triggerOpen-U4pa9", ot = "crk-triggerLabel-QLITs", nt = "crk-triggerError-3jlu1", ct = "crk-placeholder-fWdch", st = "crk-chevron-jmDNe", at = "crk-menu-fxnKL", lt = "crk-menuOpen-HF-Y1", it = "crk-alignLeft-buCDJ", dt = "crk-alignRight-05P9w", ut = "crk-item-f-Rhh", mt = "crk-itemDisabled-L-d6i", pt = "crk-itemSelected-Fwmuo", N = {
476
- root: _r,
477
- fullWidth: et,
478
- trigger: rt,
479
- triggerOpen: tt,
480
- triggerLabel: ot,
481
- triggerError: nt,
482
- placeholder: ct,
483
- chevron: st,
484
- menu: at,
485
- menuOpen: lt,
486
- alignLeft: it,
487
- alignRight: dt,
488
- item: ut,
489
- itemDisabled: mt,
490
- itemSelected: pt
484
+ const $o = dt, ut = "crk-root-an8Cf", mt = "crk-fullWidth-S-uVk", ht = "crk-trigger-LwPaD", pt = "crk-triggerOpen-U4pa9", ft = "crk-triggerLabel-QLITs", gt = "crk-triggerError-3jlu1", bt = "crk-placeholder-fWdch", kt = "crk-chevron-jmDNe", vt = "crk-menu-fxnKL", yt = "crk-menuOpen-HF-Y1", Nt = "crk-alignLeft-buCDJ", wt = "crk-alignRight-05P9w", xt = "crk-item-f-Rhh", St = "crk-itemDisabled-L-d6i", It = "crk-itemSelected-Fwmuo", M = {
485
+ root: ut,
486
+ fullWidth: mt,
487
+ trigger: ht,
488
+ triggerOpen: pt,
489
+ triggerLabel: ft,
490
+ triggerError: gt,
491
+ placeholder: bt,
492
+ chevron: kt,
493
+ menu: vt,
494
+ menuOpen: yt,
495
+ alignLeft: Nt,
496
+ alignRight: wt,
497
+ item: xt,
498
+ itemDisabled: St,
499
+ itemSelected: It
491
500
  };
492
- function ie(e, r) {
493
- O(() => {
494
- const t = (o) => {
501
+ function ie(e, r, t = !0) {
502
+ F(() => {
503
+ if (!t) return;
504
+ const n = (o) => {
495
505
  !e.current || e.current.contains(o.target) || r();
496
506
  };
497
- return document.addEventListener("mousedown", t), () => {
498
- document.removeEventListener("mousedown", t);
507
+ return document.addEventListener("mousedown", n), () => {
508
+ document.removeEventListener("mousedown", n);
499
509
  };
500
- }, [e, r]);
510
+ }, [e, r, t]);
501
511
  }
502
- function ne(e, r = !0) {
503
- const t = C(
504
- (o) => {
505
- const n = e[o.key];
506
- n && n(o);
512
+ function he(e, r = !0) {
513
+ const t = L(
514
+ (n) => {
515
+ const o = e[n.key];
516
+ o && o(n);
507
517
  },
508
518
  [e]
509
519
  );
510
- O(() => {
520
+ F(() => {
511
521
  if (r)
512
522
  return document.addEventListener("keydown", t), () => {
513
523
  document.removeEventListener("keydown", t);
514
524
  };
515
525
  }, [r, t]);
516
526
  }
517
- const ht = $(
527
+ const $t = W(
518
528
  ({
519
529
  trigger: e,
520
530
  children: r,
521
531
  align: t = "left",
522
- className: o,
523
- style: n,
524
- onOpen: i,
525
- onClose: l,
526
- options: u,
527
- placeholder: d = "Select...",
528
- value: m,
529
- onChange: a,
530
- error: p = !1,
531
- fullWidth: h = !0,
532
- classes: f
533
- }, y) => {
534
- const [D, P] = oe(!1), A = j(null), E = C(() => {
535
- P(!1), l?.();
536
- }, [l]), S = C(() => {
537
- P((v) => {
538
- const H = !v;
539
- return H ? i?.() : l?.(), H;
532
+ className: n,
533
+ style: o,
534
+ id: m,
535
+ onOpen: a,
536
+ onClose: h,
537
+ options: i,
538
+ placeholder: y = "Select...",
539
+ value: u,
540
+ onChange: g,
541
+ error: v = !1,
542
+ fullWidth: b = !0,
543
+ classes: p
544
+ }, $) => {
545
+ const [w, R] = X(!1), D = O(null), S = O(null), E = O(null), K = ne();
546
+ F(() => {
547
+ w && S.current && S.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
548
+ }, [w]);
549
+ const q = L(() => {
550
+ R(!1), h?.(), E.current?.focus();
551
+ }, [h]), V = L(() => {
552
+ R((x) => {
553
+ const B = !x;
554
+ return B ? a?.() : h?.(), B;
540
555
  });
541
- }, [i, l]), T = C(
542
- (v) => {
543
- a?.(v), E();
556
+ }, [a, h]), j = L(
557
+ (x) => {
558
+ g?.(x), q();
544
559
  },
545
- [a, E]
560
+ [g, q]
546
561
  );
547
- ie(A, E), ne(
562
+ ie(D, q, w), he(
548
563
  {
549
- Escape: () => E()
564
+ Escape: () => q()
550
565
  },
551
- D
566
+ w
552
567
  );
553
- const q = u?.find((v) => v.value === m)?.label, ee = u ? q || d : e, re = u && !q;
568
+ const Y = i?.find((x) => x.value === u)?.label, k = i ? Y || y : e, P = i && !Y;
554
569
  return /* @__PURE__ */ c(
555
570
  "div",
556
571
  {
557
- ref: y,
558
- className: s(N.root, h && N.fullWidth, f?.root, o),
559
- style: n,
560
- children: /* @__PURE__ */ b("div", { ref: A, style: h ? { width: "100%" } : void 0, children: [
561
- /* @__PURE__ */ b(
572
+ ref: $,
573
+ className: l(M.root, b && M.fullWidth, p?.root, n),
574
+ style: o,
575
+ children: /* @__PURE__ */ I("div", { ref: D, style: b ? { width: "100%" } : void 0, children: [
576
+ /* @__PURE__ */ I(
562
577
  "button",
563
578
  {
579
+ ref: E,
580
+ id: m,
564
581
  type: "button",
565
- className: s(
566
- N.trigger,
567
- D && N.triggerOpen,
568
- p && N.triggerError,
569
- h && N.fullWidth,
570
- f?.trigger
582
+ className: l(
583
+ M.trigger,
584
+ w && M.triggerOpen,
585
+ v && M.triggerError,
586
+ b && M.fullWidth,
587
+ p?.trigger
571
588
  ),
572
- onClick: S,
573
- "aria-expanded": D,
574
- "aria-haspopup": "true",
589
+ onClick: V,
590
+ "aria-expanded": w,
591
+ "aria-haspopup": "menu",
592
+ "aria-controls": w ? K : void 0,
575
593
  children: [
576
- /* @__PURE__ */ c("span", { className: s(N.triggerLabel, re && N.placeholder, f?.triggerLabel), children: ee }),
577
- /* @__PURE__ */ c("span", { className: s(N.chevron, f?.chevron), "aria-hidden": "true" })
594
+ /* @__PURE__ */ c("span", { className: l(M.triggerLabel, P && M.placeholder, p?.triggerLabel), children: k }),
595
+ /* @__PURE__ */ c("span", { className: l(M.chevron, p?.chevron), "aria-hidden": "true" })
578
596
  ]
579
597
  }
580
598
  ),
581
599
  /* @__PURE__ */ c(
582
600
  "div",
583
601
  {
584
- className: s(
585
- N.menu,
586
- D && N.menuOpen,
587
- t === "left" ? N.alignLeft : N.alignRight,
588
- h && N.fullWidth,
589
- f?.menu
602
+ ref: S,
603
+ id: K,
604
+ className: l(
605
+ M.menu,
606
+ w && M.menuOpen,
607
+ t === "left" ? M.alignLeft : M.alignRight,
608
+ b && M.fullWidth,
609
+ p?.menu
590
610
  ),
591
611
  role: "menu",
592
- children: u ? u.map((v) => /* @__PURE__ */ c(
612
+ children: i ? i.map((x) => /* @__PURE__ */ c(
593
613
  "button",
594
614
  {
595
615
  type: "button",
596
616
  role: "menuitem",
597
- className: s(
598
- N.item,
599
- v.disabled && N.itemDisabled,
600
- v.value === m && N.itemSelected,
601
- f?.item
617
+ className: l(
618
+ M.item,
619
+ x.disabled && M.itemDisabled,
620
+ x.value === u && M.itemSelected,
621
+ p?.item
602
622
  ),
603
- disabled: v.disabled,
604
- onClick: () => T(v.value),
605
- children: v.label
623
+ disabled: x.disabled,
624
+ onClick: () => j(x.value),
625
+ children: x.label
606
626
  },
607
- v.value
627
+ x.value
608
628
  )) : r
609
629
  }
610
630
  )
@@ -613,89 +633,111 @@ const ht = $(
613
633
  );
614
634
  }
615
635
  );
616
- ht.displayName = "Dropdown";
617
- const kt = $(
636
+ $t.displayName = "Dropdown";
637
+ const Ct = W(
618
638
  ({
619
639
  disabled: e = !1,
620
640
  className: r,
621
641
  children: t,
622
- ...o
623
- }, n) => /* @__PURE__ */ c(
642
+ ...n
643
+ }, o) => /* @__PURE__ */ c(
624
644
  "button",
625
645
  {
626
- ref: n,
646
+ ref: o,
627
647
  type: "button",
628
648
  role: "menuitem",
629
- className: s(
630
- N.item,
631
- e && N.itemDisabled,
649
+ className: l(
650
+ M.item,
651
+ e && M.itemDisabled,
632
652
  r
633
653
  ),
634
654
  disabled: e,
635
- ...o,
655
+ ...n,
636
656
  children: t
637
657
  }
638
658
  )
639
659
  );
640
- kt.displayName = "DropdownItem";
641
- const ft = "crk-root-8H-L9", gt = "crk-trigger-Zn1nQ", bt = "crk-popover-rvS3X", yt = "crk-popoverFade-hj41M", Nt = "crk-bottom-lawQw", vt = "crk-top-rqvC6", wt = "crk-left-J6exv", xt = "crk-right-3y20l", G = {
642
- root: ft,
643
- trigger: gt,
644
- popover: bt,
645
- popoverFade: yt,
646
- bottom: Nt,
647
- top: vt,
648
- left: wt,
649
- right: xt
650
- }, $t = $(
660
+ Ct.displayName = "DropdownItem";
661
+ const Rt = "crk-root-8H-L9", Dt = "crk-trigger-Zn1nQ", Et = "crk-popover-rvS3X", Lt = "crk-popoverFade-hj41M", Bt = "crk-bottom-lawQw", Tt = "crk-top-rqvC6", At = "crk-left-J6exv", Ot = "crk-right-3y20l", oe = {
662
+ root: Rt,
663
+ trigger: Dt,
664
+ popover: Et,
665
+ popoverFade: Lt,
666
+ bottom: Bt,
667
+ top: Tt,
668
+ left: At,
669
+ right: Ot
670
+ }, Pt = W(
651
671
  ({
652
672
  trigger: e,
653
673
  content: r,
654
674
  position: t = "bottom",
655
- open: o,
656
- onOpenChange: n,
657
- classes: i,
658
- className: l,
659
- style: u
660
- }, d) => {
661
- const [m, a] = oe(!1), p = j(null), h = o !== void 0, f = h ? o : m, y = C(
662
- (A) => {
663
- h || a(A), n?.(A);
675
+ open: n,
676
+ onOpenChange: o,
677
+ classes: m,
678
+ className: a,
679
+ style: h
680
+ }, i) => {
681
+ const [y, u] = X(!1), g = O(null), v = O(null), b = O(null), p = ne(), $ = n !== void 0, w = $ ? n : y, R = L(
682
+ (E) => {
683
+ $ || u(E), o?.(E);
664
684
  },
665
- [h, n]
666
- ), D = C(() => y(!1), [y]), P = C(() => {
667
- y(!f);
668
- }, [f, y]);
669
- return ie(p, D), ne(
685
+ [$, o]
686
+ ), D = L(() => {
687
+ R(!1), b.current?.focus();
688
+ }, [R]), S = L(() => {
689
+ R(!w);
690
+ }, [w, R]);
691
+ return ie(g, D, w), he(
670
692
  {
671
693
  Escape: () => D()
672
694
  },
673
- f
674
- ), /* @__PURE__ */ c(
695
+ w
696
+ ), F(() => {
697
+ if (w && v.current) {
698
+ const E = v.current.querySelector(
699
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
700
+ );
701
+ E ? E.focus() : v.current.focus();
702
+ }
703
+ }, [w]), /* @__PURE__ */ c(
675
704
  "div",
676
705
  {
677
- ref: d,
678
- className: s(G.root, i?.root, l),
679
- style: u,
680
- children: /* @__PURE__ */ b("div", { ref: p, children: [
706
+ ref: i,
707
+ className: l(oe.root, m?.root, a),
708
+ style: h,
709
+ children: /* @__PURE__ */ I("div", { ref: g, children: [
681
710
  /* @__PURE__ */ c(
682
711
  "button",
683
712
  {
713
+ ref: b,
684
714
  type: "button",
685
- className: s(G.trigger, i?.trigger),
686
- onClick: P,
687
- "aria-expanded": f,
715
+ className: l(oe.trigger, m?.trigger),
716
+ onClick: S,
717
+ "aria-expanded": w,
718
+ "aria-haspopup": "dialog",
719
+ "aria-controls": w ? p : void 0,
688
720
  children: e
689
721
  }
690
722
  ),
691
- f && /* @__PURE__ */ c("div", { className: s(G.popover, G[t], i?.popover), children: r })
723
+ w && /* @__PURE__ */ c(
724
+ "div",
725
+ {
726
+ ref: v,
727
+ id: p,
728
+ role: "dialog",
729
+ tabIndex: -1,
730
+ className: l(oe.popover, oe[t], m?.popover),
731
+ children: r
732
+ }
733
+ )
692
734
  ] })
693
735
  }
694
736
  );
695
737
  }
696
738
  );
697
- $t.displayName = "Popover";
698
- const se = [
739
+ Pt.displayName = "Popover";
740
+ const pe = [
699
741
  'input:not([disabled]):not([type="hidden"])',
700
742
  "button:not([disabled])",
701
743
  "select:not([disabled])",
@@ -703,62 +745,63 @@ const se = [
703
745
  "a[href]",
704
746
  '[tabindex]:not([tabindex="-1"])'
705
747
  ].join(", ");
706
- function St(e, r) {
707
- const t = j(null), o = C(
708
- (n) => {
709
- if (n.key !== "Tab" || !e.current)
748
+ function Mt(e, r) {
749
+ const t = O(null), n = L(
750
+ (o) => {
751
+ if (o.key !== "Tab" || !e.current)
710
752
  return;
711
- const i = Array.from(
712
- e.current.querySelectorAll(se)
753
+ const m = Array.from(
754
+ e.current.querySelectorAll(pe)
713
755
  );
714
- if (i.length === 0) {
715
- n.preventDefault();
756
+ if (m.length === 0) {
757
+ o.preventDefault();
716
758
  return;
717
759
  }
718
- const l = i[0], u = i[i.length - 1];
719
- n.shiftKey ? document.activeElement === l && (n.preventDefault(), u.focus()) : document.activeElement === u && (n.preventDefault(), l.focus());
760
+ const a = m[0], h = m[m.length - 1];
761
+ o.shiftKey ? document.activeElement === a && (o.preventDefault(), h.focus()) : document.activeElement === h && (o.preventDefault(), a.focus());
720
762
  },
721
763
  [e]
722
764
  );
723
- O(() => {
765
+ F(() => {
724
766
  if (!r || !e.current)
725
767
  return;
726
768
  t.current = document.activeElement;
727
- const n = e.current.querySelectorAll(se);
728
- return n.length > 0 && n[0].focus(), document.addEventListener("keydown", o), () => {
729
- document.removeEventListener("keydown", o), t.current instanceof HTMLElement && t.current.focus();
769
+ const o = e.current.querySelectorAll(pe);
770
+ return o.length > 0 && o[0].focus(), document.addEventListener("keydown", n), () => {
771
+ document.removeEventListener("keydown", n), t.current instanceof HTMLElement && t.current.focus();
730
772
  };
731
- }, [r, e, o]);
773
+ }, [r, e, n]);
732
774
  }
733
- const Ct = "crk-backdrop-jYpTA", It = "crk-backdropIn-x5Z-A", Bt = "crk-modal-yNG-7", Dt = "crk-modalIn-xFUwm", At = "crk-sm--xyY9", Lt = "crk-md-ETTfh", Rt = "crk-lg-5DBb7", Et = "crk-fullscreen-b4jQ-", Tt = "crk-header-NS30G", Ft = "crk-headerWithClose-4davm", Pt = "crk-closeButton-JX-aq", Mt = "crk-body-3zIj9", Wt = "crk-footer-Oyz-R", R = {
734
- backdrop: Ct,
735
- backdropIn: It,
736
- modal: Bt,
737
- modalIn: Dt,
738
- sm: At,
739
- md: Lt,
740
- lg: Rt,
741
- fullscreen: Et,
742
- header: Tt,
743
- headerWithClose: Ft,
744
- closeButton: Pt,
745
- body: Mt,
746
- footer: Wt
747
- }, J = ae({}), de = ({ children: e, className: r, style: t, onClose: o }) => {
748
- const n = Z(J);
749
- return /* @__PURE__ */ b(
775
+ const Wt = "crk-backdrop-jYpTA", Ht = "crk-backdropIn-x5Z-A", qt = "crk-modal-yNG-7", Ft = "crk-modalIn-xFUwm", jt = "crk-sm--xyY9", zt = "crk-md-ETTfh", Kt = "crk-lg-5DBb7", Ut = "crk-fullscreen-b4jQ-", Gt = "crk-header-NS30G", Vt = "crk-headerWithClose-4davm", Qt = "crk-closeButton-JX-aq", Xt = "crk-body-3zIj9", Yt = "crk-footer-Oyz-R", J = {
776
+ backdrop: Wt,
777
+ backdropIn: Ht,
778
+ modal: qt,
779
+ modalIn: Ft,
780
+ sm: jt,
781
+ md: zt,
782
+ lg: Kt,
783
+ fullscreen: Ut,
784
+ header: Gt,
785
+ headerWithClose: Vt,
786
+ closeButton: Qt,
787
+ body: Xt,
788
+ footer: Yt
789
+ }, de = fe({ classes: {}, titleId: "" }), be = ({ children: e, className: r, style: t, onClose: n }) => {
790
+ const { classes: o, titleId: m } = ae(de);
791
+ return /* @__PURE__ */ I(
750
792
  "div",
751
793
  {
752
- className: s(R.header, o && R.headerWithClose, n.header, r),
794
+ id: m,
795
+ className: l(J.header, n && J.headerWithClose, o.header, r),
753
796
  style: t,
754
797
  children: [
755
798
  e,
756
- o && /* @__PURE__ */ c(
799
+ n && /* @__PURE__ */ c(
757
800
  "button",
758
801
  {
759
802
  type: "button",
760
- className: s(R.closeButton, n.closeButton),
761
- onClick: o,
803
+ className: l(J.closeButton, o.closeButton),
804
+ onClick: n,
762
805
  "aria-label": "Close",
763
806
  children: "×"
764
807
  }
@@ -767,65 +810,69 @@ const Ct = "crk-backdrop-jYpTA", It = "crk-backdropIn-x5Z-A", Bt = "crk-modal-yN
767
810
  }
768
811
  );
769
812
  };
770
- de.displayName = "Modal.Header";
771
- const ue = ({ children: e, className: r, style: t }) => {
772
- const o = Z(J);
773
- return /* @__PURE__ */ c("div", { className: s(R.body, o.body, r), style: t, children: e });
813
+ be.displayName = "Modal.Header";
814
+ const ke = ({ children: e, className: r, style: t }) => {
815
+ const { classes: n } = ae(de);
816
+ return /* @__PURE__ */ c("div", { className: l(J.body, n.body, r), style: t, children: e });
774
817
  };
775
- ue.displayName = "Modal.Body";
776
- const me = ({ children: e, className: r, style: t }) => {
777
- const o = Z(J);
778
- return /* @__PURE__ */ c("div", { className: s(R.footer, o.footer, r), style: t, children: e });
818
+ ke.displayName = "Modal.Body";
819
+ const ve = ({ children: e, className: r, style: t }) => {
820
+ const { classes: n } = ae(de);
821
+ return /* @__PURE__ */ c("div", { className: l(J.footer, n.footer, r), style: t, children: e });
779
822
  };
780
- me.displayName = "Modal.Footer";
781
- const _ = $(
823
+ ve.displayName = "Modal.Footer";
824
+ const ue = W(
782
825
  ({
783
826
  open: e,
784
827
  onClose: r,
785
828
  closeOnBackdrop: t = !0,
786
- closeOnEscape: o = !0,
787
- size: n = "md",
788
- classes: i,
789
- className: l,
790
- style: u,
791
- children: d
792
- }, m) => {
793
- const a = j(null), p = m ?? a;
794
- St(p, e);
795
- const h = X(
829
+ closeOnEscape: n = !0,
830
+ size: o = "md",
831
+ classes: m,
832
+ className: a,
833
+ style: h,
834
+ children: i,
835
+ "aria-label": y,
836
+ "aria-labelledby": u
837
+ }, g) => {
838
+ const v = O(null), b = g ?? v, p = ne(), $ = u ?? `${p}-title`;
839
+ Mt(b, e);
840
+ const w = ee(
796
841
  () => ({
797
842
  Escape: () => {
798
- o && r();
843
+ n && r();
799
844
  }
800
845
  }),
801
- [o, r]
846
+ [n, r]
802
847
  );
803
- ne(h, e), O(() => {
848
+ he(w, e), F(() => {
804
849
  if (!e) return;
805
- const y = document.body.style.overflow;
850
+ const D = document.body.style.overflow;
806
851
  return document.body.style.overflow = "hidden", () => {
807
- document.body.style.overflow = y;
852
+ document.body.style.overflow = D;
808
853
  };
809
854
  }, [e]);
810
- const f = (y) => {
811
- t && y.target === y.currentTarget && r();
855
+ const R = (D) => {
856
+ t && D.target === D.currentTarget && r();
812
857
  };
813
- return e ? ye(
858
+ return e ? Ee(
814
859
  /* @__PURE__ */ c(
815
860
  "div",
816
861
  {
817
- className: s(R.backdrop, i?.backdrop),
818
- onClick: f,
862
+ className: l(J.backdrop, m?.backdrop),
863
+ onClick: R,
819
864
  role: "presentation",
820
865
  children: /* @__PURE__ */ c(
821
866
  "div",
822
867
  {
823
- ref: p,
824
- className: s(R.modal, R[n], i?.modal, l),
825
- style: u,
868
+ ref: b,
869
+ className: l(J.modal, J[o], m?.modal, a),
870
+ style: h,
826
871
  role: "dialog",
827
872
  "aria-modal": "true",
828
- children: /* @__PURE__ */ c(J.Provider, { value: i ?? {}, children: d })
873
+ "aria-label": y,
874
+ "aria-labelledby": y ? void 0 : $,
875
+ children: /* @__PURE__ */ c(de.Provider, { value: { classes: m ?? {}, titleId: $ }, children: i })
829
876
  }
830
877
  )
831
878
  }
@@ -834,296 +881,780 @@ const _ = $(
834
881
  ) : null;
835
882
  }
836
883
  );
837
- _.displayName = "Modal";
838
- _.Header = de;
839
- _.Body = ue;
840
- _.Footer = me;
841
- const zt = "crk-root-jHIIP", qt = "crk-field-OUlYz", Ot = "crk-label-udkR7", jt = "crk-required-IYiA2", Ht = "crk-error-yFZXm", Ut = "crk-helperText-Dm-rb", z = {
842
- root: zt,
843
- field: qt,
844
- label: Ot,
845
- required: jt,
846
- error: Ht,
847
- helperText: Ut
884
+ ue.displayName = "Modal";
885
+ ue.Header = be;
886
+ ue.Body = ke;
887
+ ue.Footer = ve;
888
+ const Jt = "crk-root-jHIIP", Zt = "crk-formErrors-eh-OP", _t = "crk-formError-XEuWv", en = "crk-field-OUlYz", rn = "crk-label-udkR7", tn = "crk-labelError-LOgKi", nn = "crk-required-IYiA2", on = "crk-error-yFZXm", cn = "crk-helperText-Dm-rb", ln = "crk-row-nNbx-", G = {
889
+ root: Jt,
890
+ formErrors: Zt,
891
+ formError: _t,
892
+ field: en,
893
+ label: rn,
894
+ labelError: tn,
895
+ required: nn,
896
+ error: on,
897
+ helperText: cn,
898
+ row: ln
848
899
  };
849
- function Wo({
900
+ function Co({
850
901
  form: e,
851
902
  onSubmit: r,
852
- className: t,
903
+ errors: t,
904
+ className: n,
853
905
  style: o,
854
- children: n
906
+ children: m
855
907
  }) {
856
- return /* @__PURE__ */ c(fe, { ...e, children: /* @__PURE__ */ c(
908
+ const a = t && t.length > 0;
909
+ return /* @__PURE__ */ c(Ce, { ...e, children: /* @__PURE__ */ I(
857
910
  "form",
858
911
  {
859
912
  onSubmit: e.handleSubmit(r),
860
- className: s(z.root, t),
913
+ className: l(G.root, n),
861
914
  style: o,
862
- children: n
915
+ children: [
916
+ a && /* @__PURE__ */ c("ul", { className: G.formErrors, role: "alert", children: t.map((h, i) => /* @__PURE__ */ c("li", { className: G.formError, children: h }, i)) }),
917
+ m
918
+ ]
863
919
  }
864
920
  ) });
865
921
  }
866
- function zo({
922
+ function Ro({
867
923
  name: e,
868
924
  label: r,
869
925
  helperText: t,
870
- required: o,
871
- rules: n,
872
- classes: i,
873
- className: l,
874
- style: u,
875
- children: d
926
+ required: n,
927
+ rules: o,
928
+ classes: m,
929
+ className: a,
930
+ style: h,
931
+ children: i
876
932
  }) {
877
- const { control: m } = ge(), { field: a, fieldState: p } = be({ name: e, control: m, rules: n });
878
- return /* @__PURE__ */ b("div", { className: s(z.field, i?.field, l), style: u, children: [
879
- r && /* @__PURE__ */ b("label", { className: s(z.label, i?.label), htmlFor: e, children: [
933
+ const { control: y } = Re(), { field: u, fieldState: g } = De({ name: e, control: y, rules: o }), { ref: v, ...b } = u, p = O(v);
934
+ p.current = v;
935
+ const $ = L(
936
+ (w) => {
937
+ if (w) {
938
+ const R = w.matches("input, select, textarea, button, [tabindex]") ? w : w.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
939
+ p.current(R ?? w);
940
+ } else
941
+ p.current(null);
942
+ },
943
+ // eslint-disable-next-line react-hooks/exhaustive-deps
944
+ []
945
+ );
946
+ return /* @__PURE__ */ I("div", { className: l(G.field, m?.field, a), style: h, children: [
947
+ r && /* @__PURE__ */ I("label", { className: l(G.label, g.error && G.labelError, m?.label), htmlFor: e, children: [
880
948
  r,
881
- o && /* @__PURE__ */ c("span", { className: z.required, children: "*" })
949
+ n && /* @__PURE__ */ c("span", { className: G.required, children: "*" })
882
950
  ] }),
883
- ke(d, { ...a, id: e, error: !!p.error }),
884
- p.error?.message ? /* @__PURE__ */ c("span", { className: s(z.error, i?.error), children: p.error.message }) : t ? /* @__PURE__ */ c("span", { className: s(z.helperText, i?.helperText), children: t }) : null
951
+ $e(i, {
952
+ ...b,
953
+ ref: $,
954
+ id: e,
955
+ error: !!g.error,
956
+ "aria-invalid": g.error ? !0 : void 0,
957
+ "aria-describedby": g.error?.message ? `${e}-error` : t ? `${e}-helper` : void 0,
958
+ // Bridge for custom components that use onValueChange/onValuesChange
959
+ onValueChange: b.onChange,
960
+ onValuesChange: b.onChange,
961
+ // Bridge for Checkbox (expects checked, not value)
962
+ checked: typeof b.value == "boolean" ? b.value : void 0
963
+ }),
964
+ g.error?.message ? /* @__PURE__ */ c("span", { id: `${e}-error`, className: l(G.error, m?.error), role: "alert", children: g.error.message }) : t ? /* @__PURE__ */ c("span", { id: `${e}-helper`, className: l(G.helperText, m?.helperText), children: t }) : null
885
965
  ] });
886
966
  }
887
- const Gt = "crk-root-rSgdy", Kt = "crk-wrapper-GHy8V", Qt = "crk-sm-DptM5", Vt = "crk-md-F4B0G", Yt = "crk-lg-pBxwX", Xt = "crk-error-fucxe", Zt = "crk-prefix-w53Md", Jt = "crk-suffix-fcNgR", _t = "crk-hasPrefix--bqPD", eo = "crk-hasSuffix-zO0nX", B = {
888
- root: Gt,
889
- wrapper: Kt,
890
- sm: Qt,
891
- md: Vt,
892
- lg: Yt,
893
- error: Xt,
894
- prefix: Zt,
895
- suffix: Jt,
896
- hasPrefix: _t,
897
- hasSuffix: eo
898
- }, ro = $(
967
+ function Do({ children: e, className: r, style: t }) {
968
+ return /* @__PURE__ */ c("div", { className: l(G.row, r), style: t, children: e });
969
+ }
970
+ const sn = "crk-root-rSgdy", an = "crk-wrapper-GHy8V", dn = "crk-sm-DptM5", un = "crk-md-F4B0G", mn = "crk-lg-pBxwX", hn = "crk-error-fucxe", pn = "crk-prefix-w53Md", fn = "crk-suffix-fcNgR", gn = "crk-hasPrefix--bqPD", bn = "crk-hasSuffix-zO0nX", U = {
971
+ root: sn,
972
+ wrapper: an,
973
+ sm: dn,
974
+ md: un,
975
+ lg: mn,
976
+ error: hn,
977
+ prefix: pn,
978
+ suffix: fn,
979
+ hasPrefix: gn,
980
+ hasSuffix: bn
981
+ }, kn = W(
899
982
  ({
900
983
  inputSize: e = "md",
901
984
  error: r = !1,
902
985
  prefix: t,
903
- suffix: o,
904
- classes: n,
905
- className: i,
906
- style: l,
907
- ...u
908
- }, d) => {
909
- const m = /* @__PURE__ */ c(
986
+ suffix: n,
987
+ classes: o,
988
+ className: m,
989
+ style: a,
990
+ ...h
991
+ }, i) => {
992
+ const y = /* @__PURE__ */ c(
910
993
  "input",
911
994
  {
912
- ref: d,
913
- className: s(
914
- B.root,
915
- B[e],
916
- r && B.error,
917
- t && B.hasPrefix,
918
- o && B.hasSuffix,
919
- n?.root,
920
- !t && !o && i
995
+ ref: i,
996
+ className: l(
997
+ U.root,
998
+ U[e],
999
+ r && U.error,
1000
+ t && U.hasPrefix,
1001
+ n && U.hasSuffix,
1002
+ o?.root,
1003
+ !t && !n && m
921
1004
  ),
922
- style: !t && !o ? l : void 0,
923
- ...u
1005
+ style: !t && !n ? a : void 0,
1006
+ ...h
924
1007
  }
925
1008
  );
926
- return t || o ? /* @__PURE__ */ b(
1009
+ return t || n ? /* @__PURE__ */ I(
927
1010
  "div",
928
1011
  {
929
- className: s(B.wrapper, B[e], r && B.error, n?.wrapper, i),
930
- style: l,
1012
+ className: l(U.wrapper, U[e], r && U.error, o?.wrapper, m),
1013
+ style: a,
931
1014
  children: [
932
- t && /* @__PURE__ */ c("span", { className: s(B.prefix, n?.prefix), children: t }),
933
- m,
934
- o && /* @__PURE__ */ c("span", { className: s(B.suffix, n?.suffix), children: o })
1015
+ t && /* @__PURE__ */ c("span", { className: l(U.prefix, o?.prefix), children: t }),
1016
+ y,
1017
+ n && /* @__PURE__ */ c("span", { className: l(U.suffix, o?.suffix), children: n })
935
1018
  ]
936
1019
  }
937
- ) : m;
1020
+ ) : y;
938
1021
  }
939
1022
  );
940
- ro.displayName = "Input";
941
- const to = "crk-wrapper-SP2JE", oo = "crk-root-Uu9Ah", no = "crk-sm-DqshL", co = "crk-md-j4AKI", so = "crk-lg-24Xd3", ao = "crk-error-9oRU6", lo = "crk-arrow-WU8ZW", F = {
942
- wrapper: to,
943
- root: oo,
944
- sm: no,
945
- md: co,
946
- lg: so,
947
- error: ao,
948
- arrow: lo
949
- }, io = $(
1023
+ kn.displayName = "Input";
1024
+ const vn = "crk-wrapper-SP2JE", yn = "crk-sm-DqshL", Nn = "crk-md-j4AKI", wn = "crk-lg-24Xd3", xn = "crk-root-Uu9Ah", Sn = "crk-error-9oRU6", In = "crk-arrow-WU8ZW", $n = "crk-searchableWrapper-7AL4l", Cn = "crk-hiddenSelect-s3DEx", Rn = "crk-searchableTrigger-m-GWV", Dn = "crk-triggerOpen-Lo8-j", En = "crk-triggerLabel-5rETZ", Ln = "crk-placeholder-teBBh", Bn = "crk-arrowInline-m-roG", Tn = "crk-disabled-pcSeq", An = "crk-visuallyHidden-2tTD5", On = "crk-menu--i-je", Pn = "crk-menuEnter-vJjLV", Mn = "crk-menuItems-VrZnE", Wn = "crk-item-fU3XI", Hn = "crk-itemHighlighted-MvR41", qn = "crk-itemDisabled-KTUO8", Fn = "crk-itemSelected-42-BG", jn = "crk-noResults-uicSW", zn = "crk-multiTrigger-Pd3wJ", Kn = "crk-multiTriggerDisabled-9ajge", Un = "crk-chip-TuYUB", Gn = "crk-chipLabel-H4JWu", Vn = "crk-chipRemove-Lfk0R", Qn = "crk-multiSearch-OrVeS", Xn = "crk-arrowMulti-Nh9Hr", Yn = "crk-itemCheck-DPB5A", d = {
1025
+ wrapper: vn,
1026
+ sm: yn,
1027
+ md: Nn,
1028
+ lg: wn,
1029
+ root: xn,
1030
+ error: Sn,
1031
+ arrow: In,
1032
+ searchableWrapper: $n,
1033
+ hiddenSelect: Cn,
1034
+ searchableTrigger: Rn,
1035
+ triggerOpen: Dn,
1036
+ triggerLabel: En,
1037
+ placeholder: Ln,
1038
+ arrowInline: Bn,
1039
+ disabled: Tn,
1040
+ visuallyHidden: An,
1041
+ menu: On,
1042
+ menuEnter: Pn,
1043
+ menuItems: Mn,
1044
+ item: Wn,
1045
+ itemHighlighted: Hn,
1046
+ itemDisabled: qn,
1047
+ itemSelected: Fn,
1048
+ noResults: jn,
1049
+ multiTrigger: zn,
1050
+ multiTriggerDisabled: Kn,
1051
+ chip: Un,
1052
+ chipLabel: Gn,
1053
+ chipRemove: Vn,
1054
+ multiSearch: Qn,
1055
+ arrowMulti: Xn,
1056
+ itemCheck: Yn
1057
+ }, ye = W(
950
1058
  ({
951
1059
  inputSize: e = "md",
952
1060
  error: r = !1,
953
1061
  options: t,
954
- placeholder: o,
955
- classes: n,
956
- className: i,
957
- style: l,
958
- children: u,
959
- ...d
960
- }, m) => /* @__PURE__ */ b("div", { className: s(F.wrapper, F[e], r && F.error, n?.wrapper, i), style: l, children: [
961
- /* @__PURE__ */ b(
1062
+ placeholder: n,
1063
+ classes: o,
1064
+ className: m,
1065
+ style: a,
1066
+ children: h,
1067
+ searchable: i,
1068
+ searchPlaceholder: y,
1069
+ onValueChange: u,
1070
+ ...g
1071
+ }, v) => /* @__PURE__ */ I("div", { className: l(d.wrapper, d[e], r && d.error, o?.wrapper, m), style: a, children: [
1072
+ /* @__PURE__ */ I(
962
1073
  "select",
963
1074
  {
964
- ref: m,
965
- className: s(F.root, F[e], r && F.error, n?.root),
966
- ...d,
1075
+ ref: v,
1076
+ className: l(d.root, d[e], r && d.error, o?.root),
1077
+ ...g,
967
1078
  children: [
968
- o && /* @__PURE__ */ c("option", { value: "", disabled: !0, children: o }),
969
- t ? t.map((a) => /* @__PURE__ */ c("option", { value: a.value, disabled: a.disabled, children: a.label }, a.value)) : u
1079
+ n && /* @__PURE__ */ c("option", { value: "", disabled: !0, children: n }),
1080
+ t ? t.map((b) => /* @__PURE__ */ c("option", { value: b.value, disabled: b.disabled, children: b.label }, b.value)) : h
970
1081
  ]
971
1082
  }
972
1083
  ),
973
- /* @__PURE__ */ c("span", { className: s(F.arrow, n?.arrow) })
1084
+ /* @__PURE__ */ c("span", { className: l(d.arrow, o?.arrow) })
974
1085
  ] })
975
1086
  );
976
- io.displayName = "Select";
977
- const uo = "crk-root-61cKD", mo = "crk-input-bAjPU", po = "crk-label-W9IeS", ho = "crk-indeterminate-mLarv", K = {
978
- root: uo,
979
- input: mo,
980
- label: po,
981
- indeterminate: ho
982
- }, ko = $(
1087
+ ye.displayName = "NativeSelect";
1088
+ const Ne = W(
1089
+ ({
1090
+ inputSize: e = "md",
1091
+ error: r = !1,
1092
+ options: t = [],
1093
+ placeholder: n = "Select...",
1094
+ classes: o,
1095
+ className: m,
1096
+ style: a,
1097
+ value: h,
1098
+ disabled: i,
1099
+ id: y,
1100
+ searchPlaceholder: u = "Search...",
1101
+ onChange: g,
1102
+ onValueChange: v
1103
+ }, b) => {
1104
+ const [p, $] = X(!1), [w, R] = X(""), [D, S] = X(0), E = O(null), K = O(null), q = O(null), V = O(null), j = ne(), Y = O(null), k = b ?? Y, P = O(!1);
1105
+ F(() => {
1106
+ P.current && !p && q.current?.focus(), P.current = p;
1107
+ }, [p]);
1108
+ const x = L(() => {
1109
+ $(!1), R(""), S(0);
1110
+ }, []), B = L(() => {
1111
+ i || ($(!0), R(""), S(0), setTimeout(() => K.current?.focus(), 0));
1112
+ }, [i]), z = L(
1113
+ (s) => {
1114
+ if (v?.(s), k.current) {
1115
+ Object.getOwnPropertyDescriptor(
1116
+ HTMLSelectElement.prototype,
1117
+ "value"
1118
+ )?.set?.call(k.current, s);
1119
+ const T = new Event("change", { bubbles: !0 });
1120
+ k.current.dispatchEvent(T), g?.(T);
1121
+ }
1122
+ x();
1123
+ },
1124
+ [v, g, k, x]
1125
+ ), A = ee(() => {
1126
+ if (!w) return t;
1127
+ const s = w.toLowerCase();
1128
+ return t.filter((N) => N.label.toLowerCase().includes(s));
1129
+ }, [t, w]);
1130
+ F(() => {
1131
+ const s = A.findIndex((N) => !N.disabled);
1132
+ S(s >= 0 ? s : 0);
1133
+ }, [A]), F(() => {
1134
+ if (!p) return;
1135
+ const s = V.current;
1136
+ if (!s) return;
1137
+ s.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
1138
+ }, [D, p]);
1139
+ const Z = L(
1140
+ (s) => {
1141
+ const N = A.map((T, Q) => T.disabled ? -1 : Q).filter((T) => T >= 0);
1142
+ if (N.length !== 0)
1143
+ if (s.key === "ArrowDown")
1144
+ s.preventDefault(), S((T) => {
1145
+ const Q = N.indexOf(T);
1146
+ return Q < N.length - 1 ? N[Q + 1] : N[0];
1147
+ });
1148
+ else if (s.key === "ArrowUp")
1149
+ s.preventDefault(), S((T) => {
1150
+ const Q = N.indexOf(T);
1151
+ return Q > 0 ? N[Q - 1] : N[N.length - 1];
1152
+ });
1153
+ else if (s.key === "Enter") {
1154
+ s.preventDefault();
1155
+ const T = A[D];
1156
+ T && !T.disabled && z(T.value);
1157
+ } else s.key === "Escape" && (s.preventDefault(), x());
1158
+ },
1159
+ [A, D, z, x]
1160
+ );
1161
+ ie(E, x, p);
1162
+ const re = t.find((s) => s.value === h)?.label, f = A.filter((s) => !s.disabled);
1163
+ return /* @__PURE__ */ I(
1164
+ "div",
1165
+ {
1166
+ ref: E,
1167
+ className: l(
1168
+ d.wrapper,
1169
+ d.searchableWrapper,
1170
+ d[e],
1171
+ r && d.error,
1172
+ i && d.disabled,
1173
+ o?.wrapper,
1174
+ m
1175
+ ),
1176
+ style: a,
1177
+ children: [
1178
+ /* @__PURE__ */ c(
1179
+ "select",
1180
+ {
1181
+ ref: k,
1182
+ className: d.hiddenSelect,
1183
+ value: h ?? "",
1184
+ disabled: i,
1185
+ tabIndex: -1,
1186
+ "aria-hidden": "true",
1187
+ onChange: () => {
1188
+ },
1189
+ children: t.map((s) => /* @__PURE__ */ c("option", { value: s.value, children: s.label }, s.value))
1190
+ }
1191
+ ),
1192
+ /* @__PURE__ */ I(
1193
+ "button",
1194
+ {
1195
+ ref: q,
1196
+ id: y,
1197
+ type: "button",
1198
+ className: l(
1199
+ d.root,
1200
+ d.searchableTrigger,
1201
+ d[e],
1202
+ p && d.triggerOpen,
1203
+ r && d.error,
1204
+ p && d.visuallyHidden,
1205
+ o?.root
1206
+ ),
1207
+ onClick: B,
1208
+ disabled: i,
1209
+ "aria-expanded": p,
1210
+ "aria-haspopup": "listbox",
1211
+ "aria-controls": p ? j : void 0,
1212
+ children: [
1213
+ /* @__PURE__ */ c("span", { className: l(d.triggerLabel, !re && d.placeholder), children: re || n }),
1214
+ /* @__PURE__ */ c("span", { className: l(d.arrow, d.arrowInline, o?.arrow) })
1215
+ ]
1216
+ }
1217
+ ),
1218
+ p && /* @__PURE__ */ c(
1219
+ "input",
1220
+ {
1221
+ ref: K,
1222
+ type: "text",
1223
+ role: "combobox",
1224
+ className: l(
1225
+ d.root,
1226
+ d.searchableTrigger,
1227
+ d[e],
1228
+ d.triggerOpen,
1229
+ r && d.error,
1230
+ o?.root,
1231
+ o?.search
1232
+ ),
1233
+ placeholder: re || n,
1234
+ value: w,
1235
+ onChange: (s) => R(s.target.value),
1236
+ onKeyDown: Z,
1237
+ "aria-expanded": !0,
1238
+ "aria-haspopup": "listbox",
1239
+ "aria-controls": j,
1240
+ "aria-activedescendant": f.length > 0 ? `select-option-${A[D]?.value}` : void 0
1241
+ }
1242
+ ),
1243
+ p && /* @__PURE__ */ c("div", { id: j, className: l(d.menu, o?.menu), role: "listbox", children: /* @__PURE__ */ c("div", { className: d.menuItems, ref: V, children: A.length === 0 ? /* @__PURE__ */ c("div", { className: d.noResults, children: "No results" }) : A.map((s, N) => /* @__PURE__ */ c(
1244
+ "button",
1245
+ {
1246
+ id: `select-option-${s.value}`,
1247
+ type: "button",
1248
+ role: "option",
1249
+ "aria-selected": s.value === h,
1250
+ className: l(
1251
+ d.item,
1252
+ s.disabled && d.itemDisabled,
1253
+ s.value === h && d.itemSelected,
1254
+ N === D && d.itemHighlighted,
1255
+ o?.item
1256
+ ),
1257
+ disabled: s.disabled,
1258
+ onClick: () => z(s.value),
1259
+ onMouseEnter: () => S(N),
1260
+ children: s.content ?? s.label
1261
+ },
1262
+ s.value
1263
+ )) }) })
1264
+ ]
1265
+ }
1266
+ );
1267
+ }
1268
+ );
1269
+ Ne.displayName = "SearchableSelect";
1270
+ const we = W(
1271
+ ({
1272
+ inputSize: e = "md",
1273
+ error: r = !1,
1274
+ options: t = [],
1275
+ placeholder: n = "Select...",
1276
+ classes: o,
1277
+ className: m,
1278
+ style: a,
1279
+ value: h,
1280
+ disabled: i,
1281
+ id: y,
1282
+ searchPlaceholder: u,
1283
+ onValuesChange: g,
1284
+ clearSearchOnSelect: v = !0
1285
+ }, b) => {
1286
+ const p = Array.isArray(h) ? h : h ? [h] : [], [$, w] = X(!1), [R, D] = X(""), [S, E] = X(0), K = O(null), q = O(null), V = O(null), j = ne(), Y = O(null), k = b ?? Y, P = L(() => {
1287
+ w(!1), D(""), E(0);
1288
+ }, []), x = L(() => {
1289
+ i || (w(!0), D(""), E(0), setTimeout(() => q.current?.focus(), 0));
1290
+ }, [i]), B = L(
1291
+ (f) => {
1292
+ const s = p.includes(f) ? p.filter((N) => N !== f) : [...p, f];
1293
+ g?.(s), v && D("");
1294
+ },
1295
+ [p, g, v]
1296
+ ), z = L(
1297
+ (f, s) => {
1298
+ s.stopPropagation(), g?.(p.filter((N) => N !== f));
1299
+ },
1300
+ [p, g]
1301
+ ), A = ee(() => {
1302
+ if (!R) return t;
1303
+ const f = R.toLowerCase();
1304
+ return t.filter((s) => s.label.toLowerCase().includes(f));
1305
+ }, [t, R]);
1306
+ F(() => {
1307
+ const f = A.findIndex((s) => !s.disabled);
1308
+ E(f >= 0 ? f : 0);
1309
+ }, [A]), F(() => {
1310
+ if (!$) return;
1311
+ const f = V.current;
1312
+ if (!f) return;
1313
+ f.querySelectorAll('[role="option"]')[S]?.scrollIntoView?.({ block: "nearest" });
1314
+ }, [S, $]);
1315
+ const Z = L(
1316
+ (f) => {
1317
+ const s = A.map((N, T) => N.disabled ? -1 : T).filter((N) => N >= 0);
1318
+ if (f.key === "Backspace" && R === "" && p.length > 0) {
1319
+ f.preventDefault(), g?.(p.slice(0, -1));
1320
+ return;
1321
+ }
1322
+ if (s.length !== 0)
1323
+ if (f.key === "ArrowDown") {
1324
+ if (f.preventDefault(), !$) {
1325
+ x();
1326
+ return;
1327
+ }
1328
+ E((N) => {
1329
+ const T = s.indexOf(N);
1330
+ return T < s.length - 1 ? s[T + 1] : s[0];
1331
+ });
1332
+ } else if (f.key === "ArrowUp")
1333
+ f.preventDefault(), E((N) => {
1334
+ const T = s.indexOf(N);
1335
+ return T > 0 ? s[T - 1] : s[s.length - 1];
1336
+ });
1337
+ else if (f.key === "Enter") {
1338
+ f.preventDefault();
1339
+ const N = A[S];
1340
+ N && !N.disabled && B(N.value);
1341
+ } else f.key === "Escape" && (f.preventDefault(), P());
1342
+ },
1343
+ [A, S, B, P, R, p, g, $, x]
1344
+ );
1345
+ ie(K, P, $);
1346
+ const re = p.map((f) => t.find((s) => s.value === f)).filter((f) => !!f);
1347
+ return /* @__PURE__ */ I(
1348
+ "div",
1349
+ {
1350
+ ref: K,
1351
+ className: l(
1352
+ d.wrapper,
1353
+ d.searchableWrapper,
1354
+ d[e],
1355
+ r && d.error,
1356
+ i && d.disabled,
1357
+ o?.wrapper,
1358
+ m
1359
+ ),
1360
+ style: a,
1361
+ children: [
1362
+ /* @__PURE__ */ c(
1363
+ "select",
1364
+ {
1365
+ ref: k,
1366
+ className: d.hiddenSelect,
1367
+ multiple: !0,
1368
+ value: p,
1369
+ disabled: i,
1370
+ tabIndex: -1,
1371
+ "aria-hidden": "true",
1372
+ onChange: () => {
1373
+ },
1374
+ children: t.map((f) => /* @__PURE__ */ c("option", { value: f.value, children: f.label }, f.value))
1375
+ }
1376
+ ),
1377
+ /* @__PURE__ */ I(
1378
+ "div",
1379
+ {
1380
+ className: l(
1381
+ d.multiTrigger,
1382
+ d[e],
1383
+ $ && d.triggerOpen,
1384
+ r && d.error,
1385
+ i && d.multiTriggerDisabled,
1386
+ o?.root
1387
+ ),
1388
+ onClick: () => {
1389
+ $ ? q.current?.focus() : x();
1390
+ },
1391
+ role: "combobox",
1392
+ "aria-expanded": $,
1393
+ "aria-haspopup": "listbox",
1394
+ "aria-controls": $ ? j : void 0,
1395
+ children: [
1396
+ re.map((f) => /* @__PURE__ */ I("span", { className: l(d.chip, o?.chip), children: [
1397
+ /* @__PURE__ */ c("span", { className: d.chipLabel, children: f.content ?? f.label }),
1398
+ /* @__PURE__ */ c(
1399
+ "button",
1400
+ {
1401
+ type: "button",
1402
+ className: l(d.chipRemove, o?.chipRemove),
1403
+ onClick: (s) => z(f.value, s),
1404
+ "aria-label": `Remove ${f.label}`,
1405
+ tabIndex: -1,
1406
+ children: "×"
1407
+ }
1408
+ )
1409
+ ] }, f.value)),
1410
+ /* @__PURE__ */ c(
1411
+ "input",
1412
+ {
1413
+ ref: q,
1414
+ id: y,
1415
+ type: "text",
1416
+ className: d.multiSearch,
1417
+ placeholder: p.length === 0 ? n : "",
1418
+ value: R,
1419
+ onChange: (f) => {
1420
+ D(f.target.value), $ || x();
1421
+ },
1422
+ onKeyDown: Z,
1423
+ disabled: i,
1424
+ "aria-label": "Search options"
1425
+ }
1426
+ ),
1427
+ /* @__PURE__ */ c("span", { className: l(d.arrow, d.arrowMulti, o?.arrow) })
1428
+ ]
1429
+ }
1430
+ ),
1431
+ $ && /* @__PURE__ */ c("div", { id: j, className: l(d.menu, o?.menu), role: "listbox", "aria-multiselectable": "true", children: /* @__PURE__ */ c("div", { className: d.menuItems, ref: V, children: A.length === 0 ? /* @__PURE__ */ c("div", { className: d.noResults, children: "No results" }) : A.map((f, s) => {
1432
+ const N = p.includes(f.value);
1433
+ return /* @__PURE__ */ I(
1434
+ "button",
1435
+ {
1436
+ id: `select-option-${f.value}`,
1437
+ type: "button",
1438
+ role: "option",
1439
+ "aria-selected": N,
1440
+ className: l(
1441
+ d.item,
1442
+ f.disabled && d.itemDisabled,
1443
+ N && d.itemSelected,
1444
+ s === S && d.itemHighlighted,
1445
+ o?.item
1446
+ ),
1447
+ disabled: f.disabled,
1448
+ onClick: () => B(f.value),
1449
+ onMouseEnter: () => E(s),
1450
+ children: [
1451
+ N && /* @__PURE__ */ c("span", { className: d.itemCheck, "aria-hidden": "true" }),
1452
+ f.content ?? f.label
1453
+ ]
1454
+ },
1455
+ f.value
1456
+ );
1457
+ }) }) })
1458
+ ]
1459
+ }
1460
+ );
1461
+ }
1462
+ );
1463
+ we.displayName = "MultiSelect";
1464
+ const Jn = W(
1465
+ (e, r) => e.multiple ? /* @__PURE__ */ c(we, { ref: r, ...e }) : e.searchable ? /* @__PURE__ */ c(Ne, { ref: r, ...e }) : /* @__PURE__ */ c(ye, { ref: r, ...e })
1466
+ );
1467
+ Jn.displayName = "Select";
1468
+ const Zn = "crk-root-61cKD", _n = "crk-input-bAjPU", eo = "crk-label-W9IeS", ro = "crk-indeterminate-mLarv", ce = {
1469
+ root: Zn,
1470
+ input: _n,
1471
+ label: eo,
1472
+ indeterminate: ro
1473
+ }, to = W(
983
1474
  ({
984
1475
  label: e,
985
1476
  indeterminate: r = !1,
986
1477
  classes: t,
987
- className: o,
988
- style: n,
989
- ...i
990
- }, l) => {
991
- const u = j(null);
992
- return O(() => {
993
- u.current && (u.current.indeterminate = r);
994
- }, [r]), /* @__PURE__ */ b(
1478
+ className: n,
1479
+ style: o,
1480
+ ...m
1481
+ }, a) => {
1482
+ const h = O(null);
1483
+ return F(() => {
1484
+ h.current && (h.current.indeterminate = r);
1485
+ }, [r]), /* @__PURE__ */ I(
995
1486
  "label",
996
1487
  {
997
- className: s(K.root, r && K.indeterminate, t?.root, o),
998
- style: n,
1488
+ className: l(ce.root, r && ce.indeterminate, t?.root, n),
1489
+ style: o,
999
1490
  children: [
1000
1491
  /* @__PURE__ */ c(
1001
1492
  "input",
1002
1493
  {
1003
- ref: (d) => {
1004
- u.current = d, typeof l == "function" ? l(d) : l && (l.current = d);
1494
+ ref: (i) => {
1495
+ h.current = i, typeof a == "function" ? a(i) : a && (a.current = i);
1005
1496
  },
1006
1497
  type: "checkbox",
1007
- className: s(K.input, t?.input),
1008
- ...i
1498
+ className: l(ce.input, t?.input),
1499
+ ...m
1009
1500
  }
1010
1501
  ),
1011
- e && /* @__PURE__ */ c("span", { className: s(K.label, t?.label), children: e })
1502
+ e && /* @__PURE__ */ c("span", { className: l(ce.label, t?.label), children: e })
1012
1503
  ]
1013
1504
  }
1014
1505
  );
1015
1506
  }
1016
1507
  );
1017
- ko.displayName = "Checkbox";
1018
- const fo = "crk-group-NNwCD", go = "crk-root-7fGik", bo = "crk-input-43PQW", yo = "crk-label-aW30x", Y = {
1019
- group: fo,
1020
- root: go,
1021
- input: bo,
1022
- label: yo
1023
- }, pe = ae(null), No = ({
1508
+ to.displayName = "Checkbox";
1509
+ const no = "crk-group-NNwCD", oo = "crk-root-7fGik", co = "crk-input-43PQW", lo = "crk-label-aW30x", se = {
1510
+ group: no,
1511
+ root: oo,
1512
+ input: co,
1513
+ label: lo
1514
+ }, xe = fe(null), so = ({
1024
1515
  name: e,
1025
1516
  value: r,
1026
1517
  onChange: t,
1027
- className: o,
1028
- style: n,
1029
- children: i
1030
- }) => /* @__PURE__ */ c(pe.Provider, { value: { name: e, value: r, onChange: t }, children: /* @__PURE__ */ c("div", { className: s(Y.group, o), style: n, role: "radiogroup", children: i }) });
1031
- No.displayName = "RadioGroup";
1032
- const vo = $(
1518
+ className: n,
1519
+ style: o,
1520
+ children: m,
1521
+ id: a,
1522
+ "aria-label": h,
1523
+ "aria-labelledby": i,
1524
+ required: y
1525
+ }) => /* @__PURE__ */ c(xe.Provider, { value: { name: e, value: r, onChange: t }, children: /* @__PURE__ */ c(
1526
+ "div",
1527
+ {
1528
+ id: a,
1529
+ className: l(se.group, n),
1530
+ style: o,
1531
+ role: "radiogroup",
1532
+ tabIndex: -1,
1533
+ "aria-label": h,
1534
+ "aria-labelledby": i,
1535
+ "aria-required": y || void 0,
1536
+ children: m
1537
+ }
1538
+ ) });
1539
+ so.displayName = "RadioGroup";
1540
+ const ao = W(
1033
1541
  ({
1034
1542
  label: e,
1035
1543
  value: r,
1036
1544
  classes: t,
1037
- className: o,
1038
- style: n,
1039
- onChange: i,
1040
- checked: l,
1041
- name: u,
1042
- ...d
1043
- }, m) => {
1044
- const a = Z(pe), p = a?.name ?? u, h = a ? a.value === r : l, f = (y) => {
1045
- a?.onChange?.(r), i?.(y);
1545
+ className: n,
1546
+ style: o,
1547
+ onChange: m,
1548
+ checked: a,
1549
+ name: h,
1550
+ ...i
1551
+ }, y) => {
1552
+ const u = ae(xe), g = u?.name ?? h, v = u ? u.value === r : a, b = (p) => {
1553
+ u?.onChange?.(r), m?.(p);
1046
1554
  };
1047
- return /* @__PURE__ */ b("label", { className: s(Y.root, t?.root, o), style: n, children: [
1555
+ return /* @__PURE__ */ I("label", { className: l(se.root, t?.root, n), style: o, children: [
1048
1556
  /* @__PURE__ */ c(
1049
1557
  "input",
1050
1558
  {
1051
- ref: m,
1559
+ ref: y,
1052
1560
  type: "radio",
1053
- className: s(Y.input, t?.input),
1054
- name: p,
1561
+ className: l(se.input, t?.input),
1562
+ name: g,
1055
1563
  value: r,
1056
- checked: h,
1057
- onChange: f,
1058
- ...d
1564
+ checked: v,
1565
+ onChange: b,
1566
+ ...i
1059
1567
  }
1060
1568
  ),
1061
- e && /* @__PURE__ */ c("span", { className: s(Y.label, t?.label), children: e })
1569
+ e && /* @__PURE__ */ c("span", { className: l(se.label, t?.label), children: e })
1062
1570
  ] });
1063
1571
  }
1064
1572
  );
1065
- vo.displayName = "Radio";
1066
- const wo = "crk-root-IGgdn", xo = "crk-sm-N-5I2", $o = "crk-md-bbyFl", So = "crk-lg-Pd-Iq", Co = "crk-error-fyu3i", Io = "crk-resizeNone-SmNT4", Bo = "crk-resizeVertical-oi8vP", Do = "crk-resizeHorizontal-riMLL", Ao = "crk-resizeBoth-NYSh4", Q = {
1067
- root: wo,
1068
- sm: xo,
1069
- md: $o,
1070
- lg: So,
1071
- error: Co,
1072
- resizeNone: Io,
1073
- resizeVertical: Bo,
1074
- resizeHorizontal: Do,
1075
- resizeBoth: Ao
1076
- }, Lo = {
1573
+ ao.displayName = "Radio";
1574
+ const io = "crk-root-IGgdn", uo = "crk-sm-N-5I2", mo = "crk-md-bbyFl", ho = "crk-lg-Pd-Iq", po = "crk-error-fyu3i", fo = "crk-resizeNone-SmNT4", go = "crk-resizeVertical-oi8vP", bo = "crk-resizeHorizontal-riMLL", ko = "crk-resizeBoth-NYSh4", vo = "crk-autoExpand-JWone", te = {
1575
+ root: io,
1576
+ sm: uo,
1577
+ md: mo,
1578
+ lg: ho,
1579
+ error: po,
1580
+ resizeNone: fo,
1581
+ resizeVertical: go,
1582
+ resizeHorizontal: bo,
1583
+ resizeBoth: ko,
1584
+ autoExpand: vo
1585
+ }, yo = {
1077
1586
  none: "resizeNone",
1078
1587
  vertical: "resizeVertical",
1079
1588
  horizontal: "resizeHorizontal",
1080
1589
  both: "resizeBoth"
1081
- }, Ro = $(
1590
+ }, No = W(
1082
1591
  ({
1083
1592
  inputSize: e = "md",
1084
1593
  error: r = !1,
1085
1594
  resize: t = "vertical",
1595
+ autoExpand: n = !0,
1086
1596
  className: o,
1087
- style: n,
1088
- ...i
1089
- }, l) => /* @__PURE__ */ c(
1090
- "textarea",
1091
- {
1092
- ref: l,
1093
- className: s(
1094
- Q.root,
1095
- Q[e],
1096
- r && Q.error,
1097
- Q[Lo[t]],
1098
- o
1099
- ),
1100
- style: n,
1101
- ...i
1102
- }
1103
- )
1597
+ style: m,
1598
+ onChange: a,
1599
+ ...h
1600
+ }, i) => {
1601
+ const y = O(null), u = L(() => {
1602
+ const b = y.current;
1603
+ b && (b.style.height = "auto", b.style.height = `${b.scrollHeight}px`);
1604
+ }, []), g = h.value ?? "";
1605
+ F(() => {
1606
+ n && u();
1607
+ }, [n, u, g]);
1608
+ const v = L(
1609
+ (b) => {
1610
+ n && u(), a?.(b);
1611
+ },
1612
+ [n, u, a]
1613
+ );
1614
+ return /* @__PURE__ */ c(
1615
+ "textarea",
1616
+ {
1617
+ ref: (b) => {
1618
+ y.current = b, typeof i == "function" ? i(b) : i && (i.current = b);
1619
+ },
1620
+ className: l(
1621
+ te.root,
1622
+ te[e],
1623
+ r && te.error,
1624
+ n ? te.autoExpand : te[yo[t]],
1625
+ o
1626
+ ),
1627
+ style: m,
1628
+ onChange: v,
1629
+ rows: h.rows ?? 1,
1630
+ ...h
1631
+ }
1632
+ );
1633
+ }
1104
1634
  );
1105
- Ro.displayName = "Textarea";
1635
+ No.displayName = "Textarea";
1106
1636
  export {
1107
- Oe as Button,
1108
- ko as Checkbox,
1109
- ht as Dropdown,
1110
- kt as DropdownItem,
1111
- Wo as Form,
1112
- zo as FormField,
1113
- ro as Input,
1114
- Ge as Link,
1115
- xr as List,
1116
- $r as ListItem,
1117
- _ as Modal,
1118
- $t as Popover,
1119
- vo as Radio,
1120
- No as RadioGroup,
1121
- io as Select,
1122
- Mo as Table,
1123
- Ro as Textarea,
1124
- hr as Typography,
1637
+ Ze as Button,
1638
+ to as Checkbox,
1639
+ $t as Dropdown,
1640
+ Ct as DropdownItem,
1641
+ Co as Form,
1642
+ Ro as FormField,
1643
+ Do as FormRow,
1644
+ kn as Input,
1645
+ nr as Link,
1646
+ Or as List,
1647
+ Pr as ListItem,
1648
+ ue as Modal,
1649
+ Pt as Popover,
1650
+ ao as Radio,
1651
+ so as RadioGroup,
1652
+ Jn as Select,
1653
+ $o as Table,
1654
+ No as Textarea,
1655
+ $r as Typography,
1125
1656
  ie as useClickOutside,
1126
- St as useFocusTrap,
1127
- ne as useKeyboard,
1128
- Yr as useTableSort
1657
+ Mt as useFocusTrap,
1658
+ he as useKeyboard,
1659
+ st as useTableSort
1129
1660
  };