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