haze-ui 1.18.2 → 1.19.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/dist/components/Accordion/index.js +3 -0
- package/dist/components/Affix/index.js +2 -0
- package/dist/components/Alert/index.js +2 -0
- package/dist/components/ApprovalCard/index.js +2 -0
- package/dist/components/AspectRatio/index.js +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/BackToTop/index.js +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Banner/index.js +2 -0
- package/dist/components/BottomSheet/index.js +2 -0
- package/dist/components/Breadcrumb/index.js +3 -0
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/Carousel/index.js +3 -0
- package/dist/components/ChatContainer/index.js +2 -0
- package/dist/components/ChatInput/index.js +2 -0
- package/dist/components/ChatMessage/index.js +2 -0
- package/dist/components/Checkbox/index.js +3 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/CodeBlock/index.js +2 -0
- package/dist/components/Collapsible/index.js +2 -0
- package/dist/components/ColorPicker/index.js +3 -0
- package/dist/components/Combobox/index.js +3 -0
- package/dist/components/Command/index.js +2 -0
- package/dist/components/ConfirmDialog/index.js +2 -0
- package/dist/components/Container/index.js +2 -0
- package/dist/components/ContextMenu/index.js +6 -0
- package/dist/components/ConversationList/index.js +3 -0
- package/dist/components/DateRangePicker/index.js +3 -0
- package/dist/components/Datepicker/index.js +3 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/DiffViewer/index.js +2 -0
- package/dist/components/Disclosure/index.js +2 -0
- package/dist/components/Divider/index.js +2 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/DropdownMenu/index.js +6 -0
- package/dist/components/Empty/index.js +2 -0
- package/dist/components/FileInput/index.js +2 -0
- package/dist/components/Flex/index.js +2 -0
- package/dist/components/Grid/index.js +3 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Image/index.js +2 -0
- package/dist/components/InlineEdit/index.js +2 -0
- package/dist/components/Input/index.js +3 -0
- package/dist/components/List/index.js +3 -0
- package/dist/components/LogViewer/index.js +2 -0
- package/dist/components/MarkdownRenderer/index.js +2 -0
- package/dist/components/Menu/index.js +4 -0
- package/dist/components/ModelPicker/index.js +2 -0
- package/dist/components/NavigationBar/index.js +3 -0
- package/dist/components/NumberInput/index.js +3 -0
- package/dist/components/OTPInput/index.js +3 -0
- package/dist/components/Pagination/index.js +2 -0
- package/dist/components/PasswordInput/index.js +3 -0
- package/dist/components/Popover/Popover.js +5 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/index.js +4 -0
- package/dist/components/Rating/index.js +3 -0
- package/dist/components/Resizable/index.js +2 -0
- package/dist/components/ScrollArea/index.js +2 -0
- package/dist/components/Segmented/index.js +3 -0
- package/dist/components/Select/index.js +4 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Slider/index.js +3 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/Stat/index.js +2 -0
- package/dist/components/StepTimeline/index.js +2 -0
- package/dist/components/Stepper/index.js +3 -0
- package/dist/components/StreamingText/index.js +2 -0
- package/dist/components/SwipeAction/index.js +2 -0
- package/dist/components/Switch/index.js +3 -0
- package/dist/components/Table/index.js +6 -0
- package/dist/components/Tabs/index.js +5 -0
- package/dist/components/Tag/index.js +2 -0
- package/dist/components/TagGroup/index.js +3 -0
- package/dist/components/TagInput/index.js +3 -0
- package/dist/components/Textarea/index.js +3 -0
- package/dist/components/ThinkingIndicator/index.js +2 -0
- package/dist/components/TimePicker/index.js +3 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.js +42 -15
- package/dist/components/Toast/ToastContainer.js +35 -26
- package/dist/components/Toast/index.js +4 -0
- package/dist/components/TokenCounter/index.js +2 -0
- package/dist/components/ToolCallCard/index.js +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Transfer/index.js +3 -0
- package/dist/components/Tree/index.js +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/components/Upload/index.js +3 -0
- package/dist/components/VirtualList/index.js +2 -0
- package/dist/css/toast.css +2 -2
- package/dist/form/FormItem.js +1 -1
- package/dist/form/index.js +2 -0
- package/dist/haze-ui.css +2 -2
- package/dist/tokens/index.js +4 -0
- package/dist/types/components/Toast/ToastContainer.d.ts +13 -2
- package/dist/types/form/FormItem.d.ts +3 -2
- package/dist/types/utils/floating.d.ts +13 -0
- package/dist/utils/floating.js +44 -22
- package/package.json +17 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import e from "./ContextMenu.js";
|
|
2
|
+
import t from "./ContextMenuTrigger.js";
|
|
3
|
+
import n from "./ContextMenuContent.js";
|
|
4
|
+
import r from "./ContextMenuItem.js";
|
|
5
|
+
import i from "./ContextMenuSeparator.js";
|
|
6
|
+
export { e as ContextMenu, n as ContextMenuContent, r as ContextMenuItem, i as ContextMenuSeparator, t as ContextMenuTrigger };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import e from "./DropdownMenu.js";
|
|
2
|
+
import t from "./DropdownMenuTrigger.js";
|
|
3
|
+
import n from "./DropdownMenuContent.js";
|
|
4
|
+
import r from "./DropdownMenuItem.js";
|
|
5
|
+
import i from "./DropdownMenuSeparator.js";
|
|
6
|
+
export { e as DropdownMenu, n as DropdownMenuContent, r as DropdownMenuItem, i as DropdownMenuSeparator, t as DropdownMenuTrigger };
|
|
@@ -19,10 +19,15 @@ function l({ content: l, open: u, className: d, children: f }) {
|
|
|
19
19
|
ref: g,
|
|
20
20
|
style: v.triggerStyle,
|
|
21
21
|
role: "button",
|
|
22
|
+
tabIndex: 0,
|
|
23
|
+
"aria-haspopup": "true",
|
|
22
24
|
"aria-expanded": p,
|
|
23
25
|
"aria-controls": h,
|
|
24
26
|
onPointerDown: v.onTriggerPointerDown,
|
|
25
27
|
onClick: v.onTriggerClick,
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), v.onTriggerClick());
|
|
30
|
+
},
|
|
26
31
|
children: f
|
|
27
32
|
}), /* @__PURE__ */ n(e, {
|
|
28
33
|
ref: _,
|
|
@@ -2,33 +2,60 @@
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
5
|
+
import { useCallback as r, useEffect as i, useRef as a } from "react";
|
|
6
6
|
//#region src/lib/components/Toast/Toast.tsx
|
|
7
|
-
var
|
|
7
|
+
var o = "haze-Toast__base", s = {
|
|
8
8
|
info: "haze-Toast__info",
|
|
9
9
|
success: "haze-Toast__success",
|
|
10
10
|
warning: "haze-Toast__warning",
|
|
11
11
|
danger: "haze-Toast__danger"
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
}, c = "haze-Toast__contentStyle", l = "haze-Toast__closeBtn";
|
|
13
|
+
function u({ variant: u = "info", onClose: d, duration: f, children: p }) {
|
|
14
|
+
let m = a(f), h = a(0), g = a(null), _ = a(!1), v = a(!1), y = a(d);
|
|
15
|
+
i(() => {
|
|
16
|
+
y.current = d;
|
|
17
|
+
}, [d]);
|
|
18
|
+
let b = r(() => {
|
|
19
|
+
g.current !== null && (clearTimeout(g.current), g.current = null, m.current = Math.max(0, m.current - (Date.now() - h.current)));
|
|
20
|
+
}, []), x = r(() => {
|
|
21
|
+
g.current !== null || m.current <= 0 || (h.current = Date.now(), g.current = setTimeout(() => {
|
|
22
|
+
g.current = null, y.current();
|
|
23
|
+
}, m.current));
|
|
24
|
+
}, []), S = r(() => {
|
|
25
|
+
_.current || v.current ? b() : x();
|
|
26
|
+
}, [b, x]);
|
|
27
|
+
return i(() => {
|
|
28
|
+
if (!(f <= 0)) return m.current = f, !_.current && !v.current && x(), b;
|
|
29
|
+
}, [
|
|
30
|
+
f,
|
|
31
|
+
x,
|
|
32
|
+
b
|
|
33
|
+
]), /* @__PURE__ */ n("div", {
|
|
19
34
|
role: "alert",
|
|
20
|
-
|
|
35
|
+
onPointerEnter: () => {
|
|
36
|
+
_.current = !0, S();
|
|
37
|
+
},
|
|
38
|
+
onPointerLeave: () => {
|
|
39
|
+
_.current = !1, S();
|
|
40
|
+
},
|
|
41
|
+
onFocus: () => {
|
|
42
|
+
v.current = !0, S();
|
|
43
|
+
},
|
|
44
|
+
onBlur: () => {
|
|
45
|
+
v.current = !1, S();
|
|
46
|
+
},
|
|
47
|
+
className: e([o, s[u]]),
|
|
21
48
|
children: [/* @__PURE__ */ t("div", {
|
|
22
|
-
className:
|
|
23
|
-
children:
|
|
49
|
+
className: c,
|
|
50
|
+
children: p
|
|
24
51
|
}), /* @__PURE__ */ t("button", {
|
|
25
52
|
type: "button",
|
|
26
|
-
className:
|
|
53
|
+
className: l,
|
|
27
54
|
"aria-label": "Close",
|
|
28
|
-
onClick:
|
|
55
|
+
onClick: d,
|
|
29
56
|
children: "×"
|
|
30
57
|
})]
|
|
31
58
|
});
|
|
32
59
|
}
|
|
33
60
|
//#endregion
|
|
34
|
-
export {
|
|
61
|
+
export { u as default };
|
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
|
|
2
|
-
import e from "
|
|
3
|
-
import
|
|
2
|
+
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import t from "./Toast.js";
|
|
4
|
+
import { ToastProvider as n } from "./ToastContext.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { useCallback as
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as a, useRef as o, useState as s } from "react";
|
|
7
8
|
//#region src/lib/components/Toast/ToastContainer.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
var c = "haze-ToastContainer__containerBase", l = {
|
|
10
|
+
"top-left": "haze-ToastContainer__top-left",
|
|
11
|
+
"top-right": "haze-ToastContainer__top-right",
|
|
12
|
+
"bottom-left": "haze-ToastContainer__bottom-left",
|
|
13
|
+
"bottom-right": "haze-ToastContainer__bottom-right"
|
|
14
|
+
};
|
|
15
|
+
function u({ children: u, maxCount: d, placement: f = "bottom-right" }) {
|
|
16
|
+
let [p, m] = s([]), h = o(0), g = a((e) => {
|
|
17
|
+
h.current += 1, m((t) => {
|
|
18
|
+
let n = [...t, {
|
|
19
|
+
...e,
|
|
20
|
+
id: h.current
|
|
21
|
+
}];
|
|
22
|
+
return d === void 0 || n.length <= d ? n : n.slice(n.length - d);
|
|
23
|
+
});
|
|
24
|
+
}, [d]), _ = a((e) => {
|
|
25
|
+
m((t) => t.filter((t) => t.id !== e));
|
|
17
26
|
}, []);
|
|
18
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ i(n, {
|
|
19
28
|
value: {
|
|
20
|
-
toasts:
|
|
21
|
-
addToast:
|
|
22
|
-
removeToast:
|
|
29
|
+
toasts: p,
|
|
30
|
+
addToast: g,
|
|
31
|
+
removeToast: _
|
|
23
32
|
},
|
|
24
|
-
children: [
|
|
25
|
-
className:
|
|
26
|
-
children:
|
|
27
|
-
variant:
|
|
28
|
-
duration:
|
|
29
|
-
onClose: () =>
|
|
30
|
-
children:
|
|
31
|
-
},
|
|
33
|
+
children: [u, /* @__PURE__ */ r("div", {
|
|
34
|
+
className: e([c, l[f]]),
|
|
35
|
+
children: p.map((e) => /* @__PURE__ */ r(t, {
|
|
36
|
+
variant: e.variant,
|
|
37
|
+
duration: e.duration,
|
|
38
|
+
onClose: () => _(e.id),
|
|
39
|
+
children: e.content
|
|
40
|
+
}, e.id))
|
|
32
41
|
})]
|
|
33
42
|
});
|
|
34
43
|
}
|
|
35
44
|
//#endregion
|
|
36
|
-
export {
|
|
45
|
+
export { u as default, l as toastPlacements };
|
package/dist/css/toast.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* haze-ui toast — generated by scripts/split-css.mjs, do not edit */
|
|
2
|
-
.haze-Toast__base{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:var(--haze-space-3);padding:var(--haze-space-3) var(--haze-space-4);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);line-height:var(--haze-leading-normal);box-shadow:var(--haze-shadow-lg);pointer-events:auto;animation:.2s ease-out toastIn-haze-Toast__base;display:flex}@keyframes toastIn-haze-Toast__base{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.haze-Toast__info{background:var(--haze-color-bg);color:var(--haze-color-text);border:1px solid var(--haze-color-border)}.haze-Toast__success{background:color-mix(in srgb, var(--haze-color-success) 10%, var(--haze-color-bg));color:var(--haze-color-
|
|
3
|
-
.haze-
|
|
2
|
+
.haze-Toast__base{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:var(--haze-space-3);padding:var(--haze-space-3) var(--haze-space-4);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);line-height:var(--haze-leading-normal);box-shadow:var(--haze-shadow-lg);pointer-events:auto;animation:.2s ease-out toastIn-haze-Toast__base;display:flex}@keyframes toastIn-haze-Toast__base{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.haze-Toast__info{background:var(--haze-color-bg);color:var(--haze-color-text);border:1px solid var(--haze-color-border)}.haze-Toast__success{background:color-mix(in srgb, var(--haze-color-success) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-success) 25%, transparent)}.haze-Toast__warning{background:color-mix(in srgb, var(--haze-color-warning) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-warning) 25%, transparent)}.haze-Toast__danger{background:color-mix(in srgb, var(--haze-color-danger) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-danger) 25%, transparent)}.haze-Toast__contentStyle{flex:1}.haze-Toast__closeBtn{appearance:none;color:inherit;cursor:pointer;font-size:var(--haze-text-lg);opacity:.6;background:0 0;border:none;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:0;line-height:1;transition:opacity .15s;display:inline-flex}.haze-Toast__closeBtn:hover{opacity:1}
|
|
3
|
+
.haze-ToastContainer__containerBase{z-index:9999;gap:var(--haze-space-2);pointer-events:none;flex-direction:column;display:flex;position:fixed}.haze-ToastContainer__top-left{top:calc(var(--haze-space-4) + env(safe-area-inset-top));left:calc(var(--haze-space-4) + env(safe-area-inset-left))}.haze-ToastContainer__top-right{top:calc(var(--haze-space-4) + env(safe-area-inset-top));right:calc(var(--haze-space-4) + env(safe-area-inset-right))}.haze-ToastContainer__bottom-left{bottom:calc(var(--haze-space-4) + env(safe-area-inset-bottom));left:calc(var(--haze-space-4) + env(safe-area-inset-left))}.haze-ToastContainer__bottom-right{bottom:calc(var(--haze-space-4) + env(safe-area-inset-bottom));right:calc(var(--haze-space-4) + env(safe-area-inset-right))}
|
package/dist/form/FormItem.js
CHANGED
|
@@ -36,12 +36,12 @@ function c({ form: c, name: l, label: u, validate: d, mode: f, validateDebounce:
|
|
|
36
36
|
...S ? S(D) : { value: D },
|
|
37
37
|
children: C
|
|
38
38
|
}) : v ? /* @__PURE__ */ t(v, {
|
|
39
|
+
...y,
|
|
39
40
|
id: T,
|
|
40
41
|
"aria-invalid": j || void 0,
|
|
41
42
|
"aria-describedby": j ? E : void 0,
|
|
42
43
|
onBlur: k,
|
|
43
44
|
onChange: (e) => O(N(e)),
|
|
44
|
-
...y,
|
|
45
45
|
...S ? S(D) : { value: D }
|
|
46
46
|
}) : C({
|
|
47
47
|
id: T,
|
package/dist/haze-ui.css
CHANGED
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
.haze-ThinkingIndicator__wrapper{align-items:center;gap:var(--haze-space-2);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);color:var(--haze-color-text-muted);padding:var(--haze-space-2) 0;display:inline-flex}.haze-ThinkingIndicator__dots{gap:var(--haze-space-1);display:inline-flex}@keyframes bounce-haze-ThinkingIndicator__dots{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-.375rem)}}.haze-ThinkingIndicator__dot{border-radius:var(--haze-radius-full);background:var(--haze-color-text-muted);width:.375rem;height:.375rem;animation:1.4s ease-in-out infinite bounce}.haze-ThinkingIndicator__dot2{animation-delay:.16s}.haze-ThinkingIndicator__dot3{animation-delay:.32s}
|
|
116
116
|
.haze-TimePickerCore__input{width:100%;padding:var(--haze-space-2) var(--haze-space-3);border:1px solid var(--haze-color-border);border-radius:var(--haze-radius-md);background:var(--haze-color-bg);color:var(--haze-color-text);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);outline:none;transition:border-color .15s,box-shadow .15s}.haze-TimePickerCore__input:focus{border-color:var(--haze-color-primary);box-shadow:0 0 0 3px var(--haze-color-focus-ring)}.haze-TimePickerCore__input:disabled{opacity:.5;cursor:not-allowed}.haze-TimePickerCore__input::-webkit-input-placeholder{color:var(--haze-color-text-muted)}.haze-TimePickerCore__input::placeholder{color:var(--haze-color-text-muted)}.haze-TimePickerCore__input:-ms-placeholder-shown{color:var(--haze-color-text-muted)}.haze-TimePickerCore__input::placeholder{color:var(--haze-color-text-muted)}
|
|
117
117
|
.haze-Timeline__base{font-family:var(--haze-font-sans);flex-direction:column;display:flex}.haze-Timeline__item{gap:var(--haze-space-3);padding-bottom:var(--haze-space-6);display:flex;position:relative}.haze-Timeline__item:last-child{padding-bottom:0}.haze-Timeline__dotWrapper{flex-direction:column;flex-shrink:0;align-items:center;display:flex}.haze-Timeline__dot{border-radius:var(--haze-radius-full);background:var(--haze-color-border);z-index:1;flex-shrink:0;width:12px;height:12px}.haze-Timeline__primary{background:var(--haze-color-primary)}.haze-Timeline__success{background:var(--haze-color-success)}.haze-Timeline__warning{background:var(--haze-color-warning)}.haze-Timeline__danger{background:var(--haze-color-danger)}.haze-Timeline__line{background:var(--haze-color-border);width:2px;margin-top:var(--haze-space-1);flex:1}.haze-Timeline__content{flex:1;min-width:0}.haze-Timeline__titleStyle{font-size:var(--haze-text-sm);font-weight:var(--haze-weight-medium);color:var(--haze-color-text)}.haze-Timeline__descStyle,.haze-Timeline__timeStyle{font-size:var(--haze-text-xs);color:var(--haze-color-text-muted);margin-top:var(--haze-space-1)}
|
|
118
|
-
.haze-Toast__base{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:var(--haze-space-3);padding:var(--haze-space-3) var(--haze-space-4);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);line-height:var(--haze-leading-normal);box-shadow:var(--haze-shadow-lg);pointer-events:auto;animation:.2s ease-out toastIn-haze-Toast__base;display:flex}@keyframes toastIn-haze-Toast__base{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.haze-Toast__info{background:var(--haze-color-bg);color:var(--haze-color-text);border:1px solid var(--haze-color-border)}.haze-Toast__success{background:color-mix(in srgb, var(--haze-color-success) 10%, var(--haze-color-bg));color:var(--haze-color-
|
|
119
|
-
.haze-
|
|
118
|
+
.haze-Toast__base{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:var(--haze-space-3);padding:var(--haze-space-3) var(--haze-space-4);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);line-height:var(--haze-leading-normal);box-shadow:var(--haze-shadow-lg);pointer-events:auto;animation:.2s ease-out toastIn-haze-Toast__base;display:flex}@keyframes toastIn-haze-Toast__base{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.haze-Toast__info{background:var(--haze-color-bg);color:var(--haze-color-text);border:1px solid var(--haze-color-border)}.haze-Toast__success{background:color-mix(in srgb, var(--haze-color-success) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-success) 25%, transparent)}.haze-Toast__warning{background:color-mix(in srgb, var(--haze-color-warning) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-warning) 25%, transparent)}.haze-Toast__danger{background:color-mix(in srgb, var(--haze-color-danger) 10%, var(--haze-color-bg));color:var(--haze-color-text);border:1px solid color-mix(in srgb, var(--haze-color-danger) 25%, transparent)}.haze-Toast__contentStyle{flex:1}.haze-Toast__closeBtn{appearance:none;color:inherit;cursor:pointer;font-size:var(--haze-text-lg);opacity:.6;background:0 0;border:none;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:0;line-height:1;transition:opacity .15s;display:inline-flex}.haze-Toast__closeBtn:hover{opacity:1}
|
|
119
|
+
.haze-ToastContainer__containerBase{z-index:9999;gap:var(--haze-space-2);pointer-events:none;flex-direction:column;display:flex;position:fixed}.haze-ToastContainer__top-left{top:calc(var(--haze-space-4) + env(safe-area-inset-top));left:calc(var(--haze-space-4) + env(safe-area-inset-left))}.haze-ToastContainer__top-right{top:calc(var(--haze-space-4) + env(safe-area-inset-top));right:calc(var(--haze-space-4) + env(safe-area-inset-right))}.haze-ToastContainer__bottom-left{bottom:calc(var(--haze-space-4) + env(safe-area-inset-bottom));left:calc(var(--haze-space-4) + env(safe-area-inset-left))}.haze-ToastContainer__bottom-right{bottom:calc(var(--haze-space-4) + env(safe-area-inset-bottom));right:calc(var(--haze-space-4) + env(safe-area-inset-right))}
|
|
120
120
|
.haze-TokenCounter__wrapper{font-family:var(--haze-font-sans);font-size:var(--haze-text-xs);color:var(--haze-color-text-muted)}.haze-TokenCounter__bar{background:var(--haze-color-muted);border-radius:var(--haze-radius-full);height:.25rem;margin-top:var(--haze-space-1);overflow:hidden}.haze-TokenCounter__fill{border-radius:var(--haze-radius-full);height:100%;transition:width .3s}.haze-TokenCounter__fillNormal{background:var(--haze-color-primary)}.haze-TokenCounter__fillWarning{background:var(--haze-color-warning,#eab308)}.haze-TokenCounter__fillDanger{background:var(--haze-color-danger,#dc2626)}.haze-TokenCounter__info{-webkit-box-pack:justify;-ms-flex-pack:space-between;justify-content:space-between;align-items:baseline;display:flex}.haze-TokenCounter__count{font-variant-numeric:tabular-nums}
|
|
121
121
|
.haze-ToolCallCard__card{border:1px solid var(--haze-color-border);border-radius:var(--haze-radius-md);font-family:var(--haze-font-sans);font-size:var(--haze-text-sm);overflow:hidden}.haze-ToolCallCard__header{align-items:center;gap:var(--haze-space-2);padding:var(--haze-space-2) var(--haze-space-3);background:var(--haze-color-muted);font-family:var(--haze-font-mono);font-size:var(--haze-text-xs);display:flex}.haze-ToolCallCard__statusIcon{border-radius:var(--haze-radius-full);flex-shrink:0;width:.5rem;height:.5rem}.haze-ToolCallCard__statusPending{background:var(--haze-color-text-muted)}.haze-ToolCallCard__statusRunning{background:var(--haze-color-primary);animation:1.5s infinite pulse}.haze-ToolCallCard__statusDone{background:var(--haze-color-success,#16a34a)}.haze-ToolCallCard__statusError{background:var(--haze-color-danger,#dc2626)}.haze-ToolCallCard__body{padding:var(--haze-space-3)}.haze-ToolCallCard__section{margin-bottom:var(--haze-space-2)}.haze-ToolCallCard__sectionLabel{font-size:var(--haze-text-xs);color:var(--haze-color-text-muted);margin-bottom:var(--haze-space-1);text-transform:uppercase;letter-spacing:.05em}.haze-ToolCallCard__content{font-family:var(--haze-font-mono);font-size:var(--haze-text-xs);white-space:pre-wrap;word-break:break-all;color:var(--haze-color-text)}
|
|
122
122
|
.haze-Tooltip__wrapper{display:inline-flex;position:relative}.haze-Tooltip__bubble{padding:var(--haze-space-1) var(--haze-space-2);border-radius:var(--haze-radius-md);background:var(--haze-color-text);color:var(--haze-color-text-inverse);font-family:var(--haze-font-sans);font-size:var(--haze-text-xs);line-height:var(--haze-leading-normal);white-space:nowrap;pointer-events:none}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
type ToastPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
2
3
|
type ToastContainerProps = {
|
|
3
4
|
children: ReactNode;
|
|
5
|
+
/** Max simultaneous toasts; the oldest one is dropped on overflow. */
|
|
6
|
+
maxCount?: number;
|
|
7
|
+
/** Viewport edge the stack is pinned to. */
|
|
8
|
+
placement?: ToastPlacement;
|
|
4
9
|
};
|
|
5
|
-
export
|
|
6
|
-
|
|
10
|
+
export declare const toastPlacements: {
|
|
11
|
+
readonly 'top-left': import("@linaria/core").LinariaClassName;
|
|
12
|
+
readonly 'top-right': import("@linaria/core").LinariaClassName;
|
|
13
|
+
readonly 'bottom-left': import("@linaria/core").LinariaClassName;
|
|
14
|
+
readonly 'bottom-right': import("@linaria/core").LinariaClassName;
|
|
15
|
+
};
|
|
16
|
+
export default function ToastContainer({ children, maxCount, placement, }: ToastContainerProps): import("react").JSX.Element;
|
|
17
|
+
export type { ToastContainerProps, ToastPlacement };
|
|
@@ -49,8 +49,9 @@ export type FormItemAsProps = {
|
|
|
49
49
|
* precedence over the children render-prop. */
|
|
50
50
|
as?: ComponentType<any>;
|
|
51
51
|
/** Extra props spread onto the `as` component. They land before the
|
|
52
|
-
* value props, so `
|
|
53
|
-
*
|
|
52
|
+
* bridge wiring and the value props, so `id`, `aria-*`, `onBlur`,
|
|
53
|
+
* `onChange` and `value`/`valueToProps` win conflicts — the same
|
|
54
|
+
* precedence as the input channel and react-f0rm's `Field`. */
|
|
54
55
|
asProps?: Record<string, any>;
|
|
55
56
|
/** Converts what the control passes to its `onChange` into the field
|
|
56
57
|
* value. Defaults to identity — haze cores' `onChange` emits the next
|
|
@@ -65,6 +65,19 @@ export type FloatingBehavior = {
|
|
|
65
65
|
export declare function useFloating({ open, setOpen, triggerRef, panelRef, }: UseFloatingOptions): FloatingBehavior;
|
|
66
66
|
/** x-class entries placing the panel relative to the trigger, per tier. */
|
|
67
67
|
export declare function floatingPlacementClasses(behavior: Pick<FloatingBehavior, 'native' | 'anchored'>, placement: FloatingPlacement): (string | false)[];
|
|
68
|
+
/**
|
|
69
|
+
* Place a fixed panel from the trigger's rect (tier 2). Centers compute
|
|
70
|
+
* from the panel's own rect, so this needs layout — fine in real engines,
|
|
71
|
+
* and unreachable in jsdom where the fallback tier renders instead.
|
|
72
|
+
*
|
|
73
|
+
* Viewport awareness: a placement that would push the panel past the
|
|
74
|
+
* viewport edge flips to the opposite side when that side has room for
|
|
75
|
+
* it (bottom↔top, left↔right — the secondary-axis alignment stays as
|
|
76
|
+
* chosen); when neither side fits, the position is clamped into the
|
|
77
|
+
* viewport instead. Exported for direct testing like
|
|
78
|
+
* `supportsNativePopover` above.
|
|
79
|
+
*/
|
|
80
|
+
export declare function placeFloatingPanel(panel: HTMLElement, trigger: HTMLElement, placement: FloatingPlacement): void;
|
|
68
81
|
/**
|
|
69
82
|
* Tier 2 positioning: place the panel under/over/beside the trigger and
|
|
70
83
|
* re-place on scroll/resize while open. No-op on the anchored and
|
package/dist/utils/floating.js
CHANGED
|
@@ -113,28 +113,50 @@ function L(e, t) {
|
|
|
113
113
|
}
|
|
114
114
|
function R(e, t, n) {
|
|
115
115
|
if (n === "point") return;
|
|
116
|
-
let r = t.getBoundingClientRect(), i = e.getBoundingClientRect(), a =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
let r = t.getBoundingClientRect(), i = e.getBoundingClientRect(), a = {
|
|
117
|
+
width: window.innerWidth,
|
|
118
|
+
height: window.innerHeight
|
|
119
|
+
}, o = r.left + r.width / 2 - i.width / 2, s = r.top + r.height / 2 - i.height / 2, c = {
|
|
120
|
+
below: L(e, "marginTop"),
|
|
121
|
+
above: L(e, "marginBottom"),
|
|
122
|
+
after: L(e, "marginLeft"),
|
|
123
|
+
before: L(e, "marginRight")
|
|
124
|
+
}, l = (e, t) => ({
|
|
125
|
+
top: e === "bottom" ? r.bottom + c.below : r.top - i.height - c.above,
|
|
126
|
+
left: t === "start" ? r.left : t === "end" ? r.right - i.width : o
|
|
127
|
+
}), u = (e) => ({
|
|
128
|
+
top: s,
|
|
129
|
+
left: e === "right" ? r.right + c.after : r.left - i.width - c.before
|
|
130
|
+
}), d = {
|
|
131
|
+
bottom: {
|
|
132
|
+
side: "bottom",
|
|
133
|
+
align: "start"
|
|
134
|
+
},
|
|
135
|
+
"bottom-span": {
|
|
136
|
+
side: "bottom",
|
|
137
|
+
align: "start"
|
|
138
|
+
},
|
|
139
|
+
"bottom-center": {
|
|
140
|
+
side: "bottom",
|
|
141
|
+
align: "center"
|
|
142
|
+
},
|
|
143
|
+
"bottom-end": {
|
|
144
|
+
side: "bottom",
|
|
145
|
+
align: "end"
|
|
146
|
+
},
|
|
147
|
+
top: {
|
|
148
|
+
side: "top",
|
|
149
|
+
align: "center"
|
|
150
|
+
}
|
|
151
|
+
}, { top: f, left: p } = n === "left" || n === "right" ? u(n) : l(d[n].side, d[n].align);
|
|
152
|
+
if (n === "left" || n === "right") {
|
|
153
|
+
let e = n === "right" ? p + i.width > a.width : p < 0, t = n === "right" ? r.left - i.width - c.before >= 0 : r.right + i.width + c.after <= a.width;
|
|
154
|
+
e && t && ({top: f, left: p} = u(n === "right" ? "left" : "right"));
|
|
155
|
+
} else {
|
|
156
|
+
let { side: e, align: t } = d[n], o = e === "bottom" ? f + i.height > a.height : f < 0, s = e === "bottom" ? r.top - i.height - c.above >= 0 : r.bottom + i.height + c.below <= a.height;
|
|
157
|
+
o && s && ({top: f, left: p} = l(e === "bottom" ? "top" : "bottom", t));
|
|
137
158
|
}
|
|
159
|
+
f = Math.min(Math.max(f, 0), Math.max(0, a.height - i.height)), p = Math.min(Math.max(p, 0), Math.max(0, a.width - i.width)), e.style.top = `${f}px`, e.style.left = `${p}px`;
|
|
138
160
|
}
|
|
139
161
|
function z({ behavior: e, placement: t }) {
|
|
140
162
|
let { native: n, anchored: i, open: a, triggerRef: o, panelRef: s } = e;
|
|
@@ -178,4 +200,4 @@ function B({ behavior: n, placement: r, visualClass: i, className: a, style: o,
|
|
|
178
200
|
});
|
|
179
201
|
}
|
|
180
202
|
//#endregion
|
|
181
|
-
export { B as FloatingPanel, I as floatingPlacementClasses, l as supportsAnchorPositioning, c as supportsNativePopover, F as useFloating, z as useFloatingPosition };
|
|
203
|
+
export { B as FloatingPanel, I as floatingPlacementClasses, R as placeFloatingPanel, l as supportsAnchorPositioning, c as supportsNativePopover, F as useFloating, z as useFloatingPosition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "haze-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React UI component library powered by react-use-control and Linaria",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,6 +12,21 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./components/*": {
|
|
16
|
+
"types": "./dist/types/components/*/index.d.ts",
|
|
17
|
+
"import": "./dist/components/*/index.js",
|
|
18
|
+
"default": "./dist/components/*/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./form": {
|
|
21
|
+
"types": "./dist/types/form/index.d.ts",
|
|
22
|
+
"import": "./dist/form/index.js",
|
|
23
|
+
"default": "./dist/form/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./tokens": {
|
|
26
|
+
"types": "./dist/types/tokens/index.d.ts",
|
|
27
|
+
"import": "./dist/tokens/index.js",
|
|
28
|
+
"default": "./dist/tokens/index.js"
|
|
29
|
+
},
|
|
15
30
|
"./styles.css": "./dist/haze-ui.css",
|
|
16
31
|
"./css/*": "./dist/css/*"
|
|
17
32
|
},
|
|
@@ -59,6 +74,7 @@
|
|
|
59
74
|
"react-use-control": "^1.5.0"
|
|
60
75
|
},
|
|
61
76
|
"devDependencies": {
|
|
77
|
+
"@axe-core/playwright": "^4.13.0",
|
|
62
78
|
"@babel/core": "^8.0.1",
|
|
63
79
|
"@babel/preset-env": "^8.0.2",
|
|
64
80
|
"@babel/preset-typescript": "^8.0.1",
|