@ciridae/ui 2.81.0 → 2.82.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.
@@ -75,13 +75,19 @@ export type AppFrameProps = {
75
75
  sidebarTop: ReactNode;
76
76
  /** Top of the rail, which stands in for the sidebar at narrower widths. */
77
77
  sidebarRail: ReactNode;
78
- /** The sidebar's sections as data, which `AppNavigation` draws in the sidebar and the rail. */
79
- navigation?: Pick<AppNavigationProps, "sections" | "activeId" | "renderLink">;
78
+ /**
79
+ * The sidebar's sections as data, which `AppNavigation` draws in the sidebar and the rail, and the
80
+ * reader's choice to keep the sidebar as its rail: `collapsed`, with `onExpand` for the rail's
81
+ * expand button, which a settings sidebar keeps too. The host keeps the choice.
82
+ */
83
+ navigation?: Pick<AppNavigationProps, "sections" | "activeId" | "renderLink" | "collapsed" | "onExpand">;
80
84
  /** The sidebar's own content, in place of `navigation`. */
81
85
  sidebar?: ReactNode;
82
86
  /**
83
87
  * On a settings page: the sidebar swaps the app's sections, its top and its footer's own rows for
84
- * Back to app and the settings sections, keeping the account.
88
+ * Back to app and the settings sections, keeping the account. Its sidebar takes its collapsed
89
+ * state and expand action from `navigation`, so an app that sets `settings` without `navigation`
90
+ * gets no collapse.
85
91
  */
86
92
  settings?: AppFrameSettings;
87
93
  /** Expanded-only content at the top of the footer. */
@@ -76,7 +76,8 @@ const agentLauncherButton = css({
76
76
  gap: "layout.controlGap",
77
77
  width: "full",
78
78
  height: "control.sidebarSearch",
79
- paddingInlineStart: "layout.tightGap",
79
+ // Its mark starts where the nav rows' icons do, as the Figma's launcher is padded.
80
+ paddingInlineStart: "control.compactInline",
80
81
  paddingInlineEnd: "layout.controlGap",
81
82
  // The raised face and canvas edge its keycaps wear, so the pill and its keys read as one.
82
83
  border: "1px solid token(colors.border.canvas)",
@@ -125,7 +126,9 @@ export function AppFrame({ title, actions, sidebarTop, sidebarRail, navigation,
125
126
  const items = settings ? [] : ownItems;
126
127
  const statusLink = statusUrl ? (_jsx(IconButton, { "aria-label": labels.appFrame.status, nativeButton: false, render: _jsx("a", { href: statusUrl, target: "_blank", rel: "noreferrer" }), children: _jsx(PulseIcon, { className: icon() }) })) : undefined;
127
128
  const sidebarFoot = (_jsxs(_Fragment, { children: [(sidebarFooter || buildSha !== null || items.length > 0) && (_jsxs(AppSidebarOnly, { children: [sidebarFooter, buildSha !== null && _jsx(BuildUpdateButton, { buildSha: buildSha }), items.map((item) => (_jsx(SidebarItem, { "aria-pressed": item.pressed, icon: item.icon, onClick: item.onClick, children: item.label }, item.id)))] })), (footnote || statusUrl || buildSha) && (_jsxs(AppSidebarFootnote, { children: [footnote, statusUrl && (_jsx(Link, { external: true, tone: "muted", href: statusUrl, children: labels.appFrame.status })), statusUrl && buildSha && _jsx("span", { "aria-hidden": "true", children: "\u00B7" }), buildSha && _jsx("code", { title: buildSha, children: buildSha.slice(0, 7) })] })), (railActions || statusLink || items.length > 0) && (_jsxs(AppSidebarOnly, { rail: true, children: [items.map((item) => (_jsx(Tooltip, { content: item.label, side: "inline-end", children: _jsx(SidebarItem, { "aria-label": item.label, "aria-pressed": item.pressed, icon: item.icon, onClick: item.onClick }) }, item.id))), railActions, statusLink && (_jsx(Tooltip, { content: labels.appFrame.status, side: "inline-end", children: statusLink }))] })), !settings && agentLauncher && (_jsxs(_Fragment, { children: [_jsx(AppSidebarOnly, { children: _jsx(AgentLauncher, { ...agentLauncher }) }), _jsx(AppSidebarOnly, { rail: true, children: _jsx(AgentLauncher, { ...agentLauncher, compact: true }) })] })), account && (_jsxs(_Fragment, { children: [_jsx(AppSidebarOnly, { children: _jsx(AccountMenu, { ...account }) }), _jsx(AppSidebarOnly, { rail: true, children: _jsx(AccountMenu, { ...account, compact: true }) })] }))] }));
128
- return (_jsxs(AppShell, { children: [_jsx(KeyboardShortcuts, {}), settings ? (_jsx(AppNavigation, { labels: { navigation: labels.appFrame.settings }, sections: settings.sections, activeId: settings.activeId, renderLink: settings.renderLink, header: _jsx(BackToApp, { back: settings.back }), railHeader: _jsx(BackToApp, { back: settings.back, compact: true }), footer: sidebarFoot })) : navigation ? (_jsx(AppNavigation, { ...navigation, header: sidebarTop, railHeader: sidebarRail, footer: sidebarFoot })) : (_jsxs(AppSidebar, { children: [_jsx(AppSidebarGroup, { children: sidebarTop }), _jsx(AppSidebarRail, { children: sidebarRail }), sidebar && _jsx(AppSidebarNav, { children: sidebar }), _jsx(AppSidebarFooter, { children: sidebarFoot })] })), title === undefined ? (children) : (_jsxs(AppMain, { children: [_jsx(AppHeader, { actions: _jsxs(AppHeaderActions, { children: [actions, _jsxs(AppHeaderCompact, { children: [compactActions, statusLink, items.map((item) => (_jsx(IconButton, { "aria-label": item.label, "aria-pressed": item.pressed, onClick: item.onClick, children: item.icon }, item.id))), account && _jsx(AccountMenu, { ...account, compact: true })] })] }), children: _jsx(AppBreadcrumbs, { children: title }) }), _jsx(AppContent, { children: children })] })), overlays] }));
129
+ return (_jsxs(AppShell, { children: [_jsx(KeyboardShortcuts, {}), settings ? (_jsx(AppNavigation, { labels: { navigation: labels.appFrame.settings }, sections: settings.sections, activeId: settings.activeId, renderLink: settings.renderLink,
130
+ // The reader's collapsed sidebar stays collapsed on a settings page.
131
+ collapsed: navigation?.collapsed, onExpand: navigation?.onExpand, header: _jsx(BackToApp, { back: settings.back }), railHeader: _jsx(BackToApp, { back: settings.back, compact: true }), footer: sidebarFoot })) : navigation ? (_jsx(AppNavigation, { ...navigation, header: sidebarTop, railHeader: sidebarRail, footer: sidebarFoot })) : (_jsxs(AppSidebar, { children: [_jsx(AppSidebarGroup, { children: sidebarTop }), _jsx(AppSidebarRail, { children: sidebarRail }), sidebar && _jsx(AppSidebarNav, { children: sidebar }), _jsx(AppSidebarFooter, { children: sidebarFoot })] })), title === undefined ? (children) : (_jsxs(AppMain, { children: [_jsx(AppHeader, { actions: _jsxs(AppHeaderActions, { children: [actions, _jsxs(AppHeaderCompact, { children: [compactActions, statusLink, items.map((item) => (_jsx(IconButton, { "aria-label": item.label, "aria-pressed": item.pressed, onClick: item.onClick, children: item.icon }, item.id))), account && _jsx(AccountMenu, { ...account, compact: true })] })] }), children: _jsx(AppBreadcrumbs, { children: title }) }), _jsx(AppContent, { children: children })] })), overlays] }));
129
132
  }
130
133
  /** The settings sidebar's first row: back to the page the reader left, or its icon in the rail. */
131
134
  function BackToApp({ back, compact = false, }) {
@@ -24,6 +24,12 @@ export type NavSection = {
24
24
  maxVisible?: number;
25
25
  /** Whether its items are in the rail too. Defaults to true. */
26
26
  rail?: boolean;
27
+ /**
28
+ * In the rail, one control in the section's place instead of its items, such as a round button
29
+ * that shows rows that have no icons. The section keeps its place among the others. Like its
30
+ * items, it is left out of the rail under `rail: false` and while the section has no items.
31
+ */
32
+ railControl?: ReactNode;
27
33
  /** On the tinted panel under the main sections; consecutive panel sections share one. */
28
34
  panel?: boolean;
29
35
  /** Unfolded, its items scroll in a short box rather than lengthen the sidebar. */
@@ -152,7 +152,8 @@ export function AppNavigation({ sections, activeId: ownActiveId = null, renderLi
152
152
  const sectionBlock = (section) => (_jsxs(SidebarSection, { label: section.label, children: [_jsx(SectionItems, { section: section, activeIds: activeIds, renderLink: renderLink, roomy: roomy, labels: labels, expanded: expandedSectionIds.has(section.id), onExpandedChange: (expanded) => setSectionExpanded(section.id, expanded) }), section.footer && _jsx("div", { className: sectionFooter, children: section.footer })] }, section.id));
153
153
  return (_jsxs(AppSidebar, { "aria-label": labels.navigation, collapsed: collapsed, ...props, children: [_jsxs(AppSidebarNav, { ref: room.navRef, children: [header, sectionRuns(sections).map((run) => run.panel ? (_jsx(SidebarPanel, { children: run.sections.map(sectionBlock) }, run.sections[0].id)) : (_jsx(Fragment, { children: run.sections.map(sectionBlock) }, run.sections[0].id)))] }), _jsxs(AppSidebarRail, { children: [railHeader, sections
154
154
  .filter((section) => section.rail !== false && section.items.length > 0)
155
- .map((section) => (_jsxs("div", { className: railSection, children: [section.label && _jsx(SidebarRailRule, {}), section.items.map((item) => (_jsx(Tooltip, { content: item.label, side: "inline-end", children: _jsx(SidebarItem, { "aria-label": item.label, icon: item.icon, active: activeIds.includes(item.id), href: item.href, render: item.render ?? renderLink?.(item), onClick: item.onSelect }) }, item.id)))] }, section.id)))] }), _jsxs(AppSidebarFooter, { ref: room.footerRef, children: [collapsed && onExpand && (_jsx(AppSidebarRail, { className: expandButtonRail, children: _jsx(Tooltip, { content: locale.labels.common.expand, side: "inline-end", children: _jsx(IconButton, { "aria-label": locale.labels.common.expand, size: "medium", onClick: onExpand, children: _jsx(CaretLineRightIcon, { className: cx(icon({ size: "small" }), directional) }) }) }) })), footer] })] }));
155
+ .map((section) => (_jsxs("div", { className: railSection, children: [section.label && _jsx(SidebarRailRule, {}), section.railControl ??
156
+ section.items.map((item) => (_jsx(Tooltip, { content: item.label, side: "inline-end", children: _jsx(SidebarItem, { "aria-label": item.label, icon: item.icon, active: activeIds.includes(item.id), href: item.href, render: item.render ?? renderLink?.(item), onClick: item.onSelect }) }, item.id)))] }, section.id)))] }), _jsxs(AppSidebarFooter, { ref: room.footerRef, children: [collapsed && onExpand && (_jsx(AppSidebarRail, { className: expandButtonRail, children: _jsx(Tooltip, { content: locale.labels.common.expand, side: "inline-end", children: _jsx(IconButton, { "aria-label": locale.labels.common.expand, size: "medium", onClick: onExpand, children: _jsx(CaretLineRightIcon, { className: cx(icon({ size: "small" }), directional) }) }) }) })), footer] })] }));
156
157
  }
