haze-ui 1.30.0 → 1.31.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/README.md +35 -1
- package/dist/components/ActivityRail/ActivityRail.js +76 -0
- package/dist/components/ActivityRail/index.js +3 -0
- package/dist/components/BottomSheet/BottomSheet.js +12 -26
- package/dist/components/ConversationList/ConversationList.js +16 -7
- package/dist/components/List/List.js +14 -10
- package/dist/components/LocaleProvider/ar-sa.js +7 -0
- package/dist/components/LocaleProvider/de-de.js +7 -0
- package/dist/components/LocaleProvider/es-es.js +7 -0
- package/dist/components/LocaleProvider/fr-fr.js +7 -0
- package/dist/components/LocaleProvider/it-it.js +7 -0
- package/dist/components/LocaleProvider/ja-jp.js +7 -0
- package/dist/components/LocaleProvider/ko-kr.js +7 -0
- package/dist/components/LocaleProvider/locale.js +7 -0
- package/dist/components/LocaleProvider/pt-br.js +7 -0
- package/dist/components/LocaleProvider/ru-ru.js +7 -0
- package/dist/components/LocaleProvider/zh-cn.js +7 -0
- package/dist/components/LogViewer/LogViewer.js +45 -38
- package/dist/components/OTPInput/OTPInputCore.js +1 -0
- package/dist/components/Resizable/Resizable.js +266 -36
- package/dist/components/Sparkline/Sparkline.js +45 -0
- package/dist/components/Sparkline/index.js +3 -0
- package/dist/components/Sparkline/sparkline-styles.js +18 -0
- package/dist/components/StatusBar/StatusBar.js +47 -0
- package/dist/components/StatusBar/index.js +3 -0
- package/dist/components/TabBar/TabBar.js +60 -0
- package/dist/components/TabBar/index.js +3 -0
- package/dist/components/Tabs/SortableTabList.js +116 -0
- package/dist/components/Tabs/Tab.js +83 -16
- package/dist/components/Tabs/TabList.js +94 -38
- package/dist/components/Tabs/edge-scroll.js +6 -0
- package/dist/components/Tabs/index.js +4 -3
- package/dist/components/Tabs/tab-metas.js +24 -0
- package/dist/components/TagInput/SortableTagInputCore.js +11 -11
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toast/{toast2.js → toast-channel.js} +1 -1
- package/dist/components/Toast/useToast.js +1 -1
- package/dist/components/Tree/SortableTree.js +39 -39
- package/dist/components/VirtualList/VirtualList.js +133 -121
- package/dist/components/Workbench/Workbench.js +144 -0
- package/dist/components/Workbench/index.js +3 -0
- package/dist/css/activity-rail.css +2 -0
- package/dist/css/app-shell.css +1 -1
- package/dist/css/breadcrumb.css +1 -1
- package/dist/css/checkbox.css +1 -1
- package/dist/css/command.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/date-range-picker.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +2 -2
- package/dist/css/hover-card.css +1 -1
- package/dist/css/list.css +1 -1
- package/dist/css/menu.css +2 -2
- package/dist/css/popover.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/resizable.css +1 -1
- package/dist/css/segmented.css +1 -1
- package/dist/css/sidebar.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/sparkline.css +2 -0
- package/dist/css/status-bar.css +2 -0
- package/dist/css/switch.css +1 -1
- package/dist/css/tab-bar.css +2 -0
- package/dist/css/tabs.css +3 -2
- package/dist/css/tag.css +1 -1
- package/dist/css/tree.css +1 -1
- package/dist/css/workbench.css +2 -0
- package/dist/css-manifest.json +16 -0
- package/dist/dates/adapter.js +9 -1
- package/dist/dates/buddhist.js +43 -0
- package/dist/dates/ethiopic.js +67 -0
- package/dist/dates/hebrew.js +95 -0
- package/dist/dates/japanese.js +41 -0
- package/dist/dates/persian.js +121 -0
- package/dist/dates/registry.js +14 -4
- package/dist/haze-ui.css +30 -24
- package/dist/index.js +253 -241
- package/dist/mcp-docs.json +555 -10
- package/dist/registry.json +115 -5
- package/dist/types/components/ActivityRail/ActivityRail.d.ts +30 -0
- package/dist/types/components/ActivityRail/index.d.ts +4 -0
- package/dist/types/components/ConversationList/ConversationList.d.ts +10 -1
- package/dist/types/components/List/List.d.ts +10 -1
- package/dist/types/components/LocaleProvider/locale.d.ts +7 -0
- package/dist/types/components/LogViewer/LogViewer.d.ts +10 -1
- package/dist/types/components/Resizable/Resizable.d.ts +24 -7
- package/dist/types/components/Resizable/index.d.ts +1 -1
- package/dist/types/components/Sparkline/Sparkline.d.ts +31 -0
- package/dist/types/components/Sparkline/index.d.ts +3 -0
- package/dist/types/components/Sparkline/sparkline-styles.d.ts +26 -0
- package/dist/types/components/StatusBar/StatusBar.d.ts +18 -0
- package/dist/types/components/StatusBar/index.d.ts +3 -0
- package/dist/types/components/TabBar/TabBar.d.ts +23 -0
- package/dist/types/components/TabBar/index.d.ts +4 -0
- package/dist/types/components/Tabs/SortableTabList.d.ts +46 -0
- package/dist/types/components/Tabs/Tab.d.ts +54 -3
- package/dist/types/components/Tabs/TabList.d.ts +26 -2
- package/dist/types/components/Tabs/edge-scroll.d.ts +17 -0
- package/dist/types/components/Tabs/index.d.ts +3 -1
- package/dist/types/components/Tabs/tab-metas.d.ts +20 -0
- package/dist/types/components/Toast/index.d.ts +2 -2
- package/dist/types/components/Toast/useToast.d.ts +1 -1
- package/dist/types/components/VirtualList/VirtualList.d.ts +20 -1
- package/dist/types/components/Workbench/Workbench.d.ts +50 -0
- package/dist/types/components/Workbench/index.d.ts +2 -0
- package/dist/types/dates/adapter.d.ts +33 -6
- package/dist/types/dates/buddhist.d.ts +14 -0
- package/dist/types/dates/ethiopic.d.ts +15 -0
- package/dist/types/dates/hebrew.d.ts +19 -0
- package/dist/types/dates/index.d.ts +5 -0
- package/dist/types/dates/japanese.d.ts +16 -0
- package/dist/types/dates/persian.d.ts +18 -0
- package/dist/types/dates/registry.d.ts +1 -1
- package/dist/types/index.d.ts +13 -3
- package/dist/types/utils/sortable.d.ts +8 -1
- package/dist/types/utils/use-end-reached.d.ts +56 -0
- package/dist/types/utils/viewport.d.ts +12 -0
- package/dist/utils/sortable-shared.js +3 -3
- package/dist/utils/sortable.js +15 -14
- package/dist/utils/use-end-reached.js +46 -0
- package/dist/utils/viewport.js +20 -0
- package/package.json +12 -4
- /package/dist/types/components/Toast/{toast.d.ts → toast-channel.d.ts} +0 -0
|
@@ -1,30 +1,97 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { classnames as e } from "../../utils/classnames.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
5
|
+
import { useTabsContext as n } from "./TabsContext.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { jsx as
|
|
7
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
8
|
//#region src/lib/components/Tabs/Tab.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var o = "haze-Tab__base", s = "haze-Tab__active", c = "haze-Tab__iconSlot", l = "haze-Tab__statusDot", u = {
|
|
10
|
+
dirty: "haze-Tab__dirty",
|
|
11
|
+
error: "haze-Tab__error",
|
|
12
|
+
syncing: "haze-Tab__syncing"
|
|
13
|
+
}, d = "haze-Tab__srOnly", f = "haze-Tab__labelContent", p = "haze-Tab__closeGlyph", m = "haze-Tab__closablePad", h = {
|
|
14
|
+
dirty: "statusDirty",
|
|
15
|
+
error: "statusError",
|
|
16
|
+
syncing: "statusSyncing"
|
|
17
|
+
};
|
|
18
|
+
function g({ status: t }) {
|
|
19
|
+
return /* @__PURE__ */ i("span", {
|
|
20
|
+
"data-slot": "tab-status-dot",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: e([l, u[t]])
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function _({ value: l, icon: u, status: _, statusLabel: v, closable: y = !1, closeLabel: b, onClose: x, className: S, children: C }) {
|
|
26
|
+
let { value: w, setValue: T, classNames: E } = n(), D = t("tabs"), O = w === l, k = (e) => {
|
|
27
|
+
e.stopPropagation(), x?.(e);
|
|
28
|
+
}, A = /* @__PURE__ */ a(r, { children: [
|
|
29
|
+
u !== void 0 && /* @__PURE__ */ i("span", {
|
|
30
|
+
"data-slot": "icon",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
className: e(c),
|
|
33
|
+
children: u
|
|
34
|
+
}),
|
|
35
|
+
C,
|
|
36
|
+
_ !== void 0 && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(g, { status: _ }), /* @__PURE__ */ i("span", {
|
|
37
|
+
className: e(d),
|
|
38
|
+
children: v ?? D[h[_]]
|
|
39
|
+
})] })
|
|
40
|
+
] });
|
|
41
|
+
return y ? /* @__PURE__ */ a("div", {
|
|
42
|
+
"data-slot": "tab",
|
|
43
|
+
role: "tab",
|
|
44
|
+
"aria-selected": O,
|
|
45
|
+
"aria-controls": `tabpanel-${l}`,
|
|
46
|
+
tabIndex: O ? 0 : -1,
|
|
47
|
+
"data-haze-tab-value": l,
|
|
48
|
+
onKeyDown: (e) => {
|
|
49
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
50
|
+
e.preventDefault(), T(l);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
e.key === "Delete" && (e.preventDefault(), x?.(e));
|
|
54
|
+
},
|
|
55
|
+
onClick: () => T(l),
|
|
56
|
+
className: e([
|
|
57
|
+
o,
|
|
58
|
+
O && s,
|
|
59
|
+
m,
|
|
60
|
+
S,
|
|
61
|
+
E?.tab
|
|
62
|
+
]),
|
|
63
|
+
children: [/* @__PURE__ */ i("span", {
|
|
64
|
+
"data-slot": "tab-label",
|
|
65
|
+
className: e(f),
|
|
66
|
+
children: A
|
|
67
|
+
}), /* @__PURE__ */ i("span", {
|
|
68
|
+
role: "button",
|
|
69
|
+
"data-slot": "tab-close",
|
|
70
|
+
"aria-label": b ?? D.close,
|
|
71
|
+
onClick: k,
|
|
72
|
+
className: e(p),
|
|
73
|
+
children: /* @__PURE__ */ i("span", {
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: "×"
|
|
76
|
+
})
|
|
77
|
+
})]
|
|
78
|
+
}) : /* @__PURE__ */ i("button", {
|
|
12
79
|
type: "button",
|
|
13
80
|
"data-slot": "tab",
|
|
14
81
|
role: "tab",
|
|
15
|
-
"aria-selected":
|
|
16
|
-
"aria-controls": `tabpanel-${
|
|
17
|
-
tabIndex:
|
|
18
|
-
"data-haze-tab-value":
|
|
19
|
-
onClick: () => l
|
|
82
|
+
"aria-selected": O,
|
|
83
|
+
"aria-controls": `tabpanel-${l}`,
|
|
84
|
+
tabIndex: O ? 0 : -1,
|
|
85
|
+
"data-haze-tab-value": l,
|
|
86
|
+
onClick: () => T(l),
|
|
20
87
|
className: e([
|
|
21
|
-
r,
|
|
22
|
-
d && i,
|
|
23
88
|
o,
|
|
24
|
-
|
|
89
|
+
O && s,
|
|
90
|
+
S,
|
|
91
|
+
E?.tab
|
|
25
92
|
]),
|
|
26
|
-
children:
|
|
93
|
+
children: A
|
|
27
94
|
});
|
|
28
95
|
}
|
|
29
96
|
//#endregion
|
|
30
|
-
export {
|
|
97
|
+
export { g as TabStatusDot, _ as default };
|
|
@@ -2,47 +2,103 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { classnames as e } from "../../utils/classnames.js";
|
|
4
4
|
import { getDirection as t } from "../../utils/direction.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useStrings as n } from "../LocaleProvider/useStrings.js";
|
|
6
|
+
import { useTabsContext as r } from "./TabsContext.js";
|
|
7
|
+
import i from "../Menu/Menu.js";
|
|
8
|
+
import { TabStatusDot as a } from "./Tab.js";
|
|
9
|
+
import { collectTabMetas as o } from "./tab-metas.js";
|
|
6
10
|
/* empty css */
|
|
7
|
-
import { useRef as
|
|
8
|
-
import { jsx as
|
|
11
|
+
import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
12
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
13
|
+
import { useControl as m } from "react-use-control";
|
|
9
14
|
//#region src/lib/components/Tabs/TabList.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let { setValue:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let n = Array.from(d.current?.querySelectorAll(o) ?? []);
|
|
19
|
-
if (n.length === 0) return;
|
|
20
|
-
let r = n.indexOf(document.activeElement), i = (e) => {
|
|
21
|
-
let t = n[e];
|
|
22
|
-
t && (t.focus(), l(t.dataset.hazeTabValue ?? ""));
|
|
23
|
-
}, a = t(d.current) === "rtl" ? "ArrowLeft" : "ArrowRight", s = a === "ArrowLeft" ? "ArrowRight" : "ArrowLeft";
|
|
24
|
-
switch (e.key) {
|
|
25
|
-
case a:
|
|
26
|
-
e.preventDefault(), i(r < 0 ? 0 : (r + 1) % n.length);
|
|
27
|
-
return;
|
|
28
|
-
case s:
|
|
29
|
-
e.preventDefault(), i(r < 0 ? n.length - 1 : (r - 1 + n.length) % n.length);
|
|
30
|
-
return;
|
|
31
|
-
case "Home":
|
|
32
|
-
e.preventDefault(), i(0);
|
|
33
|
-
return;
|
|
34
|
-
case "End":
|
|
35
|
-
e.preventDefault(), i(n.length - 1);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
15
|
+
var h = "haze-TabList__base", g = "haze-TabList__grow", _ = "haze-TabList__bar", v = "haze-TabList__overflowArea", y = "haze-TabList__overflowButton", b = "haze-TabList__menuTabLabel", x = "[role=\"tab\"]:not([disabled])";
|
|
16
|
+
function S({ className: S, listRef: C, overflowLabel: w, children: T, tabMetas: E }) {
|
|
17
|
+
let { value: D, setValue: O, classNames: k } = r(), A = n("tabs"), j = u(null), M = C ?? j, [N, P] = d(!1), [, F, I] = m(void 0, !1), L = l(() => E ?? o(T), [E, T]), R = l(() => L.length === 0 ? [] : [{
|
|
18
|
+
type: "group",
|
|
19
|
+
key: `tab-list-overflow-${D}`,
|
|
20
|
+
value: D,
|
|
21
|
+
onValueChange: (e) => {
|
|
22
|
+
O(e), F(!1);
|
|
38
23
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
children: L.map((t) => ({
|
|
25
|
+
type: "radio",
|
|
26
|
+
key: t.value,
|
|
27
|
+
value: t.value,
|
|
28
|
+
icon: t.icon,
|
|
29
|
+
label: t.status ? /* @__PURE__ */ p("span", {
|
|
30
|
+
className: e(b),
|
|
31
|
+
children: [/* @__PURE__ */ f(a, { status: t.status }), t.label]
|
|
32
|
+
}) : t.label
|
|
33
|
+
}))
|
|
34
|
+
}], [
|
|
35
|
+
L,
|
|
36
|
+
D,
|
|
37
|
+
O,
|
|
38
|
+
F
|
|
39
|
+
]), z = s(() => {
|
|
40
|
+
let e = M.current;
|
|
41
|
+
e && P(e.scrollWidth > e.clientWidth + 1);
|
|
42
|
+
}, []);
|
|
43
|
+
return c(() => {
|
|
44
|
+
let e = M.current;
|
|
45
|
+
if (!e || (z(), typeof ResizeObserver > "u")) return;
|
|
46
|
+
let t = new ResizeObserver(z);
|
|
47
|
+
return t.observe(e), () => t.disconnect();
|
|
48
|
+
}, [z, T]), /* @__PURE__ */ p("div", {
|
|
49
|
+
"data-slot": "tab-bar",
|
|
50
|
+
className: e(_),
|
|
51
|
+
children: [/* @__PURE__ */ f("div", {
|
|
52
|
+
ref: M,
|
|
53
|
+
"data-slot": "tab-list",
|
|
54
|
+
role: "tablist",
|
|
55
|
+
onKeyDown: (e) => {
|
|
56
|
+
let n = Array.from(M.current?.querySelectorAll(x) ?? []);
|
|
57
|
+
if (n.length === 0) return;
|
|
58
|
+
let r = document.activeElement, i = n.findIndex((e) => e.contains(r)), a = (e) => {
|
|
59
|
+
let t = n[e];
|
|
60
|
+
t && (t.focus(), O(t.dataset.hazeTabValue ?? ""));
|
|
61
|
+
}, o = t(M.current) === "rtl" ? "ArrowLeft" : "ArrowRight", s = o === "ArrowLeft" ? "ArrowRight" : "ArrowLeft";
|
|
62
|
+
switch (e.key) {
|
|
63
|
+
case o:
|
|
64
|
+
e.preventDefault(), a(i < 0 ? 0 : (i + 1) % n.length);
|
|
65
|
+
return;
|
|
66
|
+
case s:
|
|
67
|
+
e.preventDefault(), a(i < 0 ? n.length - 1 : (i - 1 + n.length) % n.length);
|
|
68
|
+
return;
|
|
69
|
+
case "Home":
|
|
70
|
+
e.preventDefault(), a(0);
|
|
71
|
+
return;
|
|
72
|
+
case "End":
|
|
73
|
+
e.preventDefault(), a(n.length - 1);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
className: e([
|
|
78
|
+
h,
|
|
79
|
+
g,
|
|
80
|
+
S,
|
|
81
|
+
k?.list
|
|
82
|
+
]),
|
|
83
|
+
children: T
|
|
84
|
+
}), N && L.length > 0 && /* @__PURE__ */ f("div", {
|
|
85
|
+
"data-slot": "tab-overflow",
|
|
86
|
+
className: e(v),
|
|
87
|
+
children: /* @__PURE__ */ f(i, {
|
|
88
|
+
open: I,
|
|
89
|
+
trigger: /* @__PURE__ */ f("button", {
|
|
90
|
+
type: "button",
|
|
91
|
+
"aria-label": w ?? A.moreTabs,
|
|
92
|
+
className: e(y),
|
|
93
|
+
children: /* @__PURE__ */ f("span", {
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
children: "⋯"
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
items: R
|
|
99
|
+
})
|
|
100
|
+
})]
|
|
45
101
|
});
|
|
46
102
|
}
|
|
47
103
|
//#endregion
|
|
48
|
-
export {
|
|
104
|
+
export { S as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e from "./Tabs.js";
|
|
3
|
-
import t from "./
|
|
4
|
-
import n from "./
|
|
3
|
+
import t from "./Tab.js";
|
|
4
|
+
import n from "./TabList.js";
|
|
5
5
|
import r from "./TabPanel.js";
|
|
6
|
-
|
|
6
|
+
import i from "./SortableTabList.js";
|
|
7
|
+
export { i as SortableTabList, t as Tab, n as TabList, r as TabPanel, e as Tabs };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "./Tab.js";
|
|
3
|
+
import { Children as t, Fragment as n, isValidElement as r } from "react";
|
|
4
|
+
//#region src/lib/components/Tabs/tab-metas.ts
|
|
5
|
+
function i(i) {
|
|
6
|
+
let a = [], o = (i) => {
|
|
7
|
+
t.forEach(i, (t) => {
|
|
8
|
+
if (r(t)) {
|
|
9
|
+
if (t.type === e) {
|
|
10
|
+
let { value: e, icon: n, status: r, children: i } = t.props;
|
|
11
|
+
a.push({
|
|
12
|
+
value: e,
|
|
13
|
+
icon: n,
|
|
14
|
+
status: r,
|
|
15
|
+
label: i
|
|
16
|
+
});
|
|
17
|
+
} else t.type === n && o(t.props.children);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
return o(i), a;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { i as collectTabMetas };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
import { sortableItemStyle as t } from "../../utils/sortable-shared.js";
|
|
4
|
-
import {
|
|
5
|
-
import a from "./
|
|
6
|
-
import
|
|
4
|
+
import { SortableRegion as n } from "../../utils/sortable.js";
|
|
5
|
+
import { removeBtn as r, tag as i, tagHandle as a } from "./tag-input-styles.js";
|
|
6
|
+
import o from "./TagInputCore.js";
|
|
7
7
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
8
|
import { rectSortingStrategy as l, useSortable as u } from "@dnd-kit/sortable";
|
|
9
9
|
//#region src/lib/components/TagInput/SortableTagInputCore.tsx
|
|
10
|
-
function d({ id:
|
|
11
|
-
let { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: g, isDragging: _ } = u({ id:
|
|
10
|
+
function d({ id: n, label: o, removeLabel: l, onRemove: d }) {
|
|
11
|
+
let { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: g, isDragging: _ } = u({ id: n });
|
|
12
12
|
return /* @__PURE__ */ c("li", {
|
|
13
13
|
ref: m,
|
|
14
14
|
"data-slot": "item",
|
|
15
15
|
style: t(h, g),
|
|
16
|
-
className: e([
|
|
16
|
+
className: e([i, _ && "haze-tag-input-styles__tagDragging"]),
|
|
17
17
|
children: [/* @__PURE__ */ s("span", {
|
|
18
18
|
"data-slot": "handle",
|
|
19
19
|
...f,
|
|
20
20
|
...p,
|
|
21
|
-
className: e([
|
|
21
|
+
className: e([a]),
|
|
22
22
|
children: o
|
|
23
23
|
}), /* @__PURE__ */ s("button", {
|
|
24
24
|
"data-slot": "remove-button",
|
|
@@ -28,14 +28,14 @@ function d({ id: a, label: o, removeLabel: l, onRemove: d }) {
|
|
|
28
28
|
e.key === "Backspace" && (e.preventDefault(), d());
|
|
29
29
|
},
|
|
30
30
|
"aria-label": l,
|
|
31
|
-
className: e([
|
|
31
|
+
className: e([r]),
|
|
32
32
|
children: "x"
|
|
33
33
|
})]
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function f(e) {
|
|
37
37
|
let { disabled: t } = e;
|
|
38
|
-
return /* @__PURE__ */ s(
|
|
38
|
+
return /* @__PURE__ */ s(o, {
|
|
39
39
|
...e,
|
|
40
40
|
renderTag: t ? void 0 : (e) => /* @__PURE__ */ s(d, {
|
|
41
41
|
id: e.index,
|
|
@@ -43,10 +43,10 @@ function f(e) {
|
|
|
43
43
|
removeLabel: e.removeLabel,
|
|
44
44
|
onRemove: e.onRemove
|
|
45
45
|
}, e.index),
|
|
46
|
-
wrapTagList: t ? void 0 : (e, { count: t, onMove:
|
|
46
|
+
wrapTagList: t ? void 0 : (e, { count: t, onMove: r }) => /* @__PURE__ */ s(n, {
|
|
47
47
|
ids: Array.from({ length: t }, (e, t) => t),
|
|
48
48
|
strategy: l,
|
|
49
|
-
onMove:
|
|
49
|
+
onMove: r,
|
|
50
50
|
children: e
|
|
51
51
|
})
|
|
52
52
|
});
|
|
@@ -6,7 +6,7 @@ import { useStrings as n } from "../LocaleProvider/useStrings.js";
|
|
|
6
6
|
import { Presence as r } from "../../utils/presence.js";
|
|
7
7
|
import i from "./Toast.js";
|
|
8
8
|
import { ToastProvider as a, applyToastPatch as o, deferredCopyKey as s } from "./ToastContext.js";
|
|
9
|
-
import { nextToastId as c, subscribeToastChannel as l } from "./
|
|
9
|
+
import { nextToastId as c, subscribeToastChannel as l } from "./toast-channel.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { useCallback as u, useEffect as d, useRef as f, useState as p } from "react";
|
|
12
12
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e from "./Toast.js";
|
|
3
|
-
import { toast as t } from "./
|
|
3
|
+
import { toast as t } from "./toast-channel.js";
|
|
4
4
|
import n from "./ToastContainer.js";
|
|
5
5
|
import r from "./useToast.js";
|
|
6
6
|
export { e as Toast, n as ToastContainer, t as toast, r as useToast };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { applyToastPatch as e, deferredToastCopy as t } from "./ToastContext.js";
|
|
3
|
-
//#region src/lib/components/Toast/toast.ts
|
|
3
|
+
//#region src/lib/components/Toast/toast-channel.ts
|
|
4
4
|
var n = 100, r = [], i = /* @__PURE__ */ new Set(), a = 0;
|
|
5
5
|
function o() {
|
|
6
6
|
return a += 1, a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useConfigDefaults as e } from "../ConfigProvider/useConfigDefaults.js";
|
|
3
3
|
import { useToastContext as t } from "./ToastContext.js";
|
|
4
|
-
import { driveToastPromise as n } from "./
|
|
4
|
+
import { driveToastPromise as n } from "./toast-channel.js";
|
|
5
5
|
import { useMemo as r } from "react";
|
|
6
6
|
//#region src/lib/components/Toast/useToast.ts
|
|
7
7
|
function i() {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
-
import {
|
|
4
|
-
import i from "
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
3
|
+
import { SortableHandleContext as t, useSortableHandle as n } from "../../utils/sortable-handle.js";
|
|
4
|
+
import { sortableItemStyle as r, useSortableSensors as i } from "../../utils/sortable-shared.js";
|
|
5
|
+
import { filterTreeByQuery as a, findNodeByKey as o, flattenVisibleTree as s } from "./utils.js";
|
|
6
|
+
import c from "./Tree.js";
|
|
7
7
|
import { resolveTreeMove as l, subtreeKeys as u } from "./sortable-tree-utils.js";
|
|
8
8
|
import { grip as d, row as f } from "./sortable-tree-styles.js";
|
|
9
9
|
import { useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
10
10
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { SortableContext as b, useSortable as x, verticalListSortingStrategy as S } from "@dnd-kit/sortable";
|
|
12
|
+
import { DndContext as C, closestCenter as w } from "@dnd-kit/core";
|
|
13
13
|
//#region src/lib/components/Tree/SortableTree.tsx
|
|
14
14
|
var T = () => /* @__PURE__ */ y("svg", {
|
|
15
15
|
viewBox: "0 0 10 16",
|
|
@@ -48,27 +48,27 @@ var T = () => /* @__PURE__ */ y("svg", {
|
|
|
48
48
|
]
|
|
49
49
|
});
|
|
50
50
|
function E() {
|
|
51
|
-
let t =
|
|
51
|
+
let t = n();
|
|
52
52
|
if (!t) return null;
|
|
53
|
-
let
|
|
53
|
+
let r = t.listeners?.onPointerDown;
|
|
54
54
|
return /* @__PURE__ */ v("span", {
|
|
55
55
|
"aria-hidden": "true",
|
|
56
56
|
"data-slot": "drag-handle",
|
|
57
|
-
onPointerDown:
|
|
57
|
+
onPointerDown: r,
|
|
58
58
|
className: e([d]),
|
|
59
59
|
children: /* @__PURE__ */ v(T, {})
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function D({ node:
|
|
63
|
-
let { attributes: c, listeners: l, setNodeRef: u, transform: d, transition: p, isDragging: m } =
|
|
64
|
-
id:
|
|
65
|
-
disabled:
|
|
62
|
+
function D({ node: n, treeDisabled: i, inDraggedSubtree: a, handleMode: o, children: s }) {
|
|
63
|
+
let { attributes: c, listeners: l, setNodeRef: u, transform: d, transition: p, isDragging: m } = x({
|
|
64
|
+
id: n.key,
|
|
65
|
+
disabled: i || !!n.disabled
|
|
66
66
|
});
|
|
67
67
|
function h(e) {
|
|
68
68
|
let t = l?.onKeyDown;
|
|
69
69
|
t?.(e), e.defaultPrevented && e.stopPropagation();
|
|
70
70
|
}
|
|
71
|
-
return /* @__PURE__ */ v(
|
|
71
|
+
return /* @__PURE__ */ v(t.Provider, {
|
|
72
72
|
value: {
|
|
73
73
|
attributes: c,
|
|
74
74
|
listeners: l
|
|
@@ -77,31 +77,31 @@ function D({ node: t, treeDisabled: n, inDraggedSubtree: r, handleMode: i, child
|
|
|
77
77
|
ref: u,
|
|
78
78
|
"data-slot": "sortable-row",
|
|
79
79
|
"data-sortable-row": "",
|
|
80
|
-
style:
|
|
81
|
-
...
|
|
80
|
+
style: r(d, p),
|
|
81
|
+
...o ? void 0 : l,
|
|
82
82
|
onKeyDown: h,
|
|
83
83
|
className: e([
|
|
84
84
|
f,
|
|
85
|
-
!
|
|
85
|
+
!o && "haze-sortable-tree-styles__rowDraggable",
|
|
86
86
|
m && "haze-sortable-tree-styles__rowDragging",
|
|
87
|
-
|
|
87
|
+
a && "haze-sortable-tree-styles__rowInSubtree"
|
|
88
88
|
]),
|
|
89
|
-
children:
|
|
89
|
+
children: s
|
|
90
90
|
})
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
function O({ treeData: e, disabled:
|
|
94
|
-
let A =
|
|
95
|
-
F(e),
|
|
96
|
-
}, [
|
|
93
|
+
function O({ treeData: e, disabled: t = !1, dragHandle: n = !1, titleRender: r, searchValue: d, expandedKeys: f, onExpand: x, onMove: T, className: O, ...k }) {
|
|
94
|
+
let A = i(), [j, M] = g(null), N = h(/* @__PURE__ */ new Set()), [P, F] = g([]), I = p((e, t) => {
|
|
95
|
+
F(e), x?.(e, t);
|
|
96
|
+
}, [x]), L = m(() => a(e, d), [e, d]), R = Array.isArray(f) ? f : P, z = m(() => !L || L.ancestorKeys.length === 0 ? R : Array.from(/* @__PURE__ */ new Set([...R, ...L.ancestorKeys])), [R, L]), B = L ? L.tree : e, V = m(() => s(B, z, !1).map((e) => e.key), [B, z]), H = p((e) => {
|
|
97
97
|
let t = j === null ? e.droppableContainers : e.droppableContainers.filter((e) => String(e.id) === j || !N.current.has(String(e.id)));
|
|
98
|
-
return
|
|
98
|
+
return w({
|
|
99
99
|
...e,
|
|
100
100
|
droppableContainers: t
|
|
101
101
|
});
|
|
102
102
|
}, [j]), U = p((t) => {
|
|
103
|
-
let
|
|
104
|
-
N.current =
|
|
103
|
+
let n = String(t.active.id), r = o(e, n);
|
|
104
|
+
N.current = r ? u(r) : /* @__PURE__ */ new Set(), M(n);
|
|
105
105
|
}, [e]), W = p(() => {
|
|
106
106
|
N.current = /* @__PURE__ */ new Set(), M(null);
|
|
107
107
|
}, []), G = p((t) => {
|
|
@@ -112,31 +112,31 @@ function O({ treeData: e, disabled: a = !1, dragHandle: o = !1, titleRender: s,
|
|
|
112
112
|
W,
|
|
113
113
|
T,
|
|
114
114
|
e
|
|
115
|
-
]), K = p((e,
|
|
116
|
-
node:
|
|
117
|
-
treeDisabled:
|
|
118
|
-
handleMode:
|
|
119
|
-
inDraggedSubtree: j !== null && j !==
|
|
115
|
+
]), K = p((e, r) => /* @__PURE__ */ v(D, {
|
|
116
|
+
node: r,
|
|
117
|
+
treeDisabled: t,
|
|
118
|
+
handleMode: n,
|
|
119
|
+
inDraggedSubtree: j !== null && j !== r.key && N.current.has(r.key),
|
|
120
120
|
children: e
|
|
121
121
|
}), [
|
|
122
122
|
j,
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
t,
|
|
124
|
+
n
|
|
125
125
|
]);
|
|
126
|
-
return /* @__PURE__ */ v(
|
|
126
|
+
return /* @__PURE__ */ v(C, {
|
|
127
127
|
sensors: A,
|
|
128
128
|
collisionDetection: H,
|
|
129
129
|
onDragStart: U,
|
|
130
130
|
onDragEnd: G,
|
|
131
131
|
onDragCancel: W,
|
|
132
|
-
children: /* @__PURE__ */ v(
|
|
132
|
+
children: /* @__PURE__ */ v(b, {
|
|
133
133
|
items: V,
|
|
134
|
-
strategy:
|
|
135
|
-
children: /* @__PURE__ */ v(
|
|
134
|
+
strategy: S,
|
|
135
|
+
children: /* @__PURE__ */ v(c, {
|
|
136
136
|
treeData: e,
|
|
137
|
-
disabled:
|
|
137
|
+
disabled: t,
|
|
138
138
|
searchValue: d,
|
|
139
|
-
titleRender:
|
|
139
|
+
titleRender: n || r ? (e) => /* @__PURE__ */ y(_, { children: [n && /* @__PURE__ */ v(E, {}), r ? r(e) : e.title] }) : void 0,
|
|
140
140
|
expandedKeys: f,
|
|
141
141
|
onExpand: I,
|
|
142
142
|
rowWrap: K,
|