@cascivo/react 0.12.0 → 0.13.1

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 (237) hide show
  1. package/dist/accordion/accordion.js +46 -44
  2. package/dist/action-sheet/action-sheet.js +16 -16
  3. package/dist/alert-dialog/alert-dialog.js +34 -34
  4. package/dist/app-shell/app-shell.css +1 -1
  5. package/dist/app-shell/app-shell.js +36 -33
  6. package/dist/app-shell/app-shell.module.js +8 -8
  7. package/dist/avatar-group/avatar-group.js +6 -6
  8. package/dist/badge/badge.js +17 -10
  9. package/dist/bottom-sheet/bottom-sheet.js +18 -18
  10. package/dist/button/button.css +1 -1
  11. package/dist/button/button.js +15 -12
  12. package/dist/button/button.module.js +1 -1
  13. package/dist/button-group/button-group.js +8 -8
  14. package/dist/card/card.css +1 -1
  15. package/dist/card/card.module.js +8 -8
  16. package/dist/carousel/carousel.js +20 -20
  17. package/dist/checkbox/checkbox.js +21 -21
  18. package/dist/checkbox-card/checkbox-card.js +15 -13
  19. package/dist/collapsible/collapsible.js +7 -7
  20. package/dist/color-picker/color-picker.js +26 -26
  21. package/dist/combobox/combobox.css +1 -1
  22. package/dist/combobox/combobox.js +86 -86
  23. package/dist/combobox/combobox.module.js +15 -15
  24. package/dist/command-menu/command-menu.js +111 -111
  25. package/dist/comparison/comparison.js +10 -10
  26. package/dist/context-menu/context-menu.js +9 -9
  27. package/dist/copy-button/copy-button.js +18 -16
  28. package/dist/data-table/data-table.css +1 -1
  29. package/dist/data-table/data-table.js +8 -2
  30. package/dist/data-table/data-table.module.js +29 -29
  31. package/dist/date-picker/date-picker.css +1 -1
  32. package/dist/date-picker/date-picker.js +25 -25
  33. package/dist/date-picker/date-picker.module.js +19 -19
  34. package/dist/date-range-picker/date-range-picker.js +26 -26
  35. package/dist/drawer/drawer.css +1 -1
  36. package/dist/drawer/drawer.js +18 -17
  37. package/dist/drawer/drawer.module.js +9 -9
  38. package/dist/dropdown/dropdown.js +48 -48
  39. package/dist/editable/editable.js +11 -11
  40. package/dist/fab/fab.js +53 -53
  41. package/dist/field/field.js +8 -8
  42. package/dist/file-uploader/file-uploader.css +1 -1
  43. package/dist/file-uploader/file-uploader.js +19 -19
  44. package/dist/file-uploader/file-uploader.module.js +14 -14
  45. package/dist/filter/filter.js +10 -9
  46. package/dist/header-panel/header-panel.js +31 -31
  47. package/dist/hover-card/hover-card.js +21 -21
  48. package/dist/icon-button/icon-button.css +1 -1
  49. package/dist/icon-button/icon-button.js +5 -5
  50. package/dist/icon-button/icon-button.module.js +1 -1
  51. package/dist/index.d.ts +1475 -251
  52. package/dist/input/input.css +1 -1
  53. package/dist/input/input.js +22 -21
  54. package/dist/input/input.module.js +5 -5
  55. package/dist/item/item.css +1 -1
  56. package/dist/item/item.module.js +6 -6
  57. package/dist/layouts/src/page-header/page-header.css +1 -0
  58. package/dist/layouts/src/page-header/page-header.js +33 -0
  59. package/dist/layouts/src/page-header/page-header.module.js +13 -0
  60. package/dist/link/link.js +14 -12
  61. package/dist/log-viewer/log-viewer.js +26 -26
  62. package/dist/menu/menu.js +20 -20
  63. package/dist/menu-button/menu-button.js +48 -48
  64. package/dist/menubar/menubar.js +42 -42
  65. package/dist/modal/modal.css +1 -1
  66. package/dist/modal/modal.js +41 -35
  67. package/dist/modal/modal.module.js +8 -7
  68. package/dist/multi-select/multi-select.css +1 -1
  69. package/dist/multi-select/multi-select.js +57 -57
  70. package/dist/multi-select/multi-select.module.js +11 -11
  71. package/dist/native-select/native-select.js +13 -11
  72. package/dist/navigation-menu/navigation-menu.js +46 -46
  73. package/dist/node/accordion/accordion.js +46 -44
  74. package/dist/node/action-sheet/action-sheet.js +16 -16
  75. package/dist/node/alert-dialog/alert-dialog.js +34 -34
  76. package/dist/node/app-shell/app-shell.js +36 -33
  77. package/dist/node/app-shell/app-shell.module.js +8 -8
  78. package/dist/node/avatar-group/avatar-group.js +6 -6
  79. package/dist/node/badge/badge.js +17 -10
  80. package/dist/node/bottom-sheet/bottom-sheet.js +18 -18
  81. package/dist/node/button/button.js +15 -12
  82. package/dist/node/button/button.module.js +1 -1
  83. package/dist/node/button-group/button-group.js +8 -8
  84. package/dist/node/card/card.module.js +8 -8
  85. package/dist/node/carousel/carousel.js +20 -20
  86. package/dist/node/checkbox/checkbox.js +21 -21
  87. package/dist/node/checkbox-card/checkbox-card.js +15 -13
  88. package/dist/node/collapsible/collapsible.js +7 -7
  89. package/dist/node/color-picker/color-picker.js +26 -26
  90. package/dist/node/combobox/combobox.js +86 -86
  91. package/dist/node/combobox/combobox.module.js +15 -15
  92. package/dist/node/command-menu/command-menu.js +111 -111
  93. package/dist/node/comparison/comparison.js +10 -10
  94. package/dist/node/context-menu/context-menu.js +9 -9
  95. package/dist/node/copy-button/copy-button.js +18 -16
  96. package/dist/node/data-table/data-table.js +8 -2
  97. package/dist/node/data-table/data-table.module.js +29 -29
  98. package/dist/node/date-picker/date-picker.js +25 -25
  99. package/dist/node/date-picker/date-picker.module.js +19 -19
  100. package/dist/node/date-range-picker/date-range-picker.js +26 -26
  101. package/dist/node/drawer/drawer.js +18 -17
  102. package/dist/node/drawer/drawer.module.js +9 -9
  103. package/dist/node/dropdown/dropdown.js +48 -48
  104. package/dist/node/editable/editable.js +11 -11
  105. package/dist/node/fab/fab.js +53 -53
  106. package/dist/node/field/field.js +8 -8
  107. package/dist/node/file-uploader/file-uploader.js +19 -19
  108. package/dist/node/file-uploader/file-uploader.module.js +14 -14
  109. package/dist/node/filter/filter.js +10 -9
  110. package/dist/node/header-panel/header-panel.js +31 -31
  111. package/dist/node/hover-card/hover-card.js +21 -21
  112. package/dist/node/icon-button/icon-button.js +5 -5
  113. package/dist/node/icon-button/icon-button.module.js +1 -1
  114. package/dist/node/input/input.js +22 -21
  115. package/dist/node/input/input.module.js +5 -5
  116. package/dist/node/item/item.module.js +6 -6
  117. package/dist/node/layouts/src/page-header/page-header.js +33 -0
  118. package/dist/node/layouts/src/page-header/page-header.module.js +12 -0
  119. package/dist/node/link/link.js +14 -12
  120. package/dist/node/log-viewer/log-viewer.js +26 -26
  121. package/dist/node/menu/menu.js +20 -20
  122. package/dist/node/menu-button/menu-button.js +48 -48
  123. package/dist/node/menubar/menubar.js +42 -42
  124. package/dist/node/modal/modal.js +41 -35
  125. package/dist/node/modal/modal.module.js +8 -7
  126. package/dist/node/multi-select/multi-select.js +57 -57
  127. package/dist/node/multi-select/multi-select.module.js +11 -11
  128. package/dist/node/native-select/native-select.js +13 -11
  129. package/dist/node/navigation-menu/navigation-menu.js +46 -46
  130. package/dist/node/notification/notification.js +50 -44
  131. package/dist/node/notification/notification.module.js +7 -7
  132. package/dist/node/number-input/number-input.js +52 -50
  133. package/dist/node/number-input/number-input.module.js +8 -8
  134. package/dist/node/otp-input/otp-input.js +8 -8
  135. package/dist/node/otp-input/otp-input.module.js +2 -2
  136. package/dist/node/overflow-menu/overflow-menu.js +18 -13
  137. package/dist/node/password-input/password-input.js +28 -27
  138. package/dist/node/password-input/password-input.module.js +7 -7
  139. package/dist/node/popover/popover.js +26 -24
  140. package/dist/node/progress/progress.js +3 -2
  141. package/dist/node/pull-to-refresh/pull-to-refresh.js +13 -13
  142. package/dist/node/radial-progress/radial-progress.js +5 -5
  143. package/dist/node/radio/radio.js +23 -22
  144. package/dist/node/radio-card/radio-card.js +27 -26
  145. package/dist/node/react/src/index.js +4 -3
  146. package/dist/node/react/src/theme.js +30 -19
  147. package/dist/node/resizable/resizable.js +11 -11
  148. package/dist/node/scroll-area/scroll-area.js +4 -4
  149. package/dist/node/search/search.js +49 -49
  150. package/dist/node/search/search.module.js +5 -5
  151. package/dist/node/select/select.js +27 -26
  152. package/dist/node/sheet/sheet.js +11 -10
  153. package/dist/node/sheet/sheet.module.js +5 -5
  154. package/dist/node/side-nav/side-nav.js +91 -91
  155. package/dist/node/skip-nav/skip-nav.js +12 -12
  156. package/dist/node/slider/slider.js +13 -11
  157. package/dist/node/stat/stat.js +6 -5
  158. package/dist/node/stat/stat.module.js +7 -7
  159. package/dist/node/status/status.js +18 -11
  160. package/dist/node/steps/steps.js +23 -23
  161. package/dist/node/structured-list/structured-list.js +33 -32
  162. package/dist/node/tabs/tabs.js +49 -47
  163. package/dist/node/tag/tag.js +22 -15
  164. package/dist/node/tags-input/tags-input.js +35 -35
  165. package/dist/node/tags-input/tags-input.module.js +4 -4
  166. package/dist/node/textarea/textarea.js +22 -21
  167. package/dist/node/tile/tile.module.js +3 -3
  168. package/dist/node/time-picker/time-picker.js +22 -21
  169. package/dist/node/time-picker/time-picker.module.js +5 -5
  170. package/dist/node/timeline/timeline.js +22 -16
  171. package/dist/node/toast/toast.js +15 -15
  172. package/dist/node/toc/toc.js +8 -8
  173. package/dist/node/toggle/toggle.js +15 -13
  174. package/dist/node/toggle-group/toggle-group.js +10 -10
  175. package/dist/node/toggletip/toggletip.js +9 -9
  176. package/dist/node/tooltip/tooltip.js +5 -5
  177. package/dist/node/tree-view/tree-view.js +32 -32
  178. package/dist/notification/notification.css +1 -1
  179. package/dist/notification/notification.js +50 -44
  180. package/dist/notification/notification.module.js +7 -7
  181. package/dist/number-input/number-input.css +1 -1
  182. package/dist/number-input/number-input.js +52 -50
  183. package/dist/number-input/number-input.module.js +8 -8
  184. package/dist/otp-input/otp-input.css +1 -1
  185. package/dist/otp-input/otp-input.js +8 -8
  186. package/dist/otp-input/otp-input.module.js +2 -2
  187. package/dist/overflow-menu/overflow-menu.js +18 -13
  188. package/dist/password-input/password-input.css +1 -1
  189. package/dist/password-input/password-input.js +28 -27
  190. package/dist/password-input/password-input.module.js +7 -7
  191. package/dist/popover/popover.js +26 -24
  192. package/dist/progress/progress.js +3 -2
  193. package/dist/pull-to-refresh/pull-to-refresh.js +13 -13
  194. package/dist/radial-progress/radial-progress.js +5 -5
  195. package/dist/radio/radio.js +23 -22
  196. package/dist/radio-card/radio-card.js +27 -26
  197. package/dist/react/src/index.js +4 -3
  198. package/dist/react/src/theme.js +30 -19
  199. package/dist/resizable/resizable.js +11 -11
  200. package/dist/scroll-area/scroll-area.js +4 -4
  201. package/dist/search/search.css +1 -1
  202. package/dist/search/search.js +49 -49
  203. package/dist/search/search.module.js +5 -5
  204. package/dist/select/select.js +27 -26
  205. package/dist/sheet/sheet.css +1 -1
  206. package/dist/sheet/sheet.js +11 -10
  207. package/dist/sheet/sheet.module.js +5 -5
  208. package/dist/side-nav/side-nav.js +91 -91
  209. package/dist/skip-nav/skip-nav.js +12 -12
  210. package/dist/slider/slider.js +13 -11
  211. package/dist/stat/stat.css +1 -1
  212. package/dist/stat/stat.js +6 -5
  213. package/dist/stat/stat.module.js +7 -7
  214. package/dist/status/status.js +18 -11
  215. package/dist/steps/steps.js +23 -23
  216. package/dist/structured-list/structured-list.js +33 -32
  217. package/dist/styles.css +87 -23
  218. package/dist/tabs/tabs.js +49 -47
  219. package/dist/tag/tag.js +22 -15
  220. package/dist/tags-input/tags-input.css +1 -1
  221. package/dist/tags-input/tags-input.js +35 -35
  222. package/dist/tags-input/tags-input.module.js +4 -4
  223. package/dist/textarea/textarea.js +22 -21
  224. package/dist/tile/tile.css +1 -1
  225. package/dist/tile/tile.module.js +3 -3
  226. package/dist/time-picker/time-picker.css +1 -1
  227. package/dist/time-picker/time-picker.js +22 -21
  228. package/dist/time-picker/time-picker.module.js +5 -5
  229. package/dist/timeline/timeline.js +22 -16
  230. package/dist/toast/toast.js +15 -15
  231. package/dist/toc/toc.js +8 -8
  232. package/dist/toggle/toggle.js +15 -13
  233. package/dist/toggle-group/toggle-group.js +10 -10
  234. package/dist/toggletip/toggletip.js +9 -9
  235. package/dist/tooltip/tooltip.js +5 -5
  236. package/dist/tree-view/tree-view.js +32 -32
  237. package/package.json +10 -4
