@orioncactuscorp/ui 1.16.0 → 1.18.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 (94) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +55 -14
  3. package/dist/components/ActionArea/ActionArea.css +1 -1
  4. package/dist/components/ActionArea/ActionArea.js +56 -55
  5. package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
  6. package/dist/components/Badge/Badge.css +1 -1
  7. package/dist/components/Badge/Badge.js +45 -40
  8. package/dist/components/Badge/Badge.module.scss.js +9 -8
  9. package/dist/components/Fieldset/Fieldset.css +1 -1
  10. package/dist/components/Modal/Modal.css +1 -1
  11. package/dist/components/Modal/Modal.js +582 -563
  12. package/dist/components/Modal/Modal.module.scss.js +59 -57
  13. package/dist/components/Modal/blockSize.js +7 -0
  14. package/dist/components/Modal/cssTime.js +11 -0
  15. package/dist/components/Modal/fieldReveal.js +57 -0
  16. package/dist/components/Modal/headerTapScroll.js +10 -0
  17. package/dist/components/Modal/keyboardEditable.js +31 -0
  18. package/dist/components/Modal/keyboardInsetMemory.js +24 -0
  19. package/dist/components/Modal/keyboardSession.js +46 -73
  20. package/dist/components/Modal/modalResizeTarget.js +28 -0
  21. package/dist/components/Modal/modalScrollArbitration.js +69 -80
  22. package/dist/components/Modal/scrollportScroller.js +43 -0
  23. package/dist/components/Modal/tapCaret.js +32 -0
  24. package/dist/components/Modal/useBottomSheetIntrinsicHeight.js +58 -0
  25. package/dist/components/Modal/useFieldReveal.js +81 -0
  26. package/dist/components/Modal/useMeasuredElement.js +20 -0
  27. package/dist/components/Modal/useModalContentBlockTransition.js +128 -49
  28. package/dist/components/Modal/useModalContentSizeSignal.js +30 -0
  29. package/dist/components/Modal/useModalDrag.js +1136 -1056
  30. package/dist/components/Modal/useModalKeyboardAvoidance.js +200 -117
  31. package/dist/components/Modal/useModalViewportGeometry.js +35 -19
  32. package/dist/components/PositionSnap/policy.js +40 -43
  33. package/dist/components/internal/ModalPresentation.js +1 -1
  34. package/dist/styles.css +5 -5
  35. package/dist/ui/src/components/ActionArea/ActionArea.d.ts.map +1 -1
  36. package/dist/ui/src/components/Badge/Badge.d.ts.map +1 -1
  37. package/dist/ui/src/components/Badge/types.d.ts +1 -1
  38. package/dist/ui/src/components/Badge/types.d.ts.map +1 -1
  39. package/dist/ui/src/components/Modal/Modal.d.ts +2 -2
  40. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
  41. package/dist/ui/src/components/Modal/Modal.test.utils.d.ts +12 -0
  42. package/dist/ui/src/components/Modal/Modal.test.utils.d.ts.map +1 -0
  43. package/dist/ui/src/components/Modal/blockSize.d.ts +2 -0
  44. package/dist/ui/src/components/Modal/blockSize.d.ts.map +1 -0
  45. package/dist/ui/src/components/Modal/contexts.d.ts +6 -0
  46. package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
  47. package/dist/ui/src/components/Modal/cssTime.d.ts +4 -0
  48. package/dist/ui/src/components/Modal/cssTime.d.ts.map +1 -0
  49. package/dist/ui/src/components/Modal/fieldReveal.d.ts +18 -0
  50. package/dist/ui/src/components/Modal/fieldReveal.d.ts.map +1 -0
  51. package/dist/ui/src/components/Modal/headerTapScroll.d.ts +5 -0
  52. package/dist/ui/src/components/Modal/headerTapScroll.d.ts.map +1 -0
  53. package/dist/ui/src/components/Modal/keyboardEditable.d.ts +6 -0
  54. package/dist/ui/src/components/Modal/keyboardEditable.d.ts.map +1 -0
  55. package/dist/ui/src/components/Modal/keyboardInsetMemory.d.ts +5 -0
  56. package/dist/ui/src/components/Modal/keyboardInsetMemory.d.ts.map +1 -0
  57. package/dist/ui/src/components/Modal/keyboardSession.d.ts +4 -11
  58. package/dist/ui/src/components/Modal/keyboardSession.d.ts.map +1 -1
  59. package/dist/ui/src/components/Modal/modalResizeTarget.d.ts +12 -0
  60. package/dist/ui/src/components/Modal/modalResizeTarget.d.ts.map +1 -0
  61. package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -1
  62. package/dist/ui/src/components/Modal/scrollportScroller.d.ts +20 -0
  63. package/dist/ui/src/components/Modal/scrollportScroller.d.ts.map +1 -0
  64. package/dist/ui/src/components/Modal/tapCaret.d.ts +10 -0
  65. package/dist/ui/src/components/Modal/tapCaret.d.ts.map +1 -0
  66. package/dist/ui/src/components/Modal/types.d.ts +6 -0
  67. package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
  68. package/dist/ui/src/components/Modal/useBottomSheetIntrinsicHeight.d.ts +28 -0
  69. package/dist/ui/src/components/Modal/useBottomSheetIntrinsicHeight.d.ts.map +1 -0
  70. package/dist/ui/src/components/Modal/useFieldReveal.d.ts +28 -0
  71. package/dist/ui/src/components/Modal/useFieldReveal.d.ts.map +1 -0
  72. package/dist/ui/src/components/Modal/{useElementSize.d.ts → useMeasuredElement.d.ts} +1 -1
  73. package/dist/ui/src/components/Modal/useMeasuredElement.d.ts.map +1 -0
  74. package/dist/ui/src/components/Modal/useModalContentBlockTransition.d.ts +20 -1
  75. package/dist/ui/src/components/Modal/useModalContentBlockTransition.d.ts.map +1 -1
  76. package/dist/ui/src/components/Modal/useModalContentSizeSignal.d.ts +22 -0
  77. package/dist/ui/src/components/Modal/useModalContentSizeSignal.d.ts.map +1 -0
  78. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
  79. package/dist/ui/src/components/Modal/useModalKeyboardAvoidance.d.ts +6 -1
  80. package/dist/ui/src/components/Modal/useModalKeyboardAvoidance.d.ts.map +1 -1
  81. package/dist/ui/src/components/Modal/useModalViewportGeometry.d.ts +1 -0
  82. package/dist/ui/src/components/Modal/useModalViewportGeometry.d.ts.map +1 -1
  83. package/dist/ui/src/components/PositionSnap/policy.d.ts.map +1 -1
  84. package/dist/ui/src/utils/gesture.d.ts +58 -0
  85. package/dist/ui/src/utils/gesture.d.ts.map +1 -0
  86. package/dist/utils/gesture.d.ts +2 -0
  87. package/dist/utils/gesture.js +103 -0
  88. package/docs/api-conventions.md +5 -0
  89. package/docs/gesture.md +64 -0
  90. package/docs/selector-contract.md +41 -10
  91. package/docs/spring.md +4 -0
  92. package/package.json +5 -1
  93. package/dist/components/Modal/useElementSize.js +0 -23
  94. package/dist/ui/src/components/Modal/useElementSize.d.ts.map +0 -1
@@ -1,106 +1,94 @@
1
1
  'use client';
