haze-ui 1.23.0 → 1.24.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/BottomSheet/BottomSheet.js +33 -16
- package/dist/components/Collapsible/Collapsible.js +34 -27
- package/dist/components/Combobox/Combobox.js +2 -1
- 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/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 +195 -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 +2 -2
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -13,7 +13,8 @@ function m({ value: m, open: h, options: g, placeholder: _, className: v }) {
|
|
|
13
13
|
open: C,
|
|
14
14
|
setOpen: w,
|
|
15
15
|
triggerRef: O,
|
|
16
|
-
panelRef: k
|
|
16
|
+
panelRef: k,
|
|
17
|
+
animated: !0
|
|
17
18
|
}), j = g.filter((e) => e.label.toLowerCase().includes(x.toLowerCase()));
|
|
18
19
|
o(() => {
|
|
19
20
|
E(-1);
|
|
@@ -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 };
|
|
@@ -4,39 +4,41 @@ import { useFloating as t } from "../../utils/floating.js";
|
|
|
4
4
|
import { DropdownMenuProvider as n } from "./DropdownMenuContext.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback as i, useId as a,
|
|
8
|
-
import { useControl as
|
|
7
|
+
import { useCallback as i, useId as a, useMemo as o, useRef as s } from "react";
|
|
8
|
+
import { useControl as c } from "react-use-control";
|
|
9
9
|
//#region src/lib/components/DropdownMenu/DropdownMenu.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
let t = typeof e == "function" ? e(
|
|
14
|
-
|
|
10
|
+
var l = "haze-DropdownMenu__wrapper";
|
|
11
|
+
function u({ open: u, onOpenChange: d, collisionPadding: f, children: p, className: m }) {
|
|
12
|
+
let [h, g] = c(u, !1), _ = s(null), v = s(null), y = a(), b = s(null), x = i((e) => {
|
|
13
|
+
let t = typeof e == "function" ? e(h) : e;
|
|
14
|
+
g(t), d?.(t);
|
|
15
15
|
}, [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
]),
|
|
20
|
-
open:
|
|
21
|
-
setOpen:
|
|
22
|
-
triggerRef:
|
|
23
|
-
panelRef:
|
|
16
|
+
h,
|
|
17
|
+
g,
|
|
18
|
+
d
|
|
19
|
+
]), S = o(() => f === void 0 ? void 0 : { collisionPadding: f }, [f]), C = t({
|
|
20
|
+
open: h,
|
|
21
|
+
setOpen: x,
|
|
22
|
+
triggerRef: _,
|
|
23
|
+
panelRef: v,
|
|
24
|
+
animated: !0,
|
|
25
|
+
collision: S
|
|
24
26
|
});
|
|
25
27
|
return /* @__PURE__ */ r(n, {
|
|
26
28
|
value: {
|
|
27
|
-
open:
|
|
28
|
-
setOpen:
|
|
29
|
-
triggerRef:
|
|
30
|
-
contentRef:
|
|
31
|
-
contentId:
|
|
32
|
-
focusRequestRef:
|
|
33
|
-
floating:
|
|
29
|
+
open: h,
|
|
30
|
+
setOpen: x,
|
|
31
|
+
triggerRef: _,
|
|
32
|
+
contentRef: v,
|
|
33
|
+
contentId: y,
|
|
34
|
+
focusRequestRef: b,
|
|
35
|
+
floating: C
|
|
34
36
|
},
|
|
35
37
|
children: r("div", {
|
|
36
|
-
className: e([
|
|
37
|
-
children:
|
|
38
|
+
className: e([l, m]),
|
|
39
|
+
children: p
|
|
38
40
|
})
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
//#endregion
|
|
42
|
-
export {
|
|
44
|
+
export { u as default };
|
|
@@ -32,7 +32,7 @@ function u({ children: u, align: d = "start", className: f }) {
|
|
|
32
32
|
y.shown,
|
|
33
33
|
g,
|
|
34
34
|
v
|
|
35
|
-
]), p ? /* @__PURE__ */ a(e, {
|
|
35
|
+
]), !p && y.exited ? null : /* @__PURE__ */ a(e, {
|
|
36
36
|
ref: g,
|
|
37
37
|
behavior: y,
|
|
38
38
|
placement: l[d],
|
|
@@ -42,7 +42,7 @@ function u({ children: u, align: d = "start", className: f }) {
|
|
|
42
42
|
className: f,
|
|
43
43
|
onKeyDown: x,
|
|
44
44
|
children: u
|
|
45
|
-
})
|
|
45
|
+
});
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
export { u as default };
|