@overdoser/react-toolkit 0.18.0 → 0.20.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.
Files changed (157) hide show
  1. package/AGENTS.md +51 -7
  2. package/CHANGELOG.md +162 -0
  3. package/components/Accordion/Accordion.d.ts +94 -0
  4. package/components/Accordion/Accordion.js +180 -0
  5. package/components/Accordion/Accordion.module.scss.js +36 -0
  6. package/components/Accordion/index.d.ts +2 -0
  7. package/components/Alert/Alert.d.ts +29 -1
  8. package/components/Alert/Alert.js +44 -30
  9. package/components/Alert/Alert.module.scss.js +24 -16
  10. package/components/Alert/index.d.ts +1 -1
  11. package/components/Card/Card.d.ts +86 -0
  12. package/components/Card/Card.js +132 -0
  13. package/components/Card/Card.module.scss.js +60 -0
  14. package/components/Card/index.d.ts +2 -0
  15. package/components/Chip/Chip.d.ts +86 -0
  16. package/components/Chip/Chip.js +141 -0
  17. package/components/Chip/Chip.module.scss.js +59 -0
  18. package/components/Chip/index.d.ts +2 -0
  19. package/components/CodeBlock/CodeBlock.d.ts +78 -0
  20. package/components/CodeBlock/CodeBlock.js +120 -0
  21. package/components/CodeBlock/CodeBlock.module.scss.js +43 -0
  22. package/components/CodeBlock/index.d.ts +2 -0
  23. package/components/CommandPalette/CommandPalette.d.ts +141 -0
  24. package/components/CommandPalette/CommandPalette.js +397 -0
  25. package/components/CommandPalette/CommandPalette.module.scss.js +49 -0
  26. package/components/CommandPalette/index.d.ts +2 -0
  27. package/components/ConfirmDialog/ConfirmDialog.d.ts +119 -0
  28. package/components/ConfirmDialog/ConfirmDialog.js +201 -0
  29. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +21 -0
  30. package/components/ConfirmDialog/index.d.ts +2 -0
  31. package/components/Drawer/Drawer.d.ts +1 -0
  32. package/components/Drawer/Drawer.js +35 -36
  33. package/components/Drawer/Drawer.module.scss.js +20 -18
  34. package/components/Dropdown/Dropdown.d.ts +47 -7
  35. package/components/Dropdown/Dropdown.js +174 -81
  36. package/components/Dropdown/Dropdown.module.scss.js +40 -22
  37. package/components/Dropdown/DropdownItem.d.ts +31 -2
  38. package/components/Dropdown/DropdownItem.js +54 -27
  39. package/components/Dropdown/DropdownLabel.d.ts +11 -0
  40. package/components/Dropdown/DropdownLabel.js +11 -0
  41. package/components/Dropdown/DropdownSeparator.d.ts +12 -0
  42. package/components/Dropdown/DropdownSeparator.js +11 -0
  43. package/components/Dropdown/dropdownContext.d.ts +6 -0
  44. package/components/Dropdown/dropdownContext.js +5 -0
  45. package/components/Dropdown/index.d.ts +8 -2
  46. package/components/Dropdown/useContextMenu.d.ts +32 -0
  47. package/components/Dropdown/useContextMenu.js +18 -0
  48. package/components/EmptyState/EmptyState.d.ts +53 -0
  49. package/components/EmptyState/EmptyState.js +55 -0
  50. package/components/EmptyState/EmptyState.module.scss.js +25 -0
  51. package/components/EmptyState/index.d.ts +2 -0
  52. package/components/Form/FormField.js +25 -24
  53. package/components/ImageViewer/ImageViewer.d.ts +105 -0
  54. package/components/ImageViewer/ImageViewer.js +201 -0
  55. package/components/ImageViewer/ImageViewer.module.scss.js +47 -0
  56. package/components/ImageViewer/index.d.ts +4 -0
  57. package/components/ImageViewer/useZoomPan.d.ts +94 -0
  58. package/components/ImageViewer/useZoomPan.js +141 -0
  59. package/components/Kbd/Kbd.d.ts +26 -0
  60. package/components/Kbd/Kbd.js +22 -0
  61. package/components/Kbd/Kbd.module.scss.js +17 -0
  62. package/components/Kbd/index.d.ts +2 -0
  63. package/components/KeyValueList/KeyValueList.d.ts +84 -0
  64. package/components/KeyValueList/KeyValueList.js +127 -0
  65. package/components/KeyValueList/KeyValueList.module.scss.js +43 -0
  66. package/components/KeyValueList/index.d.ts +2 -0
  67. package/components/Modal/Modal.d.ts +1 -0
  68. package/components/Modal/Modal.js +40 -41
  69. package/components/Modal/Modal.module.scss.js +18 -16
  70. package/components/PageHeader/PageHeader.d.ts +61 -0
  71. package/components/PageHeader/PageHeader.js +73 -0
  72. package/components/PageHeader/PageHeader.module.scss.js +43 -0
  73. package/components/PageHeader/index.d.ts +2 -0
  74. package/components/ProgressBar/ProgressBar.d.ts +74 -0
  75. package/components/ProgressBar/ProgressBar.js +90 -0
  76. package/components/ProgressBar/ProgressBar.module.scss.js +51 -0
  77. package/components/ProgressBar/index.d.ts +2 -0
  78. package/components/RelativeTime/RelativeTime.d.ts +45 -0
  79. package/components/RelativeTime/RelativeTime.js +43 -0
  80. package/components/RelativeTime/RelativeTime.module.scss.js +7 -0
  81. package/components/RelativeTime/index.d.ts +2 -0
  82. package/components/SegmentedControl/SegmentedControl.d.ts +84 -0
  83. package/components/SegmentedControl/SegmentedControl.js +131 -0
  84. package/components/SegmentedControl/SegmentedControl.module.scss.js +39 -0
  85. package/components/SegmentedControl/index.d.ts +2 -0
  86. package/components/SplitPane/SplitPane.d.ts +61 -0
  87. package/components/SplitPane/SplitPane.js +171 -0
  88. package/components/SplitPane/SplitPane.module.scss.js +25 -0
  89. package/components/SplitPane/index.d.ts +2 -0
  90. package/components/StatCard/StatCard.d.ts +105 -0
  91. package/components/StatCard/StatCard.js +127 -0
  92. package/components/StatCard/StatCard.module.scss.js +72 -0
  93. package/components/StatCard/index.d.ts +2 -0
  94. package/components/StatusDot/StatusDot.d.ts +33 -0
  95. package/components/StatusDot/StatusDot.js +39 -0
  96. package/components/StatusDot/StatusDot.module.scss.js +32 -0
  97. package/components/StatusDot/index.d.ts +2 -0
  98. package/components/Table/Table.d.ts +140 -17
  99. package/components/Table/Table.js +382 -210
  100. package/components/Table/Table.module.scss.js +68 -46
  101. package/components/Table/index.d.ts +1 -1
  102. package/components/Table/useTableSort.d.ts +1 -1
  103. package/components/ThemeToggle/ThemeToggle.d.ts +40 -0
  104. package/components/ThemeToggle/ThemeToggle.js +98 -0
  105. package/components/ThemeToggle/ThemeToggle.module.scss.js +23 -0
  106. package/components/ThemeToggle/index.d.ts +2 -0
  107. package/components/inputs/Checkbox/Checkbox.d.ts +2 -0
  108. package/components/inputs/Checkbox/Checkbox.js +29 -28
  109. package/components/inputs/Checkbox/Checkbox.module.scss.js +8 -6
  110. package/components/inputs/Input/Input.d.ts +33 -1
  111. package/components/inputs/Input/Input.js +94 -35
  112. package/components/inputs/Input/Input.module.scss.js +14 -12
  113. package/components/inputs/Radio/Radio.d.ts +5 -4
  114. package/components/inputs/Radio/Radio.js +55 -50
  115. package/components/inputs/Radio/Radio.module.scss.js +12 -10
  116. package/components/inputs/SearchInput/SearchInput.d.ts +57 -0
  117. package/components/inputs/SearchInput/SearchInput.js +116 -0
  118. package/components/inputs/SearchInput/SearchInput.module.scss.js +13 -0
  119. package/components/inputs/SearchInput/index.d.ts +2 -0
  120. package/components/inputs/Select/Select.d.ts +52 -0
  121. package/components/inputs/Select/Select.js +494 -385
  122. package/components/inputs/Select/Select.module.scss.js +34 -30
  123. package/components/inputs/Switch/Switch.d.ts +15 -0
  124. package/components/inputs/Switch/Switch.js +8 -0
  125. package/components/inputs/Switch/index.d.ts +2 -0
  126. package/hooks/useDebouncedValue.d.ts +15 -0
  127. package/hooks/useDebouncedValue.js +15 -0
  128. package/hooks/useElementSize.d.ts +20 -0
  129. package/hooks/useElementSize.js +23 -0
  130. package/hooks/useKeyboard.d.ts +49 -5
  131. package/hooks/useKeyboard.js +66 -16
  132. package/hooks/useMediaQuery.d.ts +14 -0
  133. package/hooks/useMediaQuery.js +16 -0
  134. package/hooks/useNow.d.ts +14 -0
  135. package/hooks/useNow.js +35 -0
  136. package/hooks/usePersistedState.d.ts +30 -0
  137. package/hooks/usePersistedState.js +99 -0
  138. package/hooks/useResizable.d.ts +66 -0
  139. package/hooks/useResizable.js +105 -0
  140. package/hooks/useTheme.d.ts +33 -0
  141. package/hooks/useTheme.js +25 -0
  142. package/index.css +1 -1
  143. package/index.d.ts +58 -4
  144. package/index.js +208 -132
  145. package/index.layered.css +1 -1
  146. package/llms.txt +620 -26
  147. package/manifest.json +1795 -99
  148. package/package.json +1 -1
  149. package/recipes/confirm-modal.tsx +65 -53
  150. package/recipes/floating-copy-button.tsx +32 -28
  151. package/utils/formatBytes.d.ts +21 -0
  152. package/utils/formatBytes.js +14 -0
  153. package/utils/index.d.ts +6 -0
  154. package/utils/themeScript.d.ts +19 -0
  155. package/utils/themeScript.js +9 -0
  156. package/utils/timeAgo.d.ts +33 -0
  157. package/utils/timeAgo.js +37 -0
