haze-ui 1.23.0 → 1.24.1
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/BottomSheet/BottomSheet.js +33 -16
- package/dist/components/ChatInput/ChatInput.js +1 -1
- package/dist/components/Collapsible/Collapsible.js +34 -27
- package/dist/components/Combobox/Combobox.js +37 -38
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/ConfirmDialog/ConfirmDialog.js +60 -42
- package/dist/components/ContextMenu/ContextMenu.js +2 -1
- package/dist/components/ContextMenu/ContextMenuContent.js +33 -23
- package/dist/components/Datepicker/DatepickerCore.js +2 -1
- package/dist/components/Dialog/Dialog.js +40 -21
- package/dist/components/Drawer/Drawer.js +37 -18
- package/dist/components/DropdownMenu/DropdownMenu.js +27 -25
- package/dist/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/components/Menu/Menu.js +43 -35
- package/dist/components/Popover/Popover.js +27 -25
- package/dist/components/StreamingText/StreamingText.js +11 -12
- package/dist/components/TagInput/TagInputCore.js +1 -1
- package/dist/components/Toast/Toast.js +25 -20
- package/dist/components/Toast/ToastContainer.js +31 -24
- package/dist/components/Tooltip/Tooltip.js +37 -34
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/collapsible.css +1 -1
- package/dist/css/combobox.css +1 -1
- package/dist/css/confirm-dialog.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/datepicker.css +1 -1
- package/dist/css/dialog.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/toast.css +1 -1
- package/dist/css/tokens.css +1 -0
- package/dist/css/tool-call-card.css +1 -1
- package/dist/css/tooltip.css +1 -1
- package/dist/haze-ui.css +15 -14
- package/dist/tokens/index.js +2 -1
- package/dist/tokens/motion.js +6 -0
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +3 -3
- package/dist/types/components/Collapsible/Collapsible.d.ts +1 -1
- package/dist/types/components/ConfirmDialog/ConfirmDialog.d.ts +3 -3
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +7 -1
- package/dist/types/components/Popover/Popover.d.ts +7 -1
- package/dist/types/components/Toast/Toast.d.ts +3 -3
- package/dist/types/components/Tooltip/Tooltip.d.ts +4 -1
- package/dist/types/tokens/index.d.ts +1 -0
- package/dist/types/tokens/motion.d.ts +1 -0
- package/dist/types/utils/collision.d.ts +62 -0
- package/dist/types/utils/floating.d.ts +95 -19
- package/dist/types/utils/focus-scope.d.ts +25 -0
- package/dist/types/utils/focus.d.ts +23 -0
- package/dist/types/utils/presence.d.ts +22 -0
- package/dist/utils/collision.js +73 -0
- package/dist/utils/floating.js +193 -150
- package/dist/utils/focus-scope.js +63 -0
- package/dist/utils/focus.js +34 -0
- package/dist/utils/presence.js +72 -0
- package/package.json +17 -17
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useFocusScope as t } from "../../utils/focus-scope.js";
|
|
4
|
+
import { Presence as n } from "../../utils/presence.js";
|
|
3
5
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useControl as
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { useControl as a } from "react-use-control";
|
|
6
8
|
//#region src/lib/components/BottomSheet/BottomSheet.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
var o = "haze-BottomSheet__overlay", s = "haze-BottomSheet__sheet", c = "haze-BottomSheet__handle";
|
|
10
|
+
function l({ open: l, onClose: u, children: d, className: f, ...p }) {
|
|
11
|
+
let [m, h] = a(l, !1), g = t({
|
|
12
|
+
enabled: m,
|
|
13
|
+
trapped: !0
|
|
14
|
+
}), _ = () => {
|
|
15
|
+
h(!1), u?.();
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ r(n, {
|
|
18
|
+
present: m,
|
|
19
|
+
children: r("div", {
|
|
20
|
+
onClick: () => {
|
|
21
|
+
m && _();
|
|
22
|
+
},
|
|
23
|
+
onKeyDown: (e) => {
|
|
24
|
+
e.key === "Escape" && m && _();
|
|
25
|
+
},
|
|
26
|
+
className: e([o, f]),
|
|
27
|
+
children: /* @__PURE__ */ i("div", {
|
|
28
|
+
ref: g,
|
|
29
|
+
role: "dialog",
|
|
30
|
+
"aria-modal": "true",
|
|
31
|
+
...p,
|
|
32
|
+
onClick: (e) => e.stopPropagation(),
|
|
33
|
+
className: e([s]),
|
|
34
|
+
children: [/* @__PURE__ */ r("div", { className: e([c]) }), d]
|
|
35
|
+
})
|
|
19
36
|
})
|
|
20
|
-
})
|
|
37
|
+
});
|
|
21
38
|
}
|
|
22
39
|
//#endregion
|
|
23
|
-
export {
|
|
40
|
+
export { l as default };
|
|
@@ -9,7 +9,7 @@ var o = "haze-ChatInput__wrapper", s = "haze-ChatInput__textarea", c = "haze-Cha
|
|
|
9
9
|
function l({ value: l, onSend: u, placeholder: d = "Type a message...", disabled: f, maxLength: p, className: m }) {
|
|
10
10
|
let [h, g] = a(l, ""), _ = i(null), v = r(() => {
|
|
11
11
|
let e = h.trim();
|
|
12
|
-
|
|
12
|
+
e && !f && (u?.(e), g(""), _.current && (_.current.style.height = "auto"));
|
|
13
13
|
}, [
|
|
14
14
|
h,
|
|
15
15
|
f,
|
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { Presence as t } from "../../utils/presence.js";
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { useControl as
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { createContext as r, useContext as i } from "react";
|
|
7
|
+
import { useControl as a } from "react-use-control";
|
|
7
8
|
//#region src/lib/components/Collapsible/Collapsible.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let e =
|
|
9
|
+
var o = r(void 0);
|
|
10
|
+
function s() {
|
|
11
|
+
let e = i(o);
|
|
11
12
|
if (!e) throw Error("Collapsible sub-components must be used within <Collapsible>");
|
|
12
13
|
return e;
|
|
13
14
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
let [l, u] =
|
|
17
|
-
return /* @__PURE__ */
|
|
15
|
+
var c = "haze-Collapsible__base";
|
|
16
|
+
function l({ open: t, defaultOpen: r = !1, children: i, className: s }) {
|
|
17
|
+
let [l, u] = a(t, r);
|
|
18
|
+
return /* @__PURE__ */ n(o.Provider, {
|
|
18
19
|
value: {
|
|
19
20
|
open: l,
|
|
20
21
|
toggle: () => u((e) => !e)
|
|
21
22
|
},
|
|
22
|
-
children:
|
|
23
|
-
className: e([
|
|
24
|
-
children:
|
|
23
|
+
children: n("div", {
|
|
24
|
+
className: e([c, s]),
|
|
25
|
+
children: i
|
|
25
26
|
})
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
let { toggle: i } =
|
|
31
|
-
return /* @__PURE__ */
|
|
29
|
+
var u = "haze-Collapsible__triggerStyle";
|
|
30
|
+
function d({ children: t, className: r }) {
|
|
31
|
+
let { toggle: i } = s();
|
|
32
|
+
return /* @__PURE__ */ n("button", {
|
|
32
33
|
type: "button",
|
|
33
34
|
onClick: i,
|
|
34
|
-
className: e([
|
|
35
|
-
children:
|
|
35
|
+
className: e([u, r]),
|
|
36
|
+
children: t
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
var
|
|
39
|
-
function
|
|
40
|
-
let { open:
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
children: n
|
|
44
|
-
|
|
39
|
+
var f = "haze-Collapsible__contentOuter", p = "haze-Collapsible__contentInner";
|
|
40
|
+
function m({ children: r, className: i }) {
|
|
41
|
+
let { open: a } = s();
|
|
42
|
+
return /* @__PURE__ */ n(t, {
|
|
43
|
+
present: a,
|
|
44
|
+
children: n("div", {
|
|
45
|
+
className: e([f, i]),
|
|
46
|
+
children: /* @__PURE__ */ n("div", {
|
|
47
|
+
className: e(p),
|
|
48
|
+
children: r
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
});
|
|
45
52
|
}
|
|
46
53
|
//#endregion
|
|
47
|
-
export {
|
|
54
|
+
export { l as Collapsible, m as CollapsibleContent, d as CollapsibleTrigger };
|
|
@@ -4,61 +4,60 @@ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
|
|
|
4
4
|
import r from "./ComboboxOption.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import { useControl as
|
|
7
|
+
import { useId as o, useRef as s, useState as c } from "react";
|
|
8
|
+
import { useControl as l } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/Combobox/Combobox.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
open:
|
|
14
|
-
setOpen:
|
|
15
|
-
triggerRef:
|
|
16
|
-
panelRef:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
S(t), w(!1), O.current?.focus();
|
|
10
|
+
var u = "haze-Combobox__wrapper", d = "haze-Combobox__input", f = "haze-Combobox__listbox";
|
|
11
|
+
function p({ value: p, open: m, options: h, placeholder: g, className: _ }) {
|
|
12
|
+
let [v, y] = l(p, ""), [b, x] = c(""), [S, C] = l(m, !1), [w, T] = c(-1), [E, D] = c(b), O = o(), k = s(null), A = s(null), j = n({
|
|
13
|
+
open: S,
|
|
14
|
+
setOpen: C,
|
|
15
|
+
triggerRef: k,
|
|
16
|
+
panelRef: A,
|
|
17
|
+
animated: !0
|
|
18
|
+
}), M = h.filter((e) => e.label.toLowerCase().includes(b.toLowerCase()));
|
|
19
|
+
b !== E && (D(b), T(-1));
|
|
20
|
+
let N = (e) => {
|
|
21
|
+
y(e);
|
|
22
|
+
let t = h.find((t) => t.value === e)?.label ?? e;
|
|
23
|
+
x(t), C(!1), k.current?.focus();
|
|
25
24
|
};
|
|
26
25
|
return /* @__PURE__ */ a("div", {
|
|
27
|
-
className: e([
|
|
26
|
+
className: e([u, _]),
|
|
28
27
|
children: [/* @__PURE__ */ i("input", {
|
|
29
|
-
ref:
|
|
28
|
+
ref: k,
|
|
30
29
|
role: "combobox",
|
|
31
|
-
style:
|
|
32
|
-
"aria-expanded":
|
|
33
|
-
"aria-controls":
|
|
30
|
+
style: j.triggerStyle,
|
|
31
|
+
"aria-expanded": S,
|
|
32
|
+
"aria-controls": O,
|
|
34
33
|
"aria-autocomplete": "list",
|
|
35
|
-
className:
|
|
36
|
-
value:
|
|
37
|
-
placeholder:
|
|
34
|
+
className: d,
|
|
35
|
+
value: b,
|
|
36
|
+
placeholder: g,
|
|
38
37
|
onChange: (e) => {
|
|
39
|
-
|
|
38
|
+
x(e.target.value), C(!0);
|
|
40
39
|
},
|
|
41
|
-
onFocus: () =>
|
|
42
|
-
onClick: () =>
|
|
40
|
+
onFocus: () => C(!0),
|
|
41
|
+
onClick: () => C(!0),
|
|
43
42
|
onKeyDown: (e) => {
|
|
44
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
43
|
+
e.key === "ArrowDown" ? (e.preventDefault(), T((e) => Math.min(e + 1, M.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), T((e) => Math.max(e - 1, 0))) : e.key === "Enter" && w >= 0 && M[w] ? (e.preventDefault(), N(M[w].value)) : e.key === "Escape" && C(!1);
|
|
45
44
|
}
|
|
46
45
|
}), /* @__PURE__ */ i(t, {
|
|
47
|
-
ref:
|
|
48
|
-
behavior:
|
|
46
|
+
ref: A,
|
|
47
|
+
behavior: j,
|
|
49
48
|
placement: "bottom-span",
|
|
50
|
-
id:
|
|
49
|
+
id: O,
|
|
51
50
|
role: "listbox",
|
|
52
|
-
visualClass:
|
|
53
|
-
children:
|
|
51
|
+
visualClass: f,
|
|
52
|
+
children: M.map((e, t) => /* @__PURE__ */ i(r, {
|
|
54
53
|
value: e.value,
|
|
55
|
-
highlighted: t ===
|
|
56
|
-
selected: e.value ===
|
|
57
|
-
onSelect:
|
|
54
|
+
highlighted: t === w,
|
|
55
|
+
selected: e.value === v,
|
|
56
|
+
onSelect: N,
|
|
58
57
|
children: e.label
|
|
59
58
|
}, e.value))
|
|
60
59
|
})]
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
//#endregion
|
|
64
|
-
export {
|
|
63
|
+
export { p as default };
|
|
@@ -79,7 +79,7 @@ function y({ children: t, className: a }) {
|
|
|
79
79
|
var b = "haze-Command__itemStyle";
|
|
80
80
|
function x({ children: t, className: n, onSelect: r }) {
|
|
81
81
|
let { query: a } = p();
|
|
82
|
-
return
|
|
82
|
+
return a && !(typeof t == "string" ? t : "").toLowerCase().includes(a.toLowerCase()) ? null : /* @__PURE__ */ i("div", {
|
|
83
83
|
role: "option",
|
|
84
84
|
tabIndex: -1,
|
|
85
85
|
onClick: r,
|
|
@@ -88,7 +88,7 @@ function x({ children: t, className: n, onSelect: r }) {
|
|
|
88
88
|
},
|
|
89
89
|
className: e([b, n]),
|
|
90
90
|
children: t
|
|
91
|
-
})
|
|
91
|
+
});
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
94
|
export { _ as CommandInput, x as CommandItem, y as CommandList, h as default };
|
|
@@ -1,52 +1,70 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useFocusScope as t } from "../../utils/focus-scope.js";
|
|
4
|
+
import { Presence as n } from "../../utils/presence.js";
|
|
3
5
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import {
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { useId as a } from "react";
|
|
8
|
+
import { useControl as o } from "react-use-control";
|
|
6
9
|
//#region src/lib/components/ConfirmDialog/ConfirmDialog.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var s = "haze-ConfirmDialog__overlay", c = "haze-ConfirmDialog__dialog", l = "haze-ConfirmDialog__header", u = "haze-ConfirmDialog__body", d = "haze-ConfirmDialog__footer", f = "haze-ConfirmDialog__btn", p = "haze-ConfirmDialog__cancelBtn", m = "haze-ConfirmDialog__confirmBtn", h = "haze-ConfirmDialog__dangerBtn";
|
|
11
|
+
function g({ open: g, onClose: _, onConfirm: v, onCancel: y, title: b, children: x, confirmText: S = "Confirm", cancelText: C = "Cancel", variant: w = "default", className: T, ...E }) {
|
|
12
|
+
let [D, O] = o(g, !1), k = t({
|
|
13
|
+
enabled: D,
|
|
14
|
+
trapped: !0
|
|
15
|
+
}), A = `haze-confirm-title-${a()}`, j = () => {
|
|
16
|
+
O(!1), _?.();
|
|
17
|
+
}, M = () => {
|
|
18
|
+
y?.(), j();
|
|
19
|
+
}, N = () => {
|
|
20
|
+
v?.(), j();
|
|
13
21
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className: e([l, u]),
|
|
22
|
+
return /* @__PURE__ */ r(n, {
|
|
23
|
+
present: D,
|
|
24
|
+
children: r("div", {
|
|
25
|
+
onClick: () => {
|
|
26
|
+
D && j();
|
|
27
|
+
},
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
e.key === "Escape" && D && j();
|
|
30
|
+
},
|
|
31
|
+
className: e([s, T]),
|
|
32
|
+
children: /* @__PURE__ */ i("div", {
|
|
33
|
+
ref: k,
|
|
34
|
+
role: "dialog",
|
|
35
|
+
"aria-modal": "true",
|
|
36
|
+
"aria-labelledby": b === void 0 ? void 0 : A,
|
|
37
|
+
...E,
|
|
38
|
+
onClick: (e) => e.stopPropagation(),
|
|
39
|
+
className: e([c]),
|
|
40
|
+
children: [
|
|
41
|
+
b && /* @__PURE__ */ r("div", {
|
|
42
|
+
id: A,
|
|
43
|
+
className: e([l]),
|
|
37
44
|
children: b
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ r("div", {
|
|
47
|
+
className: e([u]),
|
|
48
|
+
children: x
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ i("div", {
|
|
51
|
+
className: e([d]),
|
|
52
|
+
children: [/* @__PURE__ */ r("button", {
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: M,
|
|
55
|
+
className: e([f, p]),
|
|
56
|
+
children: C
|
|
57
|
+
}), /* @__PURE__ */ r("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
onClick: N,
|
|
60
|
+
className: e([f, w === "danger" ? h : m]),
|
|
61
|
+
children: S
|
|
62
|
+
})]
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
48
66
|
})
|
|
49
67
|
});
|
|
50
68
|
}
|
|
51
69
|
//#endregion
|
|
52
|
-
export {
|
|
70
|
+
export { g as default };
|
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useFocusScope as e } from "../../utils/focus-scope.js";
|
|
3
|
+
import { FloatingPanel as t } from "../../utils/floating.js";
|
|
4
|
+
import { useMenuKeyboard as n, useRovingTabindex as r } from "../../utils/menuKeyboard.js";
|
|
5
|
+
import { useContextMenuContext as i } from "./ContextMenuContext.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import { jsx as
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as o } from "react";
|
|
7
9
|
//#region src/lib/components/ContextMenu/ContextMenuContent.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let { open:
|
|
11
|
-
menuRef:
|
|
12
|
-
onClose: () =>
|
|
10
|
+
var s = "haze-ContextMenuContent__content";
|
|
11
|
+
function c({ children: c, className: l }) {
|
|
12
|
+
let { open: u, setOpen: d, x: f, y: p, contentRef: m, floating: h } = i(), g = n({
|
|
13
|
+
menuRef: m,
|
|
14
|
+
onClose: () => d(!1)
|
|
13
15
|
});
|
|
14
|
-
|
|
15
|
-
menuRef:
|
|
16
|
-
active:
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
r({
|
|
17
|
+
menuRef: m,
|
|
18
|
+
active: u
|
|
19
|
+
});
|
|
20
|
+
let _ = e({
|
|
21
|
+
enabled: u && h.shown,
|
|
22
|
+
autoFocus: !0,
|
|
23
|
+
returnFocus: !0
|
|
24
|
+
}), v = o((e) => {
|
|
25
|
+
m.current = e, _(e);
|
|
26
|
+
}, [m, _]);
|
|
27
|
+
return !u && h.exited ? null : /* @__PURE__ */ a(t, {
|
|
28
|
+
ref: v,
|
|
29
|
+
behavior: h,
|
|
20
30
|
role: "menu",
|
|
21
|
-
visualClass:
|
|
22
|
-
className:
|
|
31
|
+
visualClass: s,
|
|
32
|
+
className: l,
|
|
23
33
|
style: {
|
|
24
|
-
left:
|
|
25
|
-
top:
|
|
34
|
+
left: f,
|
|
35
|
+
top: p
|
|
26
36
|
},
|
|
27
|
-
onKeyDown:
|
|
28
|
-
children:
|
|
29
|
-
})
|
|
37
|
+
onKeyDown: g,
|
|
38
|
+
children: c
|
|
39
|
+
});
|
|
30
40
|
}
|
|
31
41
|
//#endregion
|
|
32
|
-
export {
|
|
42
|
+
export { c as default };
|
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useFocusScope as t } from "../../utils/focus-scope.js";
|
|
4
|
+
import { whenExitSettles as n } from "../../utils/presence.js";
|
|
3
5
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { useControl as
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as a, useEffect as o, useId as s, useRef as c } from "react";
|
|
8
|
+
import { useControl as l } from "react-use-control";
|
|
7
9
|
//#region src/lib/components/Dialog/Dialog.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
var u = "haze-Dialog__overlay", d = "haze-Dialog__titleText";
|
|
11
|
+
function f({ open: f, onClose: p, title: m, className: h, children: g }) {
|
|
12
|
+
let [_, v] = l(f, !1), y = c(null), b = t({
|
|
13
|
+
enabled: _,
|
|
14
|
+
trapped: !1
|
|
15
|
+
}), x = `haze-dialog-title-${s()}`, S = a((e) => {
|
|
16
|
+
y.current = e, b(e);
|
|
17
|
+
}, [b]);
|
|
18
|
+
return o(() => {
|
|
19
|
+
let e = y.current;
|
|
20
|
+
if (e) {
|
|
21
|
+
if (_ && !e.open) e.showModal();
|
|
22
|
+
else if (!_ && e.open) {
|
|
23
|
+
let t = n(e), r = () => {
|
|
24
|
+
e.getAttribute("data-state") === "closed" && e.close();
|
|
25
|
+
};
|
|
26
|
+
t ? t.then(r) : r();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [_]), /* @__PURE__ */ i("dialog", {
|
|
30
|
+
ref: S,
|
|
31
|
+
"data-state": _ ? "open" : "closed",
|
|
32
|
+
"aria-labelledby": m === void 0 ? void 0 : x,
|
|
17
33
|
onClose: () => {
|
|
18
|
-
|
|
34
|
+
v(!1), p?.();
|
|
35
|
+
},
|
|
36
|
+
onCancel: (e) => {
|
|
37
|
+
e.preventDefault(), v(!1);
|
|
19
38
|
},
|
|
20
39
|
onClick: (e) => {
|
|
21
|
-
e.target ===
|
|
40
|
+
e.target === y.current && v(!1);
|
|
22
41
|
},
|
|
23
|
-
className: e([
|
|
24
|
-
children: [
|
|
25
|
-
id:
|
|
26
|
-
className: e([
|
|
27
|
-
children:
|
|
28
|
-
}),
|
|
42
|
+
className: e([u, h]),
|
|
43
|
+
children: [m !== void 0 && /* @__PURE__ */ r("h2", {
|
|
44
|
+
id: x,
|
|
45
|
+
className: e([d]),
|
|
46
|
+
children: m
|
|
47
|
+
}), g]
|
|
29
48
|
});
|
|
30
49
|
}
|
|
31
50
|
//#endregion
|
|
32
|
-
export {
|
|
51
|
+
export { f as default };
|
|
@@ -1,36 +1,55 @@
|
|
|
1
1
|
|
|
2
2
|
import { classnames as e } from "../../utils/classnames.js";
|
|
3
|
+
import { useFocusScope as t } from "../../utils/focus-scope.js";
|
|
4
|
+
import { whenExitSettles as n } from "../../utils/presence.js";
|
|
3
5
|
/* empty css */
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { useControl as
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
8
|
+
import { useControl as s } from "react-use-control";
|
|
7
9
|
//#region src/lib/components/Drawer/Drawer.tsx
|
|
8
|
-
var
|
|
10
|
+
var c = "haze-Drawer__overlay", l = {
|
|
9
11
|
left: "haze-Drawer__left",
|
|
10
12
|
right: "haze-Drawer__right",
|
|
11
13
|
top: "haze-Drawer__top",
|
|
12
14
|
bottom: "haze-Drawer__bottom"
|
|
13
15
|
};
|
|
14
|
-
function
|
|
15
|
-
let [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
function u({ open: u, placement: d = "right", onClose: f, className: p, children: m }) {
|
|
17
|
+
let [h, g] = s(u, !1), _ = o(null), v = t({
|
|
18
|
+
enabled: h,
|
|
19
|
+
trapped: !1
|
|
20
|
+
}), y = i((e) => {
|
|
21
|
+
_.current = e, v(e);
|
|
22
|
+
}, [v]);
|
|
23
|
+
return a(() => {
|
|
24
|
+
let e = _.current;
|
|
25
|
+
if (e) {
|
|
26
|
+
if (h && !e.open) e.showModal();
|
|
27
|
+
else if (!h && e.open) {
|
|
28
|
+
let t = n(e), r = () => {
|
|
29
|
+
e.getAttribute("data-state") === "closed" && e.close();
|
|
30
|
+
};
|
|
31
|
+
t ? t.then(r) : r();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [h]), /* @__PURE__ */ r("dialog", {
|
|
35
|
+
ref: y,
|
|
36
|
+
"data-state": h ? "open" : "closed",
|
|
21
37
|
onClose: () => {
|
|
22
|
-
|
|
38
|
+
g(!1), f?.();
|
|
39
|
+
},
|
|
40
|
+
onCancel: (e) => {
|
|
41
|
+
e.preventDefault(), g(!1);
|
|
23
42
|
},
|
|
24
43
|
onClick: (e) => {
|
|
25
|
-
e.target ===
|
|
44
|
+
e.target === _.current && g(!1);
|
|
26
45
|
},
|
|
27
46
|
className: e([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
c,
|
|
48
|
+
l[d],
|
|
49
|
+
p
|
|
31
50
|
]),
|
|
32
|
-
children:
|
|
51
|
+
children: m
|
|
33
52
|
});
|
|
34
53
|
}
|
|
35
54
|
//#endregion
|
|
36
|
-
export {
|
|
55
|
+
export { u as default };
|