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.
Files changed (148) hide show
  1. package/README.md +139 -0
  2. package/dist/components/Alert/Alert.js +19 -18
  3. package/dist/components/ApprovalCard/ApprovalCard.js +27 -25
  4. package/dist/components/AsyncSection/AsyncSection.js +32 -30
  5. package/dist/components/AvatarGroup/AvatarGroup.js +29 -0
  6. package/dist/components/AvatarGroup/index.js +2 -0
  7. package/dist/components/BackToTop/BackToTop.js +15 -14
  8. package/dist/components/Banner/Banner.js +19 -18
  9. package/dist/components/Breadcrumb/Breadcrumb.js +18 -17
  10. package/dist/components/Calendar/Calendar.js +152 -0
  11. package/dist/components/Calendar/index.js +2 -0
  12. package/dist/components/Carousel/Carousel.js +42 -40
  13. package/dist/components/Cascader/Cascader.js +227 -0
  14. package/dist/components/Cascader/index.js +2 -0
  15. package/dist/components/ChatInput/ChatInput.js +30 -29
  16. package/dist/components/ChatMessage/ChatMessage.js +28 -27
  17. package/dist/components/Chip/Chip.js +20 -19
  18. package/dist/components/ColorPicker/ColorPickerCore.js +28 -26
  19. package/dist/components/Combobox/Combobox.js +62 -41
  20. package/dist/components/ConfirmDialog/ConfirmDialog.js +40 -39
  21. package/dist/components/DataTable/DataTable.js +151 -0
  22. package/dist/components/DataTable/index.js +2 -0
  23. package/dist/components/DateRangePicker/DateRangePickerCore.js +21 -19
  24. package/dist/components/Datepicker/Datepicker.js +10 -8
  25. package/dist/components/Datepicker/DatepickerCore.js +18 -16
  26. package/dist/components/Empty/Empty.js +21 -19
  27. package/dist/components/FileInput/FileInput.js +14 -13
  28. package/dist/components/HoverCard/HoverCard.js +53 -0
  29. package/dist/components/HoverCard/index.js +2 -0
  30. package/dist/components/InlineEdit/InlineEdit.js +32 -31
  31. package/dist/components/Kbd/Kbd.js +21 -0
  32. package/dist/components/Kbd/index.js +2 -0
  33. package/dist/components/LocaleProvider/LocaleContext.js +5 -0
  34. package/dist/components/LocaleProvider/LocaleProvider.js +21 -0
  35. package/dist/components/LocaleProvider/index.js +4 -0
  36. package/dist/components/LocaleProvider/locale.js +126 -0
  37. package/dist/components/LocaleProvider/useStrings.js +17 -0
  38. package/dist/components/LogViewer/LogViewer.js +44 -43
  39. package/dist/components/MarkdownRenderer/MarkdownRenderer.js +19 -19
  40. package/dist/components/MarkdownRenderer/markdown-blocks.js +41 -0
  41. package/dist/components/ModelPicker/ModelPicker.js +16 -15
  42. package/dist/components/NumberInput/NumberInputCore.js +34 -33
  43. package/dist/components/OTPInput/OTPInputCore.js +35 -30
  44. package/dist/components/Pagination/Pagination.js +31 -30
  45. package/dist/components/PasswordInput/PasswordInputCore.js +22 -21
  46. package/dist/components/Progress/Progress.js +40 -39
  47. package/dist/components/Rating/RatingCore.js +28 -26
  48. package/dist/components/Sidebar/Sidebar.js +112 -0
  49. package/dist/components/Sidebar/index.js +2 -0
  50. package/dist/components/Spinner/Spinner.js +14 -12
  51. package/dist/components/StreamingText/StreamingText.js +38 -18
  52. package/dist/components/Tag/Tag.js +16 -14
  53. package/dist/components/TagGroup/TagGroupItem.js +12 -10
  54. package/dist/components/TagInput/TagInputCore.js +52 -50
  55. package/dist/components/ThinkingIndicator/ThinkingIndicator.js +13 -11
  56. package/dist/components/Toast/ToastContainer.js +44 -28
  57. package/dist/components/Toast/index.js +4 -3
  58. package/dist/components/Toast/toast2.js +44 -0
  59. package/dist/components/TokenCounter/TokenCounter.js +19 -18
  60. package/dist/components/ToolCallCard/ToolCallCard.js +39 -37
  61. package/dist/components/Toolbar/Toolbar.js +59 -0
  62. package/dist/components/Toolbar/ToolbarButton.js +25 -0
  63. package/dist/components/Toolbar/ToolbarContext.js +8 -0
  64. package/dist/components/Toolbar/ToolbarSeparator.js +22 -0
  65. package/dist/components/Toolbar/index.js +4 -0
  66. package/dist/components/Tour/Tour.js +197 -0
  67. package/dist/components/Tour/index.js +2 -0
  68. package/dist/components/Transfer/TransferCore.js +61 -67
  69. package/dist/components/Tree/TreeItem.js +56 -55
  70. package/dist/components/Upload/UploadCore.js +36 -35
  71. package/dist/components/VirtualList/VirtualList.js +140 -26
  72. package/dist/css/affix.css +1 -1
  73. package/dist/css/avatar-group.css +2 -0
  74. package/dist/css/calendar.css +2 -0
  75. package/dist/css/carousel.css +1 -1
  76. package/dist/css/cascader.css +2 -0
  77. package/dist/css/chat-message.css +1 -1
  78. package/dist/css/chip.css +1 -1
  79. package/dist/css/code-block.css +1 -1
  80. package/dist/css/combobox.css +1 -1
  81. package/dist/css/container.css +1 -1
  82. package/dist/css/context-menu.css +1 -1
  83. package/dist/css/conversation-list.css +1 -1
  84. package/dist/css/data-table.css +2 -0
  85. package/dist/css/datepicker.css +0 -1
  86. package/dist/css/diff-viewer.css +1 -1
  87. package/dist/css/dropdown-menu.css +1 -1
  88. package/dist/css/hover-card.css +2 -0
  89. package/dist/css/kbd.css +2 -0
  90. package/dist/css/list.css +1 -1
  91. package/dist/css/markdown-renderer.css +1 -1
  92. package/dist/css/menu.css +1 -1
  93. package/dist/css/model-picker.css +1 -1
  94. package/dist/css/navigation-bar.css +1 -1
  95. package/dist/css/password-input.css +1 -1
  96. package/dist/css/radio.css +1 -1
  97. package/dist/css/select.css +1 -1
  98. package/dist/css/sidebar.css +2 -0
  99. package/dist/css/step-timeline.css +1 -1
  100. package/dist/css/stepper.css +1 -1
  101. package/dist/css/streaming-text.css +1 -1
  102. package/dist/css/table.css +1 -1
  103. package/dist/css/toolbar.css +4 -0
  104. package/dist/css/tour.css +2 -0
  105. package/dist/css/tree.css +1 -1
  106. package/dist/css/virtual-list.css +1 -1
  107. package/dist/css-manifest.json +19 -0
  108. package/dist/haze-ui.css +36 -26
  109. package/dist/index.js +130 -115
  110. package/dist/registry.json +247 -0
  111. package/dist/types/components/AvatarGroup/AvatarGroup.d.ts +9 -0
  112. package/dist/types/components/AvatarGroup/index.d.ts +2 -0
  113. package/dist/types/components/Calendar/Calendar.d.ts +21 -0
  114. package/dist/types/components/Calendar/index.d.ts +2 -0
  115. package/dist/types/components/Cascader/Cascader.d.ts +26 -0
  116. package/dist/types/components/Cascader/index.d.ts +2 -0
  117. package/dist/types/components/Combobox/Combobox.d.ts +7 -1
  118. package/dist/types/components/DataTable/DataTable.d.ts +61 -0
  119. package/dist/types/components/DataTable/index.d.ts +2 -0
  120. package/dist/types/components/Datepicker/Datepicker.d.ts +3 -1
  121. package/dist/types/components/Datepicker/DatepickerCore.d.ts +3 -1
  122. package/dist/types/components/HoverCard/HoverCard.d.ts +49 -0
  123. package/dist/types/components/HoverCard/index.d.ts +2 -0
  124. package/dist/types/components/Kbd/Kbd.d.ts +6 -0
  125. package/dist/types/components/Kbd/index.d.ts +2 -0
  126. package/dist/types/components/LocaleProvider/LocaleContext.d.ts +19 -0
  127. package/dist/types/components/LocaleProvider/LocaleProvider.d.ts +13 -0
  128. package/dist/types/components/LocaleProvider/index.d.ts +6 -0
  129. package/dist/types/components/LocaleProvider/locale.d.ts +176 -0
  130. package/dist/types/components/LocaleProvider/useStrings.d.ts +9 -0
  131. package/dist/types/components/MarkdownRenderer/markdown-blocks.d.ts +6 -0
  132. package/dist/types/components/Sidebar/Sidebar.d.ts +64 -0
  133. package/dist/types/components/Sidebar/index.d.ts +4 -0
  134. package/dist/types/components/Toast/index.d.ts +2 -0
  135. package/dist/types/components/Toast/toast.d.ts +46 -0
  136. package/dist/types/components/Toolbar/Toolbar.d.ts +16 -0
  137. package/dist/types/components/Toolbar/ToolbarButton.d.ts +20 -0
  138. package/dist/types/components/Toolbar/ToolbarContext.d.ts +5 -0
  139. package/dist/types/components/Toolbar/ToolbarSeparator.d.ts +14 -0
  140. package/dist/types/components/Toolbar/index.d.ts +6 -0
  141. package/dist/types/components/Tour/Tour.d.ts +46 -0
  142. package/dist/types/components/Tour/index.d.ts +2 -0
  143. package/dist/types/components/VirtualList/VirtualList.d.ts +58 -4
  144. package/dist/types/components/VirtualList/index.d.ts +1 -1
  145. package/dist/types/index.d.ts +24 -3
  146. package/package.json +25 -11
  147. package/dist/components/Datepicker/Calendar.js +0 -120
  148. 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 t, jsxs as n } from "react/jsx-runtime";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
