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