@ivex0002/stack-modal-presets 1.0.0 → 1.0.3
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/package.json +7 -7
- package/dist/index.d.mts +0 -9
- package/dist/index.mjs +0 -211
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivex0002/stack-modal-presets",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Preset layouts for @ivex0002/stack-modal library",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"module": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.
|
|
13
|
-
"require": "./dist/index.
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"react": "^18.0.0",
|
|
46
46
|
"tsup": "^8.0.0",
|
|
47
47
|
"typescript": "^5.0.0",
|
|
48
|
-
"@ivex0002/stack-modal": "1.0.
|
|
48
|
+
"@ivex0002/stack-modal": "1.0.3"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
51
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
52
52
|
"pack:test": "npm run build && npm pack"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/dist/index.d.mts
DELETED
package/dist/index.mjs
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// src/defaultPreset.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var STACK_OFFSET = 100;
|
|
5
|
-
var SCALE_STEP = 0.08;
|
|
6
|
-
var defaultPreset = {
|
|
7
|
-
Background: ({
|
|
8
|
-
children,
|
|
9
|
-
onClose
|
|
10
|
-
}) => {
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
const handleKeyUp = (e) => {
|
|
13
|
-
if (e.key === "Escape") onClose();
|
|
14
|
-
};
|
|
15
|
-
window.addEventListener("keyup", handleKeyUp);
|
|
16
|
-
return () => window.removeEventListener("keyup", handleKeyUp);
|
|
17
|
-
}, [onClose]);
|
|
18
|
-
return /* @__PURE__ */ jsx(
|
|
19
|
-
"div",
|
|
20
|
-
{
|
|
21
|
-
onClick: onClose,
|
|
22
|
-
style: {
|
|
23
|
-
zIndex: 1e3,
|
|
24
|
-
backgroundColor: "#00000020",
|
|
25
|
-
backdropFilter: "blur(2px)",
|
|
26
|
-
position: "fixed",
|
|
27
|
-
inset: 0,
|
|
28
|
-
display: "flex",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
justifyContent: "center"
|
|
31
|
-
},
|
|
32
|
-
children: /* @__PURE__ */ jsx("div", { onClick: (e) => e.stopPropagation(), children })
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
ModalWrap: ({
|
|
37
|
-
children,
|
|
38
|
-
depth,
|
|
39
|
-
isTop
|
|
40
|
-
}) => {
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
"div",
|
|
43
|
-
{
|
|
44
|
-
style: {
|
|
45
|
-
position: "absolute",
|
|
46
|
-
left: "50%",
|
|
47
|
-
top: "50%",
|
|
48
|
-
transform: `
|
|
49
|
-
translate(-50%, -50%)
|
|
50
|
-
translateX(-${depth * STACK_OFFSET}px)
|
|
51
|
-
scale(${1 - depth * SCALE_STEP})
|
|
52
|
-
`,
|
|
53
|
-
transition: "transform 0.25s ease",
|
|
54
|
-
backgroundColor: "#fff",
|
|
55
|
-
borderRadius: "16px",
|
|
56
|
-
padding: "20px",
|
|
57
|
-
boxShadow: "0 10px 30px rgba(0,0,0,0.15)",
|
|
58
|
-
pointerEvents: isTop ? "auto" : "none"
|
|
59
|
-
},
|
|
60
|
-
children
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// src/minimalPreset.tsx
|
|
67
|
-
import React2 from "react";
|
|
68
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
69
|
-
var minimalPreset = {
|
|
70
|
-
Background: ({
|
|
71
|
-
children,
|
|
72
|
-
onClose
|
|
73
|
-
}) => {
|
|
74
|
-
React2.useEffect(() => {
|
|
75
|
-
const handleKeyUp = (e) => {
|
|
76
|
-
if (e.key === "Escape") onClose();
|
|
77
|
-
};
|
|
78
|
-
window.addEventListener("keyup", handleKeyUp);
|
|
79
|
-
return () => window.removeEventListener("keyup", handleKeyUp);
|
|
80
|
-
}, [onClose]);
|
|
81
|
-
return /* @__PURE__ */ jsx2(
|
|
82
|
-
"div",
|
|
83
|
-
{
|
|
84
|
-
onClick: onClose,
|
|
85
|
-
style: {
|
|
86
|
-
position: "fixed",
|
|
87
|
-
inset: 0,
|
|
88
|
-
zIndex: 1e3,
|
|
89
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
90
|
-
display: "flex",
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
justifyContent: "center"
|
|
93
|
-
},
|
|
94
|
-
children: /* @__PURE__ */ jsx2("div", { onClick: (e) => e.stopPropagation(), children })
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
ModalWrap: ({
|
|
99
|
-
children,
|
|
100
|
-
isTop
|
|
101
|
-
}) => {
|
|
102
|
-
return /* @__PURE__ */ jsx2(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
style: {
|
|
106
|
-
position: "absolute",
|
|
107
|
-
left: "50%",
|
|
108
|
-
top: "50%",
|
|
109
|
-
transform: "translate(-50%, -50%)",
|
|
110
|
-
backgroundColor: "#fff",
|
|
111
|
-
borderRadius: "8px",
|
|
112
|
-
padding: "24px",
|
|
113
|
-
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
114
|
-
maxWidth: "90vw",
|
|
115
|
-
maxHeight: "90vh",
|
|
116
|
-
overflow: "hidden",
|
|
117
|
-
opacity: isTop ? 1 : 0,
|
|
118
|
-
pointerEvents: isTop ? "auto" : "none",
|
|
119
|
-
transition: "opacity 0.2s ease"
|
|
120
|
-
},
|
|
121
|
-
children
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// src/drawerPreset.tsx
|
|
128
|
-
import React3 from "react";
|
|
129
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
130
|
-
var drawerPreset = {
|
|
131
|
-
Background: ({
|
|
132
|
-
children,
|
|
133
|
-
onClose
|
|
134
|
-
}) => {
|
|
135
|
-
React3.useEffect(() => {
|
|
136
|
-
const handleKeyUp = (e) => {
|
|
137
|
-
if (e.key === "Escape") onClose();
|
|
138
|
-
};
|
|
139
|
-
window.addEventListener("keyup", handleKeyUp);
|
|
140
|
-
return () => window.removeEventListener("keyup", handleKeyUp);
|
|
141
|
-
}, [onClose]);
|
|
142
|
-
return /* @__PURE__ */ jsx3(
|
|
143
|
-
"div",
|
|
144
|
-
{
|
|
145
|
-
onClick: onClose,
|
|
146
|
-
style: {
|
|
147
|
-
position: "fixed",
|
|
148
|
-
inset: 0,
|
|
149
|
-
zIndex: 1e3,
|
|
150
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
151
|
-
display: "flex",
|
|
152
|
-
alignItems: "flex-end",
|
|
153
|
-
justifyContent: "center",
|
|
154
|
-
transition: "background-color 0.3s ease"
|
|
155
|
-
},
|
|
156
|
-
children: /* @__PURE__ */ jsx3("div", { onClick: (e) => e.stopPropagation(), children })
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
},
|
|
160
|
-
ModalWrap: ({
|
|
161
|
-
children,
|
|
162
|
-
depth,
|
|
163
|
-
isTop
|
|
164
|
-
}) => {
|
|
165
|
-
const translateY = depth * 50;
|
|
166
|
-
return /* @__PURE__ */ jsxs(
|
|
167
|
-
"div",
|
|
168
|
-
{
|
|
169
|
-
style: {
|
|
170
|
-
position: "absolute",
|
|
171
|
-
left: "50%",
|
|
172
|
-
bottom: 0,
|
|
173
|
-
transform: `
|
|
174
|
-
translate(-50%, 0)
|
|
175
|
-
translateY(-${translateY}px)
|
|
176
|
-
`,
|
|
177
|
-
backgroundColor: "#fff",
|
|
178
|
-
borderTopLeftRadius: "20px",
|
|
179
|
-
borderTopRightRadius: "20px",
|
|
180
|
-
padding: "20px",
|
|
181
|
-
paddingTop: "12px",
|
|
182
|
-
maxHeight: "85vh",
|
|
183
|
-
overflow: "auto",
|
|
184
|
-
boxShadow: "0 -4px 20px rgba(0, 0, 0, 0.15)",
|
|
185
|
-
transition: "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
186
|
-
pointerEvents: isTop ? "auto" : "none"
|
|
187
|
-
},
|
|
188
|
-
children: [
|
|
189
|
-
/* @__PURE__ */ jsx3(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
style: {
|
|
193
|
-
width: "40px",
|
|
194
|
-
height: "4px",
|
|
195
|
-
backgroundColor: "#e0e0e0",
|
|
196
|
-
borderRadius: "2px",
|
|
197
|
-
margin: "0 auto 16px"
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
),
|
|
201
|
-
children
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
export {
|
|
208
|
-
defaultPreset,
|
|
209
|
-
drawerPreset,
|
|
210
|
-
minimalPreset
|
|
211
|
-
};
|