@@ -2,9 +2,9 @@
2
2
 
3
3
  import e from "./color-picker.module.js";
4
4
  import { cn as t, useControllableSignal as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
5
- import { builtin as o, t as s } from "@cascivo/i18n";
6
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
- import { useId as d, useRef as f } from "react";
5
+ import { useId as o, useRef as s } from "react";
6
+ import { builtin as c, t as l } from "@cascivo/i18n";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
8
  //#region ../components/src/color-picker/color-picker.tsx
9
9
  function p(e, t, n) {
10
10
  return Math.min(n, Math.max(t, e));
@@ -75,11 +75,11 @@ function _({ h: e, s: t, l: n, a: r }) {
75
75
  }
76
76
  function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S = !0, label: C, disabled: w, size: T = "md", className: E, labels: D }) {
77
77
  a();
78
- let O = d(), [k, A] = n({
78
+ let O = o(), [k, A] = n({
79
79
  value: v,
80
80
  defaultValue: y ?? "#3b82f6",
81
81
  onChange: b
82
- }), j = f(null), M = r(!1), N = g(m(k.value)), P = (e) => {
82
+ }), j = s(null), M = r(!1), N = g(m(k.value)), P = (e) => {
83
83
  A(h(_(e), S));
84
84
  }, F = (e, t) => {
85
85
  let n = j.current;
@@ -119,22 +119,22 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
119
119
  }, R = typeof window < "u" ? window.EyeDropper : void 0, z = () => {
120
120
  R && new R().open().then((e) => A(e.sRGBHex));
121
121
  }, B = {
122
- hue: D?.hue ?? s(o.colorPicker.hue),
123
- alpha: D?.alpha ?? s(o.colorPicker.alpha),
124
- colorArea: D?.colorArea ?? s(o.colorPicker.colorArea),
125
- eyedropper: D?.eyedropper ?? s(o.colorPicker.eyedropper)
122
+ hue: D?.hue ?? l(c.colorPicker.hue),
123
+ alpha: D?.alpha ?? l(c.colorPicker.alpha),
124
+ colorArea: D?.colorArea ?? l(c.colorPicker.colorArea),
125
+ eyedropper: D?.eyedropper ?? l(c.colorPicker.eyedropper)
126
126
  }, V = h(m(k.value), !1), H = `hsl(${N.h} 100% 50%)`;
127
- return /* @__PURE__ */ u("div", {
127
+ return /* @__PURE__ */ f("div", {
128
128
  className: t(e.picker, E),
129
129
  "data-size": T,
130
130
  "data-disabled": w || void 0,
131
131
  children: [
132
- C && /* @__PURE__ */ l("span", {
132
+ C && /* @__PURE__ */ d("span", {
133
133
  className: e.label,
134
134
  id: `${O}-label`,
135
135
  children: C
136
136
  }),
137
- /* @__PURE__ */ l("div", {
137
+ /* @__PURE__ */ d("div", {
138
138
  ref: j,
139
139
  className: e.area,
140
140
  role: "slider",
@@ -147,7 +147,7 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
147
147
  w || (e.preventDefault(), M.value = !0, F(e.clientX, e.clientY));
148
148
  },
149
149
  onKeyDown: I,
150
- children: /* @__PURE__ */ l("span", {
150
+ children: /* @__PURE__ */ d("span", {
151
151
  className: e.thumb,
152
152
  style: {
153
153
  insetInlineStart: `${N.s}%`,
@@ -156,15 +156,15 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
156
156
  }
157
157
  })
158
158
  }),
159
- /* @__PURE__ */ u("div", {
159
+ /* @__PURE__ */ f("div", {
160
160
  className: e.sliders,
161
161
  children: [
162
- /* @__PURE__ */ l("label", {
162
+ /* @__PURE__ */ d("label", {
163
163
  className: e.srOnly,
164
164
  htmlFor: `${O}-hue`,
165
165
  children: B.hue
166
166
  }),
167
- /* @__PURE__ */ l("input", {
167
+ /* @__PURE__ */ d("input", {
168
168
  id: `${O}-hue`,
169
169
  className: e.hue,
170
170
  type: "range",
@@ -181,11 +181,11 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
181
181
  a: N.a
182
182
  })
183
183
  }),
184
- S && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("label", {
184
+ S && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("label", {
185
185
  className: e.srOnly,
186
186
  htmlFor: `${O}-alpha`,
187
187
  children: B.alpha
188
- }), /* @__PURE__ */ l("input", {
188
+ }), /* @__PURE__ */ d("input", {
189
189
  id: `${O}-alpha`,
190
190
  className: e.alpha,
191
191
  type: "range",
@@ -205,11 +205,11 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
205
205
  })] })
206
206
  ]
207
207
  }),
208
- x && x.length > 0 && /* @__PURE__ */ l("div", {
208
+ x && x.length > 0 && /* @__PURE__ */ d("div", {
209
209
  className: e.presets,
210
210
  role: "group",
211
211
  "aria-label": B.colorArea,
212
- children: x.map((t, n) => /* @__PURE__ */ l("button", {
212
+ children: x.map((t, n) => /* @__PURE__ */ d("button", {
213
213
  type: "button",
214
214
  className: e.preset,
215
215
  style: { backgroundColor: t },
@@ -222,15 +222,15 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
222
222
  }
223
223
  }, t))
224
224
  }),
225
- /* @__PURE__ */ u("div", {
225
+ /* @__PURE__ */ f("div", {
226
226
  className: e.row,
227
227
  children: [
228
- /* @__PURE__ */ l("span", {
228
+ /* @__PURE__ */ d("span", {
229
229
  className: e.preview,
230
230
  style: { backgroundColor: k.value },
231
231
  "aria-hidden": "true"
232
232
  }),
233
- /* @__PURE__ */ l("input", {
233
+ /* @__PURE__ */ d("input", {
234
234
  className: e.text,
235
235
  type: "text",
236
236
  value: k.value,
@@ -238,19 +238,19 @@ function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S =
238
238
  "aria-label": C ?? B.colorArea,
239
239
  onChange: (e) => A(e.target.value)
240
240
  }),
241
- R && /* @__PURE__ */ l("button", {
241
+ R && /* @__PURE__ */ d("button", {
242
242
  type: "button",
243
243
  className: e.eyedropper,
244
244
  "aria-label": B.eyedropper,
245
245
  disabled: w,
246
246
  onClick: z,
247
- children: /* @__PURE__ */ l("svg", {
247
+ children: /* @__PURE__ */ d("svg", {
248
248
  width: "16",
249
249
  height: "16",
250
250
  viewBox: "0 0 24 24",
251
251
  fill: "none",
252
252
  "aria-hidden": "true",
253
- children: /* @__PURE__ */ l("path", {
253
+ children: /* @__PURE__ */ d("path", {
254
254
  d: "m2 22 1-1h3l9-9M3 21v-3l9-9m1.5 1.5-2-2M19 2l3 3-9 9-3-3z",
255
255
  stroke: "currentColor",
256
256
  strokeWidth: "2",
@@ -1,164 +1,164 @@
1
1
  "use client";
2
2
 
3
3
  import e from "./combobox.module.js";
4
- import { cn as t, createMachine as n, useMachine as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
5
- import { builtin as s, t as c } from "@cascivo/i18n";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
- import { useId as d, useRef as f } from "react";
4
+ import { cn as t, createMachine as n, focusElement as r, useMachine as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
5
+ import { useId as c, useRef as l } from "react";
6
+ import { builtin as u, t as d } from "@cascivo/i18n";
7
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
8
8
  //#region ../components/src/combobox/combobox.tsx
9
- var p = n({
9
+ var m = n({
10
10
  initial: "closed",
11
11
  states: {
12
12
  closed: { on: { OPEN: "open" } },
13
13
  open: { on: { CLOSE: "closed" } }
14
14
  }
15
15
  });
16
- function m({ options: n, value: m, defaultValue: h, onValueChange: g, onChange: _, clearable: v = !1, searchable: y = !0, label: b, hint: x, error: S, size: C = "md", disabled: w = !1, labels: T, className: E, id: D }) {
17
- o();
18
- let [O, k] = r(p), A = d(), j = D ?? `cascade-combobox-${A}`, M = `${A}-listbox`, N = f(null), P = T?.placeholder ?? c(s.combobox.placeholder), F = T?.empty ?? c(s.combobox.empty), I = T?.clear ?? c(s.combobox.clear), L = T?.search ?? c(s.combobox.search), R = i(m ?? h);
19
- m !== void 0 && (R.value = m);
20
- let z = i(""), B = i(0), V = O.value === "open", H = n.filter((e) => !y || !z.value ? !0 : e.label.toLowerCase().includes(z.value.toLowerCase())), U = n.find((e) => e.value === R.value);
21
- a(() => {
22
- if (!V) return;
16
+ function h({ options: n, value: h, defaultValue: g, onValueChange: _, onChange: v, clearable: y = !1, searchable: b = !0, label: x, hint: S, error: C, size: w = "md", disabled: T = !1, labels: E, className: D, id: O }) {
17
+ s();
18
+ let [k, A] = i(m), j = c(), M = O ?? `cascade-combobox-${j}`, N = `${j}-listbox`, P = l(null), F = E?.placeholder ?? d(u.combobox.placeholder), I = E?.empty ?? d(u.combobox.empty), L = E?.clear ?? d(u.combobox.clear), R = E?.search ?? d(u.combobox.search), z = a(h ?? g);
19
+ h !== void 0 && (z.value = h);
20
+ let B = a(""), V = a(0), H = k.value === "open", U = n.filter((e) => !b || !B.value ? !0 : e.label.toLowerCase().includes(B.value.toLowerCase())), W = n.find((e) => e.value === z.value);
21
+ o(() => {
22
+ if (!H) return;
23
23
  let e = (e) => {
24
- let t = document.getElementById(`${A}-root`);
25
- t && !t.contains(e.target) && k("CLOSE");
24
+ let t = document.getElementById(`${j}-root`);
25
+ t && !t.contains(e.target) && A("CLOSE");
26
26
  };
27
27
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
28
28
  });
29
- let W = () => {
30
- w || (z.value = "", B.value = 0, k("OPEN"), setTimeout(() => N.current?.focus(), 0));
31
- }, G = () => {
32
- k("CLOSE"), z.value = "";
33
- }, K = g ?? _, q = (e) => {
34
- m === void 0 && (R.value = e), K?.(e), G();
35
- }, J = () => {
36
- m === void 0 && (R.value = void 0), K?.(void 0);
37
- }, Y = H.flatMap((e, t) => e.disabled ? [] : [t]), X = (e) => {
38
- if (Y.length === 0) return;
39
- let t = Y[(Y.indexOf(B.value) + e + Y.length) % Y.length];
40
- t !== void 0 && (B.value = t);
41
- }, Z = (e) => {
42
- (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), W());
29
+ let G = () => {
30
+ T || (B.value = "", V.value = 0, A("OPEN"), setTimeout(() => r(P.current), 0));
31
+ }, K = () => {
32
+ A("CLOSE"), B.value = "";
33
+ }, q = _ ?? v, J = (e) => {
34
+ h === void 0 && (z.value = e), q?.(e), K();
35
+ }, Y = () => {
36
+ h === void 0 && (z.value = void 0), q?.(void 0);
37
+ }, X = U.flatMap((e, t) => e.disabled ? [] : [t]), Z = (e) => {
38
+ if (X.length === 0) return;
39
+ let t = X[(X.indexOf(V.value) + e + X.length) % X.length];
40
+ t !== void 0 && (V.value = t);
43
41
  }, Q = (e) => {
42
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), G());
43
+ }, ee = (e) => {
44
44
  switch (e.key) {
45
45
  case "ArrowDown":
46
- e.preventDefault(), X(1);
46
+ e.preventDefault(), Z(1);
47
47
  break;
48
48
  case "ArrowUp":
49
- e.preventDefault(), X(-1);
49
+ e.preventDefault(), Z(-1);
50
50
  break;
51
51
  case "Enter": {
52
52
  e.preventDefault();
53
- let t = H[B.value];
54
- t && !t.disabled && q(t.value);
53
+ let t = U[V.value];
54
+ t && !t.disabled && J(t.value);
55
55
  break;
56
56
  }
57
57
  case "Escape":
58
- e.preventDefault(), G();
58
+ e.preventDefault(), K();
59
59
  break;
60
60
  case "Tab":
61
- G();
61
+ K();
62
62
  break;
63
63
  }
64
- }, $ = (e) => `${A}-option-${e}`;
65
- return /* @__PURE__ */ u("div", {
66
- id: `${A}-root`,
67
- className: t(e.wrapper, E),
68
- "data-state": S ? "error" : O.value,
69
- "data-size": C,
64
+ }, $ = (e) => `${j}-option-${e}`;
65
+ return /* @__PURE__ */ p("div", {
66
+ id: `${j}-root`,
67
+ className: t(e.wrapper, D),
68
+ "data-state": C ? "error" : k.value,
69
+ "data-size": w,
70
70
  children: [
71
- b && /* @__PURE__ */ l("label", {
71
+ x && /* @__PURE__ */ f("label", {
72
72
  className: e.label,
73
- htmlFor: j,
74
- children: b
73
+ htmlFor: M,
74
+ children: x
75
75
  }),
76
- /* @__PURE__ */ u("div", {
76
+ /* @__PURE__ */ p("div", {
77
77
  className: e.field,
78
- children: [/* @__PURE__ */ u("button", {
79
- id: j,
78
+ children: [/* @__PURE__ */ p("button", {
79
+ id: M,
80
80
  type: "button",
81
81
  role: "combobox",
82
- "aria-expanded": V,
83
- "aria-controls": M,
82
+ "aria-expanded": H,
83
+ "aria-controls": N,
84
84
  "aria-haspopup": "listbox",
85
- "aria-activedescendant": V && B.value >= 0 ? $(B.value) : void 0,
86
- "aria-invalid": S ? !0 : void 0,
87
- "aria-describedby": S ? `${A}-error` : x ? `${A}-hint` : void 0,
85
+ "aria-activedescendant": H && V.value >= 0 ? $(V.value) : void 0,
86
+ "aria-invalid": C ? !0 : void 0,
87
+ "aria-describedby": C ? `${j}-error` : S ? `${j}-hint` : void 0,
88
88
  className: e.trigger,
89
- disabled: w,
90
- onKeyDown: Z,
91
- onClick: V ? G : W,
92
- children: [/* @__PURE__ */ l("span", {
93
- className: t(e.value, U ? void 0 : e.placeholder),
94
- children: U?.label ?? P
95
- }), /* @__PURE__ */ l("span", {
89
+ disabled: T,
90
+ onKeyDown: Q,
91
+ onClick: H ? K : G,
92
+ children: [/* @__PURE__ */ f("span", {
93
+ className: t(e.value, W ? void 0 : e.placeholder),
94
+ children: W?.label ?? F
95
+ }), /* @__PURE__ */ f("span", {
96
96
  className: e.chevron,
97
97
  "aria-hidden": "true"
98
98
  })]
99
- }), v && R.value !== void 0 && /* @__PURE__ */ l("button", {
99
+ }), y && z.value !== void 0 && /* @__PURE__ */ f("button", {
100
100
  type: "button",
101
101
  className: e.clear,
102
- "aria-label": I,
102
+ "aria-label": L,
103
103
  onClick: (e) => {
104
- e.stopPropagation(), J();
104
+ e.stopPropagation(), Y();
105
105
  },
106
106
  children: "✕"
107
107
  })]
108
108
  }),
109
- /* @__PURE__ */ u("div", {
109
+ /* @__PURE__ */ p("div", {
110
110
  role: "listbox",
111
- id: M,
111
+ id: N,
112
112
  className: e.listbox,
113
- "data-state": V ? "open" : "closed",
114
- "aria-label": b,
115
- children: [y && V && /* @__PURE__ */ l("div", {
113
+ "data-state": H ? "open" : "closed",
114
+ "aria-label": x,
115
+ children: [b && H && /* @__PURE__ */ f("div", {
116
116
  className: e.searchWrapper,
117
- children: /* @__PURE__ */ l("input", {
118
- ref: N,
117
+ children: /* @__PURE__ */ f("input", {
118
+ ref: P,
119
119
  type: "text",
120
120
  className: e.search,
121
- value: z.value,
121
+ value: B.value,
122
122
  onChange: (e) => {
123
- z.value = e.target.value, B.value = 0;
123
+ B.value = e.target.value, V.value = 0;
124
124
  },
125
- onKeyDown: Q,
126
- "aria-label": L,
125
+ onKeyDown: ee,
126
+ "aria-label": R,
127
127
  autoComplete: "off"
128
128
  })
129
- }), H.length === 0 ? /* @__PURE__ */ l("div", {
129
+ }), U.length === 0 ? /* @__PURE__ */ f("div", {
130
130
  className: e.empty,
131
- children: F
132
- }) : H.map((t, n) => /* @__PURE__ */ l("div", {
131
+ children: I
132
+ }) : U.map((t, n) => /* @__PURE__ */ f("div", {
133
133
  id: $(n),
134
134
  role: "option",
135
- "aria-selected": t.value === R.value,
135
+ "aria-selected": t.value === z.value,
136
136
  "aria-disabled": t.disabled || void 0,
137
- "data-state": n === B.value ? "active" : void 0,
137
+ "data-state": n === V.value ? "active" : void 0,
138
138
  "data-disabled": t.disabled || void 0,
139
139
  className: e.option,
140
140
  onMouseEnter: () => {
141
- t.disabled || (B.value = n);
141
+ t.disabled || (V.value = n);
142
142
  },
143
143
  onClick: () => {
144
- t.disabled || q(t.value);
144
+ t.disabled || J(t.value);
145
145
  },
146
146
  children: t.label
147
147
  }, t.value))]
148
148
  }),
149
- S && /* @__PURE__ */ l("span", {
150
- id: `${A}-error`,
149
+ C && /* @__PURE__ */ f("span", {
150
+ id: `${j}-error`,
151
151
  className: e.error,
152
152
  role: "alert",
153
- children: S
153
+ children: C
154
154
  }),
155
- !S && x && /* @__PURE__ */ l("span", {
156
- id: `${A}-hint`,
155
+ !C && S && /* @__PURE__ */ f("span", {
156
+ id: `${j}-hint`,
157
157
  className: e.hint,
158
- children: x
158
+ children: S
159
159
  })
160
160
  ]
161
161
  });
162
162
  }
163
163
  //#endregion
164
- export { m as Combobox };
164
+ export { h as Combobox };
@@ -1,21 +1,21 @@
1
1
  "use client";
2
2
 
3
3
  var e = {
4
- wrapper: "_wrapper_bi94t_2",
5
- label: "_label_bi94t_10",
6
- field: "_field_bi94t_16",
7
- trigger: "_trigger_bi94t_22",
8
- value: "_value_bi94t_70",
9
- placeholder: "_placeholder_bi94t_76",
10
- chevron: "_chevron_bi94t_80",
11
- clear: "_clear_bi94t_96",
12
- listbox: "_listbox_bi94t_122",
13
- searchWrapper: "_searchWrapper_bi94t_156",
14
- search: "_search_bi94t_156",
15
- option: "_option_bi94t_178",
16
- empty: "_empty_bi94t_201",
17
- error: "_error_bi94t_208",
18
- hint: "_hint_bi94t_213"
4
+ wrapper: "_wrapper_11nor_2",
5
+ label: "_label_11nor_14",
6
+ field: "_field_11nor_20",
7
+ trigger: "_trigger_11nor_26",
8
+ value: "_value_11nor_74",
9
+ placeholder: "_placeholder_11nor_80",
10
+ chevron: "_chevron_11nor_84",
11
+ clear: "_clear_11nor_100",
12
+ listbox: "_listbox_11nor_126",
13
+ searchWrapper: "_searchWrapper_11nor_160",
14
+ search: "_search_11nor_160",
15
+ option: "_option_11nor_182",
16
+ empty: "_empty_11nor_205",
17
+ error: "_error_11nor_212",
18
+ hint: "_hint_11nor_217"
19
19
  };
20
20
  //#endregion
21
21
  export { e as default };