@ciridae/ui 1.0.13 → 1.1.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.
Files changed (45) hide show
  1. package/dist/chat/contract.js +12 -2
  2. package/dist/chat/message-text.js +8 -7
  3. package/dist/ciridae.css +12 -1
  4. package/dist/components/app-frame.d.ts +29 -4
  5. package/dist/components/app-frame.js +16 -5
  6. package/dist/components/app-navigation.d.ts +16 -1
  7. package/dist/components/app-navigation.js +18 -7
  8. package/dist/components/badge.d.ts +14 -0
  9. package/dist/components/badge.js +38 -1
  10. package/dist/components/button.js +7 -3
  11. package/dist/components/copyable-id.d.ts +10 -3
  12. package/dist/components/copyable-id.js +5 -2
  13. package/dist/components/data-display.js +14 -4
  14. package/dist/components/data-grid.js +5 -1
  15. package/dist/components/drawer.js +9 -1
  16. package/dist/components/filter-bar.d.ts +17 -8
  17. package/dist/components/filter-bar.js +38 -32
  18. package/dist/components/input.d.ts +6 -1
  19. package/dist/components/input.js +9 -3
  20. package/dist/components/layout.d.ts +7 -2
  21. package/dist/components/layout.js +34 -7
  22. package/dist/components/locale.d.ts +20 -0
  23. package/dist/components/locale.js +19 -1
  24. package/dist/components/objective-header.d.ts +25 -0
  25. package/dist/components/objective-header.js +70 -0
  26. package/dist/components/panel.d.ts +9 -3
  27. package/dist/components/panel.js +38 -6
  28. package/dist/components/settings.d.ts +7 -2
  29. package/dist/components/settings.js +11 -3
  30. package/dist/components/shell.js +7 -1
  31. package/dist/components/side-panel.d.ts +13 -3
  32. package/dist/components/side-panel.js +28 -7
  33. package/dist/components/switch.d.ts +7 -3
  34. package/dist/components/switch.js +17 -3
  35. package/dist/components/tabs.js +10 -1
  36. package/dist/components/theme-toggle.js +4 -1
  37. package/dist/components/value-change.d.ts +13 -0
  38. package/dist/components/value-change.js +59 -0
  39. package/dist/preset.js +27 -3
  40. package/dist/styled-system/styles.css +190 -61
  41. package/dist/styled-system/tokens/index.mjs +33 -1
  42. package/dist/styled-system/tokens/tokens.d.ts +3 -3
  43. package/dist/styles.css +12 -1
  44. package/dist/theme/palette.js +9 -5
  45. package/package.json +9 -1
@@ -187,7 +187,9 @@ export const MentionSchema = z.object({
187
187
  });
188
188
  const mentionPattern = /\[@([^\]]+)\]\(mention:\/\/([a-z][a-z0-9_-]*)\/([^)\s]+)\)/g;
189
189
  export function formatMention({ id, kind, label }) {
190
- return `[@${label.replace(/[[\]]/g, "")}](mention://${kind}/${encodeURIComponent(id)})`;
190
+ // encodeURIComponent keeps ( and ), and a ) would end the markup early.
191
+ const encodedId = encodeURIComponent(id).replace(/[()]/g, (bracket) => bracket === "(" ? "%28" : "%29");
192
+ return `[@${label.replace(/[[\]]/g, "")}](mention://${kind}/${encodedId})`;
191
193
  }
192
194
  /** Message text split into plain runs and mentions, in order. */
