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