zaravand-ui 7.0.1 → 7.1.0

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