sander-ui 0.1.5 → 0.1.7

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.
Files changed (80) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +53 -51
  3. package/dist/index10.js +2 -2
  4. package/dist/index11.js +1 -1
  5. package/dist/index12.js +4 -4
  6. package/dist/index13.js +98 -100
  7. package/dist/index14.js +41 -21
  8. package/dist/index15.js +22 -19
  9. package/dist/index16.js +20 -76
  10. package/dist/index17.js +72 -58
  11. package/dist/index18.js +56 -35
  12. package/dist/index19.js +40 -31
  13. package/dist/index20.js +30 -25
  14. package/dist/index21.js +260 -19
  15. package/dist/index22.js +15 -36
  16. package/dist/index23.js +39 -46
  17. package/dist/index24.js +39 -124
  18. package/dist/index25.js +132 -18
  19. package/dist/index26.js +18 -23
  20. package/dist/index27.js +23 -55
  21. package/dist/index28.js +55 -19
  22. package/dist/index29.js +19 -46
  23. package/dist/index3.js +2 -2
  24. package/dist/index30.js +46 -5
  25. package/dist/index31.js +5 -17
  26. package/dist/index32.js +26 -10
  27. package/dist/index33.js +25 -39
  28. package/dist/index34.js +17 -7
  29. package/dist/index35.js +8 -26
  30. package/dist/index36.js +4 -17
  31. package/dist/index37.js +16 -22
  32. package/dist/index38.js +22 -20
  33. package/dist/index39.js +8 -13
  34. package/dist/index4.js +7 -7
  35. package/dist/index40.js +14 -23
  36. package/dist/index41.js +7 -7
  37. package/dist/index42.js +6 -13
  38. package/dist/index43.js +7 -8
  39. package/dist/index44.js +26 -7
  40. package/dist/index45.js +15 -11
  41. package/dist/index46.js +20 -16
  42. package/dist/index47.js +13 -8
  43. package/dist/index48.js +23 -4
  44. package/dist/index49.js +11 -27
  45. package/dist/index5.js +3 -3
  46. package/dist/index50.js +25 -16
  47. package/dist/index51.js +12 -20
  48. package/dist/index52.js +16 -12
  49. package/dist/index53.js +26 -30
  50. package/dist/index55.js +10 -16
  51. package/dist/index56.js +42 -14
  52. package/dist/index57.js +3 -3
  53. package/dist/index58.js +4 -15
  54. package/dist/index59.js +14 -18
  55. package/dist/index6.js +3 -3
  56. package/dist/index60.js +4 -13
  57. package/dist/index61.js +12 -25
  58. package/dist/index62.js +20 -41
  59. package/dist/index63.js +42 -4
  60. package/dist/index64.js +4 -27
  61. package/dist/index65.js +14 -25
  62. package/dist/index66.js +40 -35
  63. package/dist/index67.js +15 -2
  64. package/dist/index68.js +31 -4
  65. package/dist/index69.js +16 -20
  66. package/dist/index7.js +4 -4
  67. package/dist/index70.js +35 -2
  68. package/dist/index71.js +2 -2
  69. package/dist/index72.js +4 -6
  70. package/dist/index73.js +21 -34
  71. package/dist/index74.js +2 -12
  72. package/dist/index75.js +2 -7
  73. package/dist/index76.js +6 -5
  74. package/dist/index77.js +36 -0
  75. package/dist/index78.js +14 -0
  76. package/dist/index79.js +9 -0
  77. package/dist/index8.js +12 -12
  78. package/dist/index80.js +7 -0
  79. package/dist/index9.js +2 -2
  80. package/package.json +1 -1
