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