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