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
@@ -18,7 +18,7 @@ var ue = "haze-SelectFloating__wrapper", de = "haze-SelectFloating__trigger", fe
18
18
  sm: "haze-SelectFloating__sm",
19
19
  md: "haze-SelectFloating__md",
20
20
  lg: "haze-SelectFloating__lg"
21
- }, d = "haze-SelectFloating__placeholderText", pe = "haze-SelectFloating__triggerLabel", me = "haze-SelectFloating__chipItem", he = "haze-SelectFloating__chipRemove", ge = "haze-SelectFloating__overflowBadge", _e = "haze-SelectFloating__clearBtn", ve = "haze-SelectFloating__caret", ye = "haze-SelectFloating__listbox", be = "haze-SelectFloating__listboxVirtual", xe = "haze-SelectFloating__panelSearch", Se = "haze-SelectFloating__listboxInner", Ce = "haze-SelectFloating__searchInput", we = "haze-SelectFloating__loadingBlock", Te = "haze-SelectFloating__emptyBlock", f = "haze-SelectFloating__groupLabelText", Ee = "haze-SelectFloating__groupLabelRow", De = 200, Oe = 29, ke = "haze-SelectFloating__virtualRow", Ae = "haze-SelectFloating__optionRow", je = "haze-SelectFloating__optionActive", Me = "haze-SelectFloating__optionSelected", Ne = "haze-SelectFloating__checkboxVisual", Pe = "haze-SelectFloating__checkboxChecked", Fe = () => /* @__PURE__ */ o("svg", {
21
+ }, d = "haze-SelectFloating__placeholderText", pe = "haze-SelectFloating__triggerLabel", me = "haze-SelectFloating__chipItem", he = "haze-SelectFloating__chipRemove", ge = "haze-SelectFloating__overflowBadge", _e = "haze-SelectFloating__clearBtn", ve = "haze-SelectFloating__caret", ye = "haze-SelectFloating__listbox", be = "haze-SelectFloating__listboxVirtual", xe = "haze-SelectFloating__panelSearch", Se = "haze-SelectFloating__listboxInner", Ce = "haze-SelectFloating__searchInput", we = "haze-SelectFloating__loadingBlock", Te = "haze-SelectFloating__emptyBlock", Ee = "haze-SelectFloating__groupLabelText", De = "haze-SelectFloating__groupLabelRow", Oe = 200, ke = 29, Ae = "haze-SelectFloating__virtualRow", je = "haze-SelectFloating__optionRow", Me = "haze-SelectFloating__optionActive", Ne = "haze-SelectFloating__optionSelected", Pe = "haze-SelectFloating__checkboxVisual", Fe = "haze-SelectFloating__checkboxChecked", Ie = () => /* @__PURE__ */ o("svg", {
22
22
  viewBox: "0 0 12 12",
23
23
  width: "12",
24
24
  height: "12",
@@ -31,20 +31,20 @@ var ue = "haze-SelectFloating__wrapper", de = "haze-SelectFloating__trigger", fe
31
31
  focusable: "false",
32
32
  children: o("path", { d: "M2 4l4 4 4-4" })
33
33
  });
34
- function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, searchable: v = !1, clearable: y = !1, loading: b = !1, maxTagCount: x, size: Ie = "md", virtualized: S, className: Le, ref: C, ...Re }) {
35
- let w = r("select"), T = g && Array.isArray(p) ? p : [], E = !g && typeof p == "string" ? p : "", [D, O] = le(void 0, !1), [k, A] = u(-1), [j, M] = u(""), [ze, Be] = u(j), N = ce(), P = l(null), Ve = se((e) => t(P, C)(e), [P, C]), F = l(null), I = l(null), L = l(null), R = l(null), z = S !== void 0 && S !== !1, B = typeof S == "object" ? S : void 0, V = B?.itemHeight ?? Oe, He = B?.overscan, H = ee({
34
+ function f({ value: f, onChange: p, entries: m, multiple: h, placeholder: g, searchable: _ = !1, clearable: v = !1, loading: y = !1, onSearch: b, maxTagCount: x, size: Le = "md", virtualized: S, className: Re, ref: C, ...ze }) {
35
+ let w = r("select"), T = h && Array.isArray(f) ? f : [], E = !h && typeof f == "string" ? f : "", [D, O] = le(void 0, !1), [k, A] = u(-1), [j, M] = u(""), [Be, Ve] = u(j), N = ce(), P = l(null), He = se((e) => t(P, C)(e), [P, C]), F = l(null), I = l(null), L = l(null), R = l(null), z = S !== void 0 && S !== !1, B = typeof S == "object" ? S : void 0, V = B?.itemHeight ?? ke, Ue = B?.overscan, H = ee({
36
36
  open: D,
37
37
  setOpen: O,
38
38
  triggerRef: P,
39
39
  panelRef: F,
40
40
  animated: !0
41
- }), Ue = a(h), U = b ? [] : ie(h, j), W = a(U), G = U.reduce((e, t) => ({
41
+ }), We = a(m), U = y ? [] : b ? m : ie(m, j), W = a(U), G = U.reduce((e, t) => ({
42
42
  offsets: [...e.offsets, e.flat],
43
43
  flat: e.flat + (t.kind === "group" ? t.options.length : 1)
44
44
  }), {
45
45
  offsets: [],
46
46
  flat: 0
47
- }).offsets, K = (e) => `${N}-option-${e}`, We = D && W[k] ? K(k) : void 0, q = `${N}-listbox`;
47
+ }).offsets, K = (e) => `${N}-option-${e}`, Ge = D && W[k] ? K(k) : void 0, q = `${N}-listbox`;
48
48
  c(() => {
49
49
  if (!H.shown || k < 0) return;
50
50
  if (z) {
@@ -58,34 +58,42 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
58
58
  k,
59
59
  z
60
60
  ]), c(() => {
61
- v && D && H.shown && I.current?.focus();
61
+ _ && D && H.shown && I.current?.focus();
62
62
  }, [
63
- v,
63
+ _,
64
64
  D,
65
65
  H.shown
66
- ]), !D && j !== "" && M(""), j !== ze && (Be(j), A(W.length > 0 ? 0 : -1));
67
- let Ge = (e) => {
68
- m(T.includes(e) ? T.filter((t) => t !== e) : [...T, e]);
69
- }, Ke = (e) => {
70
- m(T.filter((t) => t !== e));
71
- }, J = (e) => Ue.find((t) => t.value === e)?.label ?? e, qe = () => {
72
- m(g ? [] : "");
73
- }, Y = (e) => {
74
- if (g) {
75
- Ge(e);
66
+ ]);
67
+ let Ke = l(b);
68
+ c(() => {
69
+ Ke.current = b;
70
+ }, [b]);
71
+ let J = l(j);
72
+ c(() => {
73
+ J.current !== j && (J.current = j, Ke.current?.(j));
74
+ }, [j]), !D && j !== "" && M(""), j !== Be && (Ve(j), A(W.length > 0 ? 0 : -1));
75
+ let qe = (e) => {
76
+ p(T.includes(e) ? T.filter((t) => t !== e) : [...T, e]);
77
+ }, Je = (e) => {
78
+ p(T.filter((t) => t !== e));
79
+ }, Y = (e) => We.find((t) => t.value === e)?.label ?? e, Ye = () => {
80
+ p(h ? [] : "");
81
+ }, X = (e) => {
82
+ if (h) {
83
+ qe(e);
76
84
  return;
77
85
  }
78
- m(e), O(!1), P.current?.focus();
79
- }, X = (e) => {
86
+ p(e), O(!1), P.current?.focus();
87
+ }, Xe = (e) => {
80
88
  A((t) => e === 1 ? Math.min(t + 1, W.length - 1) : Math.max(t - 1, 0));
81
- }, Je = (e) => {
89
+ }, Ze = (e) => {
82
90
  A(W.length === 0 ? -1 : e === "Home" ? 0 : W.length - 1);
83
- }, Ye = (e) => {
84
- e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), O(!0), X(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), O(!0), Je(e.key)) : (e.key === "Enter" || e.key === " " || e.key === "Space") && D && W[k] ? (e.preventDefault(), Y(W[k].value)) : e.key === "Escape" ? O(!1) : e.key === "Backspace" && (g && T.length > 0 ? (e.preventDefault(), m(T.slice(0, -1))) : !g && y && E !== "" && (e.preventDefault(), qe()));
85
- }, Xe = (e) => {
86
- e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), X(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), Je(e.key)) : e.key === "Enter" ? (e.preventDefault(), W[k] && Y(W[k].value)) : e.key === "Escape" && (e.preventDefault(), O(!1), P.current?.focus());
91
+ }, Qe = (e) => {
92
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), O(!0), Xe(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), O(!0), Ze(e.key)) : (e.key === "Enter" || e.key === " " || e.key === "Space") && D && W[k] ? (e.preventDefault(), X(W[k].value)) : e.key === "Escape" ? O(!1) : e.key === "Backspace" && (h && T.length > 0 ? (e.preventDefault(), p(T.slice(0, -1))) : !h && v && E !== "" && (e.preventDefault(), Ye()));
93
+ }, $e = (e) => {
94
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), Xe(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), Ze(e.key)) : e.key === "Enter" ? (e.preventDefault(), W[k] && X(W[k].value)) : e.key === "Escape" && (e.preventDefault(), O(!1), P.current?.focus());
87
95
  }, Z = (t, n) => {
88
- let r = g ? T.includes(t.value) : t.value === E;
96
+ let r = h ? T.includes(t.value) : t.value === E;
89
97
  return /* @__PURE__ */ s("div", {
90
98
  ref: n === k ? L : void 0,
91
99
  role: "option",
@@ -93,53 +101,53 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
93
101
  "aria-selected": r,
94
102
  "aria-setsize": W.length,
95
103
  "aria-posinset": n + 1,
96
- onClick: () => Y(t.value),
104
+ onClick: () => X(t.value),
97
105
  className: e([
98
- Ae,
99
- n === k && je,
100
- !g && r && Me,
101
- z && ke
106
+ je,
107
+ n === k && Me,
108
+ !h && r && Ne,
109
+ z && Ae
102
110
  ]),
103
- children: [g && /* @__PURE__ */ o("span", {
111
+ children: [h && /* @__PURE__ */ o("span", {
104
112
  "aria-hidden": "true",
105
- className: e([Ne, r && Pe])
113
+ className: e([Pe, r && Fe])
106
114
  }), t.label]
107
115
  }, t.value);
108
- }, Ze = y && (g ? T.length > 0 : E !== "") ? /* @__PURE__ */ o("span", {
116
+ }, et = v && (h ? T.length > 0 : E !== "") ? /* @__PURE__ */ o("span", {
109
117
  "aria-hidden": "true",
110
118
  title: w.clear,
111
119
  onClick: (e) => {
112
- e.stopPropagation(), qe(), P.current?.focus();
120
+ e.stopPropagation(), Ye(), P.current?.focus();
113
121
  },
114
122
  className: e(_e),
115
123
  children: "×"
116
- }) : void 0, Qe = g ? T.length === 0 ? /* @__PURE__ */ o("span", {
124
+ }) : void 0, tt = h ? T.length === 0 ? /* @__PURE__ */ o("span", {
117
125
  className: e(d),
118
- children: _ ?? w.placeholder
126
+ children: g ?? w.placeholder
119
127
  }) : /* @__PURE__ */ s(oe, { children: [(x === void 0 ? T : T.slice(0, Math.max(x, 0))).map((t) => /* @__PURE__ */ s("span", {
120
128
  className: e(me),
121
129
  children: [/* @__PURE__ */ o(te, {
122
130
  color: "primary",
123
- children: J(t)
131
+ children: Y(t)
124
132
  }), /* @__PURE__ */ o("span", {
125
133
  "aria-hidden": "true",
126
134
  onClick: (e) => {
127
- e.stopPropagation(), Ke(t);
135
+ e.stopPropagation(), Je(t);
128
136
  },
129
137
  className: e(he),
130
138
  children: "×"
131
139
  })]
132
140
  }, t)), x !== void 0 && T.length > Math.max(x, 0) && /* @__PURE__ */ o("span", {
133
- title: T.slice(Math.max(x, 0)).map((e) => ae(J(e))).join(", "),
141
+ title: T.slice(Math.max(x, 0)).map((e) => ae(Y(e))).join(", "),
134
142
  className: e(ge),
135
143
  children: n(w.moreTags, { count: T.length - Math.max(x, 0) })
136
144
  })] }) : E === "" ? /* @__PURE__ */ o("span", {
137
145
  className: e(d),
138
- children: _ ?? w.placeholder
146
+ children: g ?? w.placeholder
139
147
  }) : /* @__PURE__ */ o("span", {
140
148
  className: e(pe),
141
- children: J(E)
142
- }), Q = !b && W.length > 0, $e = z ? /* @__PURE__ */ o(re, {
149
+ children: Y(E)
150
+ }), Q = !y && W.length > 0, nt = z ? /* @__PURE__ */ o(re, {
143
151
  ref: R,
144
152
  "data-virtualized": !0,
145
153
  items: W,
@@ -147,13 +155,13 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
147
155
  startIndex: G[n] ?? 0,
148
156
  key: `group-${t.label}-${G[n] ?? 0}`,
149
157
  render: () => /* @__PURE__ */ o("div", {
150
- className: e(f),
158
+ className: e(Ee),
151
159
  children: t.label
152
160
  })
153
161
  }] : []) : void 0,
154
- height: Math.min(De, W.length * V),
162
+ height: Math.min(Oe, W.length * V),
155
163
  itemHeight: V,
156
- overscan: He,
164
+ overscan: Ue,
157
165
  renderItem: Z
158
166
  }) : U.map((t, n) => {
159
167
  let r = G[n] ?? 0;
@@ -161,11 +169,11 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
161
169
  role: "group",
162
170
  "aria-label": t.label,
163
171
  children: [/* @__PURE__ */ o("div", {
164
- className: e([Ee, f]),
172
+ className: e([De, Ee]),
165
173
  children: t.label
166
174
  }), t.options.map((e, t) => Z(e, r + t))]
167
175
  }, `group-${t.label}`);
168
- }), $ = b ? /* @__PURE__ */ s("div", {
176
+ }), $ = y ? /* @__PURE__ */ s("div", {
169
177
  className: e(we),
170
178
  children: [/* @__PURE__ */ o(ne, { size: "sm" }), /* @__PURE__ */ o("span", { children: w.loading })]
171
179
  }) : /* @__PURE__ */ o("div", {
@@ -175,38 +183,38 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
175
183
  return /* @__PURE__ */ s("div", {
176
184
  className: e(ue),
177
185
  children: [/* @__PURE__ */ s("button", {
178
- ...Re,
179
- ref: Ve,
186
+ ...ze,
187
+ ref: He,
180
188
  type: "button",
181
189
  style: H.triggerStyle,
182
190
  role: "combobox",
183
191
  "aria-haspopup": "listbox",
184
192
  "aria-expanded": D,
185
- "aria-controls": v ? q : N,
186
- "aria-activedescendant": We,
187
- "data-clearable": y || void 0,
193
+ "aria-controls": _ ? q : N,
194
+ "aria-activedescendant": Ge,
195
+ "data-clearable": v || void 0,
188
196
  onPointerDown: H.onTriggerPointerDown,
189
197
  onClick: H.onTriggerClick,
190
- onKeyDown: Ye,
198
+ onKeyDown: Qe,
191
199
  className: e([
192
200
  de,
193
- fe[Ie],
194
- Le
201
+ fe[Le],
202
+ Re
195
203
  ]),
196
204
  children: [
197
- Qe,
198
- Ze,
205
+ tt,
206
+ et,
199
207
  /* @__PURE__ */ o("span", {
200
208
  "aria-hidden": "true",
201
209
  className: e(ve),
202
- children: /* @__PURE__ */ o(Fe, {})
210
+ children: /* @__PURE__ */ o(Ie, {})
203
211
  })
204
212
  ]
205
- }), v ? /* @__PURE__ */ s(i, {
213
+ }), _ ? /* @__PURE__ */ s(i, {
206
214
  ref: F,
207
215
  behavior: H,
208
216
  placement: "bottom-span",
209
- "aria-busy": b || void 0,
217
+ "aria-busy": y || void 0,
210
218
  visualClass: xe,
211
219
  children: [/* @__PURE__ */ o("input", {
212
220
  ref: I,
@@ -217,18 +225,18 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
217
225
  "aria-controls": q,
218
226
  "aria-autocomplete": "list"
219
227
  },
220
- "aria-activedescendant": We,
228
+ "aria-activedescendant": Ge,
221
229
  value: j,
222
230
  onChange: (e) => M(e.target.value),
223
- onKeyDown: Xe,
231
+ onKeyDown: $e,
224
232
  className: e(Ce)
225
233
  }), Q ? /* @__PURE__ */ o("div", {
226
234
  id: q,
227
235
  role: "listbox",
228
- "aria-multiselectable": g || void 0,
236
+ "aria-multiselectable": h || void 0,
229
237
  "aria-label": w.listboxLabel,
230
238
  className: e(z ? void 0 : Se),
231
- children: $e
239
+ children: nt
232
240
  }) : $]
233
241
  }) : /* @__PURE__ */ o(i, {
234
242
  ref: F,
@@ -236,13 +244,13 @@ function p({ value: p, onChange: m, entries: h, multiple: g, placeholder: _, sea
236
244
  placement: "bottom-span",
237
245
  id: N,
238
246
  role: Q ? "listbox" : void 0,
239
- "aria-multiselectable": Q && g ? "true" : void 0,
247
+ "aria-multiselectable": Q && h ? "true" : void 0,
240
248
  "aria-label": w.listboxLabel,
241
- "aria-busy": b || void 0,
249
+ "aria-busy": y || void 0,
242
250
  visualClass: z ? be : ye,
243
- children: Q ? $e : $
251
+ children: Q ? nt : $
244
252
  })]
245
253
  });
246
254
  }
247
255
  //#endregion
248
- export { p as default };
256
+ export { f as default };
@@ -0,0 +1,165 @@
1
+
2
+ "use client";
3
+ import { classnames as e } from "../../utils/classnames.js";
4
+ import { useStrings as t } from "../LocaleProvider/useStrings.js";
5
+ import { getCanvasPoint as n, normalizeStroke as r, pointDistance as i, serializeStrokes as a } from "./signature-points.js";
6
+ /* empty css */
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
9
+ import { useControl as f } from "react-use-control";
10
+ //#region src/lib/components/Signature/Signature.tsx
11
+ var p = "#1f2937", ee = 1.5, m = "haze-Signature__root", h = "haze-Signature__canvasFrame", g = "haze-Signature__canvasClass", _ = "haze-Signature__toolbar", v = "haze-Signature__toolButton", y = "haze-Signature__unsupportedNotice";
12
+ function b({ value: b, onChange: x, clearLabel: S, undoLabel: C, unsupportedLabel: w, width: T = 320, height: E = 160, disabled: D = !1, penColor: O, penWidth: k = 2, className: A, ...j }) {
13
+ let M = t("signature"), N = S ?? M.clear, P = C ?? M.undo, F = w ?? M.unsupported, [, I] = f(b, ""), [L, R] = d(0), [z, B] = d(!1), V = u(null), H = u(null), U = u([]), W = u(null), G = u(p), K = u(""), q = c(() => {
14
+ if (O) return O;
15
+ let e = V.current;
16
+ return (e ? getComputedStyle(e).getPropertyValue("--haze-color-text").trim() : "") || p;
17
+ }, [O]), J = c((e, t) => {
18
+ let n = H.current;
19
+ n && (n.strokeStyle = G.current, n.lineWidth = k, n.lineCap = "round", n.lineJoin = "round", n.beginPath(), n.moveTo(e.x, e.y), n.lineTo(t.x, t.y), n.stroke());
20
+ }, [k]), Y = c((e) => {
21
+ let t = H.current;
22
+ t && (t.fillStyle = G.current, t.beginPath(), t.arc(e.x, e.y, k / 2, 0, Math.PI * 2), t.fill());
23
+ }, [k]), X = c(() => {
24
+ let e = H.current, t = V.current;
25
+ if (e && t) {
26
+ e.clearRect(0, 0, T, E), G.current = q();
27
+ for (let e of U.current) if (e.length !== 0) {
28
+ Y(e[0]);
29
+ for (let t = 1; t < e.length; t += 1) J(e[t - 1], e[t]);
30
+ }
31
+ }
32
+ }, [
33
+ T,
34
+ E,
35
+ q,
36
+ Y,
37
+ J
38
+ ]);
39
+ l(() => {
40
+ let e = V.current;
41
+ if (!e) return;
42
+ let t = typeof window > "u" ? 1 : window.devicePixelRatio || 1;
43
+ e.width = Math.max(1, Math.round(T * t)), e.height = Math.max(1, Math.round(E * t));
44
+ let n = e.getContext("2d");
45
+ H.current = n, B(!n), n && (n.scale(t, t), X());
46
+ }, [
47
+ T,
48
+ E,
49
+ X
50
+ ]);
51
+ let Z = c(() => {
52
+ let e = V.current;
53
+ if (!e || !H.current) return;
54
+ let t = a(U.current);
55
+ if (t === K.current) return;
56
+ K.current = t;
57
+ let n = U.current.length > 0 ? e.toDataURL("image/png") : "";
58
+ I(n), x?.(n);
59
+ }, [I, x]), Q = (e) => {
60
+ if (D || !H.current) return;
61
+ e.preventDefault();
62
+ let t = V.current;
63
+ if (!t || W.current !== null) return;
64
+ if (W.current = e.pointerId, typeof t.setPointerCapture == "function") try {
65
+ t.setPointerCapture(e.pointerId);
66
+ } catch {}
67
+ G.current = q();
68
+ let r = n(e.clientX, e.clientY, t.getBoundingClientRect());
69
+ U.current = [...U.current, [r]], R(U.current.length), Y(r);
70
+ }, te = (e) => {
71
+ if (W.current !== e.pointerId) return;
72
+ let t = V.current;
73
+ if (!t) return;
74
+ let r = U.current, a = r[r.length - 1];
75
+ if (!a) return;
76
+ let o = n(e.clientX, e.clientY, t.getBoundingClientRect()), s = a[a.length - 1];
77
+ if (!s || i(s, o) < .5) return;
78
+ let c = [...a, o];
79
+ U.current = [...r.slice(0, -1), c], J(s, o);
80
+ }, $ = () => {
81
+ if (W.current === null) return;
82
+ W.current = null;
83
+ let e = U.current, t = e[e.length - 1];
84
+ t && (U.current = [...e.slice(0, -1), r(t, ee)]), Z();
85
+ }, ne = () => {
86
+ D || U.current.length === 0 || (U.current = U.current.slice(0, -1), R(U.current.length), X(), Z());
87
+ }, re = () => {
88
+ D || U.current.length !== 0 && (U.current = [], R(0), X(), Z());
89
+ };
90
+ return z ? /* @__PURE__ */ o("div", {
91
+ ...j,
92
+ className: e([m, A]),
93
+ children: o("div", {
94
+ style: {
95
+ width: `${T}px`,
96
+ height: `${E}px`
97
+ },
98
+ role: "status",
99
+ className: e([y]),
100
+ children: F
101
+ })
102
+ }) : /* @__PURE__ */ s("div", {
103
+ ...j,
104
+ className: e([m, A]),
105
+ children: [/* @__PURE__ */ o("div", {
106
+ className: e([h]),
107
+ children: /* @__PURE__ */ o("canvas", {
108
+ ref: V,
109
+ style: {
110
+ width: `${T}px`,
111
+ height: `${E}px`
112
+ },
113
+ "data-disabled": D,
114
+ onPointerDown: Q,
115
+ onPointerMove: te,
116
+ onPointerUp: $,
117
+ onPointerCancel: $,
118
+ className: e([g])
119
+ })
120
+ }), /* @__PURE__ */ s("div", {
121
+ className: e([_]),
122
+ children: [/* @__PURE__ */ s("button", {
123
+ type: "button",
124
+ onClick: ne,
125
+ disabled: D || L === 0,
126
+ className: e([v]),
127
+ children: [/* @__PURE__ */ s("svg", {
128
+ width: "14",
129
+ height: "14",
130
+ viewBox: "0 0 24 24",
131
+ fill: "none",
132
+ stroke: "currentColor",
133
+ strokeWidth: "2",
134
+ strokeLinecap: "round",
135
+ strokeLinejoin: "round",
136
+ "aria-hidden": "true",
137
+ children: [/* @__PURE__ */ o("path", { d: "M9 14 4 9l5-5" }), /* @__PURE__ */ o("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 0 11H11" })]
138
+ }), P]
139
+ }), /* @__PURE__ */ s("button", {
140
+ type: "button",
141
+ onClick: re,
142
+ disabled: D || L === 0,
143
+ className: e([v]),
144
+ children: [/* @__PURE__ */ s("svg", {
145
+ width: "14",
146
+ height: "14",
147
+ viewBox: "0 0 24 24",
148
+ fill: "none",
149
+ stroke: "currentColor",
150
+ strokeWidth: "2",
151
+ strokeLinecap: "round",
152
+ strokeLinejoin: "round",
153
+ "aria-hidden": "true",
154
+ children: [
155
+ /* @__PURE__ */ o("path", { d: "M3 6h18" }),
156
+ /* @__PURE__ */ o("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
157
+ /* @__PURE__ */ o("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
158
+ ]
159
+ }), N]
160
+ })]
161
+ })]
162
+ });
163
+ }
164
+ //#endregion
165
+ export { b as default };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import e from "./Signature.js";
3
+ export { e as Signature };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ //#region src/lib/components/Signature/signature-points.ts
3
+ function e(e, t) {
4
+ return Math.hypot(t.x - e.x, t.y - e.y);
5
+ }
6
+ function t(e, t, n) {
7
+ return {
8
+ x: e - n.left,
9
+ y: t - n.top
10
+ };
11
+ }
12
+ function n(t, n) {
13
+ let r = [];
14
+ return t.forEach((i, a) => {
15
+ let o = a === t.length - 1;
16
+ if (r.length === 0) {
17
+ r.push(i);
18
+ return;
19
+ }
20
+ let s = r[r.length - 1];
21
+ s && (o || e(s, i) >= n) && r.push(i);
22
+ }), r;
23
+ }
24
+ function r(e) {
25
+ return e.map((e) => e.map((e) => `${Math.round(e.x)},${Math.round(e.y)}`).join(" ")).join("|");
26
+ }
27
+ //#endregion
28
+ export { t as getCanvasPoint, n as normalizeStroke, e as pointDistance, r as serializeStrokes };
@@ -0,0 +1,109 @@
1
+
2
+ "use client";
3
+ import { classnames as e } from "../../utils/classnames.js";
4
+ import { useStrings as t } from "../LocaleProvider/useStrings.js";
5
+ /* empty css */
6
+ import { Fragment as n, 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";
9
+ //#region src/lib/components/Sources/Sources.tsx
10
+ var s = "haze-Sources__list", c = "haze-Sources__item", l = "haze-Sources__badge", u = "haze-Sources__link", d = "haze-Sources__title", f = "haze-Sources__toggleBtn", p = "haze-Sources__snippetBase", m = "haze-Sources__snippetHidden", h = "haze-Sources__snippetShown", g = "haze-Sources__compactNav", _ = "haze-Sources__compactBadge", v = () => /* @__PURE__ */ r("svg", {
11
+ width: "10",
12
+ height: "10",
13
+ viewBox: "0 0 10 10",
14
+ fill: "none",
15
+ stroke: "currentColor",
16
+ strokeWidth: "1.5",
17
+ strokeLinecap: "round",
18
+ strokeLinejoin: "round",
19
+ "aria-hidden": "true",
20
+ focusable: "false",
21
+ style: { transition: "transform var(--haze-duration-fast) var(--haze-ease)" },
22
+ children: r("path", { d: "M3 1.5 6.5 5 3 8.5" })
23
+ });
24
+ function y(e, t) {
25
+ return typeof e == "string" ? `${t}. ${e}` : `[${t}]`;
26
+ }
27
+ function b({ items: b, compact: x = !1, expanded: S, label: C, expandLabel: w, collapseLabel: T, className: E, ...D }) {
28
+ let O = t("sources"), k = C ?? O.label, A = w ?? O.expand, j = T ?? O.collapse, M = a(), [N, P] = o(S, []);
29
+ if (x) return /* @__PURE__ */ r("nav", {
30
+ "aria-label": k,
31
+ ...D,
32
+ className: e([g, E]),
33
+ children: b.map((t, n) => {
34
+ let r = n + 1, a = y(t.title, r);
35
+ return t.url ? /* @__PURE__ */ i("a", {
36
+ href: t.url,
37
+ target: "_blank",
38
+ rel: "noopener noreferrer",
39
+ "aria-label": a,
40
+ className: e([_]),
41
+ children: [
42
+ "[",
43
+ r,
44
+ "]"
45
+ ]
46
+ }, t.id) : /* @__PURE__ */ i("span", {
47
+ "aria-label": a,
48
+ className: e([_]),
49
+ children: [
50
+ "[",
51
+ r,
52
+ "]"
53
+ ]
54
+ }, t.id);
55
+ })
56
+ });
57
+ let F = (e) => N.includes(e), I = (e) => {
58
+ P((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
59
+ };
60
+ return /* @__PURE__ */ r("ol", {
61
+ "aria-label": k,
62
+ ...D,
63
+ className: e([s, E]),
64
+ children: b.map((t, a) => {
65
+ let o = a + 1, s = `${M}-snippet-${t.id}`, g = F(t.id);
66
+ return /* @__PURE__ */ i("li", {
67
+ "data-haze-sources-item": "",
68
+ "data-state": g ? "expanded" : "collapsed",
69
+ className: e([c]),
70
+ children: [
71
+ /* @__PURE__ */ i("span", {
72
+ "aria-hidden": "true",
73
+ className: e([l]),
74
+ children: [
75
+ "[",
76
+ o,
77
+ "]"
78
+ ]
79
+ }),
80
+ t.url ? /* @__PURE__ */ r("a", {
81
+ href: t.url,
82
+ target: "_blank",
83
+ rel: "noopener noreferrer",
84
+ className: e([u]),
85
+ children: t.title
86
+ }) : /* @__PURE__ */ r("span", {
87
+ className: e([d]),
88
+ children: t.title
89
+ }),
90
+ t.snippet != null && /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("button", {
91
+ type: "button",
92
+ "aria-expanded": g,
93
+ "aria-controls": s,
94
+ "aria-label": g ? j : A,
95
+ onClick: () => I(t.id),
96
+ className: e([f]),
97
+ children: /* @__PURE__ */ r(v, {})
98
+ }), /* @__PURE__ */ r("div", {
99
+ id: s,
100
+ className: e([p, g ? h : m]),
101
+ children: t.snippet
102
+ })] })
103
+ ]
104
+ }, t.id);
105
+ })
106
+ });
107
+ }
108
+ //#endregion
109
+ export { b as default };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import e from "./Sources.js";
3
+ export { e as Sources };
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { classnames as e } from "../../utils/classnames.js";
3
+ import { SortableItem as t, SortableRegion as n } from "../../utils/sortable.js";
4
+ import { group as r } from "./tag-group-styles.js";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { Children as a } from "react";
7
+ import { arrayMove as o, rectSortingStrategy as s } from "@dnd-kit/sortable";
8
+ //#region src/lib/components/TagGroup/SortableTagGroup.tsx
9
+ function c({ children: c, className: l, onReorder: u }) {
10
+ let d = a.toArray(c), f = d.map((e, t) => t);
11
+ return /* @__PURE__ */ i("div", {
12
+ role: "group",
13
+ className: e([r, l]),
14
+ children: /* @__PURE__ */ i(n, {
15
+ ids: f,
16
+ strategy: s,
17
+ onMove: (e, t) => u?.(o(f, e, t)),
18
+ children: d.map((e, n) => /* @__PURE__ */ i(t, {
19
+ id: n,
20
+ children: e
21
+ }, n))
22
+ })
23
+ });
24
+ }
25
+ //#endregion
26
+ export { c as default };
@@ -1,28 +1,14 @@
1
-
2
1
  "use client";
3
2
  import { classnames as e } from "../../utils/classnames.js";
4
- import { SortableItem as t, SortableRegion as n } from "../../utils/sortable.js";
5
- /* empty css */
6
- import { jsx as r } from "react/jsx-runtime";
7
- import { Children as i } from "react";
8
- import { arrayMove as a, rectSortingStrategy as o } from "@dnd-kit/sortable";
3
+ import { group as t } from "./tag-group-styles.js";
4
+ import { jsx as n } from "react/jsx-runtime";
9
5
  //#region src/lib/components/TagGroup/TagGroup.tsx
10
- var s = "haze-TagGroup__group";
11
- function c({ children: c, className: l, sortable: u = !1, onReorder: d }) {
12
- let f = i.toArray(c), p = f.map((e, t) => t);
13
- return /* @__PURE__ */ r("div", {
6
+ function r({ children: r, className: i }) {
7
+ return /* @__PURE__ */ n("div", {
14
8
  role: "group",
15
- className: e([s, l]),
16
- children: u ? /* @__PURE__ */ r(n, {
17
- ids: p,
18
- strategy: o,
19
- onMove: (e, t) => d?.(a(p, e, t)),
20
- children: f.map((e, n) => /* @__PURE__ */ r(t, {
21
- id: n,
22
- children: e
23
- }, n))
24
- }) : c
9
+ className: e([t, i]),
10
+ children: r
25
11
  });
26
12
  }
27
13
  //#endregion
28
- export { c as default };
14
+ export { r as default };