@@ -1,559 +1,668 @@
1
- import { jsx as s, jsxs as R, Fragment as xe } from "react/jsx-runtime";
2
- import { forwardRef as ie, useState as X, useRef as N, useId as de, useCallback as M, useMemo as fe, useEffect as B } from "react";
3
- import { createPortal as me } from "react-dom";
4
- import h from "clsx";
5
- import e from "./Select.module.scss.js";
6
- import { usePortalPosition as he } from "../../../hooks/usePortalPosition.js";
7
- const pe = ie(
1
+ import { jsx as c, jsxs as k, Fragment as De } from "react/jsx-runtime";
2
+ import { forwardRef as Ne, useState as ae, useRef as y, useId as Ee, useCallback as A, useEffect as B, useMemo as $e } from "react";
3
+ import { createPortal as Le } from "react-dom";
4
+ import f from "clsx";
5
+ import t from "./Select.module.scss.js";
6
+ import { usePortalPosition as Me } from "../../../hooks/usePortalPosition.js";
7
+ import { Spinner as Oe } from "../../Spinner/Spinner.js";
8
+ const Pe = Ne(
8
9
  ({
9
- inputSize: u = "md",
10
- error: p = !1,
11
- options: f,
12
- placeholder: I,
13
- classes: o,
14
- className: E,
15
- style: A,
16
- children: v,
17
- searchable: g,
18
- searchPlaceholder: y,
19
- onChange: z,
20
- onValueChange: x,
21
- ...O
22
- }, P) => {
23
- const G = z || x ? (k) => {
24
- z?.(k), x?.(k.target.value);
10
+ inputSize: n = "md",
11
+ error: a = !1,
12
+ options: d,
13
+ placeholder: m,
14
+ classes: r,
15
+ className: _,
16
+ style: R,
17
+ children: u,
18
+ searchable: v,
19
+ searchPlaceholder: w,
20
+ // Custom-mode-only props. Swallowed here so they never reach the DOM
21
+ // `<select>` (React warns on unknown handlers / non-boolean attributes).
22
+ // `FormField` always injects `onValuesChange`, so this path is hot.
23
+ onValuesChange: _e,
24
+ clearSearchOnSelect: C,
25
+ closeOnSelect: j,
26
+ allowCreate: F,
27
+ onCreate: fe,
28
+ createLabel: oe,
29
+ portal: G,
30
+ onSearch: J,
31
+ searchDebounce: Y,
32
+ minSearchLength: me,
33
+ searchPrompt: K,
34
+ loading: he,
35
+ loadingMessage: Z,
36
+ noResultsMessage: pe,
37
+ highlightMatches: q,
38
+ selectedLabels: ke,
39
+ onChange: ie,
40
+ onValueChange: se,
41
+ ...be
42
+ }, Re) => {
43
+ const Ce = ie || se ? (H) => {
44
+ ie?.(H), se?.(H.target.value);
25
45
  } : void 0;
26
- return /* @__PURE__ */ R("div", { className: h(e.wrapper, e[u], p && e.error, o?.wrapper, E), style: A, children: [
27
- /* @__PURE__ */ R(
46
+ return /* @__PURE__ */ k("div", { className: f(t.wrapper, t[n], a && t.error, r?.wrapper, _), style: R, children: [
47
+ /* @__PURE__ */ k(
28
48
  "select",
29
49
  {
30
- ref: P,
31
- className: h(e.root, e[u], p && e.error, o?.root),
32
- onChange: G,
33
- ...O,
50
+ ref: Re,
51
+ className: f(t.root, t[n], a && t.error, r?.root),
52
+ onChange: Ce,
53
+ ...be,
34
54
  children: [
35
- I && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: I }),
36
- f ? f.map((k) => /* @__PURE__ */ s("option", { value: k.value, disabled: k.disabled, children: k.label }, k.value)) : v
55
+ m && /* @__PURE__ */ c("option", { value: "", disabled: !0, children: m }),
56
+ d ? d.map((H) => /* @__PURE__ */ c("option", { value: H.value, disabled: H.disabled, children: H.label }, H.value)) : u
37
57
  ]
38
58
  }
39
59
  ),
40
- /* @__PURE__ */ s("span", { className: h(e.arrow, o?.arrow) })
60
+ /* @__PURE__ */ c("span", { className: f(t.arrow, r?.arrow) })
41
61
  ] });
42
62
  }
43
63
  );
44
- pe.displayName = "NativeSelect";
45
- function ve(u) {
46
- const { name: p, form: f, required: I, title: o, autoFocus: E, tabIndex: A } = u, v = { title: o, autoFocus: E, tabIndex: A };
47
- I && (v["aria-required"] = !0);
48
- for (const y of Object.keys(u))
49
- (y.startsWith("aria-") || y.startsWith("data-")) && (v[y] = u[y]);
50
- const g = {};
51
- for (const y of Object.keys(v))
52
- y.startsWith("aria-") && (g[y] = v[y]);
53
- return { hidden: { name: p, form: f }, control: v, aria: g };
64
+ Pe.displayName = "NativeSelect";
65
+ function Te(n) {
66
+ const { name: a, form: d, required: m, title: r, autoFocus: _, tabIndex: R } = n, u = { title: r, autoFocus: _, tabIndex: R };
67
+ m && (u["aria-required"] = !0);
68
+ for (const w of Object.keys(n))
69
+ (w.startsWith("aria-") || w.startsWith("data-")) && (u[w] = n[w]);
70
+ const v = {};
71
+ for (const w of Object.keys(u))
72
+ w.startsWith("aria-") && (v[w] = u[w]);
73
+ return { hidden: { name: a, form: d }, control: u, aria: v };
54
74
  }
55
- function be(u, p, f) {
56
- const I = N(!1);
75
+ function Ae(n, a, d) {
76
+ const m = y(!1);
57
77
  return {
58
- onFocus: (o) => {
59
- I.current || (I.current = !0, u?.(o));
78
+ onFocus: (r) => {
79
+ m.current || (m.current = !0, n?.(r));
60
80
  },
61
- onBlur: (o) => {
62
- const E = o.relatedTarget;
63
- E && f.some((A) => A.current?.contains(E)) || (I.current = !1, p?.(o));
81
+ onBlur: (r) => {
82
+ const _ = r.relatedTarget;
83
+ _ && d.some((R) => R.current?.contains(_)) || (m.current = !1, a?.(r));
64
84
  }
65
85
  };
66
86
  }
67
- const ge = ie(
87
+ function Fe(n, a, d, m, r) {
88
+ const _ = y(n);
89
+ _.current = n;
90
+ const R = y(null), u = !!n;
91
+ B(() => {
92
+ if (!u || !d || a.length < r) return;
93
+ const v = () => {
94
+ R.current !== a && (R.current = a, _.current?.(a));
95
+ };
96
+ if (m <= 0 || a === "") {
97
+ v();
98
+ return;
99
+ }
100
+ const w = setTimeout(v, m);
101
+ return () => clearTimeout(w);
102
+ }, [u, d, a, m, r]);
103
+ }
104
+ function He(n, a, d) {
105
+ return $e(() => {
106
+ if (d || !a) return n;
107
+ const m = a.toLowerCase();
108
+ return n.filter((r) => r.label.toLowerCase().includes(m));
109
+ }, [n, a, d]);
110
+ }
111
+ function We(n, a, d, m) {
112
+ if (n.content !== void 0) return n.content;
113
+ if (!d || !a) return n.label;
114
+ const r = n.label.toLowerCase().indexOf(a.toLowerCase());
115
+ return r < 0 ? n.label : /* @__PURE__ */ k(De, { children: [
116
+ n.label.slice(0, r),
117
+ /* @__PURE__ */ c("mark", { className: f(t.match, m), children: n.label.slice(r, r + a.length) }),
118
+ n.label.slice(r + a.length)
119
+ ] });
120
+ }
121
+ function je(n) {
122
+ return n.loading ? n.loadingMessage : n.remote && n.query.length < n.minSearchLength ? n.searchPrompt : n.empty ? n.noResultsMessage : null;
123
+ }
124
+ const Be = Ne(
68
125
  ({
69
- inputSize: u = "md",
70
- error: p = !1,
71
- options: f = [],
72
- placeholder: I = "Select...",
73
- classes: o,
74
- className: E,
75
- style: A,
76
- value: v,
77
- disabled: g,
78
- id: y,
79
- searchPlaceholder: z = "Search...",
80
- onChange: x,
81
- onValueChange: O,
82
- portal: P = !0,
83
- onFocus: G,
84
- onBlur: k,
85
- ...re
86
- }, _) => {
87
- const [b, ne] = X(!1), [U, F] = X(""), [c, d] = X(0), H = N(null), S = N(null), q = N(null), D = N(null), C = N(null), j = de(), K = he(H, b && P), { hidden: J, control: le, aria: Y } = ve(re), ae = be(G, k, [H, D]), T = N(null), oe = (r) => {
88
- T.current = r, typeof _ == "function" ? _(r) : _ && (_.current = r);
89
- }, Z = N(!1);
126
+ inputSize: n = "md",
127
+ error: a = !1,
128
+ options: d = [],
129
+ placeholder: m = "Select...",
130
+ classes: r,
131
+ className: _,
132
+ style: R,
133
+ value: u,
134
+ disabled: v,
135
+ id: w,
136
+ searchPlaceholder: _e = "Search...",
137
+ onChange: C,
138
+ onValueChange: j,
139
+ portal: F = !0,
140
+ onFocus: fe,
141
+ onBlur: oe,
142
+ onSearch: G,
143
+ searchDebounce: J = 250,
144
+ minSearchLength: Y = 0,
145
+ searchPrompt: me = "Type to search",
146
+ loading: K = !1,
147
+ loadingMessage: he = "Loading…",
148
+ noResultsMessage: Z = "No results",
149
+ highlightMatches: pe = !1,
150
+ selectedLabels: q,
151
+ // Multi-only props: not spread onto the DOM.
152
+ multiple: ke,
153
+ onValuesChange: ie,
154
+ clearSearchOnSelect: se,
155
+ closeOnSelect: be,
156
+ allowCreate: Re,
157
+ onCreate: Ce,
158
+ createLabel: H,
159
+ ...Ie
160
+ }, ee) => {
161
+ const O = !!G, [b, g] = ae(!1), [h, $] = ae(""), S = K || O && h.length < Y, [I, W] = ae(0), D = y(null), P = y(null), te = y(null), Q = y(null), ne = y(null), re = Ee(), le = Me(D, b && F), { hidden: ge, control: ce, aria: ve } = Te(Ie), we = Ae(fe, oe, [D, Q]), z = y(null), Se = (l) => {
162
+ z.current = l, typeof ee == "function" ? ee(l) : ee && (ee.current = l);
163
+ }, ye = y(!1);
90
164
  B(() => {
91
- Z.current && !b && q.current?.focus(), Z.current = b;
165
+ ye.current && !b && te.current?.focus(), ye.current = b;
92
166
  }, [b]);
93
- const W = M(() => {
94
- ne(!1), F(""), d(0);
95
- }, []), se = M(() => {
96
- g || (ne(!0), F(""), d(0), setTimeout(() => S.current?.focus(), 0));
97
- }, [g]), V = M(
98
- (r) => {
99
- if (O?.(r), T.current) {
167
+ const x = A(() => {
168
+ g(!1), $(""), W(0);
169
+ }, []), ue = A(() => {
170
+ v || (g(!0), $(""), W(0), setTimeout(() => P.current?.focus(), 0));
171
+ }, [v]), U = A(
172
+ (l) => {
173
+ if (j?.(l), z.current) {
100
174
  Object.getOwnPropertyDescriptor(
101
175
  HTMLSelectElement.prototype,
102
176
  "value"
103
- )?.set?.call(T.current, r);
104
- const n = new Event("change", { bubbles: !0 });
105
- T.current.dispatchEvent(n), x?.(n);
177
+ )?.set?.call(z.current, l);
178
+ const s = new Event("change", { bubbles: !0 });
179
+ z.current.dispatchEvent(s), C?.(s);
106
180
  }
107
- W();
181
+ x();
108
182
  },
109
- [O, x, T, W]
110
- ), m = fe(() => {
111
- if (!U) return f;
112
- const r = U.toLowerCase();
113
- return f.filter((l) => l.label.toLowerCase().includes(r));
114
- }, [f, U]);
115
- B(() => {
116
- const r = m.findIndex((l) => !l.disabled);
117
- d(r >= 0 ? r : 0);
118
- }, [m]), B(() => {
183
+ [j, C, z, x]
184
+ ), L = He(d, h, O);
185
+ Fe(G, h, b, J, Y), B(() => {
186
+ const l = L.findIndex((p) => !p.disabled);
187
+ W(l >= 0 ? l : 0);
188
+ }, [L]), B(() => {
119
189
  if (!b) return;
120
- const r = C.current;
121
- if (!r) return;
122
- r.querySelectorAll('[role="option"]')[c]?.scrollIntoView?.({ block: "nearest" });
123
- }, [c, b]);
124
- const ee = M(
125
- (r) => {
126
- const l = m.map((n, w) => n.disabled ? -1 : w).filter((n) => n >= 0);
127
- if (r.key === "Escape") {
128
- r.preventDefault(), W();
190
+ const l = ne.current;
191
+ if (!l) return;
192
+ l.querySelectorAll('[role="option"]')[I]?.scrollIntoView?.({ block: "nearest" });
193
+ }, [I, b]);
194
+ const T = A(
195
+ (l) => {
196
+ const p = L.map((s, e) => s.disabled ? -1 : e).filter((s) => s >= 0);
197
+ if (l.key === "Escape") {
198
+ l.preventDefault(), x();
129
199
  return;
130
200
  }
131
- if (l.length !== 0) {
132
- if (r.key === "ArrowDown")
133
- r.preventDefault(), d((n) => {
134
- const w = l.indexOf(n);
135
- return w < l.length - 1 ? l[w + 1] : l[0];
201
+ if (p.length !== 0) {
202
+ if (l.key === "ArrowDown")
203
+ l.preventDefault(), W((s) => {
204
+ const e = p.indexOf(s);
205
+ return e < p.length - 1 ? p[e + 1] : p[0];
136
206
  });
137
- else if (r.key === "ArrowUp")
138
- r.preventDefault(), d((n) => {
139
- const w = l.indexOf(n);
140
- return w > 0 ? l[w - 1] : l[l.length - 1];
207
+ else if (l.key === "ArrowUp")
208
+ l.preventDefault(), W((s) => {
209
+ const e = p.indexOf(s);
210
+ return e > 0 ? p[e - 1] : p[p.length - 1];
141
211
  });
142
- else if (r.key === "Enter") {
143
- r.preventDefault();
144
- const n = m[c];
145
- n && !n.disabled && V(n.value);
212
+ else if (l.key === "Enter") {
213
+ if (l.preventDefault(), S) return;
214
+ const s = L[I];
215
+ s && !s.disabled && U(s.value);
146
216
  }
147
217
  }
148
218
  },
149
- [m, c, V, W]
219
+ [L, I, U, x, S]
150
220
  );
151
221
  B(() => {
152
222
  if (!b) return;
153
- const r = (l) => {
154
- const n = l.target;
155
- H.current?.contains(n) || D.current?.contains(n) || W();
223
+ const l = (p) => {
224
+ const s = p.target;
225
+ D.current?.contains(s) || Q.current?.contains(s) || x();
156
226
  };
157
- return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
158
- }, [b, W]);
159
- const $ = f.find((r) => r.value === v)?.label, ce = m.filter((r) => !r.disabled);
160
- return /* @__PURE__ */ R(
227
+ return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
228
+ }, [b, x]);
229
+ const N = d.find((l) => l.value === u), M = N?.label ?? (u ? q?.[u] ?? (O ? u : void 0) : void 0), V = typeof M == "string" ? M : void 0, X = L.filter((l) => !l.disabled), xe = je({
230
+ loading: K,
231
+ loadingMessage: he,
232
+ remote: O,
233
+ query: h,
234
+ minSearchLength: Y,
235
+ searchPrompt: me,
236
+ empty: L.length === 0,
237
+ noResultsMessage: Z
238
+ });
239
+ return /* @__PURE__ */ k(
161
240
  "div",
162
241
  {
163
- ref: H,
164
- className: h(
165
- e.wrapper,
166
- e.searchableWrapper,
167
- e[u],
168
- p && e.error,
169
- g && e.disabled,
170
- o?.wrapper,
171
- E
242
+ ref: D,
243
+ className: f(
244
+ t.wrapper,
245
+ t.searchableWrapper,
246
+ t[n],
247
+ a && t.error,
248
+ v && t.disabled,
249
+ r?.wrapper,
250
+ _
172
251
  ),
173
- style: A,
174
- ...ae,
252
+ style: R,
253
+ ...we,
175
254
  children: [
176
- /* @__PURE__ */ R(
255
+ /* @__PURE__ */ k(
177
256
  "select",
178
257
  {
179
- ref: oe,
180
- className: e.hiddenSelect,
181
- value: v ?? "",
182
- disabled: g,
258
+ ref: Se,
259
+ className: t.hiddenSelect,
260
+ value: u ?? "",
261
+ disabled: v,
183
262
  tabIndex: -1,
184
263
  "aria-hidden": "true",
185
264
  onChange: () => {
186
265
  },
187
- ...J,
266
+ ...ge,
188
267
  children: [
189
- /* @__PURE__ */ s("option", { value: "" }),
190
- f.map((r) => /* @__PURE__ */ s("option", { value: r.value, children: r.label }, r.value))
268
+ /* @__PURE__ */ c("option", { value: "" }),
269
+ d.map((l) => /* @__PURE__ */ c("option", { value: l.value, children: l.label }, l.value)),
270
+ u && !N && /* @__PURE__ */ c("option", { value: u, children: V ?? u })
191
271
  ]
192
272
  }
193
273
  ),
194
- /* @__PURE__ */ R(
274
+ /* @__PURE__ */ k(
195
275
  "button",
196
276
  {
197
- ref: q,
198
- id: b ? void 0 : y,
277
+ ref: te,
278
+ id: b ? void 0 : w,
199
279
  type: "button",
200
- className: h(
201
- e.root,
202
- e.searchableTrigger,
203
- e[u],
204
- b && e.triggerOpen,
205
- p && e.error,
206
- b && e.visuallyHidden,
207
- o?.root
280
+ className: f(
281
+ t.root,
282
+ t.searchableTrigger,
283
+ t[n],
284
+ b && t.triggerOpen,
285
+ a && t.error,
286
+ b && t.visuallyHidden,
287
+ r?.root
208
288
  ),
209
- onClick: se,
210
- disabled: g,
289
+ onClick: ue,
290
+ disabled: v,
211
291
  "aria-expanded": b,
212
292
  "aria-haspopup": "listbox",
213
- "aria-controls": b ? j : void 0,
214
- ...le,
293
+ "aria-controls": b ? re : void 0,
294
+ ...ce,
215
295
  children: [
216
- /* @__PURE__ */ s("span", { className: h(e.triggerLabel, !$ && e.placeholder), children: $ || I }),
217
- /* @__PURE__ */ s("span", { className: h(e.arrow, e.arrowInline, o?.arrow) })
296
+ /* @__PURE__ */ c("span", { className: f(t.triggerLabel, !M && t.placeholder), children: M || m }),
297
+ K && /* @__PURE__ */ c(Oe, { size: "sm", label: "", "aria-hidden": "true", className: f(t.spinner, r?.spinner) }),
298
+ /* @__PURE__ */ c("span", { className: f(t.arrow, t.arrowInline, r?.arrow) })
218
299
  ]
219
300
  }
220
301
  ),
221
- b && /* @__PURE__ */ s(
302
+ b && /* @__PURE__ */ c(
222
303
  "input",
223
304
  {
224
- ref: S,
225
- id: y,
305
+ ref: P,
306
+ id: w,
226
307
  type: "text",
227
308
  role: "combobox",
228
- className: h(
229
- e.root,
230
- e.searchableTrigger,
231
- e[u],
232
- e.triggerOpen,
233
- p && e.error,
234
- o?.root,
235
- o?.search
309
+ className: f(
310
+ t.root,
311
+ t.searchableTrigger,
312
+ t[n],
313
+ t.triggerOpen,
314
+ a && t.error,
315
+ r?.root,
316
+ r?.search
236
317
  ),
237
- placeholder: $ || I,
238
- value: U,
239
- onChange: (r) => F(r.target.value),
240
- onKeyDown: ee,
318
+ placeholder: V || (typeof m == "string" ? m : void 0),
319
+ value: h,
320
+ onChange: (l) => $(l.target.value),
321
+ onKeyDown: T,
241
322
  "aria-expanded": !0,
242
323
  "aria-haspopup": "listbox",
243
- "aria-controls": j,
244
- "aria-activedescendant": ce.length > 0 ? `select-option-${m[c]?.value}` : void 0,
245
- "aria-label": Y["aria-labelledby"] || y ? void 0 : z,
246
- ...Y
324
+ "aria-controls": re,
325
+ "aria-activedescendant": X.length > 0 ? `select-option-${L[I]?.value}` : void 0,
326
+ "aria-label": ve["aria-labelledby"] || w ? void 0 : _e,
327
+ ...ve
247
328
  }
248
329
  ),
249
330
  b && (() => {
250
- const r = P ? {
331
+ const l = F ? {
251
332
  position: "fixed",
252
- top: K.top + 4,
253
- left: K.left,
333
+ top: le.top + 4,
334
+ left: le.left,
254
335
  right: "auto",
255
- width: K.width,
336
+ width: le.width,
256
337
  zIndex: "var(--crk-z-floating)"
257
- } : void 0, l = /* @__PURE__ */ s(
338
+ } : void 0, p = /* @__PURE__ */ c(
258
339
  "div",
259
340
  {
260
- id: j,
261
- ref: D,
262
- className: h(e.menu, o?.menu),
263
- style: r,
341
+ id: re,
342
+ ref: Q,
343
+ className: f(t.menu, r?.menu),
344
+ style: l,
264
345
  role: "listbox",
265
- children: /* @__PURE__ */ s("div", { className: e.menuItems, ref: C, children: m.length === 0 ? /* @__PURE__ */ s("div", { className: e.noResults, children: "No results" }) : m.map((n, w) => /* @__PURE__ */ s(
346
+ children: /* @__PURE__ */ c("div", { className: t.menuItems, ref: ne, children: xe !== null ? /* @__PURE__ */ c("div", { className: f(t.noResults, r?.message), role: "status", children: xe }) : L.map((s, e) => /* @__PURE__ */ c(
266
347
  "button",
267
348
  {
268
- id: `select-option-${n.value}`,
349
+ id: `select-option-${s.value}`,
269
350
  type: "button",
270
351
  role: "option",
271
- "aria-selected": n.value === v,
272
- className: h(
273
- e.item,
274
- n.disabled && e.itemDisabled,
275
- n.value === v && e.itemSelected,
276
- w === c && e.itemHighlighted,
277
- o?.item
352
+ "aria-selected": s.value === u,
353
+ className: f(
354
+ t.item,
355
+ s.disabled && t.itemDisabled,
356
+ s.value === u && t.itemSelected,
357
+ e === I && t.itemHighlighted,
358
+ r?.item
278
359
  ),
279
- disabled: n.disabled,
280
- onClick: () => V(n.value),
281
- onMouseEnter: () => d(w),
282
- children: n.content ?? n.label
360
+ disabled: s.disabled,
361
+ onClick: () => U(s.value),
362
+ onMouseEnter: () => W(e),
363
+ children: We(s, h, pe && !O, r?.match)
283
364
  },
284
- n.value
365
+ s.value
285
366
  )) })
286
367
  }
287
368
  );
288
- return P && typeof document < "u" ? me(l, document.body) : l;
369
+ return F && typeof document < "u" ? Le(p, document.body) : p;
289
370
  })()
290
371
  ]
291
372
  }
292
373
  );
293
374
  }
294
375
  );
295
- ge.displayName = "SearchableSelect";
296
- const ye = ie(
376
+ Be.displayName = "SearchableSelect";
377
+ const Ke = Ne(
297
378
  ({
298
- inputSize: u = "md",
299
- error: p = !1,
300
- options: f = [],
301
- placeholder: I = "Select...",
302
- classes: o,
303
- className: E,
304
- style: A,
305
- value: v,
306
- disabled: g,
307
- id: y,
308
- searchPlaceholder: z,
309
- onValuesChange: x,
310
- clearSearchOnSelect: O = !0,
311
- closeOnSelect: P = !0,
312
- allowCreate: G = !1,
313
- onCreate: k,
314
- createLabel: re,
315
- portal: _ = !0,
316
- onFocus: b,
317
- onBlur: ne,
318
- ...U
319
- }, F) => {
320
- const c = Array.isArray(v) ? v : v ? [v] : [], [d, H] = X(!1), [S, q] = X(""), [D, C] = X(0), j = N(null), K = N(null), J = N(null), le = N(null), Y = N(null), ae = de(), T = he(Y, d && _), { hidden: oe, control: Z } = ve(U), W = be(b, ne, [j, J]), se = N(null), V = (t) => {
321
- se.current = t, typeof F == "function" ? F(t) : F && (F.current = t);
322
- }, m = M(() => {
323
- H(!1), q(""), C(0);
324
- }, []), ee = M(() => {
325
- g || (H(!0), q(""), C(0), setTimeout(() => K.current?.focus(), 0));
326
- }, [g]), $ = M(
327
- (t) => {
328
- const i = c.includes(t) ? c.filter((a) => a !== t) : [...c, t];
329
- x?.(i), P ? m() : O && q("");
379
+ inputSize: n = "md",
380
+ error: a = !1,
381
+ options: d = [],
382
+ placeholder: m = "Select...",
383
+ classes: r,
384
+ className: _,
385
+ style: R,
386
+ value: u,
387
+ disabled: v,
388
+ id: w,
389
+ searchPlaceholder: _e,
390
+ onValuesChange: C,
391
+ clearSearchOnSelect: j = !0,
392
+ closeOnSelect: F = !0,
393
+ allowCreate: fe = !1,
394
+ onCreate: oe,
395
+ createLabel: G,
396
+ portal: J = !0,
397
+ onFocus: Y,
398
+ onBlur: me,
399
+ onSearch: K,
400
+ searchDebounce: he = 250,
401
+ minSearchLength: Z = 0,
402
+ searchPrompt: pe = "Type to search",
403
+ loading: q = !1,
404
+ loadingMessage: ke = "Loading…",
405
+ noResultsMessage: ie = "No results",
406
+ highlightMatches: se = !1,
407
+ selectedLabels: be,
408
+ // Single-mode props: not spread onto the DOM.
409
+ multiple: Re,
410
+ searchable: Ce,
411
+ onChange: H,
412
+ onValueChange: Ie,
413
+ ...ee
414
+ }, O) => {
415
+ const b = !!K, g = Array.isArray(u) ? u : u ? [u] : [], [h, $] = ae(!1), [S, I] = ae(""), W = q || b && S.length < Z, [D, P] = ae(0), te = y(null), Q = y(null), ne = y(null), re = y(null), le = y(null), ge = Ee(), ce = Me(le, h && J), { hidden: ve, control: we } = Te(ee), z = Ae(Y, me, [te, ne]), Se = y(null), ye = (e) => {
416
+ Se.current = e, typeof O == "function" ? O(e) : O && (O.current = e);
417
+ }, x = A(() => {
418
+ $(!1), I(""), P(0);
419
+ }, []), ue = A(() => {
420
+ v || ($(!0), I(""), P(0), setTimeout(() => Q.current?.focus(), 0));
421
+ }, [v]), U = A(
422
+ (e) => {
423
+ const i = g.includes(e) ? g.filter((o) => o !== e) : [...g, e];
424
+ C?.(i), F ? x() : j && I("");
330
425
  },
331
- [c, x, P, m, O]
332
- ), ce = M(
333
- (t, i) => {
334
- i.stopPropagation(), x?.(c.filter((a) => a !== t));
426
+ [g, C, F, x, j]
427
+ ), L = A(
428
+ (e, i) => {
429
+ i.stopPropagation(), C?.(g.filter((o) => o !== e));
335
430
  },
336
- [c, x]
337
- ), r = fe(() => {
338
- if (!S) return f;
339
- const t = S.toLowerCase();
340
- return f.filter((i) => i.label.toLowerCase().includes(t));
341
- }, [f, S]), l = S.trim(), n = G && l.length > 0 && !f.some(
342
- (t) => t.label.toLowerCase() === l.toLowerCase() || t.value === l
343
- ) && !c.includes(l), w = M(() => {
344
- l && (c.includes(l) || (k?.(l), x?.([...c, l]), P ? m() : O && q("")));
345
- }, [l, c, k, x, P, m, O]);
431
+ [g, C]
432
+ ), T = He(d, S, b);
433
+ Fe(K, S, h, he, Z);
434
+ const N = S.trim(), M = fe && N.length > 0 && !d.some(
435
+ (e) => e.label.toLowerCase() === N.toLowerCase() || e.value === N
436
+ ) && !g.includes(N), V = A(() => {
437
+ N && (g.includes(N) || (oe?.(N), C?.([...g, N]), F ? x() : j && I("")));
438
+ }, [N, g, oe, C, F, x, j]);
346
439
  B(() => {
347
- const t = r.findIndex((i) => !i.disabled);
348
- C(t >= 0 ? t : 0);
349
- }, [r]), B(() => {
350
- if (!d) return;
351
- const t = le.current;
352
- if (!t) return;
353
- t.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
354
- }, [D, d]);
355
- const Q = r.length, we = M(
356
- (t) => {
357
- const i = r.map((a, L) => a.disabled ? -1 : L).filter((a) => a >= 0);
358
- if (n && i.push(Q), t.key === "Backspace" && S === "" && c.length > 0) {
359
- t.preventDefault(), x?.(c.slice(0, -1));
440
+ const e = T.findIndex((i) => !i.disabled);
441
+ P(e >= 0 ? e : 0);
442
+ }, [T]), B(() => {
443
+ if (!h) return;
444
+ const e = re.current;
445
+ if (!e) return;
446
+ e.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
447
+ }, [D, h]);
448
+ const X = T.length, xe = A(
449
+ (e) => {
450
+ const i = T.map((o, E) => o.disabled ? -1 : E).filter((o) => o >= 0);
451
+ if (M && i.push(X), e.key === "Backspace" && S === "" && g.length > 0) {
452
+ e.preventDefault(), C?.(g.slice(0, -1));
360
453
  return;
361
454
  }
362
- if (t.key === "Escape") {
363
- if (!d) return;
364
- t.preventDefault(), m();
455
+ if (e.key === "Escape") {
456
+ if (!h) return;
457
+ e.preventDefault(), x();
365
458
  return;
366
459
  }
367
460
  if (i.length !== 0) {
368
- if (t.key === "ArrowDown") {
369
- if (t.preventDefault(), !d) {
370
- ee();
461
+ if (e.key === "ArrowDown") {
462
+ if (e.preventDefault(), !h) {
463
+ ue();
371
464
  return;
372
465
  }
373
- C((a) => {
374
- const L = i.indexOf(a);
375
- return L < i.length - 1 ? i[L + 1] : i[0];
466
+ P((o) => {
467
+ const E = i.indexOf(o);
468
+ return E < i.length - 1 ? i[E + 1] : i[0];
376
469
  });
377
- } else if (t.key === "ArrowUp")
378
- t.preventDefault(), C((a) => {
379
- const L = i.indexOf(a);
380
- return L > 0 ? i[L - 1] : i[i.length - 1];
470
+ } else if (e.key === "ArrowUp")
471
+ e.preventDefault(), P((o) => {
472
+ const E = i.indexOf(o);
473
+ return E > 0 ? i[E - 1] : i[i.length - 1];
381
474
  });
382
- else if (t.key === "Enter") {
383
- if (t.preventDefault(), n && D === Q) {
384
- w();
475
+ else if (e.key === "Enter") {
476
+ if (e.preventDefault(), W) return;
477
+ if (M && D === X) {
478
+ V();
385
479
  return;
386
480
  }
387
- const a = r[D];
388
- a && !a.disabled ? $(a.value) : n && w();
481
+ const o = T[D];
482
+ o && !o.disabled ? U(o.value) : M && V();
389
483
  }
390
484
  }
391
485
  },
392
- [r, D, $, m, S, c, x, d, ee, n, w, Q]
486
+ [T, D, U, x, S, g, C, h, ue, M, V, X, W]
393
487
  );
394
488
  B(() => {
395
- if (!d) return;
396
- const t = (i) => {
397
- const a = i.target;
398
- j.current?.contains(a) || J.current?.contains(a) || m();
489
+ if (!h) return;
490
+ const e = (i) => {
491
+ const o = i.target;
492
+ te.current?.contains(o) || ne.current?.contains(o) || x();
399
493
  };
400
- return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
401
- }, [d, m]);
402
- const ue = c.map((t) => f.find((a) => a.value === t) ?? { value: t, label: t });
403
- return /* @__PURE__ */ R(
494
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
495
+ }, [h, x]);
496
+ const l = g.map((e) => {
497
+ const i = d.find((E) => E.value === e);
498
+ if (i) return i;
499
+ const o = be?.[e];
500
+ return typeof o == "string" ? { value: e, label: o } : { value: e, label: e, content: o };
501
+ }), p = je({
502
+ loading: q,
503
+ loadingMessage: ke,
504
+ remote: b,
505
+ query: S,
506
+ minSearchLength: Z,
507
+ searchPrompt: pe,
508
+ empty: T.length === 0 && !M,
509
+ noResultsMessage: ie
510
+ }), s = p === null;
511
+ return /* @__PURE__ */ k(
404
512
  "div",
405
513
  {
406
- ref: j,
407
- className: h(
408
- e.wrapper,
409
- e.searchableWrapper,
410
- e[u],
411
- p && e.error,
412
- g && e.disabled,
413
- o?.wrapper,
414
- E
514
+ ref: te,
515
+ className: f(
516
+ t.wrapper,
517
+ t.searchableWrapper,
518
+ t[n],
519
+ a && t.error,
520
+ v && t.disabled,
521
+ r?.wrapper,
522
+ _
415
523
  ),
416
- style: A,
417
- ...W,
524
+ style: R,
525
+ ...z,
418
526
  children: [
419
- /* @__PURE__ */ R(
527
+ /* @__PURE__ */ k(
420
528
  "select",
421
529
  {
422
- ref: V,
423
- className: e.hiddenSelect,
530
+ ref: ye,
531
+ className: t.hiddenSelect,
424
532
  multiple: !0,
425
- value: c,
426
- disabled: g,
533
+ value: g,
534
+ disabled: v,
427
535
  tabIndex: -1,
428
536
  "aria-hidden": "true",
429
537
  onChange: () => {
430
538
  },
431
- ...oe,
539
+ ...ve,
432
540
  children: [
433
- f.map((t) => /* @__PURE__ */ s("option", { value: t.value, children: t.label }, t.value)),
434
- ue.filter((t) => !f.some((i) => i.value === t.value)).map((t) => /* @__PURE__ */ s("option", { value: t.value, children: t.label }, t.value))
541
+ d.map((e) => /* @__PURE__ */ c("option", { value: e.value, children: e.label }, e.value)),
542
+ l.filter((e) => !d.some((i) => i.value === e.value)).map((e) => /* @__PURE__ */ c("option", { value: e.value, children: e.label }, e.value))
435
543
  ]
436
544
  }
437
545
  ),
438
- /* @__PURE__ */ R(
546
+ /* @__PURE__ */ k(
439
547
  "div",
440
548
  {
441
- ref: Y,
442
- className: h(
443
- e.multiTrigger,
444
- e[u],
445
- d && e.triggerOpen,
446
- p && e.error,
447
- g && e.multiTriggerDisabled,
448
- o?.root
549
+ ref: le,
550
+ className: f(
551
+ t.multiTrigger,
552
+ t[n],
553
+ h && t.triggerOpen,
554
+ a && t.error,
555
+ v && t.multiTriggerDisabled,
556
+ r?.root
449
557
  ),
450
558
  onClick: () => {
451
- d ? K.current?.focus() : ee();
559
+ h ? Q.current?.focus() : ue();
452
560
  },
453
561
  role: "combobox",
454
- "aria-expanded": d,
562
+ "aria-expanded": h,
455
563
  "aria-haspopup": "listbox",
456
- "aria-controls": d ? ae : void 0,
564
+ "aria-controls": h ? ge : void 0,
457
565
  children: [
458
- ue.map((t) => /* @__PURE__ */ R("span", { className: h(e.chip, o?.chip), children: [
459
- /* @__PURE__ */ s("span", { className: e.chipLabel, children: t.content ?? t.label }),
460
- /* @__PURE__ */ s(
566
+ l.map((e) => /* @__PURE__ */ k("span", { className: f(t.chip, r?.chip), children: [
567
+ /* @__PURE__ */ c("span", { className: t.chipLabel, children: e.content ?? e.label }),
568
+ /* @__PURE__ */ c(
461
569
  "button",
462
570
  {
463
571
  type: "button",
464
- className: h(e.chipRemove, o?.chipRemove),
465
- onClick: (i) => ce(t.value, i),
466
- "aria-label": `Remove ${t.label}`,
572
+ className: f(t.chipRemove, r?.chipRemove),
573
+ onClick: (i) => L(e.value, i),
574
+ "aria-label": `Remove ${e.label}`,
467
575
  tabIndex: -1,
468
576
  children: "×"
469
577
  }
470
578
  )
471
- ] }, t.value)),
472
- /* @__PURE__ */ s(
579
+ ] }, e.value)),
580
+ /* @__PURE__ */ c(
473
581
  "input",
474
582
  {
475
- ref: K,
476
- id: y,
583
+ ref: Q,
584
+ id: w,
477
585
  type: "text",
478
- className: e.multiSearch,
479
- placeholder: c.length === 0 ? I : "",
586
+ className: t.multiSearch,
587
+ placeholder: g.length === 0 ? m : "",
480
588
  value: S,
481
- onChange: (t) => {
482
- q(t.target.value), d || H(!0);
589
+ onChange: (e) => {
590
+ I(e.target.value), h || $(!0);
483
591
  },
484
- onKeyDown: we,
485
- disabled: g,
486
- "aria-label": Z["aria-labelledby"] ? void 0 : "Search options",
487
- ...Z
592
+ onKeyDown: xe,
593
+ disabled: v,
594
+ "aria-label": we["aria-labelledby"] ? void 0 : "Search options",
595
+ ...we
488
596
  }
489
597
  ),
490
- /* @__PURE__ */ s("span", { className: h(e.arrow, e.arrowMulti, o?.arrow) })
598
+ q && /* @__PURE__ */ c(Oe, { size: "sm", label: "", "aria-hidden": "true", className: f(t.spinner, r?.spinner) }),
599
+ /* @__PURE__ */ c("span", { className: f(t.arrow, t.arrowMulti, r?.arrow) })
491
600
  ]
492
601
  }
493
602
  ),
494
- d && (() => {
495
- const t = _ ? {
603
+ h && (() => {
604
+ const e = J ? {
496
605
  position: "fixed",
497
- top: T.top + 4,
498
- left: T.left,
606
+ top: ce.top + 4,
607
+ left: ce.left,
499
608
  right: "auto",
500
- width: T.width,
609
+ width: ce.width,
501
610
  zIndex: "var(--crk-z-floating)"
502
- } : void 0, i = /* @__PURE__ */ s(
611
+ } : void 0, i = /* @__PURE__ */ c(
503
612
  "div",
504
613
  {
505
- id: ae,
506
- ref: J,
507
- className: h(e.menu, o?.menu),
508
- style: t,
614
+ id: ge,
615
+ ref: ne,
616
+ className: f(t.menu, r?.menu),
617
+ style: e,
509
618
  role: "listbox",
510
619
  "aria-multiselectable": "true",
511
- onMouseDown: (a) => a.preventDefault(),
512
- children: /* @__PURE__ */ R("div", { className: e.menuItems, ref: le, children: [
513
- r.length === 0 && !n && /* @__PURE__ */ s("div", { className: e.noResults, children: "No results" }),
514
- r.map((a, L) => {
515
- const te = c.includes(a.value);
516
- return /* @__PURE__ */ R(
620
+ onMouseDown: (o) => o.preventDefault(),
621
+ children: /* @__PURE__ */ k("div", { className: t.menuItems, ref: re, children: [
622
+ p !== null && /* @__PURE__ */ c("div", { className: f(t.noResults, r?.message), role: "status", children: p }),
623
+ s && T.map((o, E) => {
624
+ const de = g.includes(o.value);
625
+ return /* @__PURE__ */ k(
517
626
  "button",
518
627
  {
519
- id: `select-option-${a.value}`,
628
+ id: `select-option-${o.value}`,
520
629
  type: "button",
521
630
  role: "option",
522
- "aria-selected": te,
523
- className: h(
524
- e.item,
525
- a.disabled && e.itemDisabled,
526
- te && e.itemSelected,
527
- L === D && e.itemHighlighted,
528
- o?.item
631
+ "aria-selected": de,
632
+ className: f(
633
+ t.item,
634
+ o.disabled && t.itemDisabled,
635
+ de && t.itemSelected,
636
+ E === D && t.itemHighlighted,
637
+ r?.item
529
638
  ),
530
- disabled: a.disabled,
531
- onClick: () => $(a.value),
532
- onMouseEnter: () => C(L),
639
+ disabled: o.disabled,
640
+ onClick: () => U(o.value),
641
+ onMouseEnter: () => P(E),
533
642
  children: [
534
- te && /* @__PURE__ */ s("span", { className: e.itemCheck, "aria-hidden": "true" }),
535
- a.content ?? a.label
643
+ de && /* @__PURE__ */ c("span", { className: t.itemCheck, "aria-hidden": "true" }),
644
+ We(o, S, se && !b, r?.match)
536
645
  ]
537
646
  },
538
- a.value
647
+ o.value
539
648
  );
540
649
  }),
541
- n && /* @__PURE__ */ s(
650
+ s && M && /* @__PURE__ */ c(
542
651
  "button",
543
652
  {
544
653
  type: "button",
545
654
  role: "option",
546
655
  "aria-selected": !1,
547
- className: h(
548
- e.item,
549
- D === Q && e.itemHighlighted,
550
- o?.item
656
+ className: f(
657
+ t.item,
658
+ D === X && t.itemHighlighted,
659
+ r?.item
551
660
  ),
552
- onClick: w,
553
- onMouseEnter: () => C(Q),
554
- children: re ? re(l) : /* @__PURE__ */ R(xe, { children: [
661
+ onClick: V,
662
+ onMouseEnter: () => P(X),
663
+ children: G ? G(N) : /* @__PURE__ */ k(De, { children: [
555
664
  "Create “",
556
- /* @__PURE__ */ s("strong", { children: l }),
665
+ /* @__PURE__ */ c("strong", { children: N }),
557
666
  "”"
558
667
  ] })
559
668
  },
@@ -562,18 +671,18 @@ const ye = ie(
562
671
  ] })
563
672
  }
564
673
  );
565
- return _ && typeof document < "u" ? me(i, document.body) : i;
674
+ return J && typeof document < "u" ? Le(i, document.body) : i;
566
675
  })()
567
676
  ]
568
677
  }
569
678
  );
570
679
  }
571
680
  );
572
- ye.displayName = "MultiSelect";
573
- const Ne = ie(
574
- (u, p) => u.multiple ? /* @__PURE__ */ s(ye, { ref: p, ...u }) : u.searchable ? /* @__PURE__ */ s(ge, { ref: p, ...u }) : /* @__PURE__ */ s(pe, { ref: p, ...u })
681
+ Ke.displayName = "MultiSelect";
682
+ const Qe = Ne(
683
+ (n, a) => n.multiple ? /* @__PURE__ */ c(Ke, { ref: a, ...n }) : n.searchable ? /* @__PURE__ */ c(Be, { ref: a, ...n }) : /* @__PURE__ */ c(Pe, { ref: a, ...n })
575
684
  );
576
- Ne.displayName = "Select";
685
+ Qe.displayName = "Select";
577
686
  export {
578
- Ne as Select
687
+ Qe as Select
579
688
  };