@orioncactuscorp/ui 1.4.1 → 1.5.1

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,57 +1,57 @@
1
1
  'use client';
2
2
  import { jsx as d, jsxs as X } from "react/jsx-runtime";
3
- import { useCallback as F, useEffect as O, useRef as E, useState as H, useMemo as he } from "react";
4
- import { Dialog as B } from "@base-ui-components/react/dialog";
5
- import ge from "@orioncactuscorp/icons/orioncactus/CloseThick";
6
- import ke from "../Background/Background.js";
7
- import ve from "../BackgroundIconButton/BackgroundIconButton.js";
8
- import { ScrollArea as ye, ScrollAreaContainer as Ce } from "../ScrollArea/ScrollArea.js";
9
- import { useModalContext as Y, ModalProvider as Se } from "./contexts.js";
10
- import { useControllableState as Me } from "./useControllableState.js";
11
- import { useMeasuredElement as ue } from "./useElementSize.js";
12
- import { useModalDrag as Ne } from "./useModalDrag.js";
13
- import { useModalPlacement as we } from "./useModalPlacement.js";
14
- import { useModalStackDepth as Fe } from "./useModalStackDepth.js";
15
- import { getModalScrollState as Re } from "./modalScrollArbitration.js";
16
- import { resolveModalSnapMetrics as Te, resolveModalPopupSnapPositions as He } from "./snapPoints.js";
3
+ import { useCallback as R, useEffect as z, useRef as j, useState as T, useMemo as ge, useLayoutEffect as ve } from "react";
4
+ import { Dialog as A } from "@base-ui-components/react/dialog";
5
+ import ye from "@orioncactuscorp/icons/orioncactus/CloseThick";
6
+ import Ce from "../Background/Background.js";
7
+ import Se from "../BackgroundIconButton/BackgroundIconButton.js";
8
+ import { ScrollArea as Me, ScrollAreaContainer as Ne } from "../ScrollArea/ScrollArea.js";
9
+ import { useModalContext as Y, ModalProvider as we } from "./contexts.js";
10
+ import { useControllableState as Fe } from "./useControllableState.js";
11
+ import { useMeasuredElement as pe } from "./useElementSize.js";
12
+ import { useModalDrag as Re } from "./useModalDrag.js";
13
+ import { useModalPlacement as Te } from "./useModalPlacement.js";
14
+ import { useModalStackDepth as He } from "./useModalStackDepth.js";
15
+ import { getModalScrollState as Ae } from "./modalScrollArbitration.js";
16
+ import { resolveModalSnapMetrics as Be, resolveModalPopupSnapPositions as De } from "./snapPoints.js";
17
17
  import l from "./Modal.module.scss.js";
