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.
- package/dist/components/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.interface.d.cts +8 -0
- package/dist/components/Accordion/Accordion.interface.d.ts +8 -0
- package/dist/components/Accordion/Accordion.js +226 -148
- package/dist/components/Accordion/Accordion.variant.cjs +1 -1
- package/dist/components/Accordion/Accordion.variant.js +2 -2
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.js +32 -32
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.interface.d.cts +0 -1
- package/dist/components/Button/Button.interface.d.ts +0 -1
- package/dist/components/Button/Button.js +41 -42
- package/dist/components/Button/Button.variant.cjs +1 -1
- package/dist/components/Button/Button.variant.d.cts +0 -1
- package/dist/components/Button/Button.variant.d.ts +0 -1
- package/dist/components/Button/Button.variant.js +2 -4
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.interface.d.cts +11 -0
- package/dist/components/Checkbox/Checkbox.interface.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.js +66 -43
- package/dist/components/Checkbox/Checkbox.variant.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.variant.d.cts +9 -4
- package/dist/components/Checkbox/Checkbox.variant.d.ts +9 -4
- package/dist/components/Checkbox/Checkbox.variant.js +20 -16
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.interface.d.cts +0 -1
- package/dist/components/DatePicker/DatePicker.interface.d.ts +0 -1
- package/dist/components/DatePicker/DatePicker.js +511 -407
- package/dist/components/DatePicker/DatePicker.utils.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.utils.js +101 -82
- package/dist/components/DatePicker/DatePicker.variant.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.variant.d.cts +1 -3
- package/dist/components/DatePicker/DatePicker.variant.d.ts +1 -3
- package/dist/components/DatePicker/DatePicker.variant.js +14 -16
- package/dist/components/DatePicker/DatePickerMonthSlider.cjs +1 -0
- package/dist/components/DatePicker/DatePickerMonthSlider.d.cts +25 -0
- package/dist/components/DatePicker/DatePickerMonthSlider.d.ts +25 -0
- package/dist/components/DatePicker/DatePickerMonthSlider.js +98 -0
- package/dist/components/DatePicker/DatePickerWheel.cjs +1 -0
- package/dist/components/DatePicker/DatePickerWheel.d.cts +30 -0
- package/dist/components/DatePicker/DatePickerWheel.d.ts +30 -0
- package/dist/components/DatePicker/DatePickerWheel.js +156 -0
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.interface.d.cts +5 -0
- package/dist/components/Dialog/Dialog.interface.d.ts +5 -0
- package/dist/components/Dialog/Dialog.js +57 -49
- package/dist/components/Dialog/Dialog.variant.cjs +1 -1
- package/dist/components/Dialog/Dialog.variant.js +1 -1
- package/dist/components/Dialog/DialogDragHandle.cjs +1 -0
- package/dist/components/Dialog/DialogDragHandle.d.cts +11 -0
- package/dist/components/Dialog/DialogDragHandle.d.ts +11 -0
- package/dist/components/Dialog/DialogDragHandle.js +55 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +38 -37
- package/dist/components/Input/Input.variant.cjs +1 -1
- package/dist/components/Input/Input.variant.d.cts +1 -3
- package/dist/components/Input/Input.variant.d.ts +1 -3
- package/dist/components/Input/Input.variant.js +9 -8
- package/dist/components/Pagination/Pagination.cjs +1 -1
- package/dist/components/Pagination/Pagination.js +90 -73
- package/dist/components/Pagination/Pagination.variant.cjs +1 -1
- package/dist/components/Pagination/Pagination.variant.d.cts +3 -1
- package/dist/components/Pagination/Pagination.variant.d.ts +3 -1
- package/dist/components/Pagination/Pagination.variant.js +12 -6
- package/dist/components/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +44 -41
- package/dist/components/RadioGroup/RadioGroup.variant.cjs +1 -1
- package/dist/components/RadioGroup/RadioGroup.variant.d.cts +3 -2
- package/dist/components/RadioGroup/RadioGroup.variant.d.ts +3 -2
- package/dist/components/RadioGroup/RadioGroup.variant.js +11 -21
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.d.cts +1 -3
- package/dist/components/Select/Select.d.ts +1 -3
- package/dist/components/Select/Select.interface.d.cts +0 -1
- package/dist/components/Select/Select.interface.d.ts +0 -1
- package/dist/components/Select/Select.js +620 -401
- package/dist/components/Select/Select.variant.cjs +1 -1
- package/dist/components/Select/Select.variant.d.cts +5 -5
- package/dist/components/Select/Select.variant.d.ts +5 -5
- package/dist/components/Select/Select.variant.js +10 -12
- package/dist/components/Sheet/Sheet.variant.cjs +1 -1
- package/dist/components/Sheet/Sheet.variant.js +6 -6
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.interface.d.cts +12 -3
- package/dist/components/Switch/Switch.interface.d.ts +12 -3
- package/dist/components/Switch/Switch.js +57 -37
- package/dist/components/Switch/Switch.variant.cjs +1 -1
- package/dist/components/Switch/Switch.variant.d.cts +9 -5
- package/dist/components/Switch/Switch.variant.d.ts +9 -5
- package/dist/components/Switch/Switch.variant.js +22 -15
- package/dist/components/Table/Table.cjs +1 -1
- package/dist/components/Table/Table.interface.d.cts +9 -0
- package/dist/components/Table/Table.interface.d.ts +9 -0
- package/dist/components/Table/Table.js +462 -271
- package/dist/components/Table/TableSkeletonRows.cjs +1 -1
- package/dist/components/Table/TableSkeletonRows.js +26 -21
- package/dist/components/Table/TableSortToggle.cjs +1 -1
- package/dist/components/Table/TableSortToggle.d.cts +1 -1
- package/dist/components/Table/TableSortToggle.d.ts +1 -1
- package/dist/components/Table/TableSortToggle.js +23 -22
- package/dist/components/Table/hooks/useTableCardLabels.cjs +1 -0
- package/dist/components/Table/hooks/useTableCardLabels.d.cts +9 -0
- package/dist/components/Table/hooks/useTableCardLabels.d.ts +9 -0
- package/dist/components/Table/hooks/useTableCardLabels.js +34 -0
- package/dist/components/Table/hooks/useTableSort.cjs +1 -1
- package/dist/components/Table/hooks/useTableSort.d.cts +2 -0
- package/dist/components/Table/hooks/useTableSort.d.ts +2 -0
- package/dist/components/Table/hooks/useTableSort.js +8 -1
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +90 -63
- package/dist/components/Tabs/Tabs.variant.cjs +1 -1
- package/dist/components/Tabs/Tabs.variant.d.cts +2 -2
- package/dist/components/Tabs/Tabs.variant.d.ts +2 -2
- package/dist/components/Tabs/Tabs.variant.js +52 -29
- package/dist/components/Textarea/Textarea.cjs +1 -1
- package/dist/components/Textarea/Textarea.js +19 -18
- package/dist/components/Textarea/Textarea.variant.cjs +1 -1
- package/dist/components/Textarea/Textarea.variant.js +5 -5
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.interface.d.cts +0 -1
- package/dist/components/TimePicker/TimePicker.interface.d.ts +0 -1
- package/dist/components/TimePicker/TimePicker.js +121 -83
- package/dist/components/TimePicker/TimePicker.variant.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.variant.d.cts +1 -3
- package/dist/components/TimePicker/TimePicker.variant.d.ts +1 -3
- package/dist/components/TimePicker/TimePicker.variant.js +9 -11
- package/dist/components/TimePicker/TimePickerPanel.cjs +1 -1
- package/dist/components/TimePicker/TimePickerPanel.js +3 -4
- package/dist/components/TimePicker/TimePickerWheel.cjs +1 -0
- package/dist/components/TimePicker/TimePickerWheel.d.cts +27 -0
- package/dist/components/TimePicker/TimePickerWheel.d.ts +27 -0
- package/dist/components/TimePicker/TimePickerWheel.js +205 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.d.cts +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/Toast/Toast.js +56 -34
- package/dist/components/Toast/Toast.variant.cjs +1 -1
- package/dist/components/Toast/Toast.variant.d.cts +1 -1
- package/dist/components/Toast/Toast.variant.d.ts +1 -1
- package/dist/components/Toast/Toast.variant.js +1 -1
- package/dist/components/Toast/ToastHost.cjs +1 -1
- package/dist/components/Toast/ToastHost.js +42 -41
- package/dist/components/Toast/function/toastHaptics.cjs +1 -0
- package/dist/components/Toast/function/toastHaptics.d.cts +11 -0
- package/dist/components/Toast/function/toastHaptics.d.ts +11 -0
- package/dist/components/Toast/function/toastHaptics.js +6 -0
- package/dist/components/Uploader/Uploader.cjs +2 -2
- package/dist/components/Uploader/Uploader.js +328 -158
- package/dist/components/Uploader/Uploader.variant.cjs +1 -1
- package/dist/components/Uploader/Uploader.variant.d.cts +1 -3
- package/dist/components/Uploader/Uploader.variant.d.ts +1 -3
- package/dist/components/Uploader/Uploader.variant.js +2 -5
- package/dist/components/shared/ActionSheet.cjs +1 -0
- package/dist/components/shared/ActionSheet.d.cts +26 -0
- package/dist/components/shared/ActionSheet.d.ts +26 -0
- package/dist/components/shared/ActionSheet.js +51 -0
- package/dist/components/shared/FieldClearButton.cjs +1 -1
- package/dist/components/shared/FieldClearButton.d.cts +2 -1
- package/dist/components/shared/FieldClearButton.d.ts +2 -1
- package/dist/components/shared/FieldClearButton.js +11 -10
- package/dist/components/shared/FieldLabel.cjs +1 -1
- package/dist/components/shared/FieldLabel.js +6 -6
- package/dist/components/shared/IconActionButton.cjs +1 -1
- package/dist/components/shared/IconActionButton.d.cts +6 -1
- package/dist/components/shared/IconActionButton.d.ts +6 -1
- package/dist/components/shared/IconActionButton.js +9 -11
- package/dist/components/shared/WheelColumn.cjs +1 -0
- package/dist/components/shared/WheelColumn.d.cts +29 -0
- package/dist/components/shared/WheelColumn.d.ts +29 -0
- package/dist/components/shared/WheelColumn.js +116 -0
- package/dist/components/shared/haptics.cjs +1 -0
- package/dist/components/shared/haptics.d.cts +6 -0
- package/dist/components/shared/haptics.d.ts +6 -0
- package/dist/components/shared/haptics.js +8 -0
- package/dist/components/shared/responsiveScale.cjs +1 -1
- package/dist/components/shared/responsiveScale.d.cts +7 -1
- package/dist/components/shared/responsiveScale.d.ts +7 -1
- package/dist/components/shared/responsiveScale.js +2 -6
- package/dist/components/shared/useStickyToolbar.cjs +1 -0
- package/dist/components/shared/useStickyToolbar.d.cts +17 -0
- package/dist/components/shared/useStickyToolbar.d.ts +17 -0
- package/dist/components/shared/useStickyToolbar.js +39 -0
- package/dist/components/shared/useWheelSize.cjs +1 -0
- package/dist/components/shared/useWheelSize.d.cts +10 -0
- package/dist/components/shared/useWheelSize.d.ts +10 -0
- package/dist/components/shared/useWheelSize.js +14 -0
- package/dist/components/shared/viewport.cjs +1 -0
- package/dist/components/shared/viewport.d.cts +17 -0
- package/dist/components/shared/viewport.d.ts +17 -0
- package/dist/components/shared/viewport.js +32 -0
- package/dist/config/messages.cjs +1 -1
- package/dist/config/messages.d.cts +14 -0
- package/dist/config/messages.d.ts +14 -0
- package/dist/config/messages.js +26 -8
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +16 -16
- 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
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
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
|
|
21
|
-
function
|
|
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
|
|
29
|
+
function Se(e) {
|
|
25
30
|
return typeof e == "string" && e.length > 0;
|
|
26
31
|
}
|
|
27
|
-
function
|
|
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
|
|
39
|
+
function N(e, t) {
|
|
35
40
|
return `${t ?? ""}\u0000${e}`;
|
|
36
41
|
}
|
|
37
|
-
function
|
|
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 =
|
|
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
|
|
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(
|
|
62
|
+
n.set(N(e.value, e.group), e);
|
|
58
63
|
}), t.forEach((e) => {
|
|
59
|
-
n.set(
|
|
64
|
+
n.set(N(e.value, e.group), e);
|
|
60
65
|
}), Array.from(n.values());
|
|
61
66
|
}
|
|
62
|
-
function
|
|
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
|
|
83
|
+
function F(e, n) {
|
|
79
84
|
return t({ value: (e.length > 0 ? e : n).toLocaleLowerCase() });
|
|
80
85
|
}
|
|
81
|
-
function
|
|
86
|
+
function Te(e) {
|
|
82
87
|
return {
|
|
83
88
|
value: e.value,
|
|
84
89
|
label: e.label,
|
|
85
|
-
searchText:
|
|
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
|
|
91
|
-
if (typeof e != "number" || !Number.isFinite(e)) return
|
|
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 :
|
|
98
|
+
return t > 0 ? t : k;
|
|
94
99
|
}
|
|
95
|
-
function
|
|
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
|
|
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
|
|
106
|
+
function Oe(e, t) {
|
|
102
107
|
return e instanceof Error && e.message.trim().length > 0 ? e.message : t;
|
|
103
108
|
}
|
|
104
|
-
function
|
|
105
|
-
return /* @__PURE__ */
|
|
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:
|
|
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
|
|
112
|
-
return typeof e == "string" ? n(e, t) : typeof e == "number" ? n(String(e), t) : Array.isArray(e) ? e.map((e, n) => /* @__PURE__ */
|
|
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
|
|
115
|
-
return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(
|
|
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
|
|
122
|
+
function B(e) {
|
|
118
123
|
return null;
|
|
119
124
|
}
|
|
120
|
-
function
|
|
125
|
+
function V(e) {
|
|
121
126
|
return null;
|
|
122
127
|
}
|
|
123
|
-
function
|
|
128
|
+
function H(e) {
|
|
124
129
|
return null;
|
|
125
130
|
}
|
|
126
|
-
function
|
|
131
|
+
function U() {
|
|
127
132
|
return null;
|
|
128
133
|
}
|
|
129
|
-
function
|
|
134
|
+
function ke(e) {
|
|
130
135
|
let t = [], n = /* @__PURE__ */ new Set(), r = !1, i = (e, a) => {
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
if (e.type ===
|
|
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 ===
|
|
138
|
-
let i = e.props, o = typeof i.value == "string" ? i.value.trim() : "", s =
|
|
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:
|
|
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 ===
|
|
156
|
+
if (e.type === V) {
|
|
152
157
|
let t = e.props.children, n;
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
let t =
|
|
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
|
|
168
|
-
let { messages: n, dir: i } = e(), { type:
|
|
169
|
-
|
|
170
|
-
}, [
|
|
171
|
-
|
|
172
|
-
}, []),
|
|
173
|
-
|
|
174
|
-
}, []), [
|
|
175
|
-
value: !
|
|
176
|
-
defaultValue: !
|
|
177
|
-
}),
|
|
178
|
-
value:
|
|
179
|
-
defaultValue: () =>
|
|
180
|
-
}), [
|
|
181
|
-
value:
|
|
182
|
-
defaultValue: !!
|
|
183
|
-
onChange:
|
|
184
|
-
}),
|
|
185
|
-
|
|
186
|
-
|
|
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 (
|
|
189
|
-
let e =
|
|
190
|
-
|
|
191
|
-
isOpen:
|
|
192
|
-
values:
|
|
193
|
-
}),
|
|
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
|
|
196
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
]),
|
|
201
|
-
|
|
202
|
-
}, []),
|
|
203
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
|
|
220
|
-
|
|
218
|
+
T,
|
|
219
|
+
O,
|
|
220
|
+
Ee,
|
|
221
221
|
Te
|
|
222
|
-
]),
|
|
223
|
-
|
|
224
|
-
|
|
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
|
|
227
|
-
id: t.id ??
|
|
228
|
-
|
|
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 ===
|
|
239
|
+
if (e.type === K) {
|
|
234
240
|
let t = e.props;
|
|
235
|
-
return
|
|
241
|
+
return S.cloneElement(e, { className: r("zui:text-start", t.className) });
|
|
236
242
|
}
|
|
237
243
|
return e;
|
|
238
|
-
}),
|
|
239
|
-
listboxId:
|
|
240
|
-
isSearch:
|
|
241
|
-
searchTerm:
|
|
242
|
-
setSearchTerm:
|
|
243
|
-
hasValue:
|
|
244
|
-
isInvalid:
|
|
245
|
-
selectType:
|
|
246
|
-
isOpen:
|
|
247
|
-
setOpen:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
|
|
268
|
-
|
|
275
|
+
be,
|
|
276
|
+
Ae,
|
|
277
|
+
Le,
|
|
278
|
+
Re,
|
|
279
|
+
J,
|
|
269
280
|
Me,
|
|
281
|
+
D,
|
|
282
|
+
h,
|
|
283
|
+
H,
|
|
270
284
|
Ne,
|
|
271
|
-
|
|
272
|
-
q,
|
|
273
|
-
ge,
|
|
274
|
-
m,
|
|
275
|
-
Oe,
|
|
276
|
-
he,
|
|
285
|
+
pe,
|
|
277
286
|
n,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
J.values,
|
|
282
|
-
xe,
|
|
283
|
-
p,
|
|
287
|
+
c,
|
|
288
|
+
o,
|
|
289
|
+
Fe,
|
|
284
290
|
U,
|
|
285
|
-
|
|
291
|
+
k,
|
|
292
|
+
q.values,
|
|
293
|
+
ve,
|
|
294
|
+
f,
|
|
295
|
+
I,
|
|
286
296
|
L,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
297
|
+
F,
|
|
298
|
+
je,
|
|
299
|
+
se,
|
|
300
|
+
a,
|
|
301
|
+
V,
|
|
302
|
+
Ie
|
|
292
303
|
]);
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
ref:
|
|
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__ */
|
|
299
|
-
title:
|
|
300
|
-
htmlFor:
|
|
301
|
-
required:
|
|
302
|
-
showRequiredMessage:
|
|
303
|
-
}), /* @__PURE__ */
|
|
304
|
-
value:
|
|
305
|
-
children: [/* @__PURE__ */
|
|
306
|
-
open:
|
|
307
|
-
onOpenChange:
|
|
308
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
321
|
+
children: /* @__PURE__ */ w("div", {
|
|
311
322
|
"data-slot": "select",
|
|
312
323
|
dir: i,
|
|
313
324
|
className: "zui:relative",
|
|
314
|
-
children: [
|
|
315
|
-
id:
|
|
316
|
-
|
|
317
|
-
|
|
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:
|
|
321
|
-
form:
|
|
330
|
+
name: oe,
|
|
331
|
+
form: y,
|
|
322
332
|
value: e
|
|
323
|
-
}, e)) : /* @__PURE__ */
|
|
333
|
+
}, e)) : /* @__PURE__ */ C("input", {
|
|
324
334
|
type: "hidden",
|
|
325
|
-
name:
|
|
326
|
-
form:
|
|
327
|
-
value:
|
|
335
|
+
name: oe,
|
|
336
|
+
form: y,
|
|
337
|
+
value: O ? I.join(",") : F ?? ""
|
|
328
338
|
}) : null]
|
|
329
339
|
})
|
|
330
340
|
})
|
|
331
|
-
}),
|
|
332
|
-
hasValue:
|
|
333
|
-
form:
|
|
334
|
-
disabled:
|
|
335
|
-
onInvalid:
|
|
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
|
|
341
|
-
let d =
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
-
ref:
|
|
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":
|
|
347
|
-
"data-state":
|
|
348
|
-
dir:
|
|
349
|
-
"aria-expanded":
|
|
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":
|
|
352
|
-
"aria-activedescendant":
|
|
353
|
-
"aria-invalid":
|
|
354
|
-
disabled:
|
|
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
|
-
|
|
367
|
+
i?.(e), !(e.defaultPrevented || v || !d) && d.setOpen(!g);
|
|
361
368
|
},
|
|
362
369
|
onKeyDown: (e) => {
|
|
363
|
-
|
|
370
|
+
a?.(e), e.defaultPrevented || d?.onListKeyDown(e);
|
|
364
371
|
},
|
|
365
|
-
...
|
|
372
|
+
...l,
|
|
366
373
|
children: [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
/* @__PURE__ */
|
|
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
|
-
}),
|
|
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
|
|
378
|
-
let o =
|
|
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__ */
|
|
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:
|
|
393
|
+
children: R(e, s)
|
|
387
394
|
});
|
|
388
395
|
}
|
|
389
|
-
let
|
|
390
|
-
return
|
|
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:
|
|
395
|
-
}) : /* @__PURE__ */
|
|
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
|
|
404
|
-
let
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
]),
|
|
409
|
-
|
|
410
|
-
|
|
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
|
|
413
|
-
let r =
|
|
414
|
-
if (!
|
|
415
|
-
let i =
|
|
416
|
-
|
|
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:
|
|
427
|
+
pageSize: je,
|
|
421
428
|
search: n
|
|
422
429
|
});
|
|
423
|
-
if (i !==
|
|
424
|
-
let o =
|
|
425
|
-
|
|
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 ===
|
|
434
|
+
i === J.current && (Ye(Oe(e, l.select.loadError)), Ge(!1));
|
|
428
435
|
} finally {
|
|
429
|
-
i ===
|
|
436
|
+
i === J.current && (Le.current = !1, qe(!1));
|
|
430
437
|
}
|
|
431
438
|
}, [
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
439
|
+
K,
|
|
440
|
+
l.select.loadError,
|
|
441
|
+
je
|
|
435
442
|
]);
|
|
436
|
-
|
|
437
|
-
if (!
|
|
443
|
+
S.useEffect(() => {
|
|
444
|
+
if (!K) return;
|
|
438
445
|
let e = window.setTimeout(() => {
|
|
439
|
-
|
|
440
|
-
},
|
|
446
|
+
Ve(_.trim());
|
|
447
|
+
}, ve);
|
|
441
448
|
return () => window.clearTimeout(e);
|
|
442
|
-
}, [
|
|
443
|
-
!
|
|
449
|
+
}, [K, _]), S.useEffect(() => {
|
|
450
|
+
!K || !x || Qe(_e, "replace", Y);
|
|
444
451
|
}, [
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
452
|
+
x,
|
|
453
|
+
K,
|
|
454
|
+
Qe,
|
|
455
|
+
Me,
|
|
449
456
|
Y
|
|
450
457
|
]);
|
|
451
|
-
let
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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 =
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
]), Z =
|
|
461
|
-
Z &&
|
|
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
|
-
|
|
465
|
-
|
|
471
|
+
Qe,
|
|
472
|
+
He,
|
|
466
473
|
Y
|
|
467
|
-
]),
|
|
474
|
+
]), tt = S.useCallback((e) => {
|
|
468
475
|
if (!Z) return;
|
|
469
476
|
let t = e.currentTarget;
|
|
470
|
-
t.scrollHeight - t.scrollTop - t.clientHeight <=
|
|
471
|
-
}, [Z,
|
|
472
|
-
|
|
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 =
|
|
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) &&
|
|
484
|
+
e.some((e) => e.isIntersecting) && et();
|
|
478
485
|
}, { root: t });
|
|
479
486
|
return n.observe(e), () => n.disconnect();
|
|
480
|
-
}, [Z,
|
|
481
|
-
let
|
|
482
|
-
if (!
|
|
483
|
-
let e =
|
|
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
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
]), Q =
|
|
491
|
-
if (
|
|
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
|
|
494
|
-
|
|
500
|
+
return nt.forEach((n) => {
|
|
501
|
+
Ze.has(n.value) ? e.push(n) : t.push(n);
|
|
495
502
|
}), [...e, ...t];
|
|
496
|
-
}, [
|
|
497
|
-
|
|
498
|
-
|
|
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
|
-
}, [
|
|
520
|
+
}, [
|
|
521
|
+
x,
|
|
522
|
+
at,
|
|
523
|
+
g
|
|
524
|
+
]), S.useEffect(() => {
|
|
504
525
|
M.current?.scrollIntoView({ block: "nearest" });
|
|
505
526
|
}, [E]);
|
|
506
|
-
let
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
|
|
536
|
+
c.setSingleSelectedValue(e), c.setOpen(!1);
|
|
517
537
|
}
|
|
518
538
|
}, [
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
]),
|
|
523
|
-
e.preventDefault(), !n && (
|
|
524
|
-
}, [
|
|
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 (
|
|
527
|
-
|
|
546
|
+
if (F.current === e) {
|
|
547
|
+
F.current = null;
|
|
528
548
|
return;
|
|
529
549
|
}
|
|
530
|
-
|
|
550
|
+
ft(e);
|
|
531
551
|
}
|
|
532
|
-
}, [
|
|
533
|
-
|
|
552
|
+
}, [ft]), ht = S.useCallback(() => {
|
|
553
|
+
m && c && c.setMultiSelectedValues(it ? [] : rt);
|
|
534
554
|
}, [
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
]),
|
|
540
|
-
if (!
|
|
541
|
-
let t =
|
|
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 && !
|
|
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 &&
|
|
575
|
+
t >= 0 && c.setActiveIndex(t);
|
|
556
576
|
return;
|
|
557
577
|
}
|
|
558
578
|
if (e.key === "Enter" && n(E)) {
|
|
559
|
-
e.preventDefault(), e.stopPropagation(),
|
|
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(),
|
|
563
|
-
},
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
}), !
|
|
567
|
-
let
|
|
568
|
-
|
|
569
|
-
|
|
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:
|
|
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
|
-
|
|
793
|
+
c.fieldRootRef.current?.contains(e.target) && e.preventDefault();
|
|
580
794
|
},
|
|
581
|
-
className: r(
|
|
582
|
-
children: /* @__PURE__ */
|
|
583
|
-
ref:
|
|
795
|
+
className: r(ae(), n),
|
|
796
|
+
children: /* @__PURE__ */ w("div", {
|
|
797
|
+
ref: Pe,
|
|
584
798
|
"data-slot": "select-viewport",
|
|
585
|
-
className: r(
|
|
586
|
-
onScroll:
|
|
799
|
+
className: r(ue({ hasSearch: g }), "zui:max-h-72 zui:overflow-y-auto"),
|
|
800
|
+
onScroll: tt,
|
|
587
801
|
children: [
|
|
588
|
-
|
|
802
|
+
g ? /* @__PURE__ */ C("div", {
|
|
589
803
|
"data-slot": "select-search",
|
|
590
|
-
className:
|
|
591
|
-
children: /* @__PURE__ */
|
|
592
|
-
dir:
|
|
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__ */
|
|
596
|
-
className: "zui:
|
|
597
|
-
children:
|
|
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: "
|
|
603
|
-
dir:
|
|
813
|
+
type: "search",
|
|
814
|
+
dir: p,
|
|
604
815
|
role: "combobox",
|
|
605
|
-
"aria-expanded":
|
|
606
|
-
"aria-controls":
|
|
816
|
+
"aria-expanded": x,
|
|
817
|
+
"aria-controls": k,
|
|
607
818
|
"aria-autocomplete": "list",
|
|
608
|
-
"aria-activedescendant": E >= 0 ?
|
|
609
|
-
"aria-label":
|
|
610
|
-
value:
|
|
611
|
-
placeholder:
|
|
612
|
-
|
|
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(),
|
|
825
|
+
e.stopPropagation(), _t(e);
|
|
617
826
|
},
|
|
618
827
|
onPointerDown: (e) => e.stopPropagation()
|
|
619
|
-
})
|
|
828
|
+
})
|
|
620
829
|
}),
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
label:
|
|
623
|
-
icon: /* @__PURE__ */
|
|
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:
|
|
628
|
-
disabled:
|
|
836
|
+
className: ie,
|
|
837
|
+
disabled: bt,
|
|
629
838
|
onPointerDown: (e) => e.stopPropagation(),
|
|
630
|
-
onClick: () =>
|
|
839
|
+
onClick: () => m ? c.setMultiSelectedValues([]) : c.clearSingleSelection()
|
|
631
840
|
}),
|
|
632
|
-
|
|
633
|
-
label:
|
|
634
|
-
icon: /* @__PURE__ */
|
|
635
|
-
className: r(
|
|
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:
|
|
639
|
-
disabled:
|
|
847
|
+
className: ie,
|
|
848
|
+
disabled: xt,
|
|
640
849
|
onPointerDown: (e) => e.stopPropagation(),
|
|
641
|
-
onClick:
|
|
850
|
+
onClick: ht
|
|
642
851
|
}) : null
|
|
643
852
|
]
|
|
644
853
|
})
|
|
645
854
|
}) : null,
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
id:
|
|
855
|
+
/* @__PURE__ */ C("div", {
|
|
856
|
+
id: k,
|
|
648
857
|
role: "listbox",
|
|
649
|
-
"aria-multiselectable":
|
|
858
|
+
"aria-multiselectable": m || void 0,
|
|
650
859
|
"data-slot": "select-listbox",
|
|
651
860
|
children: Q.map((e, t) => {
|
|
652
|
-
let n =
|
|
653
|
-
return /* @__PURE__ */
|
|
654
|
-
o ? /* @__PURE__ */
|
|
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:
|
|
866
|
+
className: le()
|
|
658
867
|
}) : null,
|
|
659
|
-
a ? /* @__PURE__ */
|
|
868
|
+
a ? /* @__PURE__ */ C("div", {
|
|
660
869
|
role: "presentation",
|
|
661
870
|
"data-slot": "select-group-label",
|
|
662
|
-
className: r(
|
|
663
|
-
children:
|
|
871
|
+
className: r(oe(), t > 0 && "zui:pt-4"),
|
|
872
|
+
children: R(e.group, u)
|
|
664
873
|
}) : null,
|
|
665
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ w("button", {
|
|
666
875
|
type: "button",
|
|
667
|
-
id:
|
|
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 &&
|
|
885
|
+
!i && t !== E && c.setActiveIndex(t);
|
|
677
886
|
},
|
|
678
|
-
dir:
|
|
679
|
-
className: r(
|
|
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) =>
|
|
682
|
-
onClick: () =>
|
|
683
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
686
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
898
|
+
children: /* @__PURE__ */ C(T, { className: r(be, !n && "zui:opacity-0") })
|
|
690
899
|
})]
|
|
691
900
|
})
|
|
692
|
-
] },
|
|
901
|
+
] }, N(e.value, e.group));
|
|
693
902
|
})
|
|
694
903
|
}),
|
|
695
|
-
!
|
|
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:
|
|
907
|
+
children: l.select.noResults
|
|
699
908
|
}) : null,
|
|
700
|
-
|
|
701
|
-
|
|
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:
|
|
913
|
+
children: Je
|
|
705
914
|
}) : null,
|
|
706
|
-
Z ? /* @__PURE__ */
|
|
707
|
-
ref:
|
|
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 {
|
|
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 };
|