@mortenbrudvik/waveui 0.8.0 → 0.10.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 +634 -167
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- 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 +39 -96
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/input/Calendar.cjs +2 -0
- package/dist/components/input/Calendar.cjs.map +1 -0
- package/dist/components/input/Calendar.mjs +352 -0
- package/dist/components/input/Calendar.mjs.map +1 -0
- package/dist/components/input/Calendar.views.cjs +2 -0
- package/dist/components/input/Calendar.views.cjs.map +1 -0
- package/dist/components/input/Calendar.views.mjs +194 -0
- package/dist/components/input/Calendar.views.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +91 -75
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorArea.cjs +1 -1
- package/dist/components/input/ColorArea.cjs.map +1 -1
- package/dist/components/input/ColorArea.mjs +18 -18
- package/dist/components/input/ColorArea.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +1 -1
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.mjs +1 -1
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +20 -20
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +219 -138
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Combobox.text.cjs +2 -0
- package/dist/components/input/Combobox.text.cjs.map +1 -0
- package/dist/components/input/Combobox.text.mjs +24 -0
- package/dist/components/input/Combobox.text.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +205 -286
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +137 -105
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +99 -66
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +79 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -13
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +2 -0
- package/dist/components/input/Listbox.cjs.map +1 -0
- package/dist/components/input/Listbox.mjs +134 -0
- package/dist/components/input/Listbox.mjs.map +1 -0
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +158 -97
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +150 -151
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +146 -115
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -25
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +77 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +198 -96
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs +2 -0
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.context.mjs +35 -0
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +131 -103
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
- package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
- package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +71 -55
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +154 -123
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +28 -21
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +204 -199
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/dateUtils.cjs +1 -1
- package/dist/components/input/dateUtils.cjs.map +1 -1
- package/dist/components/input/dateUtils.mjs +114 -96
- package/dist/components/input/dateUtils.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerLabels.cjs +2 -0
- package/dist/components/input/pickerLabels.cjs.map +1 -0
- package/dist/components/input/pickerLabels.mjs +16 -0
- package/dist/components/input/pickerLabels.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/input/pickerValues.cjs +2 -0
- package/dist/components/input/pickerValues.cjs.map +1 -0
- package/dist/components/input/pickerValues.mjs +24 -0
- package/dist/components/input/pickerValues.mjs.map +1 -0
- 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 +10 -10
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +10 -10
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +203 -208
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.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 +25 -19
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +67 -70
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +2 -0
- package/dist/hooks/useActiveDescendant.cjs.map +1 -0
- package/dist/hooks/useActiveDescendant.mjs +56 -0
- package/dist/hooks/useActiveDescendant.mjs.map +1 -0
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +250 -210
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +2 -0
- package/dist/hooks/useRovingGrid.cjs.map +1 -0
- package/dist/hooks/useRovingGrid.mjs +69 -0
- package/dist/hooks/useRovingGrid.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2901 -203
- package/dist/index.d.ts +2901 -203
- package/dist/index.mjs +107 -99
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +111 -67
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/date.cjs +2 -0
- package/dist/lib/date.cjs.map +1 -0
- package/dist/lib/date.mjs +44 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/focus.cjs +1 -1
- package/dist/lib/focus.cjs.map +1 -1
- package/dist/lib/focus.mjs +5 -2
- package/dist/lib/focus.mjs.map +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/cn.mjs";
|
|
3
3
|
import { isDev as t, reportMissingContext as n, warnOnce as r } from "../../lib/dev.mjs";
|
|
4
|
-
import { slotRendersContent as
|
|
5
|
-
import { composeEventHandlers as
|
|
6
|
-
import { popoverContentClassNames as
|
|
7
|
-
import { useEventCallback as
|
|
8
|
-
import { useControllable as
|
|
9
|
-
import { useId as
|
|
10
|
-
import { focusElement as
|
|
11
|
-
import { useMergedRefs as
|
|
12
|
-
import { useIsClient as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { useContextMenuAnchor as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { jsx as D, jsxs as ne } from "react/jsx-runtime";
|
|
4
|
+
import { slotRendersContent as ee } from "../../lib/slot.mjs";
|
|
5
|
+
import { composeEventHandlers as i } from "../../lib/composeEventHandlers.mjs";
|
|
6
|
+
import { popoverContentClassNames as a } from "../../lib/classNames.mjs";
|
|
7
|
+
import { useEventCallback as o } from "../../hooks/useEventCallback.mjs";
|
|
8
|
+
import { useControllable as s } from "../../hooks/useControllable.mjs";
|
|
9
|
+
import { useId as c } from "../../hooks/useId.mjs";
|
|
10
|
+
import { focusElement as te, getFirstTabbable as l, isConnectedAndFocusable as u } from "../../lib/focus.mjs";
|
|
11
|
+
import { useMergedRefs as d } from "../../hooks/useMergedRefs.mjs";
|
|
12
|
+
import { useIsClient as f } from "../../hooks/useIsClient.mjs";
|
|
13
|
+
import { useDismiss as ne } from "../../hooks/useDismiss.mjs";
|
|
14
|
+
import { Portal as p } from "../portal/Portal.mjs";
|
|
15
|
+
import { usePopupPosition as re } from "../../hooks/usePopupPosition.mjs";
|
|
16
|
+
import { useRestoreFocus as m } from "../../hooks/useRestoreFocus.mjs";
|
|
17
|
+
import { useHoverIntent as h } from "../../hooks/useHoverIntent.mjs";
|
|
18
|
+
import { PopoverBeak as g, getTabbableThrough as _, isFocusInSurfaceTree as v, usePopoverTabOrder as y } from "./Popover.shared.mjs";
|
|
19
|
+
import { getTriggerFocusTarget as b, useTriggerElement as x, useTriggerFocusRef as S } from "../../hooks/useTriggerElement.mjs";
|
|
20
|
+
import { useContextMenuAnchor as ie } from "../../hooks/useContextMenuAnchor.mjs";
|
|
21
|
+
import * as C from "react";
|
|
22
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
24
23
|
//#region src/components/overlays/Popover.tsx
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
24
|
+
var E = C.createContext(null);
|
|
25
|
+
E.displayName = "PopoverContext";
|
|
26
|
+
var D = null;
|
|
27
|
+
function O() {
|
|
28
|
+
return D ??= {
|
|
30
29
|
open: !1,
|
|
31
30
|
setOpen: () => {},
|
|
32
31
|
contentId: "wave-popover-inert-content",
|
|
@@ -56,190 +55,186 @@ function A() {
|
|
|
56
55
|
},
|
|
57
56
|
arrowStyles: {},
|
|
58
57
|
placedSide: "bottom"
|
|
59
|
-
},
|
|
58
|
+
}, D;
|
|
60
59
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
60
|
+
function k(e) {
|
|
61
|
+
return C.useContext(E) || (n(e, "Popover"), O());
|
|
63
62
|
}
|
|
64
|
-
function
|
|
63
|
+
function A(e, t) {
|
|
65
64
|
let n = (t ?? "").split(/\s+/).filter((t) => t && e.getElementById(t));
|
|
66
65
|
return n.length > 0 ? n.join(" ") : void 0;
|
|
67
66
|
}
|
|
68
|
-
function
|
|
67
|
+
function j(e, t) {
|
|
69
68
|
if (!e) return t;
|
|
70
|
-
let n = e.ownerDocument, r = (t ? n.getElementById(t) : null) ??
|
|
71
|
-
return
|
|
69
|
+
let n = e.ownerDocument, r = (t ? n.getElementById(t) : null) ?? b(e) ?? e;
|
|
70
|
+
return A(n, r.getAttribute("aria-labelledby")) ?? (r.id || e.id || void 0);
|
|
72
71
|
}
|
|
73
|
-
function
|
|
72
|
+
function ae(e, t) {
|
|
74
73
|
return t.split(/\s+/).some((t) => {
|
|
75
74
|
let n = t ? e.getElementById(t) : null;
|
|
76
75
|
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;
|
|
77
76
|
});
|
|
78
77
|
}
|
|
79
|
-
var
|
|
80
|
-
function
|
|
81
|
-
let n = e?.ownerDocument.activeElement;
|
|
82
|
-
return !e || !n ? !1 : e.contains(n) ? !0 : m(t, { includeOwnElements: !1 }).some((e) => e.contains(n));
|
|
83
|
-
}
|
|
84
|
-
function ae(e) {
|
|
78
|
+
var oe = () => () => {};
|
|
79
|
+
function M(e) {
|
|
85
80
|
return !!e && typeof e.nodeType == "number";
|
|
86
81
|
}
|
|
87
|
-
function
|
|
82
|
+
function se(e) {
|
|
88
83
|
return { get current() {
|
|
89
84
|
return e();
|
|
90
85
|
} };
|
|
91
86
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
87
|
+
function ce(e, t, n) {
|
|
88
|
+
return b(e) ?? _(e, t, n);
|
|
94
89
|
}
|
|
95
|
-
var
|
|
96
|
-
let [
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
N !==
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, [
|
|
104
|
-
let { setReference:
|
|
90
|
+
var N = ({ open: e, defaultOpen: t, onOpenChange: n, side: ee = "bottom", align: i = "start", ignoreOutsideRefs: a, openOnHover: p = !1, openDelay: g = 250, closeDelay: _ = 500, openOnContext: x = !1, target: T, children: D }) => {
|
|
91
|
+
let [O, k] = s(e, t ?? !1, n), A = C.useRef(!1), j = o((e) => {
|
|
92
|
+
A.current = !1, k(e);
|
|
93
|
+
}), ae = C.useCallback(() => A.current, []), oe = f(), N = O && oe, [P, F] = C.useState("other"), [I, L] = C.useState(!1), [R, le] = C.useState(N), z = P;
|
|
94
|
+
N !== R && (le(N), N && (z = I ? "hover" : "other")), z !== P && F(z), I && L(!1);
|
|
95
|
+
let B = c("popover-content"), [V, ue] = C.useState(void 0), H = V ?? B, de = c("popover-trigger"), [U, fe] = C.useState(void 0), [W, pe] = C.useState(null), [G, me] = C.useState(null), K = C.useRef(null), q = C.useRef(null), he = C.useRef(null), ge = M(T) ? T : null, J = C.useRef(null);
|
|
96
|
+
C.useInsertionEffect(() => {
|
|
97
|
+
J.current = ge;
|
|
98
|
+
}, [ge]);
|
|
99
|
+
let { setReference: _e, setFloating: ve, floatingProps: ye, arrowStyles: be, side: xe } = re({
|
|
105
100
|
open: N,
|
|
106
|
-
side:
|
|
107
|
-
align:
|
|
101
|
+
side: ee,
|
|
102
|
+
align: i,
|
|
108
103
|
offset: 8,
|
|
109
|
-
arrowRef:
|
|
110
|
-
}),
|
|
111
|
-
let e =
|
|
112
|
-
if (e &&
|
|
113
|
-
let t =
|
|
104
|
+
arrowRef: he
|
|
105
|
+
}), Se = C.useRef(null), Y = o(() => {
|
|
106
|
+
let e = x ? Se.current?.current : null;
|
|
107
|
+
if (e && u(e)) return e;
|
|
108
|
+
let t = K.current, n = t ? b(t) : null;
|
|
114
109
|
if (n) return n;
|
|
115
|
-
let r =
|
|
116
|
-
return r &&
|
|
117
|
-
}), Ce =
|
|
110
|
+
let r = J.current;
|
|
111
|
+
return r && u(r) ? r : t;
|
|
112
|
+
}), Ce = C.useMemo(() => se(Y), [Y]), we = o((e) => !(e.ctrlKey && K.current?.contains(e.target))), { layerId: X } = ne({
|
|
118
113
|
open: N,
|
|
119
|
-
onDismiss: () =>
|
|
120
|
-
refs:
|
|
114
|
+
onDismiss: () => j(!1),
|
|
115
|
+
refs: x ? [
|
|
116
|
+
q,
|
|
121
117
|
J,
|
|
122
|
-
|
|
123
|
-
...o ?? []
|
|
118
|
+
...a ?? []
|
|
124
119
|
] : [
|
|
125
|
-
J,
|
|
126
120
|
q,
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
K,
|
|
122
|
+
J,
|
|
123
|
+
...a ?? []
|
|
129
124
|
],
|
|
130
125
|
anchorRef: Ce,
|
|
131
126
|
kind: "popover",
|
|
132
|
-
outsidePress: !
|
|
133
|
-
}), Z =
|
|
134
|
-
enabled:
|
|
127
|
+
outsidePress: !x || we
|
|
128
|
+
}), Z = C.useRef(!1), { anchor: Te, fromContext: Ee, origin: De, opener: Q, triggerHandlers: Oe, surfaceHandlers: ke } = ie({
|
|
129
|
+
enabled: x,
|
|
135
130
|
open: N,
|
|
136
|
-
trigger:
|
|
131
|
+
trigger: G,
|
|
137
132
|
layerId: X,
|
|
138
133
|
onOpen: (e) => {
|
|
139
|
-
Z.current = e === "keyboard",
|
|
134
|
+
Z.current = e === "keyboard", j(!0);
|
|
140
135
|
},
|
|
141
|
-
onClose: () =>
|
|
136
|
+
onClose: () => j(!1)
|
|
142
137
|
});
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
C.useInsertionEffect(() => {
|
|
139
|
+
Se.current = Q;
|
|
145
140
|
}, [Q]);
|
|
146
|
-
let Ae =
|
|
147
|
-
|
|
141
|
+
let Ae = S(K);
|
|
142
|
+
m({
|
|
148
143
|
enabled: N,
|
|
149
|
-
container:
|
|
150
|
-
triggerRef:
|
|
151
|
-
finalFocusRef:
|
|
152
|
-
fallback:
|
|
144
|
+
container: W,
|
|
145
|
+
triggerRef: x ? void 0 : Ae,
|
|
146
|
+
finalFocusRef: x ? Q : void 0,
|
|
147
|
+
fallback: Y,
|
|
153
148
|
onlyIfFocusInside: !0,
|
|
154
|
-
isHoverClose:
|
|
155
|
-
}),
|
|
156
|
-
N && (
|
|
149
|
+
isHoverClose: ae
|
|
150
|
+
}), C.useLayoutEffect(() => {
|
|
151
|
+
N && (A.current = !1);
|
|
157
152
|
}, [N]);
|
|
158
|
-
let je =
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
let je = d(K, me), Me = d(q, pe, ve);
|
|
154
|
+
C.useLayoutEffect(() => {
|
|
155
|
+
_e(Ee ? Te ?? (G && (b(G) ?? G)) : T ?? G);
|
|
161
156
|
}, [
|
|
162
157
|
Te,
|
|
163
158
|
Ee,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
]),
|
|
159
|
+
T,
|
|
160
|
+
G,
|
|
161
|
+
_e
|
|
162
|
+
]), C.useLayoutEffect(() => {
|
|
168
163
|
if (Z.current) {
|
|
169
164
|
if (!N) {
|
|
170
165
|
Z.current = !1;
|
|
171
166
|
return;
|
|
172
167
|
}
|
|
173
|
-
|
|
168
|
+
W && (Z.current = !1, te(l(W) ?? W, { preventScroll: !0 }));
|
|
174
169
|
}
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
}, [
|
|
178
|
-
let $ =
|
|
170
|
+
}), C.useEffect(() => {
|
|
171
|
+
p && x && 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.");
|
|
172
|
+
}, [p, x]);
|
|
173
|
+
let $ = p && !x, Ne = o(() => z === "hover" && !v(q.current, X)), { triggerHandlers: Pe, surfaceHandlers: Fe, cancel: Ie } = h({
|
|
179
174
|
enabled: $,
|
|
180
175
|
open: N,
|
|
181
176
|
openDelay: g,
|
|
182
|
-
closeDelay:
|
|
183
|
-
trigger:
|
|
184
|
-
surface:
|
|
177
|
+
closeDelay: _,
|
|
178
|
+
trigger: G,
|
|
179
|
+
surface: W,
|
|
185
180
|
onOpen: () => {
|
|
186
|
-
|
|
181
|
+
L(!0), j(!0);
|
|
187
182
|
},
|
|
188
183
|
onClose: () => {
|
|
189
|
-
|
|
184
|
+
A.current = !0, k(!1);
|
|
190
185
|
},
|
|
191
186
|
canClose: Ne
|
|
192
|
-
}), Le =
|
|
193
|
-
Ie(), N &&
|
|
194
|
-
}), Re =
|
|
195
|
-
let e =
|
|
196
|
-
return t && e?.contains(t) ? t : e ??
|
|
197
|
-
}), ze =
|
|
187
|
+
}), Le = o(() => {
|
|
188
|
+
Ie(), N && z === "hover" ? F("other") : j((e) => !e);
|
|
189
|
+
}), Re = o(() => {
|
|
190
|
+
let e = K.current, t = x ? Q.current : null;
|
|
191
|
+
return t && e?.contains(t) ? t : e ?? J.current;
|
|
192
|
+
}), ze = C.useMemo(() => se(Re), [Re]), Be = o((e) => {
|
|
198
193
|
if (e.key !== "Tab" || e.shiftKey || !N) return;
|
|
199
|
-
if (
|
|
194
|
+
if (x) {
|
|
200
195
|
let t = Re();
|
|
201
|
-
if (!t || e.target !== (
|
|
196
|
+
if (!t || e.target !== (b(t) ?? t)) return;
|
|
202
197
|
}
|
|
203
|
-
let t =
|
|
198
|
+
let t = q.current, n = t ? l(t) : null;
|
|
204
199
|
n && (e.preventDefault(), n.focus());
|
|
205
|
-
}), Ve =
|
|
200
|
+
}), Ve = y({
|
|
206
201
|
enabled: N,
|
|
207
|
-
surface:
|
|
202
|
+
surface: W,
|
|
208
203
|
anchorRef: ze,
|
|
209
|
-
getPreviousStop:
|
|
210
|
-
}), He = Ee && De === "keyboard", Ue =
|
|
204
|
+
getPreviousStop: ce
|
|
205
|
+
}), He = Ee && De === "keyboard", Ue = C.useMemo(() => ({
|
|
211
206
|
open: N,
|
|
212
|
-
setOpen:
|
|
213
|
-
contentId:
|
|
214
|
-
setCustomContentId:
|
|
215
|
-
triggerId:
|
|
216
|
-
resolvedTriggerId:
|
|
217
|
-
setResolvedTriggerId:
|
|
218
|
-
triggerRef:
|
|
219
|
-
triggerElement:
|
|
207
|
+
setOpen: j,
|
|
208
|
+
contentId: H,
|
|
209
|
+
setCustomContentId: ue,
|
|
210
|
+
triggerId: de,
|
|
211
|
+
resolvedTriggerId: U,
|
|
212
|
+
setResolvedTriggerId: fe,
|
|
213
|
+
triggerRef: K,
|
|
214
|
+
triggerElement: G,
|
|
220
215
|
triggerElementRef: je,
|
|
221
216
|
surfaceElementRef: Me,
|
|
222
|
-
arrowRef:
|
|
217
|
+
arrowRef: he,
|
|
223
218
|
onTriggerClick: Le,
|
|
224
219
|
onTriggerKeyDown: Be,
|
|
225
220
|
hoverTriggerHandlers: $ ? Pe : null,
|
|
226
221
|
hoverSurfaceHandlers: $ ? Fe : null,
|
|
227
|
-
contextMode:
|
|
228
|
-
contextTriggerHandlers:
|
|
222
|
+
contextMode: x,
|
|
223
|
+
contextTriggerHandlers: x ? Oe : null,
|
|
229
224
|
onContentContextMenu: ke.onContextMenu,
|
|
230
225
|
keyboardContext: He,
|
|
231
226
|
onContentKeyDown: Ve,
|
|
232
227
|
layerId: X,
|
|
233
|
-
floatingProps:
|
|
234
|
-
arrowStyles:
|
|
235
|
-
placedSide:
|
|
228
|
+
floatingProps: ye,
|
|
229
|
+
arrowStyles: be,
|
|
230
|
+
placedSide: xe
|
|
236
231
|
}), [
|
|
237
232
|
N,
|
|
238
|
-
|
|
233
|
+
j,
|
|
234
|
+
H,
|
|
235
|
+
de,
|
|
239
236
|
U,
|
|
240
|
-
|
|
241
|
-
W,
|
|
242
|
-
K,
|
|
237
|
+
G,
|
|
243
238
|
je,
|
|
244
239
|
Me,
|
|
245
240
|
Le,
|
|
@@ -247,121 +242,121 @@ var I = ({ open: e, defaultOpen: t, onOpenChange: n, side: i = "bottom", align:
|
|
|
247
242
|
$,
|
|
248
243
|
Pe,
|
|
249
244
|
Fe,
|
|
250
|
-
|
|
245
|
+
x,
|
|
251
246
|
Oe,
|
|
252
247
|
ke,
|
|
253
248
|
He,
|
|
254
249
|
Ve,
|
|
255
250
|
X,
|
|
256
|
-
ve,
|
|
257
251
|
ye,
|
|
258
|
-
be
|
|
252
|
+
be,
|
|
253
|
+
xe
|
|
259
254
|
]);
|
|
260
|
-
return /* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ w(E.Provider, {
|
|
261
256
|
value: Ue,
|
|
262
|
-
children:
|
|
257
|
+
children: D
|
|
263
258
|
});
|
|
264
259
|
};
|
|
265
|
-
|
|
266
|
-
var
|
|
267
|
-
let { open:
|
|
268
|
-
...
|
|
269
|
-
id: n ??
|
|
260
|
+
N.displayName = "Popover";
|
|
261
|
+
var P = ({ children: e, asChild: t, id: n, onClick: r, onKeyDown: ee, onContextMenu: a, onPointerEnter: o, onPointerMove: s, onPointerLeave: c, ref: te, ...l }) => {
|
|
262
|
+
let { open: u, contentId: f, triggerId: ne, triggerElementRef: p, setResolvedTriggerId: re, onTriggerClick: m, onTriggerKeyDown: h, hoverTriggerHandlers: g, contextMode: _, contextTriggerHandlers: v } = k("Popover.Trigger"), y = d(te, p), b = {
|
|
263
|
+
...l,
|
|
264
|
+
id: n ?? ne,
|
|
270
265
|
"aria-haspopup": "dialog",
|
|
271
|
-
"aria-expanded": !
|
|
272
|
-
"aria-controls":
|
|
273
|
-
onClick:
|
|
274
|
-
onKeyDown:
|
|
275
|
-
onContextMenu:
|
|
276
|
-
onPointerEnter:
|
|
277
|
-
onPointerMove:
|
|
278
|
-
onPointerLeave:
|
|
279
|
-
ref:
|
|
266
|
+
"aria-expanded": !_ && u,
|
|
267
|
+
"aria-controls": u && !_ ? f : void 0,
|
|
268
|
+
onClick: i(r, _ ? void 0 : m),
|
|
269
|
+
onKeyDown: i(ee, v ? i(v.onKeyDown, h) : h),
|
|
270
|
+
onContextMenu: v ? i(a, v.onContextMenu) : a,
|
|
271
|
+
onPointerEnter: g ? i(o, g.onPointerEnter) : o,
|
|
272
|
+
onPointerMove: g ? i(s, g.onPointerMove) : s,
|
|
273
|
+
onPointerLeave: g ? i(c, g.onPointerLeave) : c,
|
|
274
|
+
ref: y
|
|
280
275
|
};
|
|
281
|
-
return
|
|
276
|
+
return x(e, b, {
|
|
282
277
|
componentName: "Popover.Trigger",
|
|
283
278
|
asChild: t,
|
|
284
|
-
onResolvedId:
|
|
285
|
-
omitStateAria:
|
|
279
|
+
onResolvedId: re,
|
|
280
|
+
omitStateAria: _
|
|
286
281
|
});
|
|
287
282
|
};
|
|
288
|
-
|
|
289
|
-
var
|
|
290
|
-
let { open:
|
|
291
|
-
if (!
|
|
283
|
+
P.displayName = "PopoverTrigger";
|
|
284
|
+
var F = ({ children: n, title: o, id: s, className: te, style: l, "aria-label": u, "aria-labelledby": f, onKeyDown: ne, onContextMenu: re, onPointerEnter: m, onPointerLeave: h, ref: _, ...v }) => {
|
|
285
|
+
let { open: y, contentId: b, setCustomContentId: x, resolvedTriggerId: S, triggerRef: ie, triggerElement: E, surfaceElementRef: D, arrowRef: O, layerId: A, floatingProps: M, arrowStyles: se, placedSide: ce, onContentKeyDown: N, hoverSurfaceHandlers: P, contextMode: F, onContentContextMenu: I, keyboardContext: L } = k("Popover.Content"), R = c("popover-title"), le = d(_, D), z = ee(o), B = f === void 0 && !u && !z, V = y && B && !F, ue = C.useCallback((e) => {
|
|
286
|
+
if (!V || !E || typeof MutationObserver > "u") return oe();
|
|
292
287
|
let t = new MutationObserver(e);
|
|
293
|
-
return t.observe(
|
|
288
|
+
return t.observe(E, {
|
|
294
289
|
attributes: !0,
|
|
295
290
|
attributeFilter: ["id", "aria-labelledby"],
|
|
296
291
|
childList: !0,
|
|
297
292
|
subtree: !0
|
|
298
293
|
}), () => t.disconnect();
|
|
299
|
-
}, [
|
|
300
|
-
return
|
|
301
|
-
|
|
294
|
+
}, [V, E]), H = C.useSyncExternalStore(ue, () => V ? j(E, S) : void 0, () => V ? S : void 0), de = f ?? (u ? void 0 : z ? R : H), U = s || void 0;
|
|
295
|
+
return C.useEffect(() => (x(U), () => x(void 0)), [U, x]), C.useEffect(() => {
|
|
296
|
+
y && B && F && 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`.");
|
|
302
297
|
}, [
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
]),
|
|
307
|
-
if (!
|
|
308
|
-
let e =
|
|
298
|
+
y,
|
|
299
|
+
B,
|
|
300
|
+
F
|
|
301
|
+
]), C.useEffect(() => {
|
|
302
|
+
if (!V || !t) return;
|
|
303
|
+
let e = ie.current;
|
|
309
304
|
if (!e) {
|
|
310
305
|
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.");
|
|
311
306
|
return;
|
|
312
307
|
}
|
|
313
|
-
let n =
|
|
314
|
-
n ?
|
|
308
|
+
let n = j(e, S);
|
|
309
|
+
n ? ae(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`.");
|
|
315
310
|
}, [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
]),
|
|
321
|
-
layerId:
|
|
322
|
-
children: /* @__PURE__ */
|
|
311
|
+
V,
|
|
312
|
+
S,
|
|
313
|
+
ie,
|
|
314
|
+
H
|
|
315
|
+
]), y ? /* @__PURE__ */ w(p, {
|
|
316
|
+
layerId: A,
|
|
317
|
+
children: /* @__PURE__ */ T("div", {
|
|
323
318
|
role: "dialog",
|
|
324
|
-
"aria-label":
|
|
325
|
-
"aria-labelledby":
|
|
326
|
-
tabIndex:
|
|
327
|
-
...
|
|
328
|
-
ref:
|
|
329
|
-
id:
|
|
330
|
-
"data-side":
|
|
331
|
-
"data-align":
|
|
319
|
+
"aria-label": u,
|
|
320
|
+
"aria-labelledby": de,
|
|
321
|
+
tabIndex: L ? -1 : void 0,
|
|
322
|
+
...v,
|
|
323
|
+
ref: le,
|
|
324
|
+
id: U ?? b,
|
|
325
|
+
"data-side": M["data-side"],
|
|
326
|
+
"data-align": M["data-align"],
|
|
332
327
|
style: {
|
|
333
|
-
...
|
|
334
|
-
...
|
|
328
|
+
...l,
|
|
329
|
+
...M.style
|
|
335
330
|
},
|
|
336
|
-
onKeyDown:
|
|
337
|
-
onContextMenu:
|
|
338
|
-
onPointerEnter:
|
|
339
|
-
onPointerLeave:
|
|
340
|
-
className: e(
|
|
331
|
+
onKeyDown: i(ne, N),
|
|
332
|
+
onContextMenu: i(re, I),
|
|
333
|
+
onPointerEnter: P ? i(m, P.onPointerEnter) : m,
|
|
334
|
+
onPointerLeave: P ? i(h, P.onPointerLeave) : h,
|
|
335
|
+
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),
|
|
341
336
|
children: [
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
ref:
|
|
344
|
-
side:
|
|
345
|
-
style:
|
|
337
|
+
/* @__PURE__ */ w(g, {
|
|
338
|
+
ref: O,
|
|
339
|
+
side: ce,
|
|
340
|
+
style: se,
|
|
346
341
|
"data-wave-popover-arrow": "",
|
|
347
|
-
className:
|
|
342
|
+
className: a.beak
|
|
348
343
|
}),
|
|
349
|
-
|
|
350
|
-
id:
|
|
351
|
-
className: e(
|
|
352
|
-
children:
|
|
344
|
+
z && /* @__PURE__ */ w("h2", {
|
|
345
|
+
id: R,
|
|
346
|
+
className: e(a.title, "mb-2 text-subtitle-2 font-semibold"),
|
|
347
|
+
children: o
|
|
353
348
|
}),
|
|
354
349
|
n
|
|
355
350
|
]
|
|
356
351
|
})
|
|
357
352
|
}) : null;
|
|
358
353
|
};
|
|
359
|
-
|
|
360
|
-
var
|
|
361
|
-
Trigger:
|
|
362
|
-
Content:
|
|
354
|
+
F.displayName = "PopoverContent";
|
|
355
|
+
var I = /* @__PURE__ */ Object.assign(N, {
|
|
356
|
+
Trigger: P,
|
|
357
|
+
Content: F
|
|
363
358
|
});
|
|
364
359
|
//#endregion
|
|
365
|
-
export {
|
|
360
|
+
export { I as Popover, F as PopoverContent, P as PopoverTrigger };
|
|
366
361
|
|
|
367
362
|
//# sourceMappingURL=Popover.mjs.map
|