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