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