@shiflo/ui 0.1.3 → 0.1.4
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.
|
@@ -56,7 +56,7 @@ function z({
|
|
|
56
56
|
dragThreshold: h = 100,
|
|
57
57
|
...y
|
|
58
58
|
}) {
|
|
59
|
-
const [b, s] = R(!1), l = a(null),
|
|
59
|
+
const [b, s] = R(!1), l = a(null), $ = a(null), x = a(null);
|
|
60
60
|
S(f, () => l.current);
|
|
61
61
|
const v = (e) => {
|
|
62
62
|
e.stopPropagation(), typeof c == "function" && c(e);
|
|
@@ -74,7 +74,7 @@ function z({
|
|
|
74
74
|
}, [t]), /* @__PURE__ */ o(
|
|
75
75
|
I,
|
|
76
76
|
{
|
|
77
|
-
ref:
|
|
77
|
+
ref: $,
|
|
78
78
|
open: t,
|
|
79
79
|
onClose: r,
|
|
80
80
|
transitionDuration: i,
|
|
@@ -95,7 +95,6 @@ function z({
|
|
|
95
95
|
animate: {
|
|
96
96
|
y: b ? 0 : "200%"
|
|
97
97
|
},
|
|
98
|
-
exit: { y: "200%" },
|
|
99
98
|
transition: {
|
|
100
99
|
type: "spring",
|
|
101
100
|
duration: i,
|
|
@@ -104,7 +103,7 @@ function z({
|
|
|
104
103
|
style: g,
|
|
105
104
|
...y,
|
|
106
105
|
children: [
|
|
107
|
-
!p && /* @__PURE__ */ o(A, { ref:
|
|
106
|
+
!p && /* @__PURE__ */ o(A, { ref: x, children: /* @__PURE__ */ o(F, {}) }),
|
|
108
107
|
m
|
|
109
108
|
]
|
|
110
109
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as O, jsx as f } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as j } from "react";
|
|
3
3
|
import { createPortal as v } from "react-dom";
|
|
4
4
|
import { useTheme as x } from "@emotion/react";
|
|
5
|
-
import
|
|
6
|
-
import { motion as
|
|
7
|
-
const C =
|
|
5
|
+
import n from "@emotion/styled";
|
|
6
|
+
import { motion as a } from "motion/react";
|
|
7
|
+
const C = n(a.div)`
|
|
8
8
|
position: fixed;
|
|
9
9
|
top: 0;
|
|
10
10
|
left: 0;
|
|
11
11
|
z-index: 1;
|
|
12
|
-
`, A =
|
|
12
|
+
`, A = n(a.div)`
|
|
13
13
|
position: fixed;
|
|
14
14
|
top: 0;
|
|
15
15
|
left: 0;
|
|
16
16
|
width: 100%;
|
|
17
17
|
height: 100%;
|
|
18
|
-
`, w =
|
|
18
|
+
`, w = n(a.div)`
|
|
19
19
|
position: fixed;
|
|
20
20
|
width: 100%;
|
|
21
21
|
display: flex;
|
|
@@ -91,49 +91,53 @@ const C = r(n.div)`
|
|
|
91
91
|
function P({
|
|
92
92
|
children: o,
|
|
93
93
|
open: t,
|
|
94
|
-
onClose:
|
|
95
|
-
transitionDuration:
|
|
96
|
-
placement:
|
|
94
|
+
onClose: d,
|
|
95
|
+
transitionDuration: s = 0.2,
|
|
96
|
+
placement: p,
|
|
97
97
|
ref: I,
|
|
98
|
-
onClick:
|
|
99
|
-
hideOverlay:
|
|
100
|
-
...
|
|
98
|
+
onClick: g,
|
|
99
|
+
hideOverlay: r,
|
|
100
|
+
...i
|
|
101
101
|
}) {
|
|
102
102
|
const {
|
|
103
|
-
palette: { common:
|
|
104
|
-
} = x(), [u,
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
t ||
|
|
103
|
+
palette: { common: c }
|
|
104
|
+
} = x(), [u, l] = b(!0), [y, m] = b(!1), h = (e) => {
|
|
105
|
+
d?.(), g?.(e);
|
|
106
|
+
}, k = () => {
|
|
107
|
+
t || l(!0);
|
|
108
108
|
};
|
|
109
109
|
return j(() => {
|
|
110
110
|
let e;
|
|
111
|
-
return t ? (
|
|
112
|
-
|
|
113
|
-
})) :
|
|
111
|
+
return t ? (l(!1), e = requestAnimationFrame(() => {
|
|
112
|
+
m(!0);
|
|
113
|
+
})) : m(!1), () => {
|
|
114
114
|
e && cancelAnimationFrame(e);
|
|
115
115
|
};
|
|
116
|
-
}, [t,
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
116
|
+
}, [t, s]), u ? null : v(
|
|
117
|
+
/* @__PURE__ */ O(C, { children: [
|
|
118
|
+
/* @__PURE__ */ f(
|
|
119
119
|
A,
|
|
120
120
|
{
|
|
121
|
-
initial: { opacity: 0, backgroundColor:
|
|
121
|
+
initial: { opacity: 0, backgroundColor: r ? "rgba(0, 0, 0, 0)" : c.overlay },
|
|
122
122
|
animate: {
|
|
123
|
-
opacity:
|
|
124
|
-
backgroundColor:
|
|
123
|
+
opacity: y ? 1 : 0,
|
|
124
|
+
backgroundColor: r ? "rgba(0, 0, 0, 0)" : c.overlay
|
|
125
125
|
},
|
|
126
126
|
transition: {
|
|
127
127
|
type: "spring",
|
|
128
|
-
duration:
|
|
128
|
+
duration: s,
|
|
129
129
|
bounce: 0.2
|
|
130
130
|
},
|
|
131
|
-
onAnimationComplete:
|
|
132
|
-
onClick:
|
|
133
|
-
...
|
|
131
|
+
onAnimationComplete: k,
|
|
132
|
+
onClick: h,
|
|
133
|
+
...i,
|
|
134
|
+
style: {
|
|
135
|
+
pointerEvents: r ? "none" : void 0,
|
|
136
|
+
...i.style
|
|
137
|
+
}
|
|
134
138
|
}
|
|
135
139
|
),
|
|
136
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ f(w, { placement: p, children: o })
|
|
137
141
|
] }),
|
|
138
142
|
document.body
|
|
139
143
|
);
|
package/dist/theme/dark.mjs
CHANGED
package/dist/theme/light.mjs
CHANGED