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
|
@@ -1,44 +1,45 @@
|
|
|
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/Chip/Chip.tsx
|
|
6
|
-
var
|
|
7
|
+
var i = "haze-Chip__base", a = {
|
|
7
8
|
default: "haze-Chip__default",
|
|
8
9
|
primary: "haze-Chip__primary",
|
|
9
10
|
success: "haze-Chip__success",
|
|
10
11
|
warning: "haze-Chip__warning",
|
|
11
12
|
danger: "haze-Chip__danger"
|
|
12
|
-
},
|
|
13
|
+
}, o = {
|
|
13
14
|
default: "haze-Chip__default",
|
|
14
15
|
primary: "haze-Chip__primary",
|
|
15
16
|
success: "haze-Chip__success",
|
|
16
17
|
warning: "haze-Chip__warning",
|
|
17
18
|
danger: "haze-Chip__danger"
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
return /* @__PURE__ */
|
|
19
|
+
}, s = "haze-Chip__iconStyle", c = "haze-Chip__closeBtn";
|
|
20
|
+
function l({ variant: l = "solid", color: u = "default", icon: d, onClose: f, className: p, children: m }) {
|
|
21
|
+
let h = t("chip"), g = l === "outline" ? o[u] : a[u];
|
|
22
|
+
return /* @__PURE__ */ r("span", {
|
|
22
23
|
className: e([
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
i,
|
|
25
|
+
g,
|
|
26
|
+
p
|
|
26
27
|
]),
|
|
27
28
|
children: [
|
|
28
|
-
|
|
29
|
-
className: e([
|
|
30
|
-
children:
|
|
29
|
+
d && /* @__PURE__ */ n("span", {
|
|
30
|
+
className: e([s]),
|
|
31
|
+
children: d
|
|
31
32
|
}),
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
m,
|
|
34
|
+
f && /* @__PURE__ */ n("button", {
|
|
34
35
|
type: "button",
|
|
35
|
-
onClick:
|
|
36
|
-
"aria-label":
|
|
37
|
-
className: e([
|
|
36
|
+
onClick: f,
|
|
37
|
+
"aria-label": h.remove,
|
|
38
|
+
className: e([c]),
|
|
38
39
|
children: "×"
|
|
39
40
|
})
|
|
40
41
|
]
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
//#endregion
|
|
44
|
-
export {
|
|
45
|
+
export { l as default };
|
|
@@ -1,38 +1,40 @@
|
|
|
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/ColorPicker/ColorPickerCore.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
var i = "haze-ColorPickerCore__container", a = "haze-ColorPickerCore__previewRow", o = "haze-ColorPickerCore__colorInput", s = "haze-ColorPickerCore__textInput", c = "haze-ColorPickerCore__presetsRow", l = "haze-ColorPickerCore__presetBtn", u = "haze-ColorPickerCore__activePreset";
|
|
8
|
+
function d({ value: d, onChange: f, presets: p, className: m }) {
|
|
9
|
+
let h = t("colorPicker");
|
|
10
|
+
return /* @__PURE__ */ r("div", {
|
|
11
|
+
className: e([i, m]),
|
|
12
|
+
children: [/* @__PURE__ */ r("div", {
|
|
13
|
+
className: e([a]),
|
|
14
|
+
children: [/* @__PURE__ */ n("input", {
|
|
13
15
|
type: "color",
|
|
14
|
-
value:
|
|
15
|
-
"aria-label":
|
|
16
|
-
onChange: (e) =>
|
|
17
|
-
className: e([a])
|
|
18
|
-
}), /* @__PURE__ */ t("input", {
|
|
19
|
-
type: "text",
|
|
20
|
-
value: u,
|
|
21
|
-
"aria-label": "Hex color",
|
|
22
|
-
onChange: (e) => d(e.target.value),
|
|
16
|
+
value: d,
|
|
17
|
+
"aria-label": h.pickColor,
|
|
18
|
+
onChange: (e) => f(e.target.value),
|
|
23
19
|
className: e([o])
|
|
20
|
+
}), /* @__PURE__ */ n("input", {
|
|
21
|
+
type: "text",
|
|
22
|
+
value: d,
|
|
23
|
+
"aria-label": h.hexColor,
|
|
24
|
+
onChange: (e) => f(e.target.value),
|
|
25
|
+
className: e([s])
|
|
24
26
|
})]
|
|
25
|
-
}),
|
|
26
|
-
className: e([
|
|
27
|
-
children:
|
|
27
|
+
}), p && p.length > 0 && /* @__PURE__ */ n("div", {
|
|
28
|
+
className: e([c]),
|
|
29
|
+
children: p.map((t) => /* @__PURE__ */ n("button", {
|
|
28
30
|
type: "button",
|
|
29
|
-
style: { background:
|
|
30
|
-
"aria-label":
|
|
31
|
-
onClick: () =>
|
|
32
|
-
className: e([
|
|
33
|
-
},
|
|
31
|
+
style: { background: t },
|
|
32
|
+
"aria-label": t,
|
|
33
|
+
onClick: () => f(t),
|
|
34
|
+
className: e([l, d === t && u])
|
|
35
|
+
}, t))
|
|
34
36
|
})]
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
//#endregion
|
|
38
|
-
export {
|
|
40
|
+
export { d as default };
|
|
@@ -1,63 +1,84 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
4
|
-
import r from "
|
|
4
|
+
import r from "../VirtualList/VirtualList.js";
|
|
5
|
+
import i from "./ComboboxOption.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useId as
|
|
8
|
-
import { useControl as
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
9
|
+
import { useControl as d } from "react-use-control";
|
|
9
10
|
//#region src/lib/components/Combobox/Combobox.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
open:
|
|
14
|
-
setOpen:
|
|
15
|
-
triggerRef:
|
|
16
|
-
panelRef:
|
|
11
|
+
var f = "haze-Combobox__wrapper", p = "haze-Combobox__input", m = "haze-Combobox__listbox", h = "haze-Combobox__listboxVirtual", g = 200, _ = 37, v = "haze-Combobox__virtualRow";
|
|
12
|
+
function y({ value: y, open: b, options: x, placeholder: S, virtualThreshold: C = 100, className: w }) {
|
|
13
|
+
let [T, E] = d(y, ""), [D, O] = u(""), [k, A] = d(b, !1), [j, M] = u(-1), [N, P] = u(D), F = c(), I = l(null), L = l(null), R = l(null), z = n({
|
|
14
|
+
open: k,
|
|
15
|
+
setOpen: A,
|
|
16
|
+
triggerRef: I,
|
|
17
|
+
panelRef: L,
|
|
17
18
|
animated: !0
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
}), B = x.filter((e) => e.label.toLowerCase().includes(D.toLowerCase())), V = C > 0 && B.length > C;
|
|
20
|
+
s(() => {
|
|
21
|
+
!V || !z.shown || j < 0 || R.current?.scrollToIndex(j, "auto");
|
|
22
|
+
}, [
|
|
23
|
+
V,
|
|
24
|
+
z.shown,
|
|
25
|
+
j
|
|
26
|
+
]), D !== N && (P(D), M(-1));
|
|
27
|
+
let H = (e) => {
|
|
28
|
+
E(e);
|
|
29
|
+
let t = x.find((t) => t.value === e)?.label ?? e;
|
|
30
|
+
O(t), A(!1), I.current?.focus();
|
|
24
31
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
className: e([
|
|
27
|
-
children: [/* @__PURE__ */
|
|
28
|
-
ref:
|
|
32
|
+
return /* @__PURE__ */ o("div", {
|
|
33
|
+
className: e([f, w]),
|
|
34
|
+
children: [/* @__PURE__ */ a("input", {
|
|
35
|
+
ref: I,
|
|
29
36
|
role: "combobox",
|
|
30
|
-
style:
|
|
31
|
-
"aria-expanded":
|
|
32
|
-
"aria-controls":
|
|
37
|
+
style: z.triggerStyle,
|
|
38
|
+
"aria-expanded": k,
|
|
39
|
+
"aria-controls": F,
|
|
33
40
|
"aria-autocomplete": "list",
|
|
34
|
-
className:
|
|
35
|
-
value:
|
|
36
|
-
placeholder:
|
|
41
|
+
className: p,
|
|
42
|
+
value: D,
|
|
43
|
+
placeholder: S,
|
|
37
44
|
onChange: (e) => {
|
|
38
|
-
|
|
45
|
+
O(e.target.value), A(!0);
|
|
39
46
|
},
|
|
40
|
-
onFocus: () =>
|
|
41
|
-
onClick: () =>
|
|
47
|
+
onFocus: () => A(!0),
|
|
48
|
+
onClick: () => A(!0),
|
|
42
49
|
onKeyDown: (e) => {
|
|
43
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
50
|
+
e.key === "ArrowDown" ? (e.preventDefault(), M((e) => Math.min(e + 1, B.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), M((e) => Math.max(e - 1, 0))) : e.key === "Enter" && j >= 0 && B[j] ? (e.preventDefault(), H(B[j].value)) : e.key === "Escape" && A(!1);
|
|
44
51
|
}
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
ref:
|
|
47
|
-
behavior:
|
|
52
|
+
}), /* @__PURE__ */ a(t, {
|
|
53
|
+
ref: L,
|
|
54
|
+
behavior: z,
|
|
48
55
|
placement: "bottom-span",
|
|
49
|
-
id:
|
|
56
|
+
id: F,
|
|
50
57
|
role: "listbox",
|
|
51
|
-
visualClass:
|
|
52
|
-
children:
|
|
58
|
+
visualClass: V ? h : m,
|
|
59
|
+
children: V ? /* @__PURE__ */ a(r, {
|
|
60
|
+
ref: R,
|
|
61
|
+
"data-virtualized": !0,
|
|
62
|
+
items: B,
|
|
63
|
+
height: g,
|
|
64
|
+
itemHeight: _,
|
|
65
|
+
renderItem: (e, t) => /* @__PURE__ */ a(i, {
|
|
66
|
+
value: e.value,
|
|
67
|
+
highlighted: t === j,
|
|
68
|
+
selected: e.value === T,
|
|
69
|
+
onSelect: H,
|
|
70
|
+
className: v,
|
|
71
|
+
children: e.label
|
|
72
|
+
})
|
|
73
|
+
}) : B.map((e, t) => /* @__PURE__ */ a(i, {
|
|
53
74
|
value: e.value,
|
|
54
|
-
highlighted: t ===
|
|
55
|
-
selected: e.value ===
|
|
56
|
-
onSelect:
|
|
75
|
+
highlighted: t === j,
|
|
76
|
+
selected: e.value === T,
|
|
77
|
+
onSelect: H,
|
|
57
78
|
children: e.label
|
|
58
79
|
}, e.value))
|
|
59
80
|
})]
|
|
60
81
|
});
|
|
61
82
|
}
|
|
62
83
|
//#endregion
|
|
63
|
-
export {
|
|
84
|
+
export { y as default };
|
|
@@ -2,63 +2,64 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
import { useFocusScope as t } from "../../utils/focus-scope.js";
|
|
4
4
|
import { Presence as n } from "../../utils/presence.js";
|
|
5
|
+
import { useStrings as r } from "../LocaleProvider/useStrings.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useId as
|
|
8
|
-
import { useControl as
|
|
7
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
8
|
+
import { useId as o } from "react";
|
|
9
|
+
import { useControl as s } from "react-use-control";
|
|
9
10
|
//#region src/lib/components/ConfirmDialog/ConfirmDialog.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
enabled:
|
|
11
|
+
var c = "haze-ConfirmDialog__overlay", l = "haze-ConfirmDialog__dialog", u = "haze-ConfirmDialog__header", d = "haze-ConfirmDialog__body", f = "haze-ConfirmDialog__footer", p = "haze-ConfirmDialog__btn", m = "haze-ConfirmDialog__cancelBtn", h = "haze-ConfirmDialog__confirmBtn", g = "haze-ConfirmDialog__dangerBtn";
|
|
12
|
+
function _({ open: _, onClose: v, onConfirm: y, onCancel: b, title: x, children: S, confirmText: C, cancelText: w, variant: T = "default", className: E, ...D }) {
|
|
13
|
+
let [O, k] = s(_, !1), A = r("confirmDialog"), j = C ?? A.confirm, M = w ?? A.cancel, N = t({
|
|
14
|
+
enabled: O,
|
|
14
15
|
trapped: !0
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
16
|
+
}), P = `haze-confirm-title-${o()}`, F = () => {
|
|
17
|
+
k(!1), v?.();
|
|
18
|
+
}, I = () => {
|
|
19
|
+
b?.(), F();
|
|
20
|
+
}, L = () => {
|
|
21
|
+
y?.(), F();
|
|
21
22
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
present:
|
|
24
|
-
children:
|
|
23
|
+
return /* @__PURE__ */ i(n, {
|
|
24
|
+
present: O,
|
|
25
|
+
children: i("div", {
|
|
25
26
|
onClick: () => {
|
|
26
|
-
|
|
27
|
+
O && F();
|
|
27
28
|
},
|
|
28
29
|
onKeyDown: (e) => {
|
|
29
|
-
e.key === "Escape" &&
|
|
30
|
+
e.key === "Escape" && O && F();
|
|
30
31
|
},
|
|
31
|
-
className: e([
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
ref:
|
|
32
|
+
className: e([c, E]),
|
|
33
|
+
children: /* @__PURE__ */ a("div", {
|
|
34
|
+
ref: N,
|
|
34
35
|
role: "dialog",
|
|
35
36
|
"aria-modal": "true",
|
|
36
|
-
"aria-labelledby":
|
|
37
|
-
...
|
|
37
|
+
"aria-labelledby": x === void 0 ? void 0 : P,
|
|
38
|
+
...D,
|
|
38
39
|
onClick: (e) => e.stopPropagation(),
|
|
39
|
-
className: e([
|
|
40
|
+
className: e([l]),
|
|
40
41
|
children: [
|
|
41
|
-
|
|
42
|
-
id:
|
|
43
|
-
className: e([l]),
|
|
44
|
-
children: b
|
|
45
|
-
}),
|
|
46
|
-
/* @__PURE__ */ r("div", {
|
|
42
|
+
x && /* @__PURE__ */ i("div", {
|
|
43
|
+
id: P,
|
|
47
44
|
className: e([u]),
|
|
48
45
|
children: x
|
|
49
46
|
}),
|
|
50
47
|
/* @__PURE__ */ i("div", {
|
|
51
48
|
className: e([d]),
|
|
52
|
-
children:
|
|
49
|
+
children: S
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ a("div", {
|
|
52
|
+
className: e([f]),
|
|
53
|
+
children: [/* @__PURE__ */ i("button", {
|
|
53
54
|
type: "button",
|
|
54
|
-
onClick:
|
|
55
|
-
className: e([
|
|
56
|
-
children:
|
|
57
|
-
}), /* @__PURE__ */
|
|
55
|
+
onClick: I,
|
|
56
|
+
className: e([p, m]),
|
|
57
|
+
children: M
|
|
58
|
+
}), /* @__PURE__ */ i("button", {
|
|
58
59
|
type: "button",
|
|
59
|
-
onClick:
|
|
60
|
-
className: e([
|
|
61
|
-
children:
|
|
60
|
+
onClick: L,
|
|
61
|
+
className: e([p, T === "danger" ? g : h]),
|
|
62
|
+
children: j
|
|
62
63
|
})]
|
|
63
64
|
})
|
|
64
65
|
]
|
|
@@ -67,4 +68,4 @@ function g({ open: g, onClose: _, onConfirm: v, onCancel: y, title: b, children:
|
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
//#endregion
|
|
70
|
-
export {
|
|
71
|
+
export { _ as default };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import t from "../Checkbox/CheckboxCore.js";
|
|
4
|
+
import n from "../Skeleton/Skeleton.js";
|
|
5
|
+
import r from "../Table/TableHead.js";
|
|
6
|
+
import i from "../Table/TableBody.js";
|
|
7
|
+
import a from "../Table/TableCell.js";
|
|
8
|
+
import ee from "../Empty/Empty.js";
|
|
9
|
+
import o from "../Pagination/Pagination.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
12
|
+
import { useEffect as u, useMemo as d, useRef as f } from "react";
|
|
13
|
+
import { useControl as p } from "react-use-control";
|
|
14
|
+
import { createPaginatedRowModel as m, createSortedRowModel as h, metaHelper as g, rowPaginationFeature as _, rowSelectionFeature as v, rowSortingFeature as y, sortFn_alphanumeric as b, sortFn_text as x, tableFeatures as S, useTable as te } from "@tanstack/react-table";
|
|
15
|
+
//#region src/lib/components/DataTable/DataTable.tsx
|
|
16
|
+
var ne = S({
|
|
17
|
+
rowPaginationFeature: _,
|
|
18
|
+
paginatedRowModel: m(),
|
|
19
|
+
rowSelectionFeature: v,
|
|
20
|
+
rowSortingFeature: y,
|
|
21
|
+
sortedRowModel: h(),
|
|
22
|
+
sortFns: {
|
|
23
|
+
alphanumeric: b,
|
|
24
|
+
text: x
|
|
25
|
+
},
|
|
26
|
+
columnMeta: g()
|
|
27
|
+
});
|
|
28
|
+
function C(e, t) {
|
|
29
|
+
let n = {
|
|
30
|
+
...e,
|
|
31
|
+
enableSorting: e.enableSorting ?? e.meta?.sortable ?? t
|
|
32
|
+
};
|
|
33
|
+
return "columns" in n && n.columns ? {
|
|
34
|
+
...n,
|
|
35
|
+
columns: n.columns.map((e) => C(e, t))
|
|
36
|
+
} : n;
|
|
37
|
+
}
|
|
38
|
+
var re = "haze-DataTable__root", ie = "haze-DataTable__scrollArea", ae = "haze-DataTable__stickyScrollArea", w = "haze-DataTable__tableBase", T = "haze-DataTable__stickyHead", E = "haze-DataTable__sortButton", D = "haze-DataTable__sortIcon", O = "haze-DataTable__rowHover", k = "haze-DataTable__rowSelected", A = "haze-DataTable__clickableRow", j = "haze-DataTable__checkCell", M = "haze-DataTable__emptyCell", N = "haze-DataTable__footer";
|
|
39
|
+
function P({ columns: m, data: h, sortable: g = !1, selectable: _ = !1, rowSelection: v, sorting: y, pageSize: b, page: x, loading: S = !1, stickyHeader: P = !1, getRowId: F, onRowClick: I, empty: L, className: R, ...z }) {
|
|
40
|
+
let [oe, B] = p(y, []), [V, H] = p(v, {}), [U, W, G] = p(x, 1), K = b ?? Math.max(h.length, 1), q = d(() => m.map((e) => C(e, g)), [m, g]), J = te({
|
|
41
|
+
features: ne,
|
|
42
|
+
columns: q,
|
|
43
|
+
data: h,
|
|
44
|
+
getRowId: F,
|
|
45
|
+
state: {
|
|
46
|
+
sorting: oe,
|
|
47
|
+
rowSelection: V,
|
|
48
|
+
pagination: {
|
|
49
|
+
pageIndex: U - 1,
|
|
50
|
+
pageSize: K
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
onSortingChange: B,
|
|
54
|
+
onRowSelectionChange: H,
|
|
55
|
+
onPaginationChange: (e) => {
|
|
56
|
+
let t = typeof e == "function" ? e({
|
|
57
|
+
pageIndex: U - 1,
|
|
58
|
+
pageSize: K
|
|
59
|
+
}) : e;
|
|
60
|
+
W(Math.max(1, t.pageIndex + 1));
|
|
61
|
+
}
|
|
62
|
+
}), Y = f(null), se = J.getIsSomeRowsSelected() && !J.getIsAllRowsSelected();
|
|
63
|
+
u(() => {
|
|
64
|
+
let e = Y.current?.querySelector("input");
|
|
65
|
+
e && (e.indeterminate = se);
|
|
66
|
+
});
|
|
67
|
+
let X = J.getHeaderGroups(), Z = J.getLeafHeaders(), ce = Z.length + +!!_, Q = J.getRowModel().rows, $ = I ? (e, t) => {
|
|
68
|
+
t.target instanceof Element && t.target.closest("button, input, select, textarea, a") || I(e, t);
|
|
69
|
+
} : void 0;
|
|
70
|
+
return /* @__PURE__ */ l("div", {
|
|
71
|
+
className: e([re, R]),
|
|
72
|
+
children: [/* @__PURE__ */ c("div", {
|
|
73
|
+
className: e([P ? ae : ie]),
|
|
74
|
+
children: /* @__PURE__ */ l("table", {
|
|
75
|
+
...z,
|
|
76
|
+
className: e([w]),
|
|
77
|
+
children: [/* @__PURE__ */ c(r, {
|
|
78
|
+
className: P ? T : void 0,
|
|
79
|
+
children: X.map((n, r) => /* @__PURE__ */ l("tr", { children: [_ && r === 0 && /* @__PURE__ */ c(a, {
|
|
80
|
+
as: "th",
|
|
81
|
+
rowSpan: X.length > 1 ? X.length : void 0,
|
|
82
|
+
className: e([j]),
|
|
83
|
+
children: /* @__PURE__ */ c("span", {
|
|
84
|
+
ref: Y,
|
|
85
|
+
children: /* @__PURE__ */ c(t, {
|
|
86
|
+
checked: J.getIsAllRowsSelected(),
|
|
87
|
+
onChange: (e) => J.toggleAllRowsSelected(e),
|
|
88
|
+
"aria-label": "Select all rows"
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}), n.headers.map((t) => {
|
|
92
|
+
if (t.rowSpan === 0) return null;
|
|
93
|
+
if (t.isPlaceholder) return /* @__PURE__ */ c(a, {
|
|
94
|
+
as: "th",
|
|
95
|
+
children: null
|
|
96
|
+
}, t.placeholderId ?? t.id);
|
|
97
|
+
let n = t.column.getIsSorted();
|
|
98
|
+
return /* @__PURE__ */ c(a, {
|
|
99
|
+
as: "th",
|
|
100
|
+
colSpan: t.colSpan > 1 ? t.colSpan : void 0,
|
|
101
|
+
rowSpan: t.rowSpan > 1 ? t.rowSpan : void 0,
|
|
102
|
+
"aria-sort": n === "asc" ? "ascending" : n === "desc" ? "descending" : void 0,
|
|
103
|
+
children: t.column.getCanSort() ? /* @__PURE__ */ l("button", {
|
|
104
|
+
type: "button",
|
|
105
|
+
onClick: t.column.getToggleSortingHandler(),
|
|
106
|
+
className: e([E]),
|
|
107
|
+
children: [/* @__PURE__ */ c(J.FlexRender, { header: t }), /* @__PURE__ */ c("span", {
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: e([D]),
|
|
110
|
+
children: n === "asc" ? "↑" : n === "desc" ? "↓" : "↕"
|
|
111
|
+
})]
|
|
112
|
+
}) : /* @__PURE__ */ c(J.FlexRender, { header: t })
|
|
113
|
+
}, t.id);
|
|
114
|
+
})] }, n.id))
|
|
115
|
+
}), /* @__PURE__ */ c(i, { children: S ? Array.from({ length: b ?? 5 }, (t, r) => /* @__PURE__ */ l("tr", { children: [_ && /* @__PURE__ */ c(a, {
|
|
116
|
+
className: e([j]),
|
|
117
|
+
children: /* @__PURE__ */ c(n, {})
|
|
118
|
+
}), Z.map((e) => /* @__PURE__ */ c(a, { children: /* @__PURE__ */ c(n, {}) }, e.id))] }, `skeleton-${r}`)) : /* @__PURE__ */ l(s, { children: [Q.map((n) => /* @__PURE__ */ l("tr", {
|
|
119
|
+
onClick: $ ? (e) => $(n.original, e) : void 0,
|
|
120
|
+
className: e([
|
|
121
|
+
O,
|
|
122
|
+
n.getIsSelected() && k,
|
|
123
|
+
I && A
|
|
124
|
+
]),
|
|
125
|
+
children: [_ && /* @__PURE__ */ c(a, {
|
|
126
|
+
className: e([j]),
|
|
127
|
+
children: /* @__PURE__ */ c(t, {
|
|
128
|
+
checked: n.getIsSelected(),
|
|
129
|
+
onChange: (e) => n.toggleSelected(e),
|
|
130
|
+
"aria-label": `Select row ${n.id}`
|
|
131
|
+
})
|
|
132
|
+
}), n.getAllCells().map((e) => /* @__PURE__ */ c(a, { children: /* @__PURE__ */ c(J.FlexRender, { cell: e }) }, e.id))]
|
|
133
|
+
}, n.id)), Q.length === 0 && /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c(a, {
|
|
134
|
+
colSpan: ce,
|
|
135
|
+
className: e([M]),
|
|
136
|
+
children: L ?? /* @__PURE__ */ c(ee, {})
|
|
137
|
+
}) })] }) })]
|
|
138
|
+
})
|
|
139
|
+
}), b !== void 0 && /* @__PURE__ */ c("div", {
|
|
140
|
+
className: e([N]),
|
|
141
|
+
children: /* @__PURE__ */ c(o, {
|
|
142
|
+
page: G,
|
|
143
|
+
total: h.length,
|
|
144
|
+
pageSize: b,
|
|
145
|
+
size: "sm"
|
|
146
|
+
})
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { P as default };
|
|
@@ -1,33 +1,35 @@
|
|
|
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/DateRangePicker/DateRangePickerCore.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var i = "haze-DateRangePickerCore__container", a = "haze-DateRangePickerCore__input", o = "haze-DateRangePickerCore__sep";
|
|
8
|
+
function s({ startDate: s, endDate: c, onStartChange: l, onEndChange: u, separator: d = "–", className: f }) {
|
|
9
|
+
let p = t("dateRangePicker");
|
|
10
|
+
return /* @__PURE__ */ r("div", {
|
|
11
|
+
className: e([i, f]),
|
|
10
12
|
children: [
|
|
11
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ n("input", {
|
|
12
14
|
type: "date",
|
|
13
|
-
"aria-label":
|
|
14
|
-
value:
|
|
15
|
-
onChange: (e) =>
|
|
16
|
-
className: e([
|
|
15
|
+
"aria-label": p.startDate,
|
|
16
|
+
value: s,
|
|
17
|
+
onChange: (e) => l(e.target.value),
|
|
18
|
+
className: e([a])
|
|
17
19
|
}),
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
className: e([
|
|
20
|
-
children:
|
|
20
|
+
/* @__PURE__ */ n("span", {
|
|
21
|
+
className: e([o]),
|
|
22
|
+
children: d
|
|
21
23
|
}),
|
|
22
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ n("input", {
|
|
23
25
|
type: "date",
|
|
24
|
-
"aria-label":
|
|
25
|
-
value:
|
|
26
|
-
onChange: (e) =>
|
|
27
|
-
className: e([
|
|
26
|
+
"aria-label": p.endDate,
|
|
27
|
+
value: c,
|
|
28
|
+
onChange: (e) => u(e.target.value),
|
|
29
|
+
className: e([a])
|
|
28
30
|
})
|
|
29
31
|
]
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
//#endregion
|
|
33
|
-
export {
|
|
35
|
+
export { s as default };
|
|
@@ -2,17 +2,19 @@ import e from "./DatepickerCore.js";
|
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { useControl as n } from "react-use-control";
|
|
4
4
|
//#region src/lib/components/Datepicker/Datepicker.tsx
|
|
5
|
-
function r({ value: r, open: i, min: a, max: o,
|
|
6
|
-
let [
|
|
5
|
+
function r({ value: r, open: i, min: a, max: o, locale: s, weekStartsOn: c, placeholder: l, className: u }) {
|
|
6
|
+
let [d, f] = n(r, ""), [p, m] = n(i, !1);
|
|
7
7
|
return /* @__PURE__ */ t(e, {
|
|
8
|
-
value:
|
|
9
|
-
onChange:
|
|
10
|
-
open:
|
|
11
|
-
onOpenChange:
|
|
8
|
+
value: d,
|
|
9
|
+
onChange: f,
|
|
10
|
+
open: p,
|
|
11
|
+
onOpenChange: m,
|
|
12
12
|
min: a,
|
|
13
13
|
max: o,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
locale: s,
|
|
15
|
+
weekStartsOn: c,
|
|
16
|
+
placeholder: l,
|
|
17
|
+
className: u
|
|
16
18
|
});
|
|
17
19
|
}
|
|
18
20
|
//#endregion
|