2
- import { jsx as u, jsxs as _e } from "react/jsx-runtime";
3
- import { useRef as A, useState as l, useMemo as Y, useLayoutEffect as Me, useEffect as X, useCallback as v } from "react";
4
- import { Dialog as I } from "@base-ui-components/react/dialog";
5
- import ht from "@orioncactuscorp/icons/orioncactus/CloseThick";
6
- import gt from "../BackgroundIconButton/BackgroundIconButton.js";
7
- import { mergeRefs as De } from "../../utils/mergeRefs.js";
8
- import { useModalContext as Z, ModalProvider as bt } from "./contexts.js";
9
- import { useControllableState as vt } from "./useControllableState.js";
10
- import { useModalContentBlockTransition as yt } from "./useModalContentBlockTransition.js";
11
- import { useMeasuredElement as We } from "./useElementSize.js";
12
- import { useModalDrag as St } from "./useModalDrag.js";
13
- import { useModalKeyboardAvoidance as kt } from "./useModalKeyboardAvoidance.js";
14
- import { useModalPlacement as Mt } from "./useModalPlacement.js";
15
- import { useModalStackDepth as Ct } from "./useModalStackDepth.js";
16
- import { useModalViewportGeometry as Nt } from "./useModalViewportGeometry.js";
17
- import { resolveContentSizedBottomSheetHeight as wt } from "./bottomSheetGeometry.js";
18
- import { getModalScrollState as Ht } from "./modalScrollArbitration.js";
19
- import { resolveModalInitialFocus as xt } from "./initialFocus.js";
20
- import { useModalBodyScrollState as Tt, ModalBodyFrame as Rt, ModalSurfaceFrame as Ft, resolveModalFooterBackground as Bt, ModalFooterFrame as Pt, ModalHeaderFrame as At, ModalNavigationSectionFrame as Dt, mergeModalClassName as Et } from "../internal/ModalPresentation.js";
2
+ import { jsx as d, jsxs as Ge } from "react/jsx-runtime";
3
+ import { useRef as j, useState as m, useMemo as Q, useEffect as L, useCallback as S, useLayoutEffect as De } from "react";
4
+ import { Dialog as V } from "@base-ui-components/react/dialog";
5
+ import ft from "@orioncactuscorp/icons/orioncactus/CloseThick";
6
+ import ht from "../BackgroundIconButton/BackgroundIconButton.js";
7
+ import gt from "../Interaction/Interaction.js";
8
+ import { mergeRefs as Ae } from "../../utils/mergeRefs.js";
9
+ import { useModalContext as le, ModalProvider as bt } from "./contexts.js";
10
+ import { shouldScrollToTopOnHeaderClick as yt } from "./headerTapScroll.js";
11
+ import { createScrollportScroller as St } from "./scrollportScroller.js";
12
+ import { useControllableState as kt } from "./useControllableState.js";
13
+ import { useModalContentBlockTransition as vt } from "./useModalContentBlockTransition.js";
14
+ import { useBottomSheetIntrinsicHeight as Mt } from "./useBottomSheetIntrinsicHeight.js";
15
+ import { getMaxCssTimeMs as Ne } from "./cssTime.js";
16
+ import { useMeasuredElement as Ue } from "./useMeasuredElement.js";
17
+ import { useModalDrag as Nt } from "./useModalDrag.js";
18
+ import { KEYBOARD_INSET_SETTLED_PROPERTY as Ct } from "./useFieldReveal.js";
19
+ import { useModalKeyboardAvoidance as Tt } from "./useModalKeyboardAvoidance.js";
20
+ import { useModalPlacement as Ht } from "./useModalPlacement.js";
21
+ import { useModalStackDepth as wt } from "./useModalStackDepth.js";
22
+ import { useModalViewportGeometry as xt } from "./useModalViewportGeometry.js";
23
+ import { getModalScrollState as Rt } from "./modalScrollArbitration.js";
24
+ import { resolveModalInitialFocus as Bt } from "./initialFocus.js";
25
+ import { useModalBodyScrollState as Ft, ModalBodyFrame as Pt, ModalSurfaceFrame as Dt, resolveModalFooterBackground as At, ModalFooterFrame as Et, ModalHeaderFrame as It, ModalNavigationSectionFrame as jt, mergeModalClassName as Lt } from "../internal/ModalPresentation.js";
21
26
  import { OverlayPortalProvider as Vt } from "../internal/OverlayPortalContext.js";
