@stackone/malachite 2.66.0 → 2.68.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/COMPONENTS.md +1 -1
- package/dist/components/Popover.js +199 -173
- package/dist/components/Popover.js.map +1 -1
- package/dist/components/PopoverParts.js +108 -31
- package/dist/components/PopoverParts.js.map +1 -1
- package/dist/components/popoverTree.js +5 -4
- package/dist/components/popoverTree.js.map +1 -1
- package/dist/index.d.ts +55 -5
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -25,7 +25,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
25
25
|
- **`Divider`** — Separator; supports a dashed line style. Horizontal by default and spanning its container; `orientation="vertical"` draws a rule between inline controls (e.g. groups in a toolbar) and holds its width in a tight flex row. `length` sizes it along its own axis on a fixed scale, and it never shrinks below 1px. _Key props:_ `orientation="horizontal" | "vertical"`, `length` (`small` | `medium` | `large`), `lineStyle="solid" | "dashed"`, `DividerVariant`, `SpacingSize`, `PaddingSize`.
|
|
26
26
|
- **`OverflowRow`** — Horizontal row that collapses items that do not fit into an overflow affordance.
|
|
27
27
|
- **`ActionBar`** — A row of actions that collapses into a single `ActionMenu` once its container drops below `collapseBelow`. Measures the nearest genuinely-wider ancestor rather than itself, since the row shrinks to its own content. `dividerBefore` renders a vertical rule in the row and a divider in the collapsed menu, so both forms group the actions the same way. _Key props:_ `buttons` (`label`, `onClick`, `icon`, `variant`, `size`, `radius`, `tooltip`, `disabled`, `dividerBefore`), `collapseBelow`, `menuLabel`, `className`.
|
|
28
|
-
- **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `
|
|
28
|
+
- **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `initialFocus` (a ref, or a function read when the panel is shown, for what takes focus in place of the first focusable; it is read again as the panel's content changes, so focus follows content that mounts late or a focused element that is removed, but never leaves an element the user moved to; `initialFocusRef` is its deprecated form, read on open only), `openOnArrowKey` (a click panel also opens, focus inside, on the arrow key its placement points at — ArrowDown for a `bottom-*` placement; a text field trigger keeps its arrow keys), `role` (`dialog` | `menu` | `listbox`; `menu` brings no roving focus of its own), `aria-label` or `aria-labelledby` (one is required), `className`. The panel is capped to the viewport width, and only overlays opened from inside it (menus, dropdowns, modals) count as inside for outside-press dismissal. A side placement stays level with its anchor and scrolls within the room below, sliding up only when under 160px is left. Parts for the panel body: `Popover.Header` (`title`, `action`), `Popover.Action` (`icon`, `aria-label`, `onClick`, `href` (a link that opens in a new tab on Cmd/Ctrl-click or a middle click; a plain click runs `onClick` when one is given), `disabled`, `tooltip`), `Popover.List` (a scrolling list; `scrollToSelected` scrolls the list, never the page, to its selected row, one marked `aria-current`, `aria-selected` or a checked radio, each time the popover is shown, once that row mounts), `Popover.Section` (a bordered section), `Popover.Empty` (an empty-state line), `Popover.Search` (pads a `Search` above the list without a second rule), `Popover.Note` (a footnote section in small secondary text) and `Popover.Status` (`message`, `tone` (`default` | `error`), `action` (`label`, `onClick`, `pending`), `focusable`): one `status` live region for the panel's life, announcing each message it is given and staying mounted, visually hidden, while there is none, so clear `message` rather than unmounting it. Errors announce through the same region. `focusable` with a ref makes it an `initialFocus` target; resolve to it only while it has a message, since an empty one is invisible. Reach for `Status` when the message changes while the panel is open or carries an action (loading, failed, sign-in needed), and `Empty` for a static line in a list that simply has nothing in it.
|
|
29
29
|
- **`Modal`** — Centred dialog over a scrim, with header slots (icon/title/subtitle/extra), a scrolling body and a pinned footer. Locks background scroll and dismisses on ESC, the close button, or a scrim click unless `closeOnOverlayClick` is off; `busy` suppresses the two pointer routes while a request is in flight and sets `aria-busy`, so a stray click cannot tear the dialog down mid-write — but never ESC, which is the only guaranteed keyboard exit from a focus trap and so always reaches `onClose`. ESC, the Tab focus trap and `aria-modal` all apply to the topmost overlay only, so these may be stacked — a dialog opened from a panel keeps Tab to itself and the panel stops claiming to be modal. The Tab trap follows focus into a malachite popup portaled out of the dialog’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the dialog’s first control or escaping the dialog altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. Set `role="alertdialog"` for a consequential choice, which asks assistive tech to announce the body and not just the name, and point `aria-describedby` at whichever element carries it. Width comes from the `size` union (`small` 420px | `medium` 612px | `large` 760px) rather than a raw pixel prop. `titleAdornment` sits immediately after the title behind a hairline divider, for naming the thing being acted on — distinct from `headerExtra`, which pins to the far right. `tray` paints a tinted plate around the card and hangs a `caption` beneath it; the plate is the dialog element itself, so that caption stays inside the `aria-modal` subtree rather than being stranded outside it by the visual nesting, and it is added to `aria-describedby` automatically because it says what the dialog is asking. It takes a tone (`neutral` | `warning` | `error` | `success`) rather than a colour, so no consumer can paint it off-palette — and the tone sets the plate and its caption colour together, so the two cannot disagree. The caption is a `{ label?, message }` pair rather than a node, because its row height, type scale and colour belong to the plate. `size` names the card, and the plate’s 4px ring is added on top. Like `SidePanel` it sits in a z-index band from 1000 — one step per stacked overlay, so what paints on top is what holds the keyboard — and stays out of the browser top layer, so a host app’s own dialogs can still cover it. `callouts` stacks full-bleed `Alert` bands at the top of the body, as on `SidePanel`; they ignore `bodyPadding` and lead `aria-describedby`, ahead of the consumer’s own description and the tray caption. For a confirmation use `ConfirmationDialog`, which is a preset over this. _Key props:_ `open`, `onClose`, `title`, `subtitle`, `icon`, `headerExtra`, `titleAdornment`, `tray`, `callouts`, `renderLink`, `headerDivider`, `footer`, `size`, `showCloseButton`, `closeOnOverlayClick`, `bodyPadding`, `busy`, `role` (`dialog` | `alertdialog`), `aria-label`, `aria-labelledby`, `aria-describedby`.
|
|
30
30
|
- **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`.
|
|
31
31
|
- **`useHasOpenOverlay`** — Hook reporting whether any modal-type overlay - `SidePanel` or `Modal` - is open anywhere in the app. For host chrome that has to get out of an overlay’s way, a floating support widget being the case it was added for: overlays render through a portal, so a host has no DOM signal of its own to read, and reading the library’s internal markers would couple it to something it does not own. Dropdowns and tooltips are deliberately not counted - they do not trap focus, and chrome does not need to move for them. _Key props:_ No arguments. Returns a boolean.
|
|
@@ -1,257 +1,280 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { ShadowRootWrapper as
|
|
5
|
-
import { PopoverEmpty as
|
|
6
|
-
import { getDeepActiveElement as
|
|
7
|
-
import { elementRef as
|
|
8
|
-
import { pushEscapeLayer as
|
|
9
|
-
import { MENU_VIEWPORT_PADDING_PX as
|
|
10
|
-
import { firstTabStopIn as
|
|
11
|
-
import { usePopupLayer as
|
|
12
|
-
import { PopoverTreeContext as
|
|
13
|
-
import { useHoverClose as
|
|
14
|
-
import { useLatestRef as
|
|
15
|
-
import { usePopoverPosition as
|
|
16
|
-
import { usePopoverTree as
|
|
17
|
-
const
|
|
1
|
+
import { jsxs as ye, Fragment as Me, jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import Se, { useContext as Ce, useState as Q, useSyncExternalStore as De, useRef as d, useCallback as Z, useEffect as $, useMemo as _e } from "react";
|
|
3
|
+
import { createPortal as Ae } from "react-dom";
|
|
4
|
+
import { ShadowRootWrapper as Ne } from "../ShadowRootWrapper.js";
|
|
5
|
+
import { PopoverNote as Ie, PopoverStatus as Oe, PopoverSearch as ke, PopoverEmpty as Ke, PopoverSection as Re, PopoverList as He, PopoverAction as Be, PopoverHeader as $e } from "./PopoverParts.js";
|
|
6
|
+
import { getDeepActiveElement as U } from "./activeElement.js";
|
|
7
|
+
import { elementRef as Ue, composeRefs as We, chainHandler as p } from "./composeRefs.js";
|
|
8
|
+
import { pushEscapeLayer as je } from "./escapeLayers.js";
|
|
9
|
+
import { MENU_VIEWPORT_PADDING_PX as Fe } from "./floatingMenuGeometry.js";
|
|
10
|
+
import { firstTabStopIn as re } from "./overlayBehaviour.js";
|
|
11
|
+
import { usePopupLayer as Ge } from "./overlayLayers.js";
|
|
12
|
+
import { PopoverTreeContext as ee, PopoverShownContext as Ve } from "./popoverTree.js";
|
|
13
|
+
import { useHoverClose as Xe } from "./useHoverClose.js";
|
|
14
|
+
import { useLatestRef as k } from "./useLatestRef.js";
|
|
15
|
+
import { usePopoverPosition as Ye } from "./usePopoverPosition.js";
|
|
16
|
+
import { usePopoverTree as qe } from "./usePopoverTree.js";
|
|
17
|
+
const ze = "font-sans box-border overflow-auto outline-none rounded-[var(--malachite-radius-xl,12px)] border border-solid border-[var(--malachite-card-border,rgb(232,232,232))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-primary,rgb(10,10,10))]", Je = {
|
|
18
18
|
default: "[box-shadow:0px_4px_10px_0px_var(--malachite-card-shadow,rgba(0,0,0,0.1))]",
|
|
19
19
|
raised: "[box-shadow:0px_8px_24px_0px_var(--malachite-card-shadow,rgba(0,0,0,0.1))]"
|
|
20
|
-
},
|
|
20
|
+
}, Qe = {
|
|
21
21
|
none: "p-0",
|
|
22
22
|
small: "p-1",
|
|
23
23
|
medium: "p-2"
|
|
24
|
-
},
|
|
25
|
-
for (const
|
|
26
|
-
if (
|
|
24
|
+
}, Ze = (r, a) => {
|
|
25
|
+
for (const g of a)
|
|
26
|
+
if (g && r.includes(g))
|
|
27
27
|
return !0;
|
|
28
28
|
return !1;
|
|
29
|
-
},
|
|
29
|
+
}, er = {
|
|
30
30
|
bottom: "ArrowDown",
|
|
31
31
|
top: "ArrowUp",
|
|
32
32
|
right: "ArrowRight",
|
|
33
33
|
left: "ArrowLeft"
|
|
34
|
-
},
|
|
34
|
+
}, rr = (r) => r instanceof HTMLElement && (r.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(r.tagName)), te = (r) => {
|
|
35
35
|
if (!(r instanceof Node))
|
|
36
36
|
return [];
|
|
37
|
-
const
|
|
38
|
-
return [r, ...
|
|
39
|
-
},
|
|
40
|
-
},
|
|
37
|
+
const a = r.getRootNode();
|
|
38
|
+
return [r, ...a instanceof ShadowRoot ? te(a.host) : []];
|
|
39
|
+
}, tr = () => () => {
|
|
40
|
+
}, or = () => !0, nr = () => !1, W = (r, a) => a ?? re(r) ?? r, K = (r) => typeof r == "function" ? r() : r == null ? void 0 : r.current, sr = (r, a) => !r || r === document.body || !r.isConnected || r === a, cr = ({
|
|
41
41
|
trigger: r,
|
|
42
|
-
children:
|
|
43
|
-
open:
|
|
44
|
-
defaultOpen:
|
|
45
|
-
onOpenChange:
|
|
46
|
-
placement:
|
|
47
|
-
openOn:
|
|
48
|
-
width:
|
|
49
|
-
padding:
|
|
50
|
-
anchorRef:
|
|
51
|
-
offset:
|
|
52
|
-
elevation:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"aria-
|
|
58
|
-
|
|
42
|
+
children: a,
|
|
43
|
+
open: g,
|
|
44
|
+
defaultOpen: oe = !1,
|
|
45
|
+
onOpenChange: ne,
|
|
46
|
+
placement: j = "bottom-start",
|
|
47
|
+
openOn: m = "click",
|
|
48
|
+
width: se = "content",
|
|
49
|
+
padding: ce = "small",
|
|
50
|
+
anchorRef: ue,
|
|
51
|
+
offset: ae = "small",
|
|
52
|
+
elevation: le = "default",
|
|
53
|
+
initialFocus: F,
|
|
54
|
+
initialFocusRef: v,
|
|
55
|
+
openOnArrowKey: ie = !1,
|
|
56
|
+
role: G = "dialog",
|
|
57
|
+
"aria-label": fe,
|
|
58
|
+
"aria-labelledby": de,
|
|
59
|
+
className: pe = ""
|
|
59
60
|
}) => {
|
|
60
|
-
const
|
|
61
|
+
const me = Ce(ee), [ve, he] = Q(oe), c = g ?? ve, be = De(tr, or, nr), w = d(null), b = d(null), Pe = Ge("popover", c, b), [t, Ee] = Q(null), V = d(0), R = d(!1), C = d(!1), D = d(!1), x = d(null), T = d(null), _ = k(c), X = k(g), A = k(ne), P = k(F), L = F !== void 0, l = Z(
|
|
61
62
|
(e) => {
|
|
62
|
-
var
|
|
63
|
-
e !==
|
|
63
|
+
var u;
|
|
64
|
+
e !== _.current && (X.current === void 0 && he(e), (u = A.current) == null || u.call(A, e));
|
|
64
65
|
},
|
|
65
|
-
[
|
|
66
|
-
), { pointerInside:
|
|
67
|
-
isOpenRef:
|
|
68
|
-
heldByChildren:
|
|
69
|
-
setOpen:
|
|
70
|
-
}), { tree:
|
|
71
|
-
parent:
|
|
72
|
-
isOpen:
|
|
73
|
-
openOn:
|
|
74
|
-
isOpenRef:
|
|
75
|
-
heldByChildren:
|
|
76
|
-
cancelClose:
|
|
77
|
-
scheduleClose:
|
|
78
|
-
}), o =
|
|
79
|
-
isOpen:
|
|
80
|
-
panel:
|
|
81
|
-
hostRef:
|
|
82
|
-
triggerRef:
|
|
83
|
-
anchorRef:
|
|
84
|
-
placement:
|
|
85
|
-
width:
|
|
86
|
-
offset:
|
|
66
|
+
[_, X, A]
|
|
67
|
+
), { pointerInside: y, focusInside: M, triggerFocused: Y, cancelClose: h, scheduleClose: N } = Xe({
|
|
68
|
+
isOpenRef: _,
|
|
69
|
+
heldByChildren: V,
|
|
70
|
+
setOpen: l
|
|
71
|
+
}), { tree: ge, ownedSources: H } = qe({
|
|
72
|
+
parent: me,
|
|
73
|
+
isOpen: c,
|
|
74
|
+
openOn: m,
|
|
75
|
+
isOpenRef: _,
|
|
76
|
+
heldByChildren: V,
|
|
77
|
+
cancelClose: h,
|
|
78
|
+
scheduleClose: N
|
|
79
|
+
}), o = Ye({
|
|
80
|
+
isOpen: c,
|
|
81
|
+
panel: t,
|
|
82
|
+
hostRef: b,
|
|
83
|
+
triggerRef: w,
|
|
84
|
+
anchorRef: ue,
|
|
85
|
+
placement: j,
|
|
86
|
+
width: se,
|
|
87
|
+
offset: ae
|
|
87
88
|
});
|
|
88
|
-
|
|
89
|
-
if (!
|
|
89
|
+
$(() => {
|
|
90
|
+
if (!c)
|
|
90
91
|
return;
|
|
91
|
-
const e = (
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...[...
|
|
97
|
-
]) ||
|
|
92
|
+
const e = (n) => {
|
|
93
|
+
const s = n.composedPath();
|
|
94
|
+
Ze(s, [
|
|
95
|
+
w.current,
|
|
96
|
+
b.current,
|
|
97
|
+
...[...H.current].map((Le) => Le())
|
|
98
|
+
]) || l(!1);
|
|
98
99
|
};
|
|
99
100
|
document.addEventListener("mousedown", e, !0);
|
|
100
|
-
const
|
|
101
|
+
const u = je(() => l(!1));
|
|
101
102
|
return () => {
|
|
102
|
-
var
|
|
103
|
-
document.removeEventListener("mousedown", e, !0),
|
|
104
|
-
const
|
|
105
|
-
|
|
103
|
+
var s;
|
|
104
|
+
document.removeEventListener("mousedown", e, !0), u(), y.current = !1;
|
|
105
|
+
const n = U();
|
|
106
|
+
M.current && (!n || n === document.body) && (C.current = !0, (s = w.current) == null || s.focus({ preventScroll: !0 }), C.current = !1), M.current = !1, x.current = null, T.current = null;
|
|
106
107
|
};
|
|
107
|
-
}, [
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
}, [c, l, H, y, M]);
|
|
109
|
+
const S = c && t !== null && o !== null, E = Z((e) => {
|
|
110
|
+
x.current = e, e.focus({ preventScroll: !0 });
|
|
111
|
+
}, []);
|
|
112
|
+
$(() => {
|
|
113
|
+
const e = m === "click" || R.current;
|
|
114
|
+
if (!S || !t || !e)
|
|
115
|
+
return;
|
|
116
|
+
R.current = !1;
|
|
117
|
+
const u = L ? K(P.current) : v == null ? void 0 : v.current;
|
|
118
|
+
E(W(t, u));
|
|
119
|
+
}, [S, t, m, L, v, P, E]), $(() => {
|
|
120
|
+
if (!S || !t || !L)
|
|
121
|
+
return;
|
|
122
|
+
const e = () => {
|
|
123
|
+
const n = U();
|
|
124
|
+
if (sr(n, b.current)) {
|
|
125
|
+
T.current && !T.current.isConnected && E(W(t, K(P.current)));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (n !== x.current)
|
|
129
|
+
return;
|
|
130
|
+
const s = K(P.current) ?? (n === t ? re(t) : null);
|
|
131
|
+
s && s !== n && s.isConnected && E(s);
|
|
132
|
+
}, u = new MutationObserver(e);
|
|
133
|
+
return u.observe(t, { childList: !0, subtree: !0 }), () => u.disconnect();
|
|
134
|
+
}, [S, t, L, P, E]);
|
|
135
|
+
const B = () => {
|
|
136
|
+
if (h(), c && t) {
|
|
137
|
+
const e = L ? K(P.current) : v == null ? void 0 : v.current;
|
|
138
|
+
E(W(t, e));
|
|
116
139
|
return;
|
|
117
140
|
}
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
...[...
|
|
141
|
+
R.current = !0, l(!0);
|
|
142
|
+
}, I = (e) => {
|
|
143
|
+
const u = [
|
|
144
|
+
w.current,
|
|
145
|
+
b.current,
|
|
146
|
+
t,
|
|
147
|
+
...[...H.current].map((n) => n())
|
|
125
148
|
];
|
|
126
|
-
return
|
|
127
|
-
(
|
|
149
|
+
return te(e).some(
|
|
150
|
+
(n) => u.some((s) => s == null ? void 0 : s.contains(n))
|
|
128
151
|
);
|
|
129
|
-
},
|
|
152
|
+
}, q = (e) => {
|
|
130
153
|
e && queueMicrotask(() => {
|
|
131
|
-
!
|
|
154
|
+
!I(e) && !I(U()) && l(!1);
|
|
132
155
|
});
|
|
133
|
-
},
|
|
156
|
+
}, i = m === "hover" ? {
|
|
134
157
|
onMouseEnter: () => {
|
|
135
|
-
|
|
158
|
+
y.current = !0, h(), l(!0);
|
|
136
159
|
},
|
|
137
160
|
onMouseLeave: () => {
|
|
138
|
-
|
|
161
|
+
y.current = !1, N();
|
|
139
162
|
},
|
|
140
163
|
onPanelMouseOver: () => {
|
|
141
|
-
|
|
164
|
+
y.current = !0, h();
|
|
142
165
|
}
|
|
143
|
-
} : null,
|
|
144
|
-
() =>
|
|
145
|
-
[
|
|
146
|
-
),
|
|
147
|
-
ref:
|
|
148
|
-
"aria-haspopup":
|
|
149
|
-
"aria-expanded":
|
|
166
|
+
} : null, f = r.props, z = Ue(r), we = _e(
|
|
167
|
+
() => We(z, w),
|
|
168
|
+
[z]
|
|
169
|
+
), J = er[j.split("-")[0]], xe = Se.cloneElement(r, {
|
|
170
|
+
ref: we,
|
|
171
|
+
"aria-haspopup": G,
|
|
172
|
+
"aria-expanded": c,
|
|
150
173
|
onClick: p(
|
|
151
|
-
|
|
174
|
+
f.onClick,
|
|
152
175
|
(e) => {
|
|
153
|
-
if (
|
|
154
|
-
|
|
176
|
+
if (m !== "hover") {
|
|
177
|
+
l(!c);
|
|
155
178
|
return;
|
|
156
179
|
}
|
|
157
180
|
if (e.detail === 0) {
|
|
158
|
-
|
|
181
|
+
B();
|
|
159
182
|
return;
|
|
160
183
|
}
|
|
161
|
-
|
|
184
|
+
h(), l(!0);
|
|
162
185
|
}
|
|
163
186
|
),
|
|
164
|
-
...
|
|
187
|
+
...i ? {
|
|
165
188
|
onMouseEnter: p(
|
|
166
|
-
|
|
167
|
-
|
|
189
|
+
f.onMouseEnter,
|
|
190
|
+
i.onMouseEnter
|
|
168
191
|
),
|
|
169
192
|
onMouseLeave: p(
|
|
170
|
-
|
|
171
|
-
|
|
193
|
+
f.onMouseLeave,
|
|
194
|
+
i.onMouseLeave
|
|
172
195
|
),
|
|
173
196
|
onMouseDown: p(
|
|
174
|
-
|
|
197
|
+
f.onMouseDown,
|
|
175
198
|
() => {
|
|
176
|
-
|
|
177
|
-
|
|
199
|
+
D.current = !0, setTimeout(() => {
|
|
200
|
+
D.current = !1;
|
|
178
201
|
});
|
|
179
202
|
}
|
|
180
203
|
),
|
|
181
|
-
onFocus: p(
|
|
182
|
-
const e =
|
|
183
|
-
|
|
204
|
+
onFocus: p(f.onFocus, () => {
|
|
205
|
+
const e = D.current;
|
|
206
|
+
D.current = !1, Y.current = !e && !C.current, !C.current && (h(), l(!0));
|
|
184
207
|
}),
|
|
185
208
|
onKeyDown: p(
|
|
186
|
-
|
|
209
|
+
f.onKeyDown,
|
|
187
210
|
(e) => {
|
|
188
|
-
e.key ===
|
|
211
|
+
e.key === J && (e.preventDefault(), B());
|
|
189
212
|
}
|
|
190
213
|
)
|
|
191
|
-
} :
|
|
214
|
+
} : ie ? {
|
|
192
215
|
onKeyDown: p(
|
|
193
|
-
|
|
216
|
+
f.onKeyDown,
|
|
194
217
|
(e) => {
|
|
195
|
-
e.key !==
|
|
218
|
+
e.key !== J || rr(e.target) || (e.preventDefault(), B());
|
|
196
219
|
}
|
|
197
220
|
)
|
|
198
221
|
} : {},
|
|
199
222
|
onBlur: p(
|
|
200
|
-
|
|
223
|
+
f.onBlur,
|
|
201
224
|
(e) => {
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
204
|
-
|
|
225
|
+
if (Y.current = !1, !(!c || I(e.relatedTarget))) {
|
|
226
|
+
if (m === "hover") {
|
|
227
|
+
N();
|
|
205
228
|
return;
|
|
206
229
|
}
|
|
207
|
-
|
|
230
|
+
q(e.relatedTarget);
|
|
208
231
|
}
|
|
209
232
|
}
|
|
210
233
|
)
|
|
211
|
-
}),
|
|
234
|
+
}), Te = {
|
|
212
235
|
maxHeight: o == null ? void 0 : o.maxHeight,
|
|
213
|
-
maxWidth: `calc(100vw - ${
|
|
236
|
+
maxWidth: `calc(100vw - ${Fe * 2}px)`,
|
|
214
237
|
visibility: o ? "visible" : "hidden"
|
|
215
238
|
};
|
|
216
|
-
return /* @__PURE__ */
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
|
|
239
|
+
return /* @__PURE__ */ ye(Me, { children: [
|
|
240
|
+
xe,
|
|
241
|
+
c && be && Ae(
|
|
242
|
+
/* @__PURE__ */ O(ee.Provider, { value: ge, children: /* @__PURE__ */ O(
|
|
243
|
+
Ne,
|
|
221
244
|
{
|
|
222
|
-
hostRef:
|
|
223
|
-
hostProps:
|
|
245
|
+
hostRef: b,
|
|
246
|
+
hostProps: Pe,
|
|
224
247
|
hostStyle: {
|
|
225
248
|
position: "fixed",
|
|
226
249
|
top: (o == null ? void 0 : o.top) ?? 0,
|
|
227
250
|
left: (o == null ? void 0 : o.left) ?? 0
|
|
228
251
|
},
|
|
229
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ O(
|
|
230
253
|
"div",
|
|
231
254
|
{
|
|
232
|
-
ref:
|
|
233
|
-
role:
|
|
234
|
-
"aria-label":
|
|
235
|
-
"aria-labelledby":
|
|
255
|
+
ref: Ee,
|
|
256
|
+
role: G,
|
|
257
|
+
"aria-label": fe,
|
|
258
|
+
"aria-labelledby": de,
|
|
236
259
|
"data-side": o == null ? void 0 : o.side,
|
|
237
260
|
tabIndex: -1,
|
|
238
|
-
className: `${
|
|
239
|
-
style:
|
|
240
|
-
onMouseOver:
|
|
241
|
-
onMouseLeave:
|
|
242
|
-
onFocus: () => {
|
|
243
|
-
|
|
261
|
+
className: `${ze} ${Je[le]} ${Qe[ce]} ${pe}`.trim(),
|
|
262
|
+
style: Te,
|
|
263
|
+
onMouseOver: i == null ? void 0 : i.onPanelMouseOver,
|
|
264
|
+
onMouseLeave: i == null ? void 0 : i.onMouseLeave,
|
|
265
|
+
onFocus: (e) => {
|
|
266
|
+
M.current = !0, e.target !== x.current && (x.current = null), e.target instanceof HTMLElement && (t != null && t.contains(e.target)) && (T.current = e.target), h();
|
|
244
267
|
},
|
|
245
268
|
onBlur: (e) => {
|
|
246
|
-
if (!
|
|
247
|
-
if (
|
|
248
|
-
|
|
269
|
+
if (!I(e.relatedTarget)) {
|
|
270
|
+
if (e.relatedTarget && (T.current = null), M.current = !1, m === "hover") {
|
|
271
|
+
N();
|
|
249
272
|
return;
|
|
250
273
|
}
|
|
251
|
-
|
|
274
|
+
q(e.relatedTarget);
|
|
252
275
|
}
|
|
253
276
|
},
|
|
254
|
-
children:
|
|
277
|
+
children: /* @__PURE__ */ O(Ve.Provider, { value: S, children: a })
|
|
255
278
|
}
|
|
256
279
|
)
|
|
257
280
|
}
|
|
@@ -259,15 +282,18 @@ const He = "font-sans box-border overflow-auto outline-none rounded-[var(--malac
|
|
|
259
282
|
document.body
|
|
260
283
|
)
|
|
261
284
|
] });
|
|
262
|
-
},
|
|
263
|
-
Header:
|
|
264
|
-
Action:
|
|
265
|
-
List:
|
|
266
|
-
Section:
|
|
267
|
-
Empty:
|
|
285
|
+
}, Lr = Object.assign(cr, {
|
|
286
|
+
Header: $e,
|
|
287
|
+
Action: Be,
|
|
288
|
+
List: He,
|
|
289
|
+
Section: Re,
|
|
290
|
+
Empty: Ke,
|
|
291
|
+
Search: ke,
|
|
292
|
+
Status: Oe,
|
|
293
|
+
Note: Ie
|
|
268
294
|
});
|
|
269
295
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
296
|
+
Lr as Popover,
|
|
297
|
+
Lr as default
|
|
272
298
|
};
|
|
273
299
|
//# sourceMappingURL=Popover.js.map
|