haze-ui 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/components/Calendar/Calendar.js +222 -151
  2. package/dist/components/Cascader/Cascader.js +180 -146
  3. package/dist/components/Chart/Chart.js +12 -9
  4. package/dist/components/Chart/chart-elements.js +118 -42
  5. package/dist/components/CodeBlock/CodeBlock.js +39 -9
  6. package/dist/components/Combobox/Combobox.js +107 -99
  7. package/dist/components/DataTable/DataTable.js +224 -221
  8. package/dist/components/DataTable/csv.js +29 -0
  9. package/dist/components/DataTable/index.js +3 -2
  10. package/dist/components/DateRangePicker/DateRangePicker.js +31 -16
  11. package/dist/components/DateRangePicker/presets.js +43 -0
  12. package/dist/components/Datepicker/Datepicker.js +12 -11
  13. package/dist/components/Datepicker/DatepickerCore.js +72 -51
  14. package/dist/components/Datepicker/datetime.js +23 -0
  15. package/dist/components/Descriptions/Descriptions.js +46 -0
  16. package/dist/components/Descriptions/index.js +3 -0
  17. package/dist/components/DiffViewer/DiffViewer.js +31 -30
  18. package/dist/components/FilePreview/FilePreview.js +135 -0
  19. package/dist/components/FilePreview/file-preview-format.js +23 -0
  20. package/dist/components/FilePreview/index.js +3 -0
  21. package/dist/components/FloatButton/FloatButton.js +42 -0
  22. package/dist/components/FloatButton/FloatButtonGroup.js +58 -0
  23. package/dist/components/FloatButton/float-button-context.js +9 -0
  24. package/dist/components/FloatButton/float-button-glyphs.js +26 -0
  25. package/dist/components/FloatButton/float-button-styles.js +14 -0
  26. package/dist/components/FloatButton/index.js +4 -0
  27. package/dist/components/InlineCompletion/InlineCompletion.js +81 -0
  28. package/dist/components/InlineCompletion/index.js +3 -0
  29. package/dist/components/JsonView/JsonView.js +209 -0
  30. package/dist/components/JsonView/index.js +3 -0
  31. package/dist/components/JsonView/json-view-utils.js +24 -0
  32. package/dist/components/LocaleProvider/index.js +5 -4
  33. package/dist/components/LocaleProvider/ja-jp.js +222 -0
  34. package/dist/components/LocaleProvider/locale.js +42 -4
  35. package/dist/components/LocaleProvider/useStrings.js +13 -11
  36. package/dist/components/LocaleProvider/zh-cn.js +42 -4
  37. package/dist/components/Masonry/Masonry.js +29 -0
  38. package/dist/components/Masonry/index.js +3 -0
  39. package/dist/components/Masonry/masonry-distribute.js +15 -0
  40. package/dist/components/Select/Select.js +14 -13
  41. package/dist/components/Select/SelectCore.js +27 -26
  42. package/dist/components/Select/SelectFloating.js +76 -68
  43. package/dist/components/Signature/Signature.js +165 -0
  44. package/dist/components/Signature/index.js +3 -0
  45. package/dist/components/Signature/signature-points.js +28 -0
  46. package/dist/components/Sources/Sources.js +109 -0
  47. package/dist/components/Sources/index.js +3 -0
  48. package/dist/components/TagGroup/SortableTagGroup.js +26 -0
  49. package/dist/components/TagGroup/TagGroup.js +7 -21
  50. package/dist/components/TagGroup/TagGroupItem.js +1 -1
  51. package/dist/components/TagGroup/index.js +2 -1
  52. package/dist/components/TagGroup/tag-group-styles.js +7 -0
  53. package/dist/components/TagInput/SortableTagInput.js +24 -0
  54. package/dist/components/TagInput/SortableTagInputCore.js +52 -0
  55. package/dist/components/TagInput/TagInput.js +9 -10
  56. package/dist/components/TagInput/TagInputCore.js +61 -84
  57. package/dist/components/TagInput/index.js +3 -1
  58. package/dist/components/TagInput/tag-input-styles.js +7 -0
  59. package/dist/components/Toast/Toast.js +44 -43
  60. package/dist/components/Tree/Tree.js +184 -121
  61. package/dist/components/Tree/TreeItem.js +91 -57
  62. package/dist/components/Tree/utils.js +57 -1
  63. package/dist/components/Upload/Upload.js +12 -9
  64. package/dist/components/Upload/UploadCore.js +130 -124
  65. package/dist/components/Upload/UploadList.js +164 -36
  66. package/dist/css/bottom-sheet.css +1 -1
  67. package/dist/css/cascader.css +1 -1
  68. package/dist/css/datepicker.css +1 -1
  69. package/dist/css/descriptions.css +2 -0
  70. package/dist/css/dialog.css +1 -1
  71. package/dist/css/drawer.css +1 -1
  72. package/dist/css/file-preview.css +2 -0
  73. package/dist/css/float-button.css +2 -0
  74. package/dist/css/inline-completion.css +2 -0
  75. package/dist/css/json-view.css +2 -0
  76. package/dist/css/masonry.css +2 -0
  77. package/dist/css/signature.css +2 -0
  78. package/dist/css/sources.css +2 -0
  79. package/dist/css/tag-group.css +2 -2
  80. package/dist/css/tag-input.css +2 -3
  81. package/dist/css/tree.css +2 -2
  82. package/dist/css/upload.css +1 -1
  83. package/dist/css-manifest.json +15 -0
  84. package/dist/haze-ui.css +20 -13
  85. package/dist/headless/index.js +18 -6
  86. package/dist/hooks/useDarkMode.js +27 -0
  87. package/dist/index.js +207 -192
  88. package/dist/registry.json +210 -34
  89. package/dist/types/components/Cascader/Cascader.d.ts +20 -1
  90. package/dist/types/components/Chart/Chart.d.ts +27 -13
  91. package/dist/types/components/Chart/chart-elements.d.ts +62 -10
  92. package/dist/types/components/Chart/index.d.ts +1 -1
  93. package/dist/types/components/CodeBlock/CodeBlock.d.ts +19 -2
  94. package/dist/types/components/CodeBlock/index.d.ts +1 -1
  95. package/dist/types/components/Combobox/Combobox.d.ts +11 -1
  96. package/dist/types/components/DataTable/DataTable.d.ts +36 -1
  97. package/dist/types/components/DataTable/csv.d.ts +36 -0
  98. package/dist/types/components/DataTable/features.d.ts +6 -0
  99. package/dist/types/components/DataTable/index.d.ts +2 -0
  100. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +15 -3
  101. package/dist/types/components/DateRangePicker/index.d.ts +1 -1
  102. package/dist/types/components/DateRangePicker/presets.d.ts +23 -0
  103. package/dist/types/components/Datepicker/Datepicker.d.ts +5 -1
  104. package/dist/types/components/Datepicker/DatepickerCore.d.ts +6 -1
  105. package/dist/types/components/Datepicker/datetime.d.ts +27 -0
  106. package/dist/types/components/Descriptions/Descriptions.d.ts +30 -0
  107. package/dist/types/components/Descriptions/index.d.ts +2 -0
  108. package/dist/types/components/FilePreview/FilePreview.d.ts +35 -0
  109. package/dist/types/components/FilePreview/file-preview-format.d.ts +20 -0
  110. package/dist/types/components/FilePreview/index.d.ts +2 -0
  111. package/dist/types/components/FloatButton/FloatButton.d.ts +43 -0
  112. package/dist/types/components/FloatButton/FloatButtonGroup.d.ts +33 -0
  113. package/dist/types/components/FloatButton/float-button-context.d.ts +11 -0
  114. package/dist/types/components/FloatButton/float-button-glyphs.d.ts +3 -0
  115. package/dist/types/components/FloatButton/float-button-styles.d.ts +58 -0
  116. package/dist/types/components/FloatButton/index.d.ts +4 -0
  117. package/dist/types/components/InlineCompletion/InlineCompletion.d.ts +29 -0
  118. package/dist/types/components/InlineCompletion/index.d.ts +2 -0
  119. package/dist/types/components/JsonView/JsonView.d.ts +26 -0
  120. package/dist/types/components/JsonView/index.d.ts +2 -0
  121. package/dist/types/components/JsonView/json-view-utils.d.ts +22 -0
  122. package/dist/types/components/LocaleProvider/index.d.ts +1 -0
  123. package/dist/types/components/LocaleProvider/ja-jp.d.ts +13 -0
  124. package/dist/types/components/LocaleProvider/locale.d.ts +44 -0
  125. package/dist/types/components/Masonry/Masonry.d.ts +34 -0
  126. package/dist/types/components/Masonry/index.d.ts +2 -0
  127. package/dist/types/components/Masonry/masonry-distribute.d.ts +16 -0
  128. package/dist/types/components/Select/Select.d.ts +13 -1
  129. package/dist/types/components/Select/SelectCore.d.ts +10 -1
  130. package/dist/types/components/Select/SelectFloating.d.ts +12 -1
  131. package/dist/types/components/Signature/Signature.d.ts +51 -0
  132. package/dist/types/components/Signature/index.d.ts +2 -0
  133. package/dist/types/components/Signature/signature-points.d.ts +31 -0
  134. package/dist/types/components/Sources/Sources.d.ts +37 -0
  135. package/dist/types/components/Sources/index.d.ts +2 -0
  136. package/dist/types/components/TagGroup/SortableTagGroup.d.ts +20 -0
  137. package/dist/types/components/TagGroup/TagGroup.d.ts +4 -13
  138. package/dist/types/components/TagGroup/index.d.ts +2 -0
  139. package/dist/types/components/TagGroup/tag-group-styles.d.ts +7 -0
  140. package/dist/types/components/TagInput/SortableTagInput.d.ts +34 -0
  141. package/dist/types/components/TagInput/SortableTagInputCore.d.ts +18 -0
  142. package/dist/types/components/TagInput/TagInput.d.ts +1 -8
  143. package/dist/types/components/TagInput/TagInputCore.d.ts +4 -10
  144. package/dist/types/components/TagInput/index.d.ts +4 -0
  145. package/dist/types/components/TagInput/tag-input-styles.d.ts +12 -0
  146. package/dist/types/components/Tree/Tree.d.ts +1 -1
  147. package/dist/types/components/Tree/TreeItem.d.ts +11 -1
  148. package/dist/types/components/Tree/types.d.ts +25 -0
  149. package/dist/types/components/Tree/utils.d.ts +41 -0
  150. package/dist/types/components/Upload/Upload.d.ts +10 -1
  151. package/dist/types/components/Upload/UploadCore.d.ts +21 -1
  152. package/dist/types/components/Upload/UploadList.d.ts +8 -2
  153. package/dist/types/headless/index.d.ts +221 -4
  154. package/dist/types/hooks/index.d.ts +2 -0
  155. package/dist/types/hooks/useDarkMode.d.ts +40 -0
  156. package/dist/types/index.d.ts +28 -11
  157. package/dist/types/utils/sortable-handle.d.ts +25 -0
  158. package/dist/types/utils/sortable-shared.d.ts +12 -24
  159. package/dist/utils/sortable-handle.js +12 -0
  160. package/dist/utils/sortable-shared.js +8 -16
  161. package/dist/utils/sortable.js +2 -1
  162. package/dist/utils/submenu.js +7 -5
  163. package/package.json +65 -5
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ //#region src/lib/components/DataTable/csv.ts
3
+ function e(e) {
4
+ return e.id === void 0 ? "accessorKey" in e ? e.accessorKey : "" : e.id;
5
+ }
6
+ function t(e) {
7
+ return e.flatMap((e) => "columns" in e && e.columns ? t(e.columns) : [e]);
8
+ }
9
+ function n(t, n) {
10
+ return t.meta?.excludeFromExport || !("accessorKey" in t) && !("accessorFn" in t) ? !1 : n?.[e(t)] !== !1;
11
+ }
12
+ function r(e, t) {
13
+ if ("accessorFn" in e) return e.accessorFn(t, 0);
14
+ if ("accessorKey" in e) return t[e.accessorKey];
15
+ }
16
+ function i(e) {
17
+ return e == null ? "" : e instanceof Date ? e.toISOString() : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? String(e) : typeof e == "function" || typeof e == "symbol" ? "" : JSON.stringify(e);
18
+ }
19
+ function a(e) {
20
+ return /["\r\n,]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e;
21
+ }
22
+ function o(o, s, c) {
23
+ let l = t(s).filter((e) => n(e, c?.columnVisibility));
24
+ if (l.length === 0) return "";
25
+ let u = l.map((t) => a(i(typeof t.header == "string" ? t.header : e(t)))).join(","), d = o.map((e) => l.map((t) => a(i(r(t, e)))).join(","));
26
+ return `${c?.bom === !1 ? "" : ""}${[u, ...d].join("\r\n")}`;
27
+ }
28
+ //#endregion
29
+ export { o as dataTableToCsv };
@@ -1,4 +1,5 @@
1
1
  "use client";
2
2
  import e from "./DataTable.js";
3
- import { dataTableAvg as t, dataTableCount as n, dataTableSum as r } from "./summary.js";
4
- export { e as DataTable, t as dataTableAvg, n as dataTableCount, r as dataTableSum };
3
+ import { dataTableToCsv as t } from "./csv.js";
4
+ import { dataTableAvg as n, dataTableCount as r, dataTableSum as i } from "./summary.js";
5
+ export { e as DataTable, n as dataTableAvg, r as dataTableCount, i as dataTableSum, t as dataTableToCsv };
@@ -1,25 +1,40 @@
1
1
  "use client";
2
- import e from "./DateRangePickerCore.js";
3
- import { jsx as t } from "react/jsx-runtime";
4
- import { useControl as n } from "react-use-control";
2
+ import { useStrings as e } from "../LocaleProvider/useStrings.js";
3
+ import t from "./DateRangePickerCore.js";
4
+ import { commonRangePresets as n } from "./presets.js";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ import { useControl as i } from "react-use-control";
5
7
  //#region src/lib/components/DateRangePicker/DateRangePicker.tsx
6
- function r({ startDate: r, endDate: i, onStartChange: a, onEndChange: o, separator: s, months: c, disabledDate: l, presets: u, className: d }) {
7
- let [f, p] = n(r, ""), [m, h] = n(i, "");
8
- return /* @__PURE__ */ t(e, {
9
- startDate: f,
10
- endDate: m,
8
+ function a(e, t) {
9
+ if (e === void 0) return;
10
+ let r = e === "common" ? ["common"] : e, i = [];
11
+ for (let e of r) e === "common" ? i.push(...n(t)) : i.push(e);
12
+ return i;
13
+ }
14
+ function o({ startDate: n, endDate: o, onStartChange: s, onEndChange: c, separator: l, months: u, disabledDate: d, presets: f, className: p }) {
15
+ let [m, h] = i(n, ""), [g, _] = i(o, ""), v = e("dateRangePicker");
16
+ return /* @__PURE__ */ r(t, {
17
+ startDate: m,
18
+ endDate: g,
11
19
  onStartChange: (e) => {
12
- p(e), a?.(e);
20
+ h(e), s?.(e);
13
21
  },
14
22
  onEndChange: (e) => {
15
- h(e), o?.(e);
23
+ _(e), c?.(e);
16
24
  },
17
- separator: s,
18
- months: c,
19
- disabledDate: l,
20
- presets: u,
21
- className: d
25
+ separator: l,
26
+ months: u,
27
+ disabledDate: d,
28
+ presets: a(f, {
29
+ today: v.presetToday,
30
+ yesterday: v.presetYesterday,
31
+ last7Days: v.presetLast7Days,
32
+ last30Days: v.presetLast30Days,
33
+ thisMonth: v.presetThisMonth,
34
+ lastMonth: v.presetLastMonth
35
+ }),
36
+ className: p
22
37
  });
23
38
  }
24
39
  //#endregion
25
- export { r as default };
40
+ export { o as default };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { addMonths as e, formatDate as t, getDaysInMonth as n } from "../Calendar/date.js";
3
+ //#region src/lib/components/DateRangePicker/presets.ts
4
+ function r(e, t) {
5
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
6
+ }
7
+ function i(e) {
8
+ return t(e.getFullYear(), e.getMonth(), e.getDate());
9
+ }
10
+ function a(e, r) {
11
+ return [t(e, r, 1), t(e, r, n(e, r))];
12
+ }
13
+ function o(t, n = /* @__PURE__ */ new Date()) {
14
+ let o = (e) => i(r(n, e)), s = a(n.getFullYear(), n.getMonth()), c = e(n.getFullYear(), n.getMonth(), -1), l = a(c.year, c.month);
15
+ return [
16
+ {
17
+ label: t.today,
18
+ range: [o(0), o(0)]
19
+ },
20
+ {
21
+ label: t.yesterday,
22
+ range: [o(-1), o(-1)]
23
+ },
24
+ {
25
+ label: t.last7Days,
26
+ range: [o(-6), o(0)]
27
+ },
28
+ {
29
+ label: t.last30Days,
30
+ range: [o(-29), o(0)]
31
+ },
32
+ {
33
+ label: t.thisMonth,
34
+ range: s
35
+ },
36
+ {
37
+ label: t.lastMonth,
38
+ range: l
39
+ }
40
+ ];
41
+ }
42
+ //#endregion
43
+ export { o as commonRangePresets };
@@ -3,23 +3,24 @@ import e from "./DatepickerCore.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  import { useControl as n } from "react-use-control";
5
5
  //#region src/lib/components/Datepicker/Datepicker.tsx
6
- function r({ value: r, open: i, picker: a, min: o, max: s, disabledDate: c, presets: l, locale: u, weekStartsOn: d, placeholder: f, className: p, ref: m }) {
7
- let [h, g] = n(r, ""), [_, v] = n(i, !1);
6
+ function r({ value: r, open: i, picker: a, min: o, max: s, disabledDate: c, presets: l, showTime: u, locale: d, weekStartsOn: f, placeholder: p, className: m, ref: h }) {
7
+ let [g, _] = n(r, ""), [v, y] = n(i, !1);
8
8
  return /* @__PURE__ */ t(e, {
9
- ref: m,
10
- value: h,
11
- onChange: g,
12
- open: _,
13
- onOpenChange: v,
9
+ ref: h,
10
+ value: g,
11
+ onChange: _,
12
+ open: v,
13
+ onOpenChange: y,
14
14
  picker: a,
15
15
  min: o,
16
16
  max: s,
17
17
  disabledDate: c,
18
18
  presets: l,
19
- locale: u,
20
- weekStartsOn: d,
21
- placeholder: f,
22
- className: p
19
+ showTime: u,
20
+ locale: d,
21
+ weekStartsOn: f,
22
+ placeholder: p,
23
+ className: m
23
24
  });
24
25
  }
25
26
  //#endregion
@@ -2,66 +2,87 @@
2
2
  "use client";
3
3
  import { classnames as e } from "../../utils/classnames.js";
4
4
  import { mergeRefs as t } from "../../utils/refs.js";
5
- import { FloatingPanel as n, useFloating as r } from "../../utils/floating.js";
6
- import i from "../Calendar/Calendar.js";
5
+ import { useStrings as n } from "../LocaleProvider/useStrings.js";
6
+ import { FloatingPanel as r, useFloating as i } from "../../utils/floating.js";
7
+ import a from "../Calendar/Calendar.js";
8
+ import { formatDateTimeValue as o, splitDateTimeValue as s } from "./datetime.js";
7
9
  /* empty css */
8
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
9
- import { useCallback as s, useId as c, useRef as l } from "react";
10
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
+ import { useCallback as u, useId as d, useRef as f, useState as p } from "react";
10
12
  //#region src/lib/components/Datepicker/DatepickerCore.tsx
11
- var u = "haze-DatepickerCore__wrapper", d = "haze-DatepickerCore__input", f = "haze-DatepickerCore__dropdown", p = "haze-DatepickerCore__presetList", m = "haze-DatepickerCore__presetRow";
12
- function h({ value: h, onChange: g, open: _, onOpenChange: v, picker: y, min: b, max: x, disabledDate: S, presets: C, locale: w, weekStartsOn: T, placeholder: E = "Select date", className: D, ref: O }) {
13
- let k = l(null), A = s((e) => t(k, O)(e), [k, O]), j = l(null), M = c(), N = s((e) => v(typeof e == "function" ? e(_) : e), [v, _]), P = r({
14
- open: _,
15
- setOpen: N,
16
- triggerRef: k,
17
- panelRef: j,
13
+ var m = "haze-DatepickerCore__wrapper", h = "haze-DatepickerCore__input", g = "haze-DatepickerCore__dropdown", _ = "haze-DatepickerCore__presetList", v = "haze-DatepickerCore__presetRow", y = "haze-DatepickerCore__timeRow", b = "haze-DatepickerCore__timeLabel", x = "haze-DatepickerCore__timeInput";
14
+ function S({ value: S, onChange: C, open: w, onOpenChange: T, picker: E, min: D, max: O, disabledDate: k, presets: A, showTime: j, locale: M, weekStartsOn: N, placeholder: P = "Select date", className: F, ref: I }) {
15
+ let L = n("datepicker"), R = f(null), z = u((e) => t(R, I)(e), [R, I]), B = f(null), V = d(), [H, U] = p("00:00"), W = j === !0 && (E ?? "date") === "date", G = W ? s(S) : null, K = W ? G?.date ?? "" : S, q = G?.time ?? H, J = u((e) => T(typeof e == "function" ? e(w) : e), [T, w]), Y = i({
16
+ open: w,
17
+ setOpen: J,
18
+ triggerRef: R,
19
+ panelRef: B,
18
20
  animated: !0
19
21
  });
20
- return /* @__PURE__ */ o("div", {
21
- className: e([u, D]),
22
- children: [/* @__PURE__ */ a("input", {
23
- ref: A,
22
+ return /* @__PURE__ */ l("div", {
23
+ className: e([m, F]),
24
+ children: [/* @__PURE__ */ c("input", {
25
+ ref: z,
24
26
  readOnly: !0,
25
- style: P.triggerStyle,
26
- className: d,
27
- value: h,
28
- placeholder: E,
27
+ style: Y.triggerStyle,
28
+ className: h,
29
+ value: S,
30
+ placeholder: P,
29
31
  role: "combobox",
30
32
  "aria-haspopup": "dialog",
31
- "aria-expanded": _,
32
- "aria-controls": M,
33
- onPointerDown: P.onTriggerPointerDown,
34
- onClick: P.onTriggerClick
35
- }), /* @__PURE__ */ o(n, {
36
- ref: j,
37
- behavior: P,
33
+ "aria-expanded": w,
34
+ "aria-controls": V,
35
+ onPointerDown: Y.onTriggerPointerDown,
36
+ onClick: Y.onTriggerClick
37
+ }), /* @__PURE__ */ l(r, {
38
+ ref: B,
39
+ behavior: Y,
38
40
  placement: "bottom",
39
- visualClass: f,
40
- id: M,
41
- children: [C && C.length > 0 && /* @__PURE__ */ a("div", {
42
- className: e([p]),
43
- children: C.map((t) => /* @__PURE__ */ a("button", {
44
- type: "button",
45
- onClick: () => {
46
- g(t.value), v(!1);
47
- },
48
- className: e([m]),
49
- children: t.label
50
- }, `${t.label}:${t.value}`))
51
- }), /* @__PURE__ */ a(i, {
52
- picker: y,
53
- value: h,
54
- min: b,
55
- max: x,
56
- disabledDate: S,
57
- locale: w,
58
- weekStartsOn: T,
59
- onSelect: (e) => {
60
- g(e), v(!1);
61
- }
62
- })]
41
+ visualClass: g,
42
+ id: V,
43
+ children: [
44
+ A && A.length > 0 && /* @__PURE__ */ c("div", {
45
+ className: e([_]),
46
+ children: A.map((t) => /* @__PURE__ */ c("button", {
47
+ type: "button",
48
+ onClick: () => {
49
+ C(t.value), T(!1);
50
+ },
51
+ className: e([v]),
52
+ children: t.label
53
+ }, `${t.label}:${t.value}`))
54
+ }),
55
+ /* @__PURE__ */ c(a, {
56
+ picker: E,
57
+ value: K,
58
+ min: D,
59
+ max: O,
60
+ disabledDate: k,
61
+ locale: M,
62
+ weekStartsOn: N,
63
+ onSelect: (e) => {
64
+ W ? C(o(e, q)) : (C(e), T(!1));
65
+ }
66
+ }),
67
+ W && /* @__PURE__ */ l("div", {
68
+ className: e([y]),
69
+ children: [/* @__PURE__ */ c("span", {
70
+ className: e([b]),
71
+ children: L.time
72
+ }), /* @__PURE__ */ c("input", {
73
+ type: "time",
74
+ "aria-label": L.time,
75
+ value: q,
76
+ onChange: (e) => {
77
+ let t = e.target.value || "00:00";
78
+ U(t), G?.date && C(o(G.date, t));
79
+ },
80
+ className: e([x])
81
+ })]
82
+ })
83
+ ]
63
84
  })]
64
85
  });
65
86
  }
66
87
  //#endregion
67
- export { h as default };
88
+ export { S as default };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { parseCivilDate as e } from "../Calendar/date.js";
3
+ //#region src/lib/components/Datepicker/datetime.ts
4
+ var t = /^(\d{4}-\d{2}-\d{2}) (2[0-3]|[01]\d):([0-5]\d)$/;
5
+ function n(n) {
6
+ let r = t.exec(n);
7
+ if (r) {
8
+ let t = r[1];
9
+ return e(t) ? {
10
+ date: t,
11
+ time: `${r[2]}:${r[3]}`
12
+ } : null;
13
+ }
14
+ return e(n) ? {
15
+ date: n,
16
+ time: null
17
+ } : null;
18
+ }
19
+ function r(e, t) {
20
+ return `${e} ${t}`;
21
+ }
22
+ //#endregion
23
+ export { r as formatDateTimeValue, n as splitDateTimeValue };
@@ -0,0 +1,46 @@
1
+
2
+ "use client";
3
+ import { classnames as e } from "../../utils/classnames.js";
4
+ /* empty css */
5
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
6
+ //#region src/lib/components/Descriptions/Descriptions.tsx
7
+ var r = "haze-Descriptions__root", i = "haze-Descriptions__titleStyle", a = "haze-Descriptions__listDefault", o = "haze-Descriptions__listBordered", s = "haze-Descriptions__group", c = "haze-Descriptions__labelCell", l = "haze-Descriptions__valueCell", u = "haze-Descriptions__labelCellBordered", d = "haze-Descriptions__valueCellBordered", f = "haze-Descriptions__sizeSm", p = "haze-Descriptions__sizeMd";
8
+ function m({ items: m, columns: h = 3, bordered: g = !1, size: _ = "md", title: v, className: y, style: b, ...x }) {
9
+ let S = Math.max(1, Math.floor(h)), C = _ === "sm" ? f : p;
10
+ return /* @__PURE__ */ n("div", {
11
+ style: b,
12
+ ...x,
13
+ className: e([r, y]),
14
+ children: [v && /* @__PURE__ */ t("div", {
15
+ className: e([i]),
16
+ children: v
17
+ }), /* @__PURE__ */ t("dl", {
18
+ style: { gridTemplateColumns: `repeat(${S}, auto minmax(0, 1fr))` },
19
+ className: e([g ? o : a]),
20
+ children: m.map(({ key: r, label: i, children: a, span: o = 1 }) => {
21
+ let f = Math.min(Math.max(o, 1), S);
22
+ return /* @__PURE__ */ n("div", {
23
+ className: e([s]),
24
+ children: [/* @__PURE__ */ t("dt", {
25
+ className: e([
26
+ c,
27
+ C,
28
+ g && u
29
+ ]),
30
+ children: i
31
+ }), /* @__PURE__ */ t("dd", {
32
+ style: { gridColumn: `span ${f * 2 - 1}` },
33
+ className: e([
34
+ l,
35
+ C,
36
+ g && d
37
+ ]),
38
+ children: a
39
+ })]
40
+ }, r);
41
+ })
42
+ })]
43
+ });
44
+ }
45
+ //#endregion
46
+ export { m as default };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import e from "./Descriptions.js";
3
+ export { e as Descriptions };
@@ -1,12 +1,13 @@
1
1
 
2
2
  "use client";
3
3
  import { classnames as e } from "../../utils/classnames.js";
4
+ import { useStrings as t } from "../LocaleProvider/useStrings.js";
4
5
  /* empty css */
5
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
6
- import { useMemo as r } from "react";
6
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
7
+ import { useMemo as i } from "react";
7
8
  //#region src/lib/components/DiffViewer/DiffViewer.tsx
8
- var i = "haze-DiffViewer__wrapper", a = "haze-DiffViewer__header", o = "haze-DiffViewer__body", s = "haze-DiffViewer__line", c = "haze-DiffViewer__lineNum", l = "haze-DiffViewer__lineContent", u = "haze-DiffViewer__added", d = "haze-DiffViewer__removed", f = "haze-DiffViewer__addedPrefix", p = "haze-DiffViewer__removedPrefix";
9
- function m(e, t) {
9
+ var a = "haze-DiffViewer__wrapper", o = "haze-DiffViewer__header", s = "haze-DiffViewer__body", c = "haze-DiffViewer__line", l = "haze-DiffViewer__lineNum", u = "haze-DiffViewer__lineContent", d = "haze-DiffViewer__added", f = "haze-DiffViewer__removed", p = "haze-DiffViewer__addedPrefix", m = "haze-DiffViewer__removedPrefix";
10
+ function h(e, t) {
10
11
  let n = e.split("\n"), r = t.split("\n"), i = [], a = 0, o = 0;
11
12
  for (; a < n.length || o < r.length;) {
12
13
  let e = n[a], t = r[o];
@@ -35,42 +36,42 @@ function m(e, t) {
35
36
  }
36
37
  return i;
37
38
  }
38
- function h({ oldValue: s, newValue: h, className: _ }) {
39
- let v = r(() => m(s, h), [s, h]);
40
- return /* @__PURE__ */ n("div", {
41
- className: e([i, _]),
42
- children: [/* @__PURE__ */ t("div", {
43
- className: e([a]),
44
- children: "Diff"
45
- }), /* @__PURE__ */ t("div", {
39
+ function g({ oldValue: c, newValue: g, className: v }) {
40
+ let y = t("diffViewer"), b = i(() => h(c, g), [c, g]);
41
+ return /* @__PURE__ */ r("div", {
42
+ className: e([a, v]),
43
+ children: [/* @__PURE__ */ n("div", {
46
44
  className: e([o]),
47
- children: v.map((r, i) => /* @__PURE__ */ n("div", {
45
+ children: y.header
46
+ }), /* @__PURE__ */ n("div", {
47
+ className: e([s]),
48
+ children: b.map((t, i) => /* @__PURE__ */ r("div", {
48
49
  className: e([
49
- g,
50
- r.type === "added" && u,
51
- r.type === "removed" && d
50
+ _,
51
+ t.type === "added" && d,
52
+ t.type === "removed" && f
52
53
  ]),
53
54
  children: [
54
- /* @__PURE__ */ t("span", {
55
- className: e([c]),
56
- children: r.oldLine ?? ""
57
- }),
58
- /* @__PURE__ */ t("span", {
59
- className: e([c]),
60
- children: r.newLine ?? ""
55
+ /* @__PURE__ */ n("span", {
56
+ className: e([l]),
57
+ children: t.oldLine ?? ""
61
58
  }),
62
59
  /* @__PURE__ */ n("span", {
63
60
  className: e([l]),
61
+ children: t.newLine ?? ""
62
+ }),
63
+ /* @__PURE__ */ r("span", {
64
+ className: e([u]),
64
65
  children: [
65
- r.type === "added" && /* @__PURE__ */ t("span", {
66
- className: e([f]),
66
+ t.type === "added" && /* @__PURE__ */ n("span", {
67
+ className: e([p]),
67
68
  children: "+ "
68
69
  }),
69
- r.type === "removed" && /* @__PURE__ */ t("span", {
70
- className: e([p]),
70
+ t.type === "removed" && /* @__PURE__ */ n("span", {
71
+ className: e([m]),
71
72
  children: "- "
72
73
  }),
73
- r.content
74
+ t.content
74
75
  ]
75
76
  })
76
77
  ]
@@ -78,6 +79,6 @@ function h({ oldValue: s, newValue: h, className: _ }) {
78
79
  })]
79
80
  });
80
81
  }
81
- var g = s;
82
+ var _ = c;
82
83
  //#endregion
83
- export { h as default };
84
+ export { g as default };
@@ -0,0 +1,135 @@
1
+
2
+ "use client";
3
+ import { classnames as e } from "../../utils/classnames.js";
4
+ import { useStrings as t } from "../LocaleProvider/useStrings.js";
5
+ import n from "../Progress/Progress.js";
6
+ import { formatFileSize as r, getFileExtension as i } from "./file-preview-format.js";
7
+ /* empty css */
8
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
9
+ //#region src/lib/components/FilePreview/FilePreview.tsx
10
+ var s = "haze-FilePreview__card", c = "haze-FilePreview__thumbWrap", l = "haze-FilePreview__thumb", u = "haze-FilePreview__extBadge", d = "haze-FilePreview__info", f = "haze-FilePreview__nameClass", p = "haze-FilePreview__meta", m = "haze-FilePreview__statusUploading", h = "haze-FilePreview__statusError", g = "haze-FilePreview__srOnly", _ = "haze-FilePreview__actions", v = "haze-FilePreview__actionBtn", y = "haze-FilePreview__actionBtnRetry", b = "haze-FilePreview__progressRow", x = "haze-FilePreview__percentClass", S = () => /* @__PURE__ */ o("svg", {
11
+ width: "16",
12
+ height: "16",
13
+ viewBox: "0 0 16 16",
14
+ fill: "none",
15
+ stroke: "currentColor",
16
+ strokeWidth: "1.25",
17
+ strokeLinecap: "round",
18
+ strokeLinejoin: "round",
19
+ "aria-hidden": "true",
20
+ focusable: "false",
21
+ children: [/* @__PURE__ */ a("path", { d: "M9 1.5H4A1.5 1.5 0 0 0 2.5 3v10A1.5 1.5 0 0 0 4 14.5h8a1.5 1.5 0 0 0 1.5-1.5V6L9 1.5Z" }), /* @__PURE__ */ a("path", { d: "M9 1.5V6h4.5" })]
22
+ }), C = () => /* @__PURE__ */ a("svg", {
23
+ width: "12",
24
+ height: "12",
25
+ viewBox: "0 0 12 12",
26
+ fill: "none",
27
+ stroke: "currentColor",
28
+ strokeWidth: "1.5",
29
+ strokeLinecap: "round",
30
+ strokeLinejoin: "round",
31
+ "aria-hidden": "true",
32
+ focusable: "false",
33
+ children: a("path", { d: "M2 6.5 4.8 9.2 10 3.5" })
34
+ }), w = () => /* @__PURE__ */ o("svg", {
35
+ width: "12",
36
+ height: "12",
37
+ viewBox: "0 0 12 12",
38
+ fill: "none",
39
+ stroke: "currentColor",
40
+ strokeWidth: "1.5",
41
+ strokeLinecap: "round",
42
+ strokeLinejoin: "round",
43
+ "aria-hidden": "true",
44
+ focusable: "false",
45
+ children: [/* @__PURE__ */ a("path", { d: "M10.5 6a4.5 4.5 0 1 1-1.32-3.18" }), /* @__PURE__ */ a("path", { d: "M10.5 1v2.5H8" })]
46
+ }), T = () => /* @__PURE__ */ a("svg", {
47
+ width: "12",
48
+ height: "12",
49
+ viewBox: "0 0 12 12",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: "1.5",
53
+ strokeLinecap: "round",
54
+ "aria-hidden": "true",
55
+ focusable: "false",
56
+ children: a("path", { d: "M2.5 2.5l7 7M9.5 2.5l-7 7" })
57
+ });
58
+ function E({ file: E, status: D = "uploaded", progress: O, onRemove: k, onRetry: A, removeLabel: j, retryLabel: M, uploadingLabel: N, uploadedLabel: P, errorLabel: F, className: I, ...L }) {
59
+ let R = t("filePreview"), z = j ?? R.remove, B = M ?? R.retry, V = N ?? R.uploading, H = P ?? R.uploaded, U = F ?? R.error, W = (E.type?.startsWith("image/") ?? !1) && E.url !== void 0, G = W ? "" : i(E.name), K = r(E.size), q = O === void 0 ? void 0 : Math.max(0, Math.min(100, O));
60
+ return /* @__PURE__ */ o("div", {
61
+ ...L,
62
+ className: e([s, I]),
63
+ children: [
64
+ W ? /* @__PURE__ */ a("img", {
65
+ src: E.url,
66
+ alt: "",
67
+ loading: "lazy",
68
+ className: e([l])
69
+ }) : /* @__PURE__ */ o("span", {
70
+ className: e([c]),
71
+ children: [/* @__PURE__ */ a(S, {}), G && /* @__PURE__ */ a("span", {
72
+ "aria-hidden": "true",
73
+ className: e([u]),
74
+ children: G
75
+ })]
76
+ }),
77
+ /* @__PURE__ */ o("div", {
78
+ className: e([d]),
79
+ children: [/* @__PURE__ */ a("span", {
80
+ title: E.name,
81
+ className: e([f]),
82
+ children: E.name
83
+ }), /* @__PURE__ */ o("div", {
84
+ className: e([p]),
85
+ children: [
86
+ K && /* @__PURE__ */ a("span", { children: K }),
87
+ D === "uploading" && /* @__PURE__ */ a("span", {
88
+ className: e([m]),
89
+ children: V
90
+ }),
91
+ D === "uploaded" && /* @__PURE__ */ o("span", {
92
+ className: e([m]),
93
+ children: [/* @__PURE__ */ a(C, {}), /* @__PURE__ */ a("span", {
94
+ className: e([g]),
95
+ children: H
96
+ })]
97
+ }),
98
+ D === "error" && /* @__PURE__ */ a("span", {
99
+ className: e([h]),
100
+ children: U
101
+ })
102
+ ]
103
+ })]
104
+ }),
105
+ (k || D === "error" && A) && /* @__PURE__ */ o("div", {
106
+ className: e([_]),
107
+ children: [D === "error" && A && /* @__PURE__ */ a("button", {
108
+ type: "button",
109
+ "aria-label": B,
110
+ onClick: A,
111
+ className: e([v, y]),
112
+ children: /* @__PURE__ */ a(w, {})
113
+ }), k && /* @__PURE__ */ a("button", {
114
+ type: "button",
115
+ "aria-label": z,
116
+ onClick: k,
117
+ className: e([v]),
118
+ children: /* @__PURE__ */ a(T, {})
119
+ })]
120
+ }),
121
+ D === "uploading" && /* @__PURE__ */ o("div", {
122
+ className: e([b]),
123
+ children: [/* @__PURE__ */ a(n, {
124
+ value: q ?? 0,
125
+ size: "sm"
126
+ }), q !== void 0 && /* @__PURE__ */ o("span", {
127
+ className: e([x]),
128
+ children: [Math.round(q), "%"]
129
+ })]
130
+ })
131
+ ]
132
+ });
133
+ }
134
+ //#endregion
135
+ export { E as default };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ //#region src/lib/components/FilePreview/file-preview-format.ts
3
+ function e(e) {
4
+ if (e == null || !Number.isFinite(e) || e < 0) return "";
5
+ if (e < 1024) return `${e} B`;
6
+ let t = [
7
+ "KB",
8
+ "MB",
9
+ "GB",
10
+ "TB"
11
+ ], n = e, r = -1;
12
+ do
13
+ n /= 1024, r += 1;
14
+ while (n >= 1024 && r < t.length - 1);
15
+ let i = n >= 100 ? 0 : n >= 10 ? 1 : 2;
16
+ return `${n.toFixed(i)} ${t[r]}`;
17
+ }
18
+ function t(e) {
19
+ let t = e.lastIndexOf(".");
20
+ return t <= 0 || t === e.length - 1 ? "" : e.slice(t + 1).toUpperCase();
21
+ }
22
+ //#endregion
23
+ export { e as formatFileSize, t as getFileExtension };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import e from "./FilePreview.js";
3
+ export { e as FilePreview };