motile-ui 1.0.2 → 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/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion.js +121 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge.js +24 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button.js +73 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox.js +69 -0
- package/dist/components/Dock/Dock.css +1 -0
- package/dist/components/Dock/Dock.js +151 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Drawer/Drawer.js +275 -0
- package/dist/components/Input/Input.css +1 -0
- package/dist/components/Input/Input.js +122 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal.js +231 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover.js +197 -0
- package/dist/components/Sheet/Sheet.css +1 -0
- package/dist/components/Sheet/Sheet.js +283 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton.js +30 -0
- package/dist/components/SpeedDial/SpeedDial.css +1 -0
- package/dist/components/SpeedDial/SpeedDial.js +149 -0
- package/dist/components/Switch/Switch.css +1 -0
- package/dist/components/Switch/Switch.js +31 -0
- package/dist/components/Textarea/Textarea.css +1 -0
- package/dist/components/Textarea/Textarea.js +111 -0
- package/dist/components/Toast/Toast.css +1 -0
- package/dist/components/Toast/Toast.js +178 -0
- package/dist/components/Toast/useToast.js +30 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip.js +321 -0
- package/dist/hooks/useClickOutside.js +24 -0
- package/dist/hooks/useEscapeKey.js +18 -0
- package/dist/hooks/useHistoryClose.js +42 -0
- package/dist/hooks/useScrollLock.js +73 -0
- package/dist/index.js +42 -0
- package/dist/utils/FloatingArrow.js +55 -0
- package/dist/utils/Slot.js +44 -0
- package/package.json +88 -6
- package/dist/index.css +0 -1
- package/dist/motile-ui.es.js +0 -2492
- package/dist/motile-ui.umd.js +0 -2
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import W, { forwardRef as w, useRef as _, useState as E, useEffect as M, createContext as G, useContext as J } from "react";
|
|
3
|
+
import { createPortal as Q } from "react-dom";
|
|
4
|
+
import { Slot as Y } from "../../utils/Slot.js";
|
|
5
|
+
import { useScrollLock as X } from "../../hooks/useScrollLock.js";
|
|
6
|
+
import { useClickOutside as Z } from "../../hooks/useClickOutside.js";
|
|
7
|
+
import { useEscapeKey as k } from "../../hooks/useEscapeKey.js";
|
|
8
|
+
import './Drawer.css';/* empty css */
|
|
9
|
+
const $ = G(null), f = () => {
|
|
10
|
+
const t = J($);
|
|
11
|
+
if (!t)
|
|
12
|
+
throw new Error("Drawer components must be used within Drawer.Root");
|
|
13
|
+
return t;
|
|
14
|
+
}, C = ({
|
|
15
|
+
children: t,
|
|
16
|
+
open: s,
|
|
17
|
+
defaultOpen: n = !1,
|
|
18
|
+
onOpenChange: r,
|
|
19
|
+
closeOnBackdrop: e = !0,
|
|
20
|
+
closeOnDrag: o = !0,
|
|
21
|
+
maxHeight: d = "70dvh",
|
|
22
|
+
width: c = "480px",
|
|
23
|
+
maxWidth: y,
|
|
24
|
+
zIndex: h = 9999
|
|
25
|
+
}) => {
|
|
26
|
+
const a = _(null), m = _(null), l = _(null), v = _(0), b = _(!1), [A, g] = E(!1), [x, N] = E(n), [F, U] = E(n), D = s !== void 0 ? s : F, R = (i) => {
|
|
27
|
+
s === void 0 && U(i), r == null || r(i);
|
|
28
|
+
}, S = typeof e == "boolean" ? { escapeKey: e, clickOutside: e } : {
|
|
29
|
+
escapeKey: (e == null ? void 0 : e.escapeKey) ?? !1,
|
|
30
|
+
clickOutside: (e == null ? void 0 : e.clickOutside) ?? !1
|
|
31
|
+
};
|
|
32
|
+
X({
|
|
33
|
+
enabled: D,
|
|
34
|
+
allowedSelectors: ["[data-scroll-allowed]", ".motile-drawer__body"]
|
|
35
|
+
});
|
|
36
|
+
const p = () => {
|
|
37
|
+
if (!a.current) {
|
|
38
|
+
g(!1), setTimeout(() => {
|
|
39
|
+
N(!1), R(!1);
|
|
40
|
+
}, 300);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
a.current.style.transition = "transform 0.3s ease", a.current.style.transform = "translateY(100%)", g(!1), setTimeout(() => {
|
|
44
|
+
N(!1), R(!1);
|
|
45
|
+
}, 300);
|
|
46
|
+
};
|
|
47
|
+
M(() => {
|
|
48
|
+
D ? N(!0) : x && p();
|
|
49
|
+
}, [D]), M(() => {
|
|
50
|
+
if (!x || !a.current) return;
|
|
51
|
+
const i = a.current;
|
|
52
|
+
i.style.transition = "none", i.style.transform = "translateY(100%)", requestAnimationFrame(() => {
|
|
53
|
+
requestAnimationFrame(() => {
|
|
54
|
+
i.style.transition = "transform 0.3s ease", i.style.transform = "translateY(0)", g(!0);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}, [x]), Z({
|
|
58
|
+
refs: [a],
|
|
59
|
+
handler: p,
|
|
60
|
+
enabled: D && S.clickOutside
|
|
61
|
+
}), k({
|
|
62
|
+
handler: p,
|
|
63
|
+
enabled: D && S.escapeKey
|
|
64
|
+
});
|
|
65
|
+
const j = {
|
|
66
|
+
open: x,
|
|
67
|
+
setOpen: R,
|
|
68
|
+
closeOnBackdrop: e,
|
|
69
|
+
closeOnDrag: o,
|
|
70
|
+
maxHeight: d,
|
|
71
|
+
width: c,
|
|
72
|
+
maxWidth: y,
|
|
73
|
+
zIndex: h,
|
|
74
|
+
drawerRef: a,
|
|
75
|
+
bodyRef: m,
|
|
76
|
+
isVisible: A,
|
|
77
|
+
handleClose: p,
|
|
78
|
+
handleDragStart: (i) => {
|
|
79
|
+
o && (l.current = i, b.current = !1);
|
|
80
|
+
},
|
|
81
|
+
handleDragMove: (i) => {
|
|
82
|
+
if (!o || !a.current || l.current === null || !m.current)
|
|
83
|
+
return;
|
|
84
|
+
const T = i - l.current;
|
|
85
|
+
m.current.scrollTop <= 0 && T > 0 && (b.current = !0, v.current = T, a.current.style.transition = "none", a.current.style.transform = `translateY(${T}px)`);
|
|
86
|
+
},
|
|
87
|
+
handleDragEnd: () => {
|
|
88
|
+
if (!o || !a.current) return;
|
|
89
|
+
const i = window.innerHeight * 0.2;
|
|
90
|
+
a.current.style.transition = "transform 0.3s ease", b.current && v.current > i ? p() : (a.current.style.transform = "translateY(0)", v.current = 0), b.current = !1, l.current = null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ u($.Provider, { value: j, children: t });
|
|
94
|
+
};
|
|
95
|
+
C.displayName = "Drawer.Root";
|
|
96
|
+
const P = w(
|
|
97
|
+
({ children: t, asChild: s, onClick: n, ...r }, e) => {
|
|
98
|
+
const { setOpen: o } = f(), d = (c) => {
|
|
99
|
+
n == null || n(c), o(!0);
|
|
100
|
+
};
|
|
101
|
+
return s ? /* @__PURE__ */ u(
|
|
102
|
+
Y,
|
|
103
|
+
{
|
|
104
|
+
...r,
|
|
105
|
+
onClick: d,
|
|
106
|
+
ref: e,
|
|
107
|
+
children: t
|
|
108
|
+
}
|
|
109
|
+
) : /* @__PURE__ */ u("button", { type: "button", onClick: d, ref: e, ...r, children: t });
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
P.displayName = "Drawer.Trigger";
|
|
113
|
+
const V = ({
|
|
114
|
+
children: t,
|
|
115
|
+
container: s
|
|
116
|
+
}) => {
|
|
117
|
+
const { open: n } = f();
|
|
118
|
+
return !n || typeof document > "u" ? null : Q(t, s || document.body);
|
|
119
|
+
};
|
|
120
|
+
V.displayName = "Drawer.Portal";
|
|
121
|
+
const H = w(
|
|
122
|
+
({ className: t, ...s }, n) => {
|
|
123
|
+
const { isVisible: r, zIndex: e } = f();
|
|
124
|
+
return /* @__PURE__ */ u(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
ref: n,
|
|
128
|
+
className: `motile-drawer__overlay ${r ? "motile-drawer__overlay--visible" : ""} ${t || ""}`,
|
|
129
|
+
style: { zIndex: e },
|
|
130
|
+
role: "presentation",
|
|
131
|
+
...s
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
H.displayName = "Drawer.Overlay";
|
|
137
|
+
const K = w(
|
|
138
|
+
({ className: t, style: s, children: n, ...r }, e) => {
|
|
139
|
+
const { drawerRef: o, isVisible: d, maxHeight: c, width: y, maxWidth: h, zIndex: a } = f(), m = {
|
|
140
|
+
...c !== "70dvh" && { "--drawer-max-height": c },
|
|
141
|
+
...y !== "480px" && { "--drawer-width": y },
|
|
142
|
+
...h && { "--drawer-max-width": h },
|
|
143
|
+
zIndex: a + 1,
|
|
144
|
+
...s
|
|
145
|
+
};
|
|
146
|
+
return /* @__PURE__ */ u(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: (l) => {
|
|
150
|
+
typeof e == "function" ? e(l) : e && (e.current = l), o.current = l;
|
|
151
|
+
},
|
|
152
|
+
className: `motile-drawer__content ${d ? "motile-drawer__content--visible" : ""} ${t || ""}`,
|
|
153
|
+
style: m,
|
|
154
|
+
onClick: (l) => l.stopPropagation(),
|
|
155
|
+
role: "dialog",
|
|
156
|
+
"aria-modal": "true",
|
|
157
|
+
...r,
|
|
158
|
+
children: n
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
K.displayName = "Drawer.Content";
|
|
164
|
+
const L = w(
|
|
165
|
+
({ className: t, ...s }, n) => {
|
|
166
|
+
const { handleDragStart: r, handleDragMove: e, handleDragEnd: o } = f(), d = (a) => {
|
|
167
|
+
r(a.touches[0].clientY);
|
|
168
|
+
}, c = (a) => {
|
|
169
|
+
e(a.touches[0].clientY);
|
|
170
|
+
}, y = () => {
|
|
171
|
+
o();
|
|
172
|
+
}, h = (a) => {
|
|
173
|
+
r(a.clientY);
|
|
174
|
+
const m = (v) => {
|
|
175
|
+
e(v.clientY);
|
|
176
|
+
}, l = () => {
|
|
177
|
+
o(), window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", l);
|
|
178
|
+
};
|
|
179
|
+
window.addEventListener("mousemove", m), window.addEventListener("mouseup", l);
|
|
180
|
+
};
|
|
181
|
+
return /* @__PURE__ */ u(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
ref: n,
|
|
185
|
+
className: `motile-drawer__header ${t || ""}`,
|
|
186
|
+
onTouchStart: d,
|
|
187
|
+
onTouchMove: c,
|
|
188
|
+
onTouchEnd: y,
|
|
189
|
+
onMouseDown: h,
|
|
190
|
+
...s,
|
|
191
|
+
children: /* @__PURE__ */ u("div", { className: "motile-drawer__handle", "aria-hidden": "true" })
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
L.displayName = "Drawer.Handle";
|
|
197
|
+
const I = w(
|
|
198
|
+
({ children: t, asChild: s, className: n, ...r }, e) => s && W.isValidElement(t) ? /* @__PURE__ */ u(
|
|
199
|
+
Y,
|
|
200
|
+
{
|
|
201
|
+
...r,
|
|
202
|
+
className: `motile-drawer__title ${n || ""}`,
|
|
203
|
+
ref: e,
|
|
204
|
+
children: t
|
|
205
|
+
}
|
|
206
|
+
) : /* @__PURE__ */ u("div", { className: "motile-drawer__title-wrapper", children: /* @__PURE__ */ u(
|
|
207
|
+
"h2",
|
|
208
|
+
{
|
|
209
|
+
ref: e,
|
|
210
|
+
id: "motile-drawer-title",
|
|
211
|
+
className: `motile-drawer__title ${n || ""}`,
|
|
212
|
+
...r,
|
|
213
|
+
children: t
|
|
214
|
+
}
|
|
215
|
+
) })
|
|
216
|
+
);
|
|
217
|
+
I.displayName = "Drawer.Title";
|
|
218
|
+
const z = w(
|
|
219
|
+
({ className: t, children: s, ...n }, r) => {
|
|
220
|
+
const { bodyRef: e } = f();
|
|
221
|
+
return /* @__PURE__ */ u(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
ref: (o) => {
|
|
225
|
+
typeof r == "function" ? r(o) : r && (r.current = o), e.current = o;
|
|
226
|
+
},
|
|
227
|
+
className: `motile-drawer__body ${t || ""}`,
|
|
228
|
+
"data-scroll-allowed": !0,
|
|
229
|
+
...n,
|
|
230
|
+
children: s
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
z.displayName = "Drawer.Body";
|
|
236
|
+
const q = w(
|
|
237
|
+
({ children: t, asChild: s, onClick: n, ...r }, e) => {
|
|
238
|
+
const { handleClose: o } = f(), d = (c) => {
|
|
239
|
+
n == null || n(c), o();
|
|
240
|
+
};
|
|
241
|
+
return s ? /* @__PURE__ */ u(
|
|
242
|
+
Y,
|
|
243
|
+
{
|
|
244
|
+
...r,
|
|
245
|
+
onClick: d,
|
|
246
|
+
ref: e,
|
|
247
|
+
children: t
|
|
248
|
+
}
|
|
249
|
+
) : /* @__PURE__ */ u("button", { type: "button", onClick: d, ref: e, ...r, children: t });
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
q.displayName = "Drawer.Close";
|
|
253
|
+
const ue = {
|
|
254
|
+
Root: C,
|
|
255
|
+
Trigger: P,
|
|
256
|
+
Portal: V,
|
|
257
|
+
Overlay: H,
|
|
258
|
+
Content: K,
|
|
259
|
+
Handle: L,
|
|
260
|
+
Title: I,
|
|
261
|
+
Body: z,
|
|
262
|
+
Close: q
|
|
263
|
+
};
|
|
264
|
+
export {
|
|
265
|
+
ue as Drawer,
|
|
266
|
+
z as DrawerBody,
|
|
267
|
+
q as DrawerClose,
|
|
268
|
+
K as DrawerContent,
|
|
269
|
+
L as DrawerHandle,
|
|
270
|
+
H as DrawerOverlay,
|
|
271
|
+
V as DrawerPortal,
|
|
272
|
+
C as DrawerRoot,
|
|
273
|
+
I as DrawerTitle,
|
|
274
|
+
P as DrawerTrigger
|
|
275
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.motile-input-root{display:block;width:100%}.motile-input{width:100%;border:1px solid #e5e8eb;border-radius:12px;padding:12px 16px;font-size:15px;font-weight:400;color:#111827;background:#fff;outline:none;transition:none;min-height:48px;line-height:1.4;box-sizing:border-box}.motile-input:hover:not(:disabled):not(:focus):not(.motile-input--error){border-color:#c9cdd2}.motile-input--outlined{border:2px solid #e5e8eb}.motile-input--outlined:focus{border:2px solid var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input--outlined:disabled{background:#f9fafb;color:#9ca3af;cursor:not-allowed;border-color:#e5e7eb}.motile-input--underline:disabled{background:transparent;color:#9ca3af;cursor:not-allowed;border-bottom-color:#e5e7eb;opacity:.5}.motile-input--outlined.motile-input--error{border:2px solid #ef4444;background:#fef5f5}.motile-input--outlined.motile-input--error:focus{border:2px solid #ef4444;background:#fef5f5}.motile-input-wrapper--shake{animation:motile-input-shake .5s ease-in-out}@keyframes motile-input-shake{0%{transform:translate(0)}15%{transform:translate(-10px)}30%{transform:translate(8px)}45%{transform:translate(-6px)}60%{transform:translate(4px)}75%{transform:translate(-2px)}to{transform:translate(0)}}.motile-input::placeholder{color:#9ca3af;opacity:1}.motile-input-wrapper{position:relative;width:100%}.motile-input--underline{border:none;border-bottom:2px solid #e5e8eb;border-radius:0;background:transparent;padding:18px 4px 4px;height:48px;line-height:1.5;transition:border-color .2s ease}.motile-input--underline:hover:not(:disabled):not(:focus):not(.motile-input--error){border-bottom-color:#9ca3af}.motile-input--underline:focus{border:none;border-bottom:2px solid var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) );padding:18px 4px 4px;height:48px;line-height:1.5}.motile-input--underline.motile-input--error{border-bottom-color:#ef4444}.motile-input--underline.motile-input--error:focus{border-bottom:2px solid #ef4444;padding:18px 4px 4px;height:48px;line-height:1.5}.motile-input--with-left-icon{padding-left:40px}.motile-input--outlined.motile-input--with-left-icon:focus{padding-left:40px}.motile-input--underline.motile-input--with-left-icon{padding-left:32px}.motile-input--underline.motile-input--with-left-icon:focus{padding-left:32px}.motile-input--with-right-content{padding-right:40px}.motile-input--outlined.motile-input--with-right-content:focus{padding-right:40px}.motile-input--underline.motile-input--with-right-content{padding-right:32px}.motile-input--underline.motile-input--with-right-content:focus{padding-right:32px}.motile-input__left-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:20px;color:#9ca3af;pointer-events:none}.motile-input-wrapper:has(.motile-input--underline) .motile-input__left-icon{left:4px;top:calc(50% + 7px)}.motile-input__left-icon svg{width:100%;height:100%}.motile-input__right-icon{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:20px;color:#9ca3af;pointer-events:none}.motile-input-wrapper:has(.motile-input--underline) .motile-input__right-icon{right:4px;top:calc(50% + 7px)}.motile-input__right-icon svg{width:100%;height:100%}.motile-input__clear-button{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;background:transparent;border:none;color:#9ca3af;cursor:pointer;border-radius:4px;transition:background-color .2s ease,color .2s ease}.motile-input-wrapper:has(.motile-input--underline) .motile-input__clear-button{right:4px;top:calc(50% + 7px)}.motile-input__clear-button:hover{background:#f3f4f6;color:#6b7280}.motile-input__clear-icon{width:16px;height:16px}@media (max-width: 768px){.motile-input{font-size:16px;padding:12px;min-height:44px}.motile-input--outlined{border:2px solid #e5e8eb}.motile-input--outlined:focus{border:2px solid var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input--underline{padding:18px 4px 4px;height:48px;line-height:1.5}.motile-input--underline:focus{border-bottom:2px solid var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) );padding:18px 4px 4px;height:48px;line-height:1.5}.motile-input-wrapper:has(.motile-input--underline) .motile-input__left-icon{top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:has(.motile-input--underline) .motile-input__right-icon{top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:has(.motile-input--underline) .motile-input__clear-button{top:calc(50% + 7px);transform:translateY(-50%)}.motile-input--with-left-icon{padding-left:40px}.motile-input--outlined.motile-input--with-left-icon:focus{padding-left:40px}.motile-input--outlined.motile-input--with-label.motile-input--with-left-icon{padding-left:40px}.motile-input--outlined.motile-input--with-label.motile-input--with-left-icon:focus{padding-left:40px}.motile-input--underline.motile-input--with-left-icon{padding-left:32px}.motile-input--underline.motile-input--with-left-icon:focus{padding-left:32px}.motile-input-wrapper:has(.motile-input--underline) .motile-input--with-label.motile-input--with-left-icon{padding-left:32px}.motile-input-wrapper:has(.motile-input--underline) .motile-input--with-label.motile-input--with-left-icon:focus{padding-left:32px}.motile-input--with-right-content{padding-right:36px}.motile-input--outlined.motile-input--with-right-content:focus{padding-right:36px}.motile-input--underline.motile-input--with-right-content{padding-right:32px}.motile-input--underline.motile-input--with-right-content:focus{padding-right:32px}}@supports (-webkit-touch-callout: none){.motile-input{-webkit-tap-highlight-color:transparent}}.motile-input__helper-text{display:flex;align-items:flex-start;margin-top:4px;min-height:16px;gap:8px}.motile-input__helper-text--both{justify-content:space-between}.motile-input__helper-text--error-only{justify-content:flex-start}.motile-input__helper-text--counter-only{justify-content:flex-end}.motile-input__error-message{font-size:12px;color:#ef4444;line-height:16px;flex:1}.motile-input__counter{font-size:12px;color:#9ca3af;line-height:16px;white-space:nowrap;flex-shrink:0}.motile-input__label{position:absolute;left:16px;top:50%;transform:translateY(-50%);font-size:15px;color:#9ca3af;pointer-events:none;transition:all .2s ease;background:transparent;padding:0;z-index:1}.motile-input--with-label::placeholder{opacity:0}.motile-input--with-label:focus::placeholder{opacity:1}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:not(:placeholder-shown)) .motile-input__label{top:0;transform:translateY(-50%);font-size:12px;background:#fff;padding:0 4px}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:focus) .motile-input__label:not(.motile-input__label--error),.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:not(:placeholder-shown)) .motile-input__label:not(.motile-input__label--error){color:var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input-wrapper:has(.motile-input--underline) .motile-input__label{left:4px;top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:not(:placeholder-shown)) .motile-input__label{top:14px;transform:translateY(-100%);font-size:12px}.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:focus) .motile-input__label:not(.motile-input__label--error),.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:not(:placeholder-shown)) .motile-input__label:not(.motile-input__label--error){color:var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input-wrapper:has(.motile-input:focus) .motile-input__label--error,.motile-input-wrapper:has(.motile-input:not(:placeholder-shown)) .motile-input__label--error{color:#ef4444}.motile-input--outlined.motile-input--with-label{padding-top:12px;padding-bottom:12px}.motile-input--outlined.motile-input--with-label.motile-input--with-left-icon{padding-left:40px}.motile-input--outlined.motile-input--with-label.motile-input--with-left-icon:focus{padding-left:40px}.motile-input-wrapper:has(.motile-input--underline) .motile-input--with-label.motile-input--with-left-icon{padding-left:32px}.motile-input-wrapper:has(.motile-input--underline) .motile-input--with-label.motile-input--with-left-icon:focus{padding-left:32px}.motile-input-wrapper:has(.motile-input--with-left-icon) .motile-input__label{left:44px}.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon) .motile-input__label{left:32px;top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input--with-left-icon):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input--with-left-icon):has(.motile-input:not(:placeholder-shown)) .motile-input__label{left:40px}.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon):has(.motile-input:not(:placeholder-shown)) .motile-input__label{left:4px;top:14px;transform:translateY(-100%)}@media (max-width: 768px){.motile-input__label{font-size:16px;left:12px}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:not(:placeholder-shown)) .motile-input__label{font-size:12px}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:focus) .motile-input__label:not(.motile-input__label--error),.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input:not(:placeholder-shown)) .motile-input__label:not(.motile-input__label--error){color:var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input-wrapper:has(.motile-input--underline) .motile-input__label{left:4px;top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:not(:placeholder-shown)) .motile-input__label{font-size:12px;top:14px;transform:translateY(-100%)}.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:focus) .motile-input__label:not(.motile-input__label--error),.motile-input-wrapper:has(.motile-input--underline):has(.motile-input:not(:placeholder-shown)) .motile-input__label:not(.motile-input__label--error){color:var( --motile-input-color, var(--motile-ui-input, var(--motile-theme, #3182f6)) )}.motile-input-wrapper:has(.motile-input--with-left-icon) .motile-input__label{left:40px}.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon) .motile-input__label{left:32px;top:calc(50% + 7px);transform:translateY(-50%)}.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input--with-left-icon):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:not(:has(.motile-input--underline)):has(.motile-input--with-left-icon):has(.motile-input:not(:placeholder-shown)) .motile-input__label{left:36px}.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon):has(.motile-input:focus) .motile-input__label,.motile-input-wrapper:has(.motile-input--underline.motile-input--with-left-icon):has(.motile-input:not(:placeholder-shown)) .motile-input__label{left:4px;top:14px;transform:translateY(-100%)}}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D, useId as F, useRef as G, useEffect as H } from "react";
|
|
3
|
+
import './Input.css';/* empty css */
|
|
4
|
+
const J = D(
|
|
5
|
+
({
|
|
6
|
+
id: N,
|
|
7
|
+
autoFocus: $ = !1,
|
|
8
|
+
autoSelect: _ = !1,
|
|
9
|
+
variant: v = "outlined",
|
|
10
|
+
isError: y,
|
|
11
|
+
errorMessage: r,
|
|
12
|
+
onClear: m,
|
|
13
|
+
leftIcon: d,
|
|
14
|
+
rightIcon: p,
|
|
15
|
+
className: C,
|
|
16
|
+
value: o,
|
|
17
|
+
color: f,
|
|
18
|
+
style: B,
|
|
19
|
+
maxLength: h,
|
|
20
|
+
label: i,
|
|
21
|
+
placeholder: b,
|
|
22
|
+
...w
|
|
23
|
+
}, j) => {
|
|
24
|
+
const x = F().replace(/:/g, ""), n = N ?? `motile-input-${x}`, R = G(null), l = j || R, s = y ?? !!r;
|
|
25
|
+
H(() => {
|
|
26
|
+
if ($ && l.current) {
|
|
27
|
+
const A = setTimeout(() => {
|
|
28
|
+
l.current && (l.current.focus(), _ && l.current.select());
|
|
29
|
+
}, 50);
|
|
30
|
+
return () => clearTimeout(A);
|
|
31
|
+
}
|
|
32
|
+
}, [$, _]);
|
|
33
|
+
const e = "motile-input", u = m && o, L = !!d, k = u || p, E = [
|
|
34
|
+
e,
|
|
35
|
+
`${e}--${v}`,
|
|
36
|
+
s && `${e}--error`,
|
|
37
|
+
L && `${e}--with-left-icon`,
|
|
38
|
+
k && `${e}--with-right-content`,
|
|
39
|
+
i && `${e}--with-label`,
|
|
40
|
+
C
|
|
41
|
+
].filter(Boolean).join(" "), S = [
|
|
42
|
+
`${e}-wrapper`,
|
|
43
|
+
i && `${e}-wrapper--with-label`,
|
|
44
|
+
s && `${e}-wrapper--shake`
|
|
45
|
+
].filter(Boolean).join(" "), T = [
|
|
46
|
+
`${e}__label`,
|
|
47
|
+
s && `${e}__label--error`
|
|
48
|
+
].filter(Boolean).join(" "), z = f ? { "--motile-input-color": f } : void 0, I = {
|
|
49
|
+
...B
|
|
50
|
+
}, g = o ? String(o).length : 0, c = h !== void 0, q = [
|
|
51
|
+
w["aria-describedby"],
|
|
52
|
+
r ? `${n}-error` : void 0,
|
|
53
|
+
c ? `${n}-counter` : void 0
|
|
54
|
+
].filter(Boolean).join(" ") || void 0;
|
|
55
|
+
return /* @__PURE__ */ a("div", { className: `${e}-root`, children: [
|
|
56
|
+
/* @__PURE__ */ a("div", { className: S, style: z, children: [
|
|
57
|
+
i && /* @__PURE__ */ t("label", { className: T, htmlFor: n, children: i }),
|
|
58
|
+
d && /* @__PURE__ */ t("div", { className: `${e}__left-icon`, children: d }),
|
|
59
|
+
/* @__PURE__ */ t(
|
|
60
|
+
"input",
|
|
61
|
+
{
|
|
62
|
+
id: n,
|
|
63
|
+
...w,
|
|
64
|
+
"aria-describedby": q,
|
|
65
|
+
"aria-invalid": s || void 0,
|
|
66
|
+
ref: l,
|
|
67
|
+
className: E,
|
|
68
|
+
value: o,
|
|
69
|
+
maxLength: h,
|
|
70
|
+
style: I,
|
|
71
|
+
placeholder: i ? b || " " : b
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
p && !u && /* @__PURE__ */ t("div", { className: `${e}__right-icon`, children: p }),
|
|
75
|
+
u && /* @__PURE__ */ t(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: m,
|
|
80
|
+
className: `${e}__clear-button`,
|
|
81
|
+
"aria-label": "지우기",
|
|
82
|
+
children: /* @__PURE__ */ t(
|
|
83
|
+
"svg",
|
|
84
|
+
{
|
|
85
|
+
className: `${e}__clear-icon`,
|
|
86
|
+
viewBox: "0 0 20 20",
|
|
87
|
+
fill: "currentColor",
|
|
88
|
+
children: /* @__PURE__ */ t("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }),
|
|
94
|
+
(r || c) && /* @__PURE__ */ a(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: `${e}__helper-text ${r && c ? `${e}__helper-text--both` : r ? `${e}__helper-text--error-only` : `${e}__helper-text--counter-only`}`,
|
|
98
|
+
children: [
|
|
99
|
+
r && /* @__PURE__ */ t(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
id: `${n}-error`,
|
|
103
|
+
className: `${e}__error-message`,
|
|
104
|
+
role: "alert",
|
|
105
|
+
children: r
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
c && /* @__PURE__ */ a("span", { id: `${n}-counter`, className: `${e}__counter`, children: [
|
|
109
|
+
g,
|
|
110
|
+
"/",
|
|
111
|
+
h
|
|
112
|
+
] })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] });
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
J.displayName = "Input";
|
|
120
|
+
export {
|
|
121
|
+
J as Input
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.motile-modal__backdrop{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:flex;align-items:center;justify-content:center;background-color:#00000080;padding:0 16px;box-sizing:border-box;overscroll-behavior:contain}.motile-modal__backdrop[data-variant=scale]{animation:motile-modal-fade-in .2s ease-out}.motile-modal__backdrop[data-variant=slideDown],.motile-modal__backdrop[data-variant=slideUp]{animation:motile-modal-fade-in .3s ease-out}.motile-modal__backdrop[data-variant=bottomSheet]{animation:motile-modal-fade-in .3s ease-out;align-items:flex-end;padding:0}@media (min-width: 769px){.motile-modal__backdrop{padding:0 24px}}.motile-modal{position:relative;z-index:1001;width:var(--modal-width);max-width:var(--modal-max-width, 100%)}.motile-modal[data-variant=scale]{animation:motile-modal-scale-in .25s ease-out}.motile-modal[data-variant=slideDown]{animation:motile-modal-slide-down .55s cubic-bezier(.34,1.3,.64,1)}.motile-modal[data-variant=slideUp]{animation:motile-modal-slide-up .5s cubic-bezier(.34,1.3,.64,1)}.motile-modal[data-variant=bottomSheet]{animation:motile-modal-bottom-sheet .35s cubic-bezier(.32,.72,0,1);width:var(--modal-width, 100%);max-width:var(--modal-max-width, 100%)}@media (min-width: 769px){.motile-modal[data-variant=bottomSheet]{width:var(--modal-width, 100%);max-width:var(--modal-max-width, var(--modal-width, 480px))}}@media (max-width: 768px){.motile-modal[data-variant=bottomSheet]{width:100%;max-width:none}}.motile-modal__content{background-color:#fff;border-radius:12px;box-shadow:0 20px 25px -5px #0000001a,0 10px 10px -5px #0000000a;max-height:90vh;max-height:calc(90vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-height:calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box}.motile-modal[data-variant=bottomSheet] .motile-modal__content{border-radius:20px 20px 0 0;max-height:90vh;max-height:calc(90vh - env(safe-area-inset-top));max-height:calc(90dvh - env(safe-area-inset-top));box-shadow:0 -10px 25px -5px #0000001a,0 -4px 10px -5px #0000000a}.motile-modal__header{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid #e5e7eb;flex-shrink:0}.motile-modal__title{font-size:1rem;font-weight:600;color:#111827;margin:0;line-height:1.4}.motile-modal__close{display:flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;padding:8px;margin:-8px;border-radius:8px;color:#6b7280;transition:all .15s ease}.motile-modal__close:hover{background-color:#f3f4f6;color:#111827}.motile-modal__close:active{transform:scale(.95)}.motile-modal__close:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.motile-modal__body{padding:24px;overflow-y:auto;overflow-x:hidden;flex:1;min-height:0;color:#374151;line-height:1.6;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}.motile-modal__body::-webkit-scrollbar{width:6px}.motile-modal__body::-webkit-scrollbar-track{background:transparent}.motile-modal__body::-webkit-scrollbar-thumb{background-color:#0003;border-radius:3px}.motile-modal__body::-webkit-scrollbar-thumb:hover{background-color:#0000004d}.motile-modal__footer{display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:12px 16px;border-top:1px solid #e5e7eb;flex-shrink:0}@keyframes motile-modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes motile-modal-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes motile-modal-slide-down{0%{opacity:0;transform:translateY(-100vh)}to{opacity:1;transform:translateY(0)}}@keyframes motile-modal-slide-up{0%{opacity:0;transform:translateY(100vh)}to{opacity:1;transform:translateY(0)}}@keyframes motile-modal-bottom-sheet{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion: reduce){.motile-modal__backdrop[data-variant=scale],.motile-modal__backdrop[data-variant=slideDown],.motile-modal__backdrop[data-variant=slideUp],.motile-modal__backdrop[data-variant=bottomSheet]{animation:none}.motile-modal[data-variant=scale],.motile-modal[data-variant=slideDown],.motile-modal[data-variant=slideUp],.motile-modal[data-variant=bottomSheet]{animation:none;opacity:1;transform:none}.motile-modal__close:active{transform:none}}@media (prefers-contrast: high){.motile-modal__content{border:2px solid #000000}.motile-modal__header{border-bottom-width:2px}.motile-modal__footer{border-top-width:2px}.motile-modal__title{font-weight:700}}@media (max-width: 768px){.motile-modal__content{border-radius:16px}.motile-modal__header,.motile-modal__body,.motile-modal__footer{padding:20px}.motile-modal__title{font-size:1.125rem}.motile-modal__close:active{background-color:#e5e7eb}}@media (max-width: 390px){.motile-modal__backdrop{padding:0 12px}.motile-modal__header,.motile-modal__body,.motile-modal__footer{padding:16px}.motile-modal__title{font-size:1rem}}@media (hover: none) and (pointer: coarse){.motile-modal__close{min-width:44px;min-height:44px;padding:10px}}@supports (-webkit-touch-callout: none){.motile-modal__close{-webkit-tap-highlight-color:transparent}.motile-modal__content{margin-bottom:env(safe-area-inset-bottom)}}@media (max-height: 600px) and (orientation: landscape){.motile-modal__content{max-height:85vh;max-height:85dvh;border-radius:8px}.motile-modal__header,.motile-modal__body,.motile-modal__footer{padding:16px 24px}.motile-modal__title{font-size:1rem}}@media (prefers-color-scheme: dark){.motile-modal__backdrop{background-color:#000000bf}.motile-modal__content{background-color:#1f2937;box-shadow:0 20px 25px -5px #00000080,0 10px 10px -5px #0000004d}.motile-modal__header{border-bottom-color:#374151}.motile-modal__title{color:#f9fafb}.motile-modal__close{color:#9ca3af}.motile-modal__close:hover{background-color:#374151;color:#f9fafb}.motile-modal__body{color:#e5e7eb}.motile-modal__footer{border-top-color:#374151}.motile-modal__body::-webkit-scrollbar-thumb{background-color:#fff3}.motile-modal__body::-webkit-scrollbar-thumb:hover{background-color:#ffffff4d}}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { jsx as l, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import n, { useRef as K, useId as h, createContext as L, useContext as k } from "react";
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { Slot as P } from "../../utils/Slot.js";
|
|
5
|
+
import { useClickOutside as V } from "../../hooks/useClickOutside.js";
|
|
6
|
+
import { useEscapeKey as q } from "../../hooks/useEscapeKey.js";
|
|
7
|
+
import { useScrollLock as z } from "../../hooks/useScrollLock.js";
|
|
8
|
+
import './Modal.css';/* empty css */
|
|
9
|
+
const v = L(null), m = () => {
|
|
10
|
+
const o = k(v);
|
|
11
|
+
if (!o)
|
|
12
|
+
throw new Error("Modal compound components must be used within Modal.Root");
|
|
13
|
+
return o;
|
|
14
|
+
}, A = ({
|
|
15
|
+
open: o,
|
|
16
|
+
onOpenChange: t,
|
|
17
|
+
children: e
|
|
18
|
+
}) => {
|
|
19
|
+
const a = h(), d = h(), r = n.useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
open: o,
|
|
22
|
+
onOpenChange: t,
|
|
23
|
+
titleId: a,
|
|
24
|
+
descriptionId: d
|
|
25
|
+
}),
|
|
26
|
+
[o, t, a, d]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ l(v.Provider, { value: r, children: e });
|
|
29
|
+
}, _ = n.forwardRef(
|
|
30
|
+
({
|
|
31
|
+
container: o,
|
|
32
|
+
variant: t = "scale",
|
|
33
|
+
closeOnBackdrop: e = !0,
|
|
34
|
+
disableScrollLock: a = !1,
|
|
35
|
+
width: d,
|
|
36
|
+
maxWidth: r,
|
|
37
|
+
zIndex: s = 1e3,
|
|
38
|
+
className: f,
|
|
39
|
+
onClick: i,
|
|
40
|
+
style: $,
|
|
41
|
+
...p
|
|
42
|
+
}, g) => {
|
|
43
|
+
const { open: c, onOpenChange: u } = m(), M = K(null), b = typeof e == "boolean" ? e : e.clickOutside ?? !1, S = typeof e == "boolean" ? e : e.escapeKey ?? !1;
|
|
44
|
+
z({
|
|
45
|
+
enabled: c && !a,
|
|
46
|
+
allowedSelectors: [".motile-modal__content"]
|
|
47
|
+
}), V({
|
|
48
|
+
refs: [M],
|
|
49
|
+
handler: () => {
|
|
50
|
+
b && u(!1);
|
|
51
|
+
},
|
|
52
|
+
enabled: c
|
|
53
|
+
}), q({
|
|
54
|
+
handler: () => {
|
|
55
|
+
S && u(!1);
|
|
56
|
+
},
|
|
57
|
+
enabled: c
|
|
58
|
+
});
|
|
59
|
+
const T = (y) => {
|
|
60
|
+
i == null || i(y), y.target === y.currentTarget && b && u(!1);
|
|
61
|
+
};
|
|
62
|
+
if (!c || typeof document > "u") return null;
|
|
63
|
+
const j = {
|
|
64
|
+
zIndex: s,
|
|
65
|
+
...$
|
|
66
|
+
}, E = {
|
|
67
|
+
...d && { "--modal-width": d },
|
|
68
|
+
...r && { "--modal-max-width": r },
|
|
69
|
+
zIndex: s + 1
|
|
70
|
+
}, F = /* @__PURE__ */ l(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
ref: g,
|
|
74
|
+
className: `motile-modal__backdrop ${f || ""}`,
|
|
75
|
+
"data-state": c ? "open" : "closed",
|
|
76
|
+
"data-variant": t,
|
|
77
|
+
onClick: T,
|
|
78
|
+
style: j,
|
|
79
|
+
...p,
|
|
80
|
+
children: /* @__PURE__ */ l(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
ref: M,
|
|
84
|
+
className: "motile-modal",
|
|
85
|
+
"data-variant": t,
|
|
86
|
+
style: E,
|
|
87
|
+
children: p.children
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
return O(F, o || document.body);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
_.displayName = "Modal.Overlay";
|
|
96
|
+
const N = n.forwardRef(
|
|
97
|
+
({ className: o, forceMount: t, ...e }, a) => {
|
|
98
|
+
const { open: d, titleId: r, descriptionId: s } = m();
|
|
99
|
+
return !d && !t ? null : /* @__PURE__ */ l(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
ref: a,
|
|
103
|
+
className: `motile-modal__content ${o || ""}`,
|
|
104
|
+
role: "dialog",
|
|
105
|
+
"aria-modal": "true",
|
|
106
|
+
"aria-labelledby": r,
|
|
107
|
+
"aria-describedby": s,
|
|
108
|
+
"data-state": d ? "open" : "closed",
|
|
109
|
+
...e
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
N.displayName = "Modal.Content";
|
|
115
|
+
const w = n.forwardRef(
|
|
116
|
+
({ className: o, ...t }, e) => {
|
|
117
|
+
const { titleId: a } = m();
|
|
118
|
+
return /* @__PURE__ */ l(
|
|
119
|
+
"h2",
|
|
120
|
+
{
|
|
121
|
+
ref: e,
|
|
122
|
+
id: a,
|
|
123
|
+
className: `motile-modal__title ${o || ""}`,
|
|
124
|
+
...t
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
w.displayName = "Modal.Title";
|
|
130
|
+
const x = n.forwardRef(
|
|
131
|
+
({ className: o, ...t }, e) => {
|
|
132
|
+
const { descriptionId: a } = m();
|
|
133
|
+
return /* @__PURE__ */ l(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
ref: e,
|
|
137
|
+
id: a,
|
|
138
|
+
className: `motile-modal__body ${o || ""}`,
|
|
139
|
+
...t
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
x.displayName = "Modal.Body";
|
|
145
|
+
const R = n.forwardRef(
|
|
146
|
+
({ asChild: o, className: t, onClick: e, children: a, ...d }, r) => {
|
|
147
|
+
const { onOpenChange: s } = m(), f = (i) => {
|
|
148
|
+
e == null || e(i), s(!1);
|
|
149
|
+
};
|
|
150
|
+
return o ? /* @__PURE__ */ l(
|
|
151
|
+
P,
|
|
152
|
+
{
|
|
153
|
+
...d,
|
|
154
|
+
onClick: f,
|
|
155
|
+
ref: r,
|
|
156
|
+
children: a
|
|
157
|
+
}
|
|
158
|
+
) : /* @__PURE__ */ l(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
ref: r,
|
|
162
|
+
type: "button",
|
|
163
|
+
className: `motile-modal__close ${t || ""}`,
|
|
164
|
+
onClick: f,
|
|
165
|
+
"aria-label": "닫기",
|
|
166
|
+
...d,
|
|
167
|
+
children: a || /* @__PURE__ */ H(
|
|
168
|
+
"svg",
|
|
169
|
+
{
|
|
170
|
+
width: "18",
|
|
171
|
+
height: "18",
|
|
172
|
+
viewBox: "0 0 24 24",
|
|
173
|
+
fill: "none",
|
|
174
|
+
stroke: "currentColor",
|
|
175
|
+
strokeWidth: "2",
|
|
176
|
+
strokeLinecap: "round",
|
|
177
|
+
strokeLinejoin: "round",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ l("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
180
|
+
/* @__PURE__ */ l("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
R.displayName = "Modal.Close";
|
|
189
|
+
const C = n.forwardRef(
|
|
190
|
+
({ className: o, ...t }, e) => /* @__PURE__ */ l(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
ref: e,
|
|
194
|
+
className: `motile-modal__footer ${o || ""}`,
|
|
195
|
+
...t
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
);
|
|
199
|
+
C.displayName = "Modal.Footer";
|
|
200
|
+
const I = n.forwardRef(
|
|
201
|
+
({ className: o, ...t }, e) => /* @__PURE__ */ l(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
ref: e,
|
|
205
|
+
className: `motile-modal__header ${o || ""}`,
|
|
206
|
+
...t
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
I.displayName = "Modal.Header";
|
|
211
|
+
const Z = {
|
|
212
|
+
Root: A,
|
|
213
|
+
Overlay: _,
|
|
214
|
+
Content: N,
|
|
215
|
+
Title: w,
|
|
216
|
+
Body: x,
|
|
217
|
+
Close: R,
|
|
218
|
+
Footer: C,
|
|
219
|
+
Header: I
|
|
220
|
+
};
|
|
221
|
+
export {
|
|
222
|
+
Z as Modal,
|
|
223
|
+
x as ModalBody,
|
|
224
|
+
R as ModalClose,
|
|
225
|
+
N as ModalContent,
|
|
226
|
+
C as ModalFooter,
|
|
227
|
+
I as ModalHeader,
|
|
228
|
+
_ as ModalOverlay,
|
|
229
|
+
A as ModalRoot,
|
|
230
|
+
w as ModalTitle
|
|
231
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.motile-popover-wrapper{position:relative;display:inline-block}.motile-popover-content{position:absolute;z-index:10;border-radius:12px;font-size:14px;line-height:1.5;padding:12px 16px;box-shadow:0 4px 12px #0000001a;pointer-events:auto;width:max-content;max-width:min(90vw,420px);box-sizing:border-box;overflow:visible;will-change:transform;backface-visibility:hidden}.motile-popover-content--filled{background:var( --motile-popover-color, var(--motile-ui-popover, var(--motile-theme, #3b82f6)) );color:#fff;border:1px solid var( --motile-popover-color, var(--motile-ui-popover, var(--motile-theme, #3b82f6)) )}.motile-popover-content--outlined{background:#fff;color:#111827;border:1px solid var( --motile-popover-color, var(--motile-ui-popover, var(--motile-theme, #e5e7eb)) )}.motile-popover-content[data-placement=top][data-align=start]{bottom:calc(100% + 5.5px);left:0;animation:popover-fade-in-top .2s ease-out}.motile-popover-content[data-placement=top][data-align=center]{bottom:calc(100% + 5.5px);left:50%;transform:translate(-50%);animation:popover-fade-in-top-center .2s ease-out}.motile-popover-content[data-placement=top][data-align=end]{bottom:calc(100% + 5.5px);right:0;animation:popover-fade-in-top .2s ease-out}.motile-popover-content[data-placement=bottom][data-align=start]{top:calc(100% + 5.5px);left:0;animation:popover-fade-in-bottom .2s ease-out}.motile-popover-content[data-placement=bottom][data-align=center]{top:calc(100% + 5.5px);left:50%;transform:translate(-50%);animation:popover-fade-in-bottom-center .2s ease-out}.motile-popover-content[data-placement=bottom][data-align=end]{top:calc(100% + 5.5px);right:0;animation:popover-fade-in-bottom .2s ease-out}.motile-popover-content[data-placement=left][data-align=start]{right:calc(100% + 5.5px);top:0;animation:popover-fade-in-left .2s ease-out}.motile-popover-content[data-placement=left][data-align=center]{right:calc(100% + 5.5px);top:50%;transform:translateY(-50%);animation:popover-fade-in-left-center .2s ease-out}.motile-popover-content[data-placement=left][data-align=end]{right:calc(100% + 5.5px);bottom:0;animation:popover-fade-in-left .2s ease-out}.motile-popover-content[data-placement=right][data-align=start]{left:calc(100% + 5.5px);top:0;animation:popover-fade-in-right .2s ease-out}.motile-popover-content[data-placement=right][data-align=center]{left:calc(100% + 5.5px);top:50%;transform:translateY(-50%);animation:popover-fade-in-right-center .2s ease-out}.motile-popover-content[data-placement=right][data-align=end]{left:calc(100% + 5.5px);bottom:0;animation:popover-fade-in-right .2s ease-out}@keyframes popover-fade-in-top{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-fade-in-top-center{0%{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%)}}@keyframes popover-fade-in-bottom{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-fade-in-bottom-center{0%{opacity:0;transform:translate(-50%,-8px)}to{opacity:1;transform:translate(-50%)}}@keyframes popover-fade-in-left{0%{opacity:0;transform:translate(8px)}to{opacity:1;transform:translate(0)}}@keyframes popover-fade-in-left-center{0%{opacity:0;transform:translate(8px,-50%)}to{opacity:1;transform:translateY(-50%)}}@keyframes popover-fade-in-right{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes popover-fade-in-right-center{0%{opacity:0;transform:translate(-8px,-50%)}to{opacity:1;transform:translateY(-50%)}}.motile-popover-content[data-placement=top][data-align=start][data-bounce=true],.motile-popover-content[data-placement=top][data-align=end][data-bounce=true]{animation:popover-bounce-top .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=top][data-align=center][data-bounce=true]{animation:popover-bounce-top-center .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=bottom][data-align=start][data-bounce=true],.motile-popover-content[data-placement=bottom][data-align=end][data-bounce=true]{animation:popover-bounce-bottom .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=bottom][data-align=center][data-bounce=true]{animation:popover-bounce-bottom-center .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=left][data-align=start][data-bounce=true],.motile-popover-content[data-placement=left][data-align=end][data-bounce=true]{animation:popover-bounce-left .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=left][data-align=center][data-bounce=true]{animation:popover-bounce-left-center .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=right][data-align=start][data-bounce=true],.motile-popover-content[data-placement=right][data-align=end][data-bounce=true]{animation:popover-bounce-right .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}.motile-popover-content[data-placement=right][data-align=center][data-bounce=true]{animation:popover-bounce-right-center .7s ease-out;animation-iteration-count:var(--bounce-count, 1)}@keyframes popover-bounce-top{0%,to{transform:translateY(0)}30%{transform:translateY(-10px)}50%{transform:translateY(0)}65%{transform:translateY(-3px)}80%{transform:translateY(0)}}@keyframes popover-bounce-top-center{0%,to{transform:translate(-50%)}30%{transform:translate(-50%,-10px)}50%{transform:translate(-50%)}65%{transform:translate(-50%,-3px)}80%{transform:translate(-50%)}}@keyframes popover-bounce-bottom{0%,to{transform:translateY(0)}30%{transform:translateY(10px)}50%{transform:translateY(0)}65%{transform:translateY(3px)}80%{transform:translateY(0)}}@keyframes popover-bounce-bottom-center{0%,to{transform:translate(-50%)}30%{transform:translate(-50%,10px)}50%{transform:translate(-50%)}65%{transform:translate(-50%,3px)}80%{transform:translate(-50%)}}@keyframes popover-bounce-left{0%,to{transform:translate(0)}30%{transform:translate(-10px)}50%{transform:translate(0)}65%{transform:translate(-3px)}80%{transform:translate(0)}}@keyframes popover-bounce-left-center{0%,to{transform:translateY(-50%)}30%{transform:translate(-10px,-50%)}50%{transform:translateY(-50%)}65%{transform:translate(-3px,-50%)}80%{transform:translateY(-50%)}}@keyframes popover-bounce-right{0%,to{transform:translate(0)}30%{transform:translate(10px)}50%{transform:translate(0)}65%{transform:translate(3px)}80%{transform:translate(0)}}@keyframes popover-bounce-right-center{0%,to{transform:translateY(-50%)}30%{transform:translate(10px,-50%)}50%{transform:translateY(-50%)}65%{transform:translate(3px,-50%)}80%{transform:translateY(-50%)}}.motile-popover-arrow{position:absolute;pointer-events:none;z-index:1}.motile-popover-content[data-placement=top] .motile-popover-arrow{bottom:-7.25px;transform:rotate(180deg)}.motile-popover-content[data-placement=top][data-align=start] .motile-popover-arrow{left:20px}.motile-popover-content[data-placement=top][data-align=center] .motile-popover-arrow{left:50%;margin-left:-6px}.motile-popover-content[data-placement=top][data-align=end] .motile-popover-arrow{right:20px}.motile-popover-content[data-placement=bottom] .motile-popover-arrow{top:-7.25px;transform:rotate(0)}.motile-popover-content[data-placement=bottom][data-align=start] .motile-popover-arrow{left:20px}.motile-popover-content[data-placement=bottom][data-align=center] .motile-popover-arrow{left:50%;margin-left:-6px}.motile-popover-content[data-placement=bottom][data-align=end] .motile-popover-arrow{right:20px}.motile-popover-content[data-placement=left] .motile-popover-arrow{right:-9.25px;transform:rotate(90deg)}.motile-popover-content[data-placement=left][data-align=start] .motile-popover-arrow{top:12px}.motile-popover-content[data-placement=left][data-align=center] .motile-popover-arrow{top:50%;margin-top:-4px}.motile-popover-content[data-placement=left][data-align=end] .motile-popover-arrow{bottom:12px}.motile-popover-content[data-placement=right] .motile-popover-arrow{left:-9.25px;transform:rotate(-90deg)}.motile-popover-content[data-placement=right][data-align=start] .motile-popover-arrow{top:12px}.motile-popover-content[data-placement=right][data-align=center] .motile-popover-arrow{top:50%;margin-top:-4px}.motile-popover-content[data-placement=right][data-align=end] .motile-popover-arrow{bottom:12px}
|