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,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { useHotkey as
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
2
|
+
import { jsx as r, jsxs as J } from "react/jsx-runtime";
|
|
3
|
+
import K from "../../helpers/cn.es.js";
|
|
4
|
+
import $ from "../../hooks/useClasses.es.js";
|
|
5
|
+
import { createContext as Q, useRef as N, useCallback as H, useEffect as W, useImperativeHandle as U, useContext as z } from "react";
|
|
6
|
+
import { useHotkey as V } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
7
|
+
import { twMerge as O } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
8
|
+
import X from "../Button/index.es.js";
|
|
9
|
+
import Y from "../Portal/index.es.js";
|
|
10
|
+
import Z from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
+
const w = Q({
|
|
12
12
|
open: !1,
|
|
13
13
|
onClose: () => {
|
|
14
14
|
},
|
|
@@ -16,97 +16,120 @@ const v = T({
|
|
|
16
16
|
closeOnClick: !1,
|
|
17
17
|
preventClose: !1
|
|
18
18
|
});
|
|
19
|
-
function
|
|
20
|
-
as:
|
|
21
|
-
ref:
|
|
19
|
+
function _({
|
|
20
|
+
as: s,
|
|
21
|
+
ref: l,
|
|
22
22
|
open: e,
|
|
23
|
-
|
|
23
|
+
duration: m = 300,
|
|
24
|
+
onClose: o,
|
|
25
|
+
onEnter: x,
|
|
26
|
+
onEntering: v,
|
|
27
|
+
onEntered: y,
|
|
28
|
+
onExit: c,
|
|
29
|
+
onExiting: b,
|
|
30
|
+
onExited: C,
|
|
24
31
|
closeOnClick: u = !1,
|
|
25
|
-
preventClose:
|
|
26
|
-
anchorEl:
|
|
27
|
-
className:
|
|
28
|
-
children:
|
|
29
|
-
...
|
|
32
|
+
preventClose: M = !1,
|
|
33
|
+
anchorEl: k = null,
|
|
34
|
+
className: j,
|
|
35
|
+
children: R,
|
|
36
|
+
...S
|
|
30
37
|
}) {
|
|
31
|
-
const
|
|
38
|
+
const D = $((t) => t.menu.base), F = s || "ul", n = 16, i = N(null), T = N({
|
|
32
39
|
left: n,
|
|
33
40
|
right: n,
|
|
34
41
|
top: n
|
|
35
|
-
}),
|
|
42
|
+
}), q = {
|
|
36
43
|
entering: "scale-100 opacity-100",
|
|
37
44
|
entered: "scale-100 opacity-100",
|
|
38
45
|
exiting: "scale-90 opacity-0",
|
|
39
46
|
exited: "scale-90 opacity-0",
|
|
40
47
|
unmounted: ""
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
}, []),
|
|
44
|
-
var
|
|
45
|
-
(
|
|
46
|
-
}, []),
|
|
47
|
-
var
|
|
48
|
-
if (!e || !
|
|
49
|
-
const t =
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
Math.max(
|
|
53
|
-
|
|
54
|
-
),
|
|
55
|
-
}, [e,
|
|
56
|
-
|
|
48
|
+
}, E = H((t) => {
|
|
49
|
+
T.current = t;
|
|
50
|
+
}, []), L = H((t) => {
|
|
51
|
+
var a, p, f;
|
|
52
|
+
(a = i.current) == null || a.style.setProperty("--left", `${t.left}px`), (p = i.current) == null || p.style.setProperty("--right", `${t.right}px`), (f = i.current) == null || f.style.setProperty("--top", `${t.top}px`);
|
|
53
|
+
}, []), d = H(() => {
|
|
54
|
+
var B, I;
|
|
55
|
+
if (!e || !k) return;
|
|
56
|
+
const t = k.getBoundingClientRect(), a = window.innerWidth, p = window.innerHeight, f = ((B = i.current) == null ? void 0 : B.offsetWidth) || 150, G = ((I = i.current) == null ? void 0 : I.offsetHeight) || 200;
|
|
57
|
+
let h = t.left, P = t.right, g = t.bottom;
|
|
58
|
+
h = Math.min(Math.max(h, n), a - f - n), P = Math.min(
|
|
59
|
+
Math.max(a - t.right, n),
|
|
60
|
+
a - f - n
|
|
61
|
+
), g = Math.min(Math.max(g, n), p - G - n), E({ left: h, right: P, top: g }), L({ left: h, right: P, top: g });
|
|
62
|
+
}, [e, k, E, L]), A = () => {
|
|
63
|
+
M || o == null || o();
|
|
57
64
|
};
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
}, [
|
|
65
|
+
return W(() => {
|
|
66
|
+
d();
|
|
67
|
+
}, [d, R]), W(() => {
|
|
61
68
|
const t = () => {
|
|
62
|
-
|
|
69
|
+
d();
|
|
63
70
|
};
|
|
64
71
|
return window.addEventListener("scroll", t), window.addEventListener("resize", t), () => {
|
|
65
72
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t);
|
|
66
73
|
};
|
|
67
|
-
}, [
|
|
74
|
+
}, [d]), U(l, () => i.current), V("Escape", () => o(), {
|
|
68
75
|
conflictBehavior: "allow",
|
|
69
76
|
ignoreInputs: !0,
|
|
70
|
-
enabled: e && !
|
|
71
|
-
}), /* @__PURE__ */
|
|
72
|
-
|
|
77
|
+
enabled: e && !M
|
|
78
|
+
}), /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(
|
|
79
|
+
Z,
|
|
73
80
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
nodeRef: i,
|
|
82
|
+
in: e,
|
|
83
|
+
timeout: m,
|
|
84
|
+
unmountOnExit: !0,
|
|
85
|
+
onEnter: x,
|
|
86
|
+
onEntering: v,
|
|
87
|
+
onEntered: y,
|
|
88
|
+
onExit: c,
|
|
89
|
+
onExiting: b,
|
|
90
|
+
onExited: C,
|
|
91
|
+
children: (t) => /* @__PURE__ */ r(
|
|
92
|
+
w.Provider,
|
|
93
|
+
{
|
|
94
|
+
value: {
|
|
95
|
+
open: e,
|
|
96
|
+
onClose: A,
|
|
97
|
+
transitionState: t,
|
|
98
|
+
closeOnClick: u,
|
|
99
|
+
preventClose: M
|
|
100
|
+
},
|
|
101
|
+
children: /* @__PURE__ */ J(tt, { children: [
|
|
102
|
+
/* @__PURE__ */ r(et, {}),
|
|
103
|
+
/* @__PURE__ */ r(
|
|
104
|
+
F,
|
|
105
|
+
{
|
|
106
|
+
ref: i,
|
|
107
|
+
autoFocus: !0,
|
|
108
|
+
"data-open": e,
|
|
109
|
+
role: "menu",
|
|
110
|
+
style: { transitionDuration: `${m}ms` },
|
|
111
|
+
className: O(
|
|
112
|
+
"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",
|
|
113
|
+
D,
|
|
114
|
+
q[t],
|
|
115
|
+
j
|
|
116
|
+
),
|
|
117
|
+
...S,
|
|
118
|
+
children: R
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] })
|
|
122
|
+
}
|
|
123
|
+
)
|
|
101
124
|
}
|
|
102
|
-
) })
|
|
125
|
+
) });
|
|
103
126
|
}
|
|
104
|
-
function
|
|
105
|
-
const { transitionState:
|
|
106
|
-
return /* @__PURE__ */
|
|
127
|
+
function tt({ children: s }) {
|
|
128
|
+
const { transitionState: l } = z(w);
|
|
129
|
+
return /* @__PURE__ */ r(
|
|
107
130
|
"div",
|
|
108
131
|
{
|
|
109
|
-
className:
|
|
132
|
+
className: O(
|
|
110
133
|
"fixed inset-0 size-full flex flex-col bg-transparent transition-opacity overflow-hidden z-10",
|
|
111
134
|
{
|
|
112
135
|
entering: "active pointer-events-auto",
|
|
@@ -114,55 +137,55 @@ function Q({ children: r }) {
|
|
|
114
137
|
exiting: "pointer-events-none",
|
|
115
138
|
exited: "pointer-events-none",
|
|
116
139
|
unmounted: ""
|
|
117
|
-
}[
|
|
140
|
+
}[l]
|
|
118
141
|
),
|
|
119
|
-
children:
|
|
142
|
+
children: s
|
|
120
143
|
}
|
|
121
144
|
);
|
|
122
145
|
}
|
|
123
|
-
function
|
|
124
|
-
const { onClose:
|
|
125
|
-
return /* @__PURE__ */
|
|
146
|
+
function et() {
|
|
147
|
+
const { onClose: s, preventClose: l } = z(w);
|
|
148
|
+
return /* @__PURE__ */ r(
|
|
126
149
|
"div",
|
|
127
150
|
{
|
|
128
|
-
className:
|
|
151
|
+
className: K(
|
|
129
152
|
"w-full flex-1 opacity-0 cursor-default lg:absolute lg:size-full lg:inset-0",
|
|
130
|
-
|
|
153
|
+
l && "[&:active~*]:scale-95"
|
|
131
154
|
),
|
|
132
|
-
onClick:
|
|
155
|
+
onClick: s
|
|
133
156
|
}
|
|
134
157
|
);
|
|
135
158
|
}
|
|
136
|
-
function
|
|
137
|
-
as:
|
|
138
|
-
closeOnClick:
|
|
159
|
+
function nt({
|
|
160
|
+
as: s,
|
|
161
|
+
closeOnClick: l,
|
|
139
162
|
className: e,
|
|
140
|
-
children:
|
|
141
|
-
onClick:
|
|
142
|
-
...
|
|
163
|
+
children: m,
|
|
164
|
+
onClick: o,
|
|
165
|
+
...x
|
|
143
166
|
}) {
|
|
144
|
-
const
|
|
145
|
-
b && (
|
|
167
|
+
const v = $((u) => u.menu.item.base), { closeOnClick: y, onClose: c } = z(w), b = l ?? y, C = (u) => {
|
|
168
|
+
b && (c == null || c()), o == null || o(u);
|
|
146
169
|
};
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
|
|
170
|
+
return /* @__PURE__ */ r(
|
|
171
|
+
X,
|
|
149
172
|
{
|
|
150
|
-
as:
|
|
173
|
+
as: s ?? "li",
|
|
151
174
|
color: "light",
|
|
152
175
|
variant: "text",
|
|
153
176
|
role: "menuitem",
|
|
154
|
-
className:
|
|
177
|
+
className: O(
|
|
155
178
|
"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",
|
|
156
|
-
|
|
179
|
+
v,
|
|
157
180
|
e
|
|
158
181
|
),
|
|
159
182
|
onClick: C,
|
|
160
|
-
...
|
|
161
|
-
children:
|
|
183
|
+
...x,
|
|
184
|
+
children: m
|
|
162
185
|
}
|
|
163
186
|
);
|
|
164
187
|
}
|
|
165
|
-
|
|
188
|
+
_.Item = nt;
|
|
166
189
|
export {
|
|
167
|
-
|
|
190
|
+
_ as default
|
|
168
191
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),m=require("../../helpers/cn.cjs.js"),r=require("../../hooks/useClasses.cjs.js"),i=require("react"),k=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),z=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),x=require("../Card/index.cjs.js"),R=require("../Portal/index.cjs.js"),B=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),j=i.createContext({size:"md",open:!1,onClose:()=>{},transitionState:"unmounted",duration:300});function l({as:t,ref:n,size:o="md",open:e=!1,onClose:a=()=>{},onEnter:f,onEntering:p,onEntered:b,onExit:v,onExiting:u,onExited:c,duration:y=300,preventClose:g=!1,className:C,children:h,...w}){const H=r(d=>d.modal.base),M=i.useRef(null),N=t||"div",S={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:""},q=()=>{g||a()};return i.useImperativeHandle(n,()=>M.current),k.useHotkey("Escape",()=>a(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:e&&!g}),s.jsx(R,{children:s.jsx(B.default,{nodeRef:M,in:e,timeout:y,unmountOnExit:!0,onEnter:f,onEntering:p,onEntered:b,onExit:v,onExiting:u,onExited:c,children:d=>s.jsxs(N,{ref:M,"data-open":e,style:{transitionDuration:`${y}ms`},className:z.twMerge("modal fixed size-full inset-0 flex flex-col z-10 bg-black/20 transition-opacity backdrop-blur p-4",H,S[d],C),...w,children:[s.jsx("div",{onClick:q,className:m("absolute inset-0 cursor-default opacity-0",g&&"[&:active~*]:scale-95")}),s.jsx(j.Provider,{value:{size:o,open:e,onClose:q,transitionState:d,duration:y},children:h})]})})})}function D({className:t,children:n,...o}){const e=r(u=>u.modal.dialog),{size:a,transitionState:f,duration:p}=i.useContext(j),b={entering:"scale-100",entered:"scale-100",exiting:"scale-75",exited:"scale-75",unmounted:""},v=i.useMemo(()=>{var c;return[{sm:"min-[576px]:w-[300px]",md:"min-[576px]:w-[500px]",lg:"min-[992px]:w-[800px]"}[a],(c=e==null?void 0:e.size)==null?void 0:c[a]]},[a,e==null?void 0:e.size]);return s.jsx(x,{as:"div",style:{transitionDuration:`${p}ms`},className:z.twMerge("max-w-full max-h-full m-auto transition-transform",e==null?void 0:e.base,v,b[f],t),...o,children:n})}function F({className:t,...n}){const o=r(e=>e.modal.header.base);return s.jsx(x.Header,{className:m(o,t),...n})}function $({className:t,...n}){const o=r(e=>e.modal.body.base);return s.jsx(x.Body,{className:m(o,t),...n})}function E({className:t,...n}){const o=r(e=>e.modal.footer.base);return s.jsx(x.Footer,{className:m(o,t),...n})}l.Dialog=D;l.Header=F;l.Body=$;l.Footer=E;exports.ModalContext=j;exports.default=l;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithAs, Size, ToggleProps } from '../../types';
|
|
1
|
+
import { ComponentPropsWithAs, Size, ToggleEventProps, ToggleProps } from '../../types';
|
|
2
2
|
import { ComponentProps, ElementType } from 'react';
|
|
3
3
|
import { TransitionStatus } from 'react-transition-group';
|
|
4
4
|
type Context = {
|
|
@@ -10,13 +10,13 @@ type ModalProps = {
|
|
|
10
10
|
size?: Size;
|
|
11
11
|
duration?: number;
|
|
12
12
|
preventClose?: boolean;
|
|
13
|
-
} & Partial<ToggleProps>;
|
|
13
|
+
} & Partial<ToggleEventProps> & Partial<ToggleProps>;
|
|
14
14
|
type ModalDialogProps = Omit<ComponentProps<"div">, "as" | "ref">;
|
|
15
15
|
type ModalHeaderProps = ComponentProps<"div">;
|
|
16
16
|
type ModalBodyProps = ComponentProps<"div">;
|
|
17
17
|
type ModalFooterProps = ComponentProps<"div">;
|
|
18
18
|
export declare const ModalContext: import('react').Context<Context>;
|
|
19
|
-
declare function Modal<E extends ElementType = "div">({ as, ref, size, open, onClose, duration, preventClose, className, children, ...props }: ComponentPropsWithAs<E, ModalProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function Modal<E extends ElementType = "div">({ as, ref, size, open, onClose, onEnter, onEntering, onEntered, onExit, onExiting, onExited, duration, preventClose, className, children, ...props }: ComponentPropsWithAs<E, ModalProps>): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
declare namespace Modal {
|
|
21
21
|
var Dialog: typeof ModalDialog;
|
|
22
22
|
var Header: typeof ModalHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,gBAAgB,EAChB,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAKtE,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,gBAAgB,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,WAAW,CAAC;AAChB,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,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,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AAClE,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC9C,KAAK,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC5C,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,kCAMvB,CAAC;AAEH,iBAAS,KAAK,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC5C,EAAE,EACF,GAAG,EACH,IAAW,EACX,IAAY,EACZ,OAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAc,EACd,YAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,2CAuErC;kBAxFQ,KAAK;;;;;;AAyFd,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAkCvE;AACD,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAG7D;AACD,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAGzD;AACD,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAG7D;AAOD,eAAe,KAAK,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { useHotkey as
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
2
|
+
import { jsx as a, jsxs as D } from "react/jsx-runtime";
|
|
3
|
+
import m from "../../helpers/cn.es.js";
|
|
4
|
+
import s from "../../hooks/useClasses.es.js";
|
|
5
|
+
import { createContext as S, useRef as F, useImperativeHandle as R, useContext as j, useMemo as E } from "react";
|
|
6
|
+
import { useHotkey as I } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
7
|
+
import { twMerge as C } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
8
|
+
import d from "../Card/index.es.js";
|
|
9
|
+
import P from "../Portal/index.es.js";
|
|
10
|
+
import $ from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
+
const M = S({
|
|
12
12
|
size: "md",
|
|
13
13
|
open: !1,
|
|
14
14
|
onClose: () => {
|
|
@@ -16,98 +16,119 @@ const z = w({
|
|
|
16
16
|
transitionState: "unmounted",
|
|
17
17
|
duration: 300
|
|
18
18
|
});
|
|
19
|
-
function
|
|
19
|
+
function u({
|
|
20
20
|
as: t,
|
|
21
21
|
ref: o,
|
|
22
22
|
size: n = "md",
|
|
23
23
|
open: e = !1,
|
|
24
24
|
onClose: i = () => {
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
onEnter: f,
|
|
27
|
+
onEntering: p,
|
|
28
|
+
onEntered: x,
|
|
29
|
+
onExit: v,
|
|
30
|
+
onExiting: r,
|
|
31
|
+
onExited: l,
|
|
32
|
+
duration: y = 300,
|
|
33
|
+
preventClose: b = !1,
|
|
34
|
+
className: h,
|
|
35
|
+
children: w,
|
|
36
|
+
...N
|
|
31
37
|
}) {
|
|
32
|
-
const
|
|
38
|
+
const H = s((c) => c.modal.base), g = F(null), k = t || "div", B = {
|
|
33
39
|
entering: "active opacity-100 pointer-events-auto",
|
|
34
40
|
entered: "active opacity-100 pointer-events-auto",
|
|
35
41
|
exiting: "opacity-0 pointer-events-none",
|
|
36
42
|
exited: "opacity-0 pointer-events-none",
|
|
37
43
|
unmounted: ""
|
|
38
|
-
},
|
|
39
|
-
|
|
44
|
+
}, z = () => {
|
|
45
|
+
b || i();
|
|
40
46
|
};
|
|
41
|
-
return
|
|
47
|
+
return R(o, () => g.current), I("Escape", () => i(), {
|
|
42
48
|
conflictBehavior: "allow",
|
|
43
49
|
ignoreInputs: !0,
|
|
44
|
-
enabled: e && !
|
|
45
|
-
}), /* @__PURE__ */ a(
|
|
46
|
-
|
|
50
|
+
enabled: e && !b
|
|
51
|
+
}), /* @__PURE__ */ a(P, { children: /* @__PURE__ */ a(
|
|
52
|
+
$,
|
|
47
53
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
nodeRef: g,
|
|
55
|
+
in: e,
|
|
56
|
+
timeout: y,
|
|
57
|
+
unmountOnExit: !0,
|
|
58
|
+
onEnter: f,
|
|
59
|
+
onEntering: p,
|
|
60
|
+
onEntered: x,
|
|
61
|
+
onExit: v,
|
|
62
|
+
onExiting: r,
|
|
63
|
+
onExited: l,
|
|
64
|
+
children: (c) => /* @__PURE__ */ D(
|
|
65
|
+
k,
|
|
66
|
+
{
|
|
67
|
+
ref: g,
|
|
68
|
+
"data-open": e,
|
|
69
|
+
style: { transitionDuration: `${y}ms` },
|
|
70
|
+
className: C(
|
|
71
|
+
"modal fixed size-full inset-0 flex flex-col z-10 bg-black/20 transition-opacity backdrop-blur p-4",
|
|
72
|
+
H,
|
|
73
|
+
B[c],
|
|
74
|
+
h
|
|
75
|
+
),
|
|
76
|
+
...N,
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ a(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
onClick: z,
|
|
82
|
+
className: m(
|
|
83
|
+
"absolute inset-0 cursor-default opacity-0",
|
|
84
|
+
b && "[&:active~*]:scale-95"
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ a(
|
|
89
|
+
M.Provider,
|
|
90
|
+
{
|
|
91
|
+
value: {
|
|
92
|
+
size: n,
|
|
93
|
+
open: e,
|
|
94
|
+
onClose: z,
|
|
95
|
+
transitionState: c,
|
|
96
|
+
duration: y
|
|
97
|
+
},
|
|
98
|
+
children: w
|
|
99
|
+
}
|
|
66
100
|
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
z.Provider,
|
|
71
|
-
{
|
|
72
|
-
value: {
|
|
73
|
-
size: n,
|
|
74
|
-
open: e,
|
|
75
|
-
onClose: b,
|
|
76
|
-
transitionState: d,
|
|
77
|
-
duration: s
|
|
78
|
-
},
|
|
79
|
-
children: v
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
]
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
)
|
|
83
104
|
}
|
|
84
|
-
) })
|
|
105
|
+
) });
|
|
85
106
|
}
|
|
86
|
-
function
|
|
87
|
-
const e =
|
|
107
|
+
function O({ className: t, children: o, ...n }) {
|
|
108
|
+
const e = s((r) => r.modal.dialog), { size: i, transitionState: f, duration: p } = j(M), x = {
|
|
88
109
|
entering: "scale-100",
|
|
89
110
|
entered: "scale-100",
|
|
90
111
|
exiting: "scale-75",
|
|
91
112
|
exited: "scale-75",
|
|
92
113
|
unmounted: ""
|
|
93
|
-
}, v =
|
|
94
|
-
var
|
|
114
|
+
}, v = E(() => {
|
|
115
|
+
var l;
|
|
95
116
|
return [{
|
|
96
117
|
sm: "min-[576px]:w-[300px]",
|
|
97
118
|
md: "min-[576px]:w-[500px]",
|
|
98
119
|
lg: "min-[992px]:w-[800px]"
|
|
99
|
-
}[i], (
|
|
120
|
+
}[i], (l = e == null ? void 0 : e.size) == null ? void 0 : l[i]];
|
|
100
121
|
}, [i, e == null ? void 0 : e.size]);
|
|
101
122
|
return /* @__PURE__ */ a(
|
|
102
|
-
|
|
123
|
+
d,
|
|
103
124
|
{
|
|
104
125
|
as: "div",
|
|
105
|
-
style: { transitionDuration: `${
|
|
106
|
-
className:
|
|
126
|
+
style: { transitionDuration: `${p}ms` },
|
|
127
|
+
className: C(
|
|
107
128
|
"max-w-full max-h-full m-auto transition-transform",
|
|
108
129
|
e == null ? void 0 : e.base,
|
|
109
130
|
v,
|
|
110
|
-
x[
|
|
131
|
+
x[f],
|
|
111
132
|
t
|
|
112
133
|
),
|
|
113
134
|
...n,
|
|
@@ -115,23 +136,23 @@ function R({ className: t, children: o, ...n }) {
|
|
|
115
136
|
}
|
|
116
137
|
);
|
|
117
138
|
}
|
|
118
|
-
function
|
|
119
|
-
const n =
|
|
120
|
-
return /* @__PURE__ */ a(
|
|
139
|
+
function T({ className: t, ...o }) {
|
|
140
|
+
const n = s((e) => e.modal.header.base);
|
|
141
|
+
return /* @__PURE__ */ a(d.Header, { className: m(n, t), ...o });
|
|
121
142
|
}
|
|
122
|
-
function
|
|
123
|
-
const n =
|
|
124
|
-
return /* @__PURE__ */ a(
|
|
143
|
+
function q({ className: t, ...o }) {
|
|
144
|
+
const n = s((e) => e.modal.body.base);
|
|
145
|
+
return /* @__PURE__ */ a(d.Body, { className: m(n, t), ...o });
|
|
125
146
|
}
|
|
126
|
-
function
|
|
127
|
-
const n =
|
|
128
|
-
return /* @__PURE__ */ a(
|
|
147
|
+
function A({ className: t, ...o }) {
|
|
148
|
+
const n = s((e) => e.modal.footer.base);
|
|
149
|
+
return /* @__PURE__ */ a(d.Footer, { className: m(n, t), ...o });
|
|
129
150
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
151
|
+
u.Dialog = O;
|
|
152
|
+
u.Header = T;
|
|
153
|
+
u.Body = q;
|
|
154
|
+
u.Footer = A;
|
|
134
155
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
156
|
+
M as ModalContext,
|
|
157
|
+
u as default
|
|
137
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const t=require("../../stores/portalElement.cjs.js"),n=require("react"),c=require("react-dom");function s({children:r}){const e=n.useSyncExternalStore(t.subscribe,t.getElement);return e?c.createPortal(r,e):null}module.exports=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,aAAa,sCAOzD"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
}, []), t ? u(o, t) : null;
|
|
2
|
+
import t from "../../stores/portalElement.es.js";
|
|
3
|
+
import { useSyncExternalStore as o } from "react";
|
|
4
|
+
import { createPortal as n } from "react-dom";
|
|
5
|
+
function a({ children: r }) {
|
|
6
|
+
const e = o(
|
|
7
|
+
t.subscribe,
|
|
8
|
+
t.getElement
|
|
9
|
+
);
|
|
10
|
+
return e ? n(r, e) : null;
|
|
13
11
|
}
|
|
14
12
|
export {
|
|
15
|
-
|
|
13
|
+
a as default
|
|
16
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,EAGL,YAAY,EAMb,MAAM,OAAO,CAAC;AAKf,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AACpD,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,EAGL,YAAY,EAMb,MAAM,OAAO,CAAC;AAKf,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AACpD,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;CAC9B,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,KAAK,EACL,KAAc,EACd,SAAiB,EACjB,QAAc,EACd,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,2CAgJxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Accordion/index.cjs.js"),r=require("./Alert/index.cjs.js"),i=require("./Avatar/index.cjs.js"),n=require("./Badge/index.cjs.js"),t=require("./Button/index.cjs.js"),o=require("./ButtonGroup/index.cjs.js"),u=require("./Card/index.cjs.js"),d=require("./Divider/index.cjs.js"),c=require("./Drawer/index.cjs.js"),s=require("./Fill/index.cjs.js"),q=require("./InputGroup/index.cjs.js"),x=require("./Menu/index.cjs.js"),$=require("./Modal/index.cjs.js"),a=require("./Portal/index.cjs.js"),l=require("./Progress/index.cjs.js"),p=require("./Skeleton/index.cjs.js"),f=require("./Spacer/index.cjs.js"),S=require("./Spinner/index.cjs.js"),g=require("./Stack/index.cjs.js"),b=require("./Switch/index.cjs.js"),T=require("./Table/index.cjs.js"),y=require("./Tabs/index.cjs.js"),h=require("./Tooltip/index.cjs.js"),k=require("./Typography/index.cjs.js")
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Accordion/index.cjs.js"),r=require("./Alert/index.cjs.js"),i=require("./Avatar/index.cjs.js"),n=require("./Badge/index.cjs.js"),t=require("./Button/index.cjs.js"),o=require("./ButtonGroup/index.cjs.js"),u=require("./Card/index.cjs.js"),d=require("./Divider/index.cjs.js"),c=require("./Drawer/index.cjs.js"),s=require("./Fill/index.cjs.js"),q=require("./InputGroup/index.cjs.js"),x=require("./Menu/index.cjs.js"),$=require("./Modal/index.cjs.js"),a=require("./Portal/index.cjs.js"),l=require("./Progress/index.cjs.js"),p=require("./Skeleton/index.cjs.js"),f=require("./Spacer/index.cjs.js"),S=require("./Spinner/index.cjs.js"),g=require("./Stack/index.cjs.js"),b=require("./Switch/index.cjs.js"),T=require("./Table/index.cjs.js"),y=require("./Tabs/index.cjs.js"),h=require("./Tooltip/index.cjs.js"),k=require("./Typography/index.cjs.js");exports.Accordion=e;exports.Alert=r.default;exports.Avatar=i;exports.Badge=n;exports.Button=t;exports.ButtonGroup=o.default;exports.Card=u;exports.Divider=d;exports.Drawer=c.default;exports.Fill=s;exports.InputGroup=q;exports.Menu=x;exports.Modal=$.default;exports.Portal=a;exports.Progress=l;exports.Skeleton=p;exports.Spacer=f;exports.Spinner=S;exports.Stack=g;exports.Switch=b;exports.Table=T;exports.Tabs=y.default;exports.Tooltip=h;exports.Typography=k;
|