@teamofsilicons/silicon-ui 0.2.0 → 0.4.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 +4 -3
- package/check.mjs +14 -5
- package/components/activity-heatmap/activity-heatmap.module.css +4 -4
- package/components/alert/alert.module.css +1 -1
- package/components/animated-counter/animated-counter.js +1 -1
- package/components/announcement-bar/announcement-bar.module.css +6 -6
- package/components/avatar/avatar.d.ts +2 -2
- package/components/avatar/avatar.js +1 -1
- package/components/avatar/avatar.module.css +5 -2
- package/components/avatar-group/avatar-group.module.css +4 -4
- package/components/badge/badge.module.css +4 -4
- package/components/bar-chart/bar-chart.js +1 -1
- package/components/bar-chart/bar-chart.module.css +4 -4
- package/components/billing-toggle/billing-toggle.js +2 -2
- package/components/billing-toggle/billing-toggle.module.css +10 -10
- package/components/bottom-sheet/bottom-sheet.js +1 -1
- package/components/bottom-sheet/bottom-sheet.module.css +4 -5
- package/components/breadcrumb/breadcrumb.d.ts +8 -2
- package/components/breadcrumb/breadcrumb.js +21 -9
- package/components/breadcrumb/breadcrumb.module.css +7 -3
- package/components/brush-chart/brush-chart.module.css +9 -9
- package/components/button/button.d.ts +7 -2
- package/components/button/button.js +3 -1
- package/components/button/button.module.css +10 -1
- package/components/button-group/button-group.module.css +7 -7
- package/components/calendar/calendar.js +15 -5
- package/components/calendar/calendar.module.css +13 -10
- package/components/card/card.js +4 -4
- package/components/card/card.module.css +2 -2
- package/components/card-stack/card-stack.js +2 -2
- package/components/card-stack/card-stack.module.css +2 -3
- package/components/carousel/carousel.module.css +3 -3
- package/components/chat-thread/chat-thread.module.css +41 -41
- package/components/checkbox/checkbox.module.css +1 -1
- package/components/chip-group/chip-group.js +1 -1
- package/components/chip-group/chip-group.module.css +2 -2
- package/components/code-block/code-block.module.css +7 -14
- package/components/color-picker/color-picker.module.css +20 -21
- package/components/combobox/combobox.js +5 -1
- package/components/combobox/combobox.module.css +2 -2
- package/components/command-palette/command-palette.js +18 -11
- package/components/command-palette/command-palette.module.css +18 -18
- package/components/comment-thread/comment-thread.module.css +35 -35
- package/components/confirm-morph/confirm-morph.js +5 -5
- package/components/confirm-morph/confirm-morph.module.css +9 -9
- package/components/context-menu/context-menu.js +10 -28
- package/components/context-menu/context-menu.module.css +3 -3
- package/components/copy-button/copy-button.js +4 -4
- package/components/countdown/countdown.module.css +4 -4
- package/components/date-picker/date-picker.js +3 -3
- package/components/date-picker/date-picker.module.css +7 -7
- package/components/date-range-picker/date-range-picker.js +13 -10
- package/components/date-range-picker/date-range-picker.module.css +23 -22
- package/components/dialog/dialog.module.css +2 -2
- package/components/donut-chart/donut-chart.module.css +5 -5
- package/components/drawer/drawer.module.css +7 -7
- package/components/dropdown-menu/dropdown-menu.d.ts +71 -1
- package/components/dropdown-menu/dropdown-menu.js +100 -6
- package/components/dropdown-menu/dropdown-menu.module.css +15 -5
- package/components/elastic-slider/elastic-slider.js +2 -2
- package/components/elastic-slider/elastic-slider.module.css +4 -4
- package/components/expandable-card/expandable-card.js +1 -1
- package/components/expandable-card/expandable-card.module.css +1 -1
- package/components/expanding-button-group/expanding-button-group.module.css +3 -3
- package/components/expanding-search/expanding-search.js +3 -3
- package/components/expanding-search/expanding-search.module.css +9 -9
- package/components/file-dropzone/file-dropzone.js +3 -3
- package/components/file-dropzone/file-dropzone.module.css +21 -21
- package/components/file-upload/file-upload.module.css +7 -7
- package/components/filter-toolbar/filter-toolbar.js +7 -3
- package/components/filter-toolbar/filter-toolbar.module.css +9 -9
- package/components/floating-button-group/floating-button-group.module.css +7 -7
- package/components/gauge/gauge.js +1 -1
- package/components/gauge/gauge.module.css +2 -2
- package/components/hover-card/hover-card.js +2 -2
- package/components/hover-card/hover-card.module.css +2 -2
- package/components/image-compare/image-compare.module.css +4 -4
- package/components/inline-edit/inline-edit.module.css +12 -12
- package/components/json-viewer/json-viewer.module.css +12 -12
- package/components/line-chart/line-chart.js +1 -1
- package/components/line-chart/line-chart.module.css +8 -8
- package/components/mention-input/mention-input.js +4 -2
- package/components/mention-input/mention-input.module.css +8 -8
- package/components/metric-card/metric-card.module.css +1 -1
- package/components/money-input/money-input.js +6 -3
- package/components/money-input/money-input.module.css +10 -10
- package/components/morph-select/morph-select.js +7 -5
- package/components/morph-select/morph-select.module.css +13 -13
- package/components/multi-select/multi-select.js +4 -2
- package/components/multi-select/multi-select.module.css +6 -6
- package/components/nav-list/nav-list.d.ts +64 -0
- package/components/nav-list/nav-list.js +96 -0
- package/components/nav-list/nav-list.module.css +25 -0
- package/components/notification-center/notification-center.module.css +27 -27
- package/components/number-field/number-field.js +3 -3
- package/components/number-field/number-field.module.css +3 -3
- package/components/otp-input/otp-input.module.css +4 -4
- package/components/pagination/pagination.module.css +1 -1
- package/components/password-field/password-field.module.css +2 -2
- package/components/password-strength/password-strength.module.css +8 -8
- package/components/phone-input/phone-input.js +9 -7
- package/components/phone-input/phone-input.module.css +19 -19
- package/components/popover/popover.module.css +2 -2
- package/components/progress/progress.module.css +1 -1
- package/components/radio-cards/radio-cards.module.css +8 -8
- package/components/radio-group/radio-group.js +4 -1
- package/components/radio-group/radio-group.module.css +4 -3
- package/components/resizable-panels/resizable-panels.module.css +5 -5
- package/components/rich-text-editor/rich-text-editor.js +3 -3
- package/components/rich-text-editor/rich-text-editor.module.css +12 -12
- package/components/ridgeline/ridgeline.module.css +7 -7
- package/components/scroll-area/scroll-area.module.css +8 -8
- package/components/segmented-control/segmented-control.d.ts +3 -1
- package/components/segmented-control/segmented-control.js +5 -2
- package/components/segmented-control/segmented-control.module.css +9 -4
- package/components/select/select.module.css +5 -5
- package/components/shortcut-recorder/shortcut-recorder.js +5 -5
- package/components/shortcut-recorder/shortcut-recorder.module.css +16 -16
- package/components/signature-pad/signature-pad.module.css +11 -11
- package/components/slider/slider.module.css +4 -4
- package/components/slope-chart/slope-chart.module.css +7 -7
- package/components/slot-text/slot-text.js +2 -1
- package/components/sortable-data-table/sortable-data-table.module.css +4 -4
- package/components/sparkline/sparkline.js +1 -1
- package/components/split-button/split-button.module.css +6 -6
- package/components/stepper/stepper.module.css +3 -3
- package/components/streamgraph/streamgraph.module.css +7 -7
- package/components/swipe-actions/swipe-actions.js +2 -2
- package/components/swipe-actions/swipe-actions.module.css +5 -5
- package/components/switch/switch.js +2 -2
- package/components/switch/switch.module.css +1 -1
- package/components/tabs/tabs.d.ts +9 -2
- package/components/tabs/tabs.js +11 -5
- package/components/tabs/tabs.module.css +10 -3
- package/components/tag-input/tag-input.module.css +4 -4
- package/components/text-reveal/text-reveal.js +1 -1
- package/components/time-picker/time-picker.js +4 -2
- package/components/time-picker/time-picker.module.css +3 -3
- package/components/timeline/timeline.js +4 -4
- package/components/timeline/timeline.module.css +3 -3
- package/components/toast/toast.js +1 -1
- package/components/toast/toast.module.css +5 -5
- package/components/toast-stack/toast-stack.js +1 -1
- package/components/toast-stack/toast-stack.module.css +5 -5
- package/components/tooltip/tooltip.module.css +1 -1
- package/components/tree-view/tree-view.js +16 -12
- package/components/tree-view/tree-view.module.css +10 -8
- package/components/treemap/treemap.module.css +13 -13
- package/components/usage-meter/usage-meter.js +1 -1
- package/components/usage-meter/usage-meter.module.css +5 -5
- package/components/user-menu/user-menu.js +16 -14
- package/components/user-menu/user-menu.module.css +22 -22
- package/components/waffle-chart/waffle-chart.module.css +7 -7
- package/components.json +416 -1
- package/eslint.js +35 -3
- package/lib/fluid-hover.d.ts +83 -0
- package/lib/fluid-hover.js +184 -0
- package/lib/menu-highlight.d.ts +24 -11
- package/lib/menu-highlight.js +29 -28
- package/lib/motion-tokens.d.ts +76 -18
- package/lib/motion-tokens.js +45 -10
- package/package.json +1 -1
- package/styles.css +50 -7
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/* The status mark hugs its words: its width springs to each message and grows from the right edge, so the text never slides. */
|
|
8
8
|
.badge { display: inline-flex; flex: none; height: 28px; justify-content: flex-end; overflow: hidden; border-radius: var(--radius-full); corner-shape: round; background: var(--surface-muted); color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; line-height: 1; transition: background-color var(--duration-standard) var(--ease-standard), color var(--duration-standard) var(--ease-standard); }
|
|
9
|
-
.badgeInner { display: inline-flex; flex: none; align-items: center; gap:
|
|
9
|
+
.badgeInner { display: inline-flex; flex: none; align-items: center; gap: var(--space-related); padding: 0 var(--space-group); white-space: nowrap; }
|
|
10
10
|
.badgeIcon { display: grid; place-items: center; }
|
|
11
11
|
.badge[data-status="near"] { background: color-mix(in oklab, var(--warning) 14%, var(--surface)); color: var(--foreground); }
|
|
12
12
|
.badge[data-status="near"] .badgeIcon { color: var(--warning); }
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
.swapText { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
21
21
|
|
|
22
22
|
/* The bar leaves room above and below the track for the limit marker. */
|
|
23
|
-
.bar { position: relative; padding-block:
|
|
23
|
+
.bar { position: relative; padding-block: var(--space-tight); }
|
|
24
24
|
.track { position: relative; height: 14px; overflow: hidden; border-radius: var(--radius-full); corner-shape: round; background: color-mix(in oklab, var(--foreground) 7%, var(--surface)); isolation: isolate; -webkit-tap-highlight-color: transparent; }
|
|
25
25
|
.segment { position: absolute; inset: 0; transition: opacity var(--duration-fast) var(--ease-standard); }
|
|
26
26
|
.segment[data-index="0"], .swatch[data-index="0"] { background: var(--segment-0); }
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
.limit { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; border-radius: var(--radius-full); corner-shape: round; background: var(--foreground); pointer-events: none; }
|
|
37
37
|
|
|
38
38
|
/* The legend doubles as the keyboard path: arrow keys move between categories, focus previews one, a press pins it. */
|
|
39
|
-
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap:
|
|
40
|
-
.item { display: grid; min-width: 0; justify-items: start; gap:
|
|
39
|
+
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: var(--space-hair); margin: 0 calc(var(--space-related) * -1); }
|
|
40
|
+
.item { display: grid; min-width: 0; justify-items: start; gap: var(--space-hair); padding: var(--space-related); border: 0; border-radius: calc(var(--radius-control) - var(--space-related)); corner-shape: var(--corner-shape); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard); }
|
|
41
41
|
@media (hover: hover) and (pointer: fine) { .item:hover { background: var(--surface-muted); } }
|
|
42
42
|
.item[aria-pressed="true"] { background: var(--surface-muted); }
|
|
43
43
|
.item[data-highlight="off"] { opacity: .45; }
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
.swatch { grid-area: 1 / 1; width: 10px; height: 10px; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); }
|
|
48
48
|
.swatch[data-index="free"] { background: color-mix(in oklab, var(--foreground) 7%, var(--surface)); box-shadow: inset 0 0 0 1px var(--border-strong); }
|
|
49
49
|
.keyIcon { grid-area: 1 / 1; display: grid; place-items: center; color: var(--danger); }
|
|
50
|
-
.itemValue { display: flex; align-items: baseline; gap:
|
|
50
|
+
.itemValue { display: flex; align-items: baseline; gap: var(--space-tight); padding-left: var(--space-comfort); color: var(--foreground); font-size: var(--text-base); font-weight: 500; line-height: var(--leading-body); }
|
|
51
51
|
.itemUnit { color: var(--text-secondary); font-size: var(--text-sm); font-weight: 400; }
|
|
52
52
|
|
|
53
53
|
/* A rolling number: each digit is a clipped wheel that feathers at its edges, and new columns open from zero width. */
|
|
@@ -5,6 +5,7 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
6
|
import { ChevronDown, LoaderCircle, LogOut, Monitor, Moon, Sun, SunMoon } from "lucide-react";
|
|
7
7
|
import { motionTokens } from "../../lib/motion-tokens.js";
|
|
8
|
+
import { useNearestItem } from "../../lib/fluid-hover.js";
|
|
8
9
|
import styles from "./user-menu.module.css";
|
|
9
10
|
/** Statuses in menu order. Each one has its own dot shape as well as color: solid, barred, or hollow. */
|
|
10
11
|
export const userStatuses = [
|
|
@@ -27,16 +28,16 @@ const exitEase = [0.4, 0, 1, 1];
|
|
|
27
28
|
/** The panel grows out of the trigger on a critically damped spring; rows follow a beat later. Closing is a short fade. */
|
|
28
29
|
const panelMotion = {
|
|
29
30
|
closed: { opacity: 0, scale: .94 },
|
|
30
|
-
open: { opacity: 1, scale: 1, transition: { type: "spring", visualDuration: .
|
|
31
|
+
open: { opacity: 1, scale: 1, transition: { type: "spring", visualDuration: motionTokens.spring.moderate.visualDuration, bounce: 0, opacity: { duration: motionTokens.duration.fast, ease: enter }, delayChildren: .03, staggerChildren: .016 } },
|
|
31
32
|
exit: { opacity: 0, scale: .97, transition: { duration: motionTokens.duration.instant, ease: exitEase } },
|
|
32
33
|
};
|
|
33
34
|
const sheetMotion = {
|
|
34
35
|
closed: { y: "100%" },
|
|
35
|
-
open: { y: 0, transition: { ...motionTokens.spring.smooth, visualDuration: .
|
|
36
|
-
exit: { y: "100%", transition: { duration: .
|
|
36
|
+
open: { y: 0, transition: { ...motionTokens.spring.smooth, visualDuration: motionTokens.spring.slow.visualDuration, delayChildren: .06, staggerChildren: .02 } },
|
|
37
|
+
exit: { y: "100%", transition: { duration: motionTokens.duration.exit, ease: exitEase } },
|
|
37
38
|
};
|
|
38
39
|
const stillMotion = { closed: { opacity: 0 }, open: { opacity: 1, transition: { duration: motionTokens.duration.instant } }, exit: { opacity: 0, transition: { duration: motionTokens.duration.instant } } };
|
|
39
|
-
const rowMotion = { closed: { opacity: 0, y: 3 }, open: { opacity: 1, y: 0, transition: { duration: .
|
|
40
|
+
const rowMotion = { closed: { opacity: 0, y: 3 }, open: { opacity: 1, y: 0, transition: { duration: motionTokens.duration.exit, ease: enter } } };
|
|
40
41
|
/** A presence mark that morphs between statuses: the color crossfades while a hole opens for away and a bar slides in for busy. */
|
|
41
42
|
export function PresenceDot({ status, className }) {
|
|
42
43
|
return _jsx("span", { className: [styles.dot, className].filter(Boolean).join(" "), "data-status": status, "aria-hidden": "true" });
|
|
@@ -224,19 +225,20 @@ export function UserMenu({ user, status: statusProp, defaultStatus = "available"
|
|
|
224
225
|
}
|
|
225
226
|
setHighlight(current => ({ top: stop.offsetTop, height: stop.offsetHeight, tone: stop.dataset.tone, glide: current !== null }));
|
|
226
227
|
}
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (document.activeElement !== event.currentTarget)
|
|
232
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
233
|
-
}
|
|
228
|
+
// Fluid hover: the mouse focuses the nearest row, separators and padding included, so the highlight (which follows focus)
|
|
229
|
+
// lights it and the keyboard carries on from there. A click in a gap picks that row.
|
|
230
|
+
const nearest = useNearestItem({ items: '[data-stop="item"]', onPick: item => { if (document.activeElement !== item)
|
|
231
|
+
item.focus({ preventScroll: true }); } });
|
|
234
232
|
// The inline switches are not rows, so the pointer over them releases the highlight instead of dragging it along.
|
|
235
233
|
function onListPointerMove(event) {
|
|
236
|
-
if (event.pointerType === "touch"
|
|
234
|
+
if (event.pointerType === "touch")
|
|
237
235
|
return;
|
|
238
236
|
const group = event.target instanceof HTMLElement ? event.target.closest('[data-stop="group"]') : null;
|
|
239
|
-
if (!group
|
|
237
|
+
if (!group) {
|
|
238
|
+
nearest.onPointerMove(event);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (!highlight || group.contains(document.activeElement))
|
|
240
242
|
return;
|
|
241
243
|
setHighlight(null);
|
|
242
244
|
surfaceRef.current?.focus({ preventScroll: true });
|
|
@@ -308,7 +310,7 @@ export function UserMenu({ user, status: statusProp, defaultStatus = "available"
|
|
|
308
310
|
const glide = highlight?.glide && !reduced ? motionTokens.spring.snappy : { duration: 0 };
|
|
309
311
|
const row = reduced ? undefined : rowMotion;
|
|
310
312
|
const menuProps = { id: menuId, role: "menu", "aria-labelledby": triggerId, tabIndex: -1, onKeyDown };
|
|
311
|
-
const content = _jsxs(_Fragment, { children: [_jsxs(motion.div, { className: styles.header, variants: row, children: [_jsx(Face, { user: user, status: showStatus ? status : undefined, size: "md" }), _jsxs("div", { className: styles.identity, children: [_jsxs("div", { className: styles.nameRow, children: [_jsx("span", { className: styles.name, children: user.name }), user.plan && _jsx("span", { className: styles.plan, children: user.plan })] }), _jsx("span", { className: styles.email, title: user.email, children: user.email })] })] }), _jsxs("div", { ref: listRef, className: styles.list, onFocus: onListFocus, onPointerMove: onListPointerMove, onPointerLeave: onListPointerLeave, children: [_jsx(motion.span, { className: styles.highlight, "data-tone": highlight?.tone, "aria-hidden": "true", initial: false, animate: highlight ? { y: highlight.top, height: highlight.height, opacity: 1 } : { opacity: 0 }, transition: { default: glide, opacity: { duration: reduced ? 0 : motionTokens.duration.instant } } }), items.length > 0 && _jsxs(_Fragment, { children: [_jsx("div", { className: styles.separator, role: "separator" }), items.map(item => _jsxs(motion.button, { type: "button", role: "menuitem", tabIndex: -1, className: styles.item, "data-stop": "item", "data-label": item.label, variants: row,
|
|
313
|
+
const content = _jsxs(_Fragment, { children: [_jsxs(motion.div, { className: styles.header, variants: row, children: [_jsx(Face, { user: user, status: showStatus ? status : undefined, size: "md" }), _jsxs("div", { className: styles.identity, children: [_jsxs("div", { className: styles.nameRow, children: [_jsx("span", { className: styles.name, children: user.name }), user.plan && _jsx("span", { className: styles.plan, children: user.plan })] }), _jsx("span", { className: styles.email, title: user.email, children: user.email })] })] }), _jsxs("div", { ref: listRef, className: styles.list, onFocus: onListFocus, onPointerMove: onListPointerMove, onClick: nearest.onClick, onPointerLeave: onListPointerLeave, children: [_jsx(motion.span, { className: styles.highlight, "data-tone": highlight?.tone, "aria-hidden": "true", initial: false, animate: highlight ? { y: highlight.top, height: highlight.height, opacity: 1 } : { opacity: 0 }, transition: { default: glide, opacity: { duration: reduced ? 0 : motionTokens.duration.instant } } }), items.length > 0 && _jsxs(_Fragment, { children: [_jsx("div", { className: styles.separator, role: "separator" }), items.map(item => _jsxs(motion.button, { type: "button", role: "menuitem", tabIndex: -1, className: styles.item, "data-stop": "item", "data-label": item.label, variants: row, onClick: () => { close(true); item.onSelect?.(); }, children: [_jsx("span", { className: styles.icon, "aria-hidden": "true", children: item.icon }), _jsx("span", { className: styles.itemLabel, children: item.label }), item.keys && _jsx(Keys, { keys: item.keys })] }, item.label))] }), (showTheme || showStatus) && _jsxs(_Fragment, { children: [_jsx("div", { className: styles.separator, role: "separator" }), showStatus && _jsx(Segmented, { label: "Status", icon: _jsx(PresenceDot, { status: status }), value: status, onChange: changeStatus, options: userStatuses.map(option => ({ ...option, icon: _jsx(PresenceDot, { status: option.value }) })), variants: row }), showTheme && _jsx(Segmented, { label: "Theme", icon: _jsx(SunMoon, { size: 16, strokeWidth: 1.75 }), value: theme, onChange: changeTheme, options: themes, variants: row })] }), _jsx("div", { className: styles.separator, role: "separator" }), _jsxs(motion.button, { type: "button", role: "menuitem", tabIndex: -1, className: styles.item, "data-stop": "item", "data-tone": "danger", "data-label": "Sign out", variants: row, "aria-busy": signingOut || undefined, onClick: signOut, children: [_jsx("span", { className: styles.icon, "aria-hidden": "true", children: signingOut ? _jsx(LoaderCircle, { className: styles.spinner, size: 16, strokeWidth: 1.75 }) : _jsx(LogOut, { size: 16, strokeWidth: 1.75 }) }), _jsx("span", { className: styles.itemLabel, children: _jsx(Rise, { text: signingOut ? "Signing out" : "Sign out", reduced: reduced }) }), signOutKeys && _jsx(Keys, { keys: signOutKeys })] })] })] });
|
|
312
314
|
const panel = _jsx(AnimatePresence, { children: open && !sheet && _jsx(motion.div, { ref: surfaceRef, ...menuProps, className: styles.panel, "data-inline": inline || undefined, "data-align": align, variants: reduced ? stillMotion : panelMotion, initial: "closed", animate: "open", exit: "exit", children: content }, "panel") });
|
|
313
315
|
const bottomSheet = _jsxs(AnimatePresence, { children: [open && sheet && _jsx(motion.div, { className: styles.scrim, "aria-hidden": "true", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: reduced ? .1 : .2, ease: standard }, onClick: () => close(true) }, "scrim"), open && sheet && _jsxs(motion.div, { ref: surfaceRef, ...menuProps, className: `${styles.panel} ${styles.sheet}`, "aria-modal": "true", variants: reduced ? stillMotion : sheetMotion, initial: "closed", animate: "open", exit: "exit", drag: reduced ? false : "y", dragConstraints: { top: 0, bottom: 0 }, dragElastic: { top: .04, bottom: .9 }, dragMomentum: false, onDragEnd: onDragEnd, children: [_jsx("span", { className: styles.handle, "aria-hidden": "true" }), content] }, "sheet")] });
|
|
314
316
|
return _jsxs("span", { ref: rootRef, className: styles.root, children: [_jsxs("button", { ref: setTriggerRef, id: triggerId, type: "button", className: [styles.trigger, className].filter(Boolean).join(" "), "data-state": open ? "open" : "closed", "data-name": showName || undefined, "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? menuId : undefined, "aria-label": `Account menu, ${user.name}, ${user.name.trim().split(/\s+/).slice(0, 2).map(part => part[0]?.toUpperCase()).join("")}${showStatus ? `, ${statusLabel(status)}` : ""}`, onClick: onTriggerClick, onKeyDown: onTriggerKeyDown, children: [_jsx(Face, { user: user, status: showStatus ? status : undefined, size: "sm" }), showName && _jsxs(_Fragment, { children: [_jsx("span", { className: styles.triggerName, children: user.name }), _jsx(ChevronDown, { className: styles.chevron, size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] })] }), sheet ? createPortal(bottomSheet, document.body) : inline ? panel : hydrated ? createPortal(panel, document.body) : null] });
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
.root { position: relative; display: inline-flex; flex: none; vertical-align: middle; }
|
|
2
2
|
|
|
3
3
|
/* The trigger anchors the menu, so it answers hover and press with color, never with scale. */
|
|
4
|
-
.trigger { --presence-surface: var(--user-menu-surface, var(--surface)); position: relative; display: inline-flex; height: 40px; flex: none; align-items: center; gap: var(--space-related); margin: 0; padding:
|
|
5
|
-
.trigger[data-name] { padding-right:
|
|
4
|
+
.trigger { --presence-surface: var(--user-menu-surface, var(--surface)); position: relative; display: inline-flex; height: 40px; flex: none; align-items: center; gap: var(--space-related); margin: 0; padding: var(--space-tight); border: 0; border-radius: var(--radius-full); corner-shape: round; background: transparent; color: var(--foreground); font: inherit; font-family: var(--font-body); font-size: var(--text-sm); letter-spacing: var(--tracking-body); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--duration-fast) var(--ease-standard); }
|
|
5
|
+
.trigger[data-name] { padding-right: var(--space-group); }
|
|
6
6
|
@media (hover: hover) and (pointer: fine) { .trigger:hover { --presence-surface: var(--surface-muted); background: var(--surface-muted); } }
|
|
7
7
|
.trigger[data-state="open"] { --presence-surface: var(--surface-muted); background: var(--surface-muted); }
|
|
8
8
|
.trigger:active { --presence-surface: color-mix(in oklab, var(--surface-muted), var(--foreground) 8%); background: color-mix(in oklab, var(--surface-muted), var(--foreground) 8%); }
|
|
9
9
|
.triggerName { max-width: 11rem; overflow: hidden; font-weight: 500; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
|
|
10
|
-
.chevron { flex: none; margin-left: -
|
|
10
|
+
.chevron { flex: none; margin-left: calc(var(--space-hair) * -1); color: var(--text-muted); transition: transform var(--duration-spring) var(--ease-spring), color var(--duration-fast) var(--ease-standard); }
|
|
11
11
|
.trigger:hover .chevron, .trigger[data-state="open"] .chevron { color: var(--foreground); }
|
|
12
12
|
.trigger[data-state="open"] .chevron { transform: rotate(180deg); }
|
|
13
13
|
@media (max-width: 639px) {
|
|
14
|
-
.trigger[data-name] { padding-right:
|
|
14
|
+
.trigger[data-name] { padding-right: var(--space-tight); }
|
|
15
15
|
.triggerName, .chevron { display: none; }
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
.dot[data-status="offline"] { --dot-color: var(--text-muted); }
|
|
35
35
|
|
|
36
36
|
/* The panel scales out of the avatar it belongs to; the component sets the origin once it is placed. */
|
|
37
|
-
.panel { --presence-surface: var(--surface-raised); --row: 32px; --inset: 4px; --menu-radius: var(--radius-detail); --menu-line: color-mix(in oklab, var(--foreground) 9%, transparent); position: fixed; top: 0; left: 0; z-index:
|
|
38
|
-
.panel[data-inline] { position: absolute; top: calc(100% +
|
|
37
|
+
.panel { --presence-surface: var(--surface-raised); --row: 32px; --inset: 4px; --menu-radius: var(--radius-detail); --menu-line: color-mix(in oklab, var(--foreground) 9%, transparent); position: fixed; top: 0; left: 0; z-index: var(--layer-dropdown); box-sizing: border-box; width: 15.5rem; max-width: calc(100vw - 24px); padding: var(--inset); border: .5px solid var(--border); border-radius: var(--menu-radius); background: var(--surface-raised); box-shadow: var(--shadow-floating); color: var(--foreground); font-family: var(--font-body); letter-spacing: -.01em; line-height: 1.3; text-align: left; outline: none; transform-origin: var(--origin-x, 100%) var(--origin-y, 0px); }
|
|
38
|
+
.panel[data-inline] { position: absolute; top: calc(100% + var(--space-related)); left: auto; }
|
|
39
39
|
.panel[data-inline][data-align="end"] { right: 0; }
|
|
40
40
|
.panel[data-inline][data-align="start"] { left: 0; }
|
|
41
|
-
.panel[data-inline][data-align="center"] { left: 50%; margin-left: -
|
|
41
|
+
.panel[data-inline][data-align="center"] { left: 50%; margin-left: calc(calc(var(--space-screen) + var(--space-page)) * -1); }
|
|
42
42
|
|
|
43
|
-
.header { display: flex; align-items: center; gap:
|
|
44
|
-
.identity { display: grid; min-width: 0; flex: 1; gap:
|
|
43
|
+
.header { display: flex; align-items: center; gap: var(--space-group); padding: var(--space-related) var(--space-related) var(--space-related); }
|
|
44
|
+
.identity { display: grid; min-width: 0; flex: 1; gap: var(--space-hair); }
|
|
45
45
|
/* The name keeps its room; a long plan or role shrinks and truncates first. */
|
|
46
|
-
.nameRow { display: flex; min-width: 0; align-items: center; gap:
|
|
47
|
-
.name { min-width: 0; flex: 0 1 auto; overflow: hidden; color: var(--foreground); font-size:
|
|
48
|
-
.plan { display: inline-block; min-width: 0; max-width: 55%; flex: 0 100 auto; overflow: hidden; height: 17px; padding: 0
|
|
49
|
-
.email { overflow: hidden; color: var(--text-muted); font-size:
|
|
46
|
+
.nameRow { display: flex; min-width: 0; align-items: center; gap: var(--space-related); }
|
|
47
|
+
.name { min-width: 0; flex: 0 1 auto; overflow: hidden; color: var(--foreground); font-size: var(--text-sm); font-weight: 500; letter-spacing: -.012em; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
|
|
48
|
+
.plan { display: inline-block; min-width: 0; max-width: 55%; flex: 0 100 auto; overflow: hidden; height: 17px; padding: 0 var(--space-tight); border: .5px solid var(--menu-line); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: color-mix(in oklab, var(--foreground) 4%, transparent); color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; letter-spacing: -.005em; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
|
|
49
|
+
.email { overflow: hidden; color: var(--text-muted); font-size: var(--text-xs); letter-spacing: -.008em; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
|
|
50
50
|
|
|
51
51
|
.list { position: relative; }
|
|
52
52
|
.separator { height: .5px; margin: var(--inset) calc(var(--inset) * -1); background: var(--menu-line); }
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
/* One highlight follows the pointer and the keyboard. It is the only hover treatment in the menu. */
|
|
56
56
|
.highlight { position: absolute; top: 0; right: 0; left: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: color-mix(in oklab, var(--foreground) 6%, transparent); opacity: 0; pointer-events: none; }
|
|
57
57
|
|
|
58
|
-
.item { position: relative; display: flex; width: 100%; height: var(--row); box-sizing: border-box; align-items: center; gap:
|
|
58
|
+
.item { position: relative; display: flex; width: 100%; height: var(--row); box-sizing: border-box; align-items: center; gap: var(--space-group); margin: 0; padding: 0 var(--space-related); border: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: transparent; color: var(--foreground); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; outline: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard); }
|
|
59
59
|
.icon { display: inline-grid; width: 16px; flex: none; place-items: center; color: var(--text-secondary); transition: color var(--duration-fast) var(--ease-standard); }
|
|
60
60
|
.item:focus .icon { color: var(--foreground); }
|
|
61
61
|
.itemLabel { position: relative; display: inline-flex; min-width: 0; flex: 1; }
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
.keys { display: inline-flex; flex: none; align-items: center; gap: 1px; margin-left: auto; color: var(--text-muted); font-family: var(--font-body); font-size: var(--text-xs); letter-spacing: 0; opacity: .8; font-variant-numeric: tabular-nums; }
|
|
67
67
|
.key { display: inline-block; min-width: 1.05em; font: inherit; text-align: center; }
|
|
68
68
|
|
|
69
|
-
.row { position: relative; display: flex; height: 36px; align-items: center; gap:
|
|
70
|
-
.rowLabel { flex: 1; color: var(--foreground); font-size:
|
|
69
|
+
.row { position: relative; display: flex; height: 36px; align-items: center; gap: var(--space-group); padding: 0 var(--space-tight) 0 var(--space-related); }
|
|
70
|
+
.rowLabel { flex: 1; color: var(--foreground); font-size: var(--text-sm); }
|
|
71
71
|
.row .icon .dot { --dot-size: 10px; }
|
|
72
72
|
/* The thumb slides under the icons; the group owns the stacking context. */
|
|
73
|
-
.segments { --segment: 28px; position: relative; isolation: isolate; display: inline-grid; height: 26px; flex: none; grid-auto-columns: var(--segment); grid-auto-flow: column; padding:
|
|
74
|
-
.thumb { position: absolute; z-index: -1; top:
|
|
73
|
+
.segments { --segment: 28px; position: relative; isolation: isolate; display: inline-grid; height: 26px; flex: none; grid-auto-columns: var(--segment); grid-auto-flow: column; padding: var(--space-hair); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: color-mix(in oklab, var(--foreground) 5%, transparent); }
|
|
74
|
+
.thumb { position: absolute; z-index: -1; top: var(--space-hair); bottom: var(--space-hair); left: var(--space-hair); width: var(--segment); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: var(--surface-raised); box-shadow: var(--shadow-thumb), 0 0 0 .5px var(--menu-line); transform: translateX(calc(var(--index) * 100%)); transition: transform var(--duration-spring) var(--ease-spring); }
|
|
75
75
|
:global([data-theme="dark"]) .thumb { background: color-mix(in oklab, var(--foreground) 20%, var(--surface-raised)); box-shadow: none; }
|
|
76
76
|
.segment { display: grid; place-items: center; margin: 0; padding: 0; border: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: transparent; color: var(--text-muted); cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard); }
|
|
77
77
|
.segment .dot { --dot-size: 9px; --presence-surface: var(--surface-raised); }
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
@keyframes user-menu-spin { to { transform: rotate(360deg); } }
|
|
83
83
|
|
|
84
84
|
/* Below 640px the same content rises as a bottom sheet with larger rows. */
|
|
85
|
-
.scrim { position: fixed; inset: 0; z-index:
|
|
86
|
-
.sheet { --row: 46px; --inset: 10px; position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index:
|
|
87
|
-
.handle { display: block; width: 36px; height: 5px; margin: 0 auto
|
|
88
|
-
.sheet .header { padding:
|
|
85
|
+
.scrim { position: fixed; inset: 0; z-index: var(--layer-overlay); background: var(--scrim); -webkit-tap-highlight-color: transparent; }
|
|
86
|
+
.sheet { --row: 46px; --inset: 10px; position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: var(--layer-dialog); width: auto; max-width: none; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-related) var(--inset) calc(var(--space-group) + env(safe-area-inset-bottom)); border-bottom: 0; border-radius: var(--radius-container) var(--radius-container) 0 0; corner-shape: var(--corner-shape); }
|
|
87
|
+
.handle { display: block; width: 36px; height: 5px; margin: 0 auto var(--space-group); border-radius: var(--radius-full); corner-shape: round; background: var(--border-strong); cursor: grab; }
|
|
88
|
+
.sheet .header { padding: var(--space-tight) var(--space-related) var(--space-group); }
|
|
89
89
|
.sheet .item, .sheet .rowLabel { font-size: var(--text-base); }
|
|
90
90
|
.sheet .row { height: 52px; }
|
|
91
91
|
.sheet .segments { --segment: 40px; height: 34px; }
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
.cell[data-shape="framed"] { --inner: inset 0 0 0 2.5px var(--cell), inset 0 0 0 3.25px var(--surface); }
|
|
20
20
|
.swatch[data-shape="framed"], .tipSwatch[data-shape="framed"] { box-shadow: inset 0 0 0 2px var(--cell), inset 0 0 0 3px var(--surface); }
|
|
21
21
|
|
|
22
|
-
.tooltip { position: absolute; top: 0; left: 0; z-index: 2; display: grid; min-width: 150px; max-width: min(240px, 100%); gap:
|
|
22
|
+
.tooltip { position: absolute; top: 0; left: 0; z-index: 2; display: grid; min-width: 150px; max-width: min(240px, 100%); gap: var(--space-hair); padding: var(--space-related) var(--space-group); border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--surface-raised); box-shadow: var(--shadow-floating); opacity: 0; pointer-events: none; scale: .96; transition: opacity var(--duration-fast) var(--ease-standard), scale var(--duration-fast) var(--ease-standard); }
|
|
23
23
|
.tooltip[data-shown] { opacity: 1; scale: 1; }
|
|
24
|
-
.tipRow { display: flex; min-width: 0; align-items: center; gap:
|
|
24
|
+
.tipRow { display: flex; min-width: 0; align-items: center; gap: var(--space-related); margin: 0; font-size: var(--text-sm); line-height: 1.3; }
|
|
25
25
|
.tipSwatch { width: 10px; height: 10px; flex: none; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: var(--cell); transition: background-color var(--duration-fast) var(--ease-standard); }
|
|
26
26
|
.tipName { min-width: 0; flex: 1; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
|
|
27
|
-
.tipValue { flex: none; margin-left:
|
|
28
|
-
.tipMeta { margin: 0 0 0
|
|
27
|
+
.tipValue { flex: none; margin-left: var(--space-related); font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
28
|
+
.tipMeta { margin: 0 0 0 var(--space-comfort); color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
29
29
|
|
|
30
30
|
.message { display: grid; min-height: 160px; place-items: center; margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
|
|
31
31
|
|
|
32
32
|
/* The legend doubles as the reading: each share rolls to its new value. */
|
|
33
|
-
.legend { display: grid; min-width: 0; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap:
|
|
33
|
+
.legend { display: grid; min-width: 0; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--space-hair) var(--space-related); margin: 0; padding: 0; list-style: none; }
|
|
34
34
|
@container (min-width: 420px) { .figure[data-legend] .legend { grid-template-columns: minmax(0, 1fr); } }
|
|
35
35
|
/* Below the side-by-side layout two columns would clip names like "Wind and solar", so the legend reads as one list. */
|
|
36
36
|
/* Stacked, the legend shares the grid's measure and its row padding hangs outside, so swatches and shares line up with the cell edges. */
|
|
37
|
-
@container (max-width: 419px) { .legend { grid-template-columns: minmax(0, 1fr); margin-inline: max(-
|
|
38
|
-
.item { display: grid; width: 100%; min-height: 36px; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap:
|
|
37
|
+
@container (max-width: 419px) { .legend { grid-template-columns: minmax(0, 1fr); margin-inline: max(calc(var(--space-group) * -1), calc((100% - calc(var(--space-screen) + var(--space-screen) + var(--space-screen) + var(--space-screen))) / 2)); } }
|
|
38
|
+
.item { display: grid; width: 100%; min-height: 36px; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: var(--space-group); padding: var(--space-tight) var(--space-group); border: 0; border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: var(--text-sm); line-height: var(--leading-body); text-align: left; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
|
|
39
39
|
.item:active { transform: scale(.98); }
|
|
40
40
|
.item[data-on] { color: var(--foreground); background: color-mix(in oklab, var(--foreground) 5%, transparent); }
|
|
41
41
|
.item[data-dim] { opacity: .5; }
|