@mortenbrudvik/waveui 0.14.0 → 0.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/README.md +142 -32
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +90 -82
- package/dist/components/data-display/InfoButton.mjs.map +1 -1
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +19 -18
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/feedback/MessageBarGroup.cjs +2 -0
- package/dist/components/feedback/MessageBarGroup.cjs.map +1 -0
- package/dist/components/feedback/MessageBarGroup.mjs +63 -0
- package/dist/components/feedback/MessageBarGroup.mjs.map +1 -0
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +41 -39
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +222 -216
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +124 -109
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +207 -193
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +149 -108
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- package/dist/components/layout/Tree.context.cjs +1 -1
- package/dist/components/layout/Tree.context.cjs.map +1 -1
- package/dist/components/layout/Tree.context.mjs +2 -1
- package/dist/components/layout/Tree.context.mjs.map +1 -1
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +178 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +154 -168
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +156 -136
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/NavDrawer.cjs +1 -1
- package/dist/components/navigation/NavDrawer.cjs.map +1 -1
- package/dist/components/navigation/NavDrawer.mjs +48 -45
- package/dist/components/navigation/NavDrawer.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +128 -122
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +1 -1
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.mjs +12 -12
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +97 -81
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Drawer.root.cjs +1 -1
- package/dist/components/overlays/Drawer.root.cjs.map +1 -1
- package/dist/components/overlays/Drawer.root.mjs +34 -31
- package/dist/components/overlays/Drawer.root.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +231 -216
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.mjs +202 -173
- package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.mjs +108 -99
- package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +66 -61
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +26 -23
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/hooks/useCollapsePresence.cjs +2 -0
- package/dist/hooks/useCollapsePresence.cjs.map +1 -0
- package/dist/hooks/useCollapsePresence.mjs +21 -0
- package/dist/hooks/useCollapsePresence.mjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.cjs +2 -0
- package/dist/hooks/useFocusBeforeClose.cjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.mjs +33 -0
- package/dist/hooks/useFocusBeforeClose.mjs.map +1 -0
- package/dist/hooks/useMotion.cjs +2 -0
- package/dist/hooks/useMotion.cjs.map +1 -0
- package/dist/hooks/useMotion.mjs +14 -0
- package/dist/hooks/useMotion.mjs.map +1 -0
- package/dist/hooks/usePresenceGroup.cjs +2 -0
- package/dist/hooks/usePresenceGroup.cjs.map +1 -0
- package/dist/hooks/usePresenceGroup.mjs +68 -0
- package/dist/hooks/usePresenceGroup.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +721 -131
- package/dist/index.d.ts +721 -131
- package/dist/index.mjs +136 -135
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +101 -90
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/motion.cjs +2 -0
- package/dist/lib/motion.cjs.map +1 -0
- package/dist/lib/motion.mjs +43 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
|
@@ -10,23 +10,27 @@ import { useId as c } from "../../hooks/useId.mjs";
|
|
|
10
10
|
import { focusElement as te, getFirstTabbable as l, isConnectedAndFocusable as u } from "../../lib/focus.mjs";
|
|
11
11
|
import { useMergedRefs as d } from "../../hooks/useMergedRefs.mjs";
|
|
12
12
|
import { useIsClient as f } from "../../hooks/useIsClient.mjs";
|
|
13
|
+
import { usePresence as p } from "../../hooks/usePresence.mjs";
|
|
13
14
|
import { resolvePositioning as ne, usePopupPosition as re } from "../../hooks/usePopupPosition.mjs";
|
|
14
|
-
import { useDismiss as
|
|
15
|
-
import { useRestoreFocus as
|
|
16
|
-
import { Portal as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
15
|
+
import { useDismiss as m } from "../../hooks/useDismiss.mjs";
|
|
16
|
+
import { useRestoreFocus as h } from "../../hooks/useRestoreFocus.mjs";
|
|
17
|
+
import { Portal as g } from "../portal/Portal.mjs";
|
|
18
|
+
import { popupMotion as _ } from "../../lib/motion.mjs";
|
|
19
|
+
import { useFocusBeforeClose as v } from "../../hooks/useFocusBeforeClose.mjs";
|
|
20
|
+
import { useHoverIntent as ie } from "../../hooks/useHoverIntent.mjs";
|
|
21
|
+
import { useMotionClasses as y } from "../../hooks/useMotion.mjs";
|
|
22
|
+
import { PopoverBeak as ae, getTabbableThrough as b, isFocusInSurfaceTree as x, usePopoverTabOrder as oe } from "./Popover.shared.mjs";
|
|
23
|
+
import { getTriggerFocusTarget as S, useTriggerElement as C, useTriggerFocusRef as se } from "../../hooks/useTriggerElement.mjs";
|
|
24
|
+
import { usePopupTarget as w } from "../../hooks/useResolvedTarget.mjs";
|
|
25
|
+
import { useContextMenuAnchor as ce } from "../../hooks/useContextMenuAnchor.mjs";
|
|
26
|
+
import * as T from "react";
|
|
27
|
+
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
24
28
|
//#region src/components/overlays/Popover.tsx
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
29
|
+
var k = T.createContext(null);
|
|
30
|
+
k.displayName = "PopoverContext";
|
|
31
|
+
var A = null;
|
|
32
|
+
function j() {
|
|
33
|
+
return A ??= {
|
|
30
34
|
open: !1,
|
|
31
35
|
setOpen: () => {},
|
|
32
36
|
contentId: "wave-popover-inert-content",
|
|
@@ -57,221 +61,230 @@ function O() {
|
|
|
57
61
|
arrowStyles: {},
|
|
58
62
|
placedSide: "bottom",
|
|
59
63
|
fitViewport: !1
|
|
60
|
-
},
|
|
64
|
+
}, A;
|
|
61
65
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
66
|
+
function M(e) {
|
|
67
|
+
return T.useContext(k) || (n(e, "Popover"), j());
|
|
64
68
|
}
|
|
65
|
-
function
|
|
69
|
+
function N(e, t) {
|
|
66
70
|
let n = (t ?? "").split(/\s+/).filter((t) => t && e.getElementById(t));
|
|
67
71
|
return n.length > 0 ? n.join(" ") : void 0;
|
|
68
72
|
}
|
|
69
|
-
function
|
|
73
|
+
function le(e, t) {
|
|
70
74
|
if (!e) return t;
|
|
71
|
-
let n = e.ownerDocument, r = (t ? n.getElementById(t) : null) ??
|
|
72
|
-
return
|
|
75
|
+
let n = e.ownerDocument, r = (t ? n.getElementById(t) : null) ?? S(e) ?? e;
|
|
76
|
+
return N(n, r.getAttribute("aria-labelledby")) ?? (r.id || e.id || void 0);
|
|
73
77
|
}
|
|
74
|
-
function
|
|
78
|
+
function ue(e, t) {
|
|
75
79
|
return t.split(/\s+/).some((t) => {
|
|
76
80
|
let n = t ? e.getElementById(t) : null;
|
|
77
81
|
return n ? n.getAttribute("aria-label")?.trim() || n.textContent?.trim() ? !0 : !!n.querySelector("[aria-label]:not([aria-label=\"\"]), [alt]:not([alt=\"\"]), [title]:not([title=\"\"])") : !1;
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
|
-
var
|
|
81
|
-
function
|
|
84
|
+
var P = () => () => {};
|
|
85
|
+
function de(e) {
|
|
82
86
|
return !!e && typeof e.nodeType == "number";
|
|
83
87
|
}
|
|
84
|
-
function
|
|
88
|
+
function fe(e) {
|
|
85
89
|
return { get current() {
|
|
86
90
|
return e();
|
|
87
91
|
} };
|
|
88
92
|
}
|
|
89
|
-
function
|
|
90
|
-
return
|
|
93
|
+
function pe(e, t, n) {
|
|
94
|
+
return S(e) ?? b(e, t, n);
|
|
91
95
|
}
|
|
92
|
-
var
|
|
93
|
-
let { target:
|
|
94
|
-
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}, [
|
|
101
|
-
let { setReference:
|
|
102
|
-
open:
|
|
96
|
+
var F = ({ open: e, defaultOpen: t, onOpenChange: n, side: ee = "bottom", align: i = "start", ignoreOutsideRefs: a, openOnHover: p = !1, openDelay: g = 250, closeDelay: _ = 500, openOnContext: y = !1, target: ae, positioning: b, children: C }) => {
|
|
97
|
+
let { target: E, pending: O } = w("Popover", ae, b), [A, j] = s(e, t ?? !1, n), M = T.useRef(!1), N = o((e) => {
|
|
98
|
+
M.current = !1, j(e);
|
|
99
|
+
}), le = T.useCallback(() => M.current, []), ue = f(), P = A && ue, [F, I] = T.useState("other"), [L, R] = T.useState(!1), [me, he] = T.useState(P), z = F;
|
|
100
|
+
P !== me && (he(P), P && (z = L ? "hover" : "other")), z !== F && I(z), L && R(!1);
|
|
101
|
+
let ge = c("popover-content"), [_e, ve] = T.useState(void 0), B = _e ?? ge, V = c("popover-trigger"), [H, ye] = T.useState(void 0), [U, be] = T.useState(null), [W, xe] = T.useState(null), G = T.useRef(null), K = T.useRef(null), Se = T.useRef(null), Ce = de(E) ? E : null, q = T.useRef(null);
|
|
102
|
+
T.useInsertionEffect(() => {
|
|
103
|
+
q.current = Ce;
|
|
104
|
+
}, [Ce]);
|
|
105
|
+
let { setReference: we, setFloating: Te, floatingProps: J, arrowStyles: Ee, side: De } = re({
|
|
106
|
+
open: P,
|
|
103
107
|
side: ee,
|
|
104
108
|
align: i,
|
|
105
|
-
arrowRef:
|
|
106
|
-
...ne(
|
|
107
|
-
}),
|
|
108
|
-
...
|
|
109
|
+
arrowRef: Se,
|
|
110
|
+
...ne(b, { offset: 8 })
|
|
111
|
+
}), Oe = T.useMemo(() => O ? {
|
|
112
|
+
...J,
|
|
109
113
|
style: {
|
|
110
|
-
...
|
|
114
|
+
...J.style,
|
|
111
115
|
visibility: "hidden"
|
|
112
116
|
}
|
|
113
|
-
} :
|
|
114
|
-
let e =
|
|
117
|
+
} : J, [O, J]), ke = T.useRef(null), Y = o(() => {
|
|
118
|
+
let e = y ? ke.current?.current : null;
|
|
115
119
|
if (e && u(e)) return e;
|
|
116
|
-
let t =
|
|
120
|
+
let t = G.current, n = t ? S(t) : null;
|
|
117
121
|
if (n) return n;
|
|
118
|
-
let r =
|
|
122
|
+
let r = q.current;
|
|
119
123
|
return r && u(r) ? r : t;
|
|
120
|
-
}),
|
|
121
|
-
open:
|
|
122
|
-
onDismiss: () =>
|
|
123
|
-
refs:
|
|
124
|
+
}), Ae = T.useMemo(() => fe(Y), [Y]), je = o((e) => !(e.ctrlKey && G.current?.contains(e.target))), { layerId: X } = m({
|
|
125
|
+
open: P,
|
|
126
|
+
onDismiss: () => N(!1),
|
|
127
|
+
refs: y ? [
|
|
128
|
+
K,
|
|
124
129
|
q,
|
|
125
|
-
J,
|
|
126
130
|
...a ?? []
|
|
127
131
|
] : [
|
|
128
|
-
q,
|
|
129
132
|
K,
|
|
130
|
-
|
|
133
|
+
G,
|
|
134
|
+
q,
|
|
131
135
|
...a ?? []
|
|
132
136
|
],
|
|
133
|
-
anchorRef:
|
|
137
|
+
anchorRef: Ae,
|
|
134
138
|
kind: "popover",
|
|
135
|
-
outsidePress: !
|
|
136
|
-
}), Z =
|
|
137
|
-
enabled:
|
|
138
|
-
open:
|
|
139
|
-
trigger:
|
|
139
|
+
outsidePress: !y || je
|
|
140
|
+
}), Z = T.useRef(!1), { anchor: Me, fromContext: Ne, origin: Pe, opener: Q, triggerHandlers: Fe, surfaceHandlers: Ie } = ce({
|
|
141
|
+
enabled: y,
|
|
142
|
+
open: P,
|
|
143
|
+
trigger: W,
|
|
140
144
|
layerId: X,
|
|
141
145
|
onOpen: (e) => {
|
|
142
|
-
Z.current = e === "keyboard",
|
|
146
|
+
Z.current = e === "keyboard", N(!0);
|
|
143
147
|
},
|
|
144
|
-
onClose: () =>
|
|
148
|
+
onClose: () => N(!1)
|
|
145
149
|
});
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
T.useInsertionEffect(() => {
|
|
151
|
+
ke.current = Q;
|
|
148
152
|
}, [Q]);
|
|
149
|
-
let
|
|
150
|
-
|
|
151
|
-
enabled:
|
|
152
|
-
container:
|
|
153
|
-
triggerRef:
|
|
154
|
-
finalFocusRef:
|
|
155
|
-
fallback:
|
|
153
|
+
let Le = se(G);
|
|
154
|
+
h({
|
|
155
|
+
enabled: P,
|
|
156
|
+
container: U,
|
|
157
|
+
triggerRef: y ? void 0 : Le,
|
|
158
|
+
finalFocusRef: y ? Q : void 0,
|
|
159
|
+
fallback: Y,
|
|
156
160
|
onlyIfFocusInside: !0,
|
|
157
|
-
isHoverClose:
|
|
158
|
-
}),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
isHoverClose: le
|
|
162
|
+
}), v({
|
|
163
|
+
open: P,
|
|
164
|
+
surfaceRef: K,
|
|
165
|
+
captureOpener: () => y ? null : Le.current,
|
|
166
|
+
candidates: (e) => [
|
|
167
|
+
y ? Q.current : null,
|
|
168
|
+
e,
|
|
169
|
+
Y()
|
|
170
|
+
]
|
|
171
|
+
}), T.useLayoutEffect(() => {
|
|
172
|
+
P && (M.current = !1);
|
|
173
|
+
}, [P]);
|
|
174
|
+
let Re = d(G, xe), ze = d(K, be, Te);
|
|
175
|
+
T.useLayoutEffect(() => {
|
|
176
|
+
we(Ne ? Me ?? (W && (S(W) ?? W)) : E ?? W);
|
|
164
177
|
}, [
|
|
165
|
-
je,
|
|
166
178
|
Me,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
Ne,
|
|
180
|
+
E,
|
|
181
|
+
W,
|
|
182
|
+
we
|
|
183
|
+
]), T.useLayoutEffect(() => {
|
|
171
184
|
if (Z.current) {
|
|
172
|
-
if (!
|
|
185
|
+
if (!P) {
|
|
173
186
|
Z.current = !1;
|
|
174
187
|
return;
|
|
175
188
|
}
|
|
176
|
-
|
|
189
|
+
U && (Z.current = !1, te(l(U) ?? U, { preventScroll: !0 }));
|
|
177
190
|
}
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
}, [
|
|
181
|
-
let $ =
|
|
191
|
+
}), T.useEffect(() => {
|
|
192
|
+
p && y && r("Popover:hover-and-context", "Popover: `openOnHover` is ignored with `openOnContext`: a context popover opens on a right click, Shift+F10 or the ContextMenu key, not on hover.");
|
|
193
|
+
}, [p, y]);
|
|
194
|
+
let $ = p && !y, Be = o(() => z === "hover" && !x(K.current, X)), { triggerHandlers: Ve, surfaceHandlers: He, cancel: Ue } = ie({
|
|
182
195
|
enabled: $,
|
|
183
|
-
open:
|
|
184
|
-
openDelay:
|
|
185
|
-
closeDelay:
|
|
186
|
-
trigger:
|
|
187
|
-
surface:
|
|
196
|
+
open: P,
|
|
197
|
+
openDelay: g,
|
|
198
|
+
closeDelay: _,
|
|
199
|
+
trigger: W,
|
|
200
|
+
surface: U,
|
|
188
201
|
onOpen: () => {
|
|
189
|
-
R(!0),
|
|
202
|
+
R(!0), N(!0);
|
|
190
203
|
},
|
|
191
204
|
onClose: () => {
|
|
192
|
-
|
|
205
|
+
M.current = !0, j(!1);
|
|
193
206
|
},
|
|
194
|
-
canClose:
|
|
195
|
-
}), Ue = o(() => {
|
|
196
|
-
He(), F && V === "hover" ? L("other") : M((e) => !e);
|
|
207
|
+
canClose: Be
|
|
197
208
|
}), We = o(() => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
Ue(), P && z === "hover" ? I("other") : N((e) => !e);
|
|
210
|
+
}), Ge = o(() => {
|
|
211
|
+
let e = G.current, t = y ? Q.current : null;
|
|
212
|
+
return t && e?.contains(t) ? t : e ?? q.current;
|
|
213
|
+
}), Ke = T.useMemo(() => fe(Ge), [Ge]), qe = o((e) => {
|
|
214
|
+
if (e.key !== "Tab" || e.shiftKey || !P) return;
|
|
215
|
+
if (y) {
|
|
216
|
+
let t = Ge();
|
|
217
|
+
if (!t || e.target !== (S(t) ?? t)) return;
|
|
205
218
|
}
|
|
206
|
-
let t =
|
|
219
|
+
let t = K.current, n = t ? l(t) : null;
|
|
207
220
|
n && (e.preventDefault(), n.focus());
|
|
208
|
-
}),
|
|
209
|
-
enabled:
|
|
210
|
-
surface:
|
|
211
|
-
anchorRef:
|
|
212
|
-
getPreviousStop:
|
|
213
|
-
}),
|
|
214
|
-
open:
|
|
215
|
-
setOpen:
|
|
216
|
-
contentId:
|
|
217
|
-
setCustomContentId:
|
|
218
|
-
triggerId:
|
|
219
|
-
resolvedTriggerId:
|
|
220
|
-
setResolvedTriggerId:
|
|
221
|
-
triggerRef:
|
|
222
|
-
triggerElement:
|
|
223
|
-
triggerElementRef:
|
|
224
|
-
surfaceElementRef:
|
|
225
|
-
arrowRef:
|
|
226
|
-
onTriggerClick:
|
|
227
|
-
onTriggerKeyDown:
|
|
228
|
-
hoverTriggerHandlers: $ ?
|
|
229
|
-
hoverSurfaceHandlers: $ ?
|
|
230
|
-
contextMode:
|
|
231
|
-
contextTriggerHandlers:
|
|
232
|
-
onContentContextMenu:
|
|
233
|
-
keyboardContext:
|
|
234
|
-
onContentKeyDown:
|
|
221
|
+
}), Je = oe({
|
|
222
|
+
enabled: P,
|
|
223
|
+
surface: U,
|
|
224
|
+
anchorRef: Ke,
|
|
225
|
+
getPreviousStop: pe
|
|
226
|
+
}), Ye = Ne && Pe === "keyboard", Xe = T.useMemo(() => ({
|
|
227
|
+
open: P,
|
|
228
|
+
setOpen: N,
|
|
229
|
+
contentId: B,
|
|
230
|
+
setCustomContentId: ve,
|
|
231
|
+
triggerId: V,
|
|
232
|
+
resolvedTriggerId: H,
|
|
233
|
+
setResolvedTriggerId: ye,
|
|
234
|
+
triggerRef: G,
|
|
235
|
+
triggerElement: W,
|
|
236
|
+
triggerElementRef: Re,
|
|
237
|
+
surfaceElementRef: ze,
|
|
238
|
+
arrowRef: Se,
|
|
239
|
+
onTriggerClick: We,
|
|
240
|
+
onTriggerKeyDown: qe,
|
|
241
|
+
hoverTriggerHandlers: $ ? Ve : null,
|
|
242
|
+
hoverSurfaceHandlers: $ ? He : null,
|
|
243
|
+
contextMode: y,
|
|
244
|
+
contextTriggerHandlers: y ? Fe : null,
|
|
245
|
+
onContentContextMenu: Ie.onContextMenu,
|
|
246
|
+
keyboardContext: Ye,
|
|
247
|
+
onContentKeyDown: Je,
|
|
235
248
|
layerId: X,
|
|
236
|
-
floatingProps:
|
|
237
|
-
arrowStyles:
|
|
238
|
-
placedSide:
|
|
239
|
-
fitViewport:
|
|
249
|
+
floatingProps: Oe,
|
|
250
|
+
arrowStyles: Ee,
|
|
251
|
+
placedSide: De,
|
|
252
|
+
fitViewport: b?.fitViewport === !0
|
|
240
253
|
}), [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
Le,
|
|
254
|
+
P,
|
|
255
|
+
N,
|
|
256
|
+
B,
|
|
257
|
+
V,
|
|
258
|
+
H,
|
|
259
|
+
W,
|
|
248
260
|
Re,
|
|
249
|
-
|
|
250
|
-
|
|
261
|
+
ze,
|
|
262
|
+
We,
|
|
263
|
+
qe,
|
|
251
264
|
$,
|
|
252
|
-
Be,
|
|
253
265
|
Ve,
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
He,
|
|
267
|
+
y,
|
|
256
268
|
Fe,
|
|
269
|
+
Ie,
|
|
270
|
+
Ye,
|
|
257
271
|
Je,
|
|
258
|
-
qe,
|
|
259
272
|
X,
|
|
273
|
+
Oe,
|
|
260
274
|
Ee,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
T?.fitViewport
|
|
275
|
+
De,
|
|
276
|
+
b?.fitViewport
|
|
264
277
|
]);
|
|
265
|
-
return /* @__PURE__ */
|
|
266
|
-
value:
|
|
267
|
-
children:
|
|
278
|
+
return /* @__PURE__ */ D(k.Provider, {
|
|
279
|
+
value: Xe,
|
|
280
|
+
children: C
|
|
268
281
|
});
|
|
269
282
|
};
|
|
270
|
-
|
|
271
|
-
var
|
|
272
|
-
let { open: u, contentId: f, triggerId:
|
|
283
|
+
F.displayName = "Popover";
|
|
284
|
+
var I = ({ children: e, asChild: t, id: n, onClick: r, onKeyDown: ee, onContextMenu: a, onPointerEnter: o, onPointerMove: s, onPointerLeave: c, ref: te, ...l }) => {
|
|
285
|
+
let { open: u, contentId: f, triggerId: p, triggerElementRef: ne, setResolvedTriggerId: re, onTriggerClick: m, onTriggerKeyDown: h, hoverTriggerHandlers: g, contextMode: _, contextTriggerHandlers: v } = M("Popover.Trigger"), ie = d(te, ne), y = {
|
|
273
286
|
...l,
|
|
274
|
-
id: n ??
|
|
287
|
+
id: n ?? p,
|
|
275
288
|
"aria-haspopup": "dialog",
|
|
276
289
|
"aria-expanded": !_ && u,
|
|
277
290
|
"aria-controls": u && !_ ? f : void 0,
|
|
@@ -281,93 +294,95 @@ var P = ({ children: e, asChild: t, id: n, onClick: r, onKeyDown: ee, onContextM
|
|
|
281
294
|
onPointerEnter: g ? i(o, g.onPointerEnter) : o,
|
|
282
295
|
onPointerMove: g ? i(s, g.onPointerMove) : s,
|
|
283
296
|
onPointerLeave: g ? i(c, g.onPointerLeave) : c,
|
|
284
|
-
ref:
|
|
297
|
+
ref: ie
|
|
285
298
|
};
|
|
286
|
-
return
|
|
299
|
+
return C(e, y, {
|
|
287
300
|
componentName: "Popover.Trigger",
|
|
288
301
|
asChild: t,
|
|
289
|
-
onResolvedId:
|
|
302
|
+
onResolvedId: re,
|
|
290
303
|
omitStateAria: _
|
|
291
304
|
});
|
|
292
305
|
};
|
|
293
|
-
|
|
294
|
-
var
|
|
295
|
-
let { open:
|
|
296
|
-
if (!
|
|
306
|
+
I.displayName = "PopoverTrigger";
|
|
307
|
+
var L = ({ children: n, title: o, id: s, className: te, style: l, "aria-label": u, "aria-labelledby": f, onKeyDown: ne, onContextMenu: re, onPointerEnter: m, onPointerLeave: h, motion: v, ref: ie, ...b }) => {
|
|
308
|
+
let { open: x, contentId: oe, setCustomContentId: S, resolvedTriggerId: C, triggerRef: se, triggerElement: w, surfaceElementRef: ce, arrowRef: k, layerId: A, floatingProps: j, arrowStyles: N, placedSide: de, fitViewport: fe, onContentKeyDown: pe, hoverSurfaceHandlers: F, contextMode: I, onContentContextMenu: L, keyboardContext: R } = M("Popover.Content"), me = c("popover-title"), { isMounted: he, ref: z, presenceProps: ge } = p(x, { appear: !0 }), _e = y(v, _), ve = d(ie, ce, z), B = ee(o), V = f === void 0 && !u && !B, H = x && V && !I, ye = T.useCallback((e) => {
|
|
309
|
+
if (!H || !w || typeof MutationObserver > "u") return P();
|
|
297
310
|
let t = new MutationObserver(e);
|
|
298
|
-
return t.observe(
|
|
311
|
+
return t.observe(w, {
|
|
299
312
|
attributes: !0,
|
|
300
313
|
attributeFilter: ["id", "aria-labelledby"],
|
|
301
314
|
childList: !0,
|
|
302
315
|
subtree: !0
|
|
303
316
|
}), () => t.disconnect();
|
|
304
|
-
}, [
|
|
305
|
-
if (
|
|
306
|
-
|
|
317
|
+
}, [H, w]), U = T.useSyncExternalStore(ye, () => H ? le(w, C) : void 0, () => H ? C : void 0), be = f ?? (u ? void 0 : B ? me : U), W = s || void 0;
|
|
318
|
+
if (T.useEffect(() => (S(W), () => S(void 0)), [W, S]), T.useEffect(() => {
|
|
319
|
+
x && V && I && t && r("Popover.Content:name", "Popover.Content: the popover has no accessible name. A context popover (openOnContext) is not named by its region: pass `title`, `aria-label` or `aria-labelledby`.");
|
|
307
320
|
}, [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
]),
|
|
312
|
-
if (!
|
|
313
|
-
let e =
|
|
321
|
+
x,
|
|
322
|
+
V,
|
|
323
|
+
I
|
|
324
|
+
]), T.useEffect(() => {
|
|
325
|
+
if (!H || !t) return;
|
|
326
|
+
let e = se.current;
|
|
314
327
|
if (!e) {
|
|
315
328
|
r("Popover.Content:name", "Popover.Content: the popover has no accessible name. Pass `title`, `aria-label` or `aria-labelledby`, or open it from a Popover.Trigger.");
|
|
316
329
|
return;
|
|
317
330
|
}
|
|
318
|
-
let n =
|
|
319
|
-
n ?
|
|
331
|
+
let n = le(e, C);
|
|
332
|
+
n ? ue(e.ownerDocument, n) || r("Popover.Content:trigger-name", "Popover.Content: the popover is named by its trigger, but the trigger has no text to name it (an icon-only trigger needs `aria-label`, or `aria-labelledby` pointing at text), so the popover has no accessible name. Name the trigger, or pass `title`, `aria-label` or `aria-labelledby`.") : r("Popover.Content:trigger-id", "Popover.Content: the popover is named by its trigger, but the trigger element has no `id` (a render-prop child of Popover.Trigger must spread the `id` it receives), so the popover has no accessible name. Spread every trigger prop onto the element, or pass `title`, `aria-label` or `aria-labelledby`.");
|
|
320
333
|
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
]), !
|
|
326
|
-
let
|
|
327
|
-
id:
|
|
334
|
+
H,
|
|
335
|
+
C,
|
|
336
|
+
se,
|
|
337
|
+
U
|
|
338
|
+
]), !he) return null;
|
|
339
|
+
let xe = /* @__PURE__ */ O(E, { children: [B && /* @__PURE__ */ D("h2", {
|
|
340
|
+
id: me,
|
|
328
341
|
className: e(a.title, "mb-2 text-subtitle-2 font-semibold"),
|
|
329
342
|
children: o
|
|
330
343
|
}), n] });
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
layerId:
|
|
333
|
-
children: /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ D(g, {
|
|
345
|
+
layerId: A,
|
|
346
|
+
children: /* @__PURE__ */ O("div", {
|
|
334
347
|
role: "dialog",
|
|
335
348
|
"aria-label": u,
|
|
336
|
-
"aria-labelledby":
|
|
337
|
-
tabIndex:
|
|
338
|
-
...
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"data-
|
|
349
|
+
"aria-labelledby": be,
|
|
350
|
+
tabIndex: R ? -1 : void 0,
|
|
351
|
+
...b,
|
|
352
|
+
...ge,
|
|
353
|
+
ref: ve,
|
|
354
|
+
id: W ?? oe,
|
|
355
|
+
"data-state": x ? "open" : "closed",
|
|
356
|
+
"data-side": j["data-side"],
|
|
357
|
+
"data-align": j["data-align"],
|
|
343
358
|
style: {
|
|
344
359
|
...l,
|
|
345
|
-
...
|
|
360
|
+
...j.style
|
|
346
361
|
},
|
|
347
|
-
onKeyDown: i(ne,
|
|
348
|
-
onContextMenu: i(re,
|
|
349
|
-
onPointerEnter:
|
|
350
|
-
onPointerLeave:
|
|
351
|
-
className: e(a.root, "w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4", te),
|
|
352
|
-
children: [/* @__PURE__ */
|
|
353
|
-
ref:
|
|
354
|
-
side:
|
|
355
|
-
style:
|
|
362
|
+
onKeyDown: i(ne, pe),
|
|
363
|
+
onContextMenu: i(re, L),
|
|
364
|
+
onPointerEnter: F ? i(m, F.onPointerEnter) : m,
|
|
365
|
+
onPointerLeave: F ? i(h, F.onPointerLeave) : h,
|
|
366
|
+
className: e(a.root, "w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4", _e, te),
|
|
367
|
+
children: [/* @__PURE__ */ D(ae, {
|
|
368
|
+
ref: k,
|
|
369
|
+
side: de,
|
|
370
|
+
style: N,
|
|
356
371
|
"data-wave-popover-arrow": "",
|
|
357
372
|
className: a.beak
|
|
358
|
-
}),
|
|
373
|
+
}), fe ? /* @__PURE__ */ D("div", {
|
|
359
374
|
className: "overflow-y-auto max-h-[calc(var(--wave-popup-available-height)-2rem-2px)]",
|
|
360
|
-
children:
|
|
361
|
-
}) :
|
|
375
|
+
children: xe
|
|
376
|
+
}) : xe]
|
|
362
377
|
})
|
|
363
378
|
});
|
|
364
379
|
};
|
|
365
|
-
|
|
366
|
-
var
|
|
367
|
-
Trigger:
|
|
368
|
-
Content:
|
|
380
|
+
L.displayName = "PopoverContent";
|
|
381
|
+
var R = /* @__PURE__ */ Object.assign(F, {
|
|
382
|
+
Trigger: I,
|
|
383
|
+
Content: L
|
|
369
384
|
});
|
|
370
385
|
//#endregion
|
|
371
|
-
export {
|
|
386
|
+
export { R as Popover, L as PopoverContent, I as PopoverTrigger };
|
|
372
387
|
|
|
373
388
|
//# sourceMappingURL=Popover.mjs.map
|