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