alif-ui 2.0.0-alpha.20 → 2.0.0-alpha.21
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/alif-ui.css +1 -1
- package/dist/components/Drawer/Drawer.js +17 -17
- package/dist/components/Modal/Modal.js +14 -14
- package/dist/components/NativeDialog/NativeDialog.js +41 -0
- package/dist/components/NativeDialog/NativeDialog.types.js +0 -0
- package/dist/components/NativeDialog/NativeDialog.utils.js +4 -0
- package/dist/components/NativeDialog/useControlledDialog.js +36 -0
- package/dist/components/NativeDialog/useFocusWrap.js +32 -0
- package/dist/components/NativeDrawer/NativeDrawer.js +55 -0
- package/dist/components/NativeDrawer/NativeDrawer.types.js +0 -0
- package/dist/components/NativeDrawer/NativeDrawer.utils.js +18 -0
- package/dist/components/NativeDrawer/NativeDrawerActions/NativeDrawerActions.js +5 -0
- package/dist/components/NativeDrawer/NativeDrawerContent/NativeDrawerContent.js +10 -0
- package/dist/components/NativeDrawer/NativeDrawerHeader/NativeDrawerHeader.js +28 -0
- package/dist/components/NativeModal/NativeModal.js +51 -0
- package/dist/components/NativeModal/NativeModal.types.js +0 -0
- package/dist/components/NativeModal/NativeModal.utils.js +25 -0
- package/dist/components/NativeModal/NativeModalActions/NativeModalActions.js +5 -0
- package/dist/components/NativeModal/NativeModalContent/NativeModalContent.js +10 -0
- package/dist/components/NativeModal/NativeModalHeader/NativeModalHeader.js +27 -0
- package/dist/components/NativePopover/NativePopoverDropdown/NativePopoverDropdown.js +2 -2
- package/dist/hooks/useDelayedUnmount/useDelayedUnmount.js +20 -0
- package/dist/lib/components/NativeDrawer/NativeDrawer.module.js +18 -0
- package/dist/lib/components/NativeModal/NativeModal.module.js +15 -0
- package/dist/main.js +36 -36
- package/dist/src/lib/components/NativeDialog/NativeDialog.d.ts +3 -0
- package/dist/src/lib/components/NativeDialog/NativeDialog.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDialog/NativeDialog.types.d.ts +49 -0
- package/dist/src/lib/components/NativeDialog/NativeDialog.types.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDialog/NativeDialog.utils.d.ts +2 -0
- package/dist/src/lib/components/NativeDialog/NativeDialog.utils.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDialog/index.d.ts +3 -0
- package/dist/src/lib/components/NativeDialog/index.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDialog/useControlledDialog.d.ts +22 -0
- package/dist/src/lib/components/NativeDialog/useControlledDialog.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDialog/useFocusWrap.d.ts +8 -0
- package/dist/src/lib/components/NativeDialog/useFocusWrap.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.d.ts +8 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.types.d.ts +95 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.types.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.utils.d.ts +12 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawer.utils.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerActions/NativeDrawerActions.d.ts +3 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerActions/NativeDrawerActions.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerContent/NativeDrawerContent.d.ts +3 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerContent/NativeDrawerContent.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerHeader/NativeDrawerHeader.d.ts +13 -0
- package/dist/src/lib/components/NativeDrawer/NativeDrawerHeader/NativeDrawerHeader.d.ts.map +1 -0
- package/dist/src/lib/components/NativeDrawer/index.d.ts +4 -0
- package/dist/src/lib/components/NativeDrawer/index.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModal.d.ts +8 -0
- package/dist/src/lib/components/NativeModal/NativeModal.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModal.types.d.ts +84 -0
- package/dist/src/lib/components/NativeModal/NativeModal.types.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModal.utils.d.ts +14 -0
- package/dist/src/lib/components/NativeModal/NativeModal.utils.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModalActions/NativeModalActions.d.ts +3 -0
- package/dist/src/lib/components/NativeModal/NativeModalActions/NativeModalActions.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModalContent/NativeModalContent.d.ts +3 -0
- package/dist/src/lib/components/NativeModal/NativeModalContent/NativeModalContent.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/NativeModalHeader/NativeModalHeader.d.ts +17 -0
- package/dist/src/lib/components/NativeModal/NativeModalHeader/NativeModalHeader.d.ts.map +1 -0
- package/dist/src/lib/components/NativeModal/index.d.ts +4 -0
- package/dist/src/lib/components/NativeModal/index.d.ts.map +1 -0
- package/dist/src/lib/components/index.d.ts +2 -2
- package/dist/src/lib/components/index.d.ts.map +1 -1
- package/dist/src/lib/hooks/useDelayedUnmount/useDelayedUnmount.d.ts +17 -0
- package/dist/src/lib/hooks/useDelayedUnmount/useDelayedUnmount.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/components/NativePopover/NativePopoverDropdown/useMountedContent.js +0 -24
- package/dist/src/lib/components/NativePopover/NativePopoverDropdown/useMountedContent.d.ts +0 -9
- package/dist/src/lib/components/NativePopover/NativePopoverDropdown/useMountedContent.d.ts.map +0 -1
|
@@ -4,25 +4,25 @@ import { OutlineSystemClose as t } from "../../icons/components/OutlineSystemClo
|
|
|
4
4
|
import { Backdrop as n } from "../Backdrop/Backdrop.js";
|
|
5
5
|
import { useLocale as r } from "../../providers/hooks/useLocale/useLocale.js";
|
|
6
6
|
import { Button as i } from "../Button/Button.js";
|
|
7
|
-
import
|
|
8
|
-
import o from "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import a from "../../lib/components/Drawer/Drawer.module.js";
|
|
8
|
+
import { DrawerHeader as o } from "./DrawerHeader/DrawerHeader.js";
|
|
9
|
+
import { DrawerContent as s } from "./DrawerContent/DrawerContent.js";
|
|
10
|
+
import { DrawerActions as c } from "./DrawerActions/DrawerActions.js";
|
|
11
|
+
import { ARIA_CLOSE_LABEL as l, getDrawerStyle as u, positionToTransitionName as d } from "./Drawer.utils.js";
|
|
12
|
+
import { useFocusTrapAndRestore as f } from "../../hooks/useFocusTrapAndRestore/useFocusTrapAndRestore.js";
|
|
13
13
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
14
14
|
//#region src/lib/components/Drawer/Drawer.tsx
|
|
15
|
-
var h = ({ isOpen:
|
|
16
|
-
let { locale: k } = r(), A =
|
|
15
|
+
var h = ({ isOpen: o, onClose: s, children: c, withCloseButton: h = !0, closeOnClickOutside: g = !0, scrollable: _ = !0, width: v, height: y, maxWidth: b, maxHeight: x, variant: S = "default", position: C = "right", zIndex: w, className: T, style: E, ref: D, ...O }) => {
|
|
16
|
+
let { locale: k } = r(), A = f(o), j = e(a.root, S === "floating" && a.rounded, a[C]), M = e(a.drawer, (_ || C === "bottom" || C === "top") && a.scrollable, T);
|
|
17
17
|
return /* @__PURE__ */ p(n, {
|
|
18
18
|
ref: D,
|
|
19
|
-
isOpen:
|
|
20
|
-
onClose:
|
|
19
|
+
isOpen: o,
|
|
20
|
+
onClose: s,
|
|
21
21
|
closeOnClickOutside: g,
|
|
22
22
|
className: j,
|
|
23
23
|
"data-testid": "container",
|
|
24
24
|
zIndex: w,
|
|
25
|
-
transitionProps: { transition:
|
|
25
|
+
transitionProps: { transition: d[C] },
|
|
26
26
|
children: /* @__PURE__ */ m("div", {
|
|
27
27
|
ref: A,
|
|
28
28
|
role: "dialog",
|
|
@@ -30,19 +30,19 @@ var h = ({ isOpen: s, onClose: c, children: l, withCloseButton: h = !0, closeOnC
|
|
|
30
30
|
"data-testid": "drawer",
|
|
31
31
|
"aria-modal": "true",
|
|
32
32
|
className: M,
|
|
33
|
-
style:
|
|
33
|
+
style: u(C, v, y, b, x, E),
|
|
34
34
|
...O,
|
|
35
|
-
children: [
|
|
36
|
-
className:
|
|
35
|
+
children: [c, h && /* @__PURE__ */ p(i, {
|
|
36
|
+
className: a.closeButton,
|
|
37
37
|
variant: "ghost",
|
|
38
38
|
color: "tertiary",
|
|
39
|
-
"aria-label":
|
|
40
|
-
onClick:
|
|
39
|
+
"aria-label": l[k],
|
|
40
|
+
onClick: s,
|
|
41
41
|
children: /* @__PURE__ */ p(t, {})
|
|
42
42
|
})]
|
|
43
43
|
})
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
h.Header =
|
|
46
|
+
h.Header = o, h.Content = s, h.Actions = c;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { h as Drawer };
|
|
@@ -2,36 +2,36 @@ import { classNames as e } from "../../utils/class-names.js";
|
|
|
2
2
|
import { OutlineSystemClose as t } from "../../icons/components/OutlineSystemClose.js";
|
|
3
3
|
import { Backdrop as n } from "../Backdrop/Backdrop.js";
|
|
4
4
|
import { Button as r } from "../Button/Button.js";
|
|
5
|
-
import i from "../../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { useFocusTrapAndRestore as i } from "../../hooks/useFocusTrapAndRestore/useFocusTrapAndRestore.js";
|
|
6
|
+
import a from "../../lib/components/Modal/Modal.module.js";
|
|
7
|
+
import { ModalHeader as o } from "./ModalHeader/ModalHeader.js";
|
|
8
|
+
import { ModalContent as s } from "./ModalContent/ModalContent.js";
|
|
9
|
+
import { ModalActions as c } from "./ModalActions/ModalActions.js";
|
|
10
|
+
import { getModalStyles as l } from "./Modal.utils.js";
|
|
11
11
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
12
|
//#region src/lib/components/Modal/Modal.tsx
|
|
13
|
-
var f = ({ children:
|
|
14
|
-
let _ =
|
|
13
|
+
var f = ({ children: o, device: s = "desktop", centered: c = !0, withCloseButton: f = !0, scrollable: p = !1, className: m, style: h, ...g }) => {
|
|
14
|
+
let _ = i(g.isOpen);
|
|
15
15
|
return /* @__PURE__ */ u(n, {
|
|
16
|
-
className: e(!
|
|
16
|
+
className: e(!c && a.start),
|
|
17
17
|
...g,
|
|
18
18
|
children: /* @__PURE__ */ d("div", {
|
|
19
19
|
role: "dialog",
|
|
20
20
|
"aria-modal": "true",
|
|
21
21
|
tabIndex: -1,
|
|
22
22
|
ref: _,
|
|
23
|
-
style:
|
|
24
|
-
className: e(
|
|
25
|
-
children: [
|
|
23
|
+
style: l(s, f, h),
|
|
24
|
+
className: e(a.root, p && a.scrollable, m),
|
|
25
|
+
children: [o, f && /* @__PURE__ */ u(r, {
|
|
26
26
|
variant: "ghost",
|
|
27
27
|
color: "tertiary",
|
|
28
|
-
className:
|
|
28
|
+
className: a.closeButton,
|
|
29
29
|
onClick: g.onClose,
|
|
30
30
|
children: /* @__PURE__ */ u(t, {})
|
|
31
31
|
})]
|
|
32
32
|
})
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
f.Header =
|
|
35
|
+
f.Header = o, f.Content = s, f.Actions = c;
|
|
36
36
|
//#endregion
|
|
37
37
|
export { f as Modal };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { syncRefs as e } from "../../utils/sync-refs.js";
|
|
3
|
+
import { RemoveScroll as t } from "../RemoveScroll/RemoveScroll.js";
|
|
4
|
+
import { useDelayedUnmount as n } from "../../hooks/useDelayedUnmount/useDelayedUnmount.js";
|
|
5
|
+
import { getClosedBy as r } from "./NativeDialog.utils.js";
|
|
6
|
+
import { useControlledDialog as i } from "./useControlledDialog.js";
|
|
7
|
+
import { useFocusWrap as a } from "./useFocusWrap.js";
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
+
//#region src/lib/components/NativeDialog/NativeDialog.tsx
|
|
10
|
+
var s = ({ isOpen: s, onClose: c, children: l, closeOnClickOutside: u = !0, closeOnEscape: d = !0, keepMounted: f = !1, withNativeLightDismiss: p = !1, exitDuration: m, ref: h, ...g }) => {
|
|
11
|
+
let _ = r(u, d, p), { dialogRef: v, dialogProps: y } = i({
|
|
12
|
+
isOpen: s,
|
|
13
|
+
onClose: c,
|
|
14
|
+
closeOnClickOutside: u,
|
|
15
|
+
closeOnEscape: d,
|
|
16
|
+
closedBy: _,
|
|
17
|
+
exitDuration: m
|
|
18
|
+
});
|
|
19
|
+
a({
|
|
20
|
+
isOpen: s,
|
|
21
|
+
dialogRef: v
|
|
22
|
+
});
|
|
23
|
+
let b = n({
|
|
24
|
+
keepMounted: f,
|
|
25
|
+
isOpen: s,
|
|
26
|
+
exitDuration: m
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ o(t, {
|
|
29
|
+
enabled: s,
|
|
30
|
+
children: /* @__PURE__ */ o("dialog", {
|
|
31
|
+
ref: e(v, h),
|
|
32
|
+
closedby: _,
|
|
33
|
+
"data-state": s ? "open" : "closed",
|
|
34
|
+
...g,
|
|
35
|
+
...y,
|
|
36
|
+
children: b && l
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { s as NativeDialog };
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useRef as t } from "react";
|
|
3
|
+
//#region src/lib/components/NativeDialog/useControlledDialog.ts
|
|
4
|
+
var n = () => typeof HTMLDialogElement < "u" && "closedBy" in HTMLDialogElement.prototype, r = ({ isOpen: r, onClose: i, closeOnClickOutside: a, closeOnEscape: o, closedBy: s, exitDuration: c }) => {
|
|
5
|
+
let l = t(null), u = t(!1);
|
|
6
|
+
return e(() => {
|
|
7
|
+
let e = l.current;
|
|
8
|
+
if (typeof e?.showModal != "function") return;
|
|
9
|
+
if (r) {
|
|
10
|
+
e.open || e.showModal();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!e.open) return;
|
|
14
|
+
let t = window.setTimeout(() => e.close(), c);
|
|
15
|
+
return () => window.clearTimeout(t);
|
|
16
|
+
}, [r, c]), {
|
|
17
|
+
dialogRef: l,
|
|
18
|
+
dialogProps: {
|
|
19
|
+
onCancel: (e) => {
|
|
20
|
+
e.target === e.currentTarget && (e.preventDefault(), o && i());
|
|
21
|
+
},
|
|
22
|
+
onClose: (e) => {
|
|
23
|
+
e.target === e.currentTarget && r && i();
|
|
24
|
+
},
|
|
25
|
+
onPointerDown: (e) => {
|
|
26
|
+
let { clientWidth: t, clientHeight: n } = e.currentTarget, { offsetX: r, offsetY: i } = e.nativeEvent, a = r > t || i > n;
|
|
27
|
+
u.current = e.target === e.currentTarget && !a;
|
|
28
|
+
},
|
|
29
|
+
onClick: (e) => {
|
|
30
|
+
!a || !u.current || s === "any" && n() || e.target === e.currentTarget && i();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { n as isClosedBySupported, r as useControlledDialog };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e } from "react";
|
|
3
|
+
//#region src/lib/components/NativeDialog/useFocusWrap.ts
|
|
4
|
+
var t = [
|
|
5
|
+
"a[href]",
|
|
6
|
+
"button:not([disabled])",
|
|
7
|
+
"input:not([disabled]):not([type=\"hidden\"])",
|
|
8
|
+
"select:not([disabled])",
|
|
9
|
+
"textarea:not([disabled])",
|
|
10
|
+
"iframe",
|
|
11
|
+
"[contenteditable=\"true\"]",
|
|
12
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
13
|
+
].join(", "), n = (e) => typeof e.checkVisibility == "function" ? e.checkVisibility() : !0, r = ({ isOpen: r, dialogRef: i }) => {
|
|
14
|
+
e(() => {
|
|
15
|
+
let e = i.current;
|
|
16
|
+
if (!r || !e) return;
|
|
17
|
+
let a = (r) => {
|
|
18
|
+
if (r.key !== "Tab") return;
|
|
19
|
+
let i = Array.from(e.querySelectorAll(t)).filter(n), a = i[0], o = i.at(-1);
|
|
20
|
+
if (!a || !o) return;
|
|
21
|
+
let s = document.activeElement;
|
|
22
|
+
if (r.shiftKey && s === a) {
|
|
23
|
+
r.preventDefault(), o.focus();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
!r.shiftKey && s === o && (r.preventDefault(), a.focus());
|
|
27
|
+
};
|
|
28
|
+
return e.addEventListener("keydown", a), () => e.removeEventListener("keydown", a);
|
|
29
|
+
}, [r, i]);
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { r as useFocusWrap };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { classNames as e } from "../../utils/class-names.js";
|
|
3
|
+
import { OutlineSystemClose as t } from "../../icons/components/OutlineSystemClose.js";
|
|
4
|
+
import { Button as n } from "../Button/Button.js";
|
|
5
|
+
import { NativeDialog as r } from "../NativeDialog/NativeDialog.js";
|
|
6
|
+
import i from "../../lib/components/NativeDrawer/NativeDrawer.module.js";
|
|
7
|
+
import { getNativeDrawerStyles as a, isHorizontal as o } from "./NativeDrawer.utils.js";
|
|
8
|
+
import { NativeDrawerHeader as s } from "./NativeDrawerHeader/NativeDrawerHeader.js";
|
|
9
|
+
import { NativeDrawerContent as c } from "./NativeDrawerContent/NativeDrawerContent.js";
|
|
10
|
+
import { NativeDrawerActions as l } from "./NativeDrawerActions/NativeDrawerActions.js";
|
|
11
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
|
+
//#region src/lib/components/NativeDrawer/NativeDrawer.tsx
|
|
13
|
+
var f = ({ isOpen: s, onClose: c, children: l, position: f = "right", variant: p = "default", width: m, height: h, maxWidth: g, maxHeight: _, withCloseButton: v = !0, scrollable: y = !0, closeOnClickOutside: b = !0, closeOnEscape: x = !0, blur: S, keepMounted: C = !1, transitionProps: w, className: T, style: E, ref: D, ...O }) => {
|
|
14
|
+
let { duration: k = 250, exitDuration: A = 200, timingFunction: j } = w ?? {};
|
|
15
|
+
return /* @__PURE__ */ u(r, {
|
|
16
|
+
ref: D,
|
|
17
|
+
isOpen: s,
|
|
18
|
+
onClose: c,
|
|
19
|
+
closeOnClickOutside: b,
|
|
20
|
+
closeOnEscape: x,
|
|
21
|
+
keepMounted: C,
|
|
22
|
+
exitDuration: A,
|
|
23
|
+
withNativeLightDismiss: !0,
|
|
24
|
+
"data-position": f,
|
|
25
|
+
className: e(i.root, i[f], p === "floating" && i.floating, S && i.blurred, (y || !o(f)) && i.scrollable, T),
|
|
26
|
+
style: a({
|
|
27
|
+
position: f,
|
|
28
|
+
blur: S,
|
|
29
|
+
width: m,
|
|
30
|
+
height: h,
|
|
31
|
+
maxWidth: g,
|
|
32
|
+
maxHeight: _,
|
|
33
|
+
transitionProps: {
|
|
34
|
+
duration: k,
|
|
35
|
+
exitDuration: A,
|
|
36
|
+
timingFunction: j
|
|
37
|
+
},
|
|
38
|
+
style: E
|
|
39
|
+
}),
|
|
40
|
+
...O,
|
|
41
|
+
children: /* @__PURE__ */ d("div", {
|
|
42
|
+
className: i.panel,
|
|
43
|
+
children: [l, v && /* @__PURE__ */ u(n, {
|
|
44
|
+
variant: "ghost",
|
|
45
|
+
color: "tertiary",
|
|
46
|
+
className: i.closeButton,
|
|
47
|
+
onClick: c,
|
|
48
|
+
children: /* @__PURE__ */ u(t, {})
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
f.Header = s, f.Content = c, f.Actions = l;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { f as NativeDrawer };
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveUnit as e } from "../../utils/unit-resolver.js";
|
|
2
|
+
//#region src/lib/components/NativeDrawer/NativeDrawer.utils.ts
|
|
3
|
+
var t = ["left", "right"], n = (e) => t.includes(e), r = ({ position: t, blur: r, width: i, height: a, maxWidth: o, maxHeight: s, transitionProps: c, style: l }) => {
|
|
4
|
+
let { duration: u, exitDuration: d, timingFunction: f } = c, p = n(t);
|
|
5
|
+
return {
|
|
6
|
+
"--drawer-width": p ? e(i ?? "100dvw") : "100dvw",
|
|
7
|
+
"--drawer-height": p ? "100dvh" : e(a ?? "100dvh"),
|
|
8
|
+
"--drawer-max-width": p ? e(o ?? "500px") : "100dvw",
|
|
9
|
+
"--drawer-max-height": p ? "100dvh" : e(s ?? "500px"),
|
|
10
|
+
"--drawer-backdrop-blur": r ? `${r}px` : void 0,
|
|
11
|
+
"--drawer-duration": `${u}ms`,
|
|
12
|
+
"--drawer-exit-duration": `${d}ms`,
|
|
13
|
+
"--drawer-timing": f ?? "ease",
|
|
14
|
+
...l
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as getNativeDrawerStyles, n as isHorizontal };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { classNames as e } from "../../../utils/class-names.js";
|
|
2
|
+
import t from "../../../lib/components/NativeDrawer/NativeDrawer.module.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/lib/components/NativeDrawer/NativeDrawerContent/NativeDrawerContent.tsx
|
|
5
|
+
var r = ({ className: r, ...i }) => /* @__PURE__ */ n("div", {
|
|
6
|
+
className: e(t.content, r),
|
|
7
|
+
...i
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as NativeDrawerContent };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { classNames as e } from "../../../utils/class-names.js";
|
|
3
|
+
import t from "../../../lib/components/NativeDrawer/NativeDrawer.module.js";
|
|
4
|
+
import { Typography as n } from "../../Typography/Typography.js";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/lib/components/NativeDrawer/NativeDrawerHeader/NativeDrawerHeader.tsx
|
|
7
|
+
var a = ({ title: a, description: o, className: s, children: c, ...l }) => /* @__PURE__ */ i("div", {
|
|
8
|
+
className: e(t.header, s),
|
|
9
|
+
...l,
|
|
10
|
+
children: [
|
|
11
|
+
a && /* @__PURE__ */ r(n, {
|
|
12
|
+
className: t.title,
|
|
13
|
+
variant: "heading",
|
|
14
|
+
size: "h4",
|
|
15
|
+
children: a
|
|
16
|
+
}),
|
|
17
|
+
o && /* @__PURE__ */ r(n, {
|
|
18
|
+
element: "div",
|
|
19
|
+
className: t.description,
|
|
20
|
+
variant: "body",
|
|
21
|
+
size: "l",
|
|
22
|
+
children: o
|
|
23
|
+
}),
|
|
24
|
+
c
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { a as NativeDrawerHeader };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { classNames as e } from "../../utils/class-names.js";
|
|
3
|
+
import { OutlineSystemClose as t } from "../../icons/components/OutlineSystemClose.js";
|
|
4
|
+
import { Button as n } from "../Button/Button.js";
|
|
5
|
+
import r from "../../lib/components/NativeModal/NativeModal.module.js";
|
|
6
|
+
import { getNativeModalStyles as i } from "./NativeModal.utils.js";
|
|
7
|
+
import { NativeModalHeader as a } from "./NativeModalHeader/NativeModalHeader.js";
|
|
8
|
+
import { NativeModalContent as o } from "./NativeModalContent/NativeModalContent.js";
|
|
9
|
+
import { NativeModalActions as s } from "./NativeModalActions/NativeModalActions.js";
|
|
10
|
+
import { NativeDialog as c } from "../NativeDialog/NativeDialog.js";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
+
//#region src/lib/components/NativeModal/NativeModal.tsx
|
|
13
|
+
var d = ({ isOpen: a, onClose: o, children: s, device: d = "desktop", centered: f = !0, withCloseButton: p = !0, scrollable: m = !0, closeOnClickOutside: h = !0, closeOnEscape: g = !0, blur: _, keepMounted: v = !1, transitionProps: y, className: b, style: x, ref: S, ...C }) => {
|
|
14
|
+
let { transition: w = "scale", duration: T = 200, exitDuration: E = 150, timingFunction: D } = y ?? {};
|
|
15
|
+
return /* @__PURE__ */ l(c, {
|
|
16
|
+
ref: S,
|
|
17
|
+
isOpen: a,
|
|
18
|
+
onClose: o,
|
|
19
|
+
closeOnClickOutside: h,
|
|
20
|
+
closeOnEscape: g,
|
|
21
|
+
keepMounted: v,
|
|
22
|
+
exitDuration: E,
|
|
23
|
+
className: e(r.root, !f && r.start, _ && r.blurred, m && r.scrollable, b),
|
|
24
|
+
style: i({
|
|
25
|
+
device: d,
|
|
26
|
+
blur: _,
|
|
27
|
+
withCloseButton: p,
|
|
28
|
+
transitionProps: {
|
|
29
|
+
transition: w,
|
|
30
|
+
duration: T,
|
|
31
|
+
exitDuration: E,
|
|
32
|
+
timingFunction: D
|
|
33
|
+
},
|
|
34
|
+
style: x
|
|
35
|
+
}),
|
|
36
|
+
...C,
|
|
37
|
+
children: /* @__PURE__ */ u("div", {
|
|
38
|
+
className: r.panel,
|
|
39
|
+
children: [s, p && /* @__PURE__ */ l(n, {
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
color: "tertiary",
|
|
42
|
+
className: r.closeButton,
|
|
43
|
+
onClick: o,
|
|
44
|
+
children: /* @__PURE__ */ l(t, {})
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
d.Header = a, d.Content = o, d.Actions = s;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { d as NativeModal };
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/lib/components/NativeModal/NativeModal.utils.ts
|
|
2
|
+
var e = {
|
|
3
|
+
fade: "none",
|
|
4
|
+
scale: "scale(0.96)",
|
|
5
|
+
"slide-up": "translateY(1.5rem)",
|
|
6
|
+
"slide-down": "translateY(-1.5rem)"
|
|
7
|
+
}, t = (e) => e ? "closerequest" : "none", n = ({ device: t, blur: n, withCloseButton: r, transitionProps: i, style: a }) => {
|
|
8
|
+
let { transition: o, duration: s, exitDuration: c, timingFunction: l } = i;
|
|
9
|
+
return {
|
|
10
|
+
"--modal-spacing-vertical": `var(--modal-spacing-vertical-${t})`,
|
|
11
|
+
"--modal-spacing-horizontal": `var(--modal-spacing-horizontal-${t})`,
|
|
12
|
+
"--modal-spacing-between": `var(--modal-spacing-between-${t})`,
|
|
13
|
+
"--modal-close-button-position-right": `var(--modal-close-button-position-right-${t})`,
|
|
14
|
+
"--modal-close-button-position-top": `var(--modal-close-button-position-top-${t})`,
|
|
15
|
+
"--modal-spacing-padding-horizontal-heading": r ? "var(--modal-spacing-padding-heading)" : "0",
|
|
16
|
+
"--modal-backdrop-blur": n ? `${n}px` : void 0,
|
|
17
|
+
"--modal-from-transform": e[o],
|
|
18
|
+
"--modal-duration": `${s}ms`,
|
|
19
|
+
"--modal-exit-duration": `${c}ms`,
|
|
20
|
+
"--modal-timing": l ?? "ease",
|
|
21
|
+
...a
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { e as TRANSITION_FROM_TRANSFORM, t as getClosedBy, n as getNativeModalStyles };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { classNames as e } from "../../../utils/class-names.js";
|
|
2
|
+
import t from "../../../lib/components/NativeModal/NativeModal.module.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/lib/components/NativeModal/NativeModalContent/NativeModalContent.tsx
|
|
5
|
+
var r = ({ className: r, ...i }) => /* @__PURE__ */ n("div", {
|
|
6
|
+
className: e(t.content, r),
|
|
7
|
+
...i
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as NativeModalContent };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { classNames as e } from "../../../utils/class-names.js";
|
|
3
|
+
import t from "../../../lib/components/NativeModal/NativeModal.module.js";
|
|
4
|
+
import { Typography as n } from "../../Typography/Typography.js";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/lib/components/NativeModal/NativeModalHeader/NativeModalHeader.tsx
|
|
7
|
+
var a = ({ title: a, description: o, align: s = "start", className: c, children: l, ...u }) => /* @__PURE__ */ i("div", {
|
|
8
|
+
className: e(t.header, s === "center" && t.alignCenter, c),
|
|
9
|
+
...u,
|
|
10
|
+
children: [
|
|
11
|
+
a && /* @__PURE__ */ r(n, {
|
|
12
|
+
className: t.title,
|
|
13
|
+
variant: "heading",
|
|
14
|
+
size: "h1",
|
|
15
|
+
children: a
|
|
16
|
+
}),
|
|
17
|
+
o && /* @__PURE__ */ r(n, {
|
|
18
|
+
className: t.description,
|
|
19
|
+
variant: "body",
|
|
20
|
+
size: "m",
|
|
21
|
+
children: o
|
|
22
|
+
}),
|
|
23
|
+
l
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { a as NativeModalHeader };
|
|
@@ -5,7 +5,7 @@ import { getDropdownStyles as n } from "../NativePopover.utils.js";
|
|
|
5
5
|
import r from "../../../lib/components/NativePopover/NativePopover.module.js";
|
|
6
6
|
import { useNativeVisibility as i } from "./useNativeVisibility.js";
|
|
7
7
|
import { useArrowPlacement as a } from "./useArrowPlacement.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useDelayedUnmount as o } from "../../../hooks/useDelayedUnmount/useDelayedUnmount.js";
|
|
9
9
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/lib/components/NativePopover/NativePopoverDropdown/NativePopoverDropdown.tsx
|
|
11
11
|
var l = ({ children: l, className: u, style: d, onClick: f, onMouseEnter: p, onMouseLeave: m, onToggle: h, ...g }) => {
|
|
@@ -24,7 +24,7 @@ var l = ({ children: l, className: u, style: d, onClick: f, onMouseEnter: p, onM
|
|
|
24
24
|
let H = o({
|
|
25
25
|
keepMounted: M,
|
|
26
26
|
isOpen: y,
|
|
27
|
-
|
|
27
|
+
element: S,
|
|
28
28
|
exitDuration: B
|
|
29
29
|
});
|
|
30
30
|
return /* @__PURE__ */ c("div", {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useState as t } from "react";
|
|
3
|
+
//#region src/lib/hooks/useDelayedUnmount/useDelayedUnmount.ts
|
|
4
|
+
var n = ({ keepMounted: n, isOpen: r, exitDuration: i, element: a }) => {
|
|
5
|
+
let [o, s] = t(r);
|
|
6
|
+
return r && !o && s(!0), e(() => {
|
|
7
|
+
if (r || n) return;
|
|
8
|
+
let e = () => s(!1), t = window.setTimeout(e, i);
|
|
9
|
+
return a?.addEventListener("transitionend", e), () => {
|
|
10
|
+
window.clearTimeout(t), a?.removeEventListener("transitionend", e);
|
|
11
|
+
};
|
|
12
|
+
}, [
|
|
13
|
+
r,
|
|
14
|
+
n,
|
|
15
|
+
i,
|
|
16
|
+
a
|
|
17
|
+
]), n || o;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as useDelayedUnmount };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
root: "_root_2tb2n_1",
|
|
3
|
+
right: "_right_2tb2n_47",
|
|
4
|
+
left: "_left_2tb2n_53",
|
|
5
|
+
top: "_top_2tb2n_59",
|
|
6
|
+
bottom: "_bottom_2tb2n_65",
|
|
7
|
+
floating: "_floating_2tb2n_71",
|
|
8
|
+
blurred: "_blurred_2tb2n_96",
|
|
9
|
+
panel: "_panel_2tb2n_111",
|
|
10
|
+
scrollable: "_scrollable_2tb2n_122",
|
|
11
|
+
content: "_content_2tb2n_130",
|
|
12
|
+
header: "_header_2tb2n_140",
|
|
13
|
+
title: "_title_2tb2n_147",
|
|
14
|
+
description: "_description_2tb2n_152",
|
|
15
|
+
closeButton: "_closeButton_2tb2n_157"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
root: "_root_nuokb_1",
|
|
3
|
+
panel: "_panel_nuokb_40",
|
|
4
|
+
blurred: "_blurred_nuokb_81",
|
|
5
|
+
start: "_start_nuokb_96",
|
|
6
|
+
scrollable: "_scrollable_nuokb_100",
|
|
7
|
+
content: "_content_nuokb_108",
|
|
8
|
+
header: "_header_nuokb_113",
|
|
9
|
+
alignCenter: "_alignCenter_nuokb_120",
|
|
10
|
+
title: "_title_nuokb_126",
|
|
11
|
+
description: "_description_nuokb_131",
|
|
12
|
+
closeButton: "_closeButton_nuokb_136"
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as default };
|