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