zaravand-ui 6.0.0 → 7.0.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 (198) hide show
  1. package/dist/components/Accordion/Accordion.cjs +1 -1
  2. package/dist/components/Accordion/Accordion.interface.d.cts +8 -0
  3. package/dist/components/Accordion/Accordion.interface.d.ts +8 -0
  4. package/dist/components/Accordion/Accordion.js +226 -148
  5. package/dist/components/Accordion/Accordion.variant.cjs +1 -1
  6. package/dist/components/Accordion/Accordion.variant.js +2 -2
  7. package/dist/components/Avatar/Avatar.cjs +1 -1
  8. package/dist/components/Avatar/Avatar.js +32 -32
  9. package/dist/components/Button/Button.cjs +1 -1
  10. package/dist/components/Button/Button.interface.d.cts +0 -1
  11. package/dist/components/Button/Button.interface.d.ts +0 -1
  12. package/dist/components/Button/Button.js +41 -42
  13. package/dist/components/Button/Button.variant.cjs +1 -1
  14. package/dist/components/Button/Button.variant.d.cts +0 -1
  15. package/dist/components/Button/Button.variant.d.ts +0 -1
  16. package/dist/components/Button/Button.variant.js +2 -4
  17. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  18. package/dist/components/Checkbox/Checkbox.interface.d.cts +11 -0
  19. package/dist/components/Checkbox/Checkbox.interface.d.ts +11 -0
  20. package/dist/components/Checkbox/Checkbox.js +66 -43
  21. package/dist/components/Checkbox/Checkbox.variant.cjs +1 -1
  22. package/dist/components/Checkbox/Checkbox.variant.d.cts +9 -4
  23. package/dist/components/Checkbox/Checkbox.variant.d.ts +9 -4
  24. package/dist/components/Checkbox/Checkbox.variant.js +20 -16
  25. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  26. package/dist/components/DatePicker/DatePicker.interface.d.cts +0 -1
  27. package/dist/components/DatePicker/DatePicker.interface.d.ts +0 -1
  28. package/dist/components/DatePicker/DatePicker.js +511 -407
  29. package/dist/components/DatePicker/DatePicker.utils.cjs +1 -1
  30. package/dist/components/DatePicker/DatePicker.utils.js +101 -82
  31. package/dist/components/DatePicker/DatePicker.variant.cjs +1 -1
  32. package/dist/components/DatePicker/DatePicker.variant.d.cts +1 -3
  33. package/dist/components/DatePicker/DatePicker.variant.d.ts +1 -3
  34. package/dist/components/DatePicker/DatePicker.variant.js +14 -16
  35. package/dist/components/DatePicker/DatePickerMonthSlider.cjs +1 -0
  36. package/dist/components/DatePicker/DatePickerMonthSlider.d.cts +25 -0
  37. package/dist/components/DatePicker/DatePickerMonthSlider.d.ts +25 -0
  38. package/dist/components/DatePicker/DatePickerMonthSlider.js +98 -0
  39. package/dist/components/DatePicker/DatePickerWheel.cjs +1 -0
  40. package/dist/components/DatePicker/DatePickerWheel.d.cts +30 -0
  41. package/dist/components/DatePicker/DatePickerWheel.d.ts +30 -0
  42. package/dist/components/DatePicker/DatePickerWheel.js +156 -0
  43. package/dist/components/Dialog/Dialog.cjs +1 -1
  44. package/dist/components/Dialog/Dialog.interface.d.cts +5 -0
  45. package/dist/components/Dialog/Dialog.interface.d.ts +5 -0
  46. package/dist/components/Dialog/Dialog.js +57 -49
  47. package/dist/components/Dialog/Dialog.variant.cjs +1 -1
  48. package/dist/components/Dialog/Dialog.variant.js +1 -1
  49. package/dist/components/Dialog/DialogDragHandle.cjs +1 -0
  50. package/dist/components/Dialog/DialogDragHandle.d.cts +11 -0
  51. package/dist/components/Dialog/DialogDragHandle.d.ts +11 -0
  52. package/dist/components/Dialog/DialogDragHandle.js +55 -0
  53. package/dist/components/Input/Input.cjs +1 -1
  54. package/dist/components/Input/Input.js +38 -37
  55. package/dist/components/Input/Input.variant.cjs +1 -1
  56. package/dist/components/Input/Input.variant.d.cts +1 -3
  57. package/dist/components/Input/Input.variant.d.ts +1 -3
  58. package/dist/components/Input/Input.variant.js +9 -8
  59. package/dist/components/Pagination/Pagination.cjs +1 -1
  60. package/dist/components/Pagination/Pagination.js +90 -73
  61. package/dist/components/Pagination/Pagination.variant.cjs +1 -1
  62. package/dist/components/Pagination/Pagination.variant.d.cts +3 -1
  63. package/dist/components/Pagination/Pagination.variant.d.ts +3 -1
  64. package/dist/components/Pagination/Pagination.variant.js +12 -6
  65. package/dist/components/RadioGroup/RadioGroup.cjs +1 -1
  66. package/dist/components/RadioGroup/RadioGroup.js +44 -41
  67. package/dist/components/RadioGroup/RadioGroup.variant.cjs +1 -1
  68. package/dist/components/RadioGroup/RadioGroup.variant.d.cts +3 -2
  69. package/dist/components/RadioGroup/RadioGroup.variant.d.ts +3 -2
  70. package/dist/components/RadioGroup/RadioGroup.variant.js +11 -21
  71. package/dist/components/Select/Select.cjs +1 -1
  72. package/dist/components/Select/Select.d.cts +1 -3
  73. package/dist/components/Select/Select.d.ts +1 -3
  74. package/dist/components/Select/Select.interface.d.cts +0 -1
  75. package/dist/components/Select/Select.interface.d.ts +0 -1
  76. package/dist/components/Select/Select.js +620 -401
  77. package/dist/components/Select/Select.variant.cjs +1 -1
  78. package/dist/components/Select/Select.variant.d.cts +5 -5
  79. package/dist/components/Select/Select.variant.d.ts +5 -5
  80. package/dist/components/Select/Select.variant.js +10 -12
  81. package/dist/components/Sheet/Sheet.variant.cjs +1 -1
  82. package/dist/components/Sheet/Sheet.variant.js +6 -6
  83. package/dist/components/Switch/Switch.cjs +1 -1
  84. package/dist/components/Switch/Switch.interface.d.cts +12 -3
  85. package/dist/components/Switch/Switch.interface.d.ts +12 -3
  86. package/dist/components/Switch/Switch.js +57 -37
  87. package/dist/components/Switch/Switch.variant.cjs +1 -1
  88. package/dist/components/Switch/Switch.variant.d.cts +9 -5
  89. package/dist/components/Switch/Switch.variant.d.ts +9 -5
  90. package/dist/components/Switch/Switch.variant.js +22 -15
  91. package/dist/components/Table/Table.cjs +1 -1
  92. package/dist/components/Table/Table.interface.d.cts +9 -0
  93. package/dist/components/Table/Table.interface.d.ts +9 -0
  94. package/dist/components/Table/Table.js +462 -271
  95. package/dist/components/Table/TableSkeletonRows.cjs +1 -1
  96. package/dist/components/Table/TableSkeletonRows.js +26 -21
  97. package/dist/components/Table/TableSortToggle.cjs +1 -1
  98. package/dist/components/Table/TableSortToggle.d.cts +1 -1
  99. package/dist/components/Table/TableSortToggle.d.ts +1 -1
  100. package/dist/components/Table/TableSortToggle.js +23 -22
  101. package/dist/components/Table/hooks/useTableCardLabels.cjs +1 -0
  102. package/dist/components/Table/hooks/useTableCardLabels.d.cts +9 -0
  103. package/dist/components/Table/hooks/useTableCardLabels.d.ts +9 -0
  104. package/dist/components/Table/hooks/useTableCardLabels.js +34 -0
  105. package/dist/components/Table/hooks/useTableSort.cjs +1 -1
  106. package/dist/components/Table/hooks/useTableSort.d.cts +2 -0
  107. package/dist/components/Table/hooks/useTableSort.d.ts +2 -0
  108. package/dist/components/Table/hooks/useTableSort.js +8 -1
  109. package/dist/components/Tabs/Tabs.cjs +1 -1
  110. package/dist/components/Tabs/Tabs.js +90 -63
  111. package/dist/components/Tabs/Tabs.variant.cjs +1 -1
  112. package/dist/components/Tabs/Tabs.variant.d.cts +2 -2
  113. package/dist/components/Tabs/Tabs.variant.d.ts +2 -2
  114. package/dist/components/Tabs/Tabs.variant.js +52 -29
  115. package/dist/components/Textarea/Textarea.cjs +1 -1
  116. package/dist/components/Textarea/Textarea.js +19 -18
  117. package/dist/components/Textarea/Textarea.variant.cjs +1 -1
  118. package/dist/components/Textarea/Textarea.variant.js +5 -5
  119. package/dist/components/TimePicker/TimePicker.cjs +1 -1
  120. package/dist/components/TimePicker/TimePicker.interface.d.cts +0 -1
  121. package/dist/components/TimePicker/TimePicker.interface.d.ts +0 -1
  122. package/dist/components/TimePicker/TimePicker.js +121 -83
  123. package/dist/components/TimePicker/TimePicker.variant.cjs +1 -1
  124. package/dist/components/TimePicker/TimePicker.variant.d.cts +1 -3
  125. package/dist/components/TimePicker/TimePicker.variant.d.ts +1 -3
  126. package/dist/components/TimePicker/TimePicker.variant.js +9 -11
  127. package/dist/components/TimePicker/TimePickerPanel.cjs +1 -1
  128. package/dist/components/TimePicker/TimePickerPanel.js +3 -4
  129. package/dist/components/TimePicker/TimePickerWheel.cjs +1 -0
  130. package/dist/components/TimePicker/TimePickerWheel.d.cts +27 -0
  131. package/dist/components/TimePicker/TimePickerWheel.d.ts +27 -0
  132. package/dist/components/TimePicker/TimePickerWheel.js +205 -0
  133. package/dist/components/Toast/Toast.cjs +1 -1
  134. package/dist/components/Toast/Toast.d.cts +1 -1
  135. package/dist/components/Toast/Toast.d.ts +1 -1
  136. package/dist/components/Toast/Toast.js +56 -34
  137. package/dist/components/Toast/Toast.variant.cjs +1 -1
  138. package/dist/components/Toast/Toast.variant.d.cts +1 -1
  139. package/dist/components/Toast/Toast.variant.d.ts +1 -1
  140. package/dist/components/Toast/Toast.variant.js +1 -1
  141. package/dist/components/Toast/ToastHost.cjs +1 -1
  142. package/dist/components/Toast/ToastHost.js +42 -41
  143. package/dist/components/Toast/function/toastHaptics.cjs +1 -0
  144. package/dist/components/Toast/function/toastHaptics.d.cts +11 -0
  145. package/dist/components/Toast/function/toastHaptics.d.ts +11 -0
  146. package/dist/components/Toast/function/toastHaptics.js +6 -0
  147. package/dist/components/Uploader/Uploader.cjs +2 -2
  148. package/dist/components/Uploader/Uploader.js +328 -158
  149. package/dist/components/Uploader/Uploader.variant.cjs +1 -1
  150. package/dist/components/Uploader/Uploader.variant.d.cts +1 -3
  151. package/dist/components/Uploader/Uploader.variant.d.ts +1 -3
  152. package/dist/components/Uploader/Uploader.variant.js +2 -5
  153. package/dist/components/shared/ActionSheet.cjs +1 -0
  154. package/dist/components/shared/ActionSheet.d.cts +26 -0
  155. package/dist/components/shared/ActionSheet.d.ts +26 -0
  156. package/dist/components/shared/ActionSheet.js +51 -0
  157. package/dist/components/shared/FieldClearButton.cjs +1 -1
  158. package/dist/components/shared/FieldClearButton.d.cts +2 -1
  159. package/dist/components/shared/FieldClearButton.d.ts +2 -1
  160. package/dist/components/shared/FieldClearButton.js +11 -10
  161. package/dist/components/shared/FieldLabel.cjs +1 -1
  162. package/dist/components/shared/FieldLabel.js +6 -6
  163. package/dist/components/shared/IconActionButton.cjs +1 -1
  164. package/dist/components/shared/IconActionButton.d.cts +6 -1
  165. package/dist/components/shared/IconActionButton.d.ts +6 -1
  166. package/dist/components/shared/IconActionButton.js +9 -11
  167. package/dist/components/shared/WheelColumn.cjs +1 -0
  168. package/dist/components/shared/WheelColumn.d.cts +29 -0
  169. package/dist/components/shared/WheelColumn.d.ts +29 -0
  170. package/dist/components/shared/WheelColumn.js +116 -0
  171. package/dist/components/shared/haptics.cjs +1 -0
  172. package/dist/components/shared/haptics.d.cts +6 -0
  173. package/dist/components/shared/haptics.d.ts +6 -0
  174. package/dist/components/shared/haptics.js +8 -0
  175. package/dist/components/shared/responsiveScale.cjs +1 -1
  176. package/dist/components/shared/responsiveScale.d.cts +7 -1
  177. package/dist/components/shared/responsiveScale.d.ts +7 -1
  178. package/dist/components/shared/responsiveScale.js +2 -6
  179. package/dist/components/shared/useStickyToolbar.cjs +1 -0
  180. package/dist/components/shared/useStickyToolbar.d.cts +17 -0
  181. package/dist/components/shared/useStickyToolbar.d.ts +17 -0
  182. package/dist/components/shared/useStickyToolbar.js +39 -0
  183. package/dist/components/shared/useWheelSize.cjs +1 -0
  184. package/dist/components/shared/useWheelSize.d.cts +10 -0
  185. package/dist/components/shared/useWheelSize.d.ts +10 -0
  186. package/dist/components/shared/useWheelSize.js +14 -0
  187. package/dist/components/shared/viewport.cjs +1 -0
  188. package/dist/components/shared/viewport.d.cts +17 -0
  189. package/dist/components/shared/viewport.d.ts +17 -0
  190. package/dist/components/shared/viewport.js +32 -0
  191. package/dist/config/messages.cjs +1 -1
  192. package/dist/config/messages.d.cts +14 -0
  193. package/dist/config/messages.d.ts +14 -0
  194. package/dist/config/messages.js +26 -8
  195. package/dist/index.cjs +1 -1
  196. package/dist/index.css +1 -1
  197. package/dist/index.js +16 -16
  198. package/package.json +98 -97