22
- import { resolveModalSnapMetrics as jt, resolveModalPopupSnapPositions as It } from "./snapPoints.js";
23
- import N from "./Modal.module.scss.js";
24
- const $t = /* @__PURE__ */ new Set([
27
+ import { resolveModalSnapMetrics as $t, resolveModalPopupSnapPositions as Kt } from "./snapPoints.js";
28
+ import y from "./Modal.module.scss.js";
29
+ const Ot = /* @__PURE__ */ new Set([
25
30
  "oc-modal-reject-shake",
26
31
  "oc-modal-reject-shake-replay"
27
- ]), Ne = Et;
28
- function Lt(e) {
32
+ ]), Ce = Lt;
33
+ function _t(e) {
29
34
  if (!e) return;
30
- const t = Object.entries(e).filter(
31
- ([n]) => n.startsWith("--")
35
+ const o = Object.entries(e).filter(
36
+ ([r]) => r.startsWith("--")
32
37
  );
33
- if (t.length !== 0)
34
- return Object.fromEntries(t);
35
- }
36
- function Ot(e) {
37
- const t = e.trim();
38
- if (!t.endsWith("px")) return;
39
- const n = Number.parseFloat(t);
40
- return Number.isFinite(n) && n > 0 ? n : void 0;
41
- }
42
- function Kt(e) {
43
- if (!(!e || typeof window > "u"))
44
- return Ot(window.getComputedStyle(e).maxHeight);
38
+ if (o.length !== 0)
39
+ return Object.fromEntries(o);
45
40
  }
46
41
  function qt({
47
42
  contentTransition: e,
48
- placement: t,
49
- resize: n
43
+ placement: o,
44
+ resize: r
50
45
  }) {
51
- return e !== "auto" || n !== "content" || t === "full" ? "none" : t === "bottom" ? "sheet" : "surface";
46
+ return e !== "auto" || r !== "content" || o === "full" ? "none" : o === "bottom" ? "sheet" : "surface";
52
47
  }
53
- function ze(e, t) {
54
- return e.resolvedBackdrop === t ? e : {
55
- resolvedBackdrop: t,
56
- exiting: t === "hidden" && e.resolvedBackdrop !== "hidden"
48
+ function ze(e, o) {
49
+ return e.resolvedBackdrop === o ? e : {
50
+ resolvedBackdrop: o,
51
+ exiting: o === "hidden" && e.resolvedBackdrop !== "hidden"
57
52
  };
58
53
  }
59
- function _t(e) {
60
- const t = e.trim();
61
- return t.endsWith("ms") ? Number.parseFloat(t) || 0 : t.endsWith("s") ? (Number.parseFloat(t) || 0) * 1e3 : 0;
62
- }
63
- function we(e) {
64
- return e.split(",").reduce((t, n) => Math.max(t, _t(n)), 0);
54
+ function Gt(e) {
55
+ const o = window.getComputedStyle(e), r = Ne(o.animationDuration), a = Ne(o.animationDelay);
56
+ return r + a + 250;
65
57
  }
66
- function Wt(e) {
67
- const t = window.getComputedStyle(e), n = we(t.animationDuration), s = we(t.animationDelay);
68
- return n + s + 250;
69
- }
70
- function zt(e) {
71
- const t = window.getComputedStyle(e), n = we(t.transitionDuration), s = we(t.transitionDelay);
72
- return n + s + 250;
58
+ function Ut(e) {
59
+ const o = window.getComputedStyle(e), r = Ne(o.transitionDuration), a = Ne(o.transitionDelay);
60
+ return r + a + 250;
73
61
  }
74
- function Gt({
62
+ function zt({
75
63
  defaultSnapPosition: e,
76
- node: t,
77
- snapPositions: n
64
+ node: o,
65
+ snapPositions: r
78
66
  }) {
79
- if (!n?.length) return;
80
- const s = It({
67
+ if (!r?.length) return;
68
+ const a = Kt({
81
69
  defaultSnapPosition: e,
82
- snapPositions: n,
83
- surfaceMotion: t
70
+ snapPositions: r,
71
+ surfaceMotion: o
84
72
  });
85
- if (!s) return;
86
- const c = s.defaultTarget;
87
- t.style.setProperty(
73
+ if (!a) return;
74
+ const i = a.defaultTarget;
75
+ o.style.setProperty(
88
76
  "--oc-modal-translate-x",
89
- c.settledTranslate?.x ?? `${c.x}px`
90
- ), t.style.setProperty(
77
+ i.settledTranslate?.x ?? `${i.x}px`
78
+ ), o.style.setProperty(
91
79
  "--oc-modal-translate-y",
92
- c.settledTranslate?.y ?? `${c.y}px`
80
+ i.settledTranslate?.y ?? `${i.y}px`
93
81
  );
94
82
  }
95
- function Ut(e) {
83
+ function Wt(e) {
96
84
  if (e && typeof e == "object" && "reason" in e && typeof e.reason == "string")
97
85
  return e.reason;
98
86
  }
99
- function Ce(e) {
87
+ function Me(e) {
100
88
  e && typeof e == "object" && "cancel" in e && typeof e.cancel == "function" && e.cancel();
101
89
  }
102
- function Jt(e, t) {
103
- switch (t) {
90
+ function Yt(e, o) {
91
+ switch (o) {
104
92
  case "drag-dismiss":
105
93
  return e?.drag ?? "auto";
106
94
  case "backdrop-press":
@@ -117,22 +105,22 @@ function Jt(e, t) {
117
105
  return e?.programmatic ?? "auto";
118
106
  }
119
107
  }
120
- function Qt(e, t) {
121
- return t > 0 && (e === "drag-dismiss" || e === "backdrop-press" || e === "outside-press");
108
+ function Jt(e, o) {
109
+ return o > 0 && (e === "drag-dismiss" || e === "backdrop-press" || e === "outside-press");
122
110
  }
123
- function Ge(e, t) {
124
- return t && (e === "backdrop-press" || e === "outside-press");
111
+ function We(e, o) {
112
+ return o && (e === "backdrop-press" || e === "outside-press");
125
113
  }
126
- function Xt({
114
+ function Qt({
127
115
  backdrop: e,
128
- canSnapPopup: t,
129
- placement: n,
130
- presentationState: s
116
+ canSnapPopup: o,
117
+ placement: r,
118
+ presentationState: a
131
119
  }) {
132
- return e !== "auto" ? e : n === "bottom" && s === "peeked" || t ? "hidden" : "visible";
120
+ return e !== "auto" ? e : r === "bottom" && a === "peeked" || o ? "hidden" : "visible";
133
121
  }
134
- function Yt(e) {
135
- switch (Ut(e)) {
122
+ function Xt(e) {
123
+ switch (Wt(e)) {
136
124
  case "close-press":
137
125
  return "close-button";
138
126
  case "outside-press":
@@ -147,532 +135,539 @@ function Yt(e) {
147
135
  return "programmatic";
148
136
  }
149
137
  }
150
- function Ue({
138
+ function Ye({
151
139
  children: e,
152
- open: t,
153
- defaultOpen: n,
154
- modal: s = !0,
155
- onOpenChange: c,
156
- canCloseAttempt: h,
157
- onCloseAttempt: y,
158
- presentationState: S,
159
- defaultPresentationState: p = "visible",
140
+ open: o,
141
+ defaultOpen: r,
142
+ modal: a = !0,
143
+ onOpenChange: i,
144
+ onOpenChangeComplete: h,
145
+ canCloseAttempt: g,
146
+ onCloseAttempt: f,
147
+ presentationState: p,
148
+ defaultPresentationState: R = "visible",
160
149
  onPresentationStateChange: H,
161
150
  disablePointerDismissal: w,
162
- navigationDepth: B = 0,
163
- dismissBehavior: M
151
+ navigationDepth: N = 0,
152
+ dismissBehavior: b
164
153
  }) {
165
- const k = t !== void 0, [ee, $] = l(
166
- n ?? !1
167
- ), L = k ? t : ee, [te, He] = l("bottom"), [O, xe] = l(!1), [o, oe] = l(!1), [D, ue] = l(!1), [i, me] = l(!1), [pe, ne] = l(0), [W, E] = l(0), [fe, re] = l(null), [he, ge] = l(null), [be, ae] = l({
154
+ const $ = o !== void 0, [A, X] = m(
155
+ r ?? !1
156
+ ), K = $ ? o : A, [O, _] = m("bottom"), [q, t] = m(!1), [x, de] = m(!1), [Z, he] = m(!1), [s, ge] = m(!1), [be, ue] = m(!1), [ee, E] = m(0), [ye, me] = m(0), [Se, Te] = m(null), te = Q(() => St(), []);
157
+ L(() => () => te.destroy(), [te]);
158
+ const [oe, k] = m(null), [v, G] = m({
168
159
  canScroll: !1,
169
160
  scrolledFromTop: !1,
170
161
  scrolledToBottom: !0
171
- }), [f, g] = vt({
172
- value: S,
173
- defaultValue: p,
162
+ }), [B, U] = kt({
163
+ value: p,
164
+ defaultValue: R,
174
165
  onChange: H
175
- }), x = We(), V = We(), se = Math.max(0, B), K = v(
176
- (a, m) => {
177
- k || $(a), c?.(a, m);
166
+ }), z = Ue(), M = Ue(), l = Math.max(0, N), F = S(
167
+ (n, u) => {
168
+ $ || X(n), i?.(n, u);
178
169
  },
179
- [c, k]
180
- ), C = v(
181
- (a = { reason: "programmatic" }) => h?.(a) !== !1,
182
- [h]
183
- ), d = v(
184
- (a = { reason: "programmatic" }) => {
185
- ne((m) => m + 1);
170
+ [i, $]
171
+ ), W = S(
172
+ (n = { reason: "programmatic" }) => g?.(n) !== !1,
173
+ [g]
174
+ ), C = S(
175
+ (n = { reason: "programmatic" }) => {
176
+ E((u) => u + 1);
186
177
  },
187
178
  []
188
- ), q = v(() => {
189
- E((a) => a + 1);
190
- }, []), _ = v(
191
- (a = { reason: "programmatic" }) => {
192
- if (Ge(a.reason, D))
179
+ ), ne = S(() => {
180
+ me((n) => n + 1);
181
+ }, []), Y = S(
182
+ (n = { reason: "programmatic" }) => {
183
+ if (We(n.reason, s))
193
184
  return !1;
194
- const m = Jt(M, a.reason);
195
- return m === "allow" ? !0 : m === "block" ? !1 : !Qt(a.reason, se);
185
+ const u = Yt(b, n.reason);
186
+ return u === "allow" ? !0 : u === "block" ? !1 : !Jt(n.reason, l);
196
187
  },
197
- [D, M, se]
198
- ), P = v(
199
- (a = { reason: "programmatic" }, m = {}) => {
200
- const { commit: ve = !0, skipAttempt: T = !1 } = m;
201
- return !T && Ge(a.reason, D) ? (Ce(a.eventDetails), !1) : !T && !_(a) || !T && !C(a) || !T && y?.(a) === !1 ? (Ce(a.eventDetails), d(a), !1) : (ve && K(!1, a.eventDetails), !0);
188
+ [s, b, l]
189
+ ), P = S(
190
+ (n = { reason: "programmatic" }, u = {}) => {
191
+ const { commit: ae = !0, skipAttempt: ce = !1 } = u;
192
+ return !ce && We(n.reason, s) ? (Me(n.eventDetails), !1) : !ce && !Y(n) || !ce && !W(n) || !ce && f?.(n) === !1 ? (Me(n.eventDetails), C(n), !1) : (ae && F(!1, n.eventDetails), !0);
202
193
  },
203
194
  [
195
+ W,
196
+ s,
197
+ Y,
198
+ F,
204
199
  C,
205
- D,
206
- _,
207
- K,
208
- d,
209
- y
200
+ f
210
201
  ]
211
- ), ce = v(
212
- (a, m) => {
213
- if (a && f === "peeked" && g("visible"), !a) {
202
+ ), I = S(
203
+ (n, u) => {
204
+ if (n && B === "peeked" && U("visible"), !n) {
214
205
  P({
215
- reason: Yt(m),
216
- eventDetails: m
206
+ reason: Xt(u),
207
+ eventDetails: u
217
208
  });
218
209
  return;
219
210
  }
220
- K(a, m);
211
+ F(n, u);
221
212
  },
222
- [K, f, P, g]
223
- ), z = f === "visible" && !i ? s : !1, ie = w || te === "bottom" && (O || i), j = Y(
213
+ [F, B, P, U]
214
+ ), re = B === "visible" && !be ? a : !1, pe = w || O === "bottom" && (q || be), ke = Q(
224
215
  () => ({
225
- open: L,
226
- modal: z,
227
- placement: te,
228
- setPlacement: He,
229
- presentationState: f,
230
- setPresentationState: g,
216
+ open: K,
217
+ modal: re,
218
+ placement: O,
219
+ setPlacement: _,
220
+ presentationState: B,
221
+ setPresentationState: U,
231
222
  requestClose: P,
232
- canDismissByBehavior: _,
233
- canCloseAttempt: C,
234
- closeAttemptFeedbackKey: pe,
235
- notifyCloseAttemptRejected: d,
223
+ canDismissByBehavior: Y,
224
+ canCloseAttempt: W,
225
+ closeAttemptFeedbackKey: ee,
226
+ notifyCloseAttemptRejected: C,
236
227
  disablePointerDismissal: w ?? !1,
237
- setBackdropDismissalDisabled: ue,
238
- setBackgroundInteractive: me,
239
- canPeek: O,
240
- setCanPeek: xe,
241
- canRenderHandle: o,
242
- setCanRenderHandle: oe,
243
- popupSnapLayoutVersion: W,
244
- notifyPopupSnapLayoutChange: q,
245
- headerHeight: x.height,
246
- footerHeight: V.height,
247
- setHeaderNode: x.setNode,
248
- titleNode: he,
249
- setTitleNode: ge,
250
- setFooterNode: V.setNode,
251
- bodyNode: fe,
252
- setBodyNode: re,
253
- scrollState: be,
254
- setScrollState: ae
228
+ setBackdropDismissalDisabled: ge,
229
+ setBackgroundInteractive: ue,
230
+ canPeek: q,
231
+ setCanPeek: t,
232
+ canRenderHandle: x,
233
+ setCanRenderHandle: de,
234
+ handleDraggable: Z,
235
+ setHandleDraggable: he,
236
+ popupSnapLayoutVersion: ye,
237
+ notifyPopupSnapLayoutChange: ne,
238
+ navigationDepth: l,
239
+ headerHeight: z.height,
240
+ footerHeight: M.height,
241
+ setHeaderNode: z.setNode,
242
+ titleNode: oe,
243
+ setTitleNode: k,
244
+ setFooterNode: M.setNode,
245
+ bodyNode: Se,
246
+ setBodyNode: Te,
247
+ bodyScroller: te,
248
+ scrollState: v,
249
+ setScrollState: G
255
250
  }),
256
251
  [
257
- fe,
258
- O,
259
- o,
260
- _,
261
- C,
262
- pe,
263
- V.height,
264
- V.setNode,
265
- x.height,
266
- x.setNode,
267
- z,
268
- d,
252
+ Se,
253
+ te,
269
254
  q,
255
+ x,
256
+ Z,
257
+ Y,
270
258
  W,
271
- L,
272
- te,
259
+ ee,
260
+ M.height,
261
+ M.setNode,
262
+ z.height,
263
+ z.setNode,
264
+ re,
265
+ l,
266
+ C,
267
+ ne,
268
+ ye,
269
+ K,
270
+ O,
273
271
  P,
274
- be,
272
+ v,
275
273
  w,
276
- f,
277
- g,
278
- ge,
279
- he
274
+ B,
275
+ U,
276
+ k,
277
+ oe
280
278
  ]
281
279
  );
282
- return /* @__PURE__ */ u(bt, { value: j, children: /* @__PURE__ */ u(
283
- I.Root,
280
+ return /* @__PURE__ */ d(bt, { value: ke, children: /* @__PURE__ */ d(
281
+ V.Root,
284
282
  {
285
- open: L,
286
- modal: z,
287
- onOpenChange: ce,
288
- disablePointerDismissal: ie,
283
+ open: K,
284
+ modal: re,
285
+ onOpenChange: I,
286
+ onOpenChangeComplete: h,
287
+ disablePointerDismissal: pe,
289
288
  children: e
290
289
  }
291
290
  ) });
292
291
  }
293
292
  function Zt({
294
293
  className: e = "",
295
- children: t,
296
- render: n,
297
- nativeButton: s
294
+ children: o,
295
+ render: r,
296
+ nativeButton: a
298
297
  }) {
299
- return n ? /* @__PURE__ */ u(
300
- I.Trigger,
298
+ return r ? /* @__PURE__ */ d(
299
+ V.Trigger,
301
300
  {
302
- render: n,
303
- nativeButton: s,
301
+ render: r,
302
+ nativeButton: a,
304
303
  "data-oc-component": "modal-trigger",
305
- children: t
304
+ children: o
306
305
  }
307
- ) : /* @__PURE__ */ u(
308
- I.Trigger,
306
+ ) : /* @__PURE__ */ d(
307
+ V.Trigger,
309
308
  {
310
- className: Ne(N.trigger, e),
311
- nativeButton: s,
309
+ className: Ce(y.trigger, e),
310
+ nativeButton: a,
312
311
  "data-oc-component": "modal-trigger",
313
- children: t
312
+ children: o
314
313
  }
315
314
  );
316
315
  }
317
316
  function eo({
318
317
  className: e = "",
319
- children: t,
320
- variant: n = "adaptive",
321
- size: s = "medium",
322
- resize: c = "content",
318
+ children: o,
319
+ variant: r = "adaptive",
320
+ size: a = "medium",
321
+ resize: i = "content",
323
322
  contentTransition: h = "auto",
324
- backdrop: y = "auto",
325
- backdropFrom: S,
323
+ backdrop: g = "auto",
324
+ backdropFrom: f,
326
325
  drag: p = "content",
327
- peekable: H = !1,
328
- snapPoints: w,
329
- defaultSnapPoint: B,
330
- snapPositions: M,
331
- defaultSnapPosition: k,
332
- initialFocus: ee,
333
- peekHeight: $,
334
- closeThreshold: L,
335
- scrollLockTimeout: te,
336
- container: He,
337
- style: O,
338
- ...xe
326
+ peekable: R = !1,
327
+ snapPoints: H,
328
+ defaultSnapPoint: w,
329
+ snapPositions: N,
330
+ defaultSnapPosition: b,
331
+ initialFocus: $,
332
+ peekHeight: A,
333
+ closeThreshold: X,
334
+ scrollLockTimeout: K,
335
+ container: O,
336
+ style: _,
337
+ ...q
339
338
  }) {
340
- const o = Z("ModalContent"), { setCanPeek: oe, setCanRenderHandle: D, setPlacement: ue } = o, i = Mt(n), me = A(null), pe = A(null), ne = A(null), W = A(null), [E, fe] = l(null), [re, he] = l(
339
+ const t = le("ModalContent"), { setCanPeek: x, setCanRenderHandle: de, setHandleDraggable: Z, setPlacement: he } = t, s = Ht(r), ge = j(null), be = j(null), ue = j(null), ee = j(null), [E, ye] = m(null), [me, Se] = m(
341
340
  null
342
- ), [ge, be] = l(null), ae = A(0), f = A(null), g = A(null), x = A(null), [V, se] = l(), K = p === "handle" || p === "content", C = i === "popup" && K && !!M?.length, d = Xt({
343
- backdrop: y,
344
- canSnapPopup: C,
345
- placement: i,
346
- presentationState: o.presentationState
347
- }), [q, _] = l(() => ({
348
- resolvedBackdrop: d,
341
+ ), [Te, te] = m(null), oe = j(0), k = j(null), v = j(null), G = j(null), [B, U] = m(), z = p === "handle" || p === "content", M = s === "popup" && z && !!N?.length, l = Qt({
342
+ backdrop: g,
343
+ canSnapPopup: M,
344
+ placement: s,
345
+ presentationState: t.presentationState
346
+ }), [F, W] = m(() => ({
347
+ resolvedBackdrop: l,
349
348
  exiting: !1
350
- })), P = Y(
351
- () => ze(q, d),
352
- [q, d]
353
- ), ce = P.exiting, z = C && d === "hidden", ie = (i === "bottom" || C) && K, j = i === "bottom" && ie && H, a = j && $ !== void 0 ? $ : o.headerHeight > 0 ? o.headerHeight : void 0, m = i === "bottom" && c !== "fixed", ve = Nt(o.open), T = kt({
354
- bodyNode: o.bodyNode,
355
- enabled: o.open && i === "bottom",
356
- footerHeight: o.footerHeight,
349
+ })), C = Q(
350
+ () => ze(F, l),
351
+ [F, l]
352
+ ), ne = C.exiting, Y = M && l === "hidden", P = (s === "bottom" || M) && z, I = s === "bottom" && P && R, re = I && A !== void 0 ? A : t.headerHeight > 0 ? t.headerHeight : void 0, pe = s === "bottom" && i !== "fixed", ke = xt(t.open), n = Tt({
353
+ bodyNode: t.bodyNode,
354
+ enabled: t.open && s === "bottom",
355
+ footerHeight: t.footerHeight,
356
+ scroller: t.bodyScroller,
357
357
  surfaceNode: E,
358
- viewportGeometry: ve,
359
- viewportNode: ge
360
- }), G = i === "bottom" ? T.viewportGeometry : ve, ye = G?.height ?? 0, Qe = Y(() => {
361
- if (!(!w?.length || ye <= 0))
362
- return jt({
363
- snapPoints: w,
364
- defaultSnapPoint: B,
365
- backdropFrom: S,
366
- viewportHeight: ye
358
+ viewportGeometry: ke,
359
+ viewportNode: Te
360
+ }), u = s === "bottom" ? n.viewportGeometry : ke, ae = u?.height ?? 0, ce = Q(() => {
361
+ if (!(!H?.length || ae <= 0))
362
+ return $t({
363
+ snapPoints: H,
364
+ defaultSnapPoint: w,
365
+ backdropFrom: f,
366
+ viewportHeight: ae
367
367
  });
368
- }, [S, B, w, ye]), R = i === "bottom" ? Qe : void 0, Xe = Ct(o.open), [Se, Ye] = l(0), ke = A(!1), Ze = R !== void 0 && m, Te = m && Se > 0 ? Se : void 0, U = R ? Ze && Te !== void 0 ? Te : R.sheetHeight : Te, et = R && U !== void 0 ? Math.max(0, U - R.defaultHeight) : void 0, tt = U !== void 0, Re = qt({
368
+ }, [f, w, H, ae]), D = s === "bottom" ? ce : void 0, Qe = wt(t.open), Xe = t.bodyNode, { intrinsicSheetHeight: Ee, shouldDeferSettle: Ze } = Mt({
369
+ enabled: pe,
370
+ bodyNode: Xe,
371
+ surfaceMotionNode: E,
372
+ snapSheetHeight: D?.sheetHeight,
373
+ viewportHeight: ae,
374
+ discreteKey: t.navigationDepth,
375
+ // The sheet shell is frozen for the whole keyboard session, like the
376
+ // viewport height: the keyboard moves the internal scroll inset only.
377
+ frozen: n.shellHeld
378
+ }), et = D !== void 0 && pe, He = pe && Ee > 0 ? Ee : void 0, se = D ? et && He !== void 0 ? He : D.sheetHeight : He, tt = D && se !== void 0 ? Math.max(0, se - D.defaultHeight) : void 0, ot = se !== void 0, we = qt({
369
379
  contentTransition: h,
370
- placement: i,
371
- resize: c
372
- }), ot = Re === "surface" ? "auto" : "none", nt = Re === "sheet" ? "auto" : "none", Ee = o.bodyNode;
373
- yt({
374
- enabled: o.open && Re === "surface",
375
- node: re
376
- }), Me(() => {
377
- if (!m) {
378
- ke.current = !1;
379
- return;
380
- }
381
- const r = Ee?.firstElementChild;
382
- if (!r) {
383
- ke.current = !1;
384
- return;
385
- }
386
- const b = () => {
387
- const Q = r.getBoundingClientRect().height, le = wt({
388
- contentHeight: Q,
389
- maxHeight: Kt(E),
390
- snapHeight: R?.sheetHeight
391
- }), qe = Math.abs(Se - le) > 0.5;
392
- ke.current = qe, qe && Ye(le);
393
- };
394
- if (b(), typeof ResizeObserver > "u") return;
395
- const F = new ResizeObserver(b);
396
- return F.observe(r), () => F.disconnect();
397
- }, [
398
- Ee,
399
- m,
400
- R?.sheetHeight,
401
- Se,
402
- ye,
403
- E
404
- ]), X(() => {
405
- ue(i);
406
- }, [i, ue]), X(() => {
407
- o.open || (W.current = null);
408
- }, [o.open]), X(() => (oe(j), () => oe(!1)), [j, oe]), X(() => (D(ie), () => D(!1)), [ie, D]);
409
- const rt = v(
410
- () => ke.current,
411
- []
412
- ), Ve = o.bodyNode, je = o.setScrollState, at = v(() => {
413
- je(Ht(Ve));
414
- }, [Ve, je]), Ie = R?.backdropFromHeight, [$e, Le] = l(!1), st = v((r) => {
415
- Le(!r);
380
+ placement: s,
381
+ resize: i
382
+ }), nt = we === "surface" ? "auto" : "none", rt = we === "sheet" ? "auto" : "none";
383
+ L(() => {
384
+ he(s);
385
+ }, [s, he]), L(() => {
386
+ t.open || (ee.current = null);
387
+ }, [t.open]), L(() => (x(I), () => x(!1)), [I, x]), L(() => (de(P), () => de(!1)), [P, de]);
388
+ const Ie = P;
389
+ L(() => (Z(Ie), () => Z(!1)), [Ie, Z]);
390
+ const xe = t.bodyNode, je = t.setScrollState, Le = S(() => {
391
+ je(Rt(xe));
392
+ }, [xe, je]);
393
+ vt({
394
+ enabled: t.open && we === "surface",
395
+ node: me,
396
+ resizeHost: E,
397
+ bodyNode: xe,
398
+ // Depth navigation is the explicit discrete-swap signal: the view swap
399
+ // and the depth change land in one commit, so the surface pins its
400
+ // previous height before that frame paints.
401
+ discreteKey: t.navigationDepth,
402
+ refreshScrollState: Le
403
+ });
404
+ const Ve = D?.backdropFromHeight, [$e, Ke] = m(!1), at = S((c) => {
405
+ Ke(!c);
416
406
  }, []);
417
- !o.open && $e && Le(!1);
418
- const Fe = Ie !== void 0 && $e, { collapseBottomSheetToUndimmedSnap: Be, handlers: ct } = St({
419
- enabled: p !== !1 && !T.active,
407
+ !t.open && $e && Ke(!1);
408
+ const Re = Ve !== void 0 && $e, { collapseBottomSheetToUndimmedSnap: Be, handlers: ct } = Nt({
409
+ enabled: p !== !1 && !n.active,
420
410
  drag: p,
421
- open: o.open,
422
- placement: i,
423
- surfaceMotionRef: me,
411
+ open: t.open,
412
+ placement: s,
413
+ surfaceMotionRef: ge,
424
414
  surfaceMotionNode: E,
425
- backdropRef: ne,
426
- bodyNode: o.bodyNode,
427
- snapHeights: R?.snapHeights,
428
- sheetHeight: U,
429
- backdropFromHeight: Ie,
430
- onBackdropDimRestChange: st,
431
- peekHeight: j ? $ : void 0,
432
- peekFallback: j ? "header" : void 0,
433
- presentationState: o.presentationState,
434
- setPresentationState: o.setPresentationState,
435
- requestClose: o.requestClose,
436
- canCloseAttempt: o.canCloseAttempt,
437
- dismissible: !o.disablePointerDismissal && o.canDismissByBehavior({ reason: "drag-dismiss" }),
438
- backdropHidden: d === "hidden",
439
- visibleTranslate: et,
440
- shouldDeferBottomSettle: rt,
441
- refreshScrollState: at,
442
- snapPositions: C ? M : void 0,
443
- defaultSnapPosition: k,
444
- closeThreshold: L,
445
- scrollLockTimeout: te,
446
- popupSnapLayoutVersion: o.popupSnapLayoutVersion
447
- }), it = v(
448
- (r) => {
449
- me.current = r, fe(r), r && o.open && C && W.current !== r && (Gt({
450
- defaultSnapPosition: k,
451
- node: r,
452
- snapPositions: M
453
- }), W.current = r);
415
+ backdropRef: ue,
416
+ bodyNode: t.bodyNode,
417
+ snapHeights: D?.snapHeights,
418
+ sheetHeight: se,
419
+ backdropFromHeight: Ve,
420
+ onBackdropDimRestChange: at,
421
+ peekHeight: I ? A : void 0,
422
+ peekFallback: I ? "header" : void 0,
423
+ presentationState: t.presentationState,
424
+ setPresentationState: t.setPresentationState,
425
+ requestClose: t.requestClose,
426
+ canCloseAttempt: t.canCloseAttempt,
427
+ dismissible: !t.disablePointerDismissal && t.canDismissByBehavior({ reason: "drag-dismiss" }),
428
+ backdropHidden: l === "hidden",
429
+ visibleTranslate: tt,
430
+ shouldDeferBottomSettle: Ze,
431
+ refreshScrollState: Le,
432
+ snapPositions: M ? N : void 0,
433
+ defaultSnapPosition: b,
434
+ closeThreshold: X,
435
+ scrollLockTimeout: K,
436
+ popupSnapLayoutVersion: t.popupSnapLayoutVersion
437
+ }), st = S(
438
+ (c) => {
439
+ ge.current = c, ye(c), c && t.open && M && ee.current !== c && (zt({
440
+ defaultSnapPosition: b,
441
+ node: c,
442
+ snapPositions: N
443
+ }), ee.current = c);
454
444
  },
455
- [C, o.open, k, M]
456
- ), dt = v((r) => {
457
- pe.current = r, he(r);
445
+ [M, t.open, b, N]
446
+ ), it = S((c) => {
447
+ be.current = c, Se(c);
458
448
  }, []);
459
- X(() => {
460
- const r = o.closeAttemptFeedbackKey, b = () => {
461
- se(void 0), g.current = null;
449
+ L(() => {
450
+ const c = t.closeAttemptFeedbackKey, T = () => {
451
+ U(void 0), v.current = null;
462
452
  };
463
- if (r === 0) {
464
- ae.current = r, b();
453
+ if (c === 0) {
454
+ oe.current = c, T();
465
455
  return;
466
456
  }
467
- if (i !== "popup") {
468
- b();
457
+ if (s !== "popup") {
458
+ T();
469
459
  return;
470
460
  }
471
- if (ae.current === r) {
472
- b();
461
+ if (oe.current === c) {
462
+ T();
473
463
  return;
474
464
  }
475
- const F = re;
476
- if (!F) return;
477
- ae.current = r, f.current !== null && window.cancelAnimationFrame(f.current), g.current !== null && window.clearTimeout(g.current), b();
478
- const Q = (le) => {
479
- le.target === F && $t.has(le.animationName) && (F.removeEventListener("animationend", Q), g.current !== null && window.clearTimeout(g.current), b());
465
+ const J = me;
466
+ if (!J) return;
467
+ oe.current = c, k.current !== null && window.cancelAnimationFrame(k.current), v.current !== null && window.clearTimeout(v.current), T();
468
+ const ve = (qe) => {
469
+ qe.target === J && Ot.has(qe.animationName) && (J.removeEventListener("animationend", ve), v.current !== null && window.clearTimeout(v.current), T());
480
470
  };
481
- return F.addEventListener("animationend", Q), f.current = window.requestAnimationFrame(() => {
482
- f.current = null, se(r), f.current = window.requestAnimationFrame(() => {
483
- f.current = null, g.current = window.setTimeout(() => {
484
- F.removeEventListener("animationend", Q), b();
485
- }, Wt(F));
471
+ return J.addEventListener("animationend", ve), k.current = window.requestAnimationFrame(() => {
472
+ k.current = null, U(c), k.current = window.requestAnimationFrame(() => {
473
+ k.current = null, v.current = window.setTimeout(() => {
474
+ J.removeEventListener("animationend", ve), T();
475
+ }, Gt(J));
486
476
  });
487
477
  }), () => {
488
- F.removeEventListener("animationend", Q), f.current !== null && (window.cancelAnimationFrame(f.current), f.current = null), g.current !== null && (window.clearTimeout(g.current), g.current = null);
478
+ J.removeEventListener("animationend", ve), k.current !== null && (window.cancelAnimationFrame(k.current), k.current = null), v.current !== null && (window.clearTimeout(v.current), v.current = null);
489
479
  };
490
- }, [o.closeAttemptFeedbackKey, i, re]);
491
- const Oe = Lt(O), lt = {
480
+ }, [t.closeAttemptFeedbackKey, s, me]);
481
+ const Oe = _t(_), lt = {
492
482
  ...Oe,
493
- ...o.headerHeight > 0 ? { "--oc-modal-header-height": `${o.headerHeight}px` } : {},
494
- ...o.footerHeight > 0 ? { "--oc-modal-footer-height": `${o.footerHeight}px` } : {},
495
- ...a !== void 0 ? { "--oc-modal-peek-height": `${a}px` } : {},
496
- ...U !== void 0 ? { "--oc-modal-sheet-height": `${U}px` } : {}
483
+ ...t.headerHeight > 0 ? { "--oc-modal-header-height": `${t.headerHeight}px` } : {},
484
+ // The measured footer height feeds keyboard avoidance, which hands it
485
+ // back held through a keyboard session; as a CSS reserve it only reaches
486
+ // the body when no footer is mounted (the `.surface:has(> .footer)` calc
487
+ // wins otherwise), so it must drop back to 0 on unmount.
488
+ ...n.footerHeight > 0 ? { "--oc-modal-footer-height": `${n.footerHeight}px` } : {},
489
+ ...re !== void 0 ? { "--oc-modal-peek-height": `${re}px` } : {},
490
+ ...se !== void 0 ? { "--oc-modal-sheet-height": `${se}px` } : {}
497
491
  // `--oc-modal-translate-y` and the inline `height` are owned imperatively
498
492
  // by the drag hook: content-size transitions pin the surface to a canvas
499
493
  // height and compensate the translate in the same frame. Rendering the
500
494
  // height here would commit the new size before that compensation runs and
501
495
  // make the sheet jump a frame early. The managed sizing CSS rule renders
502
496
  // the resting height from `--oc-modal-sheet-height`.
503
- }, Ke = {
497
+ }, _e = {
504
498
  // Each modal reserves one backdrop slot and one viewport slot.
505
- "--oc-modal-stack-offset": Xe * 2
506
- }, ut = {
507
- ...Ke,
508
- "--_-modal-keyboard-inset": `${T.keyboardInset}px`,
509
- "--_-modal-keyboard-inset-settled": `${T.settledKeyboardInset}px`,
510
- ...G ? {
511
- "--_-modal-viewport-height": `${G.height}px`,
512
- "--_-modal-viewport-offset-left": `${G.offsetLeft}px`,
513
- "--_-modal-viewport-offset-top": `${G.offsetTop}px`,
514
- "--_-modal-viewport-width": `${G.width}px`
499
+ "--oc-modal-stack-offset": Qe * 2
500
+ }, dt = {
501
+ ..._e,
502
+ "--_-modal-keyboard-inset": `${n.keyboardInset}px`,
503
+ [Ct]: `${n.settledKeyboardInset}px`,
504
+ ...u ? {
505
+ "--_-modal-viewport-height": `${u.height}px`,
506
+ "--_-modal-viewport-offset-left": `${u.offsetLeft}px`,
507
+ "--_-modal-viewport-offset-top": `${u.offsetTop}px`,
508
+ "--_-modal-viewport-width": `${u.width}px`
515
509
  } : {}
516
- }, mt = o.headerHeight > 0 ? {
517
- ...O,
518
- "--oc-modal-header-height": `${o.headerHeight}px`
519
- } : O, pt = xt({
510
+ }, ut = t.headerHeight > 0 ? {
511
+ ..._,
512
+ "--oc-modal-header-height": `${t.headerHeight}px`
513
+ } : _, mt = Bt({
520
514
  contentNode: E,
521
- initialFocus: ee,
522
- modal: o.modal,
523
- titleNode: o.titleNode
524
- }), { setBackdropDismissalDisabled: Pe, setBackgroundInteractive: Ae } = o, ft = d !== "hidden" || ce;
525
- Me(() => {
526
- P !== q && _(P);
527
- }, [q, P]);
528
- const J = v(() => {
529
- x.current !== null && (window.clearTimeout(x.current), x.current = null);
530
- }, []), de = v(() => {
531
- d === "hidden" && (J(), _((r) => {
532
- const b = ze(
533
- r,
534
- d
515
+ initialFocus: $,
516
+ modal: t.modal,
517
+ titleNode: t.titleNode
518
+ }), { setBackdropDismissalDisabled: Fe, setBackgroundInteractive: Pe } = t, pt = l !== "hidden" || ne;
519
+ De(() => {
520
+ C !== F && W(C);
521
+ }, [F, C]);
522
+ const ie = S(() => {
523
+ G.current !== null && (window.clearTimeout(G.current), G.current = null);
524
+ }, []), fe = S(() => {
525
+ l === "hidden" && (ie(), W((c) => {
526
+ const T = ze(
527
+ c,
528
+ l
535
529
  );
536
- return b.resolvedBackdrop !== "hidden" || !b.exiting ? b : {
537
- ...b,
530
+ return T.resolvedBackdrop !== "hidden" || !T.exiting ? T : {
531
+ ...T,
538
532
  exiting: !1
539
533
  };
540
534
  }));
541
- }, [J, d]);
542
- return X(
535
+ }, [ie, l]);
536
+ return L(
543
537
  () => () => {
544
- J();
538
+ ie();
545
539
  },
546
- [J]
547
- ), Me(() => {
548
- if (!ce || d !== "hidden") return;
549
- const r = ne.current;
550
- if (!r) {
551
- x.current = window.setTimeout(de, 0);
540
+ [ie]
541
+ ), De(() => {
542
+ if (!ne || l !== "hidden") return;
543
+ const c = ue.current;
544
+ if (!c) {
545
+ G.current = window.setTimeout(fe, 0);
552
546
  return;
553
547
  }
554
- J(), x.current = window.setTimeout(
555
- de,
556
- zt(r)
548
+ ie(), G.current = window.setTimeout(
549
+ fe,
550
+ Ut(c)
557
551
  );
558
552
  }, [
559
- J,
560
- de,
561
- ce,
562
- d
563
- ]), Me(() => (Pe(d === "hidden"), Ae(z || Fe), () => {
564
- Pe(!1), Ae(!1);
553
+ ie,
554
+ fe,
555
+ ne,
556
+ l
557
+ ]), De(() => (Fe(l === "hidden"), Pe(Y || Re), () => {
558
+ Fe(!1), Pe(!1);
565
559
  }), [
560
+ Re,
561
+ Y,
562
+ l,
566
563
  Fe,
567
- z,
568
- d,
569
- Pe,
570
- Ae
571
- ]), /* @__PURE__ */ _e(I.Portal, { container: He, children: [
572
- ft ? /* @__PURE__ */ u(
573
- I.Backdrop,
564
+ Pe
565
+ ]), /* @__PURE__ */ Ge(V.Portal, { container: O, children: [
566
+ pt ? /* @__PURE__ */ d(
567
+ V.Backdrop,
574
568
  {
575
- ref: ne,
576
- className: N.backdrop,
569
+ ref: ue,
570
+ className: y.backdrop,
577
571
  "data-oc-part": "backdrop",
578
572
  "data-oc-component": "modal-backdrop",
579
- "data-oc-modal-backdrop": d,
580
- "data-oc-modal-backdrop-passthrough": Fe ? "true" : void 0,
581
- "data-oc-modal-placement": i,
582
- "data-oc-modal-presentation-state": o.presentationState,
583
- style: Ke,
584
- onTransitionCancel: (r) => {
585
- r.currentTarget === r.target && r.propertyName === "opacity" && de();
573
+ "data-oc-modal-backdrop": l,
574
+ "data-oc-modal-backdrop-passthrough": Re ? "true" : void 0,
575
+ "data-oc-modal-placement": s,
576
+ "data-oc-modal-presentation-state": t.presentationState,
577
+ style: _e,
578
+ onTransitionCancel: (c) => {
579
+ c.currentTarget === c.target && c.propertyName === "opacity" && fe();
586
580
  },
587
- onTransitionEnd: (r) => {
588
- r.currentTarget === r.target && r.propertyName === "opacity" && de();
581
+ onTransitionEnd: (c) => {
582
+ c.currentTarget === c.target && c.propertyName === "opacity" && fe();
589
583
  },
590
584
  onClick: () => {
591
- if (o.disablePointerDismissal) {
585
+ if (t.disablePointerDismissal) {
592
586
  if (Be()) return;
593
- o.notifyCloseAttemptRejected({ reason: "backdrop-press" });
587
+ t.notifyCloseAttemptRejected({ reason: "backdrop-press" });
594
588
  return;
595
589
  }
596
- if (!o.canDismissByBehavior({ reason: "backdrop-press" })) {
590
+ if (!t.canDismissByBehavior({ reason: "backdrop-press" })) {
597
591
  if (Be()) return;
598
- o.notifyCloseAttemptRejected({ reason: "backdrop-press" });
592
+ t.notifyCloseAttemptRejected({ reason: "backdrop-press" });
599
593
  return;
600
594
  }
601
- if (i === "bottom" && j) {
602
- if (o.presentationState === "visible") {
595
+ if (s === "bottom" && I) {
596
+ if (t.presentationState === "visible") {
603
597
  if (Be()) return;
604
- o.setPresentationState("peeked");
598
+ t.setPresentationState("peeked");
605
599
  }
606
600
  return;
607
601
  }
608
- o.requestClose({ reason: "backdrop-press" });
602
+ t.requestClose({ reason: "backdrop-press" });
609
603
  }
610
604
  }
611
605
  ) : null,
612
- /* @__PURE__ */ u(
613
- I.Viewport,
606
+ /* @__PURE__ */ d(
607
+ V.Viewport,
614
608
  {
615
- ref: be,
616
- className: N.viewport,
609
+ ref: te,
610
+ className: y.viewport,
617
611
  "data-oc-part": "viewport",
618
612
  "data-oc-component": "modal-viewport",
619
- "data-oc-modal-placement": i,
620
- "data-oc-modal-keyboard-avoiding": T.active ? "true" : void 0,
621
- style: ut,
622
- children: /* @__PURE__ */ u(
623
- I.Popup,
613
+ "data-oc-modal-placement": s,
614
+ "data-oc-modal-keyboard-avoiding": n.active ? "true" : void 0,
615
+ "data-oc-modal-keyboard-closing": n.closing ? "true" : void 0,
616
+ style: dt,
617
+ children: /* @__PURE__ */ d(
618
+ V.Popup,
624
619
  {
625
- ...xe,
620
+ ...q,
626
621
  ...ct,
627
- ref: it,
628
- initialFocus: pt,
629
- className: Ne(
630
- N.surfaceMotion,
631
- N[s],
622
+ ref: st,
623
+ initialFocus: mt,
624
+ className: Ce(
625
+ y.surfaceMotion,
626
+ y[a],
632
627
  e,
633
- V === void 0 ? void 0 : V % 2 === 0 ? N.feedbackEven : N.feedbackOdd
628
+ B === void 0 ? void 0 : B % 2 === 0 ? y.feedbackEven : y.feedbackOdd
634
629
  ),
635
630
  "data-oc-part": "surface-motion",
636
631
  "data-oc-component": "modal-content",
637
- "data-oc-modal-backdrop": d,
638
- "data-oc-variant": n,
639
- "data-oc-size": s,
640
- "data-oc-resize": c,
641
- "data-oc-modal-feedback": i === "popup" && V !== void 0 ? "reject" : void 0,
642
- "data-oc-modal-placement": i,
643
- "data-oc-modal-snapping": R || C ? "true" : void 0,
644
- "data-oc-modal-sheet-sizing": tt ? "managed" : void 0,
645
- "data-oc-modal-sheet-transition": nt === "auto" ? "auto" : void 0,
632
+ "data-oc-modal-backdrop": l,
633
+ "data-oc-variant": r,
634
+ "data-oc-size": a,
635
+ "data-oc-resize": i,
636
+ "data-oc-modal-feedback": s === "popup" && B !== void 0 ? "reject" : void 0,
637
+ "data-oc-modal-placement": s,
638
+ "data-oc-modal-snapping": D || M ? "true" : void 0,
639
+ "data-oc-modal-sheet-sizing": ot ? "managed" : void 0,
640
+ "data-oc-modal-sheet-transition": rt === "auto" ? "auto" : void 0,
646
641
  style: lt,
647
- children: /* @__PURE__ */ _e(Vt, { container: E, children: [
648
- i === "bottom" ? /* @__PURE__ */ u(
642
+ children: /* @__PURE__ */ Ge(Vt, { container: E, children: [
643
+ s === "bottom" ? /* @__PURE__ */ d(
649
644
  "div",
650
645
  {
651
646
  "aria-hidden": "true",
652
- className: Ne(
653
- N.bottomFill,
654
- N[s],
647
+ className: Ce(
648
+ y.bottomFill,
649
+ y[a],
655
650
  e
656
651
  ),
657
652
  "data-oc-part": "bottom-fill",
658
653
  "data-oc-component": "modal-bottom-fill",
659
- "data-oc-size": s,
654
+ "data-oc-size": a,
660
655
  style: Oe
661
656
  }
662
657
  ) : null,
663
- /* @__PURE__ */ u(
664
- Ft,
658
+ /* @__PURE__ */ d(
659
+ Dt,
665
660
  {
666
- ref: dt,
661
+ ref: it,
667
662
  className: e,
668
- contentTransition: ot === "auto" ? "auto" : void 0,
669
- placement: i,
670
- resize: c,
671
- scrollable: o.scrollState.canScroll,
672
- size: s,
673
- style: mt,
674
- variant: n,
675
- children: t
663
+ contentTransition: nt === "auto" ? "auto" : void 0,
664
+ placement: s,
665
+ resize: i,
666
+ scrollable: t.scrollState.canScroll,
667
+ size: a,
668
+ style: ut,
669
+ variant: r,
670
+ children: o
676
671
  }
677
672
  )
678
673
  ] })
@@ -684,161 +679,185 @@ function eo({
684
679
  }
685
680
  function to({
686
681
  className: e = "",
687
- title: t,
688
- children: n,
689
- leadingContent: s,
690
- trailingContent: c,
682
+ title: o,
683
+ children: r,
684
+ leadingContent: a,
685
+ trailingContent: i,
691
686
  bottomContent: h,
692
- closeLabel: y = "닫기",
693
- closeButton: S = !0,
687
+ closeLabel: g = "닫기",
688
+ closeButton: f = !0,
694
689
  handle: p = !0,
690
+ onClick: R,
695
691
  ref: H,
696
692
  ...w
697
693
  }) {
698
- const B = Z("ModalHeader"), { setHeaderNode: M, setTitleNode: k, scrollState: ee } = B, $ = Y(
699
- () => De(M, H),
700
- [H, M]
701
- ), L = Y(
702
- () => De(k),
703
- [k]
694
+ const N = le("ModalHeader"), {
695
+ bodyNode: b,
696
+ bodyScroller: $,
697
+ setHeaderNode: A,
698
+ setTitleNode: X,
699
+ scrollState: K,
700
+ handleDraggable: O
701
+ } = N, _ = (x) => {
702
+ R?.(x), !(x.defaultPrevented || !b || !yt({
703
+ scrollTop: b.scrollTop,
704
+ target: x.target
705
+ })) && $.scrollTo(b, 0);
706
+ }, q = Q(
707
+ () => Ae(A, H),
708
+ [H, A]
709
+ ), t = Q(
710
+ () => Ae(X),
711
+ [X]
704
712
  );
705
- return /* @__PURE__ */ u(
706
- At,
713
+ return /* @__PURE__ */ d(
714
+ It,
707
715
  {
708
716
  ...w,
709
- ref: $,
717
+ ref: q,
718
+ onClick: _,
710
719
  bottomSlot: h,
711
720
  className: e,
712
- closeContent: S ? /* @__PURE__ */ u(Je, { label: y }) : null,
713
- handleContent: p && B.canRenderHandle ? /* @__PURE__ */ u(
721
+ closeContent: f ? /* @__PURE__ */ d(Je, { label: g }) : null,
722
+ handleContent: p && N.canRenderHandle ? /* @__PURE__ */ d(
714
723
  "div",
715
724
  {
716
725
  "aria-hidden": "true",
717
- className: N.handle,
718
- "data-oc-part": "handle"
726
+ className: y.handleArea,
727
+ "data-oc-part": "handle-area",
728
+ "data-oc-draggable": O ? "true" : "false",
729
+ children: /* @__PURE__ */ d(
730
+ "div",
731
+ {
732
+ "aria-hidden": "true",
733
+ className: y.handle,
734
+ "data-oc-part": "handle",
735
+ children: /* @__PURE__ */ d(gt, { variant: "light" })
736
+ }
737
+ )
719
738
  }
720
739
  ) : null,
721
- leadingContent: s,
722
- sticky: ee.scrolledFromTop,
723
- titleContent: t ? /* @__PURE__ */ u(
724
- I.Title,
740
+ leadingContent: a,
741
+ sticky: K.scrolledFromTop,
742
+ titleContent: o ? /* @__PURE__ */ d(
743
+ V.Title,
725
744
  {
726
- ref: L,
727
- className: N.initialFocusTitle,
745
+ ref: t,
746
+ className: y.initialFocusTitle,
728
747
  tabIndex: -1,
729
- children: t
748
+ children: o
730
749
  }
731
750
  ) : void 0,
732
- trailingContent: c,
733
- children: n
751
+ trailingContent: i,
752
+ children: r
734
753
  }
735
754
  );
736
755
  }
737
756
  function oo({
738
757
  handle: e = !0,
739
- ...t
758
+ ...o
740
759
  }) {
741
- const n = Z("ModalNavigationSection"), {
742
- canRenderHandle: s,
743
- notifyPopupSnapLayoutChange: c,
760
+ const r = le("ModalNavigationSection"), {
761
+ canRenderHandle: a,
762
+ notifyPopupSnapLayoutChange: i,
744
763
  placement: h
745
- } = n;
746
- return /* @__PURE__ */ u(
747
- Dt,
764
+ } = r;
765
+ return /* @__PURE__ */ d(
766
+ jt,
748
767
  {
749
- ...t,
750
- canRenderHandle: e && s,
768
+ ...o,
769
+ canRenderHandle: e && a,
751
770
  onPanelMotionStateChange: () => {
752
- h === "popup" && c();
771
+ h === "popup" && i();
753
772
  }
754
773
  }
755
774
  );
756
775
  }
757
776
  function no({
758
777
  className: e = "",
759
- children: t,
760
- layout: n = "content",
761
- containerClassName: s = "",
762
- containerProps: c,
778
+ children: o,
779
+ layout: r = "content",
780
+ containerClassName: a = "",
781
+ containerProps: i,
763
782
  ref: h,
764
- ...y
783
+ ...g
765
784
  }) {
766
- const S = Z("ModalBody"), { bodyNode: p, setBodyNode: H, setScrollState: w } = S, { setBodyRef: B, updateScrollState: M } = Tt({
785
+ const f = le("ModalBody"), { bodyNode: p, setBodyNode: R, setScrollState: H } = f, { setBodyRef: w, updateScrollState: N } = Ft({
767
786
  bodyNode: p,
768
787
  bodyRef: h,
769
- setBodyNode: H,
770
- setScrollState: w
788
+ setBodyNode: R,
789
+ setScrollState: H
771
790
  });
772
- return /* @__PURE__ */ u(
773
- Rt,
791
+ return /* @__PURE__ */ d(
792
+ Pt,
774
793
  {
775
794
  bodyContainerProps: {
776
- ref: B,
777
- onScroll: (k) => {
778
- c?.onScroll?.(k), M(k.currentTarget);
795
+ ref: w,
796
+ onScroll: (b) => {
797
+ i?.onScroll?.(b), N(b.currentTarget);
779
798
  }
780
799
  },
781
- bodyContentProps: { ...c, className: s },
782
- layout: n,
783
- scrollAreaProps: { ...y, className: e },
784
- children: t
800
+ bodyContentProps: { ...i, className: a },
801
+ layout: r,
802
+ scrollAreaProps: { ...g, className: e },
803
+ children: o
785
804
  }
786
805
  );
787
806
  }
788
807
  function ro({
789
808
  className: e = "",
790
- children: t,
791
- background: n = "auto",
792
- ref: s,
793
- ...c
809
+ children: o,
810
+ background: r = "auto",
811
+ ref: a,
812
+ ...i
794
813
  }) {
795
- const h = Z("ModalFooter"), { scrollState: y, setFooterNode: S } = h, p = Y(
796
- () => De(S, s),
797
- [s, S]
798
- ), H = Bt(
799
- n,
800
- y
814
+ const h = le("ModalFooter"), { scrollState: g, setFooterNode: f } = h, p = Q(
815
+ () => Ae(f, a),
816
+ [a, f]
817
+ ), R = At(
818
+ r,
819
+ g
801
820
  );
802
- return /* @__PURE__ */ u(
803
- Pt,
821
+ return /* @__PURE__ */ d(
822
+ Et,
804
823
  {
805
- ...c,
824
+ ...i,
806
825
  ref: p,
807
- backgroundActive: H,
826
+ backgroundActive: R,
808
827
  className: e,
809
- children: t
828
+ children: o
810
829
  }
811
830
  );
812
831
  }
813
832
  function Je({
814
833
  className: e = "",
815
- children: t = /* @__PURE__ */ u(ht, {}),
816
- label: n = "닫기",
817
- size: s = 24,
818
- disabled: c,
834
+ children: o = /* @__PURE__ */ d(ft, {}),
835
+ label: r = "닫기",
836
+ size: a = 24,
837
+ disabled: i,
819
838
  onClick: h,
820
- ...y
839
+ ...g
821
840
  }) {
822
- const S = Z("ModalClose");
823
- return /* @__PURE__ */ u(
824
- gt,
841
+ const f = le("ModalClose");
842
+ return /* @__PURE__ */ d(
843
+ ht,
825
844
  {
826
- ...y,
827
- className: Ne(N.close, e),
828
- "aria-label": y["aria-label"] ?? n,
845
+ ...g,
846
+ className: Ce(y.close, e),
847
+ "aria-label": g["aria-label"] ?? r,
829
848
  "data-oc-part": "close",
830
849
  "data-oc-component": "modal-close",
831
- disabled: c,
850
+ disabled: i,
832
851
  onClick: (p) => {
833
- h?.(p), !p.defaultPrevented && !c && S.requestClose({ reason: "close-button" });
852
+ h?.(p), !p.defaultPrevented && !i && f.requestClose({ reason: "close-button" });
834
853
  },
835
- size: s,
836
- children: t
854
+ size: a,
855
+ children: o
837
856
  }
838
857
  );
839
858
  }
840
- const To = Object.assign(Ue, {
841
- Root: Ue,
859
+ const Do = Object.assign(Ye, {
860
+ Root: Ye,
842
861
  Trigger: Zt,
843
862
  Content: eo,
844
863
  Header: to,
@@ -854,7 +873,7 @@ export {
854
873
  ro as ModalFooter,
855
874
  to as ModalHeader,
856
875
  oo as ModalNavigationSection,
857
- Ue as ModalRoot,
876
+ Ye as ModalRoot,
858
877
  Zt as ModalTrigger,
859
- To as default
878
+ Do as default
860
879
  };