@xenosystem/elements-react 0.0.10 → 0.0.12
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/dist/containers/Avatar.d.ts +8 -1
- package/dist/containers/Avatar.js +3 -3
- package/dist/containers/BulkActionBar.d.ts +20 -0
- package/dist/containers/BulkActionBar.js +8 -0
- package/dist/containers/DataTable.d.ts +50 -6
- package/dist/containers/DataTable.js +185 -11
- package/dist/containers/Table.d.ts +2 -2
- package/dist/containers/Table.js +4 -3
- package/dist/content/Kbd.d.ts +16 -0
- package/dist/content/Kbd.js +8 -0
- package/dist/forms/FormField.d.ts +32 -0
- package/dist/forms/FormField.js +26 -0
- package/dist/forms/NumberInput.d.ts +27 -0
- package/dist/forms/NumberInput.js +69 -0
- package/dist/forms/Select.d.ts +84 -0
- package/dist/forms/Select.js +243 -0
- package/dist/forms/Slider.d.ts +38 -0
- package/dist/forms/Slider.js +31 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +20 -1
- package/dist/nav/Breadcrumb.d.ts +22 -0
- package/dist/nav/Breadcrumb.js +10 -0
- package/dist/nav/Pagination.d.ts +22 -0
- package/dist/nav/Pagination.js +35 -0
- package/dist/overlays/CommandPalette.d.ts +43 -0
- package/dist/overlays/CommandPalette.js +96 -0
- package/dist/overlays/Drawer.d.ts +30 -0
- package/dist/overlays/Drawer.js +41 -0
- package/dist/overlays/Popover.d.ts +27 -12
- package/dist/overlays/Popover.js +104 -7
- package/dist/overlays/ShortcutsSheet.d.ts +21 -0
- package/dist/overlays/ShortcutsSheet.js +7 -0
- package/dist/overlays/Tooltip.d.ts +21 -10
- package/dist/overlays/Tooltip.js +93 -9
- package/dist/shortcuts.d.ts +45 -0
- package/dist/shortcuts.js +164 -0
- package/dist/status/Banner.d.ts +23 -0
- package/dist/status/Banner.js +8 -0
- package/dist/status/EmptyState.d.ts +20 -0
- package/dist/status/EmptyState.js +9 -0
- package/dist/status/Skeleton.d.ts +36 -0
- package/dist/status/Skeleton.js +31 -0
- package/dist/status/Toast.d.ts +28 -0
- package/dist/status/Toast.js +11 -0
- package/dist/uiTree.d.ts +53 -0
- package/dist/uiTree.js +197 -0
- package/dist/useDialog.d.ts +3 -1
- package/dist/useDialog.js +37 -1
- package/dist/useMenu.js +31 -1
- package/dist/useToastQueue.d.ts +29 -0
- package/dist/useToastQueue.js +73 -0
- package/package.json +9 -3
- package/src/chrome-separated.css +133 -72
- package/src/chrome-unified.css +48 -16
- package/src/containers/Badges.css +52 -28
- package/src/containers/avatar.css +7 -2
- package/src/containers/bulk-action-bar.css +45 -0
- package/src/containers/card.css +14 -13
- package/src/containers/chip.css +1 -1
- package/src/containers/panel.css +16 -53
- package/src/containers/table.css +107 -1
- package/src/content/kbd.css +33 -0
- package/src/content/model-picker.css +2 -1
- package/src/controls.css +25 -11
- package/src/fonts.css +8 -2
- package/src/forced-colors.css +41 -0
- package/src/forms/form-field.css +78 -0
- package/src/forms/number-input.css +86 -0
- package/src/forms/select.css +210 -0
- package/src/forms/slider.css +145 -0
- package/src/layout-platform.css +495 -0
- package/src/mcp-app-platform.css +1019 -0
- package/src/nav/breadcrumb.css +84 -0
- package/src/nav/pagination.css +61 -0
- package/src/overlays/command-palette.css +157 -0
- package/src/overlays/drawer.css +79 -0
- package/src/overlays/menu.css +25 -16
- package/src/overlays/modal.css +9 -27
- package/src/overlays/onboarding.css +1305 -0
- package/src/overlays/segmented-control.css +6 -3
- package/src/overlays/shortcuts-sheet.css +55 -0
- package/src/overlays/tooltip.css +22 -4
- package/src/size.css +40 -0
- package/src/status/banner.css +83 -0
- package/src/status/empty-state.css +56 -0
- package/src/status/skeleton.css +70 -0
- package/src/status/toast.css +95 -0
- package/src/xeno-elements.css +71 -44
- package/src/xeno-theme.css +75 -31
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `<CommandPalette>` — the ⌘K command, navigation, and search overlay shared across Corpus,
|
|
4
|
+
* Creator, Workshop, and Desktop Shell (560px wide, 8px radius, `--xeno-pop` depth, grouped
|
|
5
|
+
* rows, ↑/↓/Enter/Esc keyboard navigation, and optional footer hints).
|
|
6
|
+
*/
|
|
7
|
+
export interface CommandPaletteItem {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly group?: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
readonly keywords?: readonly string[];
|
|
13
|
+
readonly shortcut?: readonly string[];
|
|
14
|
+
readonly badge?: ReactNode;
|
|
15
|
+
readonly disabled?: boolean;
|
|
16
|
+
readonly onSelect?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CommandPaletteProps {
|
|
19
|
+
/** Whether the palette is mounted and visible. */
|
|
20
|
+
readonly open: boolean;
|
|
21
|
+
/** Called on Esc, scrim click, or after selection (unless `closeOnSelect={false}`). */
|
|
22
|
+
readonly onClose: () => void;
|
|
23
|
+
/** Available items, optionally grouped via `item.group`. */
|
|
24
|
+
readonly items: readonly CommandPaletteItem[];
|
|
25
|
+
/** Controlled query value (optional; falls back to internal state). */
|
|
26
|
+
readonly query?: string;
|
|
27
|
+
/** Called when the search input changes. */
|
|
28
|
+
readonly onQueryChange?: (query: string) => void;
|
|
29
|
+
/** Called whenever an item is chosen. */
|
|
30
|
+
readonly onSelect?: (item: CommandPaletteItem) => void;
|
|
31
|
+
/** Input placeholder. */
|
|
32
|
+
readonly placeholder?: string;
|
|
33
|
+
/** Text shown when no items match the query. */
|
|
34
|
+
readonly emptyMessage?: ReactNode;
|
|
35
|
+
/** Accessible label for the dialog. */
|
|
36
|
+
readonly label?: string;
|
|
37
|
+
/** Close automatically on item select. Default `true`. */
|
|
38
|
+
readonly closeOnSelect?: boolean;
|
|
39
|
+
/** Optional custom footer content. */
|
|
40
|
+
readonly footer?: ReactNode;
|
|
41
|
+
readonly className?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function CommandPalette({ open, onClose, items, query: controlledQuery, onQueryChange, onSelect, placeholder, emptyMessage, label, closeOnSelect, footer, className, }: CommandPaletteProps): ReactElement | null;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useDialog } from '../useDialog.js';
|
|
4
|
+
import { XenoElement } from '../XenoElement.js';
|
|
5
|
+
import { Kbd } from '../content/Kbd.js';
|
|
6
|
+
import { cx } from '../controls/util.js';
|
|
7
|
+
import Search from '@xenosystem/elements/elements/search';
|
|
8
|
+
export function CommandPalette({ open, onClose, items, query: controlledQuery, onQueryChange, onSelect, placeholder = 'Type a command or search…', emptyMessage = 'No matching commands.', label = 'Command palette', closeOnSelect = true, footer, className, }) {
|
|
9
|
+
const [internalQuery, setInternalQuery] = useState('');
|
|
10
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
+
const scrimArmed = useRef(false);
|
|
12
|
+
const inputRef = useRef(null);
|
|
13
|
+
const listId = useId();
|
|
14
|
+
const { panelProps } = useDialog({ open, onClose });
|
|
15
|
+
const query = controlledQuery ?? internalQuery;
|
|
16
|
+
const setQuery = (next) => {
|
|
17
|
+
if (controlledQuery === undefined)
|
|
18
|
+
setInternalQuery(next);
|
|
19
|
+
onQueryChange?.(next);
|
|
20
|
+
setActiveIndex(0);
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (open) {
|
|
24
|
+
setActiveIndex(0);
|
|
25
|
+
inputRef.current?.focus();
|
|
26
|
+
}
|
|
27
|
+
}, [open]);
|
|
28
|
+
const filtered = useMemo(() => {
|
|
29
|
+
const q = query.trim().toLowerCase();
|
|
30
|
+
if (!q)
|
|
31
|
+
return items;
|
|
32
|
+
return items.filter((item) => {
|
|
33
|
+
const hay = [item.label, item.group ?? '', item.description ?? '', ...(item.keywords ?? [])]
|
|
34
|
+
.join(' ')
|
|
35
|
+
.toLowerCase();
|
|
36
|
+
return hay.includes(q);
|
|
37
|
+
});
|
|
38
|
+
}, [items, query]);
|
|
39
|
+
const grouped = useMemo(() => {
|
|
40
|
+
const map = new Map();
|
|
41
|
+
for (const item of filtered) {
|
|
42
|
+
const key = item.group ?? '';
|
|
43
|
+
const list = map.get(key);
|
|
44
|
+
if (list)
|
|
45
|
+
list.push(item);
|
|
46
|
+
else
|
|
47
|
+
map.set(key, [item]);
|
|
48
|
+
}
|
|
49
|
+
return [...map.entries()];
|
|
50
|
+
}, [filtered]);
|
|
51
|
+
if (!open)
|
|
52
|
+
return null;
|
|
53
|
+
const choose = (item) => {
|
|
54
|
+
if (item.disabled)
|
|
55
|
+
return;
|
|
56
|
+
item.onSelect?.();
|
|
57
|
+
onSelect?.(item);
|
|
58
|
+
if (closeOnSelect)
|
|
59
|
+
onClose();
|
|
60
|
+
};
|
|
61
|
+
const onKeyDown = (e) => {
|
|
62
|
+
if (e.key === 'ArrowDown') {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
if (filtered.length > 0)
|
|
65
|
+
setActiveIndex((i) => (i + 1) % filtered.length);
|
|
66
|
+
}
|
|
67
|
+
else if (e.key === 'ArrowUp') {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
if (filtered.length > 0)
|
|
70
|
+
setActiveIndex((i) => (i - 1 + filtered.length) % filtered.length);
|
|
71
|
+
}
|
|
72
|
+
else if (e.key === 'Enter') {
|
|
73
|
+
const item = filtered[activeIndex];
|
|
74
|
+
if (item && !item.disabled) {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
choose(item);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const onScrimMouseDown = (e) => {
|
|
81
|
+
scrimArmed.current = e.target === e.currentTarget;
|
|
82
|
+
};
|
|
83
|
+
const onScrimClick = (e) => {
|
|
84
|
+
if (e.target === e.currentTarget && scrimArmed.current)
|
|
85
|
+
onClose();
|
|
86
|
+
scrimArmed.current = false;
|
|
87
|
+
};
|
|
88
|
+
let flatIndex = -1;
|
|
89
|
+
const activeItem = filtered[activeIndex];
|
|
90
|
+
return (_jsx("div", { className: "xeno-palette-overlay", onMouseDown: onScrimMouseDown, onClick: onScrimClick, children: _jsxs("div", { ...panelProps, role: "dialog", "aria-modal": "true", "aria-label": label, className: cx('xeno-palette', className), children: [_jsxs("div", { className: "xeno-palette-head", children: [_jsx("span", { className: "xeno-palette-icon", "aria-hidden": "true", children: _jsx(XenoElement, { decl: Search, size: 15 }) }), _jsx("input", { ref: inputRef, type: "text", role: "combobox", "aria-expanded": "true", "aria-controls": listId, "aria-activedescendant": activeItem ? `${listId}-${activeItem.id}` : undefined, "aria-autocomplete": "list", className: "xeno-palette-input", value: query, placeholder: placeholder, onChange: (e) => setQuery(e.target.value), onKeyDown: onKeyDown }), _jsx(Kbd, { children: "Esc" })] }), _jsx("div", { id: listId, role: "listbox", className: "xeno-palette-list", children: filtered.length === 0 ? (_jsx("div", { className: "xeno-palette-empty", children: emptyMessage })) : (grouped.map(([group, groupItems]) => (_jsxs("div", { className: "xeno-palette-group", role: "group", "aria-label": group || undefined, children: [group ? _jsx("div", { className: "xeno-palette-group-label", children: group }) : null, groupItems.map((item) => {
|
|
91
|
+
flatIndex += 1;
|
|
92
|
+
const idx = flatIndex;
|
|
93
|
+
const active = idx === activeIndex;
|
|
94
|
+
return (_jsxs("button", { id: `${listId}-${item.id}`, type: "button", role: "option", "aria-selected": active, disabled: item.disabled, className: "xeno-palette-item", "data-active": active ? 'true' : undefined, onMouseEnter: () => setActiveIndex(idx), onClick: () => choose(item), children: [_jsxs("span", { className: "xeno-palette-item-copy", children: [_jsx("span", { className: "xeno-palette-item-label", children: item.label }), item.description ? (_jsx("span", { className: "xeno-palette-item-desc", children: item.description })) : null] }), item.badge ? _jsx("span", { className: "xeno-palette-item-badge", children: item.badge }) : null, item.shortcut ? _jsx(Kbd, { keys: item.shortcut }) : null] }, item.id));
|
|
95
|
+
})] }, group || '__ungrouped')))) }), _jsx("div", { className: "xeno-palette-foot", children: footer ?? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "xeno-palette-hint", children: [_jsx(Kbd, { keys: ['↑', '↓'] }), " navigate"] }), _jsxs("span", { className: "xeno-palette-hint", children: [_jsx(Kbd, { children: "\u21B5" }), " select"] }), _jsxs("span", { className: "xeno-palette-hint", children: [_jsx(Kbd, { children: "Esc" }), " close"] })] })) })] }) }));
|
|
96
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type DrawerSide = 'start' | 'end' | 'left' | 'right';
|
|
3
|
+
export interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children'> {
|
|
4
|
+
/** Controlled visibility. Renders nothing when false. */
|
|
5
|
+
readonly open: boolean;
|
|
6
|
+
/** Called on Esc, scrim click, or close button click. */
|
|
7
|
+
readonly onClose: () => void;
|
|
8
|
+
/** Logical or physical edge (`end` = right in LTR / left in RTL). Defaults to `'end'`. */
|
|
9
|
+
readonly side?: DrawerSide;
|
|
10
|
+
/** Panel width in px or CSS length. Defaults to `400`. */
|
|
11
|
+
readonly width?: number | string;
|
|
12
|
+
/** Drawer heading linked via `aria-labelledby`. */
|
|
13
|
+
readonly title?: ReactNode;
|
|
14
|
+
/** Optional subtitle below the title. */
|
|
15
|
+
readonly subtitle?: ReactNode;
|
|
16
|
+
/** Scrollable body content. */
|
|
17
|
+
readonly children?: ReactNode;
|
|
18
|
+
/** Optional sticky footer actions. */
|
|
19
|
+
readonly footer?: ReactNode;
|
|
20
|
+
/** Accessible label for the close button. */
|
|
21
|
+
readonly closeLabel?: string;
|
|
22
|
+
/** Portal to `document.body` on client. Defaults to `true`. */
|
|
23
|
+
readonly portal?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `<Drawer>` — accessible side sheet backed by `useDialog` (Escape, focus trap, focus restoration,
|
|
27
|
+
* refcounted page-scroll lock, `aria-modal="true"`) with logical `inset-inline-start` / `end`
|
|
28
|
+
* positioning so RTL mirrors automatically.
|
|
29
|
+
*/
|
|
30
|
+
export declare function Drawer({ open, onClose, side, width, title, subtitle, children, footer, closeLabel, portal, className, style, ...rest }: DrawerProps): ReactElement | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useRef } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import X from '@xenosystem/elements/elements/x';
|
|
5
|
+
import { IconButton } from '../controls/IconButton.js';
|
|
6
|
+
import { cx } from '../controls/util.js';
|
|
7
|
+
import { useDialog } from '../useDialog.js';
|
|
8
|
+
function normalizeSide(side) {
|
|
9
|
+
if (side === 'left')
|
|
10
|
+
return 'start';
|
|
11
|
+
if (side === 'right')
|
|
12
|
+
return 'end';
|
|
13
|
+
return side;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `<Drawer>` — accessible side sheet backed by `useDialog` (Escape, focus trap, focus restoration,
|
|
17
|
+
* refcounted page-scroll lock, `aria-modal="true"`) with logical `inset-inline-start` / `end`
|
|
18
|
+
* positioning so RTL mirrors automatically.
|
|
19
|
+
*/
|
|
20
|
+
export function Drawer({ open, onClose, side = 'end', width = 400, title, subtitle, children, footer, closeLabel = 'Close drawer', portal = true, className, style, ...rest }) {
|
|
21
|
+
const titleId = useId();
|
|
22
|
+
const scrimArmed = useRef(false);
|
|
23
|
+
const { panelProps } = useDialog({ open, onClose });
|
|
24
|
+
if (!open)
|
|
25
|
+
return null;
|
|
26
|
+
const logicalSide = normalizeSide(side);
|
|
27
|
+
const resolvedWidth = typeof width === 'number' ? `${width}px` : width;
|
|
28
|
+
const onScrimMouseDown = (e) => {
|
|
29
|
+
scrimArmed.current = e.target === e.currentTarget;
|
|
30
|
+
};
|
|
31
|
+
const onScrimClick = (e) => {
|
|
32
|
+
if (e.target === e.currentTarget && scrimArmed.current)
|
|
33
|
+
onClose();
|
|
34
|
+
scrimArmed.current = false;
|
|
35
|
+
};
|
|
36
|
+
const node = (_jsx("div", { className: "xeno-drawer-overlay", "data-side": logicalSide, onMouseDown: onScrimMouseDown, onClick: onScrimClick, children: _jsxs("div", { ...rest, ...panelProps, role: "dialog", "aria-modal": "true", ...(title !== undefined ? { 'aria-labelledby': titleId } : {}), className: cx('xeno-drawer', className), "data-side": logicalSide, style: { ...style, width: resolvedWidth }, children: [_jsxs("header", { className: "xeno-drawer-header", children: [_jsxs("div", { className: "xeno-drawer-titles", children: [title !== undefined ? (_jsx("h2", { id: titleId, className: "xeno-drawer-title", children: title })) : null, subtitle !== undefined ? (_jsx("p", { className: "xeno-drawer-subtitle", children: subtitle })) : null] }), _jsx(IconButton, { icon: X, "aria-label": closeLabel, size: "sm", onClick: onClose })] }), _jsx("div", { className: "xeno-drawer-body", children: children }), footer !== undefined ? _jsx("footer", { className: "xeno-drawer-footer", children: footer }) : null] }) }));
|
|
37
|
+
if (portal && typeof document !== 'undefined' && document.body) {
|
|
38
|
+
return createPortal(node, document.body);
|
|
39
|
+
}
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* `<Popover>` —
|
|
4
|
-
* holds the `trigger`; while `open`, an absolutely-positioned panel (`--xeno-elevated`, a hairline
|
|
5
|
-
* border, one soft uncoloured shadow, `--xeno-radius-md`) is placed below the trigger, aligned to its
|
|
6
|
-
* `start` (default) or `end` edge. Nothing renders inside the panel until it is open.
|
|
3
|
+
* `<Popover>` — portaled, collision-aware anchored overlay.
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* listbox, or any anchored surface on top of the same anchoring + dismissal behaviour.
|
|
5
|
+
* Client-side, the floating panel portals to `document.body` (preserving the nearest `.xeno`
|
|
6
|
+
* ancestor's `data-theme`, `data-chrome`, and `data-density` attributes) so it escapes any parent
|
|
7
|
+
* `overflow: hidden` panel, card, or scroll region. Coordinates are computed from the trigger rect
|
|
8
|
+
* with automatic vertical flipping (`bottom` ↔ `top`) and horizontal viewport clamping, updated on
|
|
9
|
+
* scroll and resize. During SSR (or when `portal={false}`), the panel renders inline so server
|
|
10
|
+
* markup stays self-contained.
|
|
15
11
|
*/
|
|
16
12
|
export interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
17
13
|
/** Whether the panel is mounted + visible. Nothing renders in the panel when false. */
|
|
@@ -24,9 +20,28 @@ export interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chil
|
|
|
24
20
|
readonly children?: ReactNode;
|
|
25
21
|
/** Which trigger edge the panel aligns to. Default `start`. */
|
|
26
22
|
readonly align?: 'start' | 'end';
|
|
23
|
+
/** Preferred side relative to the trigger before collision flipping. Default `'bottom'`. */
|
|
24
|
+
readonly side?: 'bottom' | 'top';
|
|
25
|
+
/** Pixel gap between trigger and panel. Default `6`. */
|
|
26
|
+
readonly sideOffset?: number;
|
|
27
|
+
/** Portal panel to `document.body` on the client to escape `overflow: hidden`. Default `true`. */
|
|
28
|
+
readonly portal?: boolean;
|
|
27
29
|
/** Attached to the panel node (composition seam — e.g. {@link Menu} queries its items). */
|
|
28
30
|
readonly panelRef?: Ref<HTMLDivElement>;
|
|
29
31
|
/** Spread onto the panel node — `role`, `aria-*`, `onKeyDown`, `onClick`, … (composition seam). */
|
|
30
32
|
readonly panelProps?: HTMLAttributes<HTMLDivElement>;
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
interface FloatingPos {
|
|
35
|
+
readonly top: number;
|
|
36
|
+
readonly left: number;
|
|
37
|
+
readonly side: 'bottom' | 'top';
|
|
38
|
+
}
|
|
39
|
+
export declare function computeFloatingPosition(anchor: DOMRect, panel: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}, viewport: {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}, align: 'start' | 'end', preferredSide: 'bottom' | 'top', offset: number): FloatingPos;
|
|
46
|
+
export declare function Popover({ open, onOpenChange, trigger, children, align, side, sideOffset, portal, panelRef, panelProps, className, ...rest }: PopoverProps): ReactElement;
|
|
47
|
+
export {};
|
package/dist/overlays/Popover.js
CHANGED
|
@@ -1,16 +1,99 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
3
4
|
import { cx } from '../controls/util.js';
|
|
4
|
-
|
|
5
|
+
const VIEWPORT_MARGIN = 8;
|
|
6
|
+
function readThemeContext(anchor) {
|
|
7
|
+
if (!anchor)
|
|
8
|
+
return {};
|
|
9
|
+
const themed = anchor.closest('[data-theme]');
|
|
10
|
+
const chromed = anchor.closest('[data-chrome]');
|
|
11
|
+
const dense = anchor.closest('[data-density]');
|
|
12
|
+
const laidOut = anchor.closest('[data-layout]');
|
|
13
|
+
const theme = themed?.getAttribute('data-theme') ?? undefined;
|
|
14
|
+
const chrome = chromed?.getAttribute('data-chrome') ?? undefined;
|
|
15
|
+
const density = dense?.getAttribute('data-density') ?? undefined;
|
|
16
|
+
const layout = laidOut?.getAttribute('data-layout') ?? undefined;
|
|
17
|
+
return {
|
|
18
|
+
...(theme ? { theme } : {}),
|
|
19
|
+
...(chrome ? { chrome } : {}),
|
|
20
|
+
...(density ? { density } : {}),
|
|
21
|
+
...(layout ? { layout } : {}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function computeFloatingPosition(anchor, panel, viewport, align, preferredSide, offset) {
|
|
25
|
+
const belowTop = anchor.bottom + offset;
|
|
26
|
+
const aboveTop = anchor.top - offset - panel.height;
|
|
27
|
+
let resolvedSide = preferredSide;
|
|
28
|
+
let top = preferredSide === 'bottom' ? belowTop : aboveTop;
|
|
29
|
+
if (preferredSide === 'bottom' && belowTop + panel.height > viewport.height - VIEWPORT_MARGIN && aboveTop >= VIEWPORT_MARGIN) {
|
|
30
|
+
resolvedSide = 'top';
|
|
31
|
+
top = aboveTop;
|
|
32
|
+
}
|
|
33
|
+
else if (preferredSide === 'top' && aboveTop < VIEWPORT_MARGIN && belowTop + panel.height <= viewport.height - VIEWPORT_MARGIN) {
|
|
34
|
+
resolvedSide = 'bottom';
|
|
35
|
+
top = belowTop;
|
|
36
|
+
}
|
|
37
|
+
top = Math.max(VIEWPORT_MARGIN, Math.min(top, Math.max(VIEWPORT_MARGIN, viewport.height - panel.height - VIEWPORT_MARGIN)));
|
|
38
|
+
const rawLeft = align === 'end' ? anchor.right - panel.width : anchor.left;
|
|
39
|
+
const left = Math.max(VIEWPORT_MARGIN, Math.min(rawLeft, Math.max(VIEWPORT_MARGIN, viewport.width - panel.width - VIEWPORT_MARGIN)));
|
|
40
|
+
return { top: Math.round(top), left: Math.round(left), side: resolvedSide };
|
|
41
|
+
}
|
|
42
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
43
|
+
export function Popover({ open, onOpenChange, trigger, children, align = 'start', side = 'bottom', sideOffset = 6, portal = true, panelRef, panelProps, className, ...rest }) {
|
|
5
44
|
const rootRef = useRef(null);
|
|
45
|
+
const localPanelRef = useRef(null);
|
|
6
46
|
const restoreFocus = useRef(null);
|
|
7
|
-
|
|
47
|
+
const [portalTarget, setPortalTarget] = useState(null);
|
|
48
|
+
const [pos, setPos] = useState(null);
|
|
49
|
+
const [themeCtx, setThemeCtx] = useState({});
|
|
50
|
+
const attachPanelRef = useCallback((node) => {
|
|
51
|
+
localPanelRef.current = node;
|
|
52
|
+
if (typeof panelRef === 'function')
|
|
53
|
+
panelRef(node);
|
|
54
|
+
else if (panelRef && 'current' in panelRef) {
|
|
55
|
+
;
|
|
56
|
+
panelRef.current = node;
|
|
57
|
+
}
|
|
58
|
+
}, [panelRef]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (portal && typeof document !== 'undefined')
|
|
61
|
+
setPortalTarget(document.body);
|
|
62
|
+
else
|
|
63
|
+
setPortalTarget(null);
|
|
64
|
+
}, [portal]);
|
|
65
|
+
const updatePosition = useCallback(() => {
|
|
66
|
+
const anchorEl = rootRef.current;
|
|
67
|
+
const panelEl = localPanelRef.current;
|
|
68
|
+
if (!anchorEl || !panelEl || typeof window === 'undefined')
|
|
69
|
+
return;
|
|
70
|
+
const anchorRect = anchorEl.getBoundingClientRect();
|
|
71
|
+
const panelRect = panelEl.getBoundingClientRect();
|
|
72
|
+
setPos(computeFloatingPosition(anchorRect, { width: panelRect.width || 180, height: panelRect.height || 120 }, { width: window.innerWidth, height: window.innerHeight }, align, side, sideOffset));
|
|
73
|
+
setThemeCtx(readThemeContext(anchorEl));
|
|
74
|
+
}, [align, side, sideOffset]);
|
|
75
|
+
useIsomorphicLayoutEffect(() => {
|
|
76
|
+
if (!open || !portalTarget)
|
|
77
|
+
return;
|
|
78
|
+
updatePosition();
|
|
79
|
+
window.addEventListener('resize', updatePosition);
|
|
80
|
+
window.addEventListener('scroll', updatePosition, true);
|
|
81
|
+
return () => {
|
|
82
|
+
window.removeEventListener('resize', updatePosition);
|
|
83
|
+
window.removeEventListener('scroll', updatePosition, true);
|
|
84
|
+
};
|
|
85
|
+
}, [open, portalTarget, updatePosition]);
|
|
86
|
+
// Dismissal — check both the trigger wrapper AND the portaled panel so clicks inside never dismiss.
|
|
8
87
|
useEffect(() => {
|
|
9
88
|
if (!open)
|
|
10
89
|
return;
|
|
11
90
|
const onPointer = (e) => {
|
|
12
|
-
|
|
13
|
-
|
|
91
|
+
const target = e.target;
|
|
92
|
+
if (rootRef.current?.contains(target))
|
|
93
|
+
return;
|
|
94
|
+
if (localPanelRef.current?.contains(target))
|
|
95
|
+
return;
|
|
96
|
+
onOpenChange?.(false);
|
|
14
97
|
};
|
|
15
98
|
const onKey = (e) => {
|
|
16
99
|
if (e.key === 'Escape')
|
|
@@ -33,6 +116,20 @@ export function Popover({ open, onOpenChange, trigger, children, align = 'start'
|
|
|
33
116
|
restoreFocus.current = null;
|
|
34
117
|
}
|
|
35
118
|
}, [open]);
|
|
36
|
-
const { className: panelClassName, ...restPanel } = panelProps ?? {};
|
|
37
|
-
|
|
119
|
+
const { className: panelClassName, style: panelStyle, ...restPanel } = panelProps ?? {};
|
|
120
|
+
const floatingStyle = portalTarget && pos
|
|
121
|
+
? {
|
|
122
|
+
...panelStyle,
|
|
123
|
+
position: 'fixed',
|
|
124
|
+
top: pos.top,
|
|
125
|
+
left: pos.left,
|
|
126
|
+
right: 'auto',
|
|
127
|
+
zIndex: 1000,
|
|
128
|
+
}
|
|
129
|
+
: panelStyle;
|
|
130
|
+
const panelNode = open ? (_jsx("div", { ref: attachPanelRef, className: cx('xeno-popover-panel', portalTarget ? 'xeno-popover-panel--portaled' : false, panelClassName), "data-align": align, "data-side": pos?.side ?? side, style: floatingStyle, ...restPanel, children: children })) : null;
|
|
131
|
+
return (_jsxs("div", { ref: rootRef, className: cx('xeno-popover', className), ...rest, children: [trigger, panelNode &&
|
|
132
|
+
(portalTarget
|
|
133
|
+
? createPortal(_jsx("div", { className: "xeno xeno-popover-portal", "data-theme": themeCtx.theme, "data-chrome": themeCtx.chrome, "data-density": themeCtx.density, "data-layout": themeCtx.layout, children: panelNode }), portalTarget)
|
|
134
|
+
: panelNode)] }));
|
|
38
135
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `<ShortcutsSheet>` — keyboard shortcuts dialog (`?` in Corpus, Creator, Motion, and Workshop),
|
|
4
|
+
* composed directly on `<Modal>` + `<Kbd>` with grouped 2-column sections.
|
|
5
|
+
*/
|
|
6
|
+
export interface ShortcutEntry {
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly keys: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface ShortcutSection {
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly items: readonly ShortcutEntry[];
|
|
13
|
+
}
|
|
14
|
+
export interface ShortcutsSheetProps {
|
|
15
|
+
readonly open: boolean;
|
|
16
|
+
readonly onClose: () => void;
|
|
17
|
+
readonly sections: readonly ShortcutSection[];
|
|
18
|
+
readonly title?: string;
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function ShortcutsSheet({ open, onClose, sections, title, className, }: ShortcutsSheetProps): ReactElement | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { Kbd } from '../content/Kbd.js';
|
|
4
|
+
import { cx } from '../controls/util.js';
|
|
5
|
+
export function ShortcutsSheet({ open, onClose, sections, title = 'Keyboard shortcuts', className, }) {
|
|
6
|
+
return (_jsx(Modal, { open: open, onClose: onClose, title: title, className: cx('xeno-shortcuts-modal', className), children: _jsx("div", { className: "xeno-shortcuts-grid", children: sections.map((section) => (_jsxs("section", { className: "xeno-shortcuts-section", children: [_jsx("h3", { className: "xeno-shortcuts-heading", children: section.title }), _jsx("dl", { className: "xeno-shortcuts-list", children: section.items.map((item) => (_jsxs("div", { className: "xeno-shortcuts-row", children: [_jsx("dt", { className: "xeno-shortcuts-label", children: item.label }), _jsx("dd", { className: "xeno-shortcuts-keys", children: _jsx(Kbd, { keys: item.keys, size: "md" }) })] }, `${section.title}-${item.label}`))) })] }, section.title))) }) }));
|
|
7
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactElement, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* `<Tooltip>` — a hover/focus hint
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
* and
|
|
7
|
-
* animates opacity/transform. Reveal is instant on keyboard focus and, on hover, waits `delay` ms;
|
|
8
|
-
* per the ARIA tooltip pattern, Escape dismisses it while the pointer/focus stay put.
|
|
9
|
-
*
|
|
10
|
-
* Monochrome shell: an `--xeno-elevated` panel with a hairline border and muted 12px mono text.
|
|
3
|
+
* `<Tooltip>` — a hover/focus hint that portals to `document.body` on the client (escaping
|
|
4
|
+
* `overflow: hidden` scroll containers and stacking contexts) and flips/clamps against the
|
|
5
|
+
* viewport edges (`top ↔ bottom`, `left ↔ right`). Falls back to inline rendering on SSR so
|
|
6
|
+
* `role="tooltip"` and `aria-describedby` are always present in static HTML.
|
|
11
7
|
*/
|
|
12
8
|
export type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
13
9
|
export interface TooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content' | 'children'> {
|
|
@@ -15,9 +11,24 @@ export interface TooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'con
|
|
|
15
11
|
readonly content: ReactNode;
|
|
16
12
|
/** The trigger. A single element is wired with `aria-describedby`; other nodes render as-is. */
|
|
17
13
|
readonly children: ReactNode;
|
|
18
|
-
/**
|
|
14
|
+
/** Preferred side of the trigger. Flips automatically if clipped at the viewport edge. Default `top`. */
|
|
19
15
|
readonly side?: TooltipSide;
|
|
20
16
|
/** Milliseconds to wait before the hover reveal (keyboard focus is always instant). Default 150. */
|
|
21
17
|
readonly delay?: number;
|
|
18
|
+
/** Render the tooltip via a `document.body` portal on the client. Default `true`. */
|
|
19
|
+
readonly portal?: boolean;
|
|
22
20
|
}
|
|
23
|
-
export
|
|
21
|
+
export interface TooltipPosition {
|
|
22
|
+
readonly top: number;
|
|
23
|
+
readonly left: number;
|
|
24
|
+
readonly side: TooltipSide;
|
|
25
|
+
}
|
|
26
|
+
/** Pure collision-flip & viewport-clamp placement for Tooltip (also exported for tests). */
|
|
27
|
+
export declare function computeTooltipPosition(anchor: Pick<DOMRect, 'top' | 'bottom' | 'left' | 'right' | 'width' | 'height'>, panel: {
|
|
28
|
+
readonly width: number;
|
|
29
|
+
readonly height: number;
|
|
30
|
+
}, viewport: {
|
|
31
|
+
readonly width: number;
|
|
32
|
+
readonly height: number;
|
|
33
|
+
}, preferredSide?: TooltipSide, gap?: number): TooltipPosition;
|
|
34
|
+
export declare function Tooltip({ content, children, side, delay, portal, className, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, ...rest }: TooltipProps): ReactElement;
|
package/dist/overlays/Tooltip.js
CHANGED
|
@@ -1,12 +1,62 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement, isValidElement, useCallback, useEffect, useId, useRef, useState, } from 'react';
|
|
2
|
+
import { cloneElement, isValidElement, useCallback, useEffect, useId, useLayoutEffect, useRef, useState, } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
3
4
|
import { cx } from '../controls/util.js';
|
|
4
|
-
|
|
5
|
+
const VIEWPORT_PAD = 8;
|
|
6
|
+
/** Pure collision-flip & viewport-clamp placement for Tooltip (also exported for tests). */
|
|
7
|
+
export function computeTooltipPosition(anchor, panel, viewport, preferredSide = 'top', gap = 8) {
|
|
8
|
+
let side = preferredSide;
|
|
9
|
+
const w = panel.width || 120;
|
|
10
|
+
const h = panel.height || 28;
|
|
11
|
+
if (side === 'top' && anchor.top - gap - h < VIEWPORT_PAD && anchor.bottom + gap + h <= viewport.height - VIEWPORT_PAD) {
|
|
12
|
+
side = 'bottom';
|
|
13
|
+
}
|
|
14
|
+
else if (side === 'bottom' && anchor.bottom + gap + h > viewport.height - VIEWPORT_PAD && anchor.top - gap - h >= VIEWPORT_PAD) {
|
|
15
|
+
side = 'top';
|
|
16
|
+
}
|
|
17
|
+
else if (side === 'left' && anchor.left - gap - w < VIEWPORT_PAD && anchor.right + gap + w <= viewport.width - VIEWPORT_PAD) {
|
|
18
|
+
side = 'right';
|
|
19
|
+
}
|
|
20
|
+
else if (side === 'right' && anchor.right + gap + w > viewport.width - VIEWPORT_PAD && anchor.left - gap - w >= VIEWPORT_PAD) {
|
|
21
|
+
side = 'left';
|
|
22
|
+
}
|
|
23
|
+
let top = 0;
|
|
24
|
+
let left = 0;
|
|
25
|
+
if (side === 'top') {
|
|
26
|
+
top = anchor.top - gap - h;
|
|
27
|
+
left = anchor.left + anchor.width / 2 - w / 2;
|
|
28
|
+
}
|
|
29
|
+
else if (side === 'bottom') {
|
|
30
|
+
top = anchor.bottom + gap;
|
|
31
|
+
left = anchor.left + anchor.width / 2 - w / 2;
|
|
32
|
+
}
|
|
33
|
+
else if (side === 'left') {
|
|
34
|
+
top = anchor.top + anchor.height / 2 - h / 2;
|
|
35
|
+
left = anchor.left - gap - w;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
top = anchor.top + anchor.height / 2 - h / 2;
|
|
39
|
+
left = anchor.right + gap;
|
|
40
|
+
}
|
|
41
|
+
top = Math.max(VIEWPORT_PAD, Math.min(viewport.height - h - VIEWPORT_PAD, top));
|
|
42
|
+
left = Math.max(VIEWPORT_PAD, Math.min(viewport.width - w - VIEWPORT_PAD, left));
|
|
43
|
+
return { top: Math.round(top), left: Math.round(left), side };
|
|
44
|
+
}
|
|
45
|
+
const useIsoLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
46
|
+
export function Tooltip({ content, children, side = 'top', delay = 150, portal = true, className, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, ...rest }) {
|
|
5
47
|
const panelId = useId();
|
|
48
|
+
const rootRef = useRef(null);
|
|
49
|
+
const panelRef = useRef(null);
|
|
6
50
|
const [hovered, setHovered] = useState(false);
|
|
7
51
|
const [focused, setFocused] = useState(false);
|
|
8
52
|
const [dismissed, setDismissed] = useState(false);
|
|
53
|
+
const [mounted, setMounted] = useState(false);
|
|
54
|
+
const [pos, setPos] = useState(null);
|
|
55
|
+
const [scopeAttrs, setScopeAttrs] = useState({});
|
|
9
56
|
const timer = useRef(undefined);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setMounted(true);
|
|
59
|
+
}, []);
|
|
10
60
|
const clear = useCallback(() => {
|
|
11
61
|
if (timer.current !== undefined) {
|
|
12
62
|
clearTimeout(timer.current);
|
|
@@ -14,10 +64,6 @@ export function Tooltip({ content, children, side = 'top', delay = 150, classNam
|
|
|
14
64
|
}
|
|
15
65
|
}, []);
|
|
16
66
|
useEffect(() => clear, [clear]);
|
|
17
|
-
/* Every one of these CHAINS the caller's handler rather than replacing it. They used to be written
|
|
18
|
-
after `{...rest}` in the JSX, which meant a caller's `onMouseEnter` / `onMouseLeave` / `onFocus` /
|
|
19
|
-
`onBlur` was silently overridden — `onKeyDown` was already chained here, which is what shows the
|
|
20
|
-
other four were an oversight rather than a decision. */
|
|
21
67
|
const openHover = useCallback((e) => {
|
|
22
68
|
onMouseEnter?.(e);
|
|
23
69
|
clear();
|
|
@@ -50,12 +96,50 @@ export function Tooltip({ content, children, side = 'top', delay = 150, classNam
|
|
|
50
96
|
}, [onKeyDown]);
|
|
51
97
|
const open = (hovered || focused) && !dismissed;
|
|
52
98
|
const state = open ? 'open' : 'closed';
|
|
53
|
-
|
|
54
|
-
|
|
99
|
+
const canPortal = portal && mounted && typeof document !== 'undefined';
|
|
100
|
+
useIsoLayoutEffect(() => {
|
|
101
|
+
if (!canPortal || !rootRef.current)
|
|
102
|
+
return;
|
|
103
|
+
const scope = rootRef.current.closest('.xeno');
|
|
104
|
+
const chromeHost = rootRef.current.closest('[data-chrome]');
|
|
105
|
+
const densityHost = rootRef.current.closest('[data-density]');
|
|
106
|
+
setScopeAttrs({
|
|
107
|
+
...(scope?.getAttribute('data-theme') ? { theme: scope.getAttribute('data-theme') } : {}),
|
|
108
|
+
...(chromeHost?.getAttribute('data-chrome') ? { chrome: chromeHost.getAttribute('data-chrome') } : {}),
|
|
109
|
+
...(densityHost?.getAttribute('data-density') ? { density: densityHost.getAttribute('data-density') } : {}),
|
|
110
|
+
});
|
|
111
|
+
}, [canPortal, open]);
|
|
112
|
+
useIsoLayoutEffect(() => {
|
|
113
|
+
if (!open || !canPortal)
|
|
114
|
+
return;
|
|
115
|
+
const update = () => {
|
|
116
|
+
const anchorEl = rootRef.current;
|
|
117
|
+
const panelEl = panelRef.current;
|
|
118
|
+
if (!anchorEl)
|
|
119
|
+
return;
|
|
120
|
+
const anchorRect = anchorEl.getBoundingClientRect();
|
|
121
|
+
const panelRect = panelEl?.getBoundingClientRect();
|
|
122
|
+
setPos(computeTooltipPosition(anchorRect, { width: panelRect?.width ?? 120, height: panelRect?.height ?? 28 }, { width: window.innerWidth, height: window.innerHeight }, side, 8));
|
|
123
|
+
};
|
|
124
|
+
update();
|
|
125
|
+
window.addEventListener('scroll', update, true);
|
|
126
|
+
window.addEventListener('resize', update);
|
|
127
|
+
return () => {
|
|
128
|
+
window.removeEventListener('scroll', update, true);
|
|
129
|
+
window.removeEventListener('resize', update);
|
|
130
|
+
};
|
|
131
|
+
}, [open, canPortal, side]);
|
|
55
132
|
const trigger = isValidElement(children)
|
|
56
133
|
? cloneElement(children, {
|
|
57
134
|
'aria-describedby': panelId,
|
|
58
135
|
})
|
|
59
136
|
: children;
|
|
60
|
-
|
|
137
|
+
const resolvedSide = pos?.side ?? side;
|
|
138
|
+
const portaledStyle = canPortal && pos
|
|
139
|
+
? { position: 'fixed', top: pos.top, left: pos.left, zIndex: 1050 }
|
|
140
|
+
: undefined;
|
|
141
|
+
const panelNode = (_jsxs("span", { ref: panelRef, className: cx('xeno-tooltip-panel', canPortal ? 'xeno-tooltip-panel--portaled' : false), role: "tooltip", id: panelId, "data-side": resolvedSide, "data-state": state, style: portaledStyle, children: [content, _jsx("span", { className: "xeno-tooltip-arrow", "aria-hidden": "true" })] }));
|
|
142
|
+
return (_jsxs("span", { ref: rootRef, className: cx('xeno-tooltip', className), "data-side": resolvedSide, "data-state": state, ...rest, onMouseEnter: openHover, onMouseLeave: closeHover, onFocus: openFocus, onBlur: closeFocus, onKeyDown: handleKeyDown, children: [trigger, canPortal
|
|
143
|
+
? createPortal(_jsx("span", { className: "xeno xeno-tooltip-portal", "data-theme": scopeAttrs.theme, "data-chrome": scopeAttrs.chrome, "data-density": scopeAttrs.density, children: panelNode }), document.body)
|
|
144
|
+
: panelNode] }));
|
|
61
145
|
}
|