@@ -3,43 +3,48 @@ import { useZuiConfig as e } from "../../config/useZuiConfig.js";
3
3
  import { convertToEnglishDigits as t } from "../../services/convertToEnglishDigits/convertToEnglishDigits.js";
4
4
  import { localizeDigits as n } from "../../services/localizeDigits/localizeDigits.js";
5
5
  import { cn as r, mergeRefs as i } from "../../lib/utils.js";
6
- import { FieldLabel as a } from "../shared/FieldLabel.js";
7
- import { useInvalidState as o } from "../shared/useInvalidState.js";
8
- import { IconActionButton as s } from "../shared/IconActionButton.js";
9
- import { useControllableState as c } from "../shared/useControllableState.js";
10
- import { useIsomorphicLayoutEffect as ee } from "../shared/useIsomorphicLayoutEffect.js";
11
- import { FieldClearButton as l, FieldClearButtonSlot as u } from "../shared/FieldClearButton.js";
12
- import d from "../shared/RequiredValidationInput.js";
13
- import f from "../Skeleton/Skeleton.js";
14
- import { selectActionButtonClassName as te, selectContentVariants as p, selectLabelVariants as m, selectOptionVariants as h, selectSearchBarClassName as ne, selectSearchInputVariants as g, selectSeparatorVariants as re, selectTriggerVariants as _, selectViewportVariants as ie } from "./Select.variant.js";
15
- import * as v from "react";
16
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
17
- import { Check as ae, CheckCheck as oe, ChevronDown as S, Search as se, X as C } from "lucide-react";
18
- import * as ce from "@radix-ui/react-popover";
6
+ import a from "../Button/Button.js";
7
+ import o from "../Dialog/Dialog.js";
8
+ import { CLEAR_ICON_CLASS as s, FieldClearButton as ee, FieldClearButtonSlot as c } from "../shared/FieldClearButton.js";
9
+ import { FieldLabel as l } from "../shared/FieldLabel.js";
10
+ import { useInvalidState as u } from "../shared/useInvalidState.js";
11
+ import d from "../Input/Input.js";
12
+ import { IconActionButton as f } from "../shared/IconActionButton.js";
13
+ import { useControllableState as p } from "../shared/useControllableState.js";
14
+ import { isMobileViewport as m } from "../shared/viewport.js";
15
+ import { useIsomorphicLayoutEffect as h } from "../shared/useIsomorphicLayoutEffect.js";
16
+ import g from "../shared/RequiredValidationInput.js";
17
+ import _ from "../Skeleton/Skeleton.js";
18
+ import v, { TabsContent as te, TabsList as ne, TabsTrigger as re } from "../Tabs/Tabs.js";
19
+ import { selectActionButtonClassName as ie, selectContentVariants as ae, selectLabelVariants as oe, selectModalActionButtonClassName as y, selectModalOptionClassName as b, selectOptionVariants as se, selectSearchBarClassName as ce, selectSeparatorVariants as le, selectTriggerVariants as x, selectViewportVariants as ue } from "./Select.variant.js";
20
+ import * as S from "react";
21
+ import { Fragment as de, jsx as C, jsxs as w } from "react/jsx-runtime";
22
+ import { Check as T, CheckCheck as fe, ChevronDown as E, X as pe } from "lucide-react";
23
+ import * as me from "@radix-ui/react-popover";
19
24
  //#region src/components/Select/Select.tsx
