motile-ui 1.3.1 โ 1.4.0
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/README.md +4 -0
- package/dist/components/Drawer/Drawer.js +3 -1
- package/dist/components/Input/Input.d.ts +6 -0
- package/dist/components/Input/Input.js +48 -44
- package/dist/components/Modal/Modal.js +53 -51
- package/dist/components/Popover/Popover.js +23 -19
- package/dist/components/Select/Select.js +61 -59
- package/dist/components/Sheet/Sheet.js +3 -1
- package/dist/components/SpeedDial/SpeedDial.js +38 -36
- package/dist/components/Textarea/Textarea.d.ts +6 -0
- package/dist/components/Textarea/Textarea.js +44 -40
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +10 -8
- package/dist/hooks/useAutoBlur.d.ts +45 -0
- package/dist/hooks/useAutoBlur.js +32 -0
- package/dist/hooks/useEscapeKey.d.ts +15 -1
- package/dist/hooks/useEscapeKey.js +27 -12
- package/dist/hooks/useHistoryClose.js +89 -48
- package/dist/hooks/useScrollLock.js +42 -24
- package/package.json +1 -1
- package/dist/components/Accordion/Accordion.test.d.ts +0 -1
- package/dist/components/Badge/Badge.test.d.ts +0 -1
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/Dock/Dock.test.d.ts +0 -1
- package/dist/components/Drawer/Drawer.test.d.ts +0 -1
- package/dist/components/Input/Input.test.d.ts +0 -1
- package/dist/components/Modal/Modal.test.d.ts +0 -1
- package/dist/components/NumberFlow/NumberFlow.test.d.ts +0 -1
- package/dist/components/Popover/Popover.test.d.ts +0 -1
- package/dist/components/Select/Select.test.d.ts +0 -1
- package/dist/components/Sheet/Sheet.test.d.ts +0 -1
- package/dist/components/Skeleton/Skeleton.test.d.ts +0 -1
- package/dist/components/SpeedDial/SpeedDial.test.d.ts +0 -1
- package/dist/components/Switch/Switch.test.d.ts +0 -1
- package/dist/components/Tab/Tab.test.d.ts +0 -1
- package/dist/components/Textarea/Textarea.test.d.ts +0 -1
- package/dist/components/TimePicker/TimePicker.test.d.ts +0 -1
- package/dist/components/Toast/Toast.test.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/utils.d.ts +0 -22
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
- ๐ฑ **๋ชจ๋ฐ์ผ ์ต์ ํ** - ํฐ์น ์นํ์ ์ธํฐ๋์
๊ณผ ๋ฐ์ํ ๋์์ธ
|
|
44
44
|
- โฟ **์ ๊ทผ์ฑ** - WCAG 2.1 AA ์ค์ ์ปดํฌ๋ํธ
|
|
45
45
|
- ๐ฏ **ํธ๋ฆฌ์์ดํน ์ง์** - ํ์ํ ๊ฒ๋ง import
|
|
46
|
+
- ๐ง
**์ค์ฒฉ ์ค๋ฒ๋ ์ด ์์ ** - Sheet ์ Sheet์ฒ๋ผ ์ค๋ฒ๋ ์ด๊ฐ ๊ฒน์ณ๋ ๋ค๋ก๊ฐ๊ธฐยทESCยท์คํฌ๋กค ์ ๊ธ์ด ํ ๊ฒน์ฉ ์ ํํ ๋์
|
|
47
|
+
- โจ๏ธ **์คํฌ๋กค ์ ํค๋ณด๋ ๋ซ๊ธฐ** - ๋ชจ๋ฐ์ผ์์ ์
๋ ฅ์ ํฌ์ปค์คํ ์ฑ ์คํฌ๋กคํ๋ฉด ์ํํธ ํค๋ณด๋๋ฅผ ์๋์ผ๋ก ๋ซ์ (useAutoBlur ํ
ยท autoBlur prop)
|
|
46
48
|
- ๐ **ํ๋ถํ ๋ฌธ์** - Storybook์ ํตํ ๋ผ์ด๋ธ ์์ ์ ๊ณต
|
|
47
49
|
|
|
48
50
|
---
|
|
@@ -234,6 +236,8 @@ MIT ยฉ [Innopers](https://github.com/Innopers)
|
|
|
234
236
|
- ๐ฑ **Mobile Optimized** - Touch-friendly interactions and responsive design
|
|
235
237
|
- โฟ **Accessible** - WCAG 2.1 AA compliant components
|
|
236
238
|
- ๐ฏ **Tree-shakeable** - Import only what you need
|
|
239
|
+
- ๐ง
**Nesting-Safe Overlays** - Back navigation, ESC, and scroll lock peel one layer at a time when overlays stack (e.g. Sheet over Sheet)
|
|
240
|
+
- โจ๏ธ **Dismiss Keyboard on Scroll** - On mobile, scrolling with an input focused auto-dismisses the soft keyboard (useAutoBlur hook ยท autoBlur prop)
|
|
237
241
|
- ๐ **Well Documented** - Comprehensive docs with live examples via Storybook
|
|
238
242
|
|
|
239
243
|
---
|
|
@@ -60,7 +60,9 @@ const $ = G(null), f = () => {
|
|
|
60
60
|
enabled: D && S.clickOutside
|
|
61
61
|
}), Z({
|
|
62
62
|
handler: p,
|
|
63
|
-
enabled: D && S.escapeKey
|
|
63
|
+
enabled: D && S.escapeKey,
|
|
64
|
+
stacked: !0
|
|
65
|
+
// ์ค์ฒฉ ์ค๋ฒ๋ ์ด์์ ESC๋ ์ต์๋จ๋ง ๋ซ๋๋ค
|
|
64
66
|
});
|
|
65
67
|
const j = {
|
|
66
68
|
open: x,
|
|
@@ -56,6 +56,12 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
56
56
|
* Floating label (focus ์ ์๋ placeholder ์์น, focus/๊ฐ ์์ ๋ ์๋ก ์ด๋)
|
|
57
57
|
*/
|
|
58
58
|
label?: string;
|
|
59
|
+
/**
|
|
60
|
+
* ๋ชจ๋ฐ์ผ์์ ์ด ์
๋ ฅ์ ํฌ์ปค์ค๋ ์ฑ ์คํฌ๋กคํ๋ฉด ํฌ์ปค์ค๋ฅผ ํด์ ํด ์ํํธ ํค๋ณด๋๋ฅผ
|
|
61
|
+
* ๋ซ์ต๋๋ค (useAutoBlur ๋ด์ฅ). ๋ฐ์คํฌํฑ(๋นํฐ์น)์๋ ์ํฅ์ด ์์ต๋๋ค.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
autoBlur?: boolean;
|
|
59
65
|
}
|
|
60
66
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
61
67
|
export {};
|
|
@@ -1,78 +1,82 @@
|
|
|
1
1
|
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as H, useId as J, useRef as v, useEffect as K } from "react";
|
|
3
|
+
import { useAutoBlur as O } from "../../hooks/useAutoBlur.js";
|
|
3
4
|
import './Input.css';/* empty css */
|
|
4
|
-
const
|
|
5
|
+
const P = H(
|
|
5
6
|
({
|
|
6
|
-
id:
|
|
7
|
+
id: y,
|
|
7
8
|
autoFocus: $ = !1,
|
|
8
|
-
autoSelect:
|
|
9
|
-
variant:
|
|
10
|
-
isError:
|
|
9
|
+
autoSelect: f = !1,
|
|
10
|
+
variant: B = "outlined",
|
|
11
|
+
isError: C,
|
|
11
12
|
errorMessage: r,
|
|
12
13
|
onClear: m,
|
|
13
14
|
leftIcon: d,
|
|
14
15
|
rightIcon: p,
|
|
15
|
-
className:
|
|
16
|
-
value:
|
|
17
|
-
color:
|
|
18
|
-
style:
|
|
19
|
-
maxLength:
|
|
16
|
+
className: R,
|
|
17
|
+
value: l,
|
|
18
|
+
color: _,
|
|
19
|
+
style: j,
|
|
20
|
+
maxLength: u,
|
|
20
21
|
label: i,
|
|
22
|
+
autoBlur: x = !1,
|
|
21
23
|
placeholder: b,
|
|
22
24
|
...w
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
}, L) => {
|
|
26
|
+
const k = J().replace(/:/g, ""), n = y ?? `motile-input-${k}`, E = v(null), o = L || E, N = v(null);
|
|
27
|
+
O({ containerRef: N, enabled: x });
|
|
28
|
+
const s = C ?? !!r;
|
|
29
|
+
K(() => {
|
|
30
|
+
if ($ && o.current) {
|
|
31
|
+
const G = setTimeout(() => {
|
|
32
|
+
o.current && (o.current.focus(), f && o.current.select());
|
|
29
33
|
}, 50);
|
|
30
|
-
return () => clearTimeout(
|
|
34
|
+
return () => clearTimeout(G);
|
|
31
35
|
}
|
|
32
|
-
}, [$,
|
|
33
|
-
const e = "motile-input",
|
|
36
|
+
}, [$, f]);
|
|
37
|
+
const e = "motile-input", h = m && l, S = !!d, T = h || p, z = [
|
|
34
38
|
e,
|
|
35
|
-
`${e}--${
|
|
39
|
+
`${e}--${B}`,
|
|
36
40
|
s && `${e}--error`,
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
S && `${e}--with-left-icon`,
|
|
42
|
+
T && `${e}--with-right-content`,
|
|
39
43
|
i && `${e}--with-label`,
|
|
40
|
-
|
|
41
|
-
].filter(Boolean).join(" "),
|
|
44
|
+
R
|
|
45
|
+
].filter(Boolean).join(" "), A = [
|
|
42
46
|
`${e}-wrapper`,
|
|
43
47
|
i && `${e}-wrapper--with-label`,
|
|
44
48
|
s && `${e}-wrapper--shake`
|
|
45
|
-
].filter(Boolean).join(" "),
|
|
49
|
+
].filter(Boolean).join(" "), I = [
|
|
46
50
|
`${e}__label`,
|
|
47
51
|
s && `${e}__label--error`
|
|
48
|
-
].filter(Boolean).join(" "),
|
|
49
|
-
...
|
|
50
|
-
},
|
|
52
|
+
].filter(Boolean).join(" "), g = _ ? { "--motile-input-color": _ } : void 0, q = {
|
|
53
|
+
...j
|
|
54
|
+
}, D = l ? String(l).length : 0, c = u !== void 0, F = [
|
|
51
55
|
w["aria-describedby"],
|
|
52
56
|
r ? `${n}-error` : void 0,
|
|
53
57
|
c ? `${n}-counter` : void 0
|
|
54
58
|
].filter(Boolean).join(" ") || void 0;
|
|
55
|
-
return /* @__PURE__ */ a("div", { className: `${e}-root`, children: [
|
|
56
|
-
/* @__PURE__ */ a("div", { className:
|
|
57
|
-
i && /* @__PURE__ */ t("label", { className:
|
|
59
|
+
return /* @__PURE__ */ a("div", { className: `${e}-root`, ref: N, children: [
|
|
60
|
+
/* @__PURE__ */ a("div", { className: A, style: g, children: [
|
|
61
|
+
i && /* @__PURE__ */ t("label", { className: I, htmlFor: n, children: i }),
|
|
58
62
|
d && /* @__PURE__ */ t("div", { className: `${e}__left-icon`, children: d }),
|
|
59
63
|
/* @__PURE__ */ t(
|
|
60
64
|
"input",
|
|
61
65
|
{
|
|
62
66
|
id: n,
|
|
63
67
|
...w,
|
|
64
|
-
"aria-describedby":
|
|
68
|
+
"aria-describedby": F,
|
|
65
69
|
"aria-invalid": s || void 0,
|
|
66
|
-
ref:
|
|
67
|
-
className:
|
|
68
|
-
value:
|
|
69
|
-
maxLength:
|
|
70
|
-
style:
|
|
70
|
+
ref: o,
|
|
71
|
+
className: z,
|
|
72
|
+
value: l,
|
|
73
|
+
maxLength: u,
|
|
74
|
+
style: q,
|
|
71
75
|
placeholder: i ? b || " " : b
|
|
72
76
|
}
|
|
73
77
|
),
|
|
74
|
-
p && !
|
|
75
|
-
|
|
78
|
+
p && !h && /* @__PURE__ */ t("div", { className: `${e}__right-icon`, children: p }),
|
|
79
|
+
h && /* @__PURE__ */ t(
|
|
76
80
|
"button",
|
|
77
81
|
{
|
|
78
82
|
type: "button",
|
|
@@ -106,9 +110,9 @@ const J = D(
|
|
|
106
110
|
}
|
|
107
111
|
),
|
|
108
112
|
c && /* @__PURE__ */ a("span", { id: `${n}-counter`, className: `${e}__counter`, children: [
|
|
109
|
-
|
|
113
|
+
D,
|
|
110
114
|
"/",
|
|
111
|
-
|
|
115
|
+
u
|
|
112
116
|
] })
|
|
113
117
|
]
|
|
114
118
|
}
|
|
@@ -116,7 +120,7 @@ const J = D(
|
|
|
116
120
|
] });
|
|
117
121
|
}
|
|
118
122
|
);
|
|
119
|
-
|
|
123
|
+
P.displayName = "Input";
|
|
120
124
|
export {
|
|
121
|
-
|
|
125
|
+
P as Input
|
|
122
126
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import n, { useRef as
|
|
1
|
+
import { jsx as l, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import n, { useRef as L, useState as O, useEffect as P, useId as v, createContext as V, useContext as q } from "react";
|
|
3
3
|
import { createPortal as z } from "react-dom";
|
|
4
4
|
import { useClickOutside as A } from "../../hooks/useClickOutside.js";
|
|
5
5
|
import { useEscapeKey as D } from "../../hooks/useEscapeKey.js";
|
|
6
6
|
import { useScrollLock as G } from "../../hooks/useScrollLock.js";
|
|
7
7
|
import { Slot as J } from "../../utils/Slot.js";
|
|
8
8
|
import './Modal.css';/* empty css */
|
|
9
|
-
const
|
|
10
|
-
const o = q(
|
|
9
|
+
const _ = V(null), m = () => {
|
|
10
|
+
const o = q(_);
|
|
11
11
|
if (!o)
|
|
12
12
|
throw new Error("Modal compound components must be used within Modal.Root");
|
|
13
13
|
return o;
|
|
@@ -16,7 +16,7 @@ const v = V(null), m = () => {
|
|
|
16
16
|
onOpenChange: t,
|
|
17
17
|
children: e
|
|
18
18
|
}) => {
|
|
19
|
-
const a =
|
|
19
|
+
const a = v(), d = v(), r = n.useMemo(
|
|
20
20
|
() => ({
|
|
21
21
|
open: o,
|
|
22
22
|
onOpenChange: t,
|
|
@@ -25,8 +25,8 @@ const v = V(null), m = () => {
|
|
|
25
25
|
}),
|
|
26
26
|
[o, t, a, d]
|
|
27
27
|
);
|
|
28
|
-
return /* @__PURE__ */ l(
|
|
29
|
-
},
|
|
28
|
+
return /* @__PURE__ */ l(_.Provider, { value: r, children: e });
|
|
29
|
+
}, N = n.forwardRef(
|
|
30
30
|
({
|
|
31
31
|
container: o,
|
|
32
32
|
variant: t = "scale",
|
|
@@ -37,14 +37,14 @@ const v = V(null), m = () => {
|
|
|
37
37
|
zIndex: s = 1e3,
|
|
38
38
|
className: u,
|
|
39
39
|
onClick: i,
|
|
40
|
-
style:
|
|
40
|
+
style: g,
|
|
41
41
|
...p
|
|
42
|
-
},
|
|
43
|
-
const { open: c, onOpenChange: f } = m(), M =
|
|
42
|
+
}, S) => {
|
|
43
|
+
const { open: c, onOpenChange: f } = m(), M = L(null), [E, T] = O(!1);
|
|
44
44
|
P(() => {
|
|
45
|
-
|
|
45
|
+
T(!0);
|
|
46
46
|
}, []);
|
|
47
|
-
const b = typeof e == "boolean" ? e : e.clickOutside ?? !1,
|
|
47
|
+
const b = typeof e == "boolean" ? e : e.clickOutside ?? !1, h = typeof e == "boolean" ? e : e.escapeKey ?? !1;
|
|
48
48
|
G({
|
|
49
49
|
enabled: c && !a,
|
|
50
50
|
allowedSelectors: [".motile-modal__content"]
|
|
@@ -56,30 +56,32 @@ const v = V(null), m = () => {
|
|
|
56
56
|
enabled: c
|
|
57
57
|
}), D({
|
|
58
58
|
handler: () => {
|
|
59
|
-
|
|
59
|
+
h && f(!1);
|
|
60
60
|
},
|
|
61
|
-
enabled: c
|
|
61
|
+
enabled: c && h,
|
|
62
|
+
stacked: !0
|
|
63
|
+
// ์ค์ฒฉ ์ค๋ฒ๋ ์ด์์ ESC๋ ์ต์๋จ๋ง ๋ซ๋๋ค
|
|
62
64
|
});
|
|
63
65
|
const j = (y) => {
|
|
64
66
|
i == null || i(y), y.target === y.currentTarget && b && f(!1);
|
|
65
67
|
};
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
+
if (!E || !c) return null;
|
|
69
|
+
const k = {
|
|
68
70
|
zIndex: s,
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
+
...g
|
|
72
|
+
}, F = {
|
|
71
73
|
...d && { "--modal-width": d },
|
|
72
74
|
...r && { "--modal-max-width": r },
|
|
73
75
|
zIndex: s + 1
|
|
74
|
-
},
|
|
76
|
+
}, H = /* @__PURE__ */ l(
|
|
75
77
|
"div",
|
|
76
78
|
{
|
|
77
|
-
ref:
|
|
79
|
+
ref: S,
|
|
78
80
|
className: `motile-modal__backdrop ${u || ""}`,
|
|
79
81
|
"data-state": c ? "open" : "closed",
|
|
80
82
|
"data-variant": t,
|
|
81
83
|
onClick: j,
|
|
82
|
-
style:
|
|
84
|
+
style: k,
|
|
83
85
|
...p,
|
|
84
86
|
children: /* @__PURE__ */ l(
|
|
85
87
|
"div",
|
|
@@ -87,17 +89,17 @@ const v = V(null), m = () => {
|
|
|
87
89
|
ref: M,
|
|
88
90
|
className: "motile-modal",
|
|
89
91
|
"data-variant": t,
|
|
90
|
-
style:
|
|
92
|
+
style: F,
|
|
91
93
|
children: p.children
|
|
92
94
|
}
|
|
93
95
|
)
|
|
94
96
|
}
|
|
95
97
|
);
|
|
96
|
-
return z(
|
|
98
|
+
return z(H, o || document.body);
|
|
97
99
|
}
|
|
98
100
|
);
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
+
N.displayName = "Modal.Overlay";
|
|
102
|
+
const w = n.forwardRef(
|
|
101
103
|
({ className: o, forceMount: t, ...e }, a) => {
|
|
102
104
|
const { open: d, titleId: r, descriptionId: s } = m();
|
|
103
105
|
return !d && !t ? null : /* @__PURE__ */ l(
|
|
@@ -115,8 +117,8 @@ const N = n.forwardRef(
|
|
|
115
117
|
);
|
|
116
118
|
}
|
|
117
119
|
);
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
+
w.displayName = "Modal.Content";
|
|
121
|
+
const x = n.forwardRef(
|
|
120
122
|
({ className: o, ...t }, e) => {
|
|
121
123
|
const { titleId: a } = m();
|
|
122
124
|
return /* @__PURE__ */ l(
|
|
@@ -130,8 +132,8 @@ const w = n.forwardRef(
|
|
|
130
132
|
);
|
|
131
133
|
}
|
|
132
134
|
);
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
+
x.displayName = "Modal.Title";
|
|
136
|
+
const R = n.forwardRef(
|
|
135
137
|
({ className: o, ...t }, e) => {
|
|
136
138
|
const { descriptionId: a } = m();
|
|
137
139
|
return /* @__PURE__ */ l(
|
|
@@ -145,8 +147,8 @@ const x = n.forwardRef(
|
|
|
145
147
|
);
|
|
146
148
|
}
|
|
147
149
|
);
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
+
R.displayName = "Modal.Body";
|
|
151
|
+
const C = n.forwardRef(
|
|
150
152
|
({ asChild: o, className: t, onClick: e, children: a, ...d }, r) => {
|
|
151
153
|
const { onOpenChange: s } = m(), u = (i) => {
|
|
152
154
|
e == null || e(i), s(!1);
|
|
@@ -168,7 +170,7 @@ const R = n.forwardRef(
|
|
|
168
170
|
onClick: u,
|
|
169
171
|
"aria-label": "๋ซ๊ธฐ",
|
|
170
172
|
...d,
|
|
171
|
-
children: a || /* @__PURE__ */
|
|
173
|
+
children: a || /* @__PURE__ */ K(
|
|
172
174
|
"svg",
|
|
173
175
|
{
|
|
174
176
|
width: "18",
|
|
@@ -189,8 +191,8 @@ const R = n.forwardRef(
|
|
|
189
191
|
);
|
|
190
192
|
}
|
|
191
193
|
);
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
+
C.displayName = "Modal.Close";
|
|
195
|
+
const I = n.forwardRef(
|
|
194
196
|
({ className: o, ...t }, e) => /* @__PURE__ */ l(
|
|
195
197
|
"div",
|
|
196
198
|
{
|
|
@@ -200,8 +202,8 @@ const C = n.forwardRef(
|
|
|
200
202
|
}
|
|
201
203
|
)
|
|
202
204
|
);
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
+
I.displayName = "Modal.Footer";
|
|
206
|
+
const $ = n.forwardRef(
|
|
205
207
|
({ className: o, ...t }, e) => /* @__PURE__ */ l(
|
|
206
208
|
"div",
|
|
207
209
|
{
|
|
@@ -211,25 +213,25 @@ const I = n.forwardRef(
|
|
|
211
213
|
}
|
|
212
214
|
)
|
|
213
215
|
);
|
|
214
|
-
|
|
216
|
+
$.displayName = "Modal.Header";
|
|
215
217
|
const te = {
|
|
216
218
|
Root: Q,
|
|
217
|
-
Overlay:
|
|
218
|
-
Content:
|
|
219
|
-
Title:
|
|
220
|
-
Body:
|
|
221
|
-
Close:
|
|
222
|
-
Footer:
|
|
223
|
-
Header:
|
|
219
|
+
Overlay: N,
|
|
220
|
+
Content: w,
|
|
221
|
+
Title: x,
|
|
222
|
+
Body: R,
|
|
223
|
+
Close: C,
|
|
224
|
+
Footer: I,
|
|
225
|
+
Header: $
|
|
224
226
|
};
|
|
225
227
|
export {
|
|
226
228
|
te as Modal,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
R as ModalBody,
|
|
230
|
+
C as ModalClose,
|
|
231
|
+
w as ModalContent,
|
|
232
|
+
I as ModalFooter,
|
|
233
|
+
$ as ModalHeader,
|
|
234
|
+
N as ModalOverlay,
|
|
233
235
|
Q as ModalRoot,
|
|
234
|
-
|
|
236
|
+
x as ModalTitle
|
|
235
237
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as y, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import $, { useCallback as b, useId as N, useRef as I, useMemo as j, createContext as E, useContext as T } from "react";
|
|
3
3
|
import { useClickOutside as h } from "../../hooks/useClickOutside.js";
|
|
4
4
|
import { useEscapeKey as A } from "../../hooks/useEscapeKey.js";
|
|
5
5
|
import { FloatingArrow as B } from "../../utils/FloatingArrow.js";
|
|
@@ -17,7 +17,7 @@ function K({
|
|
|
17
17
|
defaultValue: p = !1,
|
|
18
18
|
onChange: o
|
|
19
19
|
}) {
|
|
20
|
-
const e = t !== void 0, [r, s] =
|
|
20
|
+
const e = t !== void 0, [r, s] = $.useState(p), l = e ? t : r, c = b(
|
|
21
21
|
(a) => {
|
|
22
22
|
const d = typeof a == "function" ? a(l) : a;
|
|
23
23
|
e || s(d), o == null || o(d);
|
|
@@ -38,15 +38,15 @@ function M({
|
|
|
38
38
|
open: a,
|
|
39
39
|
defaultOpen: d = !1,
|
|
40
40
|
onOpenChange: m,
|
|
41
|
-
onClickOutside:
|
|
41
|
+
onClickOutside: u,
|
|
42
42
|
onDismiss: v,
|
|
43
|
-
autoClose:
|
|
43
|
+
autoClose: f = !0
|
|
44
44
|
}) {
|
|
45
45
|
const n = N().replace(/:/g, ""), x = I(null), w = I(null), P = I(null), [R, i] = K({
|
|
46
46
|
value: a,
|
|
47
47
|
defaultValue: d,
|
|
48
48
|
onChange: m
|
|
49
|
-
}),
|
|
49
|
+
}), k = j(
|
|
50
50
|
() => ({
|
|
51
51
|
open: R,
|
|
52
52
|
setOpen: i,
|
|
@@ -56,10 +56,10 @@ function M({
|
|
|
56
56
|
showArrow: r,
|
|
57
57
|
zIndex: s,
|
|
58
58
|
color: l,
|
|
59
|
-
autoClose:
|
|
59
|
+
autoClose: f,
|
|
60
60
|
bounceCount: c,
|
|
61
61
|
onOpenChange: m,
|
|
62
|
-
onClickOutside:
|
|
62
|
+
onClickOutside: u,
|
|
63
63
|
onDismiss: v,
|
|
64
64
|
triggerId: `${n}-trigger`,
|
|
65
65
|
contentId: `${n}-content`,
|
|
@@ -76,15 +76,15 @@ function M({
|
|
|
76
76
|
r,
|
|
77
77
|
s,
|
|
78
78
|
l,
|
|
79
|
-
|
|
79
|
+
f,
|
|
80
80
|
c,
|
|
81
81
|
m,
|
|
82
|
-
|
|
82
|
+
u,
|
|
83
83
|
v,
|
|
84
84
|
n
|
|
85
85
|
]
|
|
86
86
|
);
|
|
87
|
-
return /* @__PURE__ */ g(S.Provider, { value:
|
|
87
|
+
return /* @__PURE__ */ g(S.Provider, { value: k, children: /* @__PURE__ */ g("div", { ref: P, className: "motile-popover-wrapper", children: t }) });
|
|
88
88
|
}
|
|
89
89
|
function V({ children: t, asChild: p = !1 }) {
|
|
90
90
|
const { open: o, setOpen: e, triggerId: r, contentId: s, triggerRef: l } = C(), c = b(() => {
|
|
@@ -129,9 +129,9 @@ function q({
|
|
|
129
129
|
showArrow: a,
|
|
130
130
|
zIndex: d,
|
|
131
131
|
color: m,
|
|
132
|
-
autoClose:
|
|
132
|
+
autoClose: u,
|
|
133
133
|
bounceCount: v,
|
|
134
|
-
onClickOutside:
|
|
134
|
+
onClickOutside: f,
|
|
135
135
|
onDismiss: n,
|
|
136
136
|
contentId: x,
|
|
137
137
|
contentRef: w,
|
|
@@ -140,23 +140,27 @@ function q({
|
|
|
140
140
|
if (A({
|
|
141
141
|
handler: b(
|
|
142
142
|
(i) => {
|
|
143
|
-
|
|
143
|
+
u && (n == null || n(i), i.defaultPrevented || r(!1));
|
|
144
144
|
},
|
|
145
|
-
[
|
|
145
|
+
[u, n, r]
|
|
146
146
|
),
|
|
147
|
-
enabled
|
|
147
|
+
// enabled๋ฅผ ์ ์งํ๊ฒ ๊ณ์ฐ โ ๋ซํ์ง ์์(autoClose=false) ํ์ค๋ฒ๊ฐ
|
|
148
|
+
// ESC ์คํ์ top์ ์ ์ ํด ์๋ ์ค๋ฒ๋ ์ด์ ESC๋ฅผ ์ผํค์ง ์๊ฒ
|
|
149
|
+
enabled: e && u,
|
|
150
|
+
stacked: !0
|
|
151
|
+
// ์ค์ฒฉ ์ค๋ฒ๋ ์ด์์ ESC๋ ์ต์๋จ๋ง ๋ซ๋๋ค
|
|
148
152
|
}), h({
|
|
149
153
|
refs: [P],
|
|
150
154
|
handler: b(
|
|
151
155
|
(i) => {
|
|
152
|
-
|
|
156
|
+
u && (f == null || f(i), n == null || n(i), i.defaultPrevented || r(!1));
|
|
153
157
|
},
|
|
154
|
-
[
|
|
158
|
+
[u, f, n, r]
|
|
155
159
|
),
|
|
156
160
|
enabled: e
|
|
157
161
|
}), !e) return null;
|
|
158
162
|
const R = v !== 0;
|
|
159
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ y(
|
|
160
164
|
"div",
|
|
161
165
|
{
|
|
162
166
|
ref: w,
|