193
195
  export function parseMentions(content) {
@@ -195,9 +197,17 @@ export function parseMentions(content) {
195
197
  let lastIndex = 0;
196
198
  for (const match of content.matchAll(mentionPattern)) {
197
199
  const [token, label = "", kind = "", encodedId = ""] = match;
200
+ let id;
201
+ try {
202
+ id = decodeURIComponent(encodedId);
203
+ }
204
+ catch {
205
+ // Model-written text can hold a stray %: it stays plain text, and the message still draws.
206
+ continue;
207
+ }
198
208
  if (match.index > lastIndex)
199
209
  parts.push(content.slice(lastIndex, match.index));
200
- parts.push({ label, kind, id: decodeURIComponent(encodedId) });
210
+ parts.push({ label, kind, id });
201
211
  lastIndex = match.index + token.length;
202
212
  }
203
213
  if (lastIndex < content.length)
@@ -151,11 +151,13 @@ const chatInline = {
151
151
  const rest = source.slice(index);
152
152
  const token = /^\[@[^\]]+\]\(mention:\/\/[a-z][a-z0-9_-]*\/[^)\s]+\)/.exec(rest)?.[0];
153
153
  if (token) {
154
- const [part] = parseMentions(token);
155
- if (part && typeof part !== "string") {
156
- return {
157
- length: token.length,
158
- node: {
154
+ const [part = token] = parseMentions(token);
155
+ return {
156
+ length: token.length,
157
+ // A mention whose id does not decode stays its literal markup, not a Markdown link.
158
+ node: typeof part === "string"
159
+ ? { type: "text", value: part }
160
+ : {
159
161
  type: "inlineComponent",
160
162
  name: "chat-mention",
161
163
  tagName: "chat-mention",
@@ -163,8 +165,7 @@ const chatInline = {
163
165
  properties: { ...part },
164
166
  children: [],
165
167
  },
166
- };
167
- }
168
+ };
168
169
  }
169
170
  const angle = /^<(https?:\/\/[^<>\s]+)>/.exec(rest);
170
171
  if (!angle && /\w/.test(source[index - 1] ?? ""))
package/dist/ciridae.css CHANGED
@@ -35,14 +35,25 @@
35
35
  color: inherit;
36
36
  text-decoration: none;
37
37
  }
38
+ /* AppContent stacks a page's blocks in a column; each keeps its own height, so a list whose
39
+ frame clips (overflow) is not squeezed to the window. A block's own flex utility wins. */
40
+ :where([data-app-content]) > * {
41
+ flex-shrink: 0;
42
+ }
38
43
  }
39
44
 
40
45
  /* [data-edge] paints a hairline inside the element's own box. The design counts that stroke in
41
46
  the layout, so an edged element keeps a 1px transparent border under the ring. A border the
42
47
  element sets itself wins: a native button resetting the browser's sets `1px solid transparent`,
43
- and a face the design lays its edge over, such as a text button, sets `border: 0`. */
48
+ and a face the design lays its edge over, such as a text button, sets `border: 0`.
49
+
50
+ The face is clipped to the padding box, which is where the ring sits. Left on the border box it
51
+ painted through the reserved transparent border, outside the ring, and a near-white light face
52
+ showed there as a pale halo round the control. `background-clip` does nothing to a face whose
53
+ element sets `border: 0`, so both kinds of edge draw one hairline and nothing else. */
44
54
  [data-ciridae-ui][data-edge] {
45
55
  position: relative;
56
+ background-clip: padding-box;
46
57
  }
47
58
  @layer base {
48
59
  :where([data-ciridae-ui][data-edge]) {
@@ -1,7 +1,7 @@
1
- import { type AppNavigationProps } from "./app-navigation.js";
1
+ import { type AppNavigationProps, type NavSection } from "./app-navigation.js";
2
2
  import { type HotkeyChord } from "./hotkeys.js";
3
3
  import { type MenuItem } from "./menu.js";
4
- import type { ComponentProps, ReactNode } from "react";
4
+ import type { ComponentProps, ReactElement, ReactNode } from "react";
5
5
  /** The color theme submenu: system, light or dark. */
6
6
  export declare function useColorThemeMenuItem(): MenuItem;
7
7
  export type AccountMenuProps = {
@@ -39,6 +39,23 @@ export type AppFrameItem = {
39
39
  pressed?: boolean;
40
40
  };
41
41
  export type AppAccount = Omit<AccountMenuProps, "compact">;
42
+ /**
43
+ * The sidebar on a settings page, as the Figma's Settings v2 frames draw it: a row back to the
44
+ * app, then the settings sections (the reader's own, then the workspace's) in place of the app's.
45
+ */
46
+ export type AppFrameSettings = {
47
+ sections: readonly NavSection[];
48
+ /** The open section's id. */
49
+ activeId?: string | null;
50
+ /** Every row's link element, such as `(item) => <Link to={paths[item.id]} />`. */
51
+ renderLink?: AppNavigationProps["renderLink"];
52
+ /** Where Back to app goes: an address, a router's link element, or an action. */
53
+ back: {
54
+ href?: string;
55
+ render?: ReactElement;
56
+ onSelect?: () => void;
57
+ };
58
+ };
42
59
  export type AppFrameProps = {
43
60
  /**
44
61
  * The main panel's breadcrumbs, the last one the page itself; the frame then draws the panel and
@@ -55,10 +72,18 @@ export type AppFrameProps = {
55
72
  navigation?: Pick<AppNavigationProps, "sections" | "activeId" | "renderLink">;
56
73
  /** The sidebar's own content, in place of `navigation`. */
57
74
  sidebar?: ReactNode;
75
+ /**
76
+ * On a settings page: the sidebar swaps the app's sections, its top and its footer's own rows for
77
+ * Back to app and the settings sections, keeping the account.
78
+ */
79
+ settings?: AppFrameSettings;
58
80
  /** Expanded-only content at the top of the footer. */
59
81
  sidebarFooter?: ReactNode;
60
82
  items?: readonly AppFrameItem[];
61
- /** Content before the shared status link and build SHA in the expanded footer. */
83
+ /**
84
+ * Content before the shared status link and build SHA in the expanded footer. The footnote line
85
+ * shows only when this, `statusUrl` or `buildSha` is set.
86
+ */
62
87
  footnote?: ReactNode;
63
88
  /** The bundled commit. A non-null SHA enables checks against /version.json (requires QueryClientProvider). */
64
89
  buildSha?: string | null;
@@ -74,4 +99,4 @@ export type AppFrameProps = {
74
99
  children: ReactNode;
75
100
  };
76
101
  /** The app's frame: the sidebar for every width, its footer and account, and the page. */
77
- export declare function AppFrame({ title, actions, sidebarTop, sidebarRail, navigation, sidebar, sidebarFooter, items, footnote, buildSha, statusUrl, railActions, compactActions, account, overlays, children, }: AppFrameProps): import("react").JSX.Element;
102
+ export declare function AppFrame({ title, actions, sidebarTop, sidebarRail, navigation, sidebar, settings, sidebarFooter: ownSidebarFooter, items: ownItems, footnote, buildSha, statusUrl, railActions, compactActions, account, overlays, children, }: AppFrameProps): import("react").JSX.Element;
@@ -6,12 +6,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
6
6
  * own entries, the color theme, and sign out. Auth stays with the host, which passes
7
7
  * sign-out as an action. `AssistantLauncher` opens the app's assistant from the sidebar's foot.
8
8
  */
9
- import { ArrowClockwiseIcon, CaretUpIcon, CircleHalfIcon, PulseIcon, SignOutIcon, } from "@phosphor-icons/react";
9
+ import { ArrowClockwiseIcon, ArrowLeftIcon, CaretUpIcon, CircleHalfIcon, PulseIcon, SignOutIcon, } from "@phosphor-icons/react";
10
10
  import { css, cx } from "#primitives/css";
11
11
  import { AppNavigation } from "./app-navigation.js";
12
12
  import { Button, IconButton } from "./button.js";
13
13
  import { useColorTheme } from "./color-theme.js";
14
- import { icon } from "./icon.js";
14
+ import { directional, icon } from "./icon.js";
15
15
  import { KeyboardShortcuts } from "./keyboard-shortcuts.js";
16
16
  import { ShortcutHint } from "./keycap.js";
17
17
  import { Link } from "./link.js";
@@ -99,11 +99,22 @@ export function AssistantLauncher({ label, icon: launcherIcon, hotkey, compact =
99
99
  return compact ? (_jsx(Tooltip, { content: label, side: "inline-end", children: launcher })) : (launcher);
100
100
  }
101
101
  /** The app's frame: the sidebar for every width, its footer and account, and the page. */
102
- export function AppFrame({ title, actions, sidebarTop, sidebarRail, navigation, sidebar, sidebarFooter, items = [], footnote, buildSha = null, statusUrl, railActions, compactActions, account, overlays, children, }) {
102
+ export function AppFrame({ title, actions, sidebarTop, sidebarRail, navigation, sidebar, settings, sidebarFooter: ownSidebarFooter, items: ownItems = [], footnote, buildSha = null, statusUrl, railActions, compactActions, account, overlays, children, }) {
103
103
  const { labels } = useCiridaeLocale();
104
+ // Settings keeps the account and the status line; the app's own footer rows wait for its pages.
105
+ const sidebarFooter = settings ? undefined : ownSidebarFooter;
106
+ const items = settings ? [] : ownItems;
104
107
  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;
105
- 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)))] })), _jsxs(AppSidebarFootnote, { children: [footnote, statusUrl && (_jsxs(_Fragment, { children: [_jsx(Link, { external: true, tone: "muted", href: statusUrl, children: labels.appFrame.status }), _jsx("span", { "aria-hidden": "true", children: "\u00B7" })] })), _jsx("code", { title: buildSha ?? undefined, children: buildSha ? buildSha.slice(0, 7) : labels.appFrame.localBuild })] }), (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 }))] })), account && (_jsxs(_Fragment, { children: [_jsx(AppSidebarOnly, { children: _jsx(AccountMenu, { ...account }) }), _jsx(AppSidebarOnly, { rail: true, children: _jsx(AccountMenu, { ...account, compact: true }) })] }))] }));
106
- return (_jsxs(AppShell, { children: [_jsx(KeyboardShortcuts, {}), 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] }));
108
+ 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 !== null) && (_jsxs(AppSidebarFootnote, { children: [footnote, statusUrl && (_jsxs(_Fragment, { children: [_jsx(Link, { external: true, tone: "muted", href: statusUrl, children: labels.appFrame.status }), _jsx("span", { "aria-hidden": "true", children: "\u00B7" })] })), _jsx("code", { title: buildSha ?? undefined, children: buildSha ? buildSha.slice(0, 7) : labels.appFrame.localBuild })] })), (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 }))] })), account && (_jsxs(_Fragment, { children: [_jsx(AppSidebarOnly, { children: _jsx(AccountMenu, { ...account }) }), _jsx(AppSidebarOnly, { rail: true, children: _jsx(AccountMenu, { ...account, compact: true }) })] }))] }));
109
+ 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] }));
110
+ }
111
+ /** The settings sidebar's first row: back to the page the reader left, or its icon in the rail. */
112
+ function BackToApp({ back, compact = false, }) {
113
+ const { labels } = useCiridaeLocale();
114
+ const backIcon = _jsx(ArrowLeftIcon, { className: cx(icon({ size: "small" }), directional) });
115
+ if (compact)
116
+ return (_jsx(Tooltip, { content: labels.appFrame.backToApp, side: "inline-end", children: _jsx(SidebarItem, { "aria-label": labels.appFrame.backToApp, icon: backIcon, href: back.href, render: back.render, onClick: back.onSelect }) }));
117
+ return (_jsx(SidebarItem, { size: "short", icon: backIcon, href: back.href, render: back.render, onClick: back.onSelect, children: labels.appFrame.backToApp }));
107
118
  }