20
- var w = 1, T = 20, le = 350, ue = 48, E = 3, D = "zui:size-[calc(var(--zui-scale,10px)*1.92)]", de = v.createContext(null);
21
- function fe(e, t) {
25
+ var D = "__zui-ungrouped__", O = 40, he = 24, ge = .3, _e = 1, k = 20, ve = 350, ye = 48, A = 3, be = "zui:size-[calc(var(--zui-scale,10px)*1.92)]", xe = S.createContext(null);
26
+ function j(e, t) {
22
27
  return `${e}-option-${t}`;
23
28
  }
24
- function pe(e) {
29
+ function Se(e) {
25
30
  return typeof e == "string" && e.length > 0;
26
31
  }
27
- function O(e) {
32
+ function M(e) {
28
33
  if (!Array.isArray(e)) return [];
29
34
  let t = /* @__PURE__ */ new Set();
30
35
  return e.forEach((e) => {
31
36
  typeof e == "string" && e.trim().length > 0 && t.add(e.trim());
32
37
  }), Array.from(t);
33
38
  }
34
- function k(e, t) {
39
+ function N(e, t) {
35
40
  return `${t ?? ""}\u0000${e}`;
36
41
  }
37
- function me(e) {
42
+ function Ce(e) {
38
43
  if (!Array.isArray(e)) return [];
39
44
  let t = [], n = /* @__PURE__ */ new Set();
40
45
  return e.forEach((e) => {
41
46
  if (!e || typeof e != "object") return;
42
- let r = e, i = typeof r.value == "string" ? r.value.trim() : "", a = typeof r.group == "string" && r.group.trim().length > 0 ? r.group.trim() : void 0, o = k(i, a);
47
+ let r = e, i = typeof r.value == "string" ? r.value.trim() : "", a = typeof r.group == "string" && r.group.trim().length > 0 ? r.group.trim() : void 0, o = N(i, a);
43
48
  if (i.length === 0 || n.has(o)) return;
44
49
  let s = typeof r.label == "string" && r.label.trim().length > 0 ? r.label.trim() : i;
45
50
  n.add(o), t.push({
@@ -50,16 +55,16 @@ function me(e) {
50
55
  });
51
56
  }), t;
52
57
  }
53
- function he(e, t) {
58
+ function P(e, t) {
54
59
  if (t.length === 0) return e;
55
60
  let n = /* @__PURE__ */ new Map();
56
61
  return e.forEach((e) => {
57
- n.set(k(e.value, e.group), e);
62
+ n.set(N(e.value, e.group), e);
58
63
  }), t.forEach((e) => {
59
- n.set(k(e.value, e.group), e);
64
+ n.set(N(e.value, e.group), e);
60
65
  }), Array.from(n.values());
61
66
  }
62
- function ge(e) {
67
+ function we(e) {
63
68
  let t = [], n = /* @__PURE__ */ new Map();
64
69
  return e.forEach((e) => {
65
70
  if (e.group === void 0) {
@@ -75,72 +80,72 @@ function ge(e) {
75
80
  n.set(e.group, i), t.push(i);
76
81
  }), t.flat();
77
82
  }
78
- function A(e, n) {
83
+ function F(e, n) {
79
84
  return t({ value: (e.length > 0 ? e : n).toLocaleLowerCase() });
80
85
  }
81
- function _e(e) {
86
+ function Te(e) {
82
87
  return {
83
88
  value: e.value,
84
89
  label: e.label,
85
- searchText: A(e.label.trim(), e.value),
90
+ searchText: F(e.label.trim(), e.value),
86
91
  disabled: e.disabled === !0,
87
92
  group: e.group
88
93
  };
89
94
  }
90
- function ve(e) {
91
- if (typeof e != "number" || !Number.isFinite(e)) return T;
95
+ function Ee(e) {
96
+ if (typeof e != "number" || !Number.isFinite(e)) return k;
92
97
  let t = Math.floor(e);
93
- return t > 0 ? t : T;
98
+ return t > 0 ? t : k;
94
99
  }
95
- function ye(e, t, n, r) {
100
+ function De(e, t, n, r) {
96
101
  return typeof e.hasMore == "boolean" ? e.hasMore : typeof e.totalItems == "number" && Number.isFinite(e.totalItems) ? t < Math.max(0, Math.floor(e.totalItems)) : typeof e.nextPage == "number" ? Number.isFinite(e.nextPage) && e.nextPage > 0 : n >= r;
97
102
  }
98
- function be(e, t) {
103
+ function I(e, t) {
99
104
  return typeof e.nextPage == "number" && Number.isFinite(e.nextPage) && e.nextPage > t ? Math.floor(e.nextPage) : t + 1;
100
105
  }
101
- function xe(e, t) {
106
+ function Oe(e, t) {
102
107
  return e instanceof Error && e.message.trim().length > 0 ? e.message : t;
103
108
  }
104
- function Se() {
105
- return /* @__PURE__ */ b("div", {
109
+ function L() {
110
+ return /* @__PURE__ */ C("div", {
106
111
  "data-slot": "select-loading",
107
112
  className: "zui:space-y-1 zui:px-2 zui:py-2",
108
- children: Array.from({ length: E }, (e, t) => /* @__PURE__ */ b(f, { className: r("zui:h-5 zui:max-w-full", t === 0 ? "zui:w-[88%]" : t === 1 ? "zui:w-[72%]" : "zui:w-[80%]") }, `select-loading-${t}`))
113
+ children: Array.from({ length: A }, (e, t) => /* @__PURE__ */ C(_, { className: r("zui:h-5 zui:max-w-full", t === 0 ? "zui:w-[88%]" : t === 1 ? "zui:w-[72%]" : "zui:w-[80%]") }, `select-loading-${t}`))
109
114
  });
110
115
  }
111
- function j(e, t) {
112
- return typeof e == "string" ? n(e, t) : typeof e == "number" ? n(String(e), t) : Array.isArray(e) ? e.map((e, n) => /* @__PURE__ */ b(v.Fragment, { children: j(e, t) }, n)) : v.isValidElement(e) ? !("children" in e.props) || e.props.children === void 0 ? e : v.cloneElement(e, void 0, j(e.props.children, t)) : e;
116
+ function R(e, t) {
117
+ return typeof e == "string" ? n(e, t) : typeof e == "number" ? n(String(e), t) : Array.isArray(e) ? e.map((e, n) => /* @__PURE__ */ C(S.Fragment, { children: R(e, t) }, n)) : S.isValidElement(e) ? !("children" in e.props) || e.props.children === void 0 ? e : S.cloneElement(e, void 0, R(e.props.children, t)) : e;
113
118
  }
114
- function M(e) {
115
- return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(M).join(" ") : v.isValidElement(e) ? M(e.props.children) : "";
119
+ function z(e) {
120
+ return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(z).join(" ") : S.isValidElement(e) ? z(e.props.children) : "";
116
121
  }
117
- function N(e) {
122
+ function B(e) {
118
123
  return null;
119
124
  }
120
- function P(e) {
125
+ function V(e) {
121
126
  return null;
122
127
  }
123
- function F(e) {
128
+ function H(e) {
124
129
  return null;
125
130
  }
126
- function I() {
131
+ function U() {
127
132
  return null;
128
133
  }
129
- function Ce(e) {
134
+ function ke(e) {
130
135
  let t = [], n = /* @__PURE__ */ new Set(), r = !1, i = (e, a) => {
131
- v.Children.forEach(e, (e) => {
132
- if (v.isValidElement(e)) {
133
- if (e.type === I) {
136
+ S.Children.forEach(e, (e) => {
137
+ if (S.isValidElement(e)) {
138
+ if (e.type === U) {
134
139
  r = t.length > 0;
135
140
  return;
136
141
  }
137
- if (e.type === N) {
138
- let i = e.props, o = typeof i.value == "string" ? i.value.trim() : "", s = k(o, a);
142
+ if (e.type === B) {
143
+ let i = e.props, o = typeof i.value == "string" ? i.value.trim() : "", s = N(o, a);
139
144
  if (o.length === 0 || n.has(s)) return;
140
145
  n.add(s), t.push({
141
146
  value: o,
142
147
  label: i.children,
143
- searchText: A(M(i.children).trim(), o),
148
+ searchText: F(z(i.children).trim(), o),
144
149
  disabled: i.disabled === !0,
145
150
  group: a,
146
151
  separatorBefore: r,
@@ -148,11 +153,11 @@ function Ce(e) {
148
153
  }), r = !1;
149
154
  return;
150
155
  }
151
- if (e.type === P) {
156
+ if (e.type === V) {
152
157
  let t = e.props.children, n;
153
- v.Children.forEach(t, (e) => {
154
- if (v.isValidElement(e) && e.type === F) {
155
- let t = M(e.props.children).trim();
158
+ S.Children.forEach(t, (e) => {
159
+ if (S.isValidElement(e) && e.type === H) {
160
+ let t = z(e.props.children).trim();
156
161
  n = t.length > 0 ? t : void 0;
157
162
  }
158
163
  }), i(t, n ?? a);
@@ -164,383 +169,398 @@ function Ce(e) {
164
169
  };
165
170
  return i(e), t;
166
171
  }
167
- function L(t) {
168
- let { messages: n, dir: i } = e(), { type: s = "single", title: ee, required: l = !1, showRequiredMessage: u = !1, placeholder: f, options: te, remoteOptions: p, isSearch: m = !1, size: h = "default", disabled: ne = !1, disable: g = !1, onInvalid: re, onOpenChange: _, open: ie, defaultOpen: ae, id: oe, name: S, form: se, children: C, selectAllLabel: w, selectedCountLabel: T, multiValueSubmitFormat: le = "separate", onValueChange: ue, onChange: E } = t, D = v.useCallback((e) => {
169
- ue?.(e), E?.(e);
170
- }, [E, ue]), fe = v.useId(), k = oe ?? fe, he = `${k}-listbox`, ge = ne || g, A = s === "multi", _e = v.useRef(null), ve = v.useRef(null), ye = v.useRef(null), be = v.useCallback((e) => {
171
- ye.current?.(e);
172
- }, []), xe = v.useCallback((e) => {
173
- ye.current = e;
174
- }, []), [Se, j] = v.useState(""), [M, N] = v.useState(-1), { isInvalid: P, setIsInvalid: F, handleInvalid: I } = o(re), [L, B, V] = c({
175
- value: !A && typeof t.value == "string" ? t.value : void 0,
176
- defaultValue: !A && typeof t.defaultValue == "string" ? t.defaultValue : void 0
177
- }), H = A && Array.isArray(t.value) ? t.value : void 0, [U, Te] = c({
178
- value: v.useMemo(() => H ? O(H) : void 0, [H]),
179
- defaultValue: () => O(t.defaultValue)
180
- }), [W, G] = c({
181
- value: ie,
182
- defaultValue: !!ae,
183
- onChange: _
184
- }), Ee = v.useMemo(() => me(te), [te]), De = v.useMemo(() => Ce(C), [C]), K = m ? Se : "", q = A ? U.length > 0 : pe(L), Oe = P && !q, [J, ke] = v.useState(() => ({
185
- isOpen: W,
186
- values: O(t.defaultValue)
172
+ function Ae(t) {
173
+ let { messages: n, dir: i } = e(), { type: a = "single", title: o, required: s = !1, showRequiredMessage: ee = !1, placeholder: c, options: d, remoteOptions: f, isSearch: h = !1, disabled: _ = !1, disable: v = !1, onInvalid: te, onOpenChange: ne, open: re, defaultOpen: ie, id: ae, name: oe, form: y, children: b, selectAllLabel: se, selectedCountLabel: ce, multiValueSubmitFormat: le = "separate", onValueChange: x, onChange: ue } = t, T = S.useCallback((e) => {
174
+ x?.(e), ue?.(e);
175
+ }, [ue, x]), fe = S.useId(), E = ae ?? fe, pe = `${E}-listbox`, D = _ || v, O = a === "multi", he = S.useRef(null), ge = S.useRef(null), _e = S.useRef(null), k = S.useCallback((e) => {
176
+ _e.current?.(e);
177
+ }, []), ve = S.useCallback((e) => {
178
+ _e.current = e;
179
+ }, []), [ye, A] = S.useState(""), [be, j] = S.useState(-1), { isInvalid: N, setIsInvalid: P, handleInvalid: we } = u(te), [F, Te, Ee] = p({
180
+ value: !O && typeof t.value == "string" ? t.value : void 0,
181
+ defaultValue: !O && typeof t.defaultValue == "string" ? t.defaultValue : void 0
182
+ }), De = O && Array.isArray(t.value) ? t.value : void 0, [I, Oe] = p({
183
+ value: S.useMemo(() => De ? M(De) : void 0, [De]),
184
+ defaultValue: () => M(t.defaultValue)
185
+ }), [L, R] = p({
186
+ value: re,
187
+ defaultValue: !!ie,
188
+ onChange: ne
189
+ }), [z, B] = S.useState(null), V = S.useCallback((e) => {
190
+ B(e ? m() : null), R(e);
191
+ }, [R]), H = L && (z ?? m()), U = S.useMemo(() => Ce(d), [d]), Ae = S.useMemo(() => ke(b), [b]), je = h ? ye : "", Me = O ? I.length > 0 : Se(F), Ne = N && !Me, [q, Pe] = S.useState(() => ({
192
+ isOpen: L,
193
+ values: M(t.defaultValue)
187
194
  }));
188
- if (J.isOpen !== W) {
189
- let e = A ? U : pe(L) ? [L] : [];
190
- ke({
191
- isOpen: W,
192
- values: W ? e : J.values
193
- }), N(-1), W || j("");
195
+ if (q.isOpen !== L) {
196
+ let e = O ? I : Se(F) ? [F] : [];
197
+ Pe({
198
+ isOpen: L,
199
+ values: L ? e : q.values
200
+ }), j(-1), L || A("");
194
201
  }
195
- let Ae = v.useMemo(() => !A || U.length === 0 ? "" : typeof T == "function" ? T(U.length) : n.select.selectedCount(String(U.length)), [
196
- A,
202
+ let Fe = S.useMemo(() => !O || I.length === 0 ? "" : typeof ce == "function" ? ce(I.length) : n.select.selectedCount(String(I.length)), [
203
+ O,
197
204
  n,
198
- U.length,
199
- T
200
- ]), Y = v.useCallback((e) => {
201
- j(e), N(-1);
202
- }, []), je = v.useCallback((e) => {
203
- B(e), F(!1), D(e);
204
- }, [
205
- D,
206
- F,
207
- B
208
- ]), Me = v.useCallback(() => {
209
- A || (B(V ? "" : void 0), D(""));
205
+ I.length,
206
+ ce
207
+ ]), Ie = S.useCallback((e) => {
208
+ A(e), j(-1);
209
+ }, []), J = S.useCallback((e) => {
210
+ Te(e), P(!1), T(e);
210
211
  }, [
211
- D,
212
- A,
213
- V,
214
- B
215
- ]), Ne = v.useCallback((e) => {
216
- let t = O(e);
217
- Te(t), F(!1), D(t);
212
+ T,
213
+ P,
214
+ Te
215
+ ]), Le = S.useCallback(() => {
216
+ O || (Te(Ee ? "" : void 0), T(""));
218
217
  }, [
219
- D,
220
- F,
218
+ T,
219
+ O,
220
+ Ee,
221
221
  Te
222
- ]), Pe = v.Children.toArray(C), Fe = Pe.some((e) => v.isValidElement(e) && e.type === z), Ie = p?.enabled !== !1 && p, Le = !Fe && (Ee.length > 0 || Ie) ? [...Pe, /* @__PURE__ */ b(z, {}, "select-generated-content")] : C, Re = v.Children.toArray(Le).some((e) => v.isValidElement(e) && e.type === R), ze = v.Children.map(Le, (e) => {
223
- if (!v.isValidElement(e)) return e;
224
- if (e.type === R) {
222
+ ]), Re = S.useCallback((e) => {
223
+ let t = M(e);
224
+ Oe(t), P(!1), T(t);
225
+ }, [
226
+ T,
227
+ P,
228
+ Oe
229
+ ]), ze = S.Children.toArray(b), Be = ze.some((e) => S.isValidElement(e) && e.type === K), Ve = f?.enabled !== !1 && f, Y = !Be && (U.length > 0 || Ve) ? [...ze, /* @__PURE__ */ C(K, {}, "select-generated-content")] : b, He = S.Children.toArray(Y).some((e) => S.isValidElement(e) && e.type === W), Ue = S.Children.map(Y, (e) => {
230
+ if (!S.isValidElement(e)) return e;
231
+ if (e.type === W) {
225
232
  let t = e.props;
226
- return v.cloneElement(e, {
227
- id: t.id ?? k,
228
- size: t.size ?? h,
229
- disabled: t.disabled ?? ge,
233
+ return S.cloneElement(e, {
234
+ id: t.id ?? E,
235
+ disabled: t.disabled ?? D,
230
236
  className: r("zui:text-start", t.className)
231
237
  });
232
238
  }
233
- if (e.type === z) {
239
+ if (e.type === K) {
234
240
  let t = e.props;
235
- return v.cloneElement(e, { className: r("zui:text-start", t.className) });
241
+ return S.cloneElement(e, { className: r("zui:text-start", t.className) });
236
242
  }
237
243
  return e;
238
- }), Be = v.useMemo(() => ({
239
- listboxId: he,
240
- isSearch: m,
241
- searchTerm: K,
242
- setSearchTerm: Y,
243
- hasValue: q,
244
- isInvalid: Oe,
245
- selectType: s,
246
- isOpen: W,
247
- setOpen: G,
248
- isDisabled: ge,
249
- activeIndex: M,
250
- setActiveIndex: N,
251
- singleSelectedValue: L,
252
- setSingleSelectedValue: je,
253
- clearSingleSelection: Me,
254
- multiSelectedValues: U,
255
- pinnedSelectedValues: J.values,
256
- setMultiSelectedValues: Ne,
257
- multiSelectAllLabel: w ?? n.select.selectAll,
258
- multiSelectedCountText: Ae,
259
- options: Ee,
260
- childOptions: De,
261
- remoteOptions: p,
262
- contentRef: ve,
263
- fieldRootRef: _e,
264
- onListKeyDown: be,
265
- registerListKeyDown: xe
244
+ }), We = S.useMemo(() => ({
245
+ listboxId: pe,
246
+ isSearch: h,
247
+ searchTerm: je,
248
+ setSearchTerm: Ie,
249
+ hasValue: Me,
250
+ isInvalid: Ne,
251
+ selectType: a,
252
+ isOpen: L,
253
+ setOpen: V,
254
+ isModal: H,
255
+ modalLabel: o ?? c,
256
+ isDisabled: D,
257
+ activeIndex: be,
258
+ setActiveIndex: j,
259
+ singleSelectedValue: F,
260
+ setSingleSelectedValue: J,
261
+ clearSingleSelection: Le,
262
+ multiSelectedValues: I,
263
+ pinnedSelectedValues: q.values,
264
+ setMultiSelectedValues: Re,
265
+ multiSelectAllLabel: se ?? n.select.selectAll,
266
+ multiSelectedCountText: Fe,
267
+ options: U,
268
+ childOptions: Ae,
269
+ remoteOptions: f,
270
+ contentRef: ge,
271
+ fieldRootRef: he,
272
+ onListKeyDown: k,
273
+ registerListKeyDown: ve
266
274
  }), [
267
- M,
268
- De,
275
+ be,
276
+ Ae,
277
+ Le,
278
+ Re,
279
+ J,
269
280
  Me,
281
+ D,
282
+ h,
283
+ H,
270
284
  Ne,
271
- je,
272
- q,
273
- ge,
274
- m,
275
- Oe,
276
- he,
285
+ pe,
277
286
  n,
278
- Ae,
279
- Ee,
280
- be,
281
- J.values,
282
- xe,
283
- p,
287
+ c,
288
+ o,
289
+ Fe,
284
290
  U,
285
- W,
291
+ k,
292
+ q.values,
293
+ ve,
294
+ f,
295
+ I,
286
296
  L,
287
- K,
288
- w,
289
- s,
290
- G,
291
- Y
297
+ F,
298
+ je,
299
+ se,
300
+ a,
301
+ V,
302
+ Ie
292
303
  ]);
293
- return /* @__PURE__ */ x("div", {
294
- ref: _e,
304
+ return /* @__PURE__ */ w("div", {
305
+ ref: he,
295
306
  "data-slot": "select-field",
296
307
  dir: i,
297
308
  className: "zui:relative zui:w-full zui:space-y-1.5 zui:text-start",
298
- children: [/* @__PURE__ */ b(a, {
299
- title: ee,
300
- htmlFor: k,
301
- required: l,
302
- showRequiredMessage: u
303
- }), /* @__PURE__ */ x(de.Provider, {
304
- value: Be,
305
- children: [/* @__PURE__ */ b(ce.Root, {
306
- open: W,
307
- onOpenChange: G,
308
- children: /* @__PURE__ */ b(ce.Anchor, {
309
+ children: [/* @__PURE__ */ C(l, {
310
+ title: o,
311
+ htmlFor: E,
312
+ required: s,
313
+ showRequiredMessage: ee
314
+ }), /* @__PURE__ */ w(xe.Provider, {
315
+ value: We,
316
+ children: [/* @__PURE__ */ C(me.Root, {
317
+ open: L && !H,
318
+ onOpenChange: V,
319
+ children: /* @__PURE__ */ C(me.Anchor, {
309
320
  asChild: !0,
310
- children: /* @__PURE__ */ x("div", {
321
+ children: /* @__PURE__ */ w("div", {
311
322
  "data-slot": "select",
312
323
  dir: i,
313
324
  className: "zui:relative",
314
- children: [Re ? ze : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(R, {
315
- id: k,
316
- size: h,
317
- children: /* @__PURE__ */ b(we, { placeholder: f })
318
- }), ze] }), S ? A && le === "separate" ? U.map((e) => /* @__PURE__ */ b("input", {
325
+ children: [He ? Ue : /* @__PURE__ */ w(de, { children: [/* @__PURE__ */ C(W, {
326
+ id: E,
327
+ children: /* @__PURE__ */ C(G, { placeholder: c })
328
+ }), Ue] }), oe ? O && le === "separate" ? I.map((e) => /* @__PURE__ */ C("input", {
319
329
  type: "hidden",
320
- name: S,
321
- form: se,
330
+ name: oe,
331
+ form: y,
322
332
  value: e
323
- }, e)) : /* @__PURE__ */ b("input", {
333
+ }, e)) : /* @__PURE__ */ C("input", {
324
334
  type: "hidden",
325
- name: S,
326
- form: se,
327
- value: A ? U.join(",") : L ?? ""
335
+ name: oe,
336
+ form: y,
337
+ value: O ? I.join(",") : F ?? ""
328
338
  }) : null]
329
339
  })
330
340
  })
331
- }), l ? /* @__PURE__ */ b(d, {
332
- hasValue: q,
333
- form: se,
334
- disabled: ge,
335
- onInvalid: I
341
+ }), s ? /* @__PURE__ */ C(g, {
342
+ hasValue: Me,
343
+ form: y,
344
+ disabled: D,
345
+ onInvalid: we
336
346
  }) : null]
337
347
  })]
338
348
  });
339
349
  }
340
- var R = v.forwardRef(function({ className: t, size: n = "default", children: i, onClick: a, onKeyDown: o, disabled: s, ...c }, ee) {
341
- let d = v.useContext(de), { messages: f, dir: te } = e(), p = d?.hasValue ?? !1, m = d?.isInvalid ?? !1, h = d?.isOpen ?? !1, ne = d?.selectType === "multi", g = s || (d?.isDisabled ?? !1), re = d?.activeIndex ?? -1, ie = !ne && p && !g && !!d;
342
- return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("button", {
343
- ref: ee,
350
+ var W = S.forwardRef(function({ className: t, children: n, onClick: i, onKeyDown: a, disabled: o, ...l }, u) {
351
+ let d = S.useContext(xe), { messages: f, dir: p } = e(), m = d?.hasValue ?? !1, h = d?.isInvalid ?? !1, g = d?.isOpen ?? !1, _ = d?.selectType === "multi", v = o || (d?.isDisabled ?? !1), te = d?.activeIndex ?? -1, ne = !_ && m && !v && !!d;
352
+ return /* @__PURE__ */ w(de, { children: [/* @__PURE__ */ w("button", {
353
+ ref: u,
344
354
  type: "button",
345
355
  "data-slot": "select-trigger",
346
- "data-has-value": p,
347
- "data-state": h ? "open" : "closed",
348
- dir: te,
349
- "aria-expanded": h,
356
+ "data-has-value": m,
357
+ "data-state": g ? "open" : "closed",
358
+ dir: p,
359
+ "aria-expanded": g,
350
360
  "aria-haspopup": "listbox",
351
- "aria-controls": h && d ? d.listboxId : void 0,
352
- "aria-activedescendant": h && d && re >= 0 ? fe(d.listboxId, re) : void 0,
353
- "aria-invalid": m || void 0,
354
- disabled: g,
355
- className: r(_({
356
- size: n,
357
- className: t
358
- }), "zui:text-start"),
361
+ "aria-controls": g && d ? d.listboxId : void 0,
362
+ "aria-activedescendant": g && d && te >= 0 ? j(d.listboxId, te) : void 0,
363
+ "aria-invalid": h || void 0,
364
+ disabled: v,
365
+ className: r(x({ className: t }), "zui:text-start"),
359
366
  onClick: (e) => {
360
- a?.(e), !(e.defaultPrevented || g || !d) && d.setOpen(!h);
367
+ i?.(e), !(e.defaultPrevented || v || !d) && d.setOpen(!g);
361
368
  },
362
369
  onKeyDown: (e) => {
363
- o?.(e), e.defaultPrevented || d?.onListKeyDown(e);
370
+ a?.(e), e.defaultPrevented || d?.onListKeyDown(e);
364
371
  },
365
- ...c,
372
+ ...l,
366
373
  children: [
367
- i,
368
- ie ? /* @__PURE__ */ b(u, {}) : null,
369
- /* @__PURE__ */ b(S, { className: r("zui:size-4 zui:shrink-0 zui:text-[var(--zui-color-text)] zui:transition-transform zui:duration-200", h ? "zui:rotate-180" : "zui:rotate-0") })
374
+ n,
375
+ ne ? /* @__PURE__ */ C(c, {}) : null,
376
+ /* @__PURE__ */ C(E, { className: r(s, "zui:shrink-0 zui:text-[var(--zui-color-text)] zui:transition-transform zui:duration-200", g ? "zui:rotate-180" : "zui:rotate-0") })
370
377
  ]
371
- }), ie ? /* @__PURE__ */ b(l, {
378
+ }), ne ? /* @__PURE__ */ C(ee, {
372
379
  "data-slot": "select-clear-button",
373
380
  label: f.select.clearSelection,
374
381
  onClear: () => d?.clearSingleSelection()
375
382
  }) : null] });
376
383
  });
377
- function we({ className: t, placeholder: n, children: i, ...a }) {
378
- let o = v.useContext(de), { digits: s } = e();
384
+ function G({ className: t, placeholder: n, children: i, ...a }) {
385
+ let o = S.useContext(xe), { digits: s } = e();
379
386
  if (o?.selectType === "multi") {
380
387
  let e = i ?? (o.hasValue ? o.multiSelectedCountText : n);
381
- return /* @__PURE__ */ b("span", {
388
+ return /* @__PURE__ */ C("span", {
382
389
  "data-slot": "select-value",
383
390
  "data-placeholder": o.hasValue ? void 0 : !0,
384
- className: r("zui:block zui:max-w-full zui:truncate zui:text-start zui:text-[var(--zui-color-text)]", !o.hasValue && "zui:text-[var(--zui-theme-text-muted)]", t),
391
+ className: r("zui:block zui:max-w-full zui:truncate zui:text-start zui:text-[var(--zui-color-text)]", !o.hasValue && "zui:text-[var(--zui-theme-text-muted)] zui:mobile:text-sm", t),
385
392
  ...a,
386
- children: j(e, s)
393
+ children: R(e, s)
387
394
  });
388
395
  }
389
- let c = o?.options.find((e) => e.value === o.singleSelectedValue) ?? o?.childOptions.find((e) => e.value === o.singleSelectedValue);
390
- return c ? /* @__PURE__ */ b("span", {
396
+ let ee = o?.options.find((e) => e.value === o.singleSelectedValue) ?? o?.childOptions.find((e) => e.value === o.singleSelectedValue);
397
+ return ee ? /* @__PURE__ */ C("span", {
391
398
  "data-slot": "select-value",
392
399
  className: r("zui:block zui:min-w-0 zui:flex-1 zui:truncate zui:text-start zui:text-[var(--zui-color-text)]", t),
393
400
  ...a,
394
- children: j(i ?? c.label, s)
395
- }) : /* @__PURE__ */ b("span", {
401
+ children: R(i ?? ee.label, s)
402
+ }) : /* @__PURE__ */ C("span", {
396
403
  "data-slot": "select-value",
397
404
  "data-placeholder": "",
398
- className: r("zui:block zui:min-w-0 zui:flex-1 zui:truncate zui:text-start zui:text-[var(--zui-theme-text-muted)]", t),
405
+ className: r("zui:block zui:min-w-0 zui:flex-1 zui:truncate zui:text-start zui:text-[var(--zui-theme-text-muted)] zui:mobile:text-sm", t),
399
406
  ...a,
400
407
  children: n
401
408
  });
402
409
  }
403
- var z = v.forwardRef(function({ className: a, children: o }, c) {
404
- let l = v.useContext(de), { messages: u, digits: d, dir: f } = e(), _ = l?.selectType === "multi", y = l?.isSearch ?? !1, S = l?.searchTerm ?? "", T = l?.isOpen ?? !1, E = l?.activeIndex ?? -1, O = l?.listboxId ?? "", A = v.useRef(null), M = v.useRef(null), N = v.useRef(null), P = l?.singleSelectedValue, F = l?.multiSelectedValues, I = l?.pinnedSelectedValues, L = l?.options, R = v.useMemo(() => _ ? F ?? [] : pe(P) ? [P] : [], [
405
- _,
406
- F,
407
- P
408
- ]), we = v.useMemo(() => I ?? [], [I]), z = v.useMemo(() => L ?? [], [L]), B = l?.remoteOptions, V = typeof B?.loadOptions == "function" && B.enabled !== !1, H = ve(B?.pageSize), U = B?.cacheKey, Te = B?.loadOptions, W = v.useRef(Te);
409
- ee(() => {
410
- W.current = Te;
410
+ var K = S.forwardRef(function({ className: n, children: s }, ee) {
411
+ let c = S.useContext(xe), { messages: l, digits: u, dir: p } = e(), m = c?.selectType === "multi", g = c?.isSearch ?? !1, _ = c?.searchTerm ?? "", x = c?.isOpen ?? !1, E = c?.activeIndex ?? -1, k = c?.listboxId ?? "", A = S.useRef(null), M = S.useRef(null), F = S.useRef(null), z = c?.singleSelectedValue, B = c?.multiSelectedValues, V = c?.pinnedSelectedValues, H = c?.options, U = S.useMemo(() => m ? B ?? [] : Se(z) ? [z] : [], [
412
+ m,
413
+ B,
414
+ z
415
+ ]), Ae = S.useMemo(() => V ?? [], [V]), W = S.useMemo(() => H ?? [], [H]), G = c?.remoteOptions, K = typeof G?.loadOptions == "function" && G.enabled !== !1, je = Ee(G?.pageSize), Me = G?.cacheKey, Ne = G?.loadOptions, q = S.useRef(Ne);
416
+ h(() => {
417
+ q.current = Ne;
411
418
  });
412
- let G = v.useRef(null), Ee = v.useRef(null), De = v.useRef([]), K = v.useRef(0), q = v.useRef(!1), [Oe, J] = v.useState([]), [ke, Ae] = v.useState(""), Y = V ? ke : "", [je, Me] = v.useState(w), [Ne, Pe] = v.useState(!0), [Fe, Ie] = v.useState(!1), [Le, Re] = v.useState(null), ze = v.useMemo(() => new Set(R), [R]), Be = v.useMemo(() => new Set(we), [we]), Ve = v.useCallback(async (e, t, n) => {
413
- let r = W.current;
414
- if (!V || !r || t === "append" && q.current) return;
415
- let i = K.current + 1;
416
- K.current = i, q.current = !0, t === "replace" && (De.current = [], J([]), Me(w), Pe(!0)), Ie(!0), Re(null);
419
+ let Pe = S.useRef(null), Fe = S.useRef(null), Ie = S.useRef([]), J = S.useRef(0), Le = S.useRef(!1), [Re, ze] = S.useState([]), [Be, Ve] = S.useState(""), Y = K ? Be : "", [He, Ue] = S.useState(_e), [We, Ge] = S.useState(!0), [Ke, qe] = S.useState(!1), [Je, Ye] = S.useState(null), Xe = S.useMemo(() => new Set(U), [U]), Ze = S.useMemo(() => new Set(Ae), [Ae]), Qe = S.useCallback(async (e, t, n) => {
420
+ let r = q.current;
421
+ if (!K || !r || t === "append" && Le.current) return;
422
+ let i = J.current + 1;
423
+ J.current = i, Le.current = !0, t === "replace" && (Ie.current = [], ze([]), Ue(_e), Ge(!0)), qe(!0), Ye(null);
417
424
  try {
418
425
  let a = await r({
419
426
  page: e,
420
- pageSize: H,
427
+ pageSize: je,
421
428
  search: n
422
429
  });
423
- if (i !== K.current) return;
424
- let o = me(a.options), s = t === "append" ? he(De.current, o) : o;
425
- De.current = s, J(s), Me(be(a, e)), Pe(ye(a, s.length, o.length, H));
430
+ if (i !== J.current) return;
431
+ let o = Ce(a.options), s = t === "append" ? P(Ie.current, o) : o;
432
+ Ie.current = s, ze(s), Ue(I(a, e)), Ge(De(a, s.length, o.length, je));
426
433
  } catch (e) {
427
- i === K.current && (Re(xe(e, u.select.loadError)), Pe(!1));
434
+ i === J.current && (Ye(Oe(e, l.select.loadError)), Ge(!1));
428
435
  } finally {
429
- i === K.current && (q.current = !1, Ie(!1));
436
+ i === J.current && (Le.current = !1, qe(!1));
430
437
  }
431
438
  }, [
432
- V,
433
- u.select.loadError,
434
- H
439
+ K,
440
+ l.select.loadError,
441
+ je
435
442
  ]);
436
- v.useEffect(() => {
437
- if (!V) return;
443
+ S.useEffect(() => {
444
+ if (!K) return;
438
445
  let e = window.setTimeout(() => {
439
- Ae(S.trim());
440
- }, le);
446
+ Ve(_.trim());
447
+ }, ve);
441
448
  return () => window.clearTimeout(e);
442
- }, [V, S]), v.useEffect(() => {
443
- !V || !T || Ve(w, "replace", Y);
449
+ }, [K, _]), S.useEffect(() => {
450
+ !K || !x || Qe(_e, "replace", Y);
444
451
  }, [
445
- T,
446
- V,
447
- Ve,
448
- U,
452
+ x,
453
+ K,
454
+ Qe,
455
+ Me,
449
456
  Y
450
457
  ]);
451
- let He = v.useMemo(() => V ? he(Y.length === 0 ? z : [], Oe) : z, [
452
- z,
453
- V,
454
- Oe,
458
+ let $e = S.useMemo(() => K ? P(Y.length === 0 ? W : [], Re) : W, [
459
+ W,
460
+ K,
461
+ Re,
455
462
  Y.length
456
- ]), X = v.useMemo(() => He.length > 0 || V ? ge(He).map(_e) : Ce(o), [
457
- o,
458
- He,
459
- V
460
- ]), Z = V && T && Ne && !Fe && Le === null, Ue = v.useCallback(() => {
461
- Z && Ve(je, "append", Y);
463
+ ]), X = S.useMemo(() => $e.length > 0 || K ? we($e).map(Te) : ke(s), [
464
+ s,
465
+ $e,
466
+ K
467
+ ]), Z = K && x && We && !Ke && Je === null, et = S.useCallback(() => {
468
+ Z && Qe(He, "append", Y);
462
469
  }, [
463
470
  Z,
464
- Ve,
465
- je,
471
+ Qe,
472
+ He,
466
473
  Y
467
- ]), We = v.useCallback((e) => {
474
+ ]), tt = S.useCallback((e) => {
468
475
  if (!Z) return;
469
476
  let t = e.currentTarget;
470
- t.scrollHeight - t.scrollTop - t.clientHeight <= ue && Ue();
471
- }, [Z, Ue]);
472
- v.useEffect(() => {
477
+ t.scrollHeight - t.scrollTop - t.clientHeight <= ye && et();
478
+ }, [Z, et]);
479
+ S.useEffect(() => {
473
480
  if (!Z || typeof window > "u" || !("IntersectionObserver" in window)) return;
474
- let e = Ee.current, t = G.current;
481
+ let e = Fe.current, t = Pe.current;
475
482
  if (!e || !t) return;
476
483
  let n = new IntersectionObserver((e) => {
477
- e.some((e) => e.isIntersecting) && Ue();
484
+ e.some((e) => e.isIntersecting) && et();
478
485
  }, { root: t });
479
486
  return n.observe(e), () => n.disconnect();
480
- }, [Z, Ue]);
481
- let Ge = v.useMemo(() => {
482
- if (!y || V) return X;
483
- let e = S.trim().toLocaleLowerCase();
487
+ }, [Z, et]);
488
+ let nt = S.useMemo(() => {
489
+ if (!g || K) return X;
490
+ let e = _.trim().toLocaleLowerCase();
484
491
  return e.length === 0 ? X : X.filter((t) => t.searchText.includes(e));
485
492
  }, [
486
493
  X,
487
- V,
488
- y,
489
- S
490
- ]), Q = v.useMemo(() => {
491
- if (Ge.some((e) => e.group !== void 0)) return Ge;
494
+ K,
495
+ g,
496
+ _
497
+ ]), Q = S.useMemo(() => {
498
+ if (nt.some((e) => e.group !== void 0)) return nt;
492
499
  let e = [], t = [];
493
- return Ge.forEach((n) => {
494
- Be.has(n.value) ? e.push(n) : t.push(n);
500
+ return nt.forEach((n) => {
501
+ Ze.has(n.value) ? e.push(n) : t.push(n);
495
502
  }), [...e, ...t];
496
- }, [Ge, Be]), Ke = v.useMemo(() => Array.from(new Set(X.filter((e) => !e.disabled).map((e) => e.value))), [X]), qe = Ke.length > 0 && Ke.every((e) => ze.has(e));
497
- v.useEffect(() => {
498
- if (!y || !T) return;
503
+ }, [nt, Ze]), rt = S.useMemo(() => Array.from(new Set(X.filter((e) => !e.disabled).map((e) => e.value))), [X]), it = rt.length > 0 && rt.every((e) => Xe.has(e)), at = c?.isModal ?? !1, [ot, st] = S.useState({
504
+ isOpen: !1,
505
+ group: null,
506
+ enterFrom: null
507
+ });
508
+ ot.isOpen !== at && st({
509
+ isOpen: at,
510
+ group: null,
511
+ enterFrom: null
512
+ });
513
+ let ct = S.useRef(null), lt = S.useRef(null), ut = S.useRef(!1);
514
+ S.useEffect(() => {
515
+ if (!g || !x || at) return;
499
516
  let e = requestAnimationFrame(() => {
500
517
  A.current?.focus(), A.current?.select();
501
518
  });
502
519
  return () => cancelAnimationFrame(e);
503
- }, [T, y]), v.useEffect(() => {
520
+ }, [
521
+ x,
522
+ at,
523
+ g
524
+ ]), S.useEffect(() => {
504
525
  M.current?.scrollIntoView({ block: "nearest" });
505
526
  }, [E]);
506
- let Je = v.useCallback((e) => {
507
- let r = e.target, i = r.selectionStart, a = r.selectionEnd, o = t({ value: r.value });
508
- r.value = o, i !== null && r.setSelectionRange(i, a ?? i), l?.setSearchTerm(o), r.value = n(o, d), i !== null && r.setSelectionRange(i, a ?? i);
509
- }, [d, l]), $ = v.useCallback((e) => {
510
- if (l) {
511
- if (_) {
512
- let t = new Set(R);
513
- t.has(e) ? t.delete(e) : t.add(e), l.setMultiSelectedValues(Array.from(t));
527
+ let dt = S.useCallback((e) => {
528
+ c?.setSearchTerm(t({ value: e.target.value }));
529
+ }, [c]), ft = S.useCallback((e) => {
530
+ if (c) {
531
+ if (m) {
532
+ let t = new Set(U);
533
+ t.has(e) ? t.delete(e) : t.add(e), c.setMultiSelectedValues(Array.from(t));
514
534
  return;
515
535
  }
516
- l.setSingleSelectedValue(e), l.setOpen(!1);
536
+ c.setSingleSelectedValue(e), c.setOpen(!1);
517
537
  }
518
538
  }, [
519
- _,
520
- l,
521
- R
522
- ]), Ye = v.useCallback((e, t, n) => {
523
- e.preventDefault(), !n && (N.current = t, $(t));
524
- }, [$]), Xe = v.useCallback((e, t) => {
539
+ m,
540
+ c,
541
+ U
542
+ ]), pt = S.useCallback((e, t, n) => {
543
+ e.preventDefault(), !n && (F.current = t, ft(t));
544
+ }, [ft]), mt = S.useCallback((e, t) => {
525
545
  if (!t) {
526
- if (N.current === e) {
527
- N.current = null;
546
+ if (F.current === e) {
547
+ F.current = null;
528
548
  return;
529
549
  }
530
- $(e);
550
+ ft(e);
531
551
  }
532
- }, [$]), Ze = v.useCallback(() => {
533
- _ && l && l.setMultiSelectedValues(qe ? [] : Ke);
552
+ }, [ft]), ht = S.useCallback(() => {
553
+ m && c && c.setMultiSelectedValues(it ? [] : rt);
534
554
  }, [
535
- qe,
536
- _,
537
- l,
538
- Ke
539
- ]), Qe = l?.isDisabled ?? !1, $e = (e) => {
540
- if (!T || !l) return;
541
- let t = l.fieldRootRef.current?.querySelector("[data-slot=\"select-trigger\"]"), n = (e) => {
555
+ it,
556
+ m,
557
+ c,
558
+ rt
559
+ ]), gt = c?.isDisabled ?? !1, _t = (e) => {
560
+ if (!x || !c) return;
561
+ let t = c.fieldRootRef.current?.querySelector("[data-slot=\"select-trigger\"]"), n = (e) => {
542
562
  let t = Q[e];
543
- return !!t && !t.disabled && !Qe;
563
+ return !!t && !t.disabled && !gt;
544
564
  }, r = (e, t) => {
545
565
  let r = Q.length;
546
566
  for (let i = 1; i <= r; i += 1) {
@@ -552,23 +572,217 @@ var z = v.forwardRef(function({ className: a, children: o }, c) {
552
572
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
553
573
  if (e.preventDefault(), e.stopPropagation(), Q.length === 0) return;
554
574
  let t = r(E >= 0 ? E : e.key === "ArrowDown" ? -1 : 0, e.key === "ArrowDown" ? 1 : -1);
555
- t >= 0 && l.setActiveIndex(t);
575
+ t >= 0 && c.setActiveIndex(t);
556
576
  return;
557
577
  }
558
578
  if (e.key === "Enter" && n(E)) {
559
- e.preventDefault(), e.stopPropagation(), $(Q[E].value), _ || t?.focus();
579
+ e.preventDefault(), e.stopPropagation(), ft(Q[E].value), m || t?.focus();
560
580
  return;
561
581
  }
562
- e.key === "Tab" && (e.target === A.current && t?.focus(), l.setOpen(!1));
563
- }, et = l?.registerListKeyDown;
564
- if (ee(() => {
565
- et?.($e);
566
- }), !l) return null;
567
- let tt = Q.length > 0, nt = l.isDisabled || R.length === 0, rt = l.isDisabled || Ke.length === 0 || qe;
568
- return /* @__PURE__ */ b(ce.Portal, { children: /* @__PURE__ */ b(ce.Content, {
569
- ref: i(c, l.contentRef),
582
+ e.key === "Tab" && (e.target === A.current && t?.focus(), c.setOpen(!1));
583
+ }, vt = c?.registerListKeyDown;
584
+ if (h(() => {
585
+ vt?.(_t);
586
+ }), !c) return null;
587
+ let yt = Q.length > 0, bt = c.isDisabled || U.length === 0, xt = c.isDisabled || rt.length === 0 || it, St = Q.some((e) => e.group !== void 0), Ct = (e) => e.group ?? D, wt = St ? Array.from(new Set(Q.map(Ct))) : [], Tt = Q.find((e) => Xe.has(e.value)), Et = ot.group ?? (Tt ? Ct(Tt) : void 0), $ = Et !== void 0 && wt.includes(Et) ? Et : wt[0], Dt = (e, t) => {
588
+ st({
589
+ isOpen: at,
590
+ group: e,
591
+ enterFrom: t
592
+ }), window.requestAnimationFrame(() => {
593
+ let e = ct.current, t = e?.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
594
+ if (!e || !t) return;
595
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.left + r.width / 2 - (n.left + n.width / 2);
596
+ typeof e.scrollTo == "function" ? e.scrollTo({
597
+ left: e.scrollLeft + i,
598
+ behavior: "smooth"
599
+ }) : e.scrollLeft += i;
600
+ });
601
+ }, Ot = (e) => {
602
+ ut.current = !1, lt.current = {
603
+ x: e.clientX,
604
+ y: e.clientY,
605
+ time: e.timeStamp
606
+ };
607
+ }, kt = (e) => {
608
+ let t = lt.current;
609
+ if (lt.current = null, !t || $ === void 0) return;
610
+ let n = e.clientX - t.x, r = e.clientY - t.y, i = Math.abs(n), a = i / Math.max(e.timeStamp - t.time, 1);
611
+ if (!(i >= O || i >= he && a >= ge) || i < Math.abs(r)) return;
612
+ ut.current = !0;
613
+ let o = p === "rtl" ? n > 0 : n < 0, s = wt[wt.indexOf($) + (o ? 1 : -1)];
614
+ s !== void 0 && Dt(s, n > 0 ? "left" : "right");
615
+ }, At = (e) => {
616
+ ut.current && (ut.current = !1, e.preventDefault(), e.stopPropagation());
617
+ }, jt = Q.map((e, t) => {
618
+ if (St && Ct(e) !== $) return null;
619
+ let n = Xe.has(e.value), i = c.isDisabled || e.disabled, a = !St && e.group !== void 0 && e.group !== Q[t - 1]?.group, o = !St && e.separatorBefore === !0 && t > 0;
620
+ return /* @__PURE__ */ w(S.Fragment, { children: [
621
+ o ? /* @__PURE__ */ C("div", {
622
+ role: "separator",
623
+ "data-slot": "select-separator",
624
+ className: "zui:my-1 zui:h-px zui:bg-[var(--zui-color-border)]"
625
+ }) : null,
626
+ a ? /* @__PURE__ */ C("div", {
627
+ role: "presentation",
628
+ "data-slot": "select-group-label",
629
+ className: "zui:px-1 zui:pt-2 zui:text-start zui:text-[max(calc(var(--zui-scale,10px)*1.26),13px)] zui:font-semibold zui:text-[var(--zui-theme-text-muted)]",
630
+ children: R(e.group, u)
631
+ }) : null,
632
+ /* @__PURE__ */ w("button", {
633
+ type: "button",
634
+ id: j(k, t),
635
+ "data-slot": "select-item",
636
+ role: "option",
637
+ "aria-selected": n,
638
+ "aria-disabled": i || void 0,
639
+ disabled: i,
640
+ tabIndex: -1,
641
+ dir: p,
642
+ className: r(b, n && "zui:border-[var(--zui-theme-status-success)] zui:bg-[color-mix(in_srgb,var(--zui-theme-status-success)_8%,var(--zui-color-surface))]", e.className),
643
+ onClick: () => mt(e.value, i),
644
+ children: [/* @__PURE__ */ C("span", {
645
+ className: "zui:min-w-0 zui:flex-1 zui:break-words zui:text-start",
646
+ children: R(e.label, u)
647
+ }), /* @__PURE__ */ C("span", {
648
+ "aria-hidden": "true",
649
+ className: "zui:flex zui:shrink-0 zui:items-center",
650
+ children: n ? /* @__PURE__ */ C("span", {
651
+ className: "zui:flex zui:size-7 zui:items-center zui:justify-center zui:rounded-full zui:bg-[var(--zui-theme-status-success)] zui:text-[var(--zui-color-on-solid)]",
652
+ children: /* @__PURE__ */ C(T, {
653
+ className: "zui:size-4",
654
+ strokeWidth: 3
655
+ })
656
+ }) : null
657
+ })]
658
+ })
659
+ ] }, N(e.value, e.group));
660
+ }), Mt = /* @__PURE__ */ w("div", {
661
+ ref: Pe,
662
+ "data-slot": "select-viewport",
663
+ onScroll: tt,
664
+ className: "zui:-mx-1 zui:min-h-0 zui:flex-1 zui:touch-pan-y zui:overflow-x-hidden zui:overflow-y-auto zui:overscroll-contain zui:px-1 zui:py-1",
665
+ children: [
666
+ /* @__PURE__ */ C("div", {
667
+ id: k,
668
+ role: "listbox",
669
+ "aria-multiselectable": m || void 0,
670
+ "data-slot": "select-listbox",
671
+ className: "zui:flex zui:flex-col zui:gap-2.5",
672
+ children: jt
673
+ }),
674
+ !yt && !Ke ? /* @__PURE__ */ C("p", {
675
+ "data-slot": "select-empty",
676
+ className: "zui:px-2 zui:py-4 zui:text-center zui:text-[max(calc(var(--zui-scale,10px)*1.44),15px)] zui:text-[var(--zui-theme-text-muted)]",
677
+ children: l.select.noResults
678
+ }) : null,
679
+ Ke ? /* @__PURE__ */ C(L, {}) : null,
680
+ Je ? /* @__PURE__ */ C("p", {
681
+ "data-slot": "select-error",
682
+ className: "zui:px-2 zui:py-2 zui:text-sm zui:text-[var(--zui-theme-status-danger)]",
683
+ children: Je
684
+ }) : null,
685
+ Z ? /* @__PURE__ */ C("div", {
686
+ ref: Fe,
687
+ "data-slot": "select-infinite-scroll-sentinel",
688
+ "aria-hidden": "true",
689
+ className: "zui:h-px zui:w-full"
690
+ }) : null
691
+ ]
692
+ }), Nt = /* @__PURE__ */ w("div", {
693
+ "data-slot": "select-modal-body",
694
+ className: "zui:flex zui:min-h-0 zui:flex-1 zui:flex-col zui:gap-4",
695
+ children: [
696
+ g ? /* @__PURE__ */ w("div", {
697
+ "data-slot": "select-search",
698
+ className: "zui:flex zui:items-center zui:gap-2",
699
+ children: [
700
+ /* @__PURE__ */ C("div", {
701
+ className: "zui:min-w-0 zui:flex-1",
702
+ children: /* @__PURE__ */ C(d, {
703
+ ref: A,
704
+ type: "search",
705
+ dir: p,
706
+ role: "combobox",
707
+ "aria-expanded": x,
708
+ "aria-controls": k,
709
+ "aria-autocomplete": "list",
710
+ "aria-label": l.common.searchPlaceholder,
711
+ value: _,
712
+ placeholder: l.common.searchPlaceholder,
713
+ onChange: dt,
714
+ onKeyDown: (e) => {
715
+ e.stopPropagation(), _t(e);
716
+ }
717
+ })
718
+ }),
719
+ /* @__PURE__ */ C(f, {
720
+ label: l.select.clearAll,
721
+ icon: /* @__PURE__ */ C(pe, {
722
+ className: "zui:size-5",
723
+ "aria-hidden": "true"
724
+ }),
725
+ className: y,
726
+ disabled: bt,
727
+ onClick: () => m ? c.setMultiSelectedValues([]) : c.clearSingleSelection()
728
+ }),
729
+ m ? /* @__PURE__ */ C(f, {
730
+ label: c.multiSelectAllLabel,
731
+ icon: /* @__PURE__ */ C(fe, {
732
+ className: "zui:size-5",
733
+ "aria-hidden": "true"
734
+ }),
735
+ className: y,
736
+ disabled: xt,
737
+ onClick: ht
738
+ }) : null
739
+ ]
740
+ }) : null,
741
+ St && $ !== void 0 ? /* @__PURE__ */ w(v, {
742
+ value: $,
743
+ onValueChange: (e) => Dt(e, null),
744
+ dir: p,
745
+ className: "zui:min-h-0 zui:flex-1",
746
+ children: [/* @__PURE__ */ C("div", {
747
+ ref: ct,
748
+ "data-slot": "select-group-tabs",
749
+ className: "zui:-mx-1 zui:overflow-x-auto zui:px-1 zui:[scrollbar-width:none] zui:[&::-webkit-scrollbar]:hidden",
750
+ children: /* @__PURE__ */ C(ne, {
751
+ "aria-label": l.select.ungrouped,
752
+ className: "zui:w-max zui:min-w-full",
753
+ children: wt.map((e) => /* @__PURE__ */ C(re, {
754
+ value: e,
755
+ className: "zui:flex-none",
756
+ children: e === D ? l.select.ungrouped : R(e, u)
757
+ }, e))
758
+ })
759
+ }), /* @__PURE__ */ C("div", {
760
+ "data-slot": "select-group-swipe-area",
761
+ className: "zui:flex zui:min-h-0 zui:flex-1 zui:touch-pan-y zui:flex-col",
762
+ onPointerDown: Ot,
763
+ onPointerUp: kt,
764
+ onPointerCancel: () => {
765
+ lt.current = null;
766
+ },
767
+ onClickCapture: At,
768
+ children: /* @__PURE__ */ C(te, {
769
+ value: $,
770
+ className: r("zui:mt-0 zui:flex zui:min-h-0 zui:flex-1 zui:flex-col", ot.enterFrom === "left" && "zui:slide-in-from-left-8 zui:data-[state=active]:slide-in-from-bottom-0", ot.enterFrom === "right" && "zui:slide-in-from-right-8 zui:data-[state=active]:slide-in-from-bottom-0"),
771
+ children: Mt
772
+ }, $)
773
+ })]
774
+ }) : Mt,
775
+ /* @__PURE__ */ C(a, {
776
+ label: l.common.close,
777
+ fullWidth: !0,
778
+ onClick: () => c.setOpen(!1)
779
+ })
780
+ ]
781
+ });
782
+ return /* @__PURE__ */ w(de, { children: [/* @__PURE__ */ C(me.Portal, { children: /* @__PURE__ */ C(me.Content, {
783
+ ref: i(ee, c.contentRef),
570
784
  "data-slot": "select-content",
571
- dir: f,
785
+ dir: p,
572
786
  side: "bottom",
573
787
  align: "start",
574
788
  sideOffset: 6,
@@ -576,95 +790,90 @@ var z = v.forwardRef(function({ className: a, children: o }, c) {
576
790
  onOpenAutoFocus: (e) => e.preventDefault(),
577
791
  onCloseAutoFocus: (e) => e.preventDefault(),
578
792
  onInteractOutside: (e) => {
579
- l.fieldRootRef.current?.contains(e.target) && e.preventDefault();
793
+ c.fieldRootRef.current?.contains(e.target) && e.preventDefault();
580
794
  },
581
- className: r(p(), a),
582
- children: /* @__PURE__ */ x("div", {
583
- ref: G,
795
+ className: r(ae(), n),
796
+ children: /* @__PURE__ */ w("div", {
797
+ ref: Pe,
584
798
  "data-slot": "select-viewport",
585
- className: r(ie({ hasSearch: y }), "zui:max-h-72 zui:overflow-y-auto"),
586
- onScroll: We,
799
+ className: r(ue({ hasSearch: g }), "zui:max-h-72 zui:overflow-y-auto"),
800
+ onScroll: tt,
587
801
  children: [
588
- y ? /* @__PURE__ */ b("div", {
802
+ g ? /* @__PURE__ */ C("div", {
589
803
  "data-slot": "select-search",
590
- className: ne,
591
- children: /* @__PURE__ */ x("div", {
592
- dir: f,
804
+ className: ce,
805
+ children: /* @__PURE__ */ w("div", {
806
+ dir: p,
593
807
  className: "zui:flex zui:items-center zui:gap-1",
594
808
  children: [
595
- /* @__PURE__ */ x("div", {
596
- className: "zui:relative zui:flex-1",
597
- children: [/* @__PURE__ */ b(se, {
598
- className: "zui:pointer-events-none zui:absolute zui:start-3 zui:top-1/2 zui:size-4 zui:-translate-y-1/2 zui:text-[var(--zui-theme-text-muted)]",
599
- "aria-hidden": "true"
600
- }), /* @__PURE__ */ b("input", {
809
+ /* @__PURE__ */ C("div", {
810
+ className: "zui:min-w-0 zui:flex-1",
811
+ children: /* @__PURE__ */ C(d, {
601
812
  ref: A,
602
- type: "text",
603
- dir: f,
813
+ type: "search",
814
+ dir: p,
604
815
  role: "combobox",
605
- "aria-expanded": T,
606
- "aria-controls": O,
816
+ "aria-expanded": x,
817
+ "aria-controls": k,
607
818
  "aria-autocomplete": "list",
608
- "aria-activedescendant": E >= 0 ? fe(O, E) : void 0,
609
- "aria-label": u.common.searchPlaceholder,
610
- value: n(S, d),
611
- placeholder: u.common.searchPlaceholder,
612
- "data-slot": "select-search-input",
613
- className: r(g(), "zui:ps-9"),
614
- onChange: Je,
819
+ "aria-activedescendant": E >= 0 ? j(k, E) : void 0,
820
+ "aria-label": l.common.searchPlaceholder,
821
+ value: _,
822
+ placeholder: l.common.searchPlaceholder,
823
+ onChange: dt,
615
824
  onKeyDown: (e) => {
616
- e.stopPropagation(), $e(e);
825
+ e.stopPropagation(), _t(e);
617
826
  },
618
827
  onPointerDown: (e) => e.stopPropagation()
619
- })]
828
+ })
620
829
  }),
621
- /* @__PURE__ */ b(s, {
622
- label: u.select.clearAll,
623
- icon: /* @__PURE__ */ b(C, {
830
+ /* @__PURE__ */ C(f, {
831
+ label: l.select.clearAll,
832
+ icon: /* @__PURE__ */ C(pe, {
624
833
  className: "zui:size-4 zui:text-[var(--zui-color-text)]",
625
834
  "aria-hidden": "true"
626
835
  }),
627
- className: te,
628
- disabled: nt,
836
+ className: ie,
837
+ disabled: bt,
629
838
  onPointerDown: (e) => e.stopPropagation(),
630
- onClick: () => _ ? l.setMultiSelectedValues([]) : l.clearSingleSelection()
839
+ onClick: () => m ? c.setMultiSelectedValues([]) : c.clearSingleSelection()
631
840
  }),
632
- _ ? /* @__PURE__ */ b(s, {
633
- label: l.multiSelectAllLabel,
634
- icon: /* @__PURE__ */ b(oe, {
635
- className: r(D, "zui:text-[var(--zui-color-text)]"),
841
+ m ? /* @__PURE__ */ C(f, {
842
+ label: c.multiSelectAllLabel,
843
+ icon: /* @__PURE__ */ C(fe, {
844
+ className: r(be, "zui:text-[var(--zui-color-text)]"),
636
845
  "aria-hidden": "true"
637
846
  }),
638
- className: te,
639
- disabled: rt,
847
+ className: ie,
848
+ disabled: xt,
640
849
  onPointerDown: (e) => e.stopPropagation(),
641
- onClick: Ze
850
+ onClick: ht
642
851
  }) : null
643
852
  ]
644
853
  })
645
854
  }) : null,
646
- /* @__PURE__ */ b("div", {
647
- id: O,
855
+ /* @__PURE__ */ C("div", {
856
+ id: k,
648
857
  role: "listbox",
649
- "aria-multiselectable": _ || void 0,
858
+ "aria-multiselectable": m || void 0,
650
859
  "data-slot": "select-listbox",
651
860
  children: Q.map((e, t) => {
652
- let n = ze.has(e.value), i = l.isDisabled || e.disabled, a = e.group !== void 0 && e.group !== Q[t - 1]?.group, o = e.separatorBefore === !0 && t > 0;
653
- return /* @__PURE__ */ x(v.Fragment, { children: [
654
- o ? /* @__PURE__ */ b("div", {
861
+ let n = Xe.has(e.value), i = c.isDisabled || e.disabled, a = e.group !== void 0 && e.group !== Q[t - 1]?.group, o = e.separatorBefore === !0 && t > 0;
862
+ return /* @__PURE__ */ w(S.Fragment, { children: [
863
+ o ? /* @__PURE__ */ C("div", {
655
864
  role: "separator",
656
865
  "data-slot": "select-separator",
657
- className: re()
866
+ className: le()
658
867
  }) : null,
659
- a ? /* @__PURE__ */ b("div", {
868
+ a ? /* @__PURE__ */ C("div", {
660
869
  role: "presentation",
661
870
  "data-slot": "select-group-label",
662
- className: r(m(), t > 0 && "zui:pt-4"),
663
- children: j(e.group, d)
871
+ className: r(oe(), t > 0 && "zui:pt-4"),
872
+ children: R(e.group, u)
664
873
  }) : null,
665
- /* @__PURE__ */ x("button", {
874
+ /* @__PURE__ */ w("button", {
666
875
  type: "button",
667
- id: fe(O, t),
876
+ id: j(k, t),
668
877
  "data-slot": "select-item",
669
878
  role: "option",
670
879
  "aria-selected": n,
@@ -673,45 +882,55 @@ var z = v.forwardRef(function({ className: a, children: o }, c) {
673
882
  ref: t === E ? M : void 0,
674
883
  tabIndex: -1,
675
884
  onMouseMove: () => {
676
- !i && t !== E && l.setActiveIndex(t);
885
+ !i && t !== E && c.setActiveIndex(t);
677
886
  },
678
- dir: f,
679
- className: r(h(), e.group !== void 0 && "zui:ms-2 zui:w-[calc(100%-var(--zui-spacing)*2)] zui:border-s zui:border-s-[var(--zui-color-border)]", y && "zui:scroll-mt-16", t === Q.length - 1 && "zui:border-b-0", e.className),
887
+ dir: p,
888
+ className: r(se(), e.group !== void 0 && "zui:ms-2 zui:w-[calc(100%-var(--zui-spacing)*2)] zui:border-s zui:border-s-[var(--zui-color-border)]", g && "zui:scroll-mt-16", t === Q.length - 1 && "zui:border-b-0", e.className),
680
889
  disabled: i,
681
- onPointerDown: (t) => Ye(t, e.value, i),
682
- onClick: () => Xe(e.value, i),
683
- children: [/* @__PURE__ */ b("span", {
890
+ onPointerDown: (t) => pt(t, e.value, i),
891
+ onClick: () => mt(e.value, i),
892
+ children: [/* @__PURE__ */ C("span", {
684
893
  className: "zui:line-clamp-2 zui:min-w-0 zui:flex-1 zui:break-words zui:text-start",
685
- children: j(e.label, d)
686
- }), /* @__PURE__ */ b("span", {
894
+ children: R(e.label, u)
895
+ }), /* @__PURE__ */ C("span", {
687
896
  "aria-hidden": "true",
688
897
  className: "zui:flex zui:shrink-0 zui:items-center zui:justify-center zui:text-[var(--zui-theme-action-primary)]",
689
- children: /* @__PURE__ */ b(ae, { className: r(D, !n && "zui:opacity-0") })
898
+ children: /* @__PURE__ */ C(T, { className: r(be, !n && "zui:opacity-0") })
690
899
  })]
691
900
  })
692
- ] }, k(e.value, e.group));
901
+ ] }, N(e.value, e.group));
693
902
  })
694
903
  }),
695
- !tt && !Fe ? /* @__PURE__ */ b("p", {
904
+ !yt && !Ke ? /* @__PURE__ */ C("p", {
696
905
  "data-slot": "select-empty",
697
906
  className: "zui:px-2 zui:py-2 zui:text-xs zui:text-[var(--zui-color-text)]",
698
- children: u.select.noResults
907
+ children: l.select.noResults
699
908
  }) : null,
700
- Fe ? /* @__PURE__ */ b(Se, {}) : null,
701
- Le ? /* @__PURE__ */ b("p", {
909
+ Ke ? /* @__PURE__ */ C(L, {}) : null,
910
+ Je ? /* @__PURE__ */ C("p", {
702
911
  "data-slot": "select-error",
703
912
  className: "zui:px-2 zui:py-2 zui:text-xs zui:text-[var(--zui-theme-status-danger)]",
704
- children: Le
913
+ children: Je
705
914
  }) : null,
706
- Z ? /* @__PURE__ */ b("div", {
707
- ref: Ee,
915
+ Z ? /* @__PURE__ */ C("div", {
916
+ ref: Fe,
708
917
  "data-slot": "select-infinite-scroll-sentinel",
709
918
  "aria-hidden": "true",
710
919
  className: "zui:h-px zui:w-full"
711
920
  }) : null
712
921
  ]
713
922
  })
714
- }) });
923
+ }) }), /* @__PURE__ */ C(o, {
924
+ trigger: null,
925
+ open: c.isModal,
926
+ onOpenChange: (e) => c.setOpen(e),
927
+ dir: p,
928
+ triggerLabel: c.modalLabel,
929
+ showCloseButton: !1,
930
+ onOpenAutoFocus: (e) => e.preventDefault(),
931
+ className: "zui:mobile:h-[75dvh] zui:mobile:touch-pan-y zui:mobile:overflow-x-hidden zui:mobile:overscroll-contain zui:mobile:px-3 zui:mobile:[&>[data-slot=dialog-body]]:flex zui:mobile:[&>[data-slot=dialog-body]]:min-h-0 zui:mobile:[&>[data-slot=dialog-body]]:flex-1 zui:mobile:[&>[data-slot=dialog-body]]:flex-col",
932
+ content: Nt
933
+ })] });
715
934
  });
716
935
  //#endregion
717
- export { z as SelectContent, P as SelectGroup, N as SelectItem, F as SelectLabel, I as SelectSeparator, R as SelectTrigger, we as SelectValue, L as default };
936
+ export { K as SelectContent, V as SelectGroup, B as SelectItem, H as SelectLabel, U as SelectSeparator, W as SelectTrigger, G as SelectValue, Ae as default };