@ciridae/ui 2.82.0 → 2.83.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/dist/components/app-frame.d.ts +9 -4
- package/dist/components/app-frame.js +35 -13
- package/dist/components/app-navigation.js +5 -3
- package/dist/components/locale.d.ts +1 -1
- package/dist/components/locale.js +2 -2
- package/dist/components/menu.d.ts +28 -0
- package/dist/components/menu.js +79 -1
- package/dist/styled-system/styles.css +37 -9
- package/package.json +1 -1
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { type AppNavigationProps, type NavSection } from "./app-navigation.js";
|
|
2
|
+
import { type AvatarProps } from "./data-display.js";
|
|
2
3
|
import { type HotkeyChord } from "./hotkeys.js";
|
|
3
4
|
import { type MenuItem } from "./menu.js";
|
|
4
5
|
import type { ChatListBadge } from "../chat/chat-list-source.js";
|
|
5
6
|
import type { ComponentProps, ReactElement, ReactNode } from "react";
|
|
6
|
-
/** The color theme
|
|
7
|
+
/** The color theme row: light, dark or the system's, chosen in the row itself. */
|
|
7
8
|
export declare function useColorThemeMenuItem(): MenuItem;
|
|
8
9
|
export type AccountMenuProps = {
|
|
9
|
-
|
|
10
|
+
/** The account's `Avatar`, drawn in the sidebar's row and, at 28, in the menu's first row. */
|
|
11
|
+
avatar: ReactElement<AvatarProps>;
|
|
10
12
|
name: string;
|
|
13
|
+
/** Under the name in the sidebar's row, such as the organization the account is working in. */
|
|
11
14
|
detail?: ReactNode;
|
|
12
|
-
/**
|
|
15
|
+
/** Under the name in the menu's first row. */
|
|
16
|
+
email?: string;
|
|
17
|
+
/** The app's own entries, such as Edit profile, under the account and the theme. */
|
|
13
18
|
items?: readonly MenuItem[];
|
|
14
19
|
/** The last entry, in the danger color. */
|
|
15
20
|
signOut?: {
|
|
@@ -20,7 +25,7 @@ export type AccountMenuProps = {
|
|
|
20
25
|
/** The avatar alone, for the rail and the phone header. */
|
|
21
26
|
compact?: boolean;
|
|
22
27
|
};
|
|
23
|
-
export declare function AccountMenu({ avatar, name, detail, items, signOut, compact, }: AccountMenuProps): import("react").JSX.Element;
|
|
28
|
+
export declare function AccountMenu({ avatar, name, detail, email, items, signOut, compact, }: AccountMenuProps): import("react").JSX.Element;
|
|
24
29
|
export type AgentLauncherProps = Omit<ComponentProps<"button">, "children"> & {
|
|
25
30
|
/** The rail's button is named by it. */
|
|
26
31
|
label: string;
|
|
@@ -2,11 +2,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
/*
|
|
3
3
|
* The app's frame, composed from the shell's pieces: the sidebar that folds to a rail and then
|
|
4
4
|
* into the phone menu, its footer rows and account menu drawn for each width, and, given a
|
|
5
|
-
* `title`, the main panel's header too. `AccountMenu` is the signed-in account's menu:
|
|
6
|
-
*
|
|
7
|
-
* sign-out as an action. `AgentLauncher` opens the app's assistant from the
|
|
5
|
+
* `title`, the main panel's header too. `AccountMenu` is the signed-in account's menu: who is
|
|
6
|
+
* signed in, the color theme, the app's own entries, and sign out. Auth stays with the host,
|
|
7
|
+
* which passes sign-out as an action. `AgentLauncher` opens the app's assistant from the
|
|
8
|
+
* sidebar's foot.
|
|
8
9
|
*/
|
|
9
|
-
import { ArrowClockwiseIcon, ArrowLeftIcon, CaretUpIcon, CircleHalfIcon, PulseIcon, SignOutIcon, } from "@phosphor-icons/react";
|
|
10
|
+
import { ArrowClockwiseIcon, ArrowLeftIcon, CaretUpIcon, CircleHalfIcon, MonitorIcon, MoonIcon, PulseIcon, SignOutIcon, SunIcon, } from "@phosphor-icons/react";
|
|
11
|
+
import { cloneElement } from "react";
|
|
10
12
|
import { css, cx } from "#primitives/css";
|
|
11
13
|
import { AppNavigation } from "./app-navigation.js";
|
|
12
14
|
import { Button, IconButton } from "./button.js";
|
|
@@ -22,37 +24,57 @@ import { AppAccountButton, AppBreadcrumbs, AppContent, AppHeader, AppHeaderActio
|
|
|
22
24
|
import { SidebarItem } from "./sidebar.js";
|
|
23
25
|
import { UnreadSignalBadge } from "./unread-signal-badge.js";
|
|
24
26
|
import { useNewVersionAvailable } from "./use-new-version-available.js";
|
|
25
|
-
/** The color theme
|
|
27
|
+
/** The color theme row: light, dark or the system's, chosen in the row itself. */
|
|
26
28
|
export function useColorThemeMenuItem() {
|
|
27
29
|
const colorTheme = useColorTheme();
|
|
28
30
|
const { labels } = useCiridaeLocale();
|
|
29
31
|
const choices = [
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
{
|
|
33
|
+
value: "light",
|
|
34
|
+
label: labels.colorTheme.light,
|
|
35
|
+
icon: _jsx(SunIcon, { className: icon({ size: "small" }) }),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: "dark",
|
|
39
|
+
label: labels.colorTheme.dark,
|
|
40
|
+
icon: _jsx(MoonIcon, { className: icon({ size: "small" }) }),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "system",
|
|
44
|
+
label: labels.colorTheme.system,
|
|
45
|
+
icon: _jsx(MonitorIcon, { className: icon({ size: "small" }) }),
|
|
46
|
+
},
|
|
33
47
|
];
|
|
34
48
|
return {
|
|
35
49
|
label: labels.colorTheme.title,
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
// Half filled, as the design draws the row's icon.
|
|
51
|
+
icon: _jsx(CircleHalfIcon, { className: icon({ size: "small" }), weight: "fill" }),
|
|
52
|
+
choices: choices.map((choice) => ({
|
|
38
53
|
label: choice.label,
|
|
54
|
+
icon: choice.icon,
|
|
39
55
|
checked: colorTheme.preference === choice.value,
|
|
40
56
|
onSelect: () => colorTheme.setPreference(choice.value),
|
|
41
57
|
})),
|
|
42
58
|
};
|
|
43
59
|
}
|
|
44
|
-
export function AccountMenu({ avatar, name, detail, items = [], signOut, compact = false, }) {
|
|
60
|
+
export function AccountMenu({ avatar, name, detail, email, items = [], signOut, compact = false, }) {
|
|
45
61
|
const { labels } = useCiridaeLocale();
|
|
46
62
|
const colorThemeItem = useColorThemeMenuItem();
|
|
63
|
+
// The menu's own row draws the account's avatar at the design's 28, a step under the sidebar
|
|
64
|
+
// row's 32 just below it.
|
|
65
|
+
const menuAvatar = cloneElement(avatar, { size: "author" });
|
|
47
66
|
return (_jsx(Menu
|
|
48
67
|
// In the sidebar the menu is as wide as the account row it opens from, as the design draws
|
|
49
68
|
// it, so it covers whatever sits above that row; the avatar alone opens a menu of its own width.
|
|
50
69
|
, {
|
|
51
70
|
// In the sidebar the menu is as wide as the account row it opens from, as the design draws
|
|
52
71
|
// it, so it covers whatever sits above that row; the avatar alone opens a menu of its own width.
|
|
53
|
-
matchTriggerWidth: !compact, triggerTooltip: compact ? labels.accountMenu.menu : undefined, trigger: _jsx(AppAccountButton, { "aria-label": labels.accountMenu.menu, avatar: avatar, compact: compact, detail: detail, name: name, trailing: _jsx(CaretUpIcon, { className: icon({ size: "small" }) }) }),
|
|
54
|
-
|
|
72
|
+
matchTriggerWidth: !compact, triggerTooltip: compact ? labels.accountMenu.menu : undefined, trigger: _jsx(AppAccountButton, { "aria-label": labels.accountMenu.menu, avatar: avatar, compact: compact, detail: detail, name: name, trailing: _jsx(CaretUpIcon, { className: icon({ size: "small" }) }) }),
|
|
73
|
+
// As the design draws it: who is signed in and their theme, then what they can do.
|
|
74
|
+
items: [
|
|
75
|
+
{ header: true, label: name, detail: email, icon: menuAvatar },
|
|
55
76
|
colorThemeItem,
|
|
77
|
+
...(items.length > 0 ? [{ separator: true }, ...items] : []),
|
|
56
78
|
...(signOut
|
|
57
79
|
? [
|
|
58
80
|
{ separator: true },
|
|
@@ -78,7 +78,8 @@ export function useSidebarRoom(hiddenRows) {
|
|
|
78
78
|
/**
|
|
79
79
|
* How much taller unfolding every section makes the navigation, from the rows it renders: each
|
|
80
80
|
* hidden row as tall as the tallest row shown, with the gap a section leaves between rows, less
|
|
81
|
-
* the More rows that unfolding removes
|
|
81
|
+
* the More rows that unfolding removes, plus the rows a `scrollWhenUnfolded` section keeps out of
|
|
82
|
+
* view in its short box, which a roomy sidebar lays out in full.
|
|
82
83
|
*/
|
|
83
84
|
function measureHeightUnfoldingAdds(nav, hiddenRows) {
|
|
84
85
|
const moreRows = Array.from(nav.querySelectorAll("[data-navigation-more]"));
|
|
@@ -86,10 +87,11 @@ function measureHeightUnfoldingAdds(nav, hiddenRows) {
|
|
|
86
87
|
// Without a More row, every section already shows all of its rows.
|
|
87
88
|
if (!moreRowSection)
|
|
88
89
|
return 0;
|
|
90
|
+
const heightScrolledOutOfView = Array.from(nav.querySelectorAll("[data-navigation-fold-scroll]"), (box) => box.scrollHeight - box.clientHeight).reduce((total, height) => total + height, 0);
|
|
89
91
|
const rowGap = parseFloat(getComputedStyle(moreRowSection).rowGap);
|
|
90
92
|
const tallestRowHeight = Math.max(...Array.from(nav.querySelectorAll("[data-sidebar-row]"), (row) => row.getBoundingClientRect().height));
|
|
91
93
|
const moreRowsHeight = moreRows.reduce((total, row) => total + row.getBoundingClientRect().height + rowGap, 0);
|
|
92
|
-
return hiddenRows * (tallestRowHeight + rowGap) - moreRowsHeight;
|
|
94
|
+
return hiddenRows * (tallestRowHeight + rowGap) - moreRowsHeight + heightScrolledOutOfView;
|
|
93
95
|
}
|
|
94
96
|
function NavRow({ item, activeIds, renderLink, }) {
|
|
95
97
|
return (_jsx(SidebarItem, { size: item.size, icon: item.icon, active: activeIds.includes(item.id), trailing: item.count !== undefined && _jsx("span", { className: navCount, children: item.count }), href: item.href, render: item.render ?? renderLink?.(item), onClick: item.onSelect, action: item.action, children: item.label }));
|
|
@@ -114,7 +116,7 @@ function SectionItems({ section, activeIds, renderLink, roomy, labels, expanded,
|
|
|
114
116
|
// The open page keeps its section unfolded, so a Less row could not fold it.
|
|
115
117
|
const holdsActiveItem = items.slice(maxVisible).some((item) => activeIds.includes(item.id));
|
|
116
118
|
const Caret = unfolded ? CaretUpIcon : CaretDownIcon;
|
|
117
|
-
return (_jsxs(_Fragment, { children: [!unfolded ? (rows(items.slice(0, maxVisible))) : section.scrollWhenUnfolded ? (_jsx("div", { className: foldScroll, children: rows(items) })) : (rows(items)), !holdsActiveItem && (_jsx(SidebarItem, { size: "compact", icon: _jsx(Caret, { className: icon({ size: "small" }) }), "aria-expanded": unfolded, onClick: () => onExpandedChange(!unfolded), "data-navigation-more": "", "data-sidebar-action": "", children: unfolded ? labels.less : labels.more }))] }));
|
|
119
|
+
return (_jsxs(_Fragment, { children: [!unfolded ? (rows(items.slice(0, maxVisible))) : section.scrollWhenUnfolded ? (_jsx("div", { className: foldScroll, "data-navigation-fold-scroll": "", children: rows(items) })) : (rows(items)), !holdsActiveItem && (_jsx(SidebarItem, { size: "compact", icon: _jsx(Caret, { className: icon({ size: "small" }) }), "aria-expanded": unfolded, onClick: () => onExpandedChange(!unfolded), "data-navigation-more": "", "data-sidebar-action": "", children: unfolded ? labels.less : labels.more }))] }));
|
|
118
120
|
}
|
|
119
121
|
/** Runs of sections: each main section alone, consecutive panel sections together. */
|
|
120
122
|
function sectionRuns(sections) {
|
|
@@ -728,7 +728,7 @@ export declare const englishLabels: {
|
|
|
728
728
|
menu: string;
|
|
729
729
|
signOut: string;
|
|
730
730
|
};
|
|
731
|
-
/** The account menu's
|
|
731
|
+
/** The account menu's Theme row and its three choices. */
|
|
732
732
|
colorTheme: {
|
|
733
733
|
title: string;
|
|
734
734
|
system: string;
|
|
@@ -709,8 +709,8 @@ export const englishLabels = {
|
|
|
709
709
|
/** Read before a `ValueChange`'s old and new values, which a screen reader does not mark as struck. */
|
|
710
710
|
valueChange: { from: "from", to: "to" },
|
|
711
711
|
accountMenu: { menu: "Account menu", signOut: "Sign out" },
|
|
712
|
-
/** The account menu's
|
|
713
|
-
colorTheme: { title: "
|
|
712
|
+
/** The account menu's Theme row and its three choices. */
|
|
713
|
+
colorTheme: { title: "Theme", system: "System", light: "Light", dark: "Dark" },
|
|
714
714
|
editableField: {
|
|
715
715
|
edit: (label) => `Change ${label}`,
|
|
716
716
|
saving: "Saving",
|
|
@@ -27,6 +27,7 @@ export type MenuItem = {
|
|
|
27
27
|
*/
|
|
28
28
|
render?: ReactElement;
|
|
29
29
|
items?: never;
|
|
30
|
+
choices?: never;
|
|
30
31
|
} | {
|
|
31
32
|
label: string;
|
|
32
33
|
icon?: ReactNode;
|
|
@@ -41,6 +42,7 @@ export type MenuItem = {
|
|
|
41
42
|
onSelect?: never;
|
|
42
43
|
href?: never;
|
|
43
44
|
render?: never;
|
|
45
|
+
choices?: never;
|
|
44
46
|
} | {
|
|
45
47
|
separator: true;
|
|
46
48
|
}
|
|
@@ -55,6 +57,32 @@ export type MenuItem = {
|
|
|
55
57
|
| {
|
|
56
58
|
group: true;
|
|
57
59
|
label: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A setting chosen in the row itself, such as the color theme: its name, then one icon per choice
|
|
63
|
+
* in a track, the chosen one raised. Choosing keeps the menu open, so the change is seen.
|
|
64
|
+
*/
|
|
65
|
+
| {
|
|
66
|
+
label: string;
|
|
67
|
+
icon?: ReactNode;
|
|
68
|
+
choices: readonly MenuChoice[];
|
|
69
|
+
items?: never;
|
|
70
|
+
disabled?: never;
|
|
71
|
+
loading?: never;
|
|
72
|
+
variant?: never;
|
|
73
|
+
checked?: never;
|
|
74
|
+
meta?: never;
|
|
75
|
+
shortcut?: never;
|
|
76
|
+
onSelect?: never;
|
|
77
|
+
href?: never;
|
|
78
|
+
render?: never;
|
|
79
|
+
};
|
|
80
|
+
/** One choice in a `choices` row. The row draws its icon; its label names it on hover and to a screen reader. */
|
|
81
|
+
export type MenuChoice = {
|
|
82
|
+
label: string;
|
|
83
|
+
icon: ReactNode;
|
|
84
|
+
checked: boolean;
|
|
85
|
+
onSelect: () => void;
|
|
58
86
|
};
|
|
59
87
|
export type MenuProps = Omit<ComponentProps<typeof BaseMenu.Root>, "children"> & {
|
|
60
88
|
trigger: ReactElement;
|
package/dist/components/menu.js
CHANGED
|
@@ -6,6 +6,7 @@ import { CaretRightIcon, CheckIcon, DotsThreeIcon } from "@phosphor-icons/react"
|
|
|
6
6
|
import { css, cx } from "#primitives/css";
|
|
7
7
|
import { IconButton } from "./button.js";
|
|
8
8
|
import { glassMenuDivider, glassMenuOffsetFromTrigger, glassMenuRow, glassMenuSurface, } from "./glass-menu.js";
|
|
9
|
+
import { faceEdge } from "./gradient-edge.js";
|
|
9
10
|
import { HotkeyLayer } from "./hotkeys.js";
|
|
10
11
|
import { directional, icon, Spinner } from "./icon.js";
|
|
11
12
|
import { ShortcutHint } from "./keycap.js";
|
|
@@ -49,7 +50,7 @@ const header = css({
|
|
|
49
50
|
alignItems: "center",
|
|
50
51
|
gap: "layout.controlGap",
|
|
51
52
|
paddingInline: "menu.itemInline",
|
|
52
|
-
paddingBlock: "control.
|
|
53
|
+
paddingBlock: "control.block",
|
|
53
54
|
fontSize: "body",
|
|
54
55
|
lineHeight: "compact",
|
|
55
56
|
cursor: "default",
|
|
@@ -82,6 +83,57 @@ const itemMeta = css({
|
|
|
82
83
|
fontSize: "code",
|
|
83
84
|
});
|
|
84
85
|
const separator = css(glassMenuDivider);
|
|
86
|
+
// A row that holds a control and is not one, so it takes no wash. Its track sits 6 from the row's
|
|
87
|
+
// top and bottom, as the design's Theme row draws it. It starts and ends where the menu's items
|
|
88
|
+
// and rules do, in the items' ink, so the row reads as one of them.
|
|
89
|
+
const choiceRow = css({
|
|
90
|
+
display: "flex",
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
gap: "layout.controlGap",
|
|
93
|
+
paddingBlock: "control.compactBlock",
|
|
94
|
+
paddingInline: "menu.itemInline",
|
|
95
|
+
fontSize: "body",
|
|
96
|
+
fontWeight: "medium",
|
|
97
|
+
lineHeight: "tight",
|
|
98
|
+
letterSpacing: "compact",
|
|
99
|
+
cursor: "default",
|
|
100
|
+
"& > [data-label]": { flex: "1", minWidth: "0" },
|
|
101
|
+
});
|
|
102
|
+
const choiceTrack = css({
|
|
103
|
+
display: "inline-flex",
|
|
104
|
+
flexShrink: "0",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
gap: "control.trackInset",
|
|
107
|
+
padding: "control.trackInset",
|
|
108
|
+
// The design lays the track's edge over its inset, and rounds it to its options' corners.
|
|
109
|
+
border: "0",
|
|
110
|
+
borderRadius: "[calc(token(radii.inset) + token(spacing.control.trackInset))]",
|
|
111
|
+
background: "[token(gradients.panel)]",
|
|
112
|
+
});
|
|
113
|
+
const choiceOption = css({
|
|
114
|
+
display: "inline-grid",
|
|
115
|
+
placeItems: "center",
|
|
116
|
+
width: "control.small",
|
|
117
|
+
height: "[calc(token(sizes.control.small) - 2 * token(spacing.control.trackInset))]",
|
|
118
|
+
border: "0",
|
|
119
|
+
borderRadius: "inset",
|
|
120
|
+
color: "fg.secondary",
|
|
121
|
+
cursor: "pointer",
|
|
122
|
+
outline: "0",
|
|
123
|
+
transitionProperty: "[background, color]",
|
|
124
|
+
transitionDuration: "fast",
|
|
125
|
+
_before: { display: "none", background: "[token(gradients.border.raised)]" },
|
|
126
|
+
// Pointed at or reached by the keys, an unchosen option takes the wash a segment does.
|
|
127
|
+
"&[data-highlighted]": { color: "fg.primary" },
|
|
128
|
+
"&[data-highlighted]:not([data-checked])": { background: "bg.controlHover" },
|
|
129
|
+
// Under the pointer the icon's ink is enough, so the ring marks only the choice the keys reached.
|
|
130
|
+
"&:focus-visible:not(:hover)": { focusRing: "outer" },
|
|
131
|
+
"&[data-checked]": {
|
|
132
|
+
background: "[token(gradients.raised)]",
|
|
133
|
+
color: "fg.primary",
|
|
134
|
+
_before: { display: "block" },
|
|
135
|
+
},
|
|
136
|
+
});
|
|
85
137
|
export function Menu({ trigger, items, align = "start", sideOffset = glassMenuOffsetFromTrigger, matchTriggerWidth = false, triggerTooltip, ...rootProps }) {
|
|
86
138
|
const menuTrigger = _jsx(BaseMenu.Trigger, { render: trigger });
|
|
87
139
|
return (_jsxs(BaseMenu.Root, { ...rootProps, children: [triggerTooltip === undefined ? (menuTrigger) : (_jsx(BaseTooltip.Provider, { children: _jsxs(BaseTooltip.Root, { children: [_jsx(BaseTooltip.Trigger, { render: menuTrigger }), _jsx(TooltipChip, { content: triggerTooltip, side: "inline-end" })] }) })), _jsx(BaseMenu.Portal, { children: _jsx(HotkeyLayer, { children: _jsx(BaseMenu.Positioner, { className: positioner, sideOffset: sideOffset, align: align, children: _jsx(BaseMenu.Popup, { className: matchTriggerWidth ? triggerWidthPopup : popup, "data-ciridae-ui": "", children: _jsx(MenuItems, { items: items }) }) }) }) })] }));
|
|
@@ -106,6 +158,9 @@ function MenuItems({ items }) {
|
|
|
106
158
|
if ("header" in menuItem) {
|
|
107
159
|
return (_jsxs("div", { className: header, role: "presentation", children: [menuItem.icon, _jsxs("span", { className: headerCopy, children: [_jsx("span", { children: menuItem.label }), menuItem.detail && _jsx("span", { children: menuItem.detail })] })] }, index));
|
|
108
160
|
}
|
|
161
|
+
if (menuItem.choices) {
|
|
162
|
+
return (_jsx(MenuChoiceRow, { label: menuItem.label, icon: menuItem.icon, choices: menuItem.choices }, index));
|
|
163
|
+
}
|
|
109
164
|
if (menuItem.items) {
|
|
110
165
|
return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsxs(BaseMenu.SubmenuTrigger, { className: item, disabled: menuItem.disabled, children: [menuItem.icon && _jsx("span", { className: iconSlot, children: menuItem.icon }), _jsx("span", { "data-label": "", className: singleLineTextClass, children: menuItem.label }), _jsx(CaretRightIcon, { "data-trailing": "", className: cx(icon({ size: "small" }), directional) })] }), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { className: positioner, sideOffset: 0, align: "start", alignOffset: submenuAlignOffsetToFirstRow, children: _jsx(BaseMenu.Popup, { className: cx(popup, submenuPopup), "data-ciridae-ui": "", children: _jsx(MenuItems, { items: menuItem.items }) }) }) })] }, index));
|
|
111
166
|
}
|
|
@@ -125,3 +180,26 @@ function MenuItems({ items }) {
|
|
|
125
180
|
return (_jsx(BaseMenu.Item, { className: className, disabled: disabledOrLoading, onClick: menuItem.onSelect, ...choice, children: content }, index));
|
|
126
181
|
});
|
|
127
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* The choices sit side by side, so the arrow keys along the line move between them, as they do in
|
|
185
|
+
* a segmented control; the menu's own up and down keys still walk them in order. Focusing a choice
|
|
186
|
+
* makes it the menu's current item.
|
|
187
|
+
*/
|
|
188
|
+
function focusTheNextChoiceOnAnInlineArrowKey(event) {
|
|
189
|
+
if (event.key !== "ArrowRight" && event.key !== "ArrowLeft")
|
|
190
|
+
return;
|
|
191
|
+
const choice = event.currentTarget;
|
|
192
|
+
const towardTheLineEnd = (event.key === "ArrowRight") === (getComputedStyle(choice).direction === "ltr");
|
|
193
|
+
const next = towardTheLineEnd ? choice.nextElementSibling : choice.previousElementSibling;
|
|
194
|
+
if (!(next instanceof HTMLElement))
|
|
195
|
+
return;
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
event.stopPropagation();
|
|
198
|
+
next.focus();
|
|
199
|
+
}
|
|
200
|
+
function MenuChoiceRow({ label, icon: rowIcon, choices, }) {
|
|
201
|
+
// The track takes the quieter toolbar edge: with the raised edge it matched the chosen option's
|
|
202
|
+
// own ring 2px inside it, and the pair read as one thick double border.
|
|
203
|
+
const trackEdge = faceEdge("toolbar");
|
|
204
|
+
return (_jsxs(BaseMenu.RadioGroup, { className: choiceRow, "aria-label": label, value: choices.findIndex((choice) => choice.checked), children: [rowIcon && _jsx("span", { className: iconSlot, children: rowIcon }), _jsx("span", { "data-label": "", className: singleLineTextClass, children: label }), _jsx("span", { className: cx(choiceTrack, trackEdge.className), "data-ciridae-ui": "", "data-edge": trackEdge["data-edge"], children: _jsx(BaseTooltip.Provider, { children: choices.map((choice, choiceIndex) => (_jsxs(BaseTooltip.Root, { children: [_jsx(BaseTooltip.Trigger, { render: _jsx(BaseMenu.RadioItem, { className: choiceOption, value: choiceIndex, label: choice.label, "aria-label": choice.label, "data-ciridae-ui": "", "data-edge": "gradient", onClick: choice.onSelect, onKeyDown: focusTheNextChoiceOnAnInlineArrowKey }), children: choice.icon }), _jsx(TooltipChip, { content: choice.label, side: "bottom" })] }, choiceIndex))) }) })] }));
|
|
205
|
+
}
|
|
@@ -1387,6 +1387,10 @@
|
|
|
1387
1387
|
background: color-mix(in srgb, currentColor 7%, transparent);
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
|
+
.bg_\[token\(gradients\.panel\)\] {
|
|
1391
|
+
background: var(--gradients-panel);
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1390
1394
|
.bg_bg\.hover {
|
|
1391
1395
|
background: var(--colors-bg\.hover);
|
|
1392
1396
|
}
|
|
@@ -1455,10 +1459,6 @@
|
|
|
1455
1459
|
border: 1px solid var(--card-edge, var(--colors-border\.card));
|
|
1456
1460
|
}
|
|
1457
1461
|
|
|
1458
|
-
.bg_\[token\(gradients\.panel\)\] {
|
|
1459
|
-
background: var(--gradients-panel);
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
1462
|
.bg_bg\.avatar {
|
|
1463
1463
|
background: var(--colors-bg\.avatar);
|
|
1464
1464
|
}
|
|
@@ -1987,6 +1987,10 @@
|
|
|
1987
1987
|
margin-inline: 1px;
|
|
1988
1988
|
}
|
|
1989
1989
|
|
|
1990
|
+
.bdr_\[calc\(token\(radii\.inset\)_\+_token\(spacing\.control\.trackInset\)\)\] {
|
|
1991
|
+
border-radius: calc(var(--radii-inset) + var(--spacing-control\.track-inset));
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1990
1994
|
.gap_meter\.rowGap {
|
|
1991
1995
|
gap: var(--spacing-meter\.row-gap);
|
|
1992
1996
|
}
|
|
@@ -4416,6 +4420,14 @@
|
|
|
4416
4420
|
min-height: var(--sizes-mark\.inline);
|
|
4417
4421
|
}
|
|
4418
4422
|
|
|
4423
|
+
.w_control\.small {
|
|
4424
|
+
width: var(--sizes-control\.small);
|
|
4425
|
+
}
|
|
4426
|
+
|
|
4427
|
+
.h_\[calc\(token\(sizes\.control\.small\)_-_2_\*_token\(spacing\.control\.trackInset\)\)\] {
|
|
4428
|
+
height: calc(var(--sizes-control\.small) - 2 * var(--spacing-control\.track-inset));
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4419
4431
|
.w_tile\.icon {
|
|
4420
4432
|
width: var(--sizes-tile\.icon);
|
|
4421
4433
|
}
|
|
@@ -5684,6 +5696,14 @@
|
|
|
5684
5696
|
background: var(--colors-bg\.row-hover);
|
|
5685
5697
|
}
|
|
5686
5698
|
|
|
5699
|
+
.\[\&\[data-highlighted\]\:not\(\[data-checked\]\)\]\:bg_bg\.controlHover[data-highlighted]:not([data-checked]) {
|
|
5700
|
+
background: var(--colors-bg\.control-hover);
|
|
5701
|
+
}
|
|
5702
|
+
|
|
5703
|
+
.\[\&\[data-checked\]\]\:bg_\[token\(gradients\.raised\)\][data-checked] {
|
|
5704
|
+
background: var(--gradients-raised);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5687
5707
|
.\[\&\[data-popup-open\]\]\:bg_bg\.hover[data-popup-open] {
|
|
5688
5708
|
background: var(--colors-bg\.hover);
|
|
5689
5709
|
}
|
|
@@ -9662,6 +9682,14 @@
|
|
|
9662
9682
|
font-size: var(--font-sizes-code);
|
|
9663
9683
|
}
|
|
9664
9684
|
|
|
9685
|
+
.before\:d_none::before {
|
|
9686
|
+
display: none;
|
|
9687
|
+
}
|
|
9688
|
+
|
|
9689
|
+
.\[\&\[data-highlighted\]\]\:c_fg\.primary[data-highlighted],.\[\&\[data-checked\]\]\:c_fg\.primary[data-checked] {
|
|
9690
|
+
color: var(--colors-fg\.primary);
|
|
9691
|
+
}
|
|
9692
|
+
|
|
9665
9693
|
.\[\&\[data-popup-open\]\]\:bx-sh_\[inset_0_0_0_1px_token\(colors\.border\.menuHover\)\][data-popup-open] {
|
|
9666
9694
|
box-shadow: inset 0 0 0 1px var(--colors-border\.menu-hover);
|
|
9667
9695
|
}
|
|
@@ -10145,10 +10173,6 @@
|
|
|
10145
10173
|
color: var(--colors-accent\.bronze);
|
|
10146
10174
|
}
|
|
10147
10175
|
|
|
10148
|
-
.before\:d_none::before {
|
|
10149
|
-
display: none;
|
|
10150
|
-
}
|
|
10151
|
-
|
|
10152
10176
|
.\[\&\[data-active\]\]\:bx-sh_soft[data-active] {
|
|
10153
10177
|
box-shadow: var(--shadows-soft);
|
|
10154
10178
|
}
|
|
@@ -11602,7 +11626,7 @@
|
|
|
11602
11626
|
outline-offset: 2px;
|
|
11603
11627
|
}
|
|
11604
11628
|
|
|
11605
|
-
.\[\&\:has\(input\:focus-visible\)\:not\(\[data-popup-open\]\)\]\:focus-ring_outer:has(input:focus-visible):not([data-popup-open]),.\[\&\:has\(\>_\[data-sidebar-row\]\:focus-visible\)\]\:focus-ring_outer:has(> [data-sidebar-row]:focus-visible) {
|
|
11629
|
+
.\[\&\:focus-visible\:not\(\:hover\)\]\:focus-ring_outer:focus-visible:not(:hover),.\[\&\:has\(input\:focus-visible\)\:not\(\[data-popup-open\]\)\]\:focus-ring_outer:has(input:focus-visible):not([data-popup-open]),.\[\&\:has\(\>_\[data-sidebar-row\]\:focus-visible\)\]\:focus-ring_outer:has(> [data-sidebar-row]:focus-visible) {
|
|
11606
11630
|
outline: var(--spacing-focus\.ring-width) solid var(--colors-border\.focus);
|
|
11607
11631
|
outline-offset: var(--spacing-focus\.ring-offset);
|
|
11608
11632
|
}
|
|
@@ -12261,6 +12285,10 @@
|
|
|
12261
12285
|
font-size: var(--font-sizes-icon\.compact);
|
|
12262
12286
|
}
|
|
12263
12287
|
|
|
12288
|
+
.\[\&\[data-checked\]\]\:before\:d_block[data-checked]::before {
|
|
12289
|
+
display: block;
|
|
12290
|
+
}
|
|
12291
|
+
|
|
12264
12292
|
.\[\&\:is\(button\)\]\:focusVisible\:focus-ring_inset:is(button):is(:focus-visible, [data-focus-visible]) {
|
|
12265
12293
|
outline: var(--spacing-focus\.ring-width) solid var(--colors-border\.focus);
|
|
12266
12294
|
outline-offset: calc(var(--spacing-focus\.ring-width) * -1);
|