haze-ui 1.24.1 → 1.25.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 +139 -0
- package/dist/components/Alert/Alert.js +19 -18
- package/dist/components/ApprovalCard/ApprovalCard.js +27 -25
- package/dist/components/AsyncSection/AsyncSection.js +32 -30
- package/dist/components/AvatarGroup/AvatarGroup.js +29 -0
- package/dist/components/AvatarGroup/index.js +2 -0
- package/dist/components/BackToTop/BackToTop.js +15 -14
- package/dist/components/Banner/Banner.js +19 -18
- package/dist/components/Breadcrumb/Breadcrumb.js +18 -17
- package/dist/components/Calendar/Calendar.js +152 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Carousel/Carousel.js +42 -40
- package/dist/components/Cascader/Cascader.js +227 -0
- package/dist/components/Cascader/index.js +2 -0
- package/dist/components/ChatInput/ChatInput.js +30 -29
- package/dist/components/ChatMessage/ChatMessage.js +28 -27
- package/dist/components/Chip/Chip.js +20 -19
- package/dist/components/ColorPicker/ColorPickerCore.js +28 -26
- package/dist/components/Combobox/Combobox.js +62 -41
- package/dist/components/ConfirmDialog/ConfirmDialog.js +40 -39
- package/dist/components/DataTable/DataTable.js +151 -0
- package/dist/components/DataTable/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePickerCore.js +21 -19
- package/dist/components/Datepicker/Datepicker.js +10 -8
- package/dist/components/Datepicker/DatepickerCore.js +18 -16
- package/dist/components/Empty/Empty.js +21 -19
- package/dist/components/FileInput/FileInput.js +14 -13
- package/dist/components/HoverCard/HoverCard.js +53 -0
- package/dist/components/HoverCard/index.js +2 -0
- package/dist/components/InlineEdit/InlineEdit.js +32 -31
- package/dist/components/Kbd/Kbd.js +21 -0
- package/dist/components/Kbd/index.js +2 -0
- package/dist/components/LocaleProvider/LocaleContext.js +5 -0
- package/dist/components/LocaleProvider/LocaleProvider.js +21 -0
- package/dist/components/LocaleProvider/index.js +4 -0
- package/dist/components/LocaleProvider/locale.js +126 -0
- package/dist/components/LocaleProvider/useStrings.js +17 -0
- package/dist/components/LogViewer/LogViewer.js +44 -43
- package/dist/components/MarkdownRenderer/MarkdownRenderer.js +19 -19
- package/dist/components/MarkdownRenderer/markdown-blocks.js +41 -0
- package/dist/components/ModelPicker/ModelPicker.js +16 -15
- package/dist/components/NumberInput/NumberInputCore.js +34 -33
- package/dist/components/OTPInput/OTPInputCore.js +35 -30
- package/dist/components/Pagination/Pagination.js +31 -30
- package/dist/components/PasswordInput/PasswordInputCore.js +22 -21
- package/dist/components/Progress/Progress.js +40 -39
- package/dist/components/Rating/RatingCore.js +28 -26
- package/dist/components/Sidebar/Sidebar.js +112 -0
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Spinner/Spinner.js +14 -12
- package/dist/components/StreamingText/StreamingText.js +38 -18
- package/dist/components/Tag/Tag.js +16 -14
- package/dist/components/TagGroup/TagGroupItem.js +12 -10
- package/dist/components/TagInput/TagInputCore.js +52 -50
- package/dist/components/ThinkingIndicator/ThinkingIndicator.js +13 -11
- package/dist/components/Toast/ToastContainer.js +44 -28
- package/dist/components/Toast/index.js +4 -3
- package/dist/components/Toast/toast2.js +44 -0
- package/dist/components/TokenCounter/TokenCounter.js +19 -18
- package/dist/components/ToolCallCard/ToolCallCard.js +39 -37
- package/dist/components/Toolbar/Toolbar.js +59 -0
- package/dist/components/Toolbar/ToolbarButton.js +25 -0
- package/dist/components/Toolbar/ToolbarContext.js +8 -0
- package/dist/components/Toolbar/ToolbarSeparator.js +22 -0
- package/dist/components/Toolbar/index.js +4 -0
- package/dist/components/Tour/Tour.js +197 -0
- package/dist/components/Tour/index.js +2 -0
- package/dist/components/Transfer/TransferCore.js +61 -67
- package/dist/components/Tree/TreeItem.js +56 -55
- package/dist/components/Upload/UploadCore.js +36 -35
- package/dist/components/VirtualList/VirtualList.js +140 -26
- package/dist/css/affix.css +1 -1
- package/dist/css/avatar-group.css +2 -0
- package/dist/css/calendar.css +2 -0
- package/dist/css/carousel.css +1 -1
- package/dist/css/cascader.css +2 -0
- package/dist/css/chat-message.css +1 -1
- package/dist/css/chip.css +1 -1
- package/dist/css/code-block.css +1 -1
- package/dist/css/combobox.css +1 -1
- package/dist/css/container.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/conversation-list.css +1 -1
- package/dist/css/data-table.css +2 -0
- package/dist/css/datepicker.css +0 -1
- package/dist/css/diff-viewer.css +1 -1
- package/dist/css/dropdown-menu.css +1 -1
- package/dist/css/hover-card.css +2 -0
- package/dist/css/kbd.css +2 -0
- package/dist/css/list.css +1 -1
- package/dist/css/markdown-renderer.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/model-picker.css +1 -1
- package/dist/css/navigation-bar.css +1 -1
- package/dist/css/password-input.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/sidebar.css +2 -0
- package/dist/css/step-timeline.css +1 -1
- package/dist/css/stepper.css +1 -1
- package/dist/css/streaming-text.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/toolbar.css +4 -0
- package/dist/css/tour.css +2 -0
- package/dist/css/tree.css +1 -1
- package/dist/css/virtual-list.css +1 -1
- package/dist/css-manifest.json +19 -0
- package/dist/haze-ui.css +36 -26
- package/dist/index.js +130 -115
- package/dist/registry.json +247 -0
- package/dist/types/components/AvatarGroup/AvatarGroup.d.ts +9 -0
- package/dist/types/components/AvatarGroup/index.d.ts +2 -0
- package/dist/types/components/Calendar/Calendar.d.ts +21 -0
- package/dist/types/components/Calendar/index.d.ts +2 -0
- package/dist/types/components/Cascader/Cascader.d.ts +26 -0
- package/dist/types/components/Cascader/index.d.ts +2 -0
- package/dist/types/components/Combobox/Combobox.d.ts +7 -1
- package/dist/types/components/DataTable/DataTable.d.ts +61 -0
- package/dist/types/components/DataTable/index.d.ts +2 -0
- package/dist/types/components/Datepicker/Datepicker.d.ts +3 -1
- package/dist/types/components/Datepicker/DatepickerCore.d.ts +3 -1
- package/dist/types/components/HoverCard/HoverCard.d.ts +49 -0
- package/dist/types/components/HoverCard/index.d.ts +2 -0
- package/dist/types/components/Kbd/Kbd.d.ts +6 -0
- package/dist/types/components/Kbd/index.d.ts +2 -0
- package/dist/types/components/LocaleProvider/LocaleContext.d.ts +19 -0
- package/dist/types/components/LocaleProvider/LocaleProvider.d.ts +13 -0
- package/dist/types/components/LocaleProvider/index.d.ts +6 -0
- package/dist/types/components/LocaleProvider/locale.d.ts +176 -0
- package/dist/types/components/LocaleProvider/useStrings.d.ts +9 -0
- package/dist/types/components/MarkdownRenderer/markdown-blocks.d.ts +6 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +64 -0
- package/dist/types/components/Sidebar/index.d.ts +4 -0
- package/dist/types/components/Toast/index.d.ts +2 -0
- package/dist/types/components/Toast/toast.d.ts +46 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +16 -0
- package/dist/types/components/Toolbar/ToolbarButton.d.ts +20 -0
- package/dist/types/components/Toolbar/ToolbarContext.d.ts +5 -0
- package/dist/types/components/Toolbar/ToolbarSeparator.d.ts +14 -0
- package/dist/types/components/Toolbar/index.d.ts +6 -0
- package/dist/types/components/Tour/Tour.d.ts +46 -0
- package/dist/types/components/Tour/index.d.ts +2 -0
- package/dist/types/components/VirtualList/VirtualList.d.ts +58 -4
- package/dist/types/components/VirtualList/index.d.ts +1 -1
- package/dist/types/index.d.ts +24 -3
- package/package.json +25 -11
- package/dist/components/Datepicker/Calendar.js +0 -120
- package/dist/types/components/Datepicker/Calendar.d.ts +0 -8
|
@@ -3,45 +3,61 @@ import { classnames as e } from "../../utils/classnames.js";
|
|
|
3
3
|
import { Presence as t } from "../../utils/presence.js";
|
|
4
4
|
import n from "./Toast.js";
|
|
5
5
|
import { ToastProvider as r } from "./ToastContext.js";
|
|
6
|
+
import { nextToastId as i, subscribeToastChannel as a } from "./toast2.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useCallback as
|
|
8
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
|
|
9
10
|
//#region src/lib/components/Toast/ToastContainer.tsx
|
|
10
|
-
var
|
|
11
|
+
var f = "haze-ToastContainer__containerBase", p = {
|
|
11
12
|
"top-left": "haze-ToastContainer__top-left",
|
|
12
13
|
"top-right": "haze-ToastContainer__top-right",
|
|
13
14
|
"bottom-left": "haze-ToastContainer__bottom-left",
|
|
14
15
|
"bottom-right": "haze-ToastContainer__bottom-right"
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
-
let [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
function m({ children: m, maxCount: h, placement: g = "bottom-right" }) {
|
|
18
|
+
let [_, v] = d([]), [y, b] = d([]), x = u([]);
|
|
19
|
+
l(() => {
|
|
20
|
+
x.current = _;
|
|
21
|
+
}, [_]);
|
|
22
|
+
let S = c((e) => {
|
|
23
|
+
v((t) => {
|
|
24
|
+
let n = [...t, e];
|
|
25
|
+
return h === void 0 || n.length <= h ? n : n.slice(n.length - h);
|
|
24
26
|
});
|
|
25
|
-
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
}, [h]), C = c((e) => {
|
|
28
|
+
S({
|
|
29
|
+
...e,
|
|
30
|
+
id: i()
|
|
31
|
+
});
|
|
32
|
+
}, [S]), w = c((e) => {
|
|
33
|
+
b((t) => t.includes(e) ? t : [...t, e]);
|
|
34
|
+
}, []), T = c((e) => {
|
|
35
|
+
v((t) => t.filter((t) => t.id !== e)), b((t) => t.filter((t) => t !== e));
|
|
36
|
+
}, []), E = c((e) => {
|
|
37
|
+
if (e === void 0) {
|
|
38
|
+
x.current.forEach((e) => w(e.id));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
w(e);
|
|
42
|
+
}, [w]);
|
|
43
|
+
return l(() => a({
|
|
44
|
+
onToast: S,
|
|
45
|
+
onDismiss: E
|
|
46
|
+
}), [S, E]), /* @__PURE__ */ s(r, {
|
|
31
47
|
value: {
|
|
32
|
-
toasts:
|
|
33
|
-
addToast:
|
|
34
|
-
removeToast:
|
|
48
|
+
toasts: _,
|
|
49
|
+
addToast: C,
|
|
50
|
+
removeToast: w
|
|
35
51
|
},
|
|
36
|
-
children: [
|
|
37
|
-
className: e([
|
|
38
|
-
children:
|
|
39
|
-
present: !
|
|
40
|
-
onExited: () =>
|
|
41
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: [m, /* @__PURE__ */ o("div", {
|
|
53
|
+
className: e([f, p[g]]),
|
|
54
|
+
children: _.map((e) => /* @__PURE__ */ o(t, {
|
|
55
|
+
present: !y.includes(e.id),
|
|
56
|
+
onExited: () => T(e.id),
|
|
57
|
+
children: /* @__PURE__ */ o(n, {
|
|
42
58
|
variant: e.variant,
|
|
43
59
|
duration: e.duration,
|
|
44
|
-
onClose: () =>
|
|
60
|
+
onClose: () => w(e.id),
|
|
45
61
|
children: e.content
|
|
46
62
|
})
|
|
47
63
|
}, e.id))
|
|
@@ -49,4 +65,4 @@ function d({ children: d, maxCount: f, placement: p = "bottom-right" }) {
|
|
|
49
65
|
});
|
|
50
66
|
}
|
|
51
67
|
//#endregion
|
|
52
|
-
export {
|
|
68
|
+
export { m as default, p as toastPlacements };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import e from "./Toast.js";
|
|
2
|
-
import t from "./
|
|
3
|
-
import n from "./
|
|
4
|
-
|
|
2
|
+
import { toast as t } from "./toast2.js";
|
|
3
|
+
import n from "./ToastContainer.js";
|
|
4
|
+
import r from "./useToast.js";
|
|
5
|
+
export { e as Toast, n as ToastContainer, t as toast, r as useToast };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/lib/components/Toast/toast.ts
|
|
2
|
+
var e = [], t = /* @__PURE__ */ new Set(), n = 0;
|
|
3
|
+
function r() {
|
|
4
|
+
return n += 1, n;
|
|
5
|
+
}
|
|
6
|
+
function i(n, i) {
|
|
7
|
+
let a = {
|
|
8
|
+
id: r(),
|
|
9
|
+
content: n,
|
|
10
|
+
variant: i?.variant ?? "info",
|
|
11
|
+
duration: i?.duration ?? 3e3
|
|
12
|
+
}, [o] = t;
|
|
13
|
+
return o ? o.onToast(a) : (e.length >= 100 && e.shift(), e.push(a)), a.id;
|
|
14
|
+
}
|
|
15
|
+
function a(n) {
|
|
16
|
+
if (n === void 0) {
|
|
17
|
+
e.length = 0;
|
|
18
|
+
let [n] = t;
|
|
19
|
+
n?.onDismiss(void 0);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let r = e.findIndex((e) => e.id === n);
|
|
23
|
+
if (r !== -1) {
|
|
24
|
+
e.splice(r, 1);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let [i] = t;
|
|
28
|
+
i?.onDismiss(n);
|
|
29
|
+
}
|
|
30
|
+
function o(e) {
|
|
31
|
+
return (t, n) => i(t, {
|
|
32
|
+
...n,
|
|
33
|
+
variant: e
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
i.info = o("info"), i.success = o("success"), i.warning = o("warning"), i.danger = o("danger"), i.dismiss = a;
|
|
37
|
+
function s(n) {
|
|
38
|
+
if (t.add(n), t.size === 1 && e.length > 0) for (let t of e.splice(0)) n.onToast(t);
|
|
39
|
+
return () => {
|
|
40
|
+
t.delete(n);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { r as nextToastId, s as subscribeToastChannel, i as toast };
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/lib/components/TokenCounter/TokenCounter.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
className: e([
|
|
11
|
-
children: [/* @__PURE__ */
|
|
12
|
-
className: e([
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
-
className: e([
|
|
7
|
+
var i = "haze-TokenCounter__wrapper", a = "haze-TokenCounter__bar", o = "haze-TokenCounter__fill", s = "haze-TokenCounter__fillNormal", c = "haze-TokenCounter__fillWarning", l = "haze-TokenCounter__fillDanger", u = "haze-TokenCounter__info", d = "haze-TokenCounter__count";
|
|
8
|
+
function f({ used: f, max: p, label: m, className: h }) {
|
|
9
|
+
let g = p > 0 ? Math.min(100, f / p * 100) : 0, _ = g > 90 ? l : g > 70 ? c : s, v = t("tokenCounter");
|
|
10
|
+
return /* @__PURE__ */ r("div", {
|
|
11
|
+
className: e([i, h]),
|
|
12
|
+
children: [/* @__PURE__ */ r("div", {
|
|
13
|
+
className: e([u]),
|
|
14
|
+
children: [/* @__PURE__ */ n("span", { children: m || v.label }), /* @__PURE__ */ r("span", {
|
|
15
|
+
className: e([d]),
|
|
15
16
|
children: [
|
|
16
|
-
|
|
17
|
+
f.toLocaleString(),
|
|
17
18
|
" / ",
|
|
18
|
-
|
|
19
|
+
p.toLocaleString()
|
|
19
20
|
]
|
|
20
21
|
})]
|
|
21
|
-
}), /* @__PURE__ */
|
|
22
|
-
className: e([
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
-
style: { width: `${
|
|
25
|
-
className: e([
|
|
22
|
+
}), /* @__PURE__ */ n("div", {
|
|
23
|
+
className: e([a]),
|
|
24
|
+
children: /* @__PURE__ */ n("div", {
|
|
25
|
+
style: { width: `${g}%` },
|
|
26
|
+
className: e([o, _])
|
|
26
27
|
})
|
|
27
28
|
})]
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
//#endregion
|
|
31
|
-
export {
|
|
32
|
+
export { f as default };
|
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useStrings as t } from "../LocaleProvider/useStrings.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/lib/components/ToolCallCard/ToolCallCard.tsx
|
|
6
|
-
var
|
|
7
|
-
pending:
|
|
8
|
-
running:
|
|
9
|
-
done:
|
|
10
|
-
error:
|
|
11
|
-
}, h = {
|
|
12
|
-
pending: "Pending",
|
|
13
|
-
running: "Running...",
|
|
14
|
-
done: "Done",
|
|
15
|
-
error: "Error"
|
|
7
|
+
var i = "haze-ToolCallCard__card", a = "haze-ToolCallCard__header", o = "haze-ToolCallCard__statusIcon", s = "haze-ToolCallCard__statusPending", c = "haze-ToolCallCard__statusRunning", l = "haze-ToolCallCard__statusDone", u = "haze-ToolCallCard__statusError", d = "haze-ToolCallCard__body", f = "haze-ToolCallCard__section", p = "haze-ToolCallCard__sectionLabel", m = "haze-ToolCallCard__content", h = {
|
|
8
|
+
pending: s,
|
|
9
|
+
running: c,
|
|
10
|
+
done: l,
|
|
11
|
+
error: u
|
|
16
12
|
};
|
|
17
|
-
function g({ name:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
function g({ name: s, input: c, output: l, status: u = "pending", className: g }) {
|
|
14
|
+
let _ = t("toolCallCard"), v = {
|
|
15
|
+
pending: _.pending,
|
|
16
|
+
running: _.running,
|
|
17
|
+
done: _.done,
|
|
18
|
+
error: _.error
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ r("div", {
|
|
21
|
+
className: e([i, g]),
|
|
22
|
+
children: [/* @__PURE__ */ r("div", {
|
|
23
|
+
className: e([a]),
|
|
22
24
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ n("span", { className: e([o, h[u]]) }),
|
|
26
|
+
/* @__PURE__ */ n("span", { children: s }),
|
|
27
|
+
/* @__PURE__ */ n("span", {
|
|
26
28
|
style: {
|
|
27
|
-
|
|
29
|
+
marginInlineStart: "auto",
|
|
28
30
|
color: "var(--haze-color-text-muted)"
|
|
29
31
|
},
|
|
30
|
-
children:
|
|
32
|
+
children: v[u]
|
|
31
33
|
})
|
|
32
34
|
]
|
|
33
|
-
}), (
|
|
34
|
-
className: e([
|
|
35
|
-
children: [
|
|
36
|
-
className: e([
|
|
37
|
-
children: [/* @__PURE__ */
|
|
38
|
-
className: e([f]),
|
|
39
|
-
children: "Input"
|
|
40
|
-
}), /* @__PURE__ */ t("div", {
|
|
35
|
+
}), (c || l) && /* @__PURE__ */ r("div", {
|
|
36
|
+
className: e([d]),
|
|
37
|
+
children: [c && /* @__PURE__ */ r("div", {
|
|
38
|
+
className: e([f]),
|
|
39
|
+
children: [/* @__PURE__ */ n("div", {
|
|
41
40
|
className: e([p]),
|
|
42
|
-
children:
|
|
41
|
+
children: _.inputLabel
|
|
42
|
+
}), /* @__PURE__ */ n("div", {
|
|
43
|
+
className: e([m]),
|
|
44
|
+
children: c
|
|
43
45
|
})]
|
|
44
|
-
}),
|
|
45
|
-
className: e([
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
-
className: e([f]),
|
|
48
|
-
children: "Output"
|
|
49
|
-
}), /* @__PURE__ */ t("div", {
|
|
46
|
+
}), l && /* @__PURE__ */ r("div", {
|
|
47
|
+
className: e([f]),
|
|
48
|
+
children: [/* @__PURE__ */ n("div", {
|
|
50
49
|
className: e([p]),
|
|
51
|
-
children:
|
|
50
|
+
children: _.outputLabel
|
|
51
|
+
}), /* @__PURE__ */ n("div", {
|
|
52
|
+
className: e([m]),
|
|
53
|
+
children: l
|
|
52
54
|
})]
|
|
53
55
|
})]
|
|
54
56
|
})]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { getEnabledMenuItems as t, useRovingTabindex as n } from "../../utils/menuKeyboard.js";
|
|
4
|
+
import { ToolbarProvider as r } from "./ToolbarContext.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as a, useRef as o } from "react";
|
|
8
|
+
//#region src/lib/components/Toolbar/Toolbar.tsx
|
|
9
|
+
var s = "[data-haze-toolbar-item]:not([disabled])", c = "haze-Toolbar__toolbar", l = "haze-Toolbar__vertical";
|
|
10
|
+
function u(e, n) {
|
|
11
|
+
return a((r) => {
|
|
12
|
+
let i = e === "horizontal" ? "ArrowRight" : "ArrowDown", a = e === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
13
|
+
if (r.key !== i && r.key !== a && r.key !== "Home" && r.key !== "End") return;
|
|
14
|
+
let o = t(n.current, s);
|
|
15
|
+
if (o.length === 0) return;
|
|
16
|
+
let c = o.indexOf(document.activeElement), l = (e) => o[e]?.focus();
|
|
17
|
+
switch (r.preventDefault(), r.key) {
|
|
18
|
+
case i:
|
|
19
|
+
l((c + 1) % o.length);
|
|
20
|
+
return;
|
|
21
|
+
case a:
|
|
22
|
+
l((c - 1 + o.length) % o.length);
|
|
23
|
+
return;
|
|
24
|
+
case "Home":
|
|
25
|
+
l(0);
|
|
26
|
+
return;
|
|
27
|
+
case "End":
|
|
28
|
+
l(o.length - 1);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}, [e, n]);
|
|
32
|
+
}
|
|
33
|
+
function d({ orientation: t = "horizontal", className: a, children: d, ...f }) {
|
|
34
|
+
let p = o(null);
|
|
35
|
+
n({
|
|
36
|
+
menuRef: p,
|
|
37
|
+
active: !0,
|
|
38
|
+
selector: s
|
|
39
|
+
});
|
|
40
|
+
let m = u(t, p);
|
|
41
|
+
return /* @__PURE__ */ i(r, {
|
|
42
|
+
value: t,
|
|
43
|
+
children: i("div", {
|
|
44
|
+
ref: p,
|
|
45
|
+
role: "toolbar",
|
|
46
|
+
"aria-orientation": t,
|
|
47
|
+
onKeyDown: m,
|
|
48
|
+
...f,
|
|
49
|
+
className: e([
|
|
50
|
+
c,
|
|
51
|
+
t === "vertical" && l,
|
|
52
|
+
a
|
|
53
|
+
]),
|
|
54
|
+
children: d
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { d as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { base as t, sizes as n, squareSizes as r, variants as i } from "../Button/styles.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/lib/components/Toolbar/ToolbarButton.tsx
|
|
7
|
+
var o = "haze-ToolbarButton__toolbarItem";
|
|
8
|
+
function s({ variant: s = "ghost", size: c = "md", square: l = !1, className: u, ...d }) {
|
|
9
|
+
let f = l ? r[c] : n[c];
|
|
10
|
+
return /* @__PURE__ */ a("button", {
|
|
11
|
+
type: "button",
|
|
12
|
+
"data-haze-toolbar-item": "",
|
|
13
|
+
tabIndex: -1,
|
|
14
|
+
...d,
|
|
15
|
+
className: e([
|
|
16
|
+
t,
|
|
17
|
+
i[s],
|
|
18
|
+
f,
|
|
19
|
+
o,
|
|
20
|
+
u
|
|
21
|
+
])
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { s as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
//#region src/lib/components/Toolbar/ToolbarContext.ts
|
|
3
|
+
var n = e(void 0), r = n.Provider;
|
|
4
|
+
function i() {
|
|
5
|
+
return t(n) ?? "horizontal";
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { r as ToolbarProvider, i as useToolbarOrientation };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useToolbarOrientation as t } from "./ToolbarContext.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region src/lib/components/Toolbar/ToolbarSeparator.tsx
|
|
7
|
+
var r = "haze-ToolbarSeparator__separator", i = "haze-ToolbarSeparator__horizontalRule";
|
|
8
|
+
function a({ className: a, ...o }) {
|
|
9
|
+
let s = t() === "vertical";
|
|
10
|
+
return /* @__PURE__ */ n("div", {
|
|
11
|
+
role: "separator",
|
|
12
|
+
"aria-orientation": s ? "horizontal" : "vertical",
|
|
13
|
+
...o,
|
|
14
|
+
className: e([
|
|
15
|
+
r,
|
|
16
|
+
s && i,
|
|
17
|
+
a
|
|
18
|
+
])
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { a as default };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { Presence as t } from "../../utils/presence.js";
|
|
4
|
+
import { computeFloatingPosition as n, resolvePadding as r } from "../../utils/collision.js";
|
|
5
|
+
import { formatString as i } from "../LocaleProvider/locale.js";
|
|
6
|
+
import { useStrings as a } from "../LocaleProvider/useStrings.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
import { useCallback as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
10
|
+
import { useControl as p } from "react-use-control";
|
|
11
|
+
import { createPortal as m } from "react-dom";
|
|
12
|
+
//#region src/lib/components/Tour/Tour.tsx
|
|
13
|
+
var h = 8, g = 16;
|
|
14
|
+
function _(e) {
|
|
15
|
+
let { target: t } = e;
|
|
16
|
+
if (typeof t == "function") return t();
|
|
17
|
+
try {
|
|
18
|
+
return document.querySelector(t);
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var v = "haze-Tour__overlay", y = "haze-Tour__spotlight", b = "haze-Tour__mask", ee = "haze-Tour__card", te = "haze-Tour__centeredCard", ne = "haze-Tour__titleStyle", re = "haze-Tour__bodyStyle", x = "haze-Tour__footerStyle", S = "haze-Tour__counterStyle", C = "haze-Tour__btn", w = "haze-Tour__subtleBtn", ie = "haze-Tour__primaryBtn";
|
|
24
|
+
function T({ steps: T, open: E, current: D, onClose: O, onStepChange: k, maskClosable: A = !1, className: j, ...M }) {
|
|
25
|
+
let [N, P] = p(E, !1), [F, I] = p(D, 0), L = a("tour"), R = `haze-tour-title-${u()}`, z = `haze-tour-step-${u()}`, B = T.length, V = Math.min(Math.max(F, 0), Math.max(B - 1, 0)), H = B > 0 ? T[V] : void 0, U = V >= B - 1, W = H?.placement ?? "bottom", G = i(L.stepOf, {
|
|
26
|
+
current: V + 1,
|
|
27
|
+
total: B
|
|
28
|
+
}), [K, q] = f(N);
|
|
29
|
+
N !== K && (q(N), N && D === void 0 && I(0));
|
|
30
|
+
let J = d(null), Y = d(-1), [X, ae] = f(null), Z = d(null), Q = c((e) => {
|
|
31
|
+
P(!1), O?.(e);
|
|
32
|
+
}, [O, P]), $ = c((e) => {
|
|
33
|
+
I(e), k?.(e);
|
|
34
|
+
}, [k, I]);
|
|
35
|
+
return l(() => {
|
|
36
|
+
if (!N) return;
|
|
37
|
+
let e = B > 0 ? T[V] : void 0, t = J.current;
|
|
38
|
+
if (!e || !t) return;
|
|
39
|
+
let i = _(e);
|
|
40
|
+
i?.scrollIntoView({ block: "nearest" });
|
|
41
|
+
let a = (e) => {
|
|
42
|
+
let t = Z.current;
|
|
43
|
+
(t === null != (e === null) || t !== null && e !== null && (t.top !== e.top || t.left !== e.left || t.width !== e.width || t.height !== e.height)) && (Z.current = e, ae(e));
|
|
44
|
+
}, o = () => {
|
|
45
|
+
let e = i?.getBoundingClientRect();
|
|
46
|
+
if (!i || !e || e.width === 0 && e.height === 0) {
|
|
47
|
+
t.style.top = "", t.style.left = "", a(null);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let o = t.getBoundingClientRect(), { top: s, left: c } = n({
|
|
51
|
+
trigger: e,
|
|
52
|
+
panel: {
|
|
53
|
+
width: o.width,
|
|
54
|
+
height: o.height
|
|
55
|
+
},
|
|
56
|
+
viewport: {
|
|
57
|
+
width: window.innerWidth,
|
|
58
|
+
height: window.innerHeight
|
|
59
|
+
},
|
|
60
|
+
placement: W,
|
|
61
|
+
gap: {
|
|
62
|
+
below: g,
|
|
63
|
+
above: g,
|
|
64
|
+
before: g,
|
|
65
|
+
after: g
|
|
66
|
+
},
|
|
67
|
+
strategy: {
|
|
68
|
+
flip: !0,
|
|
69
|
+
shift: !0,
|
|
70
|
+
padding: r()
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
t.style.top = `${s}px`, t.style.left = `${c}px`, a({
|
|
74
|
+
top: e.top - h,
|
|
75
|
+
left: e.left - h,
|
|
76
|
+
width: e.width + 16,
|
|
77
|
+
height: e.height + 16
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
o();
|
|
81
|
+
let s = 0, c = () => {
|
|
82
|
+
s ||= requestAnimationFrame(() => {
|
|
83
|
+
s = 0, o();
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), () => {
|
|
87
|
+
s && cancelAnimationFrame(s), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0);
|
|
88
|
+
};
|
|
89
|
+
}, [
|
|
90
|
+
N,
|
|
91
|
+
T,
|
|
92
|
+
V,
|
|
93
|
+
B,
|
|
94
|
+
W
|
|
95
|
+
]), l(() => {
|
|
96
|
+
if (!N) {
|
|
97
|
+
Y.current = -1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
Y.current !== V && (Y.current = V, J.current?.focus());
|
|
101
|
+
}, [N, V]), l(() => {
|
|
102
|
+
if (!N || B === 0) return;
|
|
103
|
+
let e = (e) => {
|
|
104
|
+
if (e.defaultPrevented) return;
|
|
105
|
+
if (e.key === "Escape") {
|
|
106
|
+
Q("skip");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
let t = e.target;
|
|
110
|
+
t instanceof HTMLElement && (t.isContentEditable || t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT") || (e.key === "ArrowRight" && !U ? (e.preventDefault(), $(V + 1)) : e.key === "ArrowLeft" && V > 0 && (e.preventDefault(), $(V - 1)));
|
|
111
|
+
};
|
|
112
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
113
|
+
}, [
|
|
114
|
+
N,
|
|
115
|
+
B,
|
|
116
|
+
V,
|
|
117
|
+
U,
|
|
118
|
+
Q,
|
|
119
|
+
$
|
|
120
|
+
]), !H || typeof document > "u" ? null : m(/* @__PURE__ */ o(t, {
|
|
121
|
+
present: N,
|
|
122
|
+
children: s("div", {
|
|
123
|
+
onClick: A ? (e) => {
|
|
124
|
+
N && e.target === e.currentTarget && Q("skip");
|
|
125
|
+
} : void 0,
|
|
126
|
+
className: e([v]),
|
|
127
|
+
children: [X === null ? /* @__PURE__ */ o("div", {
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
className: e([b])
|
|
130
|
+
}) : /* @__PURE__ */ o("div", {
|
|
131
|
+
"data-haze-tour-spotlight": "",
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
style: {
|
|
134
|
+
top: X.top,
|
|
135
|
+
left: X.left,
|
|
136
|
+
width: X.width,
|
|
137
|
+
height: X.height
|
|
138
|
+
},
|
|
139
|
+
className: e([y])
|
|
140
|
+
}), /* @__PURE__ */ s("div", {
|
|
141
|
+
ref: J,
|
|
142
|
+
role: "dialog",
|
|
143
|
+
"aria-modal": "false",
|
|
144
|
+
"aria-labelledby": H.title === void 0 ? z : R,
|
|
145
|
+
tabIndex: -1,
|
|
146
|
+
...M,
|
|
147
|
+
className: e([
|
|
148
|
+
ee,
|
|
149
|
+
X === null && te,
|
|
150
|
+
j
|
|
151
|
+
]),
|
|
152
|
+
children: [
|
|
153
|
+
H.title !== void 0 && /* @__PURE__ */ o("h2", {
|
|
154
|
+
id: R,
|
|
155
|
+
className: e([ne]),
|
|
156
|
+
children: H.title
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ o("div", {
|
|
159
|
+
className: e([re]),
|
|
160
|
+
children: H.content
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ s("div", {
|
|
163
|
+
className: e([x]),
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ o("span", {
|
|
166
|
+
id: z,
|
|
167
|
+
className: e([S]),
|
|
168
|
+
children: G
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ o("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
onClick: () => Q("skip"),
|
|
173
|
+
className: e([C, w]),
|
|
174
|
+
children: L.skip
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ o("button", {
|
|
177
|
+
type: "button",
|
|
178
|
+
disabled: V === 0,
|
|
179
|
+
onClick: () => $(V - 1),
|
|
180
|
+
className: e([C, w]),
|
|
181
|
+
children: L.back
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ o("button", {
|
|
184
|
+
type: "button",
|
|
185
|
+
onClick: () => U ? Q("done") : $(V + 1),
|
|
186
|
+
className: e([C, ie]),
|
|
187
|
+
children: U ? L.done : L.next
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
})
|
|
191
|
+
]
|
|
192
|
+
})]
|
|
193
|
+
})
|
|
194
|
+
}), document.body);
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { T as default };
|