motile-ui 1.3.1 โ†’ 1.5.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.
Files changed (43) hide show
  1. package/README.md +4 -0
  2. package/dist/components/Drawer/Drawer.js +3 -1
  3. package/dist/components/Input/Input.d.ts +6 -0
  4. package/dist/components/Input/Input.js +48 -44
  5. package/dist/components/Modal/Modal.d.ts +13 -0
  6. package/dist/components/Modal/Modal.js +109 -99
  7. package/dist/components/Popover/Popover.js +23 -19
  8. package/dist/components/Select/Select.js +61 -59
  9. package/dist/components/Sheet/Sheet.js +3 -1
  10. package/dist/components/SpeedDial/SpeedDial.js +38 -36
  11. package/dist/components/Textarea/Textarea.d.ts +6 -0
  12. package/dist/components/Textarea/Textarea.js +44 -40
  13. package/dist/hooks/index.d.ts +2 -0
  14. package/dist/hooks/index.js +10 -8
  15. package/dist/hooks/useAutoBlur.d.ts +45 -0
  16. package/dist/hooks/useAutoBlur.js +32 -0
  17. package/dist/hooks/useEscapeKey.d.ts +15 -1
  18. package/dist/hooks/useEscapeKey.js +27 -12
  19. package/dist/hooks/useHistoryClose.js +89 -48
  20. package/dist/hooks/useScrollLock.js +42 -24
  21. package/package.json +1 -1
  22. package/dist/components/Accordion/Accordion.test.d.ts +0 -1
  23. package/dist/components/Badge/Badge.test.d.ts +0 -1
  24. package/dist/components/Button/Button.test.d.ts +0 -1
  25. package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
  26. package/dist/components/Dock/Dock.test.d.ts +0 -1
  27. package/dist/components/Drawer/Drawer.test.d.ts +0 -1
  28. package/dist/components/Input/Input.test.d.ts +0 -1
  29. package/dist/components/Modal/Modal.test.d.ts +0 -1
  30. package/dist/components/NumberFlow/NumberFlow.test.d.ts +0 -1
  31. package/dist/components/Popover/Popover.test.d.ts +0 -1
  32. package/dist/components/Select/Select.test.d.ts +0 -1
  33. package/dist/components/Sheet/Sheet.test.d.ts +0 -1
  34. package/dist/components/Skeleton/Skeleton.test.d.ts +0 -1
  35. package/dist/components/SpeedDial/SpeedDial.test.d.ts +0 -1
  36. package/dist/components/Switch/Switch.test.d.ts +0 -1
  37. package/dist/components/Tab/Tab.test.d.ts +0 -1
  38. package/dist/components/Textarea/Textarea.test.d.ts +0 -1
  39. package/dist/components/TimePicker/TimePicker.test.d.ts +0 -1
  40. package/dist/components/Toast/Toast.test.d.ts +0 -1
  41. package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
  42. package/dist/test/setup.d.ts +0 -1
  43. 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 D, useId as F, useRef as G, useEffect as H } from "react";
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 J = D(
5
+ const P = H(
5
6
  ({
6
- id: N,
7
+ id: y,
7
8
  autoFocus: $ = !1,
8
- autoSelect: _ = !1,
9
- variant: v = "outlined",
10
- isError: y,
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: C,
16
- value: o,
17
- color: f,
18
- style: B,
19
- maxLength: h,
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
- }, 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());
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(A);
34
+ return () => clearTimeout(G);
31
35
  }
32
- }, [$, _]);
33
- const e = "motile-input", u = m && o, L = !!d, k = u || p, E = [
36
+ }, [$, f]);
37
+ const e = "motile-input", h = m && l, S = !!d, T = h || p, z = [
34
38
  e,
35
- `${e}--${v}`,
39
+ `${e}--${B}`,
36
40
  s && `${e}--error`,
37
- L && `${e}--with-left-icon`,
38
- k && `${e}--with-right-content`,
41
+ S && `${e}--with-left-icon`,
42
+ T && `${e}--with-right-content`,
39
43
  i && `${e}--with-label`,
40
- C
41
- ].filter(Boolean).join(" "), S = [
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(" "), T = [
49
+ ].filter(Boolean).join(" "), I = [
46
50
  `${e}__label`,
47
51
  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 = [
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: S, style: z, children: [
57
- i && /* @__PURE__ */ t("label", { className: T, htmlFor: n, children: i }),
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": q,
68
+ "aria-describedby": F,
65
69
  "aria-invalid": s || void 0,
66
- ref: l,
67
- className: E,
68
- value: o,
69
- maxLength: h,
70
- style: I,
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 && !u && /* @__PURE__ */ t("div", { className: `${e}__right-icon`, children: p }),
75
- u && /* @__PURE__ */ t(
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
- g,
113
+ D,
110
114
  "/",
111
- h
115
+ u
112
116
  ] })
113
117
  ]
114
118
  }