108
119
  /** Only mounted for a named build, so local previews do not need a query provider. */
109
120
  function BuildUpdateButton({ buildSha }) {
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps, type ReactElement, type ReactNode } from "react";
2
+ import { type MenuItem } from "./menu.js";
2
3
  export type NavItem = {
3
4
  id: string;
4
5
  label: string;
@@ -82,11 +83,25 @@ export type WorkspaceMarkProps = {
82
83
  className?: string;
83
84
  };
84
85
  export declare function WorkspaceMark({ name, current, size, className, }: WorkspaceMarkProps): import("react").JSX.Element;
86
+ export type WorkspaceTriggerProps = Omit<ComponentProps<"button">, "children"> & {
87
+ /** The workspace the reader is in. */
88
+ name: string;
89
+ /** The mark alone, for the rail. */
90
+ compact?: boolean;
91
+ };
92
+ /**
93
+ * The sidebar's workspace row, as every Figma frame draws it: the square mark, the name and a
94
+ * caret, with no edge. `WorkspaceSwitcher` opens its menu from it; pass it as a `Menu`'s `trigger`
95
+ * to open another menu, such as an app with one workspace whose settings open from its name.
96
+ */
97
+ export declare function WorkspaceTrigger({ name, compact, className, ...props }: WorkspaceTriggerProps): import("react").JSX.Element;
85
98
  export type WorkspaceSwitcherProps = {
86
99
  workspaces: readonly Workspace[];
87
100
  currentId: string;
88
101
  onSelect: (id: string) => void;
102
+ /** Under the workspaces after a separator, such as the workspace's settings. */
103
+ items?: readonly MenuItem[];
89
104
  /** The mark alone, for the rail. */
90
105
  compact?: boolean;
91
106
  };
92
- export declare function WorkspaceSwitcher({ workspaces, currentId, onSelect, compact, }: WorkspaceSwitcherProps): import("react").JSX.Element;
107
+ export declare function WorkspaceSwitcher({ workspaces, currentId, onSelect, items, compact, }: WorkspaceSwitcherProps): import("react").JSX.Element;
@@ -211,13 +211,24 @@ const workspaceSwitcher = css({
211
211
  padding: "none",
212
212
  },
213
213
  });