18
- function A(...e) {
18
+ function H(...e) {
19
19
  return e.filter(Boolean).join(" ");
20
20
  }
21
- function Ae(e) {
21
+ function Pe(e) {
22
22
  return e != null && e !== !1 && e !== "";
23
23
  }
24
- function le(e, t) {
24
+ function de(e, t) {
25
25
  typeof e == "function" ? e(t) : e && (e.current = t);
26
26
  }
27
- function De(e) {
27
+ function xe(e) {
28
28
  if (!e) return;
29
29
  const t = Object.entries(e).filter(
30
- ([n]) => n.startsWith("--")
30
+ ([r]) => r.startsWith("--")
31
31
  );
32
32
  if (t.length !== 0)
33
33
  return Object.fromEntries(t);
34
34
  }
35
- function Pe(e) {
35
+ function je(e) {
36
36
  const t = e.trim();
37
37
  return t.endsWith("ms") ? Number.parseFloat(t) || 0 : t.endsWith("s") ? (Number.parseFloat(t) || 0) * 1e3 : 0;
38
38
  }
39
- function me(e) {
40
- return e.split(",").reduce((t, n) => Math.max(t, Pe(n)), 0);
39
+ function fe(e) {
40
+ return e.split(",").reduce((t, r) => Math.max(t, je(r)), 0);
41
41
  }
42
- function Be(e) {
43
- const t = window.getComputedStyle(e), n = me(t.animationDuration), a = me(t.animationDelay);
44
- return n + a + 250;
42
+ function Ee(e) {
43
+ const t = window.getComputedStyle(e), r = fe(t.animationDuration), a = fe(t.animationDelay);
44
+ return r + a + 250;
45
45
  }
46
- function xe({
46
+ function Ie({
47
47
  defaultSnapPosition: e,
48
48
  node: t,
49
- snapPositions: n
49
+ snapPositions: r
50
50
  }) {
51
- if (!n?.length) return;
52
- const a = He({
51
+ if (!r?.length) return;
52
+ const a = De({
53
53
  defaultSnapPosition: e,
54
- snapPositions: n,
54
+ snapPositions: r,
55
55
  surfaceMotion: t
56
56
  });
57
57
  a && (t.style.setProperty(
@@ -62,14 +62,14 @@ function xe({
62
62
  `${a.defaultTarget.y}px`
63
63
  ));
64
64
  }
65
- function je(e) {
65
+ function Oe(e) {
66
66
  if (e && typeof e == "object" && "reason" in e && typeof e.reason == "string")
67
67
  return e.reason;
68
68
  }
69
- function ae(e) {
69
+ function ce(e) {
70
70
  e && typeof e == "object" && "cancel" in e && typeof e.cancel == "function" && e.cancel();
71
71
  }
72
- function Ee(e, t) {
72
+ function qe(e, t) {
73
73
  switch (t) {
74
74
  case "drag-dismiss":
75
75
  return e?.drag ?? "auto";
@@ -87,22 +87,22 @@ function Ee(e, t) {
87
87
  return e?.programmatic ?? "auto";
88
88
  }
89
89
  }
90
- function Oe(e, t) {
90
+ function Le(e, t) {
91
91
  return t > 0 && (e === "drag-dismiss" || e === "backdrop-press" || e === "outside-press");
92
92
  }
93
- function pe(e, t) {
93
+ function he(e, t) {
94
94
  return t && (e === "backdrop-press" || e === "outside-press");
95
95
  }
96
- function qe({
96
+ function $e({
97
97
  backdrop: e,
98
98
  canSnapPopup: t,
99
- placement: n,
99
+ placement: r,
100
100
  presentationState: a
101
101
  }) {
102
- return e !== "auto" ? e : n === "bottom" && a === "peeked" || t ? "hidden" : "visible";
102
+ return e !== "auto" ? e : r === "bottom" && a === "peeked" || t ? "hidden" : "visible";
103
103
  }
104
- function $e(e) {
105
- switch (je(e)) {
104
+ function Ke(e) {
105
+ switch (Oe(e)) {
106
106
  case "close-press":
107
107
  return "close-button";
108
108
  case "outside-press":
@@ -117,283 +117,289 @@ function $e(e) {
117
117
  return "programmatic";
118
118
  }
119
119
  }
120
- function fe({
120
+ function be({
121
121
  children: e,
122
122
  open: t,
123
- defaultOpen: n,
123
+ defaultOpen: r,
124
124
  modal: a = !0,
125
125
  onOpenChange: p,
126
- canCloseAttempt: v,
126
+ canCloseAttempt: y,
127
127
  onCloseAttempt: u,
128
- presentationState: b,
128
+ presentationState: g,
129
129
  defaultPresentationState: f = "visible",
130
- onPresentationStateChange: S,
130
+ onPresentationStateChange: M,
131
131
  disablePointerDismissal: i,
132
- navigationDepth: g = 0,
132
+ navigationDepth: k = 0,
133
133
  dismissBehavior: c
134
134
  }) {
135
- const k = t !== void 0, [q, $] = H(
136
- n ?? !1
137
- ), z = k ? t : q, [I, re] = H("bottom"), [o, U] = H(!1), [K, Z] = H(!1), [s, _] = H(!1), [G, ee] = H(0), [L, J] = H(null), [y, M] = H({
135
+ const v = t !== void 0, [E, I] = T(
136
+ r ?? !1
137
+ ), U = v ? t : E, [O, se] = T("bottom"), [o, _] = T(!1), [q, Z] = T(!1), [s, G] = T(!1), [ee, te] = T(!1), [L, J] = T(0), [C, N] = T(null), [oe, $] = T({
138
138
  canScroll: !1,
139
139
  scrolledFromTop: !1,
140
140
  scrolledToBottom: !0
141
- }), [x, R] = Me({
142
- value: b,
141
+ }), [B, S] = Fe({
142
+ value: g,
143
143
  defaultValue: f,
144
- onChange: S
145
- }), V = ue(), N = ue(), D = Math.max(0, g), P = F(
146
- (r, h) => {
147
- k || $(r), p?.(r, h);
144
+ onChange: M
145
+ }), w = pe(), D = pe(), K = Math.max(0, k), F = R(
146
+ (n, h) => {
147
+ v || I(n), p?.(n, h);
148
148
  },
149
- [p, k]
150
- ), w = F(
151
- (r = { reason: "programmatic" }) => v?.(r) !== !1,
152
- [v]
153
- ), T = F(
154
- (r = { reason: "programmatic" }) => {
155
- ee((h) => h + 1);
149
+ [p, v]
150
+ ), P = R(
151
+ (n = { reason: "programmatic" }) => y?.(n) !== !1,
152
+ [y]
153
+ ), b = R(
154
+ (n = { reason: "programmatic" }) => {
155
+ J((h) => h + 1);
156
156
  },
157
157
  []
158
- ), C = F(
159
- (r = { reason: "programmatic" }) => {
160
- if (pe(r.reason, s))
158
+ ), V = R(
159
+ (n = { reason: "programmatic" }) => {
160
+ if (he(n.reason, s))
161
161
  return !1;
162
- const h = Ee(c, r.reason);
163
- return h === "allow" ? !0 : h === "block" ? !1 : !Oe(r.reason, D);
162
+ const h = qe(c, n.reason);
163
+ return h === "allow" ? !0 : h === "block" ? !1 : !Le(n.reason, K);
164
164
  },
165
- [s, c, D]
166
- ), W = F(
167
- (r = { reason: "programmatic" }, h = {}) => {
165
+ [s, c, K]
166
+ ), W = R(
167
+ (n = { reason: "programmatic" }, h = {}) => {
168
168
  const { commit: Q = !0, skipAttempt: m = !1 } = h;
169
- return !m && pe(r.reason, s) ? (ae(r.eventDetails), !1) : !m && !C(r) || !m && !w(r) || !m && u?.(r) === !1 ? (ae(r.eventDetails), T(r), !1) : (Q && P(!1, r.eventDetails), !0);
169
+ return !m && he(n.reason, s) ? (ce(n.eventDetails), !1) : !m && !V(n) || !m && !P(n) || !m && u?.(n) === !1 ? (ce(n.eventDetails), b(n), !1) : (Q && F(!1, n.eventDetails), !0);
170
170
  },
171
171
  [
172
- w,
173
- s,
174
- C,
175
172
  P,
176
- T,
173
+ s,
174
+ V,
175
+ F,
176
+ b,
177
177
  u
178
178
  ]
179
- ), ne = F(
180
- (r, h) => {
181
- if (r && x === "peeked" && R("visible"), !r) {
179
+ ), le = R(
180
+ (n, h) => {
181
+ if (n && B === "peeked" && S("visible"), !n) {
182
182
  W({
183
- reason: $e(h),
183
+ reason: Ke(h),
184
184
  eventDetails: h
185
185
  });
186
186
  return;
187
187
  }
188
- P(r, h);
188
+ F(n, h);
189
189
  },
190
- [P, x, W, R]
191
- ), ce = x === "visible" ? a : !1, te = i || I === "bottom" && o, se = he(
190
+ [F, B, W, S]
191
+ ), ae = B === "visible" && !ee ? a : !1, ie = i || O === "bottom" && o, re = ge(
192
192
  () => ({
193
- open: z,
194
- placement: I,
195
- setPlacement: re,
196
- presentationState: x,
197
- setPresentationState: R,
193
+ open: U,
194
+ placement: O,
195
+ setPlacement: se,
196
+ presentationState: B,
197
+ setPresentationState: S,
198
198
  requestClose: W,
199
- canDismissByBehavior: C,
200
- canCloseAttempt: w,
201
- closeAttemptFeedbackKey: G,
202
- notifyCloseAttemptRejected: T,
199
+ canDismissByBehavior: V,
200
+ canCloseAttempt: P,
201
+ closeAttemptFeedbackKey: L,
202
+ notifyCloseAttemptRejected: b,
203
203
  disablePointerDismissal: i ?? !1,
204
- setBackdropDismissalDisabled: _,
204
+ setBackdropDismissalDisabled: G,
205
+ setBackgroundInteractive: te,
205
206
  canPeek: o,
206
- setCanPeek: U,
207
- canRenderHandle: K,
207
+ setCanPeek: _,
208
+ canRenderHandle: q,
208
209
  setCanRenderHandle: Z,
209
- headerHeight: V.height,
210
- footerHeight: N.height,
211
- setHeaderNode: V.setNode,
212
- setFooterNode: N.setNode,
213
- bodyNode: L,
214
- setBodyNode: J,
215
- scrollState: y,
216
- setScrollState: M
210
+ headerHeight: w.height,
211
+ footerHeight: D.height,
212
+ setHeaderNode: w.setNode,
213
+ setFooterNode: D.setNode,
214
+ bodyNode: C,
215
+ setBodyNode: N,
216
+ scrollState: oe,
217
+ setScrollState: $
217
218
  }),
218
219
  [
219
- L,
220
- o,
221
- K,
222
220
  C,
223
- w,
224
- G,
225
- N.height,
226
- N.setNode,
227
- V.height,
228
- V.setNode,
229
- T,
230
- z,
231
- I,
221
+ o,
222
+ q,
223
+ V,
224
+ P,
225
+ L,
226
+ D.height,
227
+ D.setNode,
228
+ w.height,
229
+ w.setNode,
230
+ b,
231
+ U,
232
+ O,
232
233
  W,
233
- y,
234
+ oe,
234
235
  i,
235
- x,
236
- R
236
+ B,
237
+ S
237
238
  ]
238
239
  );
239
- return /* @__PURE__ */ d(Se, { value: se, children: /* @__PURE__ */ d(
240
- B.Root,
240
+ return /* @__PURE__ */ d(we, { value: re, children: /* @__PURE__ */ d(
241
+ A.Root,
241
242
  {
242
- open: z,
243
- modal: ce,
244
- onOpenChange: ne,
245
- disablePointerDismissal: te,
243
+ open: U,
244
+ modal: ae,
245
+ onOpenChange: le,
246
+ disablePointerDismissal: ie,
246
247
  children: e
247
248
  }
248
249
  ) });
249
250
  }
250
- function Ie({
251
+ function Ve({
251
252
  className: e = "",
252
253
  children: t,
253
- render: n,
254
+ render: r,
254
255
  nativeButton: a
255
256
  }) {
256
- return n ? /* @__PURE__ */ d(
257
- B.Trigger,
257
+ return r ? /* @__PURE__ */ d(
258
+ A.Trigger,
258
259
  {
259
- render: n,
260
+ render: r,
260
261
  nativeButton: a,
261
262
  "data-oc-component": "modal-trigger",
262
263
  children: t
263
264
  }
264
265
  ) : /* @__PURE__ */ d(
265
- B.Trigger,
266
+ A.Trigger,
266
267
  {
267
- className: A(l.trigger, e),
268
+ className: H(l.trigger, e),
268
269
  nativeButton: a,
269
270
  "data-oc-component": "modal-trigger",
270
271
  children: t
271
272
  }
272
273
  );
273
274
  }
274
- function Ke({
275
+ function We({
275
276
  className: e = "",
276
277
  children: t,
277
- variant: n = "adaptive",
278
+ variant: r = "adaptive",
278
279
  size: a = "medium",
279
280
  resize: p = "hug",
280
- backdrop: v = "auto",
281
+ backdrop: y = "auto",
281
282
  drag: u = "content",
282
- peekable: b = !1,
283
+ peekable: g = !1,
283
284
  snapPoints: f,
284
- defaultSnapPoint: S,
285
+ defaultSnapPoint: M,
285
286
  snapPositions: i,
286
- defaultSnapPosition: g,
287
+ defaultSnapPosition: k,
287
288
  initialFocus: c,
288
- peekHeight: k,
289
- closeThreshold: q,
290
- scrollLockTimeout: $,
291
- container: z,
292
- style: I,
293
- ...re
289
+ peekHeight: v,
290
+ closeThreshold: E,
291
+ scrollLockTimeout: I,
292
+ container: U,
293
+ style: O,
294
+ ...se
294
295
  }) {
295
- const o = Y("ModalContent"), { setCanPeek: U, setCanRenderHandle: K, setPlacement: Z } = o, s = we(n), _ = E(null), G = E(null), ee = E(null), L = E(null), J = E(0), y = E(null), M = E(null), [x, R] = H(), V = u === "handle" || u === "content", N = s === "popup" && u === "content" && !!i?.length, D = qe({
296
- backdrop: v,
297
- canSnapPopup: N,
296
+ const o = Y("ModalContent"), { setCanPeek: _, setCanRenderHandle: q, setPlacement: Z } = o, s = Te(r), G = j(null), ee = j(null), te = j(null), L = j(null), J = j(0), C = j(null), N = j(null), [oe, $] = T(), B = u === "handle" || u === "content", S = s === "popup" && u === "content" && !!i?.length, w = $e({
297
+ backdrop: y,
298
+ canSnapPopup: S,
298
299
  placement: s,
299
300
  presentationState: o.presentationState
300
- }), P = (s === "bottom" || N) && V, w = s === "bottom" && P && b, T = w && k !== void 0 ? k : o.headerHeight > 0 ? o.headerHeight : void 0, C = he(() => {
301
+ }), D = S && w === "hidden", K = (s === "bottom" || S) && B, F = s === "bottom" && K && g, P = F && v !== void 0 ? v : o.headerHeight > 0 ? o.headerHeight : void 0, b = ge(() => {
301
302
  if (!(!f?.length || typeof window > "u"))
302
- return Te({
303
+ return Be({
303
304
  snapPoints: f,
304
- defaultSnapPoint: S,
305
+ defaultSnapPoint: M,
305
306
  viewportHeight: window.innerHeight
306
307
  });
307
- }, [S, f]), W = Fe(o.open);
308
- O(() => {
308
+ }, [M, f]), V = He(o.open);
309
+ z(() => {
309
310
  Z(s);
310
- }, [s, Z]), O(() => {
311
+ }, [s, Z]), z(() => {
311
312
  o.open || (L.current = null);
312
- }, [o.open]), O(() => (U(w), () => U(!1)), [w, U]), O(() => (K(P), () => K(!1)), [P, K]);
313
- const ne = Ne({
313
+ }, [o.open]), z(() => (_(F), () => _(!1)), [F, _]), z(() => (q(K), () => q(!1)), [K, q]);
314
+ const W = Re({
314
315
  enabled: u !== !1,
315
316
  drag: u,
316
317
  open: o.open,
317
318
  placement: s,
318
- surfaceMotionRef: _,
319
- backdropRef: ee,
319
+ surfaceMotionRef: G,
320
+ backdropRef: te,
320
321
  bodyNode: o.bodyNode,
321
- snapHeights: C?.snapHeights,
322
- peekHeight: w ? k : void 0,
323
- peekFallback: w ? "header" : void 0,
322
+ snapHeights: b?.snapHeights,
323
+ peekHeight: F ? v : void 0,
324
+ peekFallback: F ? "header" : void 0,
324
325
  presentationState: o.presentationState,
325
326
  setPresentationState: o.setPresentationState,
326
327
  requestClose: o.requestClose,
327
328
  canCloseAttempt: o.canCloseAttempt,
328
329
  dismissible: !o.disablePointerDismissal && o.canDismissByBehavior({ reason: "drag-dismiss" }),
329
- visibleTranslate: C?.visibleTranslate,
330
- snapPositions: N ? i : void 0,
331
- defaultSnapPosition: g,
332
- closeThreshold: q,
333
- scrollLockTimeout: $
334
- }), ce = F(
330
+ visibleTranslate: b?.visibleTranslate,
331
+ snapPositions: S ? i : void 0,
332
+ defaultSnapPosition: k,
333
+ closeThreshold: E,
334
+ scrollLockTimeout: I
335
+ }), le = R(
335
336
  (m) => {
336
- _.current = m, m && o.open && N && L.current !== m && (xe({
337
- defaultSnapPosition: g,
337
+ G.current = m, m && o.open && S && L.current !== m && (Ie({
338
+ defaultSnapPosition: k,
338
339
  node: m,
339
340
  snapPositions: i
340
341
  }), L.current = m);
341
342
  },
342
- [N, o.open, g, i]
343
+ [S, o.open, k, i]
343
344
  );
344
- O(() => {
345
+ z(() => {
345
346
  const m = o.closeAttemptFeedbackKey;
346
347
  if (m === 0 || s !== "popup" || J.current === m) {
347
- J.current = m, R(void 0);
348
+ J.current = m, $(void 0);
348
349
  return;
349
350
  }
350
- const j = G.current;
351
- if (!j) return;
352
- J.current = m, y.current !== null && window.cancelAnimationFrame(y.current), M.current !== null && window.clearTimeout(M.current), R(void 0);
353
- const ie = () => {
354
- R(void 0), M.current = null;
355
- }, oe = (de) => {
356
- de.target === j && de.animationName === "oc-modal-reject-shake" && (j.removeEventListener("animationend", oe), M.current !== null && window.clearTimeout(M.current), ie());
351
+ const x = ee.current;
352
+ if (!x) return;
353
+ J.current = m, C.current !== null && window.cancelAnimationFrame(C.current), N.current !== null && window.clearTimeout(N.current), $(void 0);
354
+ const ue = () => {
355
+ $(void 0), N.current = null;
356
+ }, ne = (me) => {
357
+ me.target === x && me.animationName === "oc-modal-reject-shake" && (x.removeEventListener("animationend", ne), N.current !== null && window.clearTimeout(N.current), ue());
357
358
  };
358
- return j.addEventListener("animationend", oe), y.current = window.requestAnimationFrame(() => {
359
- y.current = null, R("reject"), y.current = window.requestAnimationFrame(() => {
360
- y.current = null, M.current = window.setTimeout(() => {
361
- j.removeEventListener("animationend", oe), ie();
362
- }, Be(j));
359
+ return x.addEventListener("animationend", ne), C.current = window.requestAnimationFrame(() => {
360
+ C.current = null, $("reject"), C.current = window.requestAnimationFrame(() => {
361
+ C.current = null, N.current = window.setTimeout(() => {
362
+ x.removeEventListener("animationend", ne), ue();
363
+ }, Ee(x));
363
364
  });
364
365
  }), () => {
365
- j.removeEventListener("animationend", oe), y.current !== null && (window.cancelAnimationFrame(y.current), y.current = null), M.current !== null && (window.clearTimeout(M.current), M.current = null);
366
+ x.removeEventListener("animationend", ne), C.current !== null && (window.cancelAnimationFrame(C.current), C.current = null), N.current !== null && (window.clearTimeout(N.current), N.current = null);
366
367
  };
367
368
  }, [o.closeAttemptFeedbackKey, s]);
368
- const te = De(I), se = {
369
- ...te,
369
+ const ae = xe(O), ie = {
370
+ ...ae,
370
371
  ...o.headerHeight > 0 ? { "--oc-modal-header-height": `${o.headerHeight}px` } : {},
371
372
  ...o.footerHeight > 0 ? { "--oc-modal-footer-height": `${o.footerHeight}px` } : {},
372
- ...T !== void 0 ? { "--oc-modal-peek-height": `${T}px` } : {},
373
- ...C?.sheetHeight !== void 0 ? { "--oc-modal-sheet-height": `${C.sheetHeight}px` } : {},
374
- ...C?.visibleTranslate !== void 0 ? {
375
- "--oc-modal-translate-y": `${C.visibleTranslate}px`
373
+ ...P !== void 0 ? { "--oc-modal-peek-height": `${P}px` } : {},
374
+ ...b?.sheetHeight !== void 0 ? { "--oc-modal-sheet-height": `${b.sheetHeight}px` } : {},
375
+ ...b?.visibleTranslate !== void 0 ? {
376
+ "--oc-modal-translate-y": `${b.visibleTranslate}px`
376
377
  } : {}
377
- }, r = {
378
+ }, re = {
378
379
  // Each modal reserves one backdrop slot and one viewport slot.
379
- "--oc-modal-stack-offset": W * 2
380
- }, h = c === "content" ? _ : c, { setBackdropDismissalDisabled: Q } = o;
381
- return O(() => (Q(D === "hidden"), () => {
382
- Q(!1);
383
- }), [D, Q]), /* @__PURE__ */ X(B.Portal, { container: z, children: [
380
+ "--oc-modal-stack-offset": V * 2
381
+ }, n = c === "content" ? G : c, { setBackdropDismissalDisabled: h, setBackgroundInteractive: Q } = o;
382
+ return ve(() => (h(w === "hidden"), Q(D), () => {
383
+ h(!1), Q(!1);
384
+ }), [
385
+ D,
386
+ w,
387
+ h,
388
+ Q
389
+ ]), /* @__PURE__ */ X(A.Portal, { container: U, children: [
384
390
  /* @__PURE__ */ d(
385
- B.Backdrop,
391
+ A.Backdrop,
386
392
  {
387
- ref: ee,
393
+ ref: te,
388
394
  className: l.backdrop,
389
395
  "data-oc-part": "backdrop",
390
396
  "data-oc-component": "modal-backdrop",
391
- "data-oc-modal-backdrop": D,
397
+ "data-oc-modal-backdrop": w,
392
398
  "data-oc-modal-placement": s,
393
399
  "data-oc-modal-presentation-state": o.presentationState,
394
- style: r,
400
+ style: re,
395
401
  onClick: (m) => {
396
- if (D === "hidden") {
402
+ if (w === "hidden") {
397
403
  m.stopPropagation();
398
404
  return;
399
405
  }
@@ -405,7 +411,7 @@ function Ke({
405
411
  o.notifyCloseAttemptRejected({ reason: "backdrop-press" });
406
412
  return;
407
413
  }
408
- if (s === "bottom" && w) {
414
+ if (s === "bottom" && F) {
409
415
  o.presentationState === "visible" && o.setPresentationState("peeked");
410
416
  return;
411
417
  }
@@ -414,41 +420,41 @@ function Ke({
414
420
  }
415
421
  ),
416
422
  /* @__PURE__ */ d(
417
- B.Viewport,
423
+ A.Viewport,
418
424
  {
419
425
  className: l.viewport,
420
426
  "data-oc-part": "viewport",
421
427
  "data-oc-component": "modal-viewport",
422
428
  "data-oc-modal-placement": s,
423
- style: r,
429
+ style: re,
424
430
  children: /* @__PURE__ */ X(
425
- B.Popup,
431
+ A.Popup,
426
432
  {
427
- ...re,
428
- ...ne,
429
- ref: ce,
430
- initialFocus: h,
431
- className: A(
433
+ ...se,
434
+ ...W,
435
+ ref: le,
436
+ initialFocus: n,
437
+ className: H(
432
438
  l.surfaceMotion,
433
439
  l[a],
434
440
  e
435
441
  ),
436
442
  "data-oc-part": "surface-motion",
437
443
  "data-oc-component": "modal-content",
438
- "data-oc-modal-backdrop": D,
439
- "data-oc-variant": n,
444
+ "data-oc-modal-backdrop": w,
445
+ "data-oc-variant": r,
440
446
  "data-oc-size": a,
441
447
  "data-oc-resize": p,
442
- "data-oc-modal-feedback": s === "popup" ? x : void 0,
448
+ "data-oc-modal-feedback": s === "popup" ? oe : void 0,
443
449
  "data-oc-modal-placement": s,
444
- "data-oc-modal-snapping": C || N ? "true" : void 0,
445
- style: se,
450
+ "data-oc-modal-snapping": b || S ? "true" : void 0,
451
+ style: ie,
446
452
  children: [
447
453
  s === "bottom" ? /* @__PURE__ */ d(
448
454
  "div",
449
455
  {
450
456
  "aria-hidden": "true",
451
- className: A(
457
+ className: H(
452
458
  l.bottomFill,
453
459
  l[a],
454
460
  e
@@ -456,24 +462,24 @@ function Ke({
456
462
  "data-oc-part": "bottom-fill",
457
463
  "data-oc-component": "modal-bottom-fill",
458
464
  "data-oc-size": a,
459
- style: te
465
+ style: ae
460
466
  }
461
467
  ) : null,
462
468
  /* @__PURE__ */ d(
463
469
  "div",
464
470
  {
465
- ref: G,
466
- className: A(
471
+ ref: ee,
472
+ className: H(
467
473
  l.surface,
468
474
  l[p],
469
475
  e
470
476
  ),
471
477
  "data-oc-part": "surface",
472
- "data-oc-variant": n,
478
+ "data-oc-variant": r,
473
479
  "data-oc-size": a,
474
480
  "data-oc-resize": p,
475
481
  "data-oc-modal-placement": s,
476
- style: I,
482
+ style: O,
477
483
  children: t
478
484
  }
479
485
  )
@@ -484,32 +490,32 @@ function Ke({
484
490
  )
485
491
  ] });
486
492
  }
487
- function Le({
493
+ function ze({
488
494
  className: e = "",
489
495
  title: t,
490
- children: n,
496
+ children: r,
491
497
  leadingContent: a,
492
498
  trailingContent: p,
493
- closeLabel: v = "닫기",
499
+ closeLabel: y = "닫기",
494
500
  closeButton: u = !0,
495
- handle: b = !0,
501
+ handle: g = !0,
496
502
  ref: f,
497
- ...S
503
+ ...M
498
504
  }) {
499
- const i = Y("ModalHeader"), { setHeaderNode: g, scrollState: c } = i, k = F(
500
- ($) => {
501
- g($), le(f, $);
505
+ const i = Y("ModalHeader"), { setHeaderNode: k, scrollState: c } = i, v = R(
506
+ (I) => {
507
+ k(I), de(f, I);
502
508
  },
503
- [f, g]
504
- ), q = Ae(a);
509
+ [f, k]
510
+ ), E = Pe(a);
505
511
  return /* @__PURE__ */ X(
506
- ke,
512
+ Ce,
507
513
  {
508
- ...S,
514
+ ...M,
509
515
  as: "header",
510
- ref: k,
516
+ ref: v,
511
517
  backdrop: "compact",
512
- className: A(l.header, e),
518
+ className: H(l.header, e),
513
519
  backColor: "var(--oc-color-theme-background-elevated-normal)",
514
520
  frontColor: "transparent",
515
521
  "data-oc-part": "header",
@@ -517,7 +523,7 @@ function Le({
517
523
  variant: "strong",
518
524
  "data-oc-sticky": c.scrolledFromTop ? "true" : "false",
519
525
  children: [
520
- b && i.canRenderHandle ? /* @__PURE__ */ d(
526
+ g && i.canRenderHandle ? /* @__PURE__ */ d(
521
527
  "div",
522
528
  {
523
529
  "aria-hidden": "true",
@@ -529,14 +535,14 @@ function Le({
529
535
  "div",
530
536
  {
531
537
  className: l.headerInner,
532
- "data-oc-has-leading": q ? "true" : "false",
538
+ "data-oc-has-leading": E ? "true" : "false",
533
539
  "data-oc-part": "header-inner",
534
540
  children: [
535
- q ? /* @__PURE__ */ d("div", { className: l.headerLeading, "data-oc-part": "header-leading", children: a }) : null,
536
- /* @__PURE__ */ d("div", { className: l.headerTitle, "data-oc-part": "header-title", children: t ? /* @__PURE__ */ d(B.Title, { children: t }) : n }),
541
+ E ? /* @__PURE__ */ d("div", { className: l.headerLeading, "data-oc-part": "header-leading", children: a }) : null,
542
+ /* @__PURE__ */ d("div", { className: l.headerTitle, "data-oc-part": "header-title", children: t ? /* @__PURE__ */ d(A.Title, { children: t }) : r }),
537
543
  /* @__PURE__ */ X("div", { className: l.headerTrailing, "data-oc-part": "header-trailing", children: [
538
544
  p,
539
- u ? /* @__PURE__ */ d(be, { label: v }) : null
545
+ u ? /* @__PURE__ */ d(ke, { label: y }) : null
540
546
  ] })
541
547
  ]
542
548
  }
@@ -545,41 +551,41 @@ function Le({
545
551
  }
546
552
  );
547
553
  }
548
- function Ve({
554
+ function Ue({
549
555
  className: e = "",
550
556
  children: t,
551
- containerClassName: n = "",
557
+ containerClassName: r = "",
552
558
  containerProps: a,
553
559
  ref: p,
554
- ...v
560
+ ...y
555
561
  }) {
556
- const u = Y("ModalBody"), { bodyNode: b, setBodyNode: f, setScrollState: S } = u, i = F(
562
+ const u = Y("ModalBody"), { bodyNode: g, setBodyNode: f, setScrollState: M } = u, i = R(
557
563
  (c) => {
558
- S(Re(c));
564
+ M(Ae(c));
559
565
  },
560
- [S]
561
- ), g = F(
566
+ [M]
567
+ ), k = R(
562
568
  (c) => {
563
- f(c), le(p, c), i(c);
569
+ f(c), de(p, c), i(c);
564
570
  },
565
571
  [p, f, i]
566
572
  );
567
- return O(() => {
568
- const c = b;
573
+ return z(() => {
574
+ const c = g;
569
575
  if (!c || (i(c), typeof ResizeObserver > "u")) return;
570
- const k = new ResizeObserver(() => i(c));
571
- return k.observe(c), c.firstElementChild && k.observe(c.firstElementChild), () => k.disconnect();
572
- }, [b, i]), /* @__PURE__ */ d(
573
- ye,
576
+ const v = new ResizeObserver(() => i(c));
577
+ return v.observe(c), c.firstElementChild && v.observe(c.firstElementChild), () => v.disconnect();
578
+ }, [g, i]), /* @__PURE__ */ d(
579
+ Me,
574
580
  {
575
- ...v,
576
- className: A(l.body, e),
581
+ ...y,
582
+ className: H(l.body, e),
577
583
  "data-oc-part": "body",
578
584
  "data-oc-component": "modal-body",
579
585
  children: /* @__PURE__ */ d(
580
- Ce,
586
+ Ne,
581
587
  {
582
- ref: g,
588
+ ref: k,
583
589
  className: l.bodyContainer,
584
590
  "data-oc-part": "body-container",
585
591
  "data-oc-component": "modal-body-container",
@@ -590,7 +596,7 @@ function Ve({
590
596
  "section",
591
597
  {
592
598
  ...a,
593
- className: A(l.bodyContent, n),
599
+ className: H(l.bodyContent, r),
594
600
  "data-oc-part": "body-content",
595
601
  "data-oc-component": "modal-body-content",
596
602
  children: t
@@ -601,75 +607,75 @@ function Ve({
601
607
  }
602
608
  );
603
609
  }
604
- function We({
610
+ function _e({
605
611
  className: e = "",
606
612
  children: t,
607
- background: n = "auto",
613
+ background: r = "auto",
608
614
  ref: a,
609
615
  ...p
610
616
  }) {
611
- const v = Y("ModalFooter"), { scrollState: u, setFooterNode: b } = v, f = F(
612
- (g) => {
613
- b(g), le(a, g);
617
+ const y = Y("ModalFooter"), { scrollState: u, setFooterNode: g } = y, f = R(
618
+ (k) => {
619
+ g(k), de(a, k);
614
620
  },
615
- [a, b]
616
- ), S = n === !0 || n === "auto" && u.canScroll && !u.scrolledToBottom;
621
+ [a, g]
622
+ ), M = r === !0 || r === "auto" && u.canScroll && !u.scrolledToBottom;
617
623
  return /* @__PURE__ */ d(
618
624
  "footer",
619
625
  {
620
626
  ...p,
621
627
  ref: f,
622
- className: A(l.footer, e),
628
+ className: H(l.footer, e),
623
629
  "data-oc-part": "footer",
624
630
  "data-oc-component": "modal-footer",
625
- "data-oc-background": S ? "true" : "false",
631
+ "data-oc-background": M ? "true" : "false",
626
632
  children: t
627
633
  }
628
634
  );
629
635
  }
630
- function be({
636
+ function ke({
631
637
  className: e = "",
632
- children: t = /* @__PURE__ */ d(ge, {}),
633
- label: n = "닫기",
638
+ children: t = /* @__PURE__ */ d(ye, {}),
639
+ label: r = "닫기",
634
640
  size: a = 24,
635
641
  disabled: p,
636
- onClick: v,
642
+ onClick: y,
637
643
  ...u
638
644
  }) {
639
- const b = Y("ModalClose");
645
+ const g = Y("ModalClose");
640
646
  return /* @__PURE__ */ d(
641
- ve,
647
+ Se,
642
648
  {
643
649
  ...u,
644
- className: A(l.close, e),
645
- "aria-label": u["aria-label"] ?? n,
650
+ className: H(l.close, e),
651
+ "aria-label": u["aria-label"] ?? r,
646
652
  "data-oc-part": "close",
647
653
  "data-oc-component": "modal-close",
648
654
  disabled: p,
649
655
  onClick: (f) => {
650
- v?.(f), !f.defaultPrevented && !p && b.requestClose({ reason: "close-button" });
656
+ y?.(f), !f.defaultPrevented && !p && g.requestClose({ reason: "close-button" });
651
657
  },
652
658
  size: a,
653
659
  children: t
654
660
  }
655
661
  );
656
662
  }
657
- const st = Object.assign(fe, {
658
- Root: fe,
659
- Trigger: Ie,
660
- Content: Ke,
661
- Header: Le,
662
- Body: Ve,
663
- Footer: We,
664
- Close: be
663
+ const dt = Object.assign(be, {
664
+ Root: be,
665
+ Trigger: Ve,
666
+ Content: We,
667
+ Header: ze,
668
+ Body: Ue,
669
+ Footer: _e,
670
+ Close: ke
665
671
  });
666
672
  export {
667
- Ve as ModalBody,
668
- be as ModalClose,
669
- Ke as ModalContent,
670
- We as ModalFooter,
671
- Le as ModalHeader,
672
- fe as ModalRoot,
673
- Ie as ModalTrigger,
674
- st as default
673
+ Ue as ModalBody,
674
+ ke as ModalClose,
675
+ We as ModalContent,
676
+ _e as ModalFooter,
677
+ ze as ModalHeader,
678
+ be as ModalRoot,
679
+ Ve as ModalTrigger,
680
+ dt as default
675
681
  };