@@ -116,7 +120,7 @@ const J = D(
116
120
  ] });
117
121
  }
118
122
  );
119
- J.displayName = "Input";
123
+ P.displayName = "Input";
120
124
  export {
121
- J as Input
125
+ P as Input
122
126
  };
@@ -37,6 +37,19 @@ interface ModalRootProps {
37
37
  * Modal ๋‚ด์šฉ
38
38
  */
39
39
  children: React.ReactNode;
40
+ /**
41
+ * ๋ธŒ๋ผ์šฐ์ € ํžˆ์Šคํ† ๋ฆฌ(๋’ค๋กœ๊ฐ€๊ธฐ / iOS ์Šค์™€์ดํ”„ ์ œ์Šค์ฒ˜)๋กœ Modal ๋‹ซ๊ธฐ ํ™œ์„ฑํ™”.
42
+ *
43
+ * ์˜ตํŠธ์ธ ๊ธฐ๋Šฅ์ด๋‹ค. ํ™œ์„ฑ ์‹œ ์—ด๋ฆด ๋•Œ ๋”๋ฏธ ํžˆ์Šคํ† ๋ฆฌ ํ•ญ๋ชฉ์„ pushํ•˜๊ณ ,
44
+ * ๋ธŒ๋ผ์šฐ์ € ๋’ค๋กœ๊ฐ€๊ธฐ๋กœ Modal์ด ๋‹ซํžŒ๋‹ค. ๋‚ด๋ถ€์ ์œผ๋กœ Sheet๊ณผ ๋™์ผํ•œ ์˜ค๋ฒ„๋ ˆ์ด
45
+ * ํžˆ์Šคํ† ๋ฆฌ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ๊ณต์œ ํ•˜๋ฏ€๋กœ Sheet/Modal ์ค‘์ฒฉ์—์„œ๋„ ์•ˆ์ „ํ•˜๋‹ค.
46
+ *
47
+ * ์ฃผ์˜: ์—ด๋ฆฐ ์ƒํƒœ๋กœ Modal.Root๊ฐ€ ์–ธ๋งˆ์šดํŠธ๋˜๊ฑฐ๋‚˜ ์™ธ๋ถ€ ๋ผ์šฐํŒ…(router.push ๋“ฑ)์œผ๋กœ
48
+ * ๋‹ซํžˆ๋ฉด ์ •๋ฆฌ์šฉ back()์ด ์‹คํ–‰๋˜์ง€ ์•Š์•„ ๋”๋ฏธ ํ•ญ๋ชฉ์ด ๋‚จ์„ ์ˆ˜ ์žˆ๋‹ค(๋’ค๋กœ๊ฐ€๊ธฐ ํ•œ ๋ฒˆ์€ no-op).
49
+ *
50
+ * @default false
51
+ */
52
+ enableHistoryClose?: boolean;
40
53
  }
41
54
  interface ModalOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
42
55
  /**
@@ -1,124 +1,134 @@
1
- import { jsx as l, jsxs as L } from "react/jsx-runtime";
2
- import n, { useRef as k, useState as O, useEffect as P, useId as h, createContext as V, useContext as q } from "react";
3
- import { createPortal as z } from "react-dom";
4
- import { useClickOutside as A } from "../../hooks/useClickOutside.js";
5
- import { useEscapeKey as D } from "../../hooks/useEscapeKey.js";
6
- import { useScrollLock as G } from "../../hooks/useScrollLock.js";
7
- import { Slot as J } from "../../utils/Slot.js";
1
+ import { jsx as l, jsxs as P } from "react/jsx-runtime";
2
+ import n, { useRef as O, useState as V, useEffect as q, useId as _, createContext as z, useContext as A } from "react";
3
+ import { createPortal as D } from "react-dom";
4
+ import { useClickOutside as G } from "../../hooks/useClickOutside.js";
5
+ import { useEscapeKey as J } from "../../hooks/useEscapeKey.js";
6
+ import { useHistoryClose as Q } from "../../hooks/useHistoryClose.js";
7
+ import { useScrollLock as U } from "../../hooks/useScrollLock.js";
8
+ import { Slot as W } from "../../utils/Slot.js";
8
9
  import './Modal.css';/* empty css */
