@chloe0592/pebble 0.1.0

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.
@@ -0,0 +1,838 @@
1
+ import { jsxs as _, jsx as t } from "react/jsx-runtime";
2
+ import b, { useId as L, useRef as O, useEffect as z, useState as H, useCallback as ae } from "react";
3
+ import { createPortal as le } from "react-dom";
4
+ const ie = "_spinner_10ctt_1", ce = "_track_10ctt_10", de = "_arc_10ctt_18", _e = "_xs_10ctt_24", pe = "_sm_10ctt_25", ue = "_md_10ctt_26", fe = "_lg_10ctt_27", he = "_xl_10ctt_28", M = {
5
+ spinner: ie,
6
+ "pb-spin": "_pb-spin_10ctt_1",
7
+ track: ce,
8
+ "pb-pulse": "_pb-pulse_10ctt_1",
9
+ arc: de,
10
+ xs: _e,
11
+ sm: pe,
12
+ md: ue,
13
+ lg: fe,
14
+ xl: he
15
+ }, me = {
16
+ xs: 12,
17
+ sm: 16,
18
+ md: 24,
19
+ lg: 32,
20
+ xl: 48
21
+ }, Q = b.forwardRef(
22
+ ({ size: r = "md", label: e = "Loading…", className: o = "" }, n) => {
23
+ const s = me[r], i = L().replace(/:/g, "");
24
+ return /* @__PURE__ */ _(
25
+ "svg",
26
+ {
27
+ ref: n,
28
+ className: [M.spinner, M[r], o].filter(Boolean).join(" "),
29
+ width: s,
30
+ height: s,
31
+ viewBox: "0 0 24 24",
32
+ fill: "none",
33
+ "aria-label": e,
34
+ role: "status",
35
+ children: [
36
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ _("linearGradient", { id: i, x1: "12", y1: "3", x2: "21", y2: "12", gradientUnits: "userSpaceOnUse", children: [
37
+ /* @__PURE__ */ t("stop", { offset: "0%", stopColor: "#6366f1", stopOpacity: "0" }),
38
+ /* @__PURE__ */ t("stop", { offset: "40%", stopColor: "#6366f1", stopOpacity: "1" }),
39
+ /* @__PURE__ */ t("stop", { offset: "100%", stopColor: "#a855f7", stopOpacity: "1" })
40
+ ] }) }),
41
+ /* @__PURE__ */ t(
42
+ "circle",
43
+ {
44
+ className: M.track,
45
+ cx: "12",
46
+ cy: "12",
47
+ r: "9",
48
+ strokeWidth: "2.5"
49
+ }
50
+ ),
51
+ /* @__PURE__ */ t(
52
+ "path",
53
+ {
54
+ className: M.arc,
55
+ d: "M12 3a9 9 0 0 1 9 9",
56
+ strokeWidth: "2.5",
57
+ strokeLinecap: "round",
58
+ stroke: `url(#${i})`
59
+ }
60
+ )
61
+ ]
62
+ }
63
+ );
64
+ }
65
+ );
66
+ Q.displayName = "Spinner";
67
+ const be = "_button_s5t2n_1", ge = "_sm_s5t2n_47", ve = "_md_s5t2n_55", ke = "_lg_s5t2n_62", we = "_primary_s5t2n_73", ye = "_secondary_s5t2n_108", xe = "_ghost_s5t2n_148", Ne = "_outline_s5t2n_166", $e = "_danger_s5t2n_187", Be = "_fullWidth_s5t2n_234", je = "_loading_s5t2n_238", Re = "_iconLeft_s5t2n_244", Le = "_iconRight_s5t2n_245", Ie = "_label_s5t2n_258", R = {
68
+ button: be,
69
+ sm: ge,
70
+ md: ve,
71
+ lg: ke,
72
+ primary: we,
73
+ secondary: ye,
74
+ ghost: xe,
75
+ outline: Ne,
76
+ danger: $e,
77
+ fullWidth: Be,
78
+ loading: je,
79
+ iconLeft: Re,
80
+ iconRight: Le,
81
+ label: Ie
82
+ }, Ce = b.forwardRef(
83
+ ({
84
+ variant: r = "primary",
85
+ size: e = "md",
86
+ isLoading: o = !1,
87
+ leftIcon: n,
88
+ rightIcon: s,
89
+ fullWidth: i = !1,
90
+ children: c,
91
+ disabled: d,
92
+ className: f = "",
93
+ ...g
94
+ }, u) => {
95
+ const h = [
96
+ R.button,
97
+ R[r],
98
+ R[e],
99
+ i ? R.fullWidth : "",
100
+ o ? R.loading : "",
101
+ f
102
+ ].filter(Boolean).join(" ");
103
+ return /* @__PURE__ */ _(
104
+ "button",
105
+ {
106
+ ref: u,
107
+ className: h,
108
+ disabled: d || o,
109
+ "aria-busy": o || void 0,
110
+ ...g,
111
+ children: [
112
+ o ? /* @__PURE__ */ t(Q, { size: "sm", label: "Loading" }) : n && /* @__PURE__ */ t("span", { className: R.iconLeft, "aria-hidden": "true", children: n }),
113
+ c && /* @__PURE__ */ t("span", { className: R.label, children: c }),
114
+ !o && s && /* @__PURE__ */ t("span", { className: R.iconRight, "aria-hidden": "true", children: s })
115
+ ]
116
+ }
117
+ );
118
+ }
119
+ );
120
+ Ce.displayName = "Button";
121
+ const Te = "_wrapper_5z8qu_3", Se = "_label_5z8qu_10", We = "_inputWrapper_5z8qu_21", ze = "_error_5z8qu_39", Ee = "_disabled_5z8qu_39", qe = "_sm_5z8qu_70", Ae = "_md_5z8qu_71", De = "_lg_5z8qu_72", Me = "_input_5z8qu_21", Pe = "_hasLeft_5z8qu_109", Fe = "_hasRight_5z8qu_110", Oe = "_iconLeft_5z8qu_114", Ue = "_iconRight_5z8qu_115", Ve = "_helperText_5z8qu_134", Ge = "_errorText_5z8qu_142", k = {
122
+ wrapper: Te,
123
+ label: Se,
124
+ inputWrapper: We,
125
+ error: ze,
126
+ disabled: Ee,
127
+ sm: qe,
128
+ md: Ae,
129
+ lg: De,
130
+ input: Me,
131
+ hasLeft: Pe,
132
+ hasRight: Fe,
133
+ iconLeft: Oe,
134
+ iconRight: Ue,
135
+ helperText: Ve,
136
+ errorText: Ge
137
+ }, He = b.forwardRef(
138
+ ({
139
+ label: r,
140
+ helperText: e,
141
+ errorText: o,
142
+ leftIcon: n,
143
+ rightIcon: s,
144
+ size: i = "md",
145
+ className: c = "",
146
+ id: d,
147
+ disabled: f,
148
+ ...g
149
+ }, u) => {
150
+ const h = L(), a = d ?? h, w = `${a}-helper`, m = `${a}-error`, N = !!o, E = [N ? m : "", e ? w : ""].filter(Boolean).join(" ") || void 0;
151
+ return /* @__PURE__ */ _("div", { className: [k.wrapper, c].filter(Boolean).join(" "), children: [
152
+ r && /* @__PURE__ */ t("label", { htmlFor: a, className: k.label, children: r }),
153
+ /* @__PURE__ */ _(
154
+ "div",
155
+ {
156
+ className: [
157
+ k.inputWrapper,
158
+ k[i],
159
+ N ? k.error : "",
160
+ f ? k.disabled : ""
161
+ ].filter(Boolean).join(" "),
162
+ children: [
163
+ n && /* @__PURE__ */ t("span", { className: k.iconLeft, "aria-hidden": "true", children: n }),
164
+ /* @__PURE__ */ t(
165
+ "input",
166
+ {
167
+ ref: u,
168
+ id: a,
169
+ className: [k.input, n ? k.hasLeft : "", s ? k.hasRight : ""].filter(Boolean).join(" "),
170
+ disabled: f,
171
+ "aria-invalid": N || void 0,
172
+ "aria-describedby": E,
173
+ ...g
174
+ }
175
+ ),
176
+ s && /* @__PURE__ */ t("span", { className: k.iconRight, "aria-hidden": "true", children: s })
177
+ ]
178
+ }
179
+ ),
180
+ N ? /* @__PURE__ */ t("p", { id: m, className: k.errorText, role: "alert", children: o }) : e ? /* @__PURE__ */ t("p", { id: w, className: k.helperText, children: e }) : null
181
+ ] });
182
+ }
183
+ );
184
+ He.displayName = "Input";
185
+ const Ke = "_wrapper_1566g_3", Je = "_label_1566g_10", Qe = "_textarea_1566g_19", Xe = "_error_1566g_47", Ye = "_disabled_1566g_47", Ze = "_helperText_1566g_82", et = "_errorText_1566g_90", T = {
186
+ wrapper: Ke,
187
+ label: Je,
188
+ textarea: Qe,
189
+ error: Xe,
190
+ disabled: Ye,
191
+ helperText: Ze,
192
+ errorText: et
193
+ }, tt = b.forwardRef(
194
+ ({
195
+ label: r,
196
+ helperText: e,
197
+ errorText: o,
198
+ resize: n = "vertical",
199
+ className: s = "",
200
+ id: i,
201
+ disabled: c,
202
+ rows: d = 4,
203
+ ...f
204
+ }, g) => {
205
+ const u = L(), h = i ?? u, a = `${h}-helper`, w = `${h}-error`, m = !!o, N = [m ? w : "", e ? a : ""].filter(Boolean).join(" ") || void 0;
206
+ return /* @__PURE__ */ _("div", { className: [T.wrapper, s].filter(Boolean).join(" "), children: [
207
+ r && /* @__PURE__ */ t("label", { htmlFor: h, className: T.label, children: r }),
208
+ /* @__PURE__ */ t(
209
+ "textarea",
210
+ {
211
+ ref: g,
212
+ id: h,
213
+ rows: d,
214
+ className: [
215
+ T.textarea,
216
+ m ? T.error : "",
217
+ c ? T.disabled : ""
218
+ ].filter(Boolean).join(" "),
219
+ style: { resize: n },
220
+ disabled: c,
221
+ "aria-invalid": m || void 0,
222
+ "aria-describedby": N,
223
+ ...f
224
+ }
225
+ ),
226
+ m ? /* @__PURE__ */ t("p", { id: w, className: T.errorText, role: "alert", children: o }) : e ? /* @__PURE__ */ t("p", { id: a, className: T.helperText, children: e }) : null
227
+ ] });
228
+ }
229
+ );
230
+ tt.displayName = "Textarea";
231
+ const ot = "_backdrop_1v4s9_3", rt = "_dialog_1v4s9_17", st = "_sm_1v4s9_37", nt = "_md_1v4s9_38", at = "_lg_1v4s9_39", lt = "_full_1v4s9_40", it = "_closeBtn_1v4s9_50", ct = "_header_1v4s9_92", dt = "_title_1v4s9_97", _t = "_description_1v4s9_107", pt = "_body_1v4s9_117", ut = "_footer_1v4s9_133", $ = {
232
+ backdrop: ot,
233
+ "pb-backdrop-in": "_pb-backdrop-in_1v4s9_1",
234
+ dialog: rt,
235
+ "pb-dialog-in": "_pb-dialog-in_1v4s9_1",
236
+ sm: st,
237
+ md: nt,
238
+ lg: at,
239
+ full: lt,
240
+ closeBtn: it,
241
+ header: ct,
242
+ title: dt,
243
+ description: _t,
244
+ body: pt,
245
+ footer: ut
246
+ }, ft = ({
247
+ isOpen: r,
248
+ onClose: e,
249
+ title: o,
250
+ description: n,
251
+ size: s = "md",
252
+ closeOnBackdrop: i = !0,
253
+ children: c,
254
+ footer: d,
255
+ className: f = ""
256
+ }) => {
257
+ const g = L(), u = L(), h = O(null);
258
+ return z(() => {
259
+ if (!r) return;
260
+ const a = h.current;
261
+ if (!a) return;
262
+ const w = a.querySelector(
263
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
264
+ );
265
+ w ? w.focus() : a.focus();
266
+ }, [r]), z(() => {
267
+ if (!r) return;
268
+ const a = (w) => {
269
+ w.key === "Escape" && e();
270
+ };
271
+ return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
272
+ }, [r, e]), z(() => (r ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
273
+ document.body.style.overflow = "";
274
+ }), [r]), r ? le(
275
+ /* @__PURE__ */ t(
276
+ "div",
277
+ {
278
+ className: $.backdrop,
279
+ onClick: i ? e : void 0,
280
+ "aria-hidden": "true",
281
+ children: /* @__PURE__ */ _(
282
+ "div",
283
+ {
284
+ ref: h,
285
+ role: "dialog",
286
+ "aria-modal": "true",
287
+ "aria-labelledby": o ? g : void 0,
288
+ "aria-describedby": n ? u : void 0,
289
+ className: [$.dialog, $[s], f].filter(Boolean).join(" "),
290
+ tabIndex: -1,
291
+ onClick: (a) => a.stopPropagation(),
292
+ children: [
293
+ /* @__PURE__ */ t(
294
+ "button",
295
+ {
296
+ className: $.closeBtn,
297
+ onClick: e,
298
+ "aria-label": "Close modal",
299
+ children: /* @__PURE__ */ t(
300
+ "svg",
301
+ {
302
+ width: "18",
303
+ height: "18",
304
+ viewBox: "0 0 24 24",
305
+ fill: "none",
306
+ stroke: "currentColor",
307
+ strokeWidth: "2",
308
+ strokeLinecap: "round",
309
+ children: /* @__PURE__ */ t("path", { d: "M18 6 6 18M6 6l12 12" })
310
+ }
311
+ )
312
+ }
313
+ ),
314
+ (o || n) && /* @__PURE__ */ _("div", { className: $.header, children: [
315
+ o && /* @__PURE__ */ t("h2", { id: g, className: $.title, children: o }),
316
+ n && /* @__PURE__ */ t("p", { id: u, className: $.description, children: n })
317
+ ] }),
318
+ /* @__PURE__ */ t("div", { className: $.body, children: c }),
319
+ d && /* @__PURE__ */ t("div", { className: $.footer, children: d })
320
+ ]
321
+ }
322
+ )
323
+ }
324
+ ),
325
+ document.body
326
+ ) : null;
327
+ };
328
+ ft.displayName = "Modal";
329
+ const ht = "_card_i6i72_3", mt = "_elevated_i6i72_25", bt = "_bordered_i6i72_36", gt = "_flat_i6i72_48", vt = "_hoverable_i6i72_60", kt = "_clickable_i6i72_68", wt = "_header_i6i72_96", yt = "_body_i6i72_105", xt = "_footer_i6i72_112", S = {
330
+ card: ht,
331
+ default: "_default_i6i72_15",
332
+ elevated: mt,
333
+ bordered: bt,
334
+ flat: gt,
335
+ hoverable: vt,
336
+ clickable: kt,
337
+ header: wt,
338
+ body: yt,
339
+ footer: xt
340
+ }, X = ({ children: r, className: e = "", ...o }) => /* @__PURE__ */ t("div", { className: [S.header, e].filter(Boolean).join(" "), ...o, children: r });
341
+ X.displayName = "Card.Header";
342
+ const Y = ({ children: r, className: e = "", ...o }) => /* @__PURE__ */ t("div", { className: [S.body, e].filter(Boolean).join(" "), ...o, children: r });
343
+ Y.displayName = "Card.Body";
344
+ const Z = ({ children: r, className: e = "", ...o }) => /* @__PURE__ */ t("div", { className: [S.footer, e].filter(Boolean).join(" "), ...o, children: r });
345
+ Z.displayName = "Card.Footer";
346
+ const U = b.forwardRef(
347
+ ({
348
+ variant: r = "default",
349
+ hoverable: e = !1,
350
+ clickable: o = !1,
351
+ children: n,
352
+ className: s = "",
353
+ ...i
354
+ }, c) => {
355
+ const d = [
356
+ S.card,
357
+ S[r],
358
+ e ? S.hoverable : "",
359
+ o ? S.clickable : "",
360
+ s
361
+ ].filter(Boolean).join(" ");
362
+ return /* @__PURE__ */ t(
363
+ "div",
364
+ {
365
+ ref: c,
366
+ className: d,
367
+ role: o ? "button" : void 0,
368
+ tabIndex: o ? 0 : void 0,
369
+ ...i,
370
+ children: n
371
+ }
372
+ );
373
+ }
374
+ );
375
+ U.displayName = "Card";
376
+ U.Header = X;
377
+ U.Body = Y;
378
+ U.Footer = Z;
379
+ const Nt = "_badge_1uusg_3", $t = "_sm_1uusg_20", Bt = "_md_1uusg_25", jt = "_dot_1uusg_32", Rt = "_primary_1uusg_56", Lt = "_success_1uusg_63", It = "_warning_1uusg_70", Ct = "_danger_1uusg_77", Tt = "_info_1uusg_84", P = {
380
+ badge: Nt,
381
+ sm: $t,
382
+ md: Bt,
383
+ dot: jt,
384
+ default: "_default_1uusg_49",
385
+ primary: Rt,
386
+ success: Lt,
387
+ warning: It,
388
+ danger: Ct,
389
+ info: Tt
390
+ }, St = b.forwardRef(
391
+ ({
392
+ variant: r = "default",
393
+ size: e = "md",
394
+ dot: o = !1,
395
+ children: n,
396
+ className: s = "",
397
+ ...i
398
+ }, c) => {
399
+ const d = [
400
+ P.badge,
401
+ P[r],
402
+ P[e],
403
+ o ? P.dot : "",
404
+ s
405
+ ].filter(Boolean).join(" ");
406
+ return /* @__PURE__ */ t("span", { ref: c, className: d, ...i, children: o ? null : n });
407
+ }
408
+ );
409
+ St.displayName = "Badge";
410
+ const Wt = "_avatar_n1f99_3", zt = "_xs_n1f99_25", Et = "_sm_n1f99_26", qt = "_md_n1f99_27", At = "_lg_n1f99_28", Dt = "_xl_n1f99_29", Mt = "_image_n1f99_33", Pt = "_initials_n1f99_42", Ft = "_fallbackIcon_n1f99_57", Ot = "_status_n1f99_65", Ut = "_overflow_n1f99_95", Vt = "_group_n1f99_107", y = {
411
+ avatar: Wt,
412
+ xs: zt,
413
+ sm: Et,
414
+ md: qt,
415
+ lg: At,
416
+ xl: Dt,
417
+ image: Mt,
418
+ initials: Pt,
419
+ fallbackIcon: Ft,
420
+ status: Ot,
421
+ "status-online": "_status-online_n1f99_79",
422
+ "status-offline": "_status-offline_n1f99_83",
423
+ "status-busy": "_status-busy_n1f99_84",
424
+ "status-away": "_status-away_n1f99_88",
425
+ overflow: Ut,
426
+ group: Vt
427
+ };
428
+ function Gt(r) {
429
+ const e = r.trim().split(/\s+/);
430
+ return e.length === 1 ? e[0].charAt(0).toUpperCase() : (e[0].charAt(0) + e[e.length - 1].charAt(0)).toUpperCase();
431
+ }
432
+ const Ht = b.forwardRef(
433
+ ({ src: r, alt: e = "", name: o, size: n = "md", status: s, className: i = "" }, c) => {
434
+ const [d, f] = H(!1), g = r && !d, u = o ? Gt(o) : null;
435
+ return /* @__PURE__ */ _(
436
+ "div",
437
+ {
438
+ ref: c,
439
+ className: [y.avatar, y[n], i].filter(Boolean).join(" "),
440
+ "aria-label": o ?? e,
441
+ title: o ?? e,
442
+ children: [
443
+ g ? /* @__PURE__ */ t(
444
+ "img",
445
+ {
446
+ src: r,
447
+ alt: e || o || "",
448
+ className: y.image,
449
+ onError: () => f(!0)
450
+ }
451
+ ) : u ? /* @__PURE__ */ t("span", { className: y.initials, "aria-hidden": "true", children: u }) : /* @__PURE__ */ t(
452
+ "svg",
453
+ {
454
+ className: y.fallbackIcon,
455
+ viewBox: "0 0 24 24",
456
+ fill: "currentColor",
457
+ "aria-hidden": "true",
458
+ children: /* @__PURE__ */ t("path", { d: "M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-5.33 0-8 2.67-8 4v1h16v-1c0-1.33-2.67-4-8-4z" })
459
+ }
460
+ ),
461
+ s && /* @__PURE__ */ t(
462
+ "span",
463
+ {
464
+ className: [y.status, y[`status-${s}`]].join(" "),
465
+ "aria-label": s
466
+ }
467
+ )
468
+ ]
469
+ }
470
+ );
471
+ }
472
+ );
473
+ Ht.displayName = "Avatar";
474
+ const Kt = ({
475
+ children: r,
476
+ max: e,
477
+ size: o = "md",
478
+ className: n = ""
479
+ }) => {
480
+ const s = b.Children.toArray(r), i = e ? s.slice(0, e) : s, c = e && s.length > e ? s.length - e : 0;
481
+ return /* @__PURE__ */ _("div", { className: [y.group, n].filter(Boolean).join(" "), children: [
482
+ i,
483
+ c > 0 && /* @__PURE__ */ t("div", { className: [y.avatar, y[o], y.overflow].join(" "), children: /* @__PURE__ */ _("span", { className: y.initials, children: [
484
+ "+",
485
+ c
486
+ ] }) })
487
+ ] });
488
+ };
489
+ Kt.displayName = "AvatarGroup";
490
+ const Jt = "_wrapper_4w97v_8", Qt = "_tooltip_4w97v_17", Xt = "_arrow_4w97v_49", Yt = "_top_4w97v_58", Zt = "_bottom_4w97v_77", eo = "_left_4w97v_96", to = "_right_4w97v_115", F = {
491
+ wrapper: Jt,
492
+ tooltip: Qt,
493
+ arrow: Xt,
494
+ top: Yt,
495
+ bottom: Zt,
496
+ left: eo,
497
+ right: to
498
+ }, oo = ({
499
+ content: r,
500
+ placement: e = "top",
501
+ children: o,
502
+ className: n = ""
503
+ }) => {
504
+ const s = L(), i = b.cloneElement(o, {
505
+ "aria-describedby": s
506
+ });
507
+ return /* @__PURE__ */ _("div", { className: [F.wrapper, n].filter(Boolean).join(" "), children: [
508
+ i,
509
+ /* @__PURE__ */ _(
510
+ "div",
511
+ {
512
+ id: s,
513
+ role: "tooltip",
514
+ className: [F.tooltip, F[e]].join(" "),
515
+ children: [
516
+ r,
517
+ /* @__PURE__ */ t("span", { className: F.arrow, "aria-hidden": "true" })
518
+ ]
519
+ }
520
+ )
521
+ ] });
522
+ };
523
+ oo.displayName = "Tooltip";
524
+ const ro = "_wrapper_kn5iw_3", so = "_label_kn5iw_12", no = "_triggerWrapper_kn5iw_23", ao = "_trigger_kn5iw_23", lo = "_open_kn5iw_64", io = "_error_kn5iw_71", co = "_disabled_kn5iw_78", _o = "_sm_kn5iw_90", po = "_md_kn5iw_91", uo = "_lg_kn5iw_92", fo = "_triggerValue_kn5iw_96", ho = "_triggerPlaceholder_kn5iw_103", mo = "_chevron_kn5iw_113", bo = "_chevronOpen_kn5iw_124", go = "_dropdown_kn5iw_135", vo = "_option_kn5iw_159", ko = "_optionDisabled_kn5iw_173", wo = "_optionSelected_kn5iw_177", yo = "_optionLabel_kn5iw_192", xo = "_checkmark_kn5iw_196", No = "_helperText_kn5iw_206", $o = "_errorText_kn5iw_214", p = {
525
+ wrapper: ro,
526
+ label: so,
527
+ triggerWrapper: no,
528
+ trigger: ao,
529
+ open: lo,
530
+ error: io,
531
+ disabled: co,
532
+ sm: _o,
533
+ md: po,
534
+ lg: uo,
535
+ triggerValue: fo,
536
+ triggerPlaceholder: ho,
537
+ chevron: mo,
538
+ chevronOpen: bo,
539
+ dropdown: go,
540
+ option: vo,
541
+ optionDisabled: ko,
542
+ optionSelected: wo,
543
+ optionLabel: yo,
544
+ checkmark: xo,
545
+ helperText: No,
546
+ errorText: $o
547
+ };
548
+ function Bo(r) {
549
+ return b.Children.toArray(r).filter(
550
+ (e) => b.isValidElement(e) && e.type === "option" && !e.props.disabled
551
+ ).map((e) => ({
552
+ value: String(e.props.value ?? ""),
553
+ label: String(e.props.children ?? ""),
554
+ disabled: !!e.props.disabled
555
+ })).filter((e) => e.value !== "");
556
+ }
557
+ function jo(r) {
558
+ const e = b.Children.toArray(r).find(
559
+ (o) => b.isValidElement(o) && o.type === "option" && (o.props.value === "" || o.props.value == null) && o.props.disabled
560
+ );
561
+ return e ? String(e.props.children) : void 0;
562
+ }
563
+ const Ro = b.forwardRef(
564
+ ({
565
+ label: r,
566
+ helperText: e,
567
+ errorText: o,
568
+ placeholder: n,
569
+ size: s = "md",
570
+ className: i = "",
571
+ id: c,
572
+ disabled: d,
573
+ value: f,
574
+ defaultValue: g,
575
+ onChange: u,
576
+ children: h
577
+ }, a) => {
578
+ const w = L(), m = c ?? w, N = `${m}-listbox`, E = `${m}-helper`, K = `${m}-error`, q = !!o, W = Bo(h), ee = n ?? jo(h) ?? "Select…", [B, j] = H(!1), [te, oe] = H(
579
+ String(g ?? f ?? "")
580
+ ), A = f !== void 0 ? String(f) : te, D = W.find((l) => l.value === A), V = O(null), J = O(null), re = (l) => {
581
+ J.current = l, typeof a == "function" ? a(l) : a && (a.current = l);
582
+ };
583
+ z(() => {
584
+ if (!B) return;
585
+ const l = (v) => {
586
+ V.current && !V.current.contains(v.target) && j(!1);
587
+ };
588
+ return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
589
+ }, [B]);
590
+ const G = ae(
591
+ (l) => {
592
+ var v;
593
+ f === void 0 && oe(l), j(!1), (v = J.current) == null || v.focus(), u == null || u({ target: { value: l } });
594
+ },
595
+ [f, u]
596
+ ), se = (l) => {
597
+ if (!d)
598
+ switch (l.key) {
599
+ case "Enter":
600
+ case " ":
601
+ l.preventDefault(), j((v) => !v);
602
+ break;
603
+ case "Escape":
604
+ j(!1);
605
+ break;
606
+ case "ArrowDown": {
607
+ if (l.preventDefault(), !B) {
608
+ j(!0);
609
+ break;
610
+ }
611
+ const v = W.findIndex((C) => C.value === A), I = W.slice(v + 1).find((C) => !C.disabled);
612
+ I && G(I.value);
613
+ break;
614
+ }
615
+ case "ArrowUp": {
616
+ if (l.preventDefault(), !B) {
617
+ j(!0);
618
+ break;
619
+ }
620
+ const v = W.findIndex((C) => C.value === A), I = W.slice(0, v).reverse().find((C) => !C.disabled);
621
+ I && G(I.value);
622
+ break;
623
+ }
624
+ case "Tab":
625
+ j(!1);
626
+ break;
627
+ }
628
+ }, ne = [q ? K : "", e ? E : ""].filter(Boolean).join(" ") || void 0;
629
+ return /* @__PURE__ */ _("div", { ref: V, className: [p.wrapper, i].filter(Boolean).join(" "), children: [
630
+ r && /* @__PURE__ */ t("label", { id: `${m}-label`, htmlFor: m, className: p.label, children: r }),
631
+ /* @__PURE__ */ _("div", { className: p.triggerWrapper, children: [
632
+ /* @__PURE__ */ _(
633
+ "button",
634
+ {
635
+ ref: re,
636
+ type: "button",
637
+ id: m,
638
+ role: "combobox",
639
+ "aria-haspopup": "listbox",
640
+ "aria-expanded": B,
641
+ "aria-controls": N,
642
+ "aria-labelledby": r ? `${m}-label` : void 0,
643
+ "aria-describedby": ne,
644
+ "aria-invalid": q || void 0,
645
+ disabled: d,
646
+ className: [
647
+ p.trigger,
648
+ p[s],
649
+ q ? p.error : "",
650
+ d ? p.disabled : "",
651
+ B ? p.open : ""
652
+ ].filter(Boolean).join(" "),
653
+ onClick: () => !d && j((l) => !l),
654
+ onKeyDown: se,
655
+ children: [
656
+ /* @__PURE__ */ t("span", { className: D ? p.triggerValue : p.triggerPlaceholder, children: (D == null ? void 0 : D.label) ?? ee }),
657
+ /* @__PURE__ */ t(
658
+ "span",
659
+ {
660
+ className: [p.chevron, B ? p.chevronOpen : ""].filter(Boolean).join(" "),
661
+ "aria-hidden": "true",
662
+ children: /* @__PURE__ */ t(
663
+ "svg",
664
+ {
665
+ width: "16",
666
+ height: "16",
667
+ viewBox: "0 0 24 24",
668
+ fill: "none",
669
+ stroke: "currentColor",
670
+ strokeWidth: "2",
671
+ strokeLinecap: "round",
672
+ strokeLinejoin: "round",
673
+ children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6" })
674
+ }
675
+ )
676
+ }
677
+ )
678
+ ]
679
+ }
680
+ ),
681
+ B && /* @__PURE__ */ t(
682
+ "ul",
683
+ {
684
+ id: N,
685
+ role: "listbox",
686
+ "aria-labelledby": r ? `${m}-label` : void 0,
687
+ className: p.dropdown,
688
+ children: W.map((l) => {
689
+ const v = l.value === A;
690
+ return /* @__PURE__ */ _(
691
+ "li",
692
+ {
693
+ role: "option",
694
+ "aria-selected": v,
695
+ "aria-disabled": l.disabled,
696
+ className: [
697
+ p.option,
698
+ v ? p.optionSelected : "",
699
+ l.disabled ? p.optionDisabled : ""
700
+ ].filter(Boolean).join(" "),
701
+ onPointerDown: (I) => {
702
+ I.preventDefault(), l.disabled || G(l.value);
703
+ },
704
+ children: [
705
+ /* @__PURE__ */ t("span", { className: p.optionLabel, children: l.label }),
706
+ v && /* @__PURE__ */ t("span", { className: p.checkmark, "aria-hidden": "true", children: /* @__PURE__ */ t(
707
+ "svg",
708
+ {
709
+ width: "14",
710
+ height: "14",
711
+ viewBox: "0 0 24 24",
712
+ fill: "none",
713
+ stroke: "currentColor",
714
+ strokeWidth: "2.5",
715
+ strokeLinecap: "round",
716
+ strokeLinejoin: "round",
717
+ children: /* @__PURE__ */ t("path", { d: "M20 6 9 17l-5-5" })
718
+ }
719
+ ) })
720
+ ]
721
+ },
722
+ l.value
723
+ );
724
+ })
725
+ }
726
+ )
727
+ ] }),
728
+ q ? /* @__PURE__ */ t("p", { id: K, className: p.errorText, role: "alert", children: o }) : e ? /* @__PURE__ */ t("p", { id: E, className: p.helperText, children: e }) : null
729
+ ] });
730
+ }
731
+ );
732
+ Ro.displayName = "Select";
733
+ const Lo = "_wrapper_cefjy_3", Io = "_checkboxRow_cefjy_10", Co = "_sm_cefjy_18", To = "_checkboxBox_cefjy_18", So = "_label_cefjy_22", Wo = "_md_cefjy_26", zo = "_checkboxOuter_cefjy_36", Eo = "_input_cefjy_46", qo = "_checkmark_cefjy_142", Ao = "_dash_cefjy_143", Do = "_disabled_cefjy_174", Mo = "_helperText_cefjy_181", x = {
734
+ wrapper: Lo,
735
+ checkboxRow: Io,
736
+ sm: Co,
737
+ checkboxBox: To,
738
+ label: So,
739
+ md: Wo,
740
+ checkboxOuter: zo,
741
+ input: Eo,
742
+ checkmark: qo,
743
+ dash: Ao,
744
+ disabled: Do,
745
+ helperText: Mo
746
+ }, Po = b.forwardRef(
747
+ ({
748
+ label: r,
749
+ indeterminate: e = !1,
750
+ size: o = "md",
751
+ helperText: n,
752
+ className: s = "",
753
+ id: i,
754
+ disabled: c,
755
+ ...d
756
+ }, f) => {
757
+ const g = L(), u = i ?? g, h = O(null), a = f ?? h;
758
+ return z(() => {
759
+ a && "current" in a && a.current && (a.current.indeterminate = e);
760
+ }, [e, a]), /* @__PURE__ */ _(
761
+ "div",
762
+ {
763
+ className: [x.wrapper, x[o], c ? x.disabled : "", s].filter(Boolean).join(" "),
764
+ children: [
765
+ /* @__PURE__ */ _("div", { className: x.checkboxRow, children: [
766
+ /* @__PURE__ */ _("div", { className: x.checkboxOuter, children: [
767
+ /* @__PURE__ */ t(
768
+ "input",
769
+ {
770
+ ref: a,
771
+ id: u,
772
+ type: "checkbox",
773
+ className: x.input,
774
+ disabled: c,
775
+ ...d
776
+ }
777
+ ),
778
+ /* @__PURE__ */ _("div", { className: x.checkboxBox, "aria-hidden": "true", children: [
779
+ /* @__PURE__ */ t(
780
+ "svg",
781
+ {
782
+ className: x.checkmark,
783
+ viewBox: "0 0 12 12",
784
+ fill: "none",
785
+ children: /* @__PURE__ */ t(
786
+ "path",
787
+ {
788
+ d: "M2 6l3 3 5-5",
789
+ stroke: "currentColor",
790
+ strokeWidth: "1.8",
791
+ strokeLinecap: "round",
792
+ strokeLinejoin: "round"
793
+ }
794
+ )
795
+ }
796
+ ),
797
+ /* @__PURE__ */ t(
798
+ "svg",
799
+ {
800
+ className: x.dash,
801
+ viewBox: "0 0 12 12",
802
+ fill: "none",
803
+ children: /* @__PURE__ */ t(
804
+ "path",
805
+ {
806
+ d: "M2.5 6h7",
807
+ stroke: "currentColor",
808
+ strokeWidth: "1.8",
809
+ strokeLinecap: "round"
810
+ }
811
+ )
812
+ }
813
+ )
814
+ ] })
815
+ ] }),
816
+ r && /* @__PURE__ */ t("label", { htmlFor: u, className: x.label, children: r })
817
+ ] }),
818
+ n && /* @__PURE__ */ t("p", { className: x.helperText, children: n })
819
+ ]
820
+ }
821
+ );
822
+ }
823
+ );
824
+ Po.displayName = "Checkbox";
825
+ export {
826
+ Ht as Avatar,
827
+ Kt as AvatarGroup,
828
+ St as Badge,
829
+ Ce as Button,
830
+ U as Card,
831
+ Po as Checkbox,
832
+ He as Input,
833
+ ft as Modal,
834
+ Ro as Select,
835
+ Q as Spinner,
836
+ tt as Textarea,
837
+ oo as Tooltip
838
+ };