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