haze-ui 1.27.0 → 1.28.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/Calendar/Calendar.js +222 -151
- package/dist/components/Cascader/Cascader.js +180 -146
- package/dist/components/Chart/Chart.js +12 -9
- package/dist/components/Chart/chart-elements.js +118 -42
- package/dist/components/CodeBlock/CodeBlock.js +39 -9
- package/dist/components/Combobox/Combobox.js +107 -99
- package/dist/components/DataTable/DataTable.js +224 -221
- package/dist/components/DataTable/csv.js +29 -0
- package/dist/components/DataTable/index.js +3 -2
- package/dist/components/DateRangePicker/DateRangePicker.js +31 -16
- package/dist/components/DateRangePicker/presets.js +43 -0
- package/dist/components/Datepicker/Datepicker.js +12 -11
- package/dist/components/Datepicker/DatepickerCore.js +72 -51
- package/dist/components/Datepicker/datetime.js +23 -0
- package/dist/components/Descriptions/Descriptions.js +46 -0
- package/dist/components/Descriptions/index.js +3 -0
- package/dist/components/DiffViewer/DiffViewer.js +31 -30
- package/dist/components/FilePreview/FilePreview.js +135 -0
- package/dist/components/FilePreview/file-preview-format.js +23 -0
- package/dist/components/FilePreview/index.js +3 -0
- package/dist/components/FloatButton/FloatButton.js +42 -0
- package/dist/components/FloatButton/FloatButtonGroup.js +58 -0
- package/dist/components/FloatButton/float-button-context.js +9 -0
- package/dist/components/FloatButton/float-button-glyphs.js +26 -0
- package/dist/components/FloatButton/float-button-styles.js +14 -0
- package/dist/components/FloatButton/index.js +4 -0
- package/dist/components/InlineCompletion/InlineCompletion.js +81 -0
- package/dist/components/InlineCompletion/index.js +3 -0
- package/dist/components/JsonView/JsonView.js +209 -0
- package/dist/components/JsonView/index.js +3 -0
- package/dist/components/JsonView/json-view-utils.js +24 -0
- package/dist/components/LocaleProvider/index.js +5 -4
- package/dist/components/LocaleProvider/ja-jp.js +222 -0
- package/dist/components/LocaleProvider/locale.js +42 -4
- package/dist/components/LocaleProvider/useStrings.js +13 -11
- package/dist/components/LocaleProvider/zh-cn.js +42 -4
- package/dist/components/Masonry/Masonry.js +29 -0
- package/dist/components/Masonry/index.js +3 -0
- package/dist/components/Masonry/masonry-distribute.js +15 -0
- package/dist/components/Select/Select.js +14 -13
- package/dist/components/Select/SelectCore.js +27 -26
- package/dist/components/Select/SelectFloating.js +76 -68
- package/dist/components/Signature/Signature.js +165 -0
- package/dist/components/Signature/index.js +3 -0
- package/dist/components/Signature/signature-points.js +28 -0
- package/dist/components/Sources/Sources.js +109 -0
- package/dist/components/Sources/index.js +3 -0
- package/dist/components/TagGroup/SortableTagGroup.js +26 -0
- package/dist/components/TagGroup/TagGroup.js +7 -21
- package/dist/components/TagGroup/TagGroupItem.js +1 -1
- package/dist/components/TagGroup/index.js +2 -1
- package/dist/components/TagGroup/tag-group-styles.js +7 -0
- package/dist/components/TagInput/SortableTagInput.js +24 -0
- package/dist/components/TagInput/SortableTagInputCore.js +52 -0
- package/dist/components/TagInput/TagInput.js +9 -10
- package/dist/components/TagInput/TagInputCore.js +61 -84
- package/dist/components/TagInput/index.js +3 -1
- package/dist/components/TagInput/tag-input-styles.js +7 -0
- package/dist/components/Toast/Toast.js +44 -43
- package/dist/components/Tree/Tree.js +184 -121
- package/dist/components/Tree/TreeItem.js +91 -57
- package/dist/components/Tree/utils.js +57 -1
- package/dist/components/Upload/Upload.js +12 -9
- package/dist/components/Upload/UploadCore.js +130 -124
- package/dist/components/Upload/UploadList.js +164 -36
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/cascader.css +1 -1
- package/dist/css/datepicker.css +1 -1
- package/dist/css/descriptions.css +2 -0
- package/dist/css/dialog.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/file-preview.css +2 -0
- package/dist/css/float-button.css +2 -0
- package/dist/css/inline-completion.css +2 -0
- package/dist/css/json-view.css +2 -0
- package/dist/css/masonry.css +2 -0
- package/dist/css/signature.css +2 -0
- package/dist/css/sources.css +2 -0
- package/dist/css/tag-group.css +2 -2
- package/dist/css/tag-input.css +2 -3
- package/dist/css/tree.css +2 -2
- package/dist/css/upload.css +1 -1
- package/dist/css-manifest.json +15 -0
- package/dist/haze-ui.css +20 -13
- package/dist/headless/index.js +18 -6
- package/dist/hooks/useDarkMode.js +27 -0
- package/dist/index.js +207 -192
- package/dist/registry.json +210 -34
- package/dist/types/components/Cascader/Cascader.d.ts +20 -1
- package/dist/types/components/Chart/Chart.d.ts +27 -13
- package/dist/types/components/Chart/chart-elements.d.ts +62 -10
- package/dist/types/components/Chart/index.d.ts +1 -1
- package/dist/types/components/CodeBlock/CodeBlock.d.ts +19 -2
- package/dist/types/components/CodeBlock/index.d.ts +1 -1
- package/dist/types/components/Combobox/Combobox.d.ts +11 -1
- package/dist/types/components/DataTable/DataTable.d.ts +36 -1
- package/dist/types/components/DataTable/csv.d.ts +36 -0
- package/dist/types/components/DataTable/features.d.ts +6 -0
- package/dist/types/components/DataTable/index.d.ts +2 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +15 -3
- package/dist/types/components/DateRangePicker/index.d.ts +1 -1
- package/dist/types/components/DateRangePicker/presets.d.ts +23 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +5 -1
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +6 -1
- package/dist/types/components/Datepicker/datetime.d.ts +27 -0
- package/dist/types/components/Descriptions/Descriptions.d.ts +30 -0
- package/dist/types/components/Descriptions/index.d.ts +2 -0
- package/dist/types/components/FilePreview/FilePreview.d.ts +35 -0
- package/dist/types/components/FilePreview/file-preview-format.d.ts +20 -0
- package/dist/types/components/FilePreview/index.d.ts +2 -0
- package/dist/types/components/FloatButton/FloatButton.d.ts +43 -0
- package/dist/types/components/FloatButton/FloatButtonGroup.d.ts +33 -0
- package/dist/types/components/FloatButton/float-button-context.d.ts +11 -0
- package/dist/types/components/FloatButton/float-button-glyphs.d.ts +3 -0
- package/dist/types/components/FloatButton/float-button-styles.d.ts +58 -0
- package/dist/types/components/FloatButton/index.d.ts +4 -0
- package/dist/types/components/InlineCompletion/InlineCompletion.d.ts +29 -0
- package/dist/types/components/InlineCompletion/index.d.ts +2 -0
- package/dist/types/components/JsonView/JsonView.d.ts +26 -0
- package/dist/types/components/JsonView/index.d.ts +2 -0
- package/dist/types/components/JsonView/json-view-utils.d.ts +22 -0
- package/dist/types/components/LocaleProvider/index.d.ts +1 -0
- package/dist/types/components/LocaleProvider/ja-jp.d.ts +13 -0
- package/dist/types/components/LocaleProvider/locale.d.ts +44 -0
- package/dist/types/components/Masonry/Masonry.d.ts +34 -0
- package/dist/types/components/Masonry/index.d.ts +2 -0
- package/dist/types/components/Masonry/masonry-distribute.d.ts +16 -0
- package/dist/types/components/Select/Select.d.ts +13 -1
- package/dist/types/components/Select/SelectCore.d.ts +10 -1
- package/dist/types/components/Select/SelectFloating.d.ts +12 -1
- package/dist/types/components/Signature/Signature.d.ts +51 -0
- package/dist/types/components/Signature/index.d.ts +2 -0
- package/dist/types/components/Signature/signature-points.d.ts +31 -0
- package/dist/types/components/Sources/Sources.d.ts +37 -0
- package/dist/types/components/Sources/index.d.ts +2 -0
- package/dist/types/components/TagGroup/SortableTagGroup.d.ts +20 -0
- package/dist/types/components/TagGroup/TagGroup.d.ts +4 -13
- package/dist/types/components/TagGroup/index.d.ts +2 -0
- package/dist/types/components/TagGroup/tag-group-styles.d.ts +7 -0
- package/dist/types/components/TagInput/SortableTagInput.d.ts +34 -0
- package/dist/types/components/TagInput/SortableTagInputCore.d.ts +18 -0
- package/dist/types/components/TagInput/TagInput.d.ts +1 -8
- package/dist/types/components/TagInput/TagInputCore.d.ts +4 -10
- package/dist/types/components/TagInput/index.d.ts +4 -0
- package/dist/types/components/TagInput/tag-input-styles.d.ts +12 -0
- package/dist/types/components/Tree/Tree.d.ts +1 -1
- package/dist/types/components/Tree/TreeItem.d.ts +11 -1
- package/dist/types/components/Tree/types.d.ts +25 -0
- package/dist/types/components/Tree/utils.d.ts +41 -0
- package/dist/types/components/Upload/Upload.d.ts +10 -1
- package/dist/types/components/Upload/UploadCore.d.ts +21 -1
- package/dist/types/components/Upload/UploadList.d.ts +8 -2
- package/dist/types/headless/index.d.ts +221 -4
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useDarkMode.d.ts +40 -0
- package/dist/types/index.d.ts +28 -11
- package/dist/types/utils/sortable-handle.d.ts +25 -0
- package/dist/types/utils/sortable-shared.d.ts +12 -24
- package/dist/utils/sortable-handle.js +12 -0
- package/dist/utils/sortable-shared.js +8 -16
- package/dist/utils/sortable.js +2 -1
- package/dist/utils/submenu.js +7 -5
- package/package.json +65 -5
|
@@ -5,14 +5,15 @@ import { mergeRefs as t } from "../../utils/refs.js";
|
|
|
5
5
|
import { getDirection as n } from "../../utils/direction.js";
|
|
6
6
|
import { useStrings as r } from "../LocaleProvider/useStrings.js";
|
|
7
7
|
import { FloatingPanel as i, useFloating as a } from "../../utils/floating.js";
|
|
8
|
-
import o from "../
|
|
9
|
-
import
|
|
8
|
+
import o from "../Spinner/Spinner.js";
|
|
9
|
+
import ee from "../VirtualList/VirtualList.js";
|
|
10
|
+
import { useFocusScope as te } from "../../utils/focus-scope.js";
|
|
10
11
|
/* empty css */
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { isControl as
|
|
12
|
+
import { Fragment as ne, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as re, useCallback as l, useEffect as u, useId as ie, useRef as d, useState as f } from "react";
|
|
14
|
+
import { isControl as ae, useControl as p, useThru as oe, watch as se } from "react-use-control";
|
|
14
15
|
//#region src/lib/components/Cascader/Cascader.tsx
|
|
15
|
-
var
|
|
16
|
+
var ce = "haze-Cascader__wrapper", le = "haze-Cascader__trigger", ue = "haze-Cascader__triggerValue", de = "haze-Cascader__triggerPlaceholder", fe = "haze-Cascader__triggerCaret", pe = "haze-Cascader__separator", me = "haze-Cascader__panel", he = "haze-Cascader__panelSearch", ge = "haze-Cascader__columnsStrip", _e = "haze-Cascader__searchInput", ve = "haze-Cascader__loadingBlock", ye = "haze-Cascader__emptyBlock", be = "haze-Cascader__column", xe = "haze-Cascader__columnVirtual", Se = 220, Ce = 37, we = "haze-Cascader__virtualRow", Te = "haze-Cascader__item", Ee = "haze-Cascader__itemInPath", De = "haze-Cascader__itemLabel", Oe = "haze-Cascader__chevron", ke = () => /* @__PURE__ */ s("svg", {
|
|
16
17
|
viewBox: "0 0 12 12",
|
|
17
18
|
fill: "none",
|
|
18
19
|
stroke: "currentColor",
|
|
@@ -21,8 +22,8 @@ var ae = "haze-Cascader__wrapper", oe = "haze-Cascader__trigger", se = "haze-Cas
|
|
|
21
22
|
strokeLinejoin: "round",
|
|
22
23
|
"aria-hidden": "true",
|
|
23
24
|
focusable: "false",
|
|
24
|
-
children:
|
|
25
|
-
}),
|
|
25
|
+
children: s("path", { d: "M4 2l4 4-4 4" })
|
|
26
|
+
}), Ae = () => /* @__PURE__ */ s("svg", {
|
|
26
27
|
viewBox: "0 0 12 12",
|
|
27
28
|
fill: "none",
|
|
28
29
|
stroke: "currentColor",
|
|
@@ -31,53 +32,57 @@ var ae = "haze-Cascader__wrapper", oe = "haze-Cascader__trigger", se = "haze-Cas
|
|
|
31
32
|
strokeLinejoin: "round",
|
|
32
33
|
"aria-hidden": "true",
|
|
33
34
|
focusable: "false",
|
|
34
|
-
children:
|
|
35
|
-
}),
|
|
36
|
-
function
|
|
35
|
+
children: s("path", { d: "M2 4l4 4 4-4" })
|
|
36
|
+
}), m = "[role=\"menuitem\"]";
|
|
37
|
+
function h(e) {
|
|
37
38
|
return e ? Array.from(e.querySelectorAll("[data-haze-cascader-column]")) : [];
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
return e ? Array.from(e.querySelectorAll(
|
|
40
|
+
function g(e) {
|
|
41
|
+
return e ? Array.from(e.querySelectorAll(m)) : [];
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
let
|
|
44
|
-
open:
|
|
45
|
-
setOpen:
|
|
46
|
-
triggerRef:
|
|
47
|
-
panelRef:
|
|
43
|
+
function _({ options: _, value: v, onChange: je, placeholder: Me, changeOnSelect: Ne = !1, expandTrigger: Pe = "click", onSearch: y, loading: b = !1, virtualized: x, className: Fe, ref: S, ...Ie }) {
|
|
44
|
+
let Le = r("cascader"), C = r("select"), [w, T] = p(!1, !1), E = ae(v), [D, O] = p(oe(E ? v : void 0, se((e) => je?.(e))), E ? [] : v ?? []), [k, A] = f([]), [j, M] = f(null), N = y !== void 0, [P, Re] = f(""), F = x !== void 0 && x !== !1, I = typeof x == "object" ? x : void 0, L = I?.itemHeight ?? Ce, ze = I?.overscan, R = ie(), z = d(null), Be = l((e) => t(z, S)(e), [z, S]), B = d(null), V = d(null), H = d(/* @__PURE__ */ new Map()), U = d(!1), W = a({
|
|
45
|
+
open: w,
|
|
46
|
+
setOpen: T,
|
|
47
|
+
triggerRef: z,
|
|
48
|
+
panelRef: B,
|
|
48
49
|
animated: !0
|
|
49
|
-
}),
|
|
50
|
-
enabled:
|
|
50
|
+
}), G = te({
|
|
51
|
+
enabled: w,
|
|
51
52
|
autoFocus: !1,
|
|
52
53
|
returnFocus: !0
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
let e =
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
if (!
|
|
59
|
-
|
|
54
|
+
}), K = d(!1);
|
|
55
|
+
u(() => {
|
|
56
|
+
let e = w && !K.current;
|
|
57
|
+
K.current = w, e && A(D);
|
|
58
|
+
}, [w, D]), u(() => {
|
|
59
|
+
if (!w) {
|
|
60
|
+
U.current = !1, M(null);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
if (!
|
|
63
|
-
let e =
|
|
63
|
+
if (!W.shown) return;
|
|
64
|
+
let e = j;
|
|
64
65
|
if (e) {
|
|
65
|
-
|
|
66
|
-
let t =
|
|
66
|
+
M(null);
|
|
67
|
+
let t = g(h(B.current)[e.level]), n = e.value === void 0 ? e.index : t.findIndex((t) => t.dataset.value === e.value);
|
|
67
68
|
(n >= 0 ? t[n] : t[0])?.focus();
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
if (
|
|
71
|
-
let t =
|
|
71
|
+
if (U.current) return;
|
|
72
|
+
let t = B.current;
|
|
72
73
|
if (!t) return;
|
|
73
|
-
|
|
74
|
+
if (N) {
|
|
75
|
+
U.current = !0, V.current?.focus();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let n = Array.from(t.querySelectorAll(m)), r = D.length - 1, i = D[r], a;
|
|
74
79
|
if (i !== void 0) {
|
|
75
|
-
if (
|
|
76
|
-
let e =
|
|
77
|
-
for (let t = 0; t < r; t++) e = e.find((e) => e.value ===
|
|
80
|
+
if (F && H.current.has(r)) {
|
|
81
|
+
let e = _;
|
|
82
|
+
for (let t = 0; t < r; t++) e = e.find((e) => e.value === D[t])?.children ?? [];
|
|
78
83
|
let t = e.findIndex((e) => e.value === i);
|
|
79
84
|
if (t >= 0) {
|
|
80
|
-
|
|
85
|
+
H.current.get(r)?.scrollToIndex(t, "auto"), U.current = !0, M({
|
|
81
86
|
level: r,
|
|
82
87
|
index: t,
|
|
83
88
|
value: i
|
|
@@ -87,79 +92,88 @@ function S({ options: S, value: C, onChange: ye, placeholder: be, changeOnSelect
|
|
|
87
92
|
}
|
|
88
93
|
if (a = n.find((e) => e.dataset.level === String(r) && e.dataset.value === i), !a) return;
|
|
89
94
|
} else a = n.find((e) => e.dataset.level === "0");
|
|
90
|
-
a && (
|
|
95
|
+
a && (U.current = !0, a.focus());
|
|
91
96
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
w,
|
|
98
|
+
W.shown,
|
|
99
|
+
k,
|
|
100
|
+
D,
|
|
95
101
|
j,
|
|
96
102
|
F,
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
_,
|
|
104
|
+
N
|
|
99
105
|
]);
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
let q = d(y);
|
|
107
|
+
u(() => {
|
|
108
|
+
q.current = y;
|
|
109
|
+
}, [y]);
|
|
110
|
+
let J = d(P);
|
|
111
|
+
u(() => {
|
|
112
|
+
J.current !== P && (J.current = P, q.current?.(P));
|
|
113
|
+
}, [P]), !w && P !== "" && Re("");
|
|
114
|
+
let Ve = l((e) => {
|
|
115
|
+
B.current = e, G(e);
|
|
116
|
+
}, [B, G]), He = l((e) => (t) => {
|
|
117
|
+
t ? H.current.set(e, t) : H.current.delete(e);
|
|
118
|
+
}, []), Y = [_];
|
|
119
|
+
for (let e of k) {
|
|
120
|
+
let t = Y.at(-1).find((t) => t.value === e)?.children;
|
|
107
121
|
if (!t?.length) break;
|
|
108
|
-
|
|
122
|
+
Y.push(t);
|
|
109
123
|
}
|
|
110
|
-
let
|
|
111
|
-
let n =
|
|
124
|
+
let X = (e, t) => {
|
|
125
|
+
let n = Y[e]?.[t];
|
|
112
126
|
if (n) {
|
|
113
|
-
if (
|
|
114
|
-
|
|
127
|
+
if (F) {
|
|
128
|
+
H.current.get(e)?.scrollToIndex(t, "auto"), M({
|
|
115
129
|
level: e,
|
|
116
130
|
index: t,
|
|
117
131
|
value: n.value
|
|
118
132
|
});
|
|
119
133
|
return;
|
|
120
134
|
}
|
|
121
|
-
|
|
135
|
+
g(h(B.current)[e])[t]?.focus();
|
|
122
136
|
}
|
|
123
|
-
},
|
|
124
|
-
for (let e of
|
|
125
|
-
let t =
|
|
137
|
+
}, Z = [], Q = _;
|
|
138
|
+
for (let e of D) {
|
|
139
|
+
let t = Q.find((t) => t.value === e);
|
|
126
140
|
if (!t) break;
|
|
127
|
-
|
|
141
|
+
Z.push(t), Q = t.children ?? [];
|
|
128
142
|
}
|
|
129
|
-
let
|
|
130
|
-
let n = [...
|
|
131
|
-
e.children?.length ? (
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
!
|
|
136
|
-
},
|
|
137
|
-
let t =
|
|
143
|
+
let Ue = (e, t) => {
|
|
144
|
+
let n = [...k.slice(0, t), e.value];
|
|
145
|
+
e.children?.length ? (A(n), Ne && O(n)) : (O(n), T(!1), z.current?.focus());
|
|
146
|
+
}, We = (e, t) => {
|
|
147
|
+
Pe === "hover" && A([...k.slice(0, t), e.value]);
|
|
148
|
+
}, Ge = (e) => {
|
|
149
|
+
!w && (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), T(!0));
|
|
150
|
+
}, Ke = (e) => {
|
|
151
|
+
let t = B.current;
|
|
138
152
|
if (!t) return;
|
|
139
|
-
let r = (document.activeElement instanceof HTMLElement ? document.activeElement : null)?.closest(
|
|
153
|
+
let r = (document.activeElement instanceof HTMLElement ? document.activeElement : null)?.closest(m) ?? void 0, i = r ? Number(r.dataset.level) : 0, a = n(t) === "rtl" ? "ArrowLeft" : "ArrowRight", o = a === "ArrowLeft" ? "ArrowRight" : "ArrowLeft";
|
|
140
154
|
switch (e.key) {
|
|
141
155
|
case "ArrowDown":
|
|
142
156
|
case "ArrowUp": {
|
|
143
157
|
e.preventDefault();
|
|
144
|
-
let t =
|
|
158
|
+
let t = Y[i] ?? [];
|
|
145
159
|
if (t.length === 0) return;
|
|
146
160
|
let n = r ? t.findIndex((e) => e.value === r.dataset.value) : -1, a = n < 0 ? e.key === "ArrowDown" ? 0 : t.length - 1 : (n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length;
|
|
147
|
-
|
|
161
|
+
X(i, a);
|
|
148
162
|
return;
|
|
149
163
|
}
|
|
150
164
|
case a:
|
|
151
165
|
if (r?.getAttribute("aria-haspopup") !== "true") return;
|
|
152
|
-
e.preventDefault(),
|
|
166
|
+
e.preventDefault(), A([...k.slice(0, i), r.dataset.value]), M({
|
|
153
167
|
level: i + 1,
|
|
154
168
|
index: 0
|
|
155
169
|
});
|
|
156
170
|
return;
|
|
157
171
|
case o: {
|
|
158
|
-
if (!r ||
|
|
172
|
+
if (!r || k.length === 0) return;
|
|
159
173
|
e.preventDefault();
|
|
160
|
-
let t =
|
|
161
|
-
|
|
162
|
-
level:
|
|
174
|
+
let t = k[k.length - 1];
|
|
175
|
+
A(k.slice(0, -1)), M({
|
|
176
|
+
level: k.length - 1,
|
|
163
177
|
index: 0,
|
|
164
178
|
value: t
|
|
165
179
|
});
|
|
@@ -168,30 +182,30 @@ function S({ options: S, value: C, onChange: ye, placeholder: be, changeOnSelect
|
|
|
168
182
|
case "Home":
|
|
169
183
|
case "End": {
|
|
170
184
|
e.preventDefault();
|
|
171
|
-
let t =
|
|
185
|
+
let t = Y[i] ?? [];
|
|
172
186
|
if (t.length === 0) return;
|
|
173
|
-
|
|
187
|
+
X(i, e.key === "Home" ? 0 : t.length - 1);
|
|
174
188
|
return;
|
|
175
189
|
}
|
|
176
190
|
case "Enter": {
|
|
177
191
|
if (!r) return;
|
|
178
192
|
e.preventDefault();
|
|
179
|
-
let t =
|
|
193
|
+
let t = Y[i]?.find((e) => e.value === r.dataset.value);
|
|
180
194
|
if (!t) return;
|
|
181
|
-
t.children?.length ? (
|
|
195
|
+
t.children?.length ? (A([...k.slice(0, i), t.value]), M({
|
|
182
196
|
level: i + 1,
|
|
183
197
|
index: 0
|
|
184
|
-
})) :
|
|
198
|
+
})) : Ue(t, i);
|
|
185
199
|
return;
|
|
186
200
|
}
|
|
187
201
|
case "Escape":
|
|
188
202
|
case "Tab":
|
|
189
|
-
e.preventDefault(),
|
|
203
|
+
e.preventDefault(), T(!1);
|
|
190
204
|
return;
|
|
191
205
|
}
|
|
192
|
-
},
|
|
193
|
-
let i = !!t.children?.length, a =
|
|
194
|
-
return /* @__PURE__ */
|
|
206
|
+
}, qe = (t, n, r) => {
|
|
207
|
+
let i = !!t.children?.length, a = k[n] === t.value;
|
|
208
|
+
return /* @__PURE__ */ c("button", {
|
|
195
209
|
type: "button",
|
|
196
210
|
role: "menuitem",
|
|
197
211
|
tabIndex: -1,
|
|
@@ -199,78 +213,98 @@ function S({ options: S, value: C, onChange: ye, placeholder: be, changeOnSelect
|
|
|
199
213
|
"data-value": t.value,
|
|
200
214
|
"aria-haspopup": i ? "true" : void 0,
|
|
201
215
|
"aria-expanded": i ? a : void 0,
|
|
202
|
-
"aria-setsize":
|
|
203
|
-
"aria-posinset":
|
|
204
|
-
onClick: () =>
|
|
205
|
-
onMouseEnter: () =>
|
|
216
|
+
"aria-setsize": F ? Y[n]?.length : void 0,
|
|
217
|
+
"aria-posinset": F ? r + 1 : void 0,
|
|
218
|
+
onClick: () => Ue(t, n),
|
|
219
|
+
onMouseEnter: () => We(t, n),
|
|
206
220
|
className: e([
|
|
207
|
-
|
|
208
|
-
a &&
|
|
209
|
-
|
|
221
|
+
Te,
|
|
222
|
+
a && Ee,
|
|
223
|
+
F && we
|
|
210
224
|
]),
|
|
211
|
-
children: [/* @__PURE__ */
|
|
212
|
-
className: e(
|
|
225
|
+
children: [/* @__PURE__ */ s("span", {
|
|
226
|
+
className: e(De),
|
|
213
227
|
children: t.label
|
|
214
|
-
}), i && /* @__PURE__ */
|
|
228
|
+
}), i && /* @__PURE__ */ s("span", {
|
|
215
229
|
role: "img",
|
|
216
|
-
"aria-label":
|
|
217
|
-
className: e(
|
|
218
|
-
children: /* @__PURE__ */
|
|
230
|
+
"aria-label": Le.expand,
|
|
231
|
+
className: e(Oe),
|
|
232
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
219
233
|
})]
|
|
220
234
|
}, t.value);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
className: e([
|
|
225
|
-
children:
|
|
226
|
-
ref:
|
|
235
|
+
}, Je = Y.map((t, n) => /* @__PURE__ */ s("div", {
|
|
236
|
+
role: "menu",
|
|
237
|
+
"data-haze-cascader-column": n,
|
|
238
|
+
className: e([be, F && xe]),
|
|
239
|
+
children: F ? /* @__PURE__ */ s(ee, {
|
|
240
|
+
ref: He(n),
|
|
241
|
+
"data-virtualized": !0,
|
|
242
|
+
items: t,
|
|
243
|
+
height: Math.min(Se, t.length * L),
|
|
244
|
+
itemHeight: L,
|
|
245
|
+
overscan: ze,
|
|
246
|
+
renderItem: (e, t) => qe(e, n, t)
|
|
247
|
+
}) : t.map((e, t) => qe(e, n, t))
|
|
248
|
+
}, n)), $ = b ? /* @__PURE__ */ c("div", {
|
|
249
|
+
className: e(ve),
|
|
250
|
+
children: [/* @__PURE__ */ s(o, { size: "sm" }), /* @__PURE__ */ s("span", { children: C.loading })]
|
|
251
|
+
}) : N && _.length === 0 ? /* @__PURE__ */ s("div", {
|
|
252
|
+
className: e(ye),
|
|
253
|
+
children: C.noMatch
|
|
254
|
+
}) : Je;
|
|
255
|
+
return /* @__PURE__ */ c("div", {
|
|
256
|
+
...Ie,
|
|
257
|
+
className: e([ce, Fe]),
|
|
258
|
+
children: [/* @__PURE__ */ c("button", {
|
|
259
|
+
ref: Be,
|
|
227
260
|
type: "button",
|
|
228
|
-
style:
|
|
261
|
+
style: W.triggerStyle,
|
|
229
262
|
"aria-haspopup": "menu",
|
|
230
|
-
"aria-expanded":
|
|
231
|
-
"aria-controls":
|
|
232
|
-
onPointerDown:
|
|
233
|
-
onClick:
|
|
234
|
-
onKeyDown:
|
|
235
|
-
className: e(
|
|
236
|
-
children: [/* @__PURE__ */
|
|
237
|
-
className: e(
|
|
238
|
-
children:
|
|
239
|
-
className: e(
|
|
240
|
-
children:
|
|
241
|
-
}) :
|
|
242
|
-
className: e(
|
|
263
|
+
"aria-expanded": w,
|
|
264
|
+
"aria-controls": R,
|
|
265
|
+
onPointerDown: W.onTriggerPointerDown,
|
|
266
|
+
onClick: W.onTriggerClick,
|
|
267
|
+
onKeyDown: Ge,
|
|
268
|
+
className: e(le),
|
|
269
|
+
children: [/* @__PURE__ */ s("span", {
|
|
270
|
+
className: e(ue),
|
|
271
|
+
children: Z.length === 0 ? /* @__PURE__ */ s("span", {
|
|
272
|
+
className: e(de),
|
|
273
|
+
children: Me
|
|
274
|
+
}) : Z.map((t, n) => /* @__PURE__ */ c(re, { children: [n > 0 && /* @__PURE__ */ s("span", {
|
|
275
|
+
className: e(pe),
|
|
243
276
|
children: " / "
|
|
244
277
|
}), t.label] }, t.value))
|
|
245
|
-
}), /* @__PURE__ */
|
|
278
|
+
}), /* @__PURE__ */ s("span", {
|
|
246
279
|
"aria-hidden": "true",
|
|
247
|
-
className: e(
|
|
248
|
-
children: /* @__PURE__ */
|
|
280
|
+
className: e(fe),
|
|
281
|
+
children: /* @__PURE__ */ s(Ae, {})
|
|
249
282
|
})]
|
|
250
|
-
}), /* @__PURE__ */
|
|
251
|
-
ref:
|
|
252
|
-
behavior:
|
|
283
|
+
}), /* @__PURE__ */ s(i, {
|
|
284
|
+
ref: Ve,
|
|
285
|
+
behavior: W,
|
|
253
286
|
placement: "bottom",
|
|
254
|
-
id:
|
|
255
|
-
role: "menu",
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
287
|
+
id: N ? void 0 : R,
|
|
288
|
+
role: N || b ? void 0 : "menu",
|
|
289
|
+
"aria-busy": b || void 0,
|
|
290
|
+
visualClass: N ? he : me,
|
|
291
|
+
onKeyDown: Ke,
|
|
292
|
+
children: N ? /* @__PURE__ */ c(ne, { children: [/* @__PURE__ */ s("input", {
|
|
293
|
+
ref: V,
|
|
294
|
+
type: "text",
|
|
295
|
+
"aria-label": C.searchLabel,
|
|
296
|
+
placeholder: C.searchPlaceholder,
|
|
297
|
+
value: P,
|
|
298
|
+
onChange: (e) => Re(e.target.value),
|
|
299
|
+
className: e(_e)
|
|
300
|
+
}), /* @__PURE__ */ s("div", {
|
|
301
|
+
id: R,
|
|
302
|
+
role: !b && _.length > 0 ? "menu" : void 0,
|
|
303
|
+
className: e(ge),
|
|
304
|
+
children: $
|
|
305
|
+
})] }) : $
|
|
272
306
|
})]
|
|
273
307
|
});
|
|
274
308
|
}
|
|
275
309
|
//#endregion
|
|
276
|
-
export {
|
|
310
|
+
export { _ as default };
|
|
@@ -7,23 +7,26 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
7
7
|
import { useMemo as i } from "react";
|
|
8
8
|
//#region src/lib/components/Chart/Chart.tsx
|
|
9
9
|
var a = "haze-Chart__root";
|
|
10
|
-
function o({ type: o, data: s, series: c, xKey: l, height: u = 300,
|
|
11
|
-
let
|
|
10
|
+
function o({ type: o, data: s, series: c, xKey: l, height: u = 300, innerRadius: d = 0, layout: f = "horizontal", renderTooltip: p, showLegend: m = !1, showGrid: h = !0, showTooltip: g = !0, className: _, style: v, ...y }) {
|
|
11
|
+
let b = i(() => n(c), [c]);
|
|
12
12
|
return /* @__PURE__ */ r("div", {
|
|
13
13
|
style: {
|
|
14
14
|
height: u,
|
|
15
|
-
...
|
|
15
|
+
...v
|
|
16
16
|
},
|
|
17
|
-
...
|
|
18
|
-
className: e([a,
|
|
17
|
+
...y,
|
|
18
|
+
className: e([a, _]),
|
|
19
19
|
children: t({
|
|
20
20
|
type: o,
|
|
21
21
|
data: s,
|
|
22
22
|
xKey: l,
|
|
23
|
-
showGrid:
|
|
24
|
-
showTooltip:
|
|
25
|
-
showLegend:
|
|
26
|
-
series:
|
|
23
|
+
showGrid: h,
|
|
24
|
+
showTooltip: g,
|
|
25
|
+
showLegend: m,
|
|
26
|
+
series: b,
|
|
27
|
+
layout: f,
|
|
28
|
+
innerRadius: d,
|
|
29
|
+
renderTooltip: p ? (e) => p(e) : void 0
|
|
27
30
|
})
|
|
28
31
|
});
|
|
29
32
|
}
|