package/dist/index17.js CHANGED
@@ -1,64 +1,78 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import u from "./index30.js";
3
- import n from "./index56.js";
4
- import h from "./index57.js";
5
- import d from "./index48.js";
6
- function b(i, r, a) {
7
- const s = [], c = Math.max(2, i - a), t = Math.min(r - 1, i + a);
8
- s.push(1), c > 2 && s.push("ellipsis");
9
- for (let o = c; o <= t; o++)
10
- s.push(o);
11
- return t < r - 1 && s.push("ellipsis"), r > 1 && s.push(r), s;
12
- }
13
- const j = ({
14
- page: i,
15
- totalPages: r,
16
- onChange: a,
17
- siblings: s = 1,
18
- className: c,
19
- ...t
1
+ import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
+ import c from "./index31.js";
3
+ import { useRef as h, useState as u, useEffect as p } from "react";
4
+ import { createPortal as v } from "react-dom";
5
+ import { useScrollLock as M } from "./index49.js";
6
+ import t from "./index50.js";
7
+ import y from "./index43.js";
8
+ const R = ({
9
+ open: s,
10
+ onClose: o,
11
+ children: r,
12
+ size: f = "sm",
13
+ className: g,
14
+ ...N
20
15
  }) => {
21
- if (r <= 1) return null;
22
- const o = b(i, r, s);
23
- return /* @__PURE__ */ f("nav", { "aria-label": "Pagination", className: u(n.pagination, c), ...t, children: [
24
- /* @__PURE__ */ e(
25
- "button",
16
+ const i = h(null), [n, m] = u(!1), [a, d] = u(!1);
17
+ return M(n && !a), p(() => {
18
+ s ? (m(!0), d(!1)) : m((e) => (e && d(!0), e));
19
+ }, [s]), p(() => {
20
+ const e = i.current;
21
+ n && !a && e && !e.open && (e.showModal(), e.focus());
22
+ }, [n, a]), n ? v(
23
+ /* @__PURE__ */ l(
24
+ "dialog",
26
25
  {
27
- "aria-label": "Previous page",
28
- disabled: i <= 1,
29
- onClick: () => a(i - 1),
30
- className: n.arrow,
31
- children: /* @__PURE__ */ e(h, { className: n.icon })
32
- }
33
- ),
34
- o.map((l, m) => {
35
- if (l === "ellipsis")
36
- return /* @__PURE__ */ e("span", { className: n.ellipsis, children: "..." }, `ellipsis-${m}`);
37
- const p = l === i;
38
- return /* @__PURE__ */ e(
39
- "button",
40
- {
41
- "aria-label": `Page ${l}`,
42
- "aria-current": p ? "page" : void 0,
43
- onClick: () => a(l),
44
- className: u(n.page, p && n.active),
45
- children: l
26
+ ref: i,
27
+ className: c(
28
+ t.dialog,
29
+ t[`size-${f}`],
30
+ a && t.closing,
31
+ g
32
+ ),
33
+ onAnimationEnd: () => {
34
+ a && (i.current?.close(), m(!1), d(!1));
46
35
  },
47
- l
48
- );
49
- }),
50
- /* @__PURE__ */ e(
51
- "button",
52
- {
53
- "aria-label": "Next page",
54
- disabled: i >= r,
55
- onClick: () => a(i + 1),
56
- className: n.arrow,
57
- children: /* @__PURE__ */ e(d, { className: n.icon })
36
+ onCancel: (e) => {
37
+ e.preventDefault(), o();
38
+ },
39
+ onClick: (e) => {
40
+ e.target === i.current && o();
41
+ },
42
+ ...N,
43
+ children: /* @__PURE__ */ l("div", { className: t.content, children: r })
58
44
  }
59
- )
60
- ] });
61
- };
45
+ ),
46
+ document.body
47
+ ) : null;
48
+ }, S = ({
49
+ children: s,
50
+ onClose: o,
51
+ className: r,
52
+ ...f
53
+ }) => /* @__PURE__ */ b("div", { className: c(t.header, r), ...f, children: [
54
+ /* @__PURE__ */ l("h2", { className: t.title, children: s }),
55
+ o && /* @__PURE__ */ l(
56
+ "button",
57
+ {
58
+ onClick: o,
59
+ "aria-label": "Close",
60
+ className: t.closeButton,
61
+ children: /* @__PURE__ */ l(y, { size: 20 })
62
+ }
63
+ )
64
+ ] }), w = ({
65
+ children: s,
66
+ className: o,
67
+ ...r
68
+ }) => /* @__PURE__ */ l("div", { className: c(t.body, o), ...r, children: s }), A = ({
69
+ children: s,
70
+ className: o,
71
+ ...r
72
+ }) => /* @__PURE__ */ l("div", { className: c(t.footer, o), ...r, children: s });
62
73
  export {
63
- j as Pagination
74
+ R as Modal,
75
+ w as ModalBody,
76
+ A as ModalFooter,
77
+ S as ModalHeader
64
78
  };
package/dist/index18.js CHANGED
@@ -1,43 +1,64 @@
1
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
- import o from "./index30.js";
3
- import r from "./index37.js";
4
- const N = ({
5
- value: e,
6
- max: d = 100,
7
- label: s,
8
- size: c = "md",
9
- className: l,
10
- ...m
1
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
+ import u from "./index31.js";
3
+ import n from "./index59.js";
4
+ import h from "./index60.js";
5
+ import d from "./index36.js";
6
+ function b(i, r, a) {
7
+ const s = [], c = Math.max(2, i - a), t = Math.min(r - 1, i + a);
8
+ s.push(1), c > 2 && s.push("ellipsis");
9
+ for (let o = c; o <= t; o++)
10
+ s.push(o);
11
+ return t < r - 1 && s.push("ellipsis"), r > 1 && s.push(r), s;
12
+ }
13
+ const j = ({
14
+ page: i,
15
+ totalPages: r,
16
+ onChange: a,
17
+ siblings: s = 1,
18
+ className: c,
19
+ ...t
11
20
  }) => {
12
- const a = e === void 0, t = a ? 0 : Math.round(e / d * 100);
13
- return /* @__PURE__ */ i("div", { className: o(r.wrapper, l), ...m, children: [
14
- s && /* @__PURE__ */ i("div", { className: r.header, children: [
15
- /* @__PURE__ */ n("span", { className: r.label, children: s }),
16
- !a && /* @__PURE__ */ i("span", { className: r.value, children: [
17
- t,
18
- "%"
19
- ] })
20
- ] }),
21
- /* @__PURE__ */ n(
22
- "div",
21
+ if (r <= 1) return null;
22
+ const o = b(i, r, s);
23
+ return /* @__PURE__ */ f("nav", { "aria-label": "Pagination", className: u(n.pagination, c), ...t, children: [
24
+ /* @__PURE__ */ e(
25
+ "button",
23
26
  {
24
- role: "progressbar",
25
- "aria-valuenow": a ? void 0 : e,
26
- "aria-valuemin": 0,
27
- "aria-valuemax": d,
28
- "aria-label": s || "Progress",
29
- className: o(r.track, r[c]),
30
- children: /* @__PURE__ */ n(
31
- "div",
32
- {
33
- className: o(r.bar, a && r.indeterminate),
34
- style: a ? void 0 : { width: `${t}%` }
35
- }
36
- )
27
+ "aria-label": "Previous page",
28
+ disabled: i <= 1,
29
+ onClick: () => a(i - 1),
30
+ className: n.arrow,
31
+ children: /* @__PURE__ */ e(h, { className: n.icon })
32
+ }
33
+ ),
34
+ o.map((l, m) => {
35
+ if (l === "ellipsis")
36
+ return /* @__PURE__ */ e("span", { className: n.ellipsis, children: "..." }, `ellipsis-${m}`);
37
+ const p = l === i;
38
+ return /* @__PURE__ */ e(
39
+ "button",
40
+ {
41
+ "aria-label": `Page ${l}`,
42
+ "aria-current": p ? "page" : void 0,
43
+ onClick: () => a(l),
44
+ className: u(n.page, p && n.active),
45
+ children: l
46
+ },
47
+ l
48
+ );
49
+ }),
50
+ /* @__PURE__ */ e(
51
+ "button",
52
+ {
53
+ "aria-label": "Next page",
54
+ disabled: i >= r,
55
+ onClick: () => a(i + 1),
56
+ className: n.arrow,
57
+ children: /* @__PURE__ */ e(d, { className: n.icon })
37
58
  }
38
59
  )
39
60
  ] });
40
61
  };
41
62
  export {
42
- N as Progress
63
+ j as Pagination
43
64
  };
package/dist/index19.js CHANGED
@@ -1,34 +1,43 @@
1
- import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
- import c from "./index30.js";
3
- import { forwardRef as h } from "react";
4
- import a from "./index54.js";
5
- const v = h(
6
- ({ label: i, error: s, options: m, value: n, onChange: o, name: r, className: p, ...t }, u) => /* @__PURE__ */ d("fieldset", { className: c(a.fieldset, p), children: [
7
- i && /* @__PURE__ */ l("legend", { className: a.legend, children: i }),
8
- /* @__PURE__ */ l("div", { className: a.options, children: m.map((e) => /* @__PURE__ */ d("label", { className: a.option, children: [
9
- /* @__PURE__ */ l(
10
- "input",
11
- {
12
- ref: u,
13
- type: "radio",
14
- name: r,
15
- value: e.value,
16
- checked: n === e.value,
17
- onChange: () => o?.(e.value),
18
- "aria-describedby": e.description ? `${r}-${e.value}-description` : void 0,
19
- className: c(a.radio, s && a.radioError),
20
- ...t
21
- }
22
- ),
23
- /* @__PURE__ */ d("div", { className: a.labels, children: [
24
- /* @__PURE__ */ l("span", { className: a.label, children: e.label }),
25
- e.description && /* @__PURE__ */ l("span", { id: `${r}-${e.value}-description`, className: a.description, children: e.description })
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import o from "./index31.js";
3
+ import r from "./index48.js";
4
+ const N = ({
5
+ value: e,
6
+ max: d = 100,
7
+ label: s,
8
+ size: c = "md",
9
+ className: l,
10
+ ...m
11
+ }) => {
12
+ const a = e === void 0, t = a ? 0 : Math.round(e / d * 100);
13
+ return /* @__PURE__ */ i("div", { className: o(r.wrapper, l), ...m, children: [
14
+ s && /* @__PURE__ */ i("div", { className: r.header, children: [
15
+ /* @__PURE__ */ n("span", { className: r.label, children: s }),
16
+ !a && /* @__PURE__ */ i("span", { className: r.value, children: [
17
+ t,
18
+ "%"
26
19
  ] })
27
- ] }, e.value)) }),
28
- s && /* @__PURE__ */ l("p", { role: "alert", className: a.error, children: s })
29
- ] })
30
- );
31
- v.displayName = "RadioGroup";
20
+ ] }),
21
+ /* @__PURE__ */ n(
22
+ "div",
23
+ {
24
+ role: "progressbar",
25
+ "aria-valuenow": a ? void 0 : e,
26
+ "aria-valuemin": 0,
27
+ "aria-valuemax": d,
28
+ "aria-label": s || "Progress",
29
+ className: o(r.track, r[c]),
30
+ children: /* @__PURE__ */ n(
31
+ "div",
32
+ {
33
+ className: o(r.bar, a && r.indeterminate),
34
+ style: a ? void 0 : { width: `${t}%` }
35
+ }
36
+ )
37
+ }
38
+ )
39
+ ] });
40
+ };
32
41
  export {
33
- v as RadioGroup
42
+ N as Progress
34
43
  };
package/dist/index20.js CHANGED
@@ -1,29 +1,34 @@
1
- import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
- import p from "./index30.js";
3
- import { forwardRef as v } from "react";
4
- import l from "./index45.js";
5
- const u = v(
6
- ({ label: i, error: e, id: r, options: m, placeholder: c, className: o, ...d }, n) => /* @__PURE__ */ t("div", { className: l.wrapper, children: [
7
- i && /* @__PURE__ */ a("label", { htmlFor: r, className: l.label, children: i }),
8
- /* @__PURE__ */ t(
9
- "select",
10
- {
11
- id: r,
12
- ref: n,
13
- "aria-invalid": e ? !0 : void 0,
14
- "aria-describedby": e ? `${r}-error` : void 0,
15
- className: p(l.select, e && l.selectError, o),
16
- ...d,
17
- children: [
18
- c && /* @__PURE__ */ a("option", { value: "", disabled: !0, children: c }),
19
- m.map((s) => /* @__PURE__ */ a("option", { value: s.value, children: s.label }, s.value))
20
- ]
21
- }
22
- ),
23
- e && /* @__PURE__ */ a("p", { id: `${r}-error`, role: "alert", className: l.error, children: e })
1
+ import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
+ import c from "./index31.js";
3
+ import { forwardRef as h } from "react";
4
+ import a from "./index54.js";
5
+ const v = h(
6
+ ({ label: i, error: s, options: m, value: n, onChange: o, name: r, className: p, ...t }, u) => /* @__PURE__ */ d("fieldset", { className: c(a.fieldset, p), children: [
7
+ i && /* @__PURE__ */ l("legend", { className: a.legend, children: i }),
8
+ /* @__PURE__ */ l("div", { className: a.options, children: m.map((e) => /* @__PURE__ */ d("label", { className: a.option, children: [
9
+ /* @__PURE__ */ l(
10
+ "input",
11
+ {
12
+ ref: u,
13
+ type: "radio",
14
+ name: r,
15
+ value: e.value,
16
+ checked: n === e.value,
17
+ onChange: () => o?.(e.value),
18
+ "aria-describedby": e.description ? `${r}-${e.value}-description` : void 0,
19
+ className: c(a.radio, s && a.radioError),
20
+ ...t
21
+ }
22
+ ),
23
+ /* @__PURE__ */ d("div", { className: a.labels, children: [
24
+ /* @__PURE__ */ l("span", { className: a.label, children: e.label }),
25
+ e.description && /* @__PURE__ */ l("span", { id: `${r}-${e.value}-description`, className: a.description, children: e.description })
26
+ ] })
27
+ ] }, e.value)) }),
28
+ s && /* @__PURE__ */ l("p", { role: "alert", className: a.error, children: s })
24
29
  ] })
25
30
  );
26
- u.displayName = "Select";
31
+ v.displayName = "RadioGroup";
27
32
  export {
28
- u as Select
33
+ v as RadioGroup
29
34
  };
package/dist/index21.js CHANGED
@@ -1,21 +1,262 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import n from "./index30.js";
3
- import t from "./index52.js";
4
- const c = ({
5
- width: e,
6
- height: r,
7
- variant: o = "text",
8
- className: s,
9
- ...m
10
- }) => /* @__PURE__ */ i(
11
- "div",
12
- {
13
- "aria-hidden": "true",
14
- className: n(t.skeleton, t[o], s),
15
- style: { width: e, height: r },
16
- ...m
17
- }
18
- );
1
+ import { jsx as l, jsxs as g } from "react/jsx-runtime";
2
+ import y from "./index31.js";
3
+ import { createPortal as de } from "react-dom";
4
+ import { useId as ue, useState as h, useRef as k, useCallback as C, useLayoutEffect as pe, useEffect as W } from "react";
5
+ import r from "./index56.js";
6
+ import fe from "./index57.js";
7
+ import be from "./index58.js";
8
+ function X(v) {
9
+ return "options" in v;
10
+ }
11
+ function he(v) {
12
+ const b = [];
13
+ for (const c of v)
14
+ X(c) ? b.push(...c.options) : b.push(c);
15
+ return b;
16
+ }
17
+ const ve = ({
18
+ id: v,
19
+ name: b,
20
+ label: c,
21
+ error: m,
22
+ options: z,
23
+ placeholder: q,
24
+ value: K,
25
+ defaultValue: J,
26
+ onChange: P,
27
+ disabled: D = !1,
28
+ required: V = !1,
29
+ className: Q
30
+ }) => {
31
+ const Z = ue(), d = v ?? Z, F = `${d}-listbox`, j = `${d}-error`, $ = `${d}-label`, u = he(z), o = u.map((e, t) => ({ ...e, index: t })).filter((e) => !e.disabled), A = K !== void 0, [_, ee] = h(J ?? ""), p = A ? K : _, [s, I] = h(!1), [a, i] = h(-1), [te, B] = h(""), O = k(null), [ne, re] = h(!1), [T, oe] = h({ top: 0, left: 0, width: 0 }), E = k(null), w = k(null), R = k(null), M = k([]), S = u.find((e) => e.value === p), U = C(
32
+ (e) => {
33
+ A || ee(e), P?.(e);
34
+ },
35
+ [A, P]
36
+ ), H = C(
37
+ (e) => {
38
+ if (D) return;
39
+ const t = e ?? (p ? u.findIndex((n) => n.value === p) : o[0]?.index ?? 0);
40
+ i(t), I(!0);
41
+ },
42
+ [D, p, u, o]
43
+ ), L = C(() => {
44
+ I(!1), i(-1), E.current?.focus();
45
+ }, []);
46
+ pe(() => {
47
+ if (!s || !E.current) return;
48
+ const e = () => {
49
+ const t = E.current.getBoundingClientRect(), n = window.innerHeight - t.bottom, f = t.top, x = w.current?.offsetHeight ?? 240, G = n < x && f > n;
50
+ re(G), oe({
51
+ top: G ? t.top + window.scrollY - (w.current?.offsetHeight ?? 0) - 4 : t.bottom + window.scrollY + 4,
52
+ left: t.left + window.scrollX,
53
+ width: t.width
54
+ });
55
+ };
56
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
57
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
58
+ };
59
+ }, [s]), W(() => {
60
+ !s || a < 0 || M.current[a]?.scrollIntoView({ block: "nearest" });
61
+ }, [a, s]), W(() => {
62
+ if (!s) return;
63
+ function e(t) {
64
+ const n = t.target;
65
+ R.current && !R.current.contains(n) && w.current && !w.current.contains(n) && (I(!1), i(-1));
66
+ }
67
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
68
+ }, [s]);
69
+ const N = C(
70
+ (e, t) => {
71
+ if (o.length === 0) return -1;
72
+ const n = o.findIndex((f) => f.index === t);
73
+ switch (e) {
74
+ case "next":
75
+ return n < 0 || n >= o.length - 1 ? o[0].index : o[n + 1].index;
76
+ case "prev":
77
+ return n <= 0 ? o[o.length - 1].index : o[n - 1].index;
78
+ case "first":
79
+ return o[0].index;
80
+ case "last":
81
+ return o[o.length - 1].index;
82
+ }
83
+ },
84
+ [o]
85
+ ), se = (e) => {
86
+ O.current && clearTimeout(O.current);
87
+ const t = te + e.toLowerCase();
88
+ B(t), O.current = setTimeout(() => B(""), 500);
89
+ const n = o.find(
90
+ (f) => f.label.toLowerCase().startsWith(t)
91
+ );
92
+ n && i(n.index);
93
+ }, ae = (e) => {
94
+ if (!s) {
95
+ switch (e.key) {
96
+ case "ArrowDown":
97
+ case "Enter":
98
+ case " ":
99
+ e.preventDefault(), H();
100
+ break;
101
+ case "ArrowUp":
102
+ e.preventDefault(), H(o[o.length - 1]?.index);
103
+ break;
104
+ }
105
+ return;
106
+ }
107
+ switch (e.key) {
108
+ case "ArrowDown":
109
+ e.preventDefault(), i((t) => N("next", t));
110
+ break;
111
+ case "ArrowUp":
112
+ e.preventDefault(), i((t) => N("prev", t));
113
+ break;
114
+ case "Home":
115
+ e.preventDefault(), i(N("first", a));
116
+ break;
117
+ case "End":
118
+ e.preventDefault(), i(N("last", a));
119
+ break;
120
+ case "Enter":
121
+ case " ":
122
+ e.preventDefault(), a >= 0 && !u[a]?.disabled && (U(u[a].value), L());
123
+ break;
124
+ case "Escape":
125
+ e.preventDefault(), L();
126
+ break;
127
+ case "Tab":
128
+ I(!1), i(-1);
129
+ break;
130
+ default:
131
+ e.key.length === 1 && !e.ctrlKey && !e.metaKey && (e.preventDefault(), se(e.key));
132
+ }
133
+ }, le = s && a >= 0 ? `${d}-option-${a}` : void 0;
134
+ let ie = 0;
135
+ const Y = (e) => {
136
+ const t = ie++, n = e.value === p, f = t === a;
137
+ return /* @__PURE__ */ g(
138
+ "li",
139
+ {
140
+ ref: (x) => {
141
+ M.current[t] = x;
142
+ },
143
+ id: `${d}-option-${t}`,
144
+ role: "option",
145
+ "aria-selected": n,
146
+ "aria-disabled": e.disabled || void 0,
147
+ className: y(
148
+ r.option,
149
+ f && r.optionActive,
150
+ n && r.optionSelected,
151
+ e.disabled && r.optionDisabled
152
+ ),
153
+ onMouseEnter: () => {
154
+ e.disabled || i(t);
155
+ },
156
+ onMouseDown: (x) => x.preventDefault(),
157
+ onClick: () => {
158
+ e.disabled || (U(e.value), L());
159
+ },
160
+ children: [
161
+ /* @__PURE__ */ l("span", { className: r.optionLabel, children: e.label }),
162
+ n && /* @__PURE__ */ l(be, { size: 16, className: r.checkIcon, "aria-hidden": !0 })
163
+ ]
164
+ },
165
+ e.value
166
+ );
167
+ }, ce = s ? de(
168
+ /* @__PURE__ */ l(
169
+ "ul",
170
+ {
171
+ ref: w,
172
+ id: F,
173
+ role: "listbox",
174
+ "aria-labelledby": c ? $ : d,
175
+ className: y(r.listbox, ne && r.flipped),
176
+ style: {
177
+ top: T.top,
178
+ left: T.left,
179
+ width: T.width
180
+ },
181
+ children: z.map((e) => {
182
+ if (X(e)) {
183
+ const t = `${d}-group-${e.label.replace(/\s+/g, "-").toLowerCase()}`;
184
+ return /* @__PURE__ */ g("li", { role: "presentation", children: [
185
+ /* @__PURE__ */ l(
186
+ "div",
187
+ {
188
+ id: t,
189
+ role: "presentation",
190
+ className: r.groupLabel,
191
+ children: e.label
192
+ }
193
+ ),
194
+ /* @__PURE__ */ l("ul", { role: "group", "aria-labelledby": t, className: r.group, children: e.options.map(Y) })
195
+ ] }, e.label);
196
+ }
197
+ return Y(e);
198
+ })
199
+ }
200
+ ),
201
+ document.body
202
+ ) : null;
203
+ return /* @__PURE__ */ g("div", { ref: R, className: r.wrapper, children: [
204
+ c && /* @__PURE__ */ l("label", { id: $, className: r.label, children: c }),
205
+ /* @__PURE__ */ g(
206
+ "button",
207
+ {
208
+ ref: E,
209
+ type: "button",
210
+ id: d,
211
+ role: "combobox",
212
+ "aria-haspopup": "listbox",
213
+ "aria-expanded": s,
214
+ "aria-controls": s ? F : void 0,
215
+ "aria-labelledby": c ? $ : void 0,
216
+ "aria-activedescendant": le,
217
+ "aria-invalid": m ? !0 : void 0,
218
+ "aria-describedby": m ? j : void 0,
219
+ "aria-required": V,
220
+ disabled: D,
221
+ className: y(r.trigger, m && r.triggerError, Q),
222
+ onClick: () => s ? L() : H(),
223
+ onKeyDown: ae,
224
+ children: [
225
+ /* @__PURE__ */ l("span", { className: y(r.triggerText, !S && r.placeholder), children: S ? S.label : q ?? " " }),
226
+ /* @__PURE__ */ l(
227
+ fe,
228
+ {
229
+ size: 16,
230
+ className: y(r.chevron, s && r.chevronOpen),
231
+ "aria-hidden": !0
232
+ }
233
+ )
234
+ ]
235
+ }
236
+ ),
237
+ b && /* @__PURE__ */ g(
238
+ "select",
239
+ {
240
+ name: b,
241
+ value: p,
242
+ required: V,
243
+ disabled: D,
244
+ tabIndex: -1,
245
+ "aria-hidden": !0,
246
+ className: r.hiddenSelect,
247
+ onChange: () => {
248
+ },
249
+ children: [
250
+ !p && /* @__PURE__ */ l("option", { value: "" }),
251
+ u.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
252
+ ]
253
+ }
254
+ ),
255
+ ce,
256
+ m && /* @__PURE__ */ l("p", { id: j, role: "alert", className: r.error, children: m })
257
+ ] });
258
+ };
259
+ ve.displayName = "Select";
19
260
  export {
20
- c as Skeleton
261
+ ve as Select
21
262
  };