reaxify 0.0.93 → 0.0.95
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/Drawer/index.cjs.js +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.es.js +121 -100
- package/dist/components/Menu/index.cjs.js +1 -1
- package/dist/components/Menu/index.d.ts +4 -3
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.es.js +125 -102
- package/dist/components/Modal/index.cjs.js +1 -1
- package/dist/components/Modal/index.d.ts +3 -3
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.es.js +103 -82
- package/dist/components/Portal/index.cjs.js +1 -1
- package/dist/components/Portal/index.d.ts.map +1 -1
- package/dist/components/Portal/index.es.js +10 -12
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.es.js +48 -49
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/portalElement.cjs.js +1 -0
- package/dist/stores/portalElement.d.ts +6 -0
- package/dist/stores/portalElement.d.ts.map +1 -0
- package/dist/stores/portalElement.es.js +16 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/reaxify.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),x=require("../../hooks/useClasses.cjs.js"),u=require("react"),z=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),q=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),m=require("../../helpers/cn.cjs.js"),w=require("../Card/index.cjs.js"),F=require("../Portal/index.cjs.js"),$=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),j=u.createContext({open:!1,onClose:()=>{},duration:300,anchor:"start",transitionState:"unmounted",preventClose:!1});function f({as:r,ref:n,open:t=!1,onClose:e=()=>{},onEnter:i,onEntering:v,onEntered:y,onExit:b,onExiting:h,onExited:p,duration:s=300,preventClose:c=!1,anchor:l="end",className:D="",children:R,...H}){const a=x(d=>d.drawer),g=u.useRef(null),N=r||"div",k={entering:"active opacity-100 pointer-events-auto",entered:"active opacity-100 pointer-events-auto",exiting:"opacity-0 pointer-events-none",exited:"opacity-0 pointer-events-none",unmounted:""},S=u.useMemo(()=>{var M;const d={start:"flex-row-reverse",end:"flex-row",top:"flex-col-reverse",bottom:"flex-col"},B=(M=a==null?void 0:a.anchor)==null?void 0:M[l];return[d[l],B]},[l,a==null?void 0:a.anchor]),C=()=>{c||e()};return u.useImperativeHandle(n,()=>g.current),z.useHotkey("Escape",()=>e(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:t&&!c}),o.jsx(F,{children:o.jsx($.default,{nodeRef:g,in:t,timeout:s,unmountOnExit:!0,onEnter:i,onEntering:v,onEntered:y,onExit:b,onExiting:h,onExited:p,children:d=>o.jsxs(N,{ref:g,style:{transitionDuration:`${s}ms`},"data-open":t,className:q.twMerge("fixed size-full inset-0 flex z-10 bg-black/20 backdrop-blur transition-opacity [--drawer-ratio:1] rtl:[--drawer-ratio:-1]",a==null?void 0:a.base,k[d],S,D),...H,children:[o.jsx("div",{onClick:C,className:m("absolute inset-0 size-full cursor-default opacity-0",c&&"[&:active~*]:scale-95")}),o.jsx(j.Provider,{value:{open:t,onClose:C,transitionState:d,duration:s,anchor:l,preventClose:c},children:R})]})})})}function E({children:r,className:n="",...t}){const e=x(s=>s.drawer.menu),{anchor:i,duration:v,transitionState:y,preventClose:b}=u.useContext(j),h=u.useMemo(()=>{var l;const s={start:"w-[31.875rem] h-full max-w-[92.5%] rounded-e me-auto",end:"w-[31.875rem] h-full max-w-[92.5%] rounded-s ms-auto",top:"w-full max-h-[92.5%] rounded-b mb-auto",bottom:"w-full max-h-[92.5%] rounded-t mt-auto"},c=(l=e==null?void 0:e.anchor)==null?void 0:l[i];return[s[i],c]},[i,e==null?void 0:e.anchor]),p=u.useMemo(()=>({start:{entering:"translate-x-0",entered:"translate-x-0",exiting:"-translate-x-[calc(100%*var(--drawer-ratio))]",exited:"-translate-x-[calc(100%*var(--drawer-ratio))]",unmounted:""},end:{entering:"translate-x-0",entered:"translate-x-0",exiting:"translate-x-[calc(100%*var(--drawer-ratio))]",exited:"translate-x-[calc(100%*var(--drawer-ratio))]",unmounted:""},top:{entering:"translate-y-0",entered:"translate-y-0",exiting:"-translate-y-full",exited:"-translate-y-full",unmounted:""},bottom:{entering:"translate-y-0",entered:"translate-y-0",exiting:"translate-y-full",exited:"translate-y-full",unmounted:""}})[i],[i]);return o.jsx(w,{as:"div",style:{transitionDuration:`${v}ms`},className:q.twMerge("relative flex flex-col transition-[translate,width] rounded-none",b&&"transition-transform",e==null?void 0:e.base,p[y],h,n),...t,children:r})}function I({className:r,...n}){const t=x(e=>e.drawer.header.base);return o.jsx(w.Header,{className:m(t,r),...n})}function O({className:r,...n}){const t=x(e=>e.drawer.body.base);return o.jsx(w.Body,{className:m("flex-1 overflow-auto",t,r),...n})}function P({className:r,...n}){const t=x(e=>e.drawer.footer.base);return o.jsx(w.Footer,{className:m(t,r),...n})}f.Menu=E;f.Header=I;f.Body=O;f.Footer=P;exports.DrawerContext=j;exports.default=f;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithAs, ToggleProps } from '../../types';
|
|
1
|
+
import { ComponentPropsWithAs, ToggleEventProps, ToggleProps } from '../../types';
|
|
2
2
|
import { ComponentProps, ElementType } from 'react';
|
|
3
3
|
import { TransitionStatus } from 'react-transition-group';
|
|
4
4
|
type Anchor = "start" | "end" | "top" | "bottom";
|
|
@@ -12,14 +12,14 @@ type DrawerBaseProps = {
|
|
|
12
12
|
anchor?: Anchor;
|
|
13
13
|
duration?: number;
|
|
14
14
|
preventClose?: boolean;
|
|
15
|
-
} & Partial<ToggleProps>;
|
|
15
|
+
} & Partial<ToggleEventProps> & Partial<ToggleProps>;
|
|
16
16
|
type DrawerProps<E extends ElementType> = ComponentPropsWithAs<E, DrawerBaseProps>;
|
|
17
17
|
type DrawerMenuProps = Omit<ComponentProps<"div">, "as" | "ref">;
|
|
18
18
|
type DrawerHeaderProps = ComponentProps<"div">;
|
|
19
19
|
type DrawerBodyProps = ComponentProps<"div">;
|
|
20
20
|
type DrawerFooterProps = ComponentProps<"div">;
|
|
21
21
|
export declare const DrawerContext: import('react').Context<Context>;
|
|
22
|
-
declare function Drawer<E extends ElementType = "div">({ as, ref, open, onClose, duration, preventClose, anchor, className, children, ...props }: DrawerProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function Drawer<E extends ElementType = "div">({ as, ref, open, onClose, onEnter, onEntering, onEntered, onExit, onExiting, onExited, duration, preventClose, anchor, className, children, ...props }: DrawerProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
declare namespace Drawer {
|
|
24
24
|
var Menu: typeof DrawerMenu;
|
|
25
25
|
var Header: typeof DrawerHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG9E,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAMtE,KAAK,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AACjD,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,WAAW,CAAC;AAChB,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC;AACvB,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,oBAAoB,CAC5D,CAAC,EACD,eAAe,CAChB,CAAC;AACF,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AACjE,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/C,KAAK,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7C,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAG/C,eAAO,MAAM,aAAa,kCAOxB,CAAC;AAEH,iBAAS,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC7C,EAAE,EACF,GAAG,EACH,IAAY,EACZ,OAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAc,EACd,YAAoB,EACpB,MAAc,EACd,SAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,CAAC,CAAC,2CAoFhB;kBArGQ,MAAM;;;;;;AAsGf,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAc,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAgE1E;AACD,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAG/D;AACD,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAQ3D;AACD,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAG/D;AAOD,eAAe,MAAM,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as s, jsxs as
|
|
2
|
+
import { jsx as s, jsxs as j } from "react/jsx-runtime";
|
|
3
3
|
import d from "../../hooks/useClasses.es.js";
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { useHotkey as
|
|
6
|
-
import { twMerge as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
4
|
+
import { createContext as E, useRef as I, useMemo as g, useImperativeHandle as P, useContext as $ } from "react";
|
|
5
|
+
import { useHotkey as O } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
6
|
+
import { twMerge as R } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
7
|
+
import m from "../../helpers/cn.es.js";
|
|
8
|
+
import f from "../Card/index.es.js";
|
|
9
|
+
import T from "../Portal/index.es.js";
|
|
10
|
+
import q from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
+
const N = E({
|
|
12
12
|
open: !1,
|
|
13
13
|
onClose: () => {
|
|
14
14
|
},
|
|
@@ -17,95 +17,116 @@ const D = B({
|
|
|
17
17
|
transitionState: "unmounted",
|
|
18
18
|
preventClose: !1
|
|
19
19
|
});
|
|
20
|
-
function
|
|
21
|
-
as:
|
|
22
|
-
ref:
|
|
23
|
-
open:
|
|
20
|
+
function x({
|
|
21
|
+
as: r,
|
|
22
|
+
ref: n,
|
|
23
|
+
open: t = !1,
|
|
24
24
|
onClose: e = () => {
|
|
25
25
|
},
|
|
26
|
+
onEnter: i,
|
|
27
|
+
onEntering: w,
|
|
28
|
+
onEntered: p,
|
|
29
|
+
onExit: v,
|
|
30
|
+
onExiting: y,
|
|
31
|
+
onExited: h,
|
|
26
32
|
duration: o = 300,
|
|
27
|
-
preventClose:
|
|
33
|
+
preventClose: u = !1,
|
|
28
34
|
anchor: l = "end",
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
31
|
-
...
|
|
35
|
+
className: H = "",
|
|
36
|
+
children: k,
|
|
37
|
+
...B
|
|
32
38
|
}) {
|
|
33
|
-
const
|
|
39
|
+
const a = d((c) => c.drawer), b = I(null), M = r || "div", z = {
|
|
34
40
|
entering: "active opacity-100 pointer-events-auto",
|
|
35
41
|
entered: "active opacity-100 pointer-events-auto",
|
|
36
42
|
exiting: "opacity-0 pointer-events-none",
|
|
37
43
|
exited: "opacity-0 pointer-events-none",
|
|
38
44
|
unmounted: ""
|
|
39
|
-
},
|
|
40
|
-
var
|
|
41
|
-
const
|
|
45
|
+
}, F = g(() => {
|
|
46
|
+
var D;
|
|
47
|
+
const c = {
|
|
42
48
|
start: "flex-row-reverse",
|
|
43
49
|
end: "flex-row",
|
|
44
50
|
top: "flex-col-reverse",
|
|
45
51
|
bottom: "flex-col"
|
|
46
|
-
},
|
|
47
|
-
return [
|
|
48
|
-
}, [l,
|
|
49
|
-
|
|
52
|
+
}, S = (D = a == null ? void 0 : a.anchor) == null ? void 0 : D[l];
|
|
53
|
+
return [c[l], S];
|
|
54
|
+
}, [l, a == null ? void 0 : a.anchor]), C = () => {
|
|
55
|
+
u || e();
|
|
50
56
|
};
|
|
51
|
-
return
|
|
57
|
+
return P(n, () => b.current), O("Escape", () => e(), {
|
|
52
58
|
conflictBehavior: "allow",
|
|
53
59
|
ignoreInputs: !0,
|
|
54
|
-
enabled:
|
|
55
|
-
}), /* @__PURE__ */ s(
|
|
56
|
-
|
|
60
|
+
enabled: t && !u
|
|
61
|
+
}), /* @__PURE__ */ s(T, { children: /* @__PURE__ */ s(
|
|
62
|
+
q,
|
|
57
63
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
nodeRef: b,
|
|
65
|
+
in: t,
|
|
66
|
+
timeout: o,
|
|
67
|
+
unmountOnExit: !0,
|
|
68
|
+
onEnter: i,
|
|
69
|
+
onEntering: w,
|
|
70
|
+
onEntered: p,
|
|
71
|
+
onExit: v,
|
|
72
|
+
onExiting: y,
|
|
73
|
+
onExited: h,
|
|
74
|
+
children: (c) => /* @__PURE__ */ j(
|
|
75
|
+
M,
|
|
76
|
+
{
|
|
77
|
+
ref: b,
|
|
78
|
+
style: { transitionDuration: `${o}ms` },
|
|
79
|
+
"data-open": t,
|
|
80
|
+
className: R(
|
|
81
|
+
"fixed size-full inset-0 flex z-10 bg-black/20 backdrop-blur transition-opacity [--drawer-ratio:1] rtl:[--drawer-ratio:-1]",
|
|
82
|
+
a == null ? void 0 : a.base,
|
|
83
|
+
z[c],
|
|
84
|
+
F,
|
|
85
|
+
H
|
|
86
|
+
),
|
|
87
|
+
...B,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ s(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
onClick: C,
|
|
93
|
+
className: m(
|
|
94
|
+
"absolute inset-0 size-full cursor-default opacity-0",
|
|
95
|
+
u && "[&:active~*]:scale-95"
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ s(
|
|
100
|
+
N.Provider,
|
|
101
|
+
{
|
|
102
|
+
value: {
|
|
103
|
+
open: t,
|
|
104
|
+
onClose: C,
|
|
105
|
+
transitionState: c,
|
|
106
|
+
duration: o,
|
|
107
|
+
anchor: l,
|
|
108
|
+
preventClose: u
|
|
109
|
+
},
|
|
110
|
+
children: k
|
|
111
|
+
}
|
|
77
112
|
)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
D.Provider,
|
|
82
|
-
{
|
|
83
|
-
value: {
|
|
84
|
-
open: r,
|
|
85
|
-
onClose: b,
|
|
86
|
-
transitionState: u,
|
|
87
|
-
duration: o,
|
|
88
|
-
anchor: l,
|
|
89
|
-
preventClose: i
|
|
90
|
-
},
|
|
91
|
-
children: v
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
]
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
)
|
|
95
116
|
}
|
|
96
|
-
) })
|
|
117
|
+
) });
|
|
97
118
|
}
|
|
98
|
-
function
|
|
99
|
-
const e = d((
|
|
100
|
-
var
|
|
101
|
-
const
|
|
119
|
+
function A({ children: r, className: n = "", ...t }) {
|
|
120
|
+
const e = d((o) => o.drawer.menu), { anchor: i, duration: w, transitionState: p, preventClose: v } = $(N), y = g(() => {
|
|
121
|
+
var l;
|
|
122
|
+
const o = {
|
|
102
123
|
start: "w-[31.875rem] h-full max-w-[92.5%] rounded-e me-auto",
|
|
103
124
|
end: "w-[31.875rem] h-full max-w-[92.5%] rounded-s ms-auto",
|
|
104
125
|
top: "w-full max-h-[92.5%] rounded-b mb-auto",
|
|
105
126
|
bottom: "w-full max-h-[92.5%] rounded-t mt-auto"
|
|
106
|
-
},
|
|
107
|
-
return [
|
|
108
|
-
}, [
|
|
127
|
+
}, u = (l = e == null ? void 0 : e.anchor) == null ? void 0 : l[i];
|
|
128
|
+
return [o[i], u];
|
|
129
|
+
}, [i, e == null ? void 0 : e.anchor]), h = g(() => ({
|
|
109
130
|
start: {
|
|
110
131
|
entering: "translate-x-0",
|
|
111
132
|
entered: "translate-x-0",
|
|
@@ -134,48 +155,48 @@ function I({ children: n, className: a = "", ...r }) {
|
|
|
134
155
|
exited: "translate-y-full",
|
|
135
156
|
unmounted: ""
|
|
136
157
|
}
|
|
137
|
-
})[
|
|
158
|
+
})[i], [i]);
|
|
138
159
|
return /* @__PURE__ */ s(
|
|
139
|
-
|
|
160
|
+
f,
|
|
140
161
|
{
|
|
141
162
|
as: "div",
|
|
142
|
-
style: { transitionDuration: `${
|
|
143
|
-
className:
|
|
163
|
+
style: { transitionDuration: `${w}ms` },
|
|
164
|
+
className: R(
|
|
144
165
|
"relative flex flex-col transition-[translate,width] rounded-none",
|
|
145
|
-
|
|
166
|
+
v && "transition-transform",
|
|
146
167
|
e == null ? void 0 : e.base,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
168
|
+
h[p],
|
|
169
|
+
y,
|
|
170
|
+
n
|
|
150
171
|
),
|
|
151
|
-
...
|
|
152
|
-
children:
|
|
172
|
+
...t,
|
|
173
|
+
children: r
|
|
153
174
|
}
|
|
154
175
|
);
|
|
155
176
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
return /* @__PURE__ */ s(
|
|
177
|
+
function G({ className: r, ...n }) {
|
|
178
|
+
const t = d((e) => e.drawer.header.base);
|
|
179
|
+
return /* @__PURE__ */ s(f.Header, { className: m(t, r), ...n });
|
|
159
180
|
}
|
|
160
|
-
function
|
|
161
|
-
const
|
|
181
|
+
function J({ className: r, ...n }) {
|
|
182
|
+
const t = d((e) => e.drawer.body.base);
|
|
162
183
|
return /* @__PURE__ */ s(
|
|
163
|
-
|
|
184
|
+
f.Body,
|
|
164
185
|
{
|
|
165
|
-
className:
|
|
166
|
-
...
|
|
186
|
+
className: m("flex-1 overflow-auto", t, r),
|
|
187
|
+
...n
|
|
167
188
|
}
|
|
168
189
|
);
|
|
169
190
|
}
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
return /* @__PURE__ */ s(
|
|
191
|
+
function K({ className: r, ...n }) {
|
|
192
|
+
const t = d((e) => e.drawer.footer.base);
|
|
193
|
+
return /* @__PURE__ */ s(f.Footer, { className: m(t, r), ...n });
|
|
173
194
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
195
|
+
x.Menu = A;
|
|
196
|
+
x.Header = G;
|
|
197
|
+
x.Body = J;
|
|
198
|
+
x.Footer = K;
|
|
178
199
|
export {
|
|
179
|
-
|
|
180
|
-
|
|
200
|
+
N as DrawerContext,
|
|
201
|
+
x as default
|
|
181
202
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const i=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const i=require("react/jsx-runtime"),A=require("../../helpers/cn.cjs.js"),L=require("../../hooks/useClasses.cjs.js"),t=require("react"),G=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),R=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),J=require("../Button/index.cjs.js"),K=require("../Portal/index.cjs.js"),Q=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),w=t.createContext({open:!1,onClose:()=>{},transitionState:"unmounted",closeOnClick:!1,preventClose:!1});function $({as:l,ref:a,open:n,duration:m=300,onClose:r,onEnter:v,onEntering:y,onEntered:C,onExit:u,onExiting:b,onExited:M,closeOnClick:f=!1,preventClose:j=!1,anchorEl:k=null,className:I,children:H,...N}){const W=L(e=>e.menu.base),B=l||"ul",s=16,o=t.useRef(null),S=t.useRef({left:s,right:s,top:s}),D={entering:"scale-100 opacity-100",entered:"scale-100 opacity-100",exiting:"scale-90 opacity-0",exited:"scale-90 opacity-0",unmounted:""},P=t.useCallback(e=>{S.current=e},[]),z=t.useCallback(e=>{var c,x,d;(c=o.current)==null||c.style.setProperty("--left",`${e.left}px`),(x=o.current)==null||x.style.setProperty("--right",`${e.right}px`),(d=o.current)==null||d.style.setProperty("--top",`${e.top}px`)},[]),p=t.useCallback(()=>{var E,O;if(!n||!k)return;const e=k.getBoundingClientRect(),c=window.innerWidth,x=window.innerHeight,d=((E=o.current)==null?void 0:E.offsetWidth)||150,T=((O=o.current)==null?void 0:O.offsetHeight)||200;let g=e.left,q=e.right,h=e.bottom;g=Math.min(Math.max(g,s),c-d-s),q=Math.min(Math.max(c-e.right,s),c-d-s),h=Math.min(Math.max(h,s),x-T-s),P({left:g,right:q,top:h}),z({left:g,right:q,top:h})},[n,k,P,z]),F=()=>{j||r==null||r()};return t.useEffect(()=>{p()},[p,H]),t.useEffect(()=>{const e=()=>{p()};return window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[p]),t.useImperativeHandle(a,()=>o.current),G.useHotkey("Escape",()=>r(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:n&&!j}),i.jsx(K,{children:i.jsx(Q.default,{nodeRef:o,in:n,timeout:m,unmountOnExit:!0,onEnter:v,onEntering:y,onEntered:C,onExit:u,onExiting:b,onExited:M,children:e=>i.jsx(w.Provider,{value:{open:n,onClose:F,transitionState:e,closeOnClick:f,preventClose:j},children:i.jsxs(U,{children:[i.jsx(V,{}),i.jsx(B,{ref:o,autoFocus:!0,"data-open":n,role:"menu",style:{transitionDuration:`${m}ms`},className:R.twMerge("w-fit min-w-52 bg-white shadow-lg rounded py-2 transition-[scale,opacity] absolute top-(--top) left-(--left) right-auto origin-top-left rtl:left-auto rtl:right-(--right) rtl:origin-top-right",W,D[e],I),...N,children:H})]})})})})}function U({children:l}){const{transitionState:a}=t.useContext(w),n={entering:"active pointer-events-auto",entered:"active pointer-events-auto",exiting:"pointer-events-none",exited:"pointer-events-none",unmounted:""};return i.jsx("div",{className:R.twMerge("fixed inset-0 size-full flex flex-col bg-transparent transition-opacity overflow-hidden z-10",n[a]),children:l})}function V(){const{onClose:l,preventClose:a}=t.useContext(w);return i.jsx("div",{className:A("w-full flex-1 opacity-0 cursor-default lg:absolute lg:size-full lg:inset-0",a&&"[&:active~*]:scale-95"),onClick:l})}function X({as:l,closeOnClick:a,className:n,children:m,onClick:r,...v}){const y=L(f=>f.menu.item.base),{closeOnClick:C,onClose:u}=t.useContext(w),b=a??C,M=f=>{b&&(u==null||u()),r==null||r(f)};return i.jsx(J,{as:l??"li",color:"light",variant:"text",role:"menuitem",className:R.twMerge("w-full flex items-center justify-start align-middle px-4 py-1.5 bg-transparent text-base font-normal rounded-none whitespace-nowrap transition-colors hover:bg-dark/5",y,n),onClick:M,...v,children:m})}$.Item=X;module.exports=$;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ComponentPropsWithAs, ToggleProps } from '../../types';
|
|
1
|
+
import { ComponentPropsWithAs, ToggleEventProps, ToggleProps } from '../../types';
|
|
2
2
|
import { ElementType } from 'react';
|
|
3
3
|
type MenuProps = {
|
|
4
4
|
anchorEl?: HTMLElement | null;
|
|
5
5
|
closeOnClick?: boolean;
|
|
6
6
|
preventClose?: boolean;
|
|
7
|
-
|
|
7
|
+
duration?: number;
|
|
8
|
+
} & Partial<ToggleEventProps> & ToggleProps;
|
|
8
9
|
type MenuItemProps = {
|
|
9
10
|
closeOnClick?: boolean;
|
|
10
11
|
};
|
|
11
|
-
declare function Menu<E extends ElementType = "ul">({ as, ref, open, onClose, closeOnClick, preventClose, anchorEl, className, children, ...props }: ComponentPropsWithAs<E, MenuProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function Menu<E extends ElementType = "ul">({ as, ref, open, duration, onClose, onEnter, onEntering, onEntered, onExit, onExiting, onExited, closeOnClick, preventClose, anchorEl, className, children, ...props }: ComponentPropsWithAs<E, MenuProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
declare namespace Menu {
|
|
13
14
|
var Item: typeof MenuItem;
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAEL,WAAW,EAOZ,MAAM,OAAO,CAAC;AAOf,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAC3B,WAAW,CAAC;AACd,KAAK,aAAa,GAAG;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgBF,iBAAS,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,EAAE,EAC1C,EAAE,EACF,GAAG,EACH,IAAI,EACJ,QAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAoB,EACpB,YAAoB,EACpB,QAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,SAAS,CAAC,2CA2HpC;kBA7IQ,IAAI;;;AA8Kb,iBAAS,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EAAE,EAClD,EAAE,EACF,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,aAAa,CAAC,2CAyBxC;AAID,eAAe,IAAI,CAAC"}
|