6
  //#region src/lib/components/Chip/Chip.tsx
6
- var r = "haze-Chip__base", i = {
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
- }, a = {
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
- }, o = "haze-Chip__iconStyle", s = "haze-Chip__closeBtn";
19
- function c({ variant: c = "solid", color: l = "default", icon: u, onClose: d, className: f, children: p }) {
20
- let m = c === "outline" ? a[l] : i[l];
21
- return /* @__PURE__ */ n("span", {
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
- r,
24
- m,
25
- f
24
+ i,
25
+ g,
26
+ p
26
27
  ]),
27
28
  children: [
28
- u && /* @__PURE__ */ t("span", {
29
- className: e([o]),
30
- children: u
29
+ d && /* @__PURE__ */ n("span", {
30
+ className: e([s]),
31
+ children: d
31
32
  }),
32
- p,
33
- d && /* @__PURE__ */ t("button", {
33
+ m,
34
+ f && /* @__PURE__ */ n("button", {
34
35
  type: "button",
35
- onClick: d,
36
- "aria-label": "Remove",
37
- className: e([s]),
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 { c as default };
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 t, jsxs as n } from "react/jsx-runtime";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
6
  //#region src/lib/components/ColorPicker/ColorPickerCore.tsx
6
- var r = "haze-ColorPickerCore__container", i = "haze-ColorPickerCore__previewRow", a = "haze-ColorPickerCore__colorInput", o = "haze-ColorPickerCore__textInput", s = "haze-ColorPickerCore__presetsRow", c = "haze-ColorPickerCore__presetBtn", l = "haze-ColorPickerCore__activePreset";
7
- function u({ value: u, onChange: d, presets: f, className: p }) {
8
- return /* @__PURE__ */ n("div", {
9
- className: e([r, p]),
10
- children: [/* @__PURE__ */ n("div", {
11
- className: e([i]),
12
- children: [/* @__PURE__ */ t("input", {
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: u,
15
- "aria-label": "Pick color",
16
- onChange: (e) => d(e.target.value),
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
- }), f && f.length > 0 && /* @__PURE__ */ t("div", {
26
- className: e([s]),
27
- children: f.map((n) => /* @__PURE__ */ t("button", {
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: n },
30
- "aria-label": n,
31
- onClick: () => d(n),
32
- className: e([c, u === n && l])
33
- }, n))
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 { u as default };
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 "./ComboboxOption.js";
4
+ import r from "../VirtualList/VirtualList.js";
5
+ import i from "./ComboboxOption.js";
5
6
  /* empty css */
6
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
- import { useId as o, useRef as s, useState as c } from "react";
8
- import { useControl as l } from "react-use-control";
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 u = "haze-Combobox__wrapper", d = "haze-Combobox__input", f = "haze-Combobox__listbox";
11
- function p({ value: p, open: m, options: h, placeholder: g, className: _ }) {
12
- let [v, y] = l(p, ""), [b, x] = c(""), [S, C] = l(m, !1), [w, T] = c(-1), [E, D] = c(b), O = o(), k = s(null), A = s(null), j = n({
13
- open: S,
14
- setOpen: C,
15
- triggerRef: k,
16
- panelRef: A,
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
- }), M = h.filter((e) => e.label.toLowerCase().includes(b.toLowerCase()));
19
- b !== E && (D(b), T(-1));
20
- let N = (e) => {
21
- y(e);
22
- let t = h.find((t) => t.value === e)?.label ?? e;
23
- x(t), C(!1), k.current?.focus();
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__ */ a("div", {
26
- className: e([u, _]),
27
- children: [/* @__PURE__ */ i("input", {
28
- ref: k,
32
+ return /* @__PURE__ */ o("div", {
33
+ className: e([f, w]),
34
+ children: [/* @__PURE__ */ a("input", {
35
+ ref: I,
29
36
  role: "combobox",
30
- style: j.triggerStyle,
31
- "aria-expanded": S,
32
- "aria-controls": O,
37
+ style: z.triggerStyle,
38
+ "aria-expanded": k,
39
+ "aria-controls": F,
33
40
  "aria-autocomplete": "list",
34
- className: d,
35
- value: b,
36
- placeholder: g,
41
+ className: p,
42
+ value: D,
43
+ placeholder: S,
37
44
  onChange: (e) => {
38
- x(e.target.value), C(!0);
45
+ O(e.target.value), A(!0);
39
46
  },
40
- onFocus: () => C(!0),
41
- onClick: () => C(!0),
47
+ onFocus: () => A(!0),
48
+ onClick: () => A(!0),
42
49
  onKeyDown: (e) => {
43
- e.key === "ArrowDown" ? (e.preventDefault(), T((e) => Math.min(e + 1, M.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), T((e) => Math.max(e - 1, 0))) : e.key === "Enter" && w >= 0 && M[w] ? (e.preventDefault(), N(M[w].value)) : e.key === "Escape" && C(!1);
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__ */ i(t, {
46
- ref: A,
47
- behavior: j,
52
+ }), /* @__PURE__ */ a(t, {
53
+ ref: L,
54
+ behavior: z,
48
55
  placement: "bottom-span",
49
- id: O,
56
+ id: F,
50
57
  role: "listbox",
51
- visualClass: f,
52
- children: M.map((e, t) => /* @__PURE__ */ i(r, {
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 === w,
55
- selected: e.value === v,
56
- onSelect: N,
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 { p as default };
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 r, jsxs as i } from "react/jsx-runtime";
7
- import { useId as a } from "react";
8
- import { useControl as o } from "react-use-control";
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 s = "haze-ConfirmDialog__overlay", c = "haze-ConfirmDialog__dialog", l = "haze-ConfirmDialog__header", u = "haze-ConfirmDialog__body", d = "haze-ConfirmDialog__footer", f = "haze-ConfirmDialog__btn", p = "haze-ConfirmDialog__cancelBtn", m = "haze-ConfirmDialog__confirmBtn", h = "haze-ConfirmDialog__dangerBtn";
11
- function g({ open: g, onClose: _, onConfirm: v, onCancel: y, title: b, children: x, confirmText: S = "Confirm", cancelText: C = "Cancel", variant: w = "default", className: T, ...E }) {
12
- let [D, O] = o(g, !1), k = t({
13
- enabled: D,
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
- }), A = `haze-confirm-title-${a()}`, j = () => {
16
- O(!1), _?.();
17
- }, M = () => {
18
- y?.(), j();
19
- }, N = () => {
20
- v?.(), j();
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__ */ r(n, {
23
- present: D,
24
- children: r("div", {
23
+ return /* @__PURE__ */ i(n, {
24
+ present: O,
25
+ children: i("div", {
25
26
  onClick: () => {
26
- D && j();
27
+ O && F();
27
28
  },
28
29
  onKeyDown: (e) => {
29
- e.key === "Escape" && D && j();
30
+ e.key === "Escape" && O && F();
30
31
  },
31
- className: e([s, T]),
32
- children: /* @__PURE__ */ i("div", {
33
- ref: k,
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": b === void 0 ? void 0 : A,
37
- ...E,
37
+ "aria-labelledby": x === void 0 ? void 0 : P,
38
+ ...D,
38
39
  onClick: (e) => e.stopPropagation(),
39
- className: e([c]),
40
+ className: e([l]),
40
41
  children: [
41
- b && /* @__PURE__ */ r("div", {
42
- id: A,
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: [/* @__PURE__ */ r("button", {
49
+ children: S
50
+ }),
51
+ /* @__PURE__ */ a("div", {
52
+ className: e([f]),
53
+ children: [/* @__PURE__ */ i("button", {
53
54
  type: "button",
54
- onClick: M,
55
- className: e([f, p]),
56
- children: C
57
- }), /* @__PURE__ */ r("button", {
55
+ onClick: I,
56
+ className: e([p, m]),
57
+ children: M
58
+ }), /* @__PURE__ */ i("button", {
58
59
  type: "button",
59
- onClick: N,
60
- className: e([f, w === "danger" ? h : m]),
61
- children: S
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 { g as default };
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 };
@@ -0,0 +1,2 @@
1
+ import e from "./DataTable.js";
2
+ export { e as DataTable };
@@ -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 t, jsxs as n } from "react/jsx-runtime";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
6
  //#region src/lib/components/DateRangePicker/DateRangePickerCore.tsx
6
- var r = "haze-DateRangePickerCore__container", i = "haze-DateRangePickerCore__input", a = "haze-DateRangePickerCore__sep";
7
- function o({ startDate: o, endDate: s, onStartChange: c, onEndChange: l, separator: u = "–", className: d }) {
8
- return /* @__PURE__ */ n("div", {
9
- className: e([r, d]),
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__ */ t("input", {
13
+ /* @__PURE__ */ n("input", {
12
14
  type: "date",
13
- "aria-label": "Start date",
14
- value: o,
15
- onChange: (e) => c(e.target.value),
16
- className: e([i])
15
+ "aria-label": p.startDate,
16
+ value: s,
17
+ onChange: (e) => l(e.target.value),
18
+ className: e([a])
17
19
  }),
18
- /* @__PURE__ */ t("span", {
19
- className: e([a]),
20
- children: u
20
+ /* @__PURE__ */ n("span", {
21
+ className: e([o]),
22
+ children: d
21
23
  }),
22
- /* @__PURE__ */ t("input", {
24
+ /* @__PURE__ */ n("input", {
23
25
  type: "date",
24
- "aria-label": "End date",
25
- value: s,
26
- onChange: (e) => l(e.target.value),
27
- className: e([i])
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 { o as default };
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, placeholder: s, className: c }) {
6
- let [l, u] = n(r, ""), [d, f] = n(i, !1);
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: l,
9
- onChange: u,
10
- open: d,
11
- onOpenChange: f,
8
+ value: d,
9
+ onChange: f,
10
+ open: p,
11
+ onOpenChange: m,
12
12
  min: a,
13
13
  max: o,
14
- placeholder: s,
15
- className: c
14
+ locale: s,
15
+ weekStartsOn: c,
16
+ placeholder: l,
17
+ className: u
16
18
  });
17
19
  }
18
20
  //#endregion