@orioncactuscorp/ui 1.14.0 → 1.15.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/CHANGELOG.md +92 -0
- package/README.md +65 -36
- package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
- package/dist/components/Button/Button.css +1 -1
- package/dist/components/CheckMark/CheckMark.js +19 -17
- package/dist/components/Checkbox/Checkbox.css +1 -1
- package/dist/components/Checkbox/Checkbox.js +38 -36
- package/dist/components/FloatingWindow/FloatingWindow.js +138 -137
- package/dist/components/Interaction/Interaction.css +1 -1
- package/dist/components/Menu/Menu.css +1 -1
- package/dist/components/Menu/Menu.js +95 -87
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +504 -488
- package/dist/components/Modal/Modal.module.scss.js +69 -62
- package/dist/components/Modal/keyboardSession.js +104 -0
- package/dist/components/Modal/snapPoints.js +95 -82
- package/dist/components/Modal/useModalDrag.js +587 -637
- package/dist/components/Modal/useModalKeyboardAvoidance.js +159 -0
- package/dist/components/Modal/useModalViewportGeometry.js +36 -0
- package/dist/components/PositionSnap/PositionSnap.css +1 -0
- package/dist/components/PositionSnap/PositionSnap.js +330 -0
- package/dist/components/PositionSnap/PositionSnap.module.scss.js +9 -0
- package/dist/components/PositionSnap/contexts.js +12 -0
- package/dist/components/PositionSnap/geometry.js +75 -0
- package/dist/components/PositionSnap/gesture.js +7 -0
- package/dist/components/PositionSnap/policy.js +60 -0
- package/dist/components/PositionSnap.d.ts +6 -0
- package/dist/components/PositionSnap.js +7 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.css +1 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.js +45 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.module.scss.js +13 -0
- package/dist/components/ProgressIndicator.d.ts +6 -0
- package/dist/components/ProgressIndicator.js +4 -0
- package/dist/components/Radio/Radio.css +1 -1
- package/dist/components/Radio/Radio.js +26 -24
- package/dist/components/Switch/Switch.css +1 -1
- package/dist/components/Switch/Switch.js +18 -16
- package/dist/components/Tabs/Tabs.css +1 -1
- package/dist/components/Tooltip/Tooltip.css +1 -1
- package/dist/components/Tooltip/Tooltip.js +59 -56
- package/dist/components/Tooltip/Tooltip.module.scss.js +6 -4
- package/dist/components/internal/ModalPresentation.js +126 -124
- package/dist/components/internal/OverlayPortalContext.js +20 -0
- package/dist/index.js +133 -126
- package/dist/styles.css +12 -10
- package/dist/ui/src/components/CheckMark/CheckMark.d.ts +1 -1
- package/dist/ui/src/components/CheckMark/CheckMark.d.ts.map +1 -1
- package/dist/ui/src/components/CheckMark/types.d.ts +2 -1
- package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
- package/dist/ui/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/ui/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/ui/src/components/Checkbox/types.d.ts +2 -1
- package/dist/ui/src/components/Checkbox/types.d.ts.map +1 -1
- package/dist/ui/src/components/FloatingWindow/FloatingWindow.d.ts.map +1 -1
- package/dist/ui/src/components/FloatingWindow/types.d.ts +1 -1
- package/dist/ui/src/components/FloatingWindow/types.d.ts.map +1 -1
- package/dist/ui/src/components/Interaction/index.d.ts +1 -1
- package/dist/ui/src/components/Interaction/index.d.ts.map +1 -1
- package/dist/ui/src/components/Interaction/types.d.ts +9 -1
- package/dist/ui/src/components/Interaction/types.d.ts.map +1 -1
- package/dist/ui/src/components/Menu/Menu.d.ts +2 -2
- package/dist/ui/src/components/Menu/Menu.d.ts.map +1 -1
- package/dist/ui/src/components/Menu/types.d.ts +9 -2
- package/dist/ui/src/components/Menu/types.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/keyboardSession.d.ts +46 -0
- package/dist/ui/src/components/Modal/keyboardSession.d.ts.map +1 -0
- package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/types.d.ts +8 -1
- 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/components/Modal/useModalKeyboardAvoidance.d.ts +17 -0
- package/dist/ui/src/components/Modal/useModalKeyboardAvoidance.d.ts.map +1 -0
- package/dist/ui/src/components/Modal/useModalViewportGeometry.d.ts +9 -0
- package/dist/ui/src/components/Modal/useModalViewportGeometry.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/PositionSnap.d.ts +11 -0
- package/dist/ui/src/components/PositionSnap/PositionSnap.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/contexts.d.ts +17 -0
- package/dist/ui/src/components/PositionSnap/contexts.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/geometry.d.ts +31 -0
- package/dist/ui/src/components/PositionSnap/geometry.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/gesture.d.ts +2 -0
- package/dist/ui/src/components/PositionSnap/gesture.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/index.d.ts +3 -0
- package/dist/ui/src/components/PositionSnap/index.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/policy.d.ts +24 -0
- package/dist/ui/src/components/PositionSnap/policy.d.ts.map +1 -0
- package/dist/ui/src/components/PositionSnap/types.d.ts +31 -0
- package/dist/ui/src/components/PositionSnap/types.d.ts.map +1 -0
- package/dist/ui/src/components/ProgressIndicator/ProgressIndicator.d.ts +4 -0
- package/dist/ui/src/components/ProgressIndicator/ProgressIndicator.d.ts.map +1 -0
- package/dist/ui/src/components/ProgressIndicator/index.d.ts +3 -0
- package/dist/ui/src/components/ProgressIndicator/index.d.ts.map +1 -0
- package/dist/ui/src/components/ProgressIndicator/types.d.ts +17 -0
- package/dist/ui/src/components/ProgressIndicator/types.d.ts.map +1 -0
- package/dist/ui/src/components/Radio/Radio.d.ts +1 -1
- package/dist/ui/src/components/Radio/Radio.d.ts.map +1 -1
- package/dist/ui/src/components/Radio/types.d.ts +2 -1
- package/dist/ui/src/components/Radio/types.d.ts.map +1 -1
- package/dist/ui/src/components/Switch/Switch.d.ts +1 -1
- package/dist/ui/src/components/Switch/Switch.d.ts.map +1 -1
- package/dist/ui/src/components/Switch/types.d.ts +2 -1
- package/dist/ui/src/components/Switch/types.d.ts.map +1 -1
- package/dist/ui/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/ui/src/components/Tooltip/types.d.ts +6 -0
- package/dist/ui/src/components/Tooltip/types.d.ts.map +1 -1
- package/dist/ui/src/components/internal/ModalPresentation.d.ts +2 -1
- package/dist/ui/src/components/internal/ModalPresentation.d.ts.map +1 -1
- package/dist/ui/src/components/internal/OverlayPortalContext.d.ts +10 -0
- package/dist/ui/src/components/internal/OverlayPortalContext.d.ts.map +1 -0
- package/dist/ui/src/index.d.ts +5 -1
- package/dist/ui/src/index.d.ts.map +1 -1
- package/docs/api-conventions.md +4 -0
- package/docs/overlay-stacking.md +48 -0
- package/docs/responsive-foundation-profile.md +1 -1
- package/docs/scss-helpers.md +110 -5
- package/docs/selector-contract.md +77 -2
- package/docs/tokens.md +2 -0
- package/package.json +1 -1
- package/src/scss/foundations/atomic.scss +9 -8
- package/src/scss/index.scss +2 -0
- package/src/scss/mixins/_fluid.scss +57 -0
- package/src/scss/mixins/_fluid.test.ts +87 -0
- package/src/scss/mixins/_gradient.scss +99 -0
- package/src/scss/mixins/_gradient.test.ts +111 -0
- package/src/scss/mixins/_responsive.scss +2 -1
- package/src/scss/mixins/_typo.scss +2 -1
- package/src/scss/mixins/_units.scss +14 -0
- package/src/scss/mixins/_utils.scss +3 -22
|
@@ -7,12 +7,13 @@ import { mergeRefs as Ee } from "../../utils/mergeRefs.js";
|
|
|
7
7
|
import _e from "../BackgroundIconButton/BackgroundIconButton.js";
|
|
8
8
|
import H from "../Modal/Modal.module.scss.js";
|
|
9
9
|
import { resolveModalInitialFocus as et } from "../Modal/initialFocus.js";
|
|
10
|
-
import { useModalBodyScrollState as tt, ModalBodyFrame as ot, ModalSurfaceFrame as nt, resolveModalFooterBackground as rt, ModalFooterFrame as it, ModalHeaderFrame as at, ModalNavigationSectionFrame as dt, mergeModalClassName as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { useModalBodyScrollState as tt, ModalBodyFrame as ot, ModalSurfaceFrame as nt, resolveModalFooterBackground as rt, ModalFooterFrame as it, ModalHeaderFrame as at, ModalNavigationSectionFrame as dt, mergeModalClassName as ct } from "../internal/ModalPresentation.js";
|
|
11
|
+
import { OverlayPortalProvider as st } from "../internal/OverlayPortalContext.js";
|
|
12
|
+
import { useFloatingWindowContentContext as q, useFloatingWindowRootContext as Le, FloatingWindowContentContext as lt, useFloatingWindowManagerContext as ut, FloatingWindowRootContext as gt } from "./contexts.js";
|
|
13
|
+
import { constrainFloatingWindowPosition as ft, getFloatingWindowBoundaryRect as Re, resolveCenteredFloatingWindowPosition as Ce, resolveAnchoredFloatingWindowPosition as mt, getFloatingWindowRect as wt } from "./geometry.js";
|
|
13
14
|
import z from "./FloatingWindow.module.scss.js";
|
|
14
|
-
import { FloatingWindowManager as
|
|
15
|
-
const
|
|
15
|
+
import { FloatingWindowManager as pt } from "./FloatingWindowManager.js";
|
|
16
|
+
const vt = {
|
|
16
17
|
topLeft: { side: "top", alignment: "start" },
|
|
17
18
|
top: { side: "top", alignment: "center" },
|
|
18
19
|
topRight: { side: "top", alignment: "end" },
|
|
@@ -25,15 +26,15 @@ const pt = {
|
|
|
25
26
|
leftTop: { side: "left", alignment: "start" },
|
|
26
27
|
left: { side: "left", alignment: "center" },
|
|
27
28
|
leftBottom: { side: "left", alignment: "end" }
|
|
28
|
-
},
|
|
29
|
+
}, ht = {
|
|
29
30
|
small: H.small,
|
|
30
31
|
medium: H.medium,
|
|
31
32
|
large: H.large
|
|
32
|
-
}, $ =
|
|
33
|
+
}, $ = ct;
|
|
33
34
|
function Se(e, o) {
|
|
34
35
|
return e?.x === o.x && e.y === o.y;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function Ft(e) {
|
|
37
38
|
return e instanceof Element && !!e.closest(
|
|
38
39
|
'button, a, input, select, textarea, [contenteditable="true"], [data-oc-window-no-drag]'
|
|
39
40
|
);
|
|
@@ -44,32 +45,32 @@ function Me(e) {
|
|
|
44
45
|
function Te(e, o) {
|
|
45
46
|
return e ? typeof e == "function" ? e() : "current" in e ? e.current : e : o;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function bt(e, o) {
|
|
48
49
|
return e.x === o.x && e.y === o.y && e.width === o.width && e.height === o.height;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function yt(e, o) {
|
|
51
52
|
if (typeof IntersectionObserver > "u") return;
|
|
52
|
-
let
|
|
53
|
+
let s = null, n;
|
|
53
54
|
const r = () => {
|
|
54
|
-
n !== void 0 && window.clearTimeout(n),
|
|
55
|
-
}, a = (
|
|
55
|
+
n !== void 0 && window.clearTimeout(n), s?.disconnect(), s = null;
|
|
56
|
+
}, a = (w = !1, h = 1) => {
|
|
56
57
|
r();
|
|
57
58
|
const g = e.getBoundingClientRect(), u = e.ownerDocument.documentElement;
|
|
58
|
-
if (
|
|
59
|
+
if (w && o(), !g.width || !g.height) return;
|
|
59
60
|
const p = Math.floor(g.top), F = Math.floor(
|
|
60
61
|
u.clientWidth - (g.left + g.width)
|
|
61
|
-
),
|
|
62
|
+
), m = Math.floor(
|
|
62
63
|
u.clientHeight - (g.top + g.height)
|
|
63
64
|
), b = Math.floor(g.left);
|
|
64
65
|
let C = !0;
|
|
65
|
-
|
|
66
|
+
s = new IntersectionObserver(
|
|
66
67
|
(x) => {
|
|
67
|
-
const E = x[0]?.intersectionRatio ?? 0,
|
|
68
|
+
const E = x[0]?.intersectionRatio ?? 0, W = !bt(
|
|
68
69
|
g,
|
|
69
70
|
e.getBoundingClientRect()
|
|
70
71
|
);
|
|
71
|
-
if (
|
|
72
|
-
if (!C ||
|
|
72
|
+
if (W || E !== h) {
|
|
73
|
+
if (!C || W) {
|
|
73
74
|
a(!0);
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
@@ -78,61 +79,61 @@ function bt(e, o) {
|
|
|
78
79
|
C = !1;
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
|
-
rootMargin: `${-p}px ${-F}px ${-
|
|
82
|
+
rootMargin: `${-p}px ${-F}px ${-m}px ${-b}px`,
|
|
82
83
|
threshold: Math.max(0, Math.min(1, h)) || 1
|
|
83
84
|
}
|
|
84
|
-
),
|
|
85
|
+
), s.observe(e);
|
|
85
86
|
};
|
|
86
87
|
return a(), r;
|
|
87
88
|
}
|
|
88
89
|
function Ie({
|
|
89
90
|
children: e,
|
|
90
91
|
modal: o = !1,
|
|
91
|
-
defaultBackdrop:
|
|
92
|
+
defaultBackdrop: s,
|
|
92
93
|
presentation: n,
|
|
93
94
|
disablePointerDismissal: r = o !== !0,
|
|
94
95
|
windowId: a,
|
|
95
|
-
onActivate:
|
|
96
|
+
onActivate: w,
|
|
96
97
|
onOpenChange: h,
|
|
97
98
|
...g
|
|
98
99
|
}) {
|
|
99
|
-
const u =
|
|
100
|
+
const u = ut(), [p, F] = R(null);
|
|
100
101
|
if (u && !a)
|
|
101
102
|
throw new Error(
|
|
102
103
|
"FloatingWindowRoot requires windowId inside FloatingWindowManager."
|
|
103
104
|
);
|
|
104
|
-
const
|
|
105
|
+
const m = u !== null && u.activeWindowId !== void 0 && u.activeWindowId !== a, b = m && o !== !1 ? !1 : o, C = m ? !0 : r, x = X(
|
|
105
106
|
() => ({
|
|
106
|
-
defaultBackdrop:
|
|
107
|
+
defaultBackdrop: s,
|
|
107
108
|
manager: u,
|
|
108
109
|
modal: o,
|
|
109
|
-
onActivate:
|
|
110
|
+
onActivate: w,
|
|
110
111
|
presentation: n,
|
|
111
112
|
setTriggerNode: F,
|
|
112
113
|
triggerNode: p,
|
|
113
114
|
windowId: a
|
|
114
115
|
}),
|
|
115
116
|
[
|
|
116
|
-
|
|
117
|
+
s,
|
|
117
118
|
u,
|
|
118
119
|
o,
|
|
119
|
-
|
|
120
|
+
w,
|
|
120
121
|
n,
|
|
121
122
|
p,
|
|
122
123
|
a
|
|
123
124
|
]
|
|
124
125
|
), E = L(
|
|
125
|
-
(
|
|
126
|
+
(W, v) => {
|
|
126
127
|
const Y = v && typeof v == "object" && "reason" in v ? v.reason : void 0;
|
|
127
|
-
if (!
|
|
128
|
+
if (!W && (Y === "escape-key" || Y === "outside-press") && u && a && u.activeWindowId !== a) {
|
|
128
129
|
v && typeof v == "object" && "cancel" in v && typeof v.cancel == "function" && v.cancel();
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
h?.(
|
|
132
|
+
h?.(W, v);
|
|
132
133
|
},
|
|
133
134
|
[u, h, a]
|
|
134
135
|
);
|
|
135
|
-
return /* @__PURE__ */ l(
|
|
136
|
+
return /* @__PURE__ */ l(gt.Provider, { value: x, children: /* @__PURE__ */ l(
|
|
136
137
|
T.Root,
|
|
137
138
|
{
|
|
138
139
|
...g,
|
|
@@ -153,7 +154,7 @@ function xe(e) {
|
|
|
153
154
|
}
|
|
154
155
|
);
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function Wt({
|
|
157
158
|
modal: e = !0,
|
|
158
159
|
...o
|
|
159
160
|
}) {
|
|
@@ -167,48 +168,48 @@ function yt({
|
|
|
167
168
|
}
|
|
168
169
|
);
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function Nt({
|
|
171
172
|
children: e,
|
|
172
173
|
className: o = "",
|
|
173
|
-
render:
|
|
174
|
+
render: s,
|
|
174
175
|
nativeButton: n,
|
|
175
176
|
ref: r
|
|
176
177
|
}) {
|
|
177
|
-
const a = Le("FloatingWindowTrigger"),
|
|
178
|
+
const a = Le("FloatingWindowTrigger"), w = X(
|
|
178
179
|
() => Ee(a.setTriggerNode, r),
|
|
179
180
|
[r, a.setTriggerNode]
|
|
180
181
|
);
|
|
181
182
|
return /* @__PURE__ */ l(
|
|
182
183
|
T.Trigger,
|
|
183
184
|
{
|
|
184
|
-
ref:
|
|
185
|
-
className:
|
|
186
|
-
render:
|
|
185
|
+
ref: w,
|
|
186
|
+
className: s ? void 0 : $(z.trigger, o),
|
|
187
|
+
render: s,
|
|
187
188
|
nativeButton: n,
|
|
188
189
|
"data-oc-component": "floating-window-trigger",
|
|
189
190
|
children: e
|
|
190
191
|
}
|
|
191
192
|
);
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function Rt({
|
|
194
195
|
children: e,
|
|
195
196
|
className: o = "",
|
|
196
|
-
style:
|
|
197
|
+
style: s,
|
|
197
198
|
position: n,
|
|
198
199
|
defaultPosition: r,
|
|
199
200
|
placement: a,
|
|
200
|
-
side:
|
|
201
|
+
side: w = "bottom",
|
|
201
202
|
alignment: h = "center",
|
|
202
203
|
sideOffset: g = 12,
|
|
203
204
|
alignOffset: u = 0,
|
|
204
205
|
anchor: p,
|
|
205
206
|
onPositionChange: F,
|
|
206
|
-
onPositionCommit:
|
|
207
|
+
onPositionCommit: m,
|
|
207
208
|
collisionBoundary: b = "viewport",
|
|
208
209
|
collisionPadding: C = 16,
|
|
209
210
|
collisionAvoidance: x,
|
|
210
211
|
dragHandleVisibility: E = 48,
|
|
211
|
-
draggable:
|
|
212
|
+
draggable: W = !0,
|
|
212
213
|
backdrop: v = "auto",
|
|
213
214
|
size: Y = "medium",
|
|
214
215
|
resize: ne = "content",
|
|
@@ -217,19 +218,19 @@ function Nt({
|
|
|
217
218
|
stackLevel: Ae = 0,
|
|
218
219
|
...K
|
|
219
220
|
}) {
|
|
220
|
-
const
|
|
221
|
+
const c = Le("FloatingWindowContent"), I = A(null), re = A(null), ie = A(!1), [Q, ae] = R(null), [de, ze] = R(null), [Z, He] = R({
|
|
221
222
|
canScroll: !1,
|
|
222
223
|
scrolledFromTop: !1,
|
|
223
224
|
scrolledToBottom: !0
|
|
224
|
-
}), P = A(null),
|
|
225
|
+
}), P = A(null), ce = n !== void 0 || r !== void 0, _ = A(ce), U = A(null), [y, $e] = R(
|
|
225
226
|
null
|
|
226
|
-
), [
|
|
227
|
+
), [se, le] = R(r ?? null), [ee, ue] = R(ce), [qe, G] = R(!1), [je, Oe] = R(w), [Ve, Xe] = R(h), Ye = c.windowId ? c.manager?.stackLevels.get(c.windowId) : void 0, te = c.manager?.registerWindow, ge = Ye ?? Ae, j = c.manager ? c.manager.activeWindowId === c.windowId : void 0, fe = a ? vt[a] : void 0, me = fe?.side ?? w, we = fe?.alignment ?? h, pe = X(
|
|
227
228
|
() => ({
|
|
228
229
|
side: x?.side ?? "flip",
|
|
229
230
|
alignment: x?.alignment ?? "shift"
|
|
230
231
|
}),
|
|
231
232
|
[x?.alignment, x?.side]
|
|
232
|
-
), ve = v === "auto" ?
|
|
233
|
+
), ve = v === "auto" ? c.defaultBackdrop : v, Ue = L(
|
|
233
234
|
(t) => {
|
|
234
235
|
const d = I.current !== null;
|
|
235
236
|
if (I.current = t, $e(t), !t) {
|
|
@@ -247,7 +248,7 @@ function Nt({
|
|
|
247
248
|
const d = I.current;
|
|
248
249
|
if (!d) return t;
|
|
249
250
|
const i = d.getBoundingClientRect();
|
|
250
|
-
return
|
|
251
|
+
return ft({
|
|
251
252
|
boundary: Re(b),
|
|
252
253
|
dragHandleHeight: E,
|
|
253
254
|
padding: C,
|
|
@@ -267,13 +268,13 @@ function Nt({
|
|
|
267
268
|
const i = B(t);
|
|
268
269
|
return k(i), n === void 0 && le(
|
|
269
270
|
(f) => Se(f, i) ? f : i
|
|
270
|
-
), d &&
|
|
271
|
+
), d && m?.(i), i;
|
|
271
272
|
},
|
|
272
|
-
[B, k,
|
|
273
|
+
[B, k, m, n]
|
|
273
274
|
), J = L(() => {
|
|
274
|
-
const t =
|
|
275
|
+
const t = y ?? I.current;
|
|
275
276
|
if (!t) return;
|
|
276
|
-
const d = t.getBoundingClientRect(), i = { width: d.width, height: d.height }, f = Re(b), S = n ??
|
|
277
|
+
const d = t.getBoundingClientRect(), i = { width: d.width, height: d.height }, f = Re(b), S = n ?? se;
|
|
277
278
|
if (_.current || S) {
|
|
278
279
|
O(
|
|
279
280
|
S ?? P.current ?? Ce({
|
|
@@ -284,7 +285,7 @@ function Nt({
|
|
|
284
285
|
), G(!0);
|
|
285
286
|
return;
|
|
286
287
|
}
|
|
287
|
-
const D = Te(p,
|
|
288
|
+
const D = Te(p, c.triggerNode);
|
|
288
289
|
if (!D) {
|
|
289
290
|
k(
|
|
290
291
|
B(
|
|
@@ -296,15 +297,15 @@ function Nt({
|
|
|
296
297
|
), G(!0);
|
|
297
298
|
return;
|
|
298
299
|
}
|
|
299
|
-
const M =
|
|
300
|
+
const M = mt({
|
|
300
301
|
alignOffset: u,
|
|
301
|
-
alignment:
|
|
302
|
+
alignment: we,
|
|
302
303
|
anchor: wt(D),
|
|
303
304
|
boundary: f,
|
|
304
305
|
collisionAvoidance: pe,
|
|
305
306
|
direction: window.getComputedStyle(D).direction === "rtl" ? "rtl" : "ltr",
|
|
306
307
|
padding: C,
|
|
307
|
-
side:
|
|
308
|
+
side: me,
|
|
308
309
|
sideOffset: g,
|
|
309
310
|
size: i
|
|
310
311
|
});
|
|
@@ -320,24 +321,24 @@ function Nt({
|
|
|
320
321
|
C,
|
|
321
322
|
O,
|
|
322
323
|
B,
|
|
323
|
-
|
|
324
|
+
se,
|
|
324
325
|
k,
|
|
325
326
|
n,
|
|
326
|
-
me,
|
|
327
327
|
we,
|
|
328
|
+
me,
|
|
328
329
|
pe,
|
|
329
|
-
|
|
330
|
+
c.triggerNode,
|
|
330
331
|
g,
|
|
331
|
-
|
|
332
|
+
y
|
|
332
333
|
]);
|
|
333
334
|
Ne(() => {
|
|
334
335
|
J();
|
|
335
336
|
}, [J]), oe(() => {
|
|
336
337
|
const t = I.current;
|
|
337
338
|
if (!t) return;
|
|
338
|
-
const d = Te(p,
|
|
339
|
+
const d = Te(p, c.triggerNode), i = () => J(), f = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(i);
|
|
339
340
|
f?.observe(t), d && f?.observe(d), b !== "viewport" && f?.observe(b);
|
|
340
|
-
const S = d && !ee && n === void 0 && r === void 0 ?
|
|
341
|
+
const S = d && !ee && n === void 0 && r === void 0 ? yt(d, i) : void 0;
|
|
341
342
|
return window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), window.visualViewport?.addEventListener("resize", i), window.visualViewport?.addEventListener("scroll", i), () => {
|
|
342
343
|
S?.(), f?.disconnect(), window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0), window.visualViewport?.removeEventListener("resize", i), window.visualViewport?.removeEventListener("scroll", i);
|
|
343
344
|
};
|
|
@@ -348,27 +349,27 @@ function Nt({
|
|
|
348
349
|
ee,
|
|
349
350
|
J,
|
|
350
351
|
n,
|
|
351
|
-
|
|
352
|
+
c.triggerNode
|
|
352
353
|
]), oe(
|
|
353
354
|
() => () => {
|
|
354
355
|
U.current?.();
|
|
355
356
|
},
|
|
356
357
|
[]
|
|
357
358
|
), Ne(() => {
|
|
358
|
-
if (!(!
|
|
359
|
-
return te(
|
|
360
|
-
}, [te,
|
|
359
|
+
if (!(!y || !te || !c.windowId))
|
|
360
|
+
return te(c.windowId, c.modal);
|
|
361
|
+
}, [te, c.modal, c.windowId, y]), oe(() => {
|
|
361
362
|
const t = j === !0 && !ie.current;
|
|
362
|
-
if (ie.current = j === !0, !t ||
|
|
363
|
+
if (ie.current = j === !0, !t || c.modal === !1 || !y) return;
|
|
363
364
|
const d = window.requestAnimationFrame(() => {
|
|
364
|
-
const i = re.current, f = i &&
|
|
365
|
-
|
|
365
|
+
const i = re.current, f = i && y.contains(i) ? i : Q ?? y;
|
|
366
|
+
y.contains(document.activeElement) || f.focus({ preventScroll: !0 });
|
|
366
367
|
});
|
|
367
368
|
return () => window.cancelAnimationFrame(d);
|
|
368
|
-
}, [j,
|
|
369
|
+
}, [j, c.modal, Q, y]);
|
|
369
370
|
const Fe = L(
|
|
370
371
|
(t) => {
|
|
371
|
-
if (!
|
|
372
|
+
if (!W || !t.isPrimary || t.button !== 0 || Ft(t.target))
|
|
372
373
|
return;
|
|
373
374
|
const d = I.current;
|
|
374
375
|
if (!d) return;
|
|
@@ -394,32 +395,32 @@ function Nt({
|
|
|
394
395
|
[
|
|
395
396
|
O,
|
|
396
397
|
B,
|
|
397
|
-
|
|
398
|
+
W,
|
|
398
399
|
k
|
|
399
400
|
]
|
|
400
401
|
), Ge = X(
|
|
401
402
|
() => ({
|
|
402
403
|
bodyNode: de,
|
|
403
|
-
draggable:
|
|
404
|
+
draggable: W,
|
|
404
405
|
scrollState: Z,
|
|
405
406
|
setBodyNode: ze,
|
|
406
407
|
setScrollState: He,
|
|
407
408
|
setTitleNode: ae,
|
|
408
409
|
startDrag: Fe
|
|
409
410
|
}),
|
|
410
|
-
[de,
|
|
411
|
+
[de, W, Z, ae, Fe]
|
|
411
412
|
), Je = et({
|
|
412
|
-
contentNode:
|
|
413
|
+
contentNode: y,
|
|
413
414
|
initialFocus: De,
|
|
414
|
-
modal:
|
|
415
|
+
modal: c.modal,
|
|
415
416
|
titleNode: Q
|
|
416
417
|
}), be = {
|
|
417
418
|
"--oc-floating-window-stack-offset": ge * 2
|
|
418
419
|
}, Ke = {
|
|
419
|
-
...
|
|
420
|
+
...s,
|
|
420
421
|
"--oc-floating-window-stack-offset": ge * 2
|
|
421
422
|
}, ye = () => {
|
|
422
|
-
|
|
423
|
+
c.windowId && c.manager?.activateWindow(c.windowId), c.onActivate?.(c.windowId);
|
|
423
424
|
};
|
|
424
425
|
return /* @__PURE__ */ Qe(T.Portal, { container: Be, children: [
|
|
425
426
|
ve === "visible" ? /* @__PURE__ */ l(
|
|
@@ -437,7 +438,7 @@ function Nt({
|
|
|
437
438
|
className: z.positioner,
|
|
438
439
|
"data-oc-component": "floating-window-positioner",
|
|
439
440
|
style: be,
|
|
440
|
-
children: /* @__PURE__ */ l(
|
|
441
|
+
children: /* @__PURE__ */ l(lt.Provider, { value: Ge, children: /* @__PURE__ */ l(
|
|
441
442
|
T.Popup,
|
|
442
443
|
{
|
|
443
444
|
...K,
|
|
@@ -450,8 +451,8 @@ function Nt({
|
|
|
450
451
|
"data-oc-part": "window",
|
|
451
452
|
"data-oc-positioned": qe ? "true" : "false",
|
|
452
453
|
"data-oc-window-positioning": ee || n !== void 0 || r !== void 0 ? "free" : "anchored",
|
|
453
|
-
"data-oc-window-presentation":
|
|
454
|
-
"data-oc-window-modality":
|
|
454
|
+
"data-oc-window-presentation": c.presentation,
|
|
455
|
+
"data-oc-window-modality": c.modal === !0 ? "modal" : c.modal === "trap-focus" ? "trap-focus" : "modeless",
|
|
455
456
|
"data-oc-window-active": j === void 0 ? void 0 : j ? "true" : "false",
|
|
456
457
|
onFocusCapture: (t) => {
|
|
457
458
|
K.onFocusCapture?.(t);
|
|
@@ -462,13 +463,13 @@ function Nt({
|
|
|
462
463
|
K.onPointerDownCapture?.(t), !t.defaultPrevented && Me(t.target) && ye();
|
|
463
464
|
},
|
|
464
465
|
style: Ke,
|
|
465
|
-
children: /* @__PURE__ */ l(
|
|
466
|
+
children: /* @__PURE__ */ l(st, { container: y, children: /* @__PURE__ */ l(
|
|
466
467
|
"div",
|
|
467
468
|
{
|
|
468
469
|
className: $(
|
|
469
470
|
H.surfaceMotion,
|
|
470
471
|
z.presentationMotion,
|
|
471
|
-
|
|
472
|
+
ht[Y]
|
|
472
473
|
),
|
|
473
474
|
"data-oc-modal-backdrop": ve,
|
|
474
475
|
"data-oc-modal-placement": "popup",
|
|
@@ -485,17 +486,17 @@ function Nt({
|
|
|
485
486
|
}
|
|
486
487
|
)
|
|
487
488
|
}
|
|
488
|
-
)
|
|
489
|
+
) })
|
|
489
490
|
}
|
|
490
491
|
) })
|
|
491
492
|
}
|
|
492
493
|
)
|
|
493
494
|
] });
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
+
function Ct({
|
|
496
497
|
children: e,
|
|
497
498
|
className: o = "",
|
|
498
|
-
onPointerDown:
|
|
499
|
+
onPointerDown: s,
|
|
499
500
|
...n
|
|
500
501
|
}) {
|
|
501
502
|
const r = q("FloatingWindowDragHandle");
|
|
@@ -507,20 +508,20 @@ function Rt({
|
|
|
507
508
|
"data-oc-part": "drag-handle",
|
|
508
509
|
"data-oc-draggable": r.draggable ? "true" : "false",
|
|
509
510
|
onPointerDown: (a) => {
|
|
510
|
-
|
|
511
|
+
s?.(a), a.defaultPrevented || r.startDrag(a);
|
|
511
512
|
},
|
|
512
513
|
children: e
|
|
513
514
|
}
|
|
514
515
|
);
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
+
function St({
|
|
517
518
|
title: e,
|
|
518
519
|
leadingContent: o,
|
|
519
|
-
trailingContent:
|
|
520
|
+
trailingContent: s,
|
|
520
521
|
closeButton: n = !0,
|
|
521
522
|
closeLabel: r = "닫기",
|
|
522
523
|
draggable: a = !0,
|
|
523
|
-
children:
|
|
524
|
+
children: w,
|
|
524
525
|
className: h = "",
|
|
525
526
|
onPointerDown: g,
|
|
526
527
|
ref: u,
|
|
@@ -538,38 +539,38 @@ function Ct({
|
|
|
538
539
|
leadingContent: o,
|
|
539
540
|
sticky: F.scrollState.scrolledFromTop,
|
|
540
541
|
titleContent: e ? /* @__PURE__ */ l(Pe, { children: e }) : void 0,
|
|
541
|
-
trailingContent:
|
|
542
|
-
onPointerDown: (
|
|
543
|
-
g?.(
|
|
542
|
+
trailingContent: s,
|
|
543
|
+
onPointerDown: (m) => {
|
|
544
|
+
g?.(m), !m.defaultPrevented && a && F.startDrag(m);
|
|
544
545
|
},
|
|
545
|
-
children:
|
|
546
|
+
children: w
|
|
546
547
|
}
|
|
547
548
|
);
|
|
548
549
|
}
|
|
549
|
-
function
|
|
550
|
+
function Mt({
|
|
550
551
|
handle: e = !0,
|
|
551
552
|
...o
|
|
552
553
|
}) {
|
|
553
|
-
const
|
|
554
|
+
const s = q(
|
|
554
555
|
"FloatingWindowNavigationSection"
|
|
555
556
|
);
|
|
556
557
|
return /* @__PURE__ */ l(
|
|
557
558
|
dt,
|
|
558
559
|
{
|
|
559
560
|
...o,
|
|
560
|
-
canRenderHandle: e &&
|
|
561
|
-
handleProps: { onPointerDown:
|
|
561
|
+
canRenderHandle: e && s.draggable,
|
|
562
|
+
handleProps: { onPointerDown: s.startDrag }
|
|
562
563
|
}
|
|
563
564
|
);
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
+
function Tt({
|
|
566
567
|
children: e,
|
|
567
568
|
className: o = "",
|
|
568
|
-
layout:
|
|
569
|
+
layout: s = "content",
|
|
569
570
|
containerClassName: n = "",
|
|
570
571
|
containerProps: r,
|
|
571
572
|
ref: a,
|
|
572
|
-
...
|
|
573
|
+
...w
|
|
573
574
|
}) {
|
|
574
575
|
const { bodyNode: h, setBodyNode: g, setScrollState: u } = q("FloatingWindowBody"), { setBodyRef: p, updateScrollState: F } = tt({
|
|
575
576
|
bodyNode: h,
|
|
@@ -582,27 +583,27 @@ function Mt({
|
|
|
582
583
|
bodyContainerProps: {
|
|
583
584
|
...r,
|
|
584
585
|
ref: p,
|
|
585
|
-
onScroll: (
|
|
586
|
-
r?.onScroll?.(
|
|
586
|
+
onScroll: (m) => {
|
|
587
|
+
r?.onScroll?.(m), F(m.currentTarget);
|
|
587
588
|
}
|
|
588
589
|
},
|
|
589
|
-
bodyContentProps: { ...
|
|
590
|
-
layout:
|
|
590
|
+
bodyContentProps: { ...w, ref: a, className: n },
|
|
591
|
+
layout: s,
|
|
591
592
|
scrollAreaProps: { className: o },
|
|
592
593
|
children: e
|
|
593
594
|
}
|
|
594
595
|
);
|
|
595
596
|
}
|
|
596
|
-
function
|
|
597
|
+
function xt({
|
|
597
598
|
children: e,
|
|
598
599
|
className: o = "",
|
|
599
|
-
background:
|
|
600
|
+
background: s = "auto",
|
|
600
601
|
...n
|
|
601
602
|
}) {
|
|
602
603
|
const { scrollState: r } = q(
|
|
603
604
|
"FloatingWindowFooter"
|
|
604
605
|
), a = rt(
|
|
605
|
-
|
|
606
|
+
s,
|
|
606
607
|
r
|
|
607
608
|
);
|
|
608
609
|
return /* @__PURE__ */ l(
|
|
@@ -618,7 +619,7 @@ function Tt({
|
|
|
618
619
|
function Pe({
|
|
619
620
|
className: e = "",
|
|
620
621
|
ref: o,
|
|
621
|
-
...
|
|
622
|
+
...s
|
|
622
623
|
}) {
|
|
623
624
|
const n = q("FloatingWindowTitle"), r = X(
|
|
624
625
|
() => Ee(n.setTitleNode, o),
|
|
@@ -627,20 +628,20 @@ function Pe({
|
|
|
627
628
|
return /* @__PURE__ */ l(
|
|
628
629
|
T.Title,
|
|
629
630
|
{
|
|
630
|
-
...
|
|
631
|
+
...s,
|
|
631
632
|
ref: r,
|
|
632
633
|
className: $(H.initialFocusTitle, e),
|
|
633
634
|
tabIndex: -1
|
|
634
635
|
}
|
|
635
636
|
);
|
|
636
637
|
}
|
|
637
|
-
function
|
|
638
|
+
function Et(e) {
|
|
638
639
|
return /* @__PURE__ */ l(T.Description, { ...e });
|
|
639
640
|
}
|
|
640
641
|
function ke(e) {
|
|
641
642
|
if (e.render !== void 0)
|
|
642
643
|
return /* @__PURE__ */ l(T.Close, { ...e });
|
|
643
|
-
const { className: o = "", label:
|
|
644
|
+
const { className: o = "", label: s = "닫기", size: n = 24, ...r } = e;
|
|
644
645
|
return /* @__PURE__ */ l(
|
|
645
646
|
T.Close,
|
|
646
647
|
{
|
|
@@ -649,7 +650,7 @@ function ke(e) {
|
|
|
649
650
|
{
|
|
650
651
|
...r,
|
|
651
652
|
className: $(H.close, o),
|
|
652
|
-
"aria-label": r["aria-label"] ??
|
|
653
|
+
"aria-label": r["aria-label"] ?? s,
|
|
653
654
|
"data-oc-component": "modal-close",
|
|
654
655
|
"data-oc-part": "close",
|
|
655
656
|
size: n,
|
|
@@ -659,34 +660,34 @@ function ke(e) {
|
|
|
659
660
|
}
|
|
660
661
|
);
|
|
661
662
|
}
|
|
662
|
-
const
|
|
663
|
-
Manager:
|
|
663
|
+
const Xt = Object.assign(xe, {
|
|
664
|
+
Manager: pt,
|
|
664
665
|
Root: xe,
|
|
665
|
-
ModalRoot:
|
|
666
|
-
Trigger:
|
|
667
|
-
Content:
|
|
668
|
-
DragHandle:
|
|
669
|
-
Header:
|
|
670
|
-
NavigationSection:
|
|
671
|
-
Body:
|
|
672
|
-
Footer:
|
|
666
|
+
ModalRoot: Wt,
|
|
667
|
+
Trigger: Nt,
|
|
668
|
+
Content: Rt,
|
|
669
|
+
DragHandle: Ct,
|
|
670
|
+
Header: St,
|
|
671
|
+
NavigationSection: Mt,
|
|
672
|
+
Body: Tt,
|
|
673
|
+
Footer: xt,
|
|
673
674
|
Title: Pe,
|
|
674
|
-
Description:
|
|
675
|
+
Description: Et,
|
|
675
676
|
Close: ke
|
|
676
677
|
});
|
|
677
678
|
export {
|
|
678
|
-
|
|
679
|
+
Tt as FloatingWindowBody,
|
|
679
680
|
ke as FloatingWindowClose,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
681
|
+
Rt as FloatingWindowContent,
|
|
682
|
+
Et as FloatingWindowDescription,
|
|
683
|
+
Ct as FloatingWindowDragHandle,
|
|
684
|
+
xt as FloatingWindowFooter,
|
|
685
|
+
St as FloatingWindowHeader,
|
|
686
|
+
pt as FloatingWindowManager,
|
|
687
|
+
Mt as FloatingWindowNavigationSection,
|
|
687
688
|
xe as FloatingWindowRoot,
|
|
688
689
|
Pe as FloatingWindowTitle,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
690
|
+
Nt as FloatingWindowTrigger,
|
|
691
|
+
Wt as ModalWindowRoot,
|
|
692
|
+
Xt as default
|
|
692
693
|
};
|