9
- const v = V(null), m = () => {
10
- const o = q(v);
10
+ const h = z(null), u = () => {
11
+ const o = A(h);
11
12
  if (!o)
12
13
  throw new Error("Modal compound components must be used within Modal.Root");
13
14
  return o;
14
- }, Q = ({
15
+ }, X = ({
15
16
  open: o,
16
17
  onOpenChange: t,
17
- children: e
18
+ children: e,
19
+ enableHistoryClose: a = !1
18
20
  }) => {
19
- const a = h(), d = h(), r = n.useMemo(
21
+ const r = _(), d = _(), { close: s } = Q({
22
+ isOpen: o,
23
+ onClose: () => t(!1),
24
+ enabled: a
25
+ }), i = n.useMemo(
20
26
  () => ({
21
27
  open: o,
22
28
  onOpenChange: t,
23
- titleId: a,
29
+ close: s,
30
+ enableHistoryClose: a,
31
+ titleId: r,
24
32
  descriptionId: d
25
33
  }),
26
- [o, t, a, d]
34
+ [o, t, s, a, r, d]
27
35
  );
28
- return /* @__PURE__ */ l(v.Provider, { value: r, children: e });
29
- }, _ = n.forwardRef(
36
+ return /* @__PURE__ */ l(h.Provider, { value: i, children: e });
37
+ }, N = n.forwardRef(
30
38
  ({
31
39
  container: o,
32
40
  variant: t = "scale",
33
41
  closeOnBackdrop: e = !0,
34
42
  disableScrollLock: a = !1,
35
- width: d,
36
- maxWidth: r,
43
+ width: r,
44
+ maxWidth: d,
37
45
  zIndex: s = 1e3,
38
- className: u,
39
- onClick: i,
40
- style: $,
41
- ...p
46
+ className: i,
47
+ onClick: c,
48
+ style: S,
49
+ ...y
42
50
  }, g) => {
43
- const { open: c, onOpenChange: f } = m(), M = k(null), [S, E] = O(!1);
44
- P(() => {
45
- E(!0);
51
+ const { open: m, onOpenChange: E, close: p, enableHistoryClose: T } = u(), M = O(null), [j, k] = V(!1);
52
+ q(() => {
53
+ k(!0);
46
54
  }, []);
47
- const b = typeof e == "boolean" ? e : e.clickOutside ?? !1, T = typeof e == "boolean" ? e : e.escapeKey ?? !1;
48
- G({
49
- enabled: c && !a,
55
+ const b = typeof e == "boolean" ? e : e.clickOutside ?? !1, v = typeof e == "boolean" ? e : e.escapeKey ?? !1;
56
+ U({
57
+ enabled: m && !a,
50
58
  allowedSelectors: [".motile-modal__content"]
51
- }), A({
59
+ }), G({
52
60
  refs: [M],
53
61
  handler: () => {
54
- b && f(!1);
62
+ b && !T && E(!1);
55
63
  },
56
- enabled: c
57
- }), D({
64
+ enabled: m
65
+ }), J({
58
66
  handler: () => {
59
- T && f(!1);
67
+ v && p();
60
68
  },
61
- enabled: c
69
+ enabled: m && v,
70
+ stacked: !0
71
+ // ์ค‘์ฒฉ ์˜ค๋ฒ„๋ ˆ์ด์—์„œ ESC๋Š” ์ตœ์ƒ๋‹จ๋งŒ ๋‹ซ๋Š”๋‹ค
62
72
  });
63
- const j = (y) => {
64
- i == null || i(y), y.target === y.currentTarget && b && f(!1);
73
+ const F = (f) => {
74
+ c == null || c(f), f.target === f.currentTarget && b && p();
65
75
  };
66
- if (!S || !c) return null;
67
- const F = {
76
+ if (!j || !m) return null;
77
+ const H = {
68
78
  zIndex: s,
69
- ...$
70
- }, H = {
71
- ...d && { "--modal-width": d },
72
- ...r && { "--modal-max-width": r },
79
+ ...S
80
+ }, K = {
81
+ ...r && { "--modal-width": r },
82
+ ...d && { "--modal-max-width": d },
73
83
  zIndex: s + 1
74
- }, K = /* @__PURE__ */ l(
84
+ }, L = /* @__PURE__ */ l(
75
85
  "div",
76
86
  {
77
87
  ref: g,
78
- className: `motile-modal__backdrop ${u || ""}`,
79
- "data-state": c ? "open" : "closed",
88
+ className: `motile-modal__backdrop ${i || ""}`,
89
+ "data-state": m ? "open" : "closed",
80
90
  "data-variant": t,
81
- onClick: j,
82
- style: F,
83
- ...p,
91
+ onClick: F,
92
+ style: H,
93
+ ...y,
84
94
  children: /* @__PURE__ */ l(
85
95
  "div",
86
96
  {
87
97
  ref: M,
88
98
  className: "motile-modal",
89
99
  "data-variant": t,
90
- style: H,
91
- children: p.children
100
+ style: K,
101
+ children: y.children
92
102
  }
93
103
  )
94
104
  }
95
105
  );
96
- return z(K, o || document.body);
106
+ return D(L, o || document.body);
97
107
  }
98
108
  );
99
- _.displayName = "Modal.Overlay";
100
- const N = n.forwardRef(
109
+ N.displayName = "Modal.Overlay";
110
+ const w = n.forwardRef(
101
111
  ({ className: o, forceMount: t, ...e }, a) => {
102
- const { open: d, titleId: r, descriptionId: s } = m();
103
- return !d && !t ? null : /* @__PURE__ */ l(
112
+ const { open: r, titleId: d, descriptionId: s } = u();
113
+ return !r && !t ? null : /* @__PURE__ */ l(
104
114
  "div",
105
115
  {
106
116
  ref: a,
107
117
  className: `motile-modal__content ${o || ""}`,
108
118
  role: "dialog",
109
119
  "aria-modal": "true",
110
- "aria-labelledby": r,
120
+ "aria-labelledby": d,
111
121
  "aria-describedby": s,
112
- "data-state": d ? "open" : "closed",
122
+ "data-state": r ? "open" : "closed",
113
123
  ...e
114
124
  }
115
125
  );
116
126
  }
117
127
  );
118
- N.displayName = "Modal.Content";
119
- const w = n.forwardRef(
128
+ w.displayName = "Modal.Content";
129
+ const x = n.forwardRef(
120
130
  ({ className: o, ...t }, e) => {
121
- const { titleId: a } = m();
131
+ const { titleId: a } = u();
122
132
  return /* @__PURE__ */ l(
123
133
  "h2",
124
134
  {
@@ -130,10 +140,10 @@ const w = n.forwardRef(
130
140
  );
131
141
  }
132
142
  );
133
- w.displayName = "Modal.Title";
134
- const x = n.forwardRef(
143
+ x.displayName = "Modal.Title";
144
+ const R = n.forwardRef(
135
145
  ({ className: o, ...t }, e) => {
136
- const { descriptionId: a } = m();
146
+ const { descriptionId: a } = u();
137
147
  return /* @__PURE__ */ l(
138
148
  "div",
139
149
  {
@@ -145,30 +155,30 @@ const x = n.forwardRef(
145
155
  );
146
156
  }
147
157
  );
148
- x.displayName = "Modal.Body";
149
- const R = n.forwardRef(
150
- ({ asChild: o, className: t, onClick: e, children: a, ...d }, r) => {
151
- const { onOpenChange: s } = m(), u = (i) => {
152
- e == null || e(i), s(!1);
158
+ R.displayName = "Modal.Body";
159
+ const C = n.forwardRef(
160
+ ({ asChild: o, className: t, onClick: e, children: a, ...r }, d) => {
161
+ const { close: s } = u(), i = (c) => {
162
+ e == null || e(c), s();
153
163
  };
154
164
  return o ? /* @__PURE__ */ l(
155
- J,
165
+ W,
156
166
  {
157
- ...d,
158
- onClick: u,
159
- ref: r,
167
+ ...r,
168
+ onClick: i,
169
+ ref: d,
160
170
  children: a
161
171
  }
162
172
  ) : /* @__PURE__ */ l(
163
173
  "button",
164
174
  {
165
- ref: r,
175
+ ref: d,
166
176
  type: "button",
167
177
  className: `motile-modal__close ${t || ""}`,
168
- onClick: u,
178
+ onClick: i,
169
179
  "aria-label": "๋‹ซ๊ธฐ",
170
- ...d,
171
- children: a || /* @__PURE__ */ L(
180
+ ...r,
181
+ children: a || /* @__PURE__ */ P(
172
182
  "svg",
173
183
  {
174
184
  width: "18",
@@ -189,8 +199,8 @@ const R = n.forwardRef(
189
199
  );
190
200
  }
191
201
  );
192
- R.displayName = "Modal.Close";
193
- const C = n.forwardRef(
202
+ C.displayName = "Modal.Close";
203
+ const I = n.forwardRef(
194
204
  ({ className: o, ...t }, e) => /* @__PURE__ */ l(
195
205
  "div",
196
206
  {
@@ -200,8 +210,8 @@ const C = n.forwardRef(
200
210
  }
201
211
  )
202
212
  );
203
- C.displayName = "Modal.Footer";
204
- const I = n.forwardRef(
213
+ I.displayName = "Modal.Footer";
214
+ const $ = n.forwardRef(
205
215
  ({ className: o, ...t }, e) => /* @__PURE__ */ l(
206
216
  "div",
207
217
  {
@@ -211,25 +221,25 @@ const I = n.forwardRef(
211
221
  }
212
222
  )
213
223
  );
214
- I.displayName = "Modal.Header";
215
- const te = {
216
- Root: Q,
217
- Overlay: _,
218
- Content: N,
219
- Title: w,
220
- Body: x,
221
- Close: R,
222
- Footer: C,
223
- Header: I
224
+ $.displayName = "Modal.Header";
225
+ const de = {
226
+ Root: X,
227
+ Overlay: N,
228
+ Content: w,
229
+ Title: x,
230
+ Body: R,
231
+ Close: C,
232
+ Footer: I,
233
+ Header: $
224
234
  };
225
235
  export {
226
- te as Modal,
227
- x as ModalBody,
228
- R as ModalClose,
229
- N as ModalContent,
230
- C as ModalFooter,
231
- I as ModalHeader,
232
- _ as ModalOverlay,
233
- Q as ModalRoot,
234
- w as ModalTitle
236
+ de as Modal,
237
+ R as ModalBody,
238
+ C as ModalClose,
239
+ w as ModalContent,
240
+ I as ModalFooter,
241
+ $ as ModalHeader,
242
+ N as ModalOverlay,
243
+ X as ModalRoot,
244
+ x as ModalTitle
235
245
  };
@@ -1,5 +1,5 @@
1
- import { jsxs as $, jsx as g } from "react/jsx-runtime";
2
- import k, { useCallback as b, useId as N, useRef as I, useMemo as j, createContext as E, useContext as T } from "react";
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] = k.useState(p), l = e ? t : r, c = b(
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: f,
41
+ onClickOutside: u,
42
42
  onDismiss: v,
43
- autoClose: u = !0
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
- }), y = j(
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: u,
59
+ autoClose: f,
60
60
  bounceCount: c,
61
61
  onOpenChange: m,
62
- onClickOutside: f,
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
- u,
79
+ f,
80
80
  c,
81
81
  m,
82
- f,
82
+ u,
83
83
  v,
84
84
  n
85
85
  ]
86
86
  );
87
- return /* @__PURE__ */ g(S.Provider, { value: y, children: /* @__PURE__ */ g("div", { ref: P, className: "motile-popover-wrapper", children: t }) });
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: f,
132
+ autoClose: u,
133
133
  bounceCount: v,
134
- onClickOutside: u,
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
- f && (n == null || n(i), i.defaultPrevented || r(!1));
143
+ u && (n == null || n(i), i.defaultPrevented || r(!1));
144
144
  },
145
- [f, n, r]
145
+ [u, n, r]
146
146
  ),
147
- enabled: e
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
- f && (u == null || u(i), n == null || n(i), i.defaultPrevented || r(!1));
156
+ u && (f == null || f(i), n == null || n(i), i.defaultPrevented || r(!1));
153
157
  },
154
- [f, u, n, r]
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,