haze-ui 1.30.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -1
- package/dist/components/ActivityRail/ActivityRail.js +76 -0
- package/dist/components/ActivityRail/index.js +3 -0
- package/dist/components/BottomSheet/BottomSheet.js +12 -26
- package/dist/components/ConversationList/ConversationList.js +16 -7
- package/dist/components/List/List.js +14 -10
- package/dist/components/LocaleProvider/ar-sa.js +7 -0
- package/dist/components/LocaleProvider/de-de.js +7 -0
- package/dist/components/LocaleProvider/es-es.js +7 -0
- package/dist/components/LocaleProvider/fr-fr.js +7 -0
- package/dist/components/LocaleProvider/it-it.js +7 -0
- package/dist/components/LocaleProvider/ja-jp.js +7 -0
- package/dist/components/LocaleProvider/ko-kr.js +7 -0
- package/dist/components/LocaleProvider/locale.js +7 -0
- package/dist/components/LocaleProvider/pt-br.js +7 -0
- package/dist/components/LocaleProvider/ru-ru.js +7 -0
- package/dist/components/LocaleProvider/zh-cn.js +7 -0
- package/dist/components/LogViewer/LogViewer.js +45 -38
- package/dist/components/OTPInput/OTPInputCore.js +1 -0
- package/dist/components/Resizable/Resizable.js +266 -36
- package/dist/components/Sparkline/Sparkline.js +45 -0
- package/dist/components/Sparkline/index.js +3 -0
- package/dist/components/Sparkline/sparkline-styles.js +18 -0
- package/dist/components/StatusBar/StatusBar.js +47 -0
- package/dist/components/StatusBar/index.js +3 -0
- package/dist/components/TabBar/TabBar.js +60 -0
- package/dist/components/TabBar/index.js +3 -0
- package/dist/components/Tabs/SortableTabList.js +116 -0
- package/dist/components/Tabs/Tab.js +83 -16
- package/dist/components/Tabs/TabList.js +94 -38
- package/dist/components/Tabs/edge-scroll.js +6 -0
- package/dist/components/Tabs/index.js +4 -3
- package/dist/components/Tabs/tab-metas.js +24 -0
- package/dist/components/TagInput/SortableTagInputCore.js +11 -11
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toast/{toast2.js → toast-channel.js} +1 -1
- package/dist/components/Toast/useToast.js +1 -1
- package/dist/components/Tree/SortableTree.js +39 -39
- package/dist/components/VirtualList/VirtualList.js +133 -121
- package/dist/components/Workbench/Workbench.js +144 -0
- package/dist/components/Workbench/index.js +3 -0
- package/dist/css/activity-rail.css +2 -0
- package/dist/css/app-shell.css +1 -1
- package/dist/css/breadcrumb.css +1 -1
- package/dist/css/checkbox.css +1 -1
- package/dist/css/command.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/date-range-picker.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +2 -2
- package/dist/css/hover-card.css +1 -1
- package/dist/css/list.css +1 -1
- package/dist/css/menu.css +2 -2
- package/dist/css/popover.css +1 -1
- package/dist/css/radio.css +1 -1
- package/dist/css/resizable.css +1 -1
- package/dist/css/segmented.css +1 -1
- package/dist/css/sidebar.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/sparkline.css +2 -0
- package/dist/css/status-bar.css +2 -0
- package/dist/css/switch.css +1 -1
- package/dist/css/tab-bar.css +2 -0
- package/dist/css/tabs.css +3 -2
- package/dist/css/tag.css +1 -1
- package/dist/css/tree.css +1 -1
- package/dist/css/workbench.css +2 -0
- package/dist/css-manifest.json +16 -0
- package/dist/dates/adapter.js +9 -1
- package/dist/dates/buddhist.js +43 -0
- package/dist/dates/ethiopic.js +67 -0
- package/dist/dates/hebrew.js +95 -0
- package/dist/dates/japanese.js +41 -0
- package/dist/dates/persian.js +121 -0
- package/dist/dates/registry.js +14 -4
- package/dist/haze-ui.css +30 -24
- package/dist/index.js +253 -241
- package/dist/mcp-docs.json +555 -10
- package/dist/registry.json +115 -5
- package/dist/types/components/ActivityRail/ActivityRail.d.ts +30 -0
- package/dist/types/components/ActivityRail/index.d.ts +4 -0
- package/dist/types/components/ConversationList/ConversationList.d.ts +10 -1
- package/dist/types/components/List/List.d.ts +10 -1
- package/dist/types/components/LocaleProvider/locale.d.ts +7 -0
- package/dist/types/components/LogViewer/LogViewer.d.ts +10 -1
- package/dist/types/components/Resizable/Resizable.d.ts +24 -7
- package/dist/types/components/Resizable/index.d.ts +1 -1
- package/dist/types/components/Sparkline/Sparkline.d.ts +31 -0
- package/dist/types/components/Sparkline/index.d.ts +3 -0
- package/dist/types/components/Sparkline/sparkline-styles.d.ts +26 -0
- package/dist/types/components/StatusBar/StatusBar.d.ts +18 -0
- package/dist/types/components/StatusBar/index.d.ts +3 -0
- package/dist/types/components/TabBar/TabBar.d.ts +23 -0
- package/dist/types/components/TabBar/index.d.ts +4 -0
- package/dist/types/components/Tabs/SortableTabList.d.ts +46 -0
- package/dist/types/components/Tabs/Tab.d.ts +54 -3
- package/dist/types/components/Tabs/TabList.d.ts +26 -2
- package/dist/types/components/Tabs/edge-scroll.d.ts +17 -0
- package/dist/types/components/Tabs/index.d.ts +3 -1
- package/dist/types/components/Tabs/tab-metas.d.ts +20 -0
- package/dist/types/components/Toast/index.d.ts +2 -2
- package/dist/types/components/Toast/useToast.d.ts +1 -1
- package/dist/types/components/VirtualList/VirtualList.d.ts +20 -1
- package/dist/types/components/Workbench/Workbench.d.ts +50 -0
- package/dist/types/components/Workbench/index.d.ts +2 -0
- package/dist/types/dates/adapter.d.ts +33 -6
- package/dist/types/dates/buddhist.d.ts +14 -0
- package/dist/types/dates/ethiopic.d.ts +15 -0
- package/dist/types/dates/hebrew.d.ts +19 -0
- package/dist/types/dates/index.d.ts +5 -0
- package/dist/types/dates/japanese.d.ts +16 -0
- package/dist/types/dates/persian.d.ts +18 -0
- package/dist/types/dates/registry.d.ts +1 -1
- package/dist/types/index.d.ts +13 -3
- package/dist/types/utils/sortable.d.ts +8 -1
- package/dist/types/utils/use-end-reached.d.ts +56 -0
- package/dist/types/utils/viewport.d.ts +12 -0
- package/dist/utils/sortable-shared.js +3 -3
- package/dist/utils/sortable.js +15 -14
- package/dist/utils/use-end-reached.js +46 -0
- package/dist/utils/viewport.js +20 -0
- package/package.json +12 -4
- /package/dist/types/components/Toast/{toast.d.ts → toast-channel.d.ts} +0 -0
|
@@ -1,61 +1,291 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { classnames as e } from "../../utils/classnames.js";
|
|
4
|
+
import { getDirection as t } from "../../utils/direction.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { jsx as
|
|
6
|
+
import { createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
8
|
+
import { isControl as u, useControl as d, useThru as f, watch as p } from "react-use-control";
|
|
7
9
|
//#region src/lib/components/Resizable/Resizable.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let e =
|
|
10
|
+
var m = n(void 0);
|
|
11
|
+
function h() {
|
|
12
|
+
let e = i(m);
|
|
11
13
|
if (!e) throw Error("Resizable sub-components must be used within <ResizableGroup>");
|
|
12
14
|
return e;
|
|
13
15
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
var g = 16, _ = 2 ** 53 - 1, v = () => void 0, y = /* @__PURE__ */ new Set();
|
|
17
|
+
function b(e, t, n) {
|
|
18
|
+
let r = Math.max(e, t);
|
|
19
|
+
return n === void 0 ? r : Math.min(r, n);
|
|
20
|
+
}
|
|
21
|
+
function x(e, t) {
|
|
22
|
+
let n = e[t];
|
|
23
|
+
for (; n !== null;) {
|
|
24
|
+
if (n instanceof HTMLElement && n.dataset.slot === "resizable-panel") return n;
|
|
25
|
+
if (n instanceof HTMLElement && n.dataset.slot === "resizable-group") return;
|
|
26
|
+
n = n[t];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function S(e) {
|
|
30
|
+
if (e?.dataset.slot !== "resizable-panel") return;
|
|
31
|
+
if (e.dataset.collapsed !== void 0) return 0;
|
|
32
|
+
if (e.style.flexGrow === "1") return;
|
|
33
|
+
let t = Number.parseFloat(e.style.flexBasis);
|
|
34
|
+
return Number.isFinite(t) ? t : void 0;
|
|
35
|
+
}
|
|
36
|
+
var C = "haze-Resizable__groupBase", w = "haze-Resizable__groupHorizontal", T = "haze-Resizable__groupVertical";
|
|
37
|
+
function E({ direction: t = "horizontal", children: n, className: i, style: a, onResizeCommit: u }) {
|
|
38
|
+
let [d, f] = c({}), p = s({}), h = s(/* @__PURE__ */ new Map()), g = s(y), [_, v] = c(0), b = r((e) => {
|
|
39
|
+
let t = p.current, n = {};
|
|
40
|
+
for (let [r, i] of Object.entries(t)) r in e || (n[r] = i);
|
|
41
|
+
let r = !1;
|
|
42
|
+
for (let [i, a] of Object.entries(e)) {
|
|
43
|
+
let e = h.current.get(i);
|
|
44
|
+
(t[i] ?? e?.defaultSize) !== a && (r = !0, a !== e?.defaultSize && (n[i] = a));
|
|
45
|
+
}
|
|
46
|
+
return r && (p.current = n, f(n)), r;
|
|
47
|
+
}, []), x = r(() => {
|
|
48
|
+
if (!u) return;
|
|
49
|
+
let e = {};
|
|
50
|
+
for (let [t, n] of h.current) n.fixed && (e[t] = n.collapsed ? 0 : p.current[t] ?? n.defaultSize);
|
|
51
|
+
u(e);
|
|
52
|
+
}, [u]), S = r((e) => {
|
|
53
|
+
if (!(e in p.current)) return;
|
|
54
|
+
let t = {};
|
|
55
|
+
for (let [n, r] of Object.entries(p.current)) n !== e && (t[n] = r);
|
|
56
|
+
p.current = t, f(t);
|
|
57
|
+
}, []), E = r((e) => {
|
|
58
|
+
g.current = new Set(e), v((e) => e + 1);
|
|
59
|
+
}, []), D = r(() => {
|
|
60
|
+
g.current = y, v((e) => e + 1);
|
|
61
|
+
}, []), O = r((e) => g.current.has(e), []), k = r((e) => e === void 0 ? void 0 : h.current.get(e), []), A = r((e, t) => (h.current.set(e, t), () => {
|
|
62
|
+
h.current.delete(e);
|
|
63
|
+
}), []), j = o(() => ({
|
|
64
|
+
direction: t,
|
|
65
|
+
sizes: d,
|
|
66
|
+
applySizes: b,
|
|
67
|
+
commitSizes: x,
|
|
68
|
+
clearOverride: S,
|
|
69
|
+
getPanelApi: k,
|
|
70
|
+
registerPanel: A,
|
|
71
|
+
markGesture: E,
|
|
72
|
+
endGesture: D,
|
|
73
|
+
isGesturePanel: O
|
|
74
|
+
}), [
|
|
75
|
+
t,
|
|
76
|
+
d,
|
|
77
|
+
b,
|
|
78
|
+
x,
|
|
79
|
+
S,
|
|
80
|
+
k,
|
|
81
|
+
A,
|
|
82
|
+
E,
|
|
83
|
+
D,
|
|
84
|
+
O,
|
|
85
|
+
_
|
|
86
|
+
]);
|
|
87
|
+
return /* @__PURE__ */ l(m.Provider, {
|
|
88
|
+
value: j,
|
|
89
|
+
children: l("div", {
|
|
26
90
|
"data-slot": "resizable-group",
|
|
91
|
+
style: a,
|
|
27
92
|
className: e([
|
|
28
|
-
|
|
29
|
-
t === "horizontal" ?
|
|
30
|
-
|
|
93
|
+
C,
|
|
94
|
+
t === "horizontal" ? w : T,
|
|
95
|
+
i
|
|
31
96
|
]),
|
|
32
97
|
children: n
|
|
33
98
|
})
|
|
34
99
|
});
|
|
35
100
|
}
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
let {
|
|
39
|
-
|
|
101
|
+
var D = "haze-Resizable__panelBase", O = "haze-Resizable__panelCollapsed";
|
|
102
|
+
function k({ id: t, defaultSize: n, minSize: r, maxSize: i, collapsible: o = !1, collapsed: c, onCollapsedChange: m, children: g, className: _, style: y, ...b }) {
|
|
103
|
+
let { sizes: x, registerPanel: S, clearOverride: C, isGesturePanel: w } = h(), T = s({
|
|
104
|
+
defaultSize: n,
|
|
105
|
+
minSize: r,
|
|
106
|
+
maxSize: i
|
|
107
|
+
});
|
|
108
|
+
a(() => {
|
|
109
|
+
let e = T.current;
|
|
110
|
+
(e.defaultSize !== n || e.minSize !== r || e.maxSize !== i) && (w(t) || (T.current = {
|
|
111
|
+
defaultSize: n,
|
|
112
|
+
minSize: r,
|
|
113
|
+
maxSize: i
|
|
114
|
+
}, C(t)));
|
|
115
|
+
});
|
|
116
|
+
let E = u(c), [k, A] = d(f(E ? c : void 0, p((e) => m?.(e))), E ? !1 : c ?? !1), j = o && k;
|
|
117
|
+
a(() => S(t, {
|
|
118
|
+
fixed: n !== void 0,
|
|
119
|
+
defaultSize: n ?? 0,
|
|
120
|
+
minSize: r ?? 0,
|
|
121
|
+
maxSize: i,
|
|
122
|
+
collapsed: j,
|
|
123
|
+
setCollapsed: o ? A : v
|
|
124
|
+
}), [
|
|
125
|
+
S,
|
|
126
|
+
t,
|
|
127
|
+
n,
|
|
128
|
+
r,
|
|
129
|
+
i,
|
|
130
|
+
j,
|
|
131
|
+
o,
|
|
132
|
+
A
|
|
133
|
+
]);
|
|
134
|
+
let M = x[t], N = j ? {
|
|
135
|
+
flexGrow: 0,
|
|
136
|
+
flexShrink: 0,
|
|
137
|
+
flexBasis: "0px"
|
|
138
|
+
} : n === void 0 ? {
|
|
139
|
+
flexGrow: 1,
|
|
140
|
+
flexShrink: 1,
|
|
141
|
+
flexBasis: "0px"
|
|
142
|
+
} : {
|
|
143
|
+
flexGrow: 0,
|
|
144
|
+
flexShrink: 0,
|
|
145
|
+
flexBasis: `${M ?? n}px`
|
|
146
|
+
};
|
|
147
|
+
return /* @__PURE__ */ l("div", {
|
|
40
148
|
"data-slot": "resizable-panel",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
149
|
+
"data-panel-id": t,
|
|
150
|
+
"data-collapsed": j || void 0,
|
|
151
|
+
style: {
|
|
152
|
+
...y,
|
|
153
|
+
...N
|
|
154
|
+
},
|
|
155
|
+
...b,
|
|
156
|
+
className: e([
|
|
157
|
+
D,
|
|
158
|
+
j && O,
|
|
159
|
+
_
|
|
160
|
+
]),
|
|
161
|
+
children: g
|
|
44
162
|
});
|
|
45
163
|
}
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
|
|
164
|
+
var A = "haze-Resizable__handleBase", j = "haze-Resizable__handleHorizontal", M = "haze-Resizable__handleVertical";
|
|
165
|
+
function N(e, t, n, r) {
|
|
166
|
+
let i = {};
|
|
167
|
+
if (e !== null && t !== null && n !== null) {
|
|
168
|
+
let a = Math.max(e.min, n - (t.max ?? Infinity)), o = Math.min(e.max ?? Infinity, n - t.min), s = b(e.start + r, a, o);
|
|
169
|
+
return i[e.id] = s, i[t.id] = n - s, i;
|
|
170
|
+
}
|
|
171
|
+
return e === null ? (t === null || (i[t.id] = b(t.start - r, t.min, t.max)), i) : (i[e.id] = b(e.start + r, e.min, e.max), i);
|
|
172
|
+
}
|
|
173
|
+
function P({ className: n, ...r }) {
|
|
174
|
+
let { direction: i, applySizes: o, commitSizes: u, getPanelApi: d, markGesture: f, endGesture: p } = h(), m = s(null), v = s(null), y = s(!1);
|
|
175
|
+
a(() => () => {
|
|
176
|
+
v.current !== null && (v.current = null, p());
|
|
177
|
+
}, [p]);
|
|
178
|
+
let b = () => i === "horizontal" && t(m.current) === "rtl", [C, w] = c(void 0);
|
|
179
|
+
a(() => {
|
|
180
|
+
let e = m.current;
|
|
181
|
+
if (e === null) return;
|
|
182
|
+
let t = (e) => {
|
|
183
|
+
let t = S(e);
|
|
184
|
+
if (t === void 0) return;
|
|
185
|
+
let n = e?.dataset.panelId, r = n === void 0 ? void 0 : d(n);
|
|
186
|
+
return {
|
|
187
|
+
now: t,
|
|
188
|
+
min: r?.minSize,
|
|
189
|
+
max: r?.maxSize
|
|
190
|
+
};
|
|
191
|
+
}, n = t(x(e, "previousElementSibling")) ?? t(x(e, "nextElementSibling"));
|
|
192
|
+
w((e) => e?.now === n?.now && e?.min === n?.min && e?.max === n?.max ? e : n);
|
|
193
|
+
});
|
|
194
|
+
let T = (e) => i === "horizontal" ? e.clientX : e.clientY, E = (e) => {
|
|
195
|
+
let t = e?.dataset.panelId;
|
|
196
|
+
if (e === void 0 || t === void 0) return null;
|
|
197
|
+
let n = d(t);
|
|
198
|
+
if (n === void 0 || n.collapsed || !n.fixed) return null;
|
|
199
|
+
let r = S(e);
|
|
200
|
+
return r === void 0 ? null : {
|
|
201
|
+
id: t,
|
|
202
|
+
start: r,
|
|
203
|
+
min: n.minSize,
|
|
204
|
+
max: n.maxSize,
|
|
205
|
+
defaultSize: n.defaultSize
|
|
206
|
+
};
|
|
207
|
+
}, D = (e) => {
|
|
208
|
+
let t = d(e?.dataset.panelId);
|
|
209
|
+
return t?.collapsed ? t : void 0;
|
|
210
|
+
}, O = (e) => ({
|
|
211
|
+
lead: E(x(e, "previousElementSibling")),
|
|
212
|
+
trail: E(x(e, "nextElementSibling")),
|
|
213
|
+
expand: D(x(e, "previousElementSibling")) ?? D(x(e, "nextElementSibling"))
|
|
214
|
+
}), k = (e) => {
|
|
215
|
+
let { lead: t, trail: n } = O(e), r = {};
|
|
216
|
+
t !== null && (r[t.id] = t.defaultSize), n !== null && (r[n.id] = n.defaultSize), o(r) && u();
|
|
217
|
+
}, P = (e) => {
|
|
218
|
+
if (e.button !== 0) return;
|
|
219
|
+
let t = e.currentTarget, { lead: n, trail: r, expand: i } = O(t);
|
|
220
|
+
if (i !== void 0) {
|
|
221
|
+
e.preventDefault(), i.setCollapsed(!1);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (n === null && r === null) return;
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
let a = [];
|
|
227
|
+
if (n !== null && a.push(n.id), r !== null && a.push(r.id), f(a), v.current = {
|
|
228
|
+
pointerId: e.pointerId,
|
|
229
|
+
origin: T(e),
|
|
230
|
+
lead: n,
|
|
231
|
+
trail: r,
|
|
232
|
+
pairSum: n !== null && r !== null ? n.start + r.start : null
|
|
233
|
+
}, y.current = !1, typeof t.setPointerCapture == "function") try {
|
|
234
|
+
t.setPointerCapture(e.pointerId);
|
|
235
|
+
} catch {}
|
|
236
|
+
}, F = (e) => {
|
|
237
|
+
let t = v.current;
|
|
238
|
+
if (t?.pointerId !== e.pointerId) return;
|
|
239
|
+
let n = T(e) - t.origin, r = N(t.lead, t.trail, t.pairSum, b() ? -n : n);
|
|
240
|
+
o(r) && (y.current = !0);
|
|
241
|
+
}, I = (e) => {
|
|
242
|
+
if (v.current?.pointerId !== e.pointerId) return;
|
|
243
|
+
v.current = null;
|
|
244
|
+
let t = e.currentTarget;
|
|
245
|
+
if (typeof t.releasePointerCapture == "function") try {
|
|
246
|
+
t.releasePointerCapture(e.pointerId);
|
|
247
|
+
} catch {}
|
|
248
|
+
e.type === "pointerup" && y.current && u(), y.current = !1, p();
|
|
249
|
+
}, L = (e) => {
|
|
250
|
+
let t = i === "horizontal" ? "ArrowRight" : "ArrowDown", n = i === "horizontal" ? "ArrowLeft" : "ArrowUp", { key: r } = e, a = e.currentTarget, { lead: s, trail: c, expand: l } = O(a);
|
|
251
|
+
if (l !== void 0) {
|
|
252
|
+
r === "Enter" && (e.preventDefault(), l.setCollapsed(!1));
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (r === "Enter") {
|
|
256
|
+
e.preventDefault(), k(a);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (r !== t && r !== n && r !== "Home" && r !== "End" || s === null && c === null) return;
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
let d = s !== null && c !== null ? s.start + c.start : null, f = b(), p = r === t ? f ? -16 : g : r === n ? f ? g : -16 : r === "Home" ? -_ : _;
|
|
262
|
+
o(N(s, c, d, p)) && u();
|
|
263
|
+
};
|
|
264
|
+
return /* @__PURE__ */ l("div", {
|
|
265
|
+
ref: m,
|
|
50
266
|
"data-slot": "resizable-handle",
|
|
267
|
+
...r,
|
|
51
268
|
role: "separator",
|
|
52
|
-
"aria-orientation":
|
|
269
|
+
"aria-orientation": i === "horizontal" ? "vertical" : "horizontal",
|
|
270
|
+
tabIndex: 0,
|
|
271
|
+
"aria-valuenow": C?.now,
|
|
272
|
+
"aria-valuemin": C?.min,
|
|
273
|
+
"aria-valuemax": C?.max,
|
|
274
|
+
onKeyDown: L,
|
|
275
|
+
onPointerDown: P,
|
|
276
|
+
onPointerMove: F,
|
|
277
|
+
onPointerUp: I,
|
|
278
|
+
onPointerCancel: I,
|
|
279
|
+
onDoubleClick: () => {
|
|
280
|
+
let e = m.current;
|
|
281
|
+
e !== null && k(e);
|
|
282
|
+
},
|
|
53
283
|
className: e([
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
284
|
+
A,
|
|
285
|
+
i === "horizontal" ? j : M,
|
|
286
|
+
n
|
|
57
287
|
])
|
|
58
288
|
});
|
|
59
289
|
}
|
|
60
290
|
//#endregion
|
|
61
|
-
export {
|
|
291
|
+
export { E as ResizableGroup, P as ResizableHandle, k as ResizablePanel };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
2
|
+
import { base as t, toneFills as n, toneStrokes as r } from "./sparkline-styles.js";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
//#region src/lib/components/Sparkline/Sparkline.tsx
|
|
5
|
+
var o = 100, s = 2;
|
|
6
|
+
function c(e) {
|
|
7
|
+
let t = Math.min(...e), n = Math.max(...e) - t, r = e.length - 1;
|
|
8
|
+
return e.map((e, i) => {
|
|
9
|
+
let a = i / r * o, s = n === 0 ? o / 2 : 92 - (e - t) / n * 84;
|
|
10
|
+
return `${i === 0 ? "M" : "L"}${a.toFixed(2)} ${s.toFixed(2)}`;
|
|
11
|
+
}).join(" ");
|
|
12
|
+
}
|
|
13
|
+
function l(e) {
|
|
14
|
+
let t = o.toFixed(2);
|
|
15
|
+
return `${e} L${t} ${t} L0.00 ${t} Z`;
|
|
16
|
+
}
|
|
17
|
+
function u({ data: u, width: d = 96, height: f = 28, variant: p = "line", tone: m = "primary", className: h, ...g }) {
|
|
18
|
+
let _ = g["aria-label"], v = g["aria-labelledby"], y = typeof _ == "string" && _.length > 0 || typeof v == "string" && v.length > 0, b = u.length >= s, x = b ? c(u) : "";
|
|
19
|
+
return /* @__PURE__ */ a("svg", {
|
|
20
|
+
...g,
|
|
21
|
+
"data-slot": "sparkline",
|
|
22
|
+
width: d,
|
|
23
|
+
height: f,
|
|
24
|
+
viewBox: `0 0 ${o} ${o}`,
|
|
25
|
+
preserveAspectRatio: "none",
|
|
26
|
+
role: y ? "img" : g.role,
|
|
27
|
+
"aria-hidden": !y || void 0,
|
|
28
|
+
className: e([t, h]),
|
|
29
|
+
children: [b && p === "area" && /* @__PURE__ */ i("path", {
|
|
30
|
+
d: l(x),
|
|
31
|
+
stroke: "none",
|
|
32
|
+
className: e([n[m]])
|
|
33
|
+
}), b && /* @__PURE__ */ i("path", {
|
|
34
|
+
d: x,
|
|
35
|
+
fill: "none",
|
|
36
|
+
"stroke-width": "2",
|
|
37
|
+
"stroke-linecap": "round",
|
|
38
|
+
"stroke-linejoin": "round",
|
|
39
|
+
"vector-effect": "non-scaling-stroke",
|
|
40
|
+
className: e([r[m]])
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { u as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/* empty css */
|
|
3
|
+
//#region src/lib/components/Sparkline/sparkline-styles.ts
|
|
4
|
+
var e = "haze-sparkline-styles__base", t = {
|
|
5
|
+
primary: "haze-sparkline-styles__primary",
|
|
6
|
+
success: "haze-sparkline-styles__success",
|
|
7
|
+
danger: "haze-sparkline-styles__danger",
|
|
8
|
+
warning: "haze-sparkline-styles__warning",
|
|
9
|
+
info: "haze-sparkline-styles__info"
|
|
10
|
+
}, n = {
|
|
11
|
+
primary: "haze-sparkline-styles__primary",
|
|
12
|
+
success: "haze-sparkline-styles__success",
|
|
13
|
+
danger: "haze-sparkline-styles__danger",
|
|
14
|
+
warning: "haze-sparkline-styles__warning",
|
|
15
|
+
info: "haze-sparkline-styles__info"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as base, n as toneFills, t as toneStrokes };
|
|
@@ -0,0 +1,47 @@
|
|
|
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/StatusBar/StatusBar.tsx
|
|
7
|
+
var r = "haze-StatusBar__bar", i = "haze-StatusBar__group", a = "haze-StatusBar__groupEnd", o = "haze-StatusBar__item", s = "haze-StatusBar__itemAction";
|
|
8
|
+
function c({ left: o, right: s, className: c, ...l }) {
|
|
9
|
+
return /* @__PURE__ */ n("footer", {
|
|
10
|
+
"data-slot": "status-bar",
|
|
11
|
+
...l,
|
|
12
|
+
className: e([r, c]),
|
|
13
|
+
children: [o != null && /* @__PURE__ */ t("div", {
|
|
14
|
+
"data-slot": "status-bar-left",
|
|
15
|
+
className: e(i),
|
|
16
|
+
children: o
|
|
17
|
+
}), s != null && /* @__PURE__ */ t("div", {
|
|
18
|
+
"data-slot": "status-bar-right",
|
|
19
|
+
className: e([i, a]),
|
|
20
|
+
children: s
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function l({ priority: n, onSelect: r, className: i, children: a, ...c }) {
|
|
25
|
+
let l = [
|
|
26
|
+
o,
|
|
27
|
+
r != null && s,
|
|
28
|
+
i
|
|
29
|
+
], u = n ? "true" : void 0;
|
|
30
|
+
return r == null ? /* @__PURE__ */ t("span", {
|
|
31
|
+
"data-slot": "status-item",
|
|
32
|
+
"data-priority": u,
|
|
33
|
+
...c,
|
|
34
|
+
className: e(l),
|
|
35
|
+
children: a
|
|
36
|
+
}) : /* @__PURE__ */ t("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
"data-slot": "status-item",
|
|
39
|
+
"data-priority": u,
|
|
40
|
+
onClick: r,
|
|
41
|
+
...c,
|
|
42
|
+
className: e(l),
|
|
43
|
+
children: a
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { l as StatusItem, c as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
4
|
+
import t from "../Badge/Badge.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
7
|
+
//#region src/lib/components/TabBar/TabBar.tsx
|
|
8
|
+
var i = "haze-TabBar__bar";
|
|
9
|
+
function a({ children: t, className: r, ...a }) {
|
|
10
|
+
return /* @__PURE__ */ n("nav", {
|
|
11
|
+
"data-slot": "tab-bar",
|
|
12
|
+
...a,
|
|
13
|
+
className: e([i, r]),
|
|
14
|
+
children: t
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
var o = "haze-TabBar__item", s = "haze-TabBar__itemActive", c = "haze-TabBar__indicator", l = "haze-TabBar__itemIcon", u = "haze-TabBar__itemLabel", d = "haze-TabBar__itemBadge";
|
|
18
|
+
function f({ icon: i, label: a, badge: f, active: p = !1, onSelect: m, onReselect: h, className: g, onClick: _, ...v }) {
|
|
19
|
+
return /* @__PURE__ */ r("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
"data-slot": "tab-bar-item",
|
|
22
|
+
"aria-current": p ? "true" : void 0,
|
|
23
|
+
onClick: (e) => {
|
|
24
|
+
_?.(e), p ? h?.() : m?.();
|
|
25
|
+
},
|
|
26
|
+
...v,
|
|
27
|
+
className: e([
|
|
28
|
+
o,
|
|
29
|
+
p && s,
|
|
30
|
+
g
|
|
31
|
+
]),
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ r("span", {
|
|
34
|
+
"data-slot": "tab-bar-item-icon",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
className: e(l),
|
|
37
|
+
children: [i, f != null && /* @__PURE__ */ n("span", {
|
|
38
|
+
"data-slot": "tab-bar-item-badge",
|
|
39
|
+
className: e(d),
|
|
40
|
+
children: /* @__PURE__ */ n(t, {
|
|
41
|
+
size: "sm",
|
|
42
|
+
children: f
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ n("span", {
|
|
47
|
+
"data-slot": "tab-bar-item-label",
|
|
48
|
+
className: e(u),
|
|
49
|
+
children: a
|
|
50
|
+
}),
|
|
51
|
+
p && /* @__PURE__ */ n("span", {
|
|
52
|
+
"data-slot": "tab-bar-item-indicator",
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: e(c)
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { f as TabBarItem, a as default };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
4
|
+
import { useTabsContext as t } from "./TabsContext.js";
|
|
5
|
+
import { collectTabMetas as n } from "./tab-metas.js";
|
|
6
|
+
import r from "./TabList.js";
|
|
7
|
+
import { sortableItemStyle as i } from "../../utils/sortable-shared.js";
|
|
8
|
+
import { SortableRegion as a } from "../../utils/sortable.js";
|
|
9
|
+
import { edgeScrollDelta as o } from "./edge-scroll.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
import { Children as s, createContext as c, isValidElement as l, useCallback as u, useContext as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
12
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
13
|
+
import { arrayMove as _, horizontalListSortingStrategy as v, useSortable as y } from "@dnd-kit/sortable";
|
|
14
|
+
//#region src/lib/components/Tabs/SortableTabList.tsx
|
|
15
|
+
var b = "haze-SortableTabList__sortableTab", x = "haze-SortableTabList__sortableTabActive", S = "haze-SortableTabList__sortableTabDragging", C = c(null);
|
|
16
|
+
function w(e, t, n) {
|
|
17
|
+
if (n.offsetParent !== t) return null;
|
|
18
|
+
let r = 0;
|
|
19
|
+
for (let e of Array.from(t.children)) {
|
|
20
|
+
let t = e;
|
|
21
|
+
r = Math.max(r, t.offsetLeft + t.offsetWidth);
|
|
22
|
+
}
|
|
23
|
+
if (r <= 0) return null;
|
|
24
|
+
let i = n.offsetLeft, a = -i, o = r - n.offsetWidth - i;
|
|
25
|
+
return {
|
|
26
|
+
x: Math.max(a, Math.min(e.x ?? 0, o)),
|
|
27
|
+
y: 0,
|
|
28
|
+
scaleX: 1,
|
|
29
|
+
scaleY: 1
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function T({ id: n, children: r }) {
|
|
33
|
+
let { value: a, setValue: o } = t(), { listeners: s, setNodeRef: c, transform: h, transition: _, isDragging: v } = y({ id: n }), T = m(null), E = d(C), D = m(null), O = u((e) => {
|
|
34
|
+
D.current = e, c(e);
|
|
35
|
+
}, [c]), k = l(r) ? r.props.value : void 0, A = k !== void 0 && a === k, j = p(() => {
|
|
36
|
+
let e = E?.current, t = D.current;
|
|
37
|
+
return !h || !e || !t ? h : w(h, e, t) ?? h;
|
|
38
|
+
}, [h, E]);
|
|
39
|
+
f(() => {
|
|
40
|
+
if (v) {
|
|
41
|
+
T.current === null && (T.current = a);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let e = T.current;
|
|
45
|
+
e !== null && (T.current = null, e !== a && o(e));
|
|
46
|
+
}, [
|
|
47
|
+
v,
|
|
48
|
+
a,
|
|
49
|
+
o
|
|
50
|
+
]);
|
|
51
|
+
function M(e) {
|
|
52
|
+
let t = s?.onKeyDown;
|
|
53
|
+
t?.(e), e.defaultPrevented && e.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
let N = s?.onPointerDown;
|
|
56
|
+
return /* @__PURE__ */ g("span", {
|
|
57
|
+
ref: O,
|
|
58
|
+
"data-slot": "sortable-tab",
|
|
59
|
+
style: i(j, _),
|
|
60
|
+
onPointerDown: N,
|
|
61
|
+
onKeyDownCapture: M,
|
|
62
|
+
className: e([
|
|
63
|
+
b,
|
|
64
|
+
A && x,
|
|
65
|
+
v && S
|
|
66
|
+
]),
|
|
67
|
+
children: r
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function E({ className: e, onReorder: t, children: i }) {
|
|
71
|
+
let c = s.toArray(i), u = c.map((e, t) => {
|
|
72
|
+
if (l(e)) {
|
|
73
|
+
let t = e.props.value;
|
|
74
|
+
if (t !== void 0) return t;
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}), d = p(() => n(c), [c]), y = m(null), b = m(0), [x, S] = h(!1);
|
|
78
|
+
return f(() => {
|
|
79
|
+
if (!x) return;
|
|
80
|
+
let e = 0, t = () => {
|
|
81
|
+
let n = y.current;
|
|
82
|
+
if (n) {
|
|
83
|
+
let e = n.getBoundingClientRect();
|
|
84
|
+
n.scrollLeft += o(e, b.current);
|
|
85
|
+
}
|
|
86
|
+
e = requestAnimationFrame(t);
|
|
87
|
+
};
|
|
88
|
+
e = requestAnimationFrame(t);
|
|
89
|
+
let n = (e) => {
|
|
90
|
+
b.current = e.clientX;
|
|
91
|
+
};
|
|
92
|
+
return window.addEventListener("pointermove", n), () => {
|
|
93
|
+
cancelAnimationFrame(e), window.removeEventListener("pointermove", n);
|
|
94
|
+
};
|
|
95
|
+
}, [x]), /* @__PURE__ */ g("div", { children: g(C.Provider, {
|
|
96
|
+
value: y,
|
|
97
|
+
children: /* @__PURE__ */ g(a, {
|
|
98
|
+
ids: u,
|
|
99
|
+
strategy: v,
|
|
100
|
+
onMove: (e, n) => t?.(_(u, e, n).map((e) => u.indexOf(e))),
|
|
101
|
+
onDragStart: (e) => S(e.activatorEvent.type === "pointerdown"),
|
|
102
|
+
onDragEnd: () => S(!1),
|
|
103
|
+
children: /* @__PURE__ */ g(r, {
|
|
104
|
+
className: e,
|
|
105
|
+
listRef: y,
|
|
106
|
+
tabMetas: d,
|
|
107
|
+
children: c.map((e, t) => /* @__PURE__ */ g(T, {
|
|
108
|
+
id: u[t] ?? t,
|
|
109
|
+
children: e
|
|
110
|
+
}, u[t] ?? t))
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
}) });
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { E as default };
|