214
- export function WorkspaceSwitcher({ workspaces, currentId, onSelect, compact = false, }) {
214
+ /**
215
+ * The sidebar's workspace row, as every Figma frame draws it: the square mark, the name and a
216
+ * caret, with no edge. `WorkspaceSwitcher` opens its menu from it; pass it as a `Menu`'s `trigger`
217
+ * to open another menu, such as an app with one workspace whose settings open from its name.
218
+ */
219
+ export function WorkspaceTrigger({ name, compact = false, className, ...props }) {
220
+ return (_jsxs("button", { type: "button", "aria-label": compact ? name : undefined, ...props, className: cx(workspaceSwitcher, className), "data-ciridae-ui": "", "data-compact": compact || undefined, children: [_jsx(WorkspaceMark, { name: name, current: true }), !compact && (_jsxs(_Fragment, { children: [_jsx("span", { className: singleLineTextClass, "data-name": "", children: name }), _jsx(CaretUpDownIcon, { className: icon({ size: "small" }) })] }))] }));
221
+ }
222
+ export function WorkspaceSwitcher({ workspaces, currentId, onSelect, items = [], compact = false, }) {
215
223
  const current = workspaces.find((workspace) => workspace.id === currentId);
216
224
  const name = current?.name ?? "";
217
- return (_jsx(Menu, { trigger: _jsxs("button", { type: "button", "aria-label": compact ? name : undefined, className: workspaceSwitcher, "data-ciridae-ui": "", "data-compact": compact || undefined, children: [_jsx(WorkspaceMark, { name: name, current: true }), !compact && (_jsxs(_Fragment, { children: [_jsx("span", { className: singleLineTextClass, "data-name": "", children: name }), _jsx(CaretUpDownIcon, { className: icon({ size: "small" }) })] }))] }), items: workspaces.map((workspace) => ({
218
- label: workspace.name,
219
- icon: (_jsx(WorkspaceMark, { name: workspace.name, current: workspace.id === currentId, size: "small" })),
220
- checked: workspace.id === currentId,
221
- onSelect: () => onSelect(workspace.id),
222
- })), matchTriggerWidth: true }));
225
+ return (_jsx(Menu, { trigger: _jsx(WorkspaceTrigger, { name: name, compact: compact }), items: [
226
+ ...workspaces.map((workspace) => ({
227
+ label: workspace.name,
228
+ icon: (_jsx(WorkspaceMark, { name: workspace.name, current: workspace.id === currentId, size: "small" })),
229
+ checked: workspace.id === currentId,
230
+ onSelect: () => onSelect(workspace.id),
231
+ })),
232
+ ...(items.length > 0 ? [{ separator: true }, ...items] : []),
233
+ ], matchTriggerWidth: true }));
223
234
  }
@@ -28,6 +28,20 @@ export type AssuranceGlyphProps = Omit<ComponentProps<"svg">, "children"> & {
28
28
  level: AssuranceLevel;
29
29
  };
30
30
  export declare function AssuranceGlyph({ level, className, ...props }: AssuranceGlyphProps): import("react").JSX.Element;
31
+ /** How soon something needs doing, as a queue or a work list ranks it. */
32
+ export type PriorityLevel = "high" | "medium" | "low";
33
+ export type PriorityGlyphProps = Omit<ComponentProps<"svg">, "children"> & {
34
+ level: PriorityLevel;
35
+ };
36
+ /** The rising bars before a priority's word: all three lit for high, two for medium, one for low. */
37
+ export declare function PriorityGlyph({ level, className, ...props }: PriorityGlyphProps): import("react").JSX.Element;
38
+ export type PriorityProps = Omit<ComponentProps<"span">, "children"> & {
39
+ level: PriorityLevel;
40
+ /** The word after the bars; the locale's High, Medium or Low when left out. */
41
+ children?: ReactNode;
42
+ };
43
+ /** A priority as the Figma's Urgency column draws it: the bars, then the word. */
44
+ export declare function Priority({ level, children, className, ...props }: PriorityProps): import("react").JSX.Element;
31
45
  export type LifecycleState = "notReached" | "hereNow" | "done" | "blocked" | "agentWaiting" | "expired" | "terminal" | "awaiting";
32
46
  export type LifecycleBadgeProps = Omit<BadgeProps, "tone" | "shape" | "appearance" | "icon"> & {
33
47
  state: LifecycleState;
@@ -6,11 +6,13 @@ import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-run
6
6
  * `pill` carries a judgment, such as a verdict or a run mode; a `square` badge carries a fact,
7
7
  * such as where a value came from, in a field's flat well. `LifecycleBadge` is the pill for where
8
8
  * a record sits in its stages, and `BadgeGlyph` and `AssuranceGlyph` the small marks badges and
9
- * fields put in their icon slot.
9
+ * fields put in their icon slot. `PriorityGlyph` is the Figma's Urgency bars, and `Priority` the
10
+ * bars with their word, for how soon something needs doing.
10
11
  */
11
12
  import { useRender } from "@base-ui/react/use-render";
12
13
  import { CheckIcon, ClockIcon, HourglassIcon, SparkleIcon, StopIcon } from "@phosphor-icons/react";
13
14
  import { css, cva, cx } from "#primitives/css";
15
+ import { useCiridaeLocale } from "./locale.js";
14
16
  /* The `[data-edge="gradient"]` ring draws the hairline from `--edge`. */
15
17
  const badge = cva({
16
18
  base: {
@@ -191,6 +193,41 @@ const ASSURANCE_BARS = [
191
193
  export function AssuranceGlyph({ level, className, ...props }) {
192
194
  return (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 14 14", fill: "currentColor", ...props, className: cx(glyph, className), children: ASSURANCE_BARS.map((bar, index) => (_jsx("rect", { x: bar.x, y: bar.y, width: "2.5", height: bar.height, rx: "0.75", opacity: index < level ? 1 : 0.28 }, bar.x))) }));
193
195
  }
196
+ const PRIORITY_LIT_BARS = { high: 3, medium: 2, low: 1 };
197
+ // The Figma's Urgency kit: three 3px bars, 4, 8 and 12 tall, 2 apart and bottom-aligned in a 13x12
198
+ // box; lit bars take the label's ink and the rest the grey of a mark not reached.
199
+ const PRIORITY_BARS = [
200
+ { x: 0, height: 4 },
201
+ { x: 5, height: 8 },
202
+ { x: 10, height: 12 },
203
+ ];
204
+ const priorityGlyph = css({
205
+ flexShrink: "0",
206
+ width: "[13px]",
207
+ height: "[12px]",
208
+ "& [data-unlit]": { fill: "chart.notStarted" },
209
+ });
210
+ /** The rising bars before a priority's word: all three lit for high, two for medium, one for low. */
211
+ export function PriorityGlyph({ level, className, ...props }) {
212
+ return (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 13 12", fill: "currentColor", ...props, className: cx(priorityGlyph, className), children: PRIORITY_BARS.map((bar, index) => (_jsx("rect", { x: bar.x, y: 12 - bar.height, width: "3", height: bar.height, rx: "1", "data-unlit": index >= PRIORITY_LIT_BARS[level] || undefined }, bar.x))) }));
213
+ }
214
+ const priority = css({
215
+ display: "inline-flex",
216
+ alignItems: "center",
217
+ gap: "control.iconGap",
218
+ minWidth: "0",
219
+ color: "fg.primary",
220
+ fontSize: "body",
221
+ fontWeight: "medium",
222
+ letterSpacing: "compact",
223
+ lineHeight: "tight",
224
+ whiteSpace: "nowrap",
225
+ });
226
+ /** A priority as the Figma's Urgency column draws it: the bars, then the word. */
227
+ export function Priority({ level, children, className, ...props }) {
228
+ const { labels } = useCiridaeLocale();
229
+ return (_jsxs("span", { ...props, className: cx(priority, className), "data-ciridae-ui": "", children: [_jsx(PriorityGlyph, { level: level }), children ?? labels.priority[level]] }));
230
+ }
194
231
  const LIFECYCLE_TONES = {
195
232
  notReached: "neutral",
196
233
  hereNow: "info",
@@ -189,8 +189,13 @@ const round = cva({
189
189
  alignItems: "center",
190
190
  justifyContent: "center",
191
191
  padding: "none",
192
- // The edge's own 1px, as the design counts it; the bare button has neither.
193
- border: "1px solid transparent",
192
+ /*
193
+ * No border, as the text button has none: every size sets its own width and height, so the
194
+ * edge still lands in the design's box. Reserving a transparent 1px border instead put the
195
+ * `[data-edge]` ring on the padding box and left the button's own face painting through the
196
+ * border outside it, which in light read as a white halo round every round button.
197
+ */
198
+ border: "0",
194
199
  borderRadius: "pill",
195
200
  // The icon is the whole control, so it is in the primary ink in every state, as the Figma's
196
201
  // round button and its icon rule draw it; hover shows on the face.
@@ -214,7 +219,6 @@ const round = cva({
214
219
  variant: {
215
220
  raised: {},
216
221
  ghost: {
217
- border: "0",
218
222
  background: "transparent",
219
223
  _hover: { background: "bg.hover" },
220
224
  _active: { translate: "[none]" },
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from "react";
1
2
  import { type IconButtonProps } from "./button.js";
2
3
  /**
3
4
  * Copies `value` (or what it returns, read at the moment of copying) and reports `copied` for a
@@ -14,16 +15,22 @@ export type CopyButtonProps = {
14
15
  value: string | (() => string);
15
16
  /** What gets copied, such as "command"; the button reads "Copy <label>", or "Copy" without one. */
16
17
  label?: string;
17
- /** `inline` is the bare icon in a line of text, such as a message's footer. */
18
- variant?: "raised" | "ghost" | "inline";
18
+ /**
19
+ * `inline` is the bare icon in a line of text, such as a message's footer; `text` is a ghost
20
+ * button that shows its name, such as a panel footer's "Copy link".
21
+ */
22
+ variant?: "raised" | "ghost" | "inline" | "text";
23
+ /** The round button's size; the `text` button is the medium (38) one. */
19
24
  size?: IconButtonProps["size"];
25
+ /** The `text` button's icon before it is pressed, such as a link; a copy icon without it. */
26
+ icon?: ReactNode;
20
27
  onCopied?: () => void;
21
28
  /** A refused copy; the kit's error toast without it. */
22
29
  onError?: (error: unknown) => void;
23
30
  className?: string;
24
31
  };
25
32
  /** A button that copies `value`, its icon turning into a check once copied. */
26
- export declare function CopyButton({ value, label, variant, size, onCopied, onError, className, }: CopyButtonProps): import("react").JSX.Element;
33
+ export declare function CopyButton({ value, label, variant, size, icon: textIcon, onCopied, onError, className, }: CopyButtonProps): import("react").JSX.Element;
27
34
  /**
28
35
  * A long identifier, such as an error's trace ID, shown short and copied whole on click so a
29
36
  * reader can hand it to support.
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { css, cx } from "#primitives/css";
5
- import { IconButton } from "./button.js";
5
+ import { Button, IconButton } from "./button.js";
6
6
  import { Field, FieldLabel } from "./form-layout.js";
7
7
  import { icon } from "./icon.js";
8
8
  import { Input } from "./input.js";
@@ -75,7 +75,7 @@ const inlineCopy = css({
75
75
  _focusVisible: { focusRing: "outer", borderRadius: "control" },
76
76
  });
77
77
  /** A button that copies `value`, its icon turning into a check once copied. */
78
- export function CopyButton({ value, label, variant = "raised", size, onCopied, onError, className, }) {
78
+ export function CopyButton({ value, label, variant = "raised", size, icon: textIcon, onCopied, onError, className, }) {
79
79
  const { copied, copy } = useCopy(value, onCopied, onError);
80
80
  const { labels } = useCiridaeLocale();
81
81
  const name = copied
@@ -84,6 +84,9 @@ export function CopyButton({ value, label, variant = "raised", size, onCopied, o
84
84
  ? labels.common.copyAction
85
85
  : labels.common.copy(label);
86
86
  const Icon = copied ? CheckIcon : CopyIcon;
87
+ if (variant === "text") {
88
+ return (_jsx(Button, { variant: "ghost", size: "medium", className: className, icon: copied || !textIcon ? _jsx(Icon, { className: icon({ size: "small" }) }) : textIcon, onClick: copy, children: name }));
89
+ }
87
90
  if (variant === "inline") {
88
91
  return (_jsx("button", { type: "button", className: cx(inlineCopy, className), "aria-label": name, "data-ciridae-ui": "", onClick: copy, children: _jsx(Icon, { className: icon({ size: "compact" }) }) }));
89
92
  }
@@ -187,19 +187,29 @@ const descriptionList = cva({
187
187
  },
188
188
  layout: {
189
189
  columns: {},
190
+ // One hairline per row across the panel, as the Figma's fact rows draw it: a row's two
191
+ // cells take the taller one's height and sit flush, the label padding the gap, so their
192
+ // rules meet on one line; each centres its own content.
190
193
  facts: {
191
194
  gridTemplateColumns: "minmax(0, 1fr) auto",
192
- alignItems: "center",
195
+ alignItems: "stretch",
193
196
  rowGap: "none",
194
- columnGap: "layout.contentGap",
197
+ columnGap: "none",
195
198
  "& dt, & dd": {
199
+ display: "flex",
200
+ alignItems: "center",
196
201
  paddingBlock: "panel.default",
197
202
  borderBottom: "1px solid token(colors.border.divider)",
198
203
  lineHeight: "tight",
199
204
  },
200
205
  "& > :nth-last-child(-n+2)": { borderBottom: "0" },
201
- "& dt": { fontSize: "code", fontWeight: "medium" },
202
- "& dd": { fontSize: "body", fontWeight: "medium", textAlign: "end" },
206
+ "& dt": { paddingInlineEnd: "layout.contentGap", fontSize: "code", fontWeight: "medium" },
207
+ "& dd": {
208
+ justifyContent: "flex-end",
209
+ fontSize: "body",
210
+ fontWeight: "medium",
211
+ textAlign: "end",
212
+ },
203
213
  },
204
214
  },
205
215
  },
@@ -726,9 +726,13 @@ const bodyRow = css(rowBase, {
726
726
  "&:is(:hover, :focus-within, [data-selected], [data-active]) [data-row-actions] > *, & [data-row-actions]:has([data-popup-open]) > *": { opacity: "[1]" },
727
727
  "@media (hover: none)": { "& [data-row-actions] > *": { opacity: "[1]" } },
728
728
  });
729
+ // A group heading sits on the page panel's own surface, a shade under the rows' card wash, as the
730
+ // Figma's My Work groups draw it; the list's surfaces are translucent, so it redraws the panel on
731
+ // the solid canvas as a pinned cell does.
729
732
  const groupRow = css(rowBase, {
730
733
  minHeight: "[40px]",
731
- background: "bg.field",
734
+ background: "bg.canvas",
735
+ boxShadow: "[inset 0 0 0 999px token(colors.bg.panel)]",
732
736
  "&:last-child": { borderBottom: "0" },
733
737
  });
734
738
  const emptyRow = css({ gridColumn: "1 / -1" });
@@ -194,14 +194,22 @@ const footer = css({
194
194
  padding: "panel.comfortable",
195
195
  borderTop: "1px solid token(colors.border.divider)",
196
196
  });
197
+ // The note keeps room for a line, as the Figma's action sheets set it left of the pills: a long
198
+ // action wraps under it before the note narrows to a column of words.
197
199
  const footerNote = css({
198
200
  flex: "1",
201
+ minWidth: "sheet.footerNote",
199
202
  color: "fg.muted",
200
203
  fontSize: "code",
201
204
  fontWeight: "medium",
202
205
  letterSpacing: "compact",
203
206
  });
204
- const footerActions = css({ display: "flex", alignItems: "center", gap: "layout.tightGap" });
207
+ const footerActions = css({
208
+ display: "flex",
209
+ alignItems: "center",
210
+ gap: "layout.tightGap",
211
+ marginInlineStart: "auto",
212
+ });
205
213
  /**
206
214
  * A sheet docked at the window's right edge beside the page, which stays usable: it is not modal
207
215
  * and a click outside leaves it open, so Escape or its close button closes it. Pass `modal` or
@@ -50,20 +50,29 @@ export declare function FilterChip({ label, icon: fieldIcon, operator, values, o
50
50
  onEdit?: () => void;
51
51
  onRemove: () => void;
52
52
  }): import("react").JSX.Element;
53
- /**
54
- * The set filters as chips, Clear all, and the Add filter builder: pick a field, then its operator
55
- * and values, which apply as they are picked. Pressing a chip reopens the builder on its field.
56
- * `children` sit after Add filter, such as the list's search. Controlled with `value` /
57
- * `onValueChange`, and the builder's `open` / `onOpenChange` when the page opens it too.
58
- */
59
- export declare function FilterBar({ fields, value, defaultValue, onValueChange, open: ownOpen, onOpenChange, children, className, ...props }: Omit<ComponentProps<"div">, "defaultValue"> & {
53
+ export type FilterButtonProps = Omit<ComponentProps<"div">, "defaultValue"> & {
60
54
  fields: readonly FilterField[];
61
55
  value?: readonly FilterValue[];
62
56
  defaultValue?: readonly FilterValue[];
63
57
  onValueChange?: (value: FilterValue[]) => void;
58
+ /** Whether the builder is open, for a page that opens it too, such as from a hotkey. */
64
59
  open?: boolean;
65
60
  onOpenChange?: (open: boolean) => void;
66
- }): import("react").JSX.Element;
61
+ };
62
+ /**
63
+ * A list toolbar's filters: the set ones as chips, Clear all, and the Figma's Filter pill (a
64
+ * funnel and "Filter") that opens the builder: pick a field, then its operator and values, which
65
+ * apply as they are picked. Pressing a chip reopens the builder on its field. It is one inline
66
+ * group, so it sits in a `Toolbar` beside the tabs and the search.
67
+ */
68
+ export declare function FilterButton({ fields, value, defaultValue, onValueChange, open: ownOpen, onOpenChange, className, ...props }: FilterButtonProps): import("react").JSX.Element;
69
+ /**
70
+ * A list's filter row: `children` first, such as the list's search, then a `FilterButton` (the set
71
+ * filters as chips, Clear all and the Filter pill) at the row's far edge. Controlled with `value` /
72
+ * `onValueChange`, and the builder's `open` / `onOpenChange` when the page opens it too. In a
73
+ * toolbar that already holds the tabs and search, place a `FilterButton` there instead.
74
+ */
75
+ export declare function FilterBar({ fields, value, defaultValue, onValueChange, open, onOpenChange, children, className, ...props }: FilterButtonProps): import("react").JSX.Element;
67
76
  /**
68
77
  * One field's operator and values, reporting every change so the list follows along. `onBack`
69
78
  * adds the way back to the builder's field list; without it the field is fixed, as under a