157
158
  /* A workspace's mark: its edge is a gradient, so it is drawn under the face through a transparent border. */
158
159
  const workspaceMark = css({
@@ -81,6 +81,8 @@ export type AlertDialogProps = Omit<ComponentProps<typeof BaseAlertDialog.Root>,
81
81
  * async confirmation is pending.
82
82
  */
83
83
  export declare function AlertDialog({ trigger, title, children, confirmLabel, cancelLabel, onConfirm, variant, onOpenChange, ...rootProps }: AlertDialogProps): import("react").JSX.Element;
84
+ /** What a `Popover`'s `actionsRef` holds, such as its `close`, for a row inside it that closes it. */
85
+ export type PopoverActions = BasePopover.Root.Actions;
84
86
  export type PopoverProps = Omit<ComponentProps<typeof BasePopover.Root>, "children"> & {
85
87
  /** The button that opens it. Leave it out and pass `anchor` to open it from elsewhere, such as a menu item. */
86
88
  trigger?: ReactElement;
@@ -96,18 +98,37 @@ export type PopoverProps = Omit<ComponentProps<typeof BasePopover.Root>, "childr
96
98
  width?: "narrow" | "regular" | "wide";
97
99
  /** Which edge of the trigger it lines up with. */
98
100
  align?: "start" | "center" | "end";
101
+ /**
102
+ * Which side of the trigger it opens on. `inline-end` is for a trigger in the rail, where a
103
+ * popover below it would cover the icons under it. Defaults to `bottom`.
104
+ */
105
+ side?: "bottom" | "inline-end";
106
+ /** How far from the trigger it opens; 4px by default, as a menu does. */
107
+ sideOffset?: number;
99
108
  /**
100
109
  * Also opens while the trigger is hovered, after a short delay, and closes soon after the
101
110
  * pointer leaves. Focus moves into it only when a keyboard opened it.
102
111
  */
103
112
  openOnHover?: boolean;
113
+ /**
114
+ * With `openOnHover`, how soon hovering opens it. `after_a_pause` (300ms, the default) is for a
115
+ * detail the pointer may only be passing, such as a profile card on a name. `quickly` (100ms) is
116
+ * for a control whose list is what a reader hovers it for, such as a rail icon for recent pages.
117
+ * It does nothing without `openOnHover`.
118
+ */
119
+ hoverOpens?: "after_a_pause" | "quickly";
120
+ /**
121
+ * The popup's accessible name, for one with no control of its own to name it, such as a list of
122
+ * links: a screen reader otherwise announces a dialog with no name.
123
+ */
124
+ label?: string;
104
125
  /**
105
126
  * Whether closing gives the focus back to the trigger, as it does by default. Turn it off for a
106
127
  * close that sends the person elsewhere, such as an action that fills a field the page focuses.
107
128
  */
108
129
  returnsFocusOnClose?: boolean;
109
130
  };
110
- export declare function Popover({ trigger, anchor, children, density, width, align, openOnHover, returnsFocusOnClose, ...rootProps }: PopoverProps): import("react").JSX.Element;
131
+ export declare function Popover({ trigger, anchor, children, density, width, align, side, sideOffset, openOnHover, hoverOpens, label, returnsFocusOnClose, ...rootProps }: PopoverProps): import("react").JSX.Element;
111
132
  export type TooltipProps = Omit<ComponentProps<typeof BaseTooltip.Root>, "children"> & {
112
133
  children: ReactElement;
113
134
  content: ReactNode;
@@ -273,10 +273,10 @@ const popoverWidths = {
273
273
  regular: css({ width: "overlay.popover" }),
274
274
  wide: css({ width: "overlay.popoverWide" }),
275
275
  };
276
- const hoverOpenDelayMilliseconds = 300;
276
+ const hoverOpenDelayMillisecondsByHoverOpens = { after_a_pause: 300, quickly: 100 };
277
277
  const hoverCloseDelayMs = 150;
278
- export function Popover({ trigger, anchor, children, density = "regular", width, align, openOnHover = false, returnsFocusOnClose = true, ...rootProps }) {
279
- return (_jsxs(BasePopover.Root, { ...rootProps, children: [trigger && (_jsx(BasePopover.Trigger, { render: trigger, openOnHover: openOnHover, delay: hoverOpenDelayMilliseconds, closeDelay: hoverCloseDelayMs })), _jsx(BasePopover.Portal, { children: _jsx(HotkeyLayer, { enabled: !openOnHover, children: _jsx(BasePopover.Positioner, { className: positioner, sideOffset: glassMenuOffsetFromTrigger, align: align, anchor: anchor, children: _jsx(BasePopover.Popup, { className: cx(popoverPopups[density], width && popoverWidths[width]), "data-ciridae-ui": "", initialFocus: openOnHover ? (openType) => openType === "keyboard" : undefined, finalFocus: returnsFocusOnClose ? undefined : false, children: children }) }) }) })] }));
278
+ export function Popover({ trigger, anchor, children, density = "regular", width, align, side = "bottom", sideOffset = glassMenuOffsetFromTrigger, openOnHover = false, hoverOpens = "after_a_pause", label, returnsFocusOnClose = true, ...rootProps }) {
279
+ return (_jsxs(BasePopover.Root, { ...rootProps, children: [trigger && (_jsx(BasePopover.Trigger, { render: trigger, openOnHover: openOnHover, delay: hoverOpenDelayMillisecondsByHoverOpens[hoverOpens], closeDelay: hoverCloseDelayMs })), _jsx(BasePopover.Portal, { children: _jsx(HotkeyLayer, { enabled: !openOnHover, children: _jsx(BasePopover.Positioner, { className: positioner, side: side, sideOffset: sideOffset, align: align, anchor: anchor, children: _jsx(BasePopover.Popup, { className: cx(popoverPopups[density], width && popoverWidths[width]), "data-ciridae-ui": "", "aria-label": label, initialFocus: openOnHover ? (openType) => openType === "keyboard" : undefined, finalFocus: returnsFocusOnClose ? undefined : false, children: children }) }) }) })] }));
280
280
  }
281
281
  /* An inverted chip: the primary face, ink in light and white in dark, with the text in the canvas's. */
282
282
  const tooltipPopup = css({
@@ -2443,8 +2443,8 @@
2443
2443
  color: var(--colors-fg\.secondary);
2444
2444
  }
2445
2445
 
2446
- .ps_layout\.tightGap {
2447
- padding-inline-start: var(--spacing-layout\.tight-gap);
2446
+ .ps_control\.compactInline {
2447
+ padding-inline-start: var(--spacing-control\.compact-inline);
2448
2448
  }
2449
2449
 
2450
2450
  .pe_layout\.controlGap {
@@ -2624,10 +2624,6 @@
2624
2624
  box-shadow: var(--shadows-soft);
2625
2625
  }
2626
2626
 
2627
- .ps_control\.compactInline {
2628
- padding-inline-start: var(--spacing-control\.compact-inline);
2629
- }
2630
-
2631
2627
  .pe_control\.iconInline {
2632
2628
  padding-inline-end: var(--spacing-control\.icon-inline);
2633
2629
  }
@@ -11368,10 +11364,6 @@
11368
11364
  height: var(--sizes-avatar\.row);
11369
11365
  }
11370
11366
 
11371
- .\[\&_\>_svg\]\:w_full > svg {
11372
- width: var(--sizes-full);
11373
- }
11374
-
11375
11367
  .\[\&_\>_\[data-timeline\]\]\:min-w_0 > [data-timeline] {
11376
11368
  min-width: var(--sizes-0);
11377
11369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "2.81.0",
3
+ "version": "2.82.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",