@ciridae/ui 1.0.14 → 1.1.1
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/ciridae.css +5 -0
- package/dist/components/app-frame.d.ts +29 -4
- package/dist/components/app-frame.js +16 -5
- package/dist/components/app-navigation.d.ts +16 -1
- package/dist/components/app-navigation.js +18 -7
- package/dist/components/badge.d.ts +14 -0
- package/dist/components/badge.js +38 -1
- package/dist/components/copyable-id.d.ts +10 -3
- package/dist/components/copyable-id.js +5 -2
- package/dist/components/data-display.js +14 -4
- package/dist/components/data-grid.js +5 -1
- package/dist/components/drawer.js +9 -1
- package/dist/components/filter-bar.d.ts +17 -8
- package/dist/components/filter-bar.js +38 -32
- package/dist/components/input.d.ts +6 -1
- package/dist/components/input.js +9 -3
- package/dist/components/layout.d.ts +7 -2
- package/dist/components/layout.js +34 -7
- package/dist/components/locale.d.ts +20 -0
- package/dist/components/locale.js +19 -1
- package/dist/components/objective-header.d.ts +25 -0
- package/dist/components/objective-header.js +70 -0
- package/dist/components/panel.d.ts +4 -2
- package/dist/components/panel.js +26 -3
- package/dist/components/settings.d.ts +7 -2
- package/dist/components/settings.js +11 -3
- package/dist/components/shell.js +7 -1
- package/dist/components/side-panel.d.ts +13 -3
- package/dist/components/side-panel.js +28 -7
- package/dist/components/sidebar.js +7 -10
- package/dist/components/switch.d.ts +7 -3
- package/dist/components/switch.js +17 -3
- package/dist/components/tabs.js +4 -1
- package/dist/components/value-change.d.ts +13 -0
- package/dist/components/value-change.js +59 -0
- package/dist/preset.js +14 -1
- package/dist/styled-system/styles.css +168 -80
- package/dist/styled-system/tokens/index.mjs +33 -1
- package/dist/styled-system/tokens/tokens.d.ts +3 -3
- package/dist/styles.css +5 -0
- package/package.json +9 -1
package/dist/ciridae.css
CHANGED
|
@@ -35,6 +35,11 @@
|
|
|
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
|
|
@@ -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
|
-
/**
|
|
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
|
-
|
|
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:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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;
|
package/dist/components/badge.js
CHANGED
|
@@ -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",
|
|
@@ -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
|
-
/**
|
|
18
|
-
|
|
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: "
|
|
195
|
+
alignItems: "stretch",
|
|
193
196
|
rowGap: "none",
|
|
194
|
-
columnGap: "
|
|
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": {
|
|
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.
|
|
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({
|
|
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
|
-
}
|
|
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
|
|
@@ -2,12 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/*
|
|
3
3
|
* A list's filters as data: fields the list can be narrowed by, each a `kind` with its own
|
|
4
4
|
* operators, and the filters set on them as `{ field, operator, values }` with string values, so
|
|
5
|
-
* they round-trip through a URL. `
|
|
6
|
-
*
|
|
5
|
+
* they round-trip through a URL. `FilterButton` shows the set ones as removable chips before a
|
|
6
|
+
* Filter pill that opens the builder (field, then operator and values), and `FilterBar` puts it at
|
|
7
|
+
* the end of a row after the list's search; `FilterValueEditor` is the builder's second step
|
|
7
8
|
* alone, such as a column head's "Filter by". Nothing here filters rows: `matchesFilter` tests one
|
|
8
9
|
* value for a list that filters on the client.
|
|
9
10
|
*/
|
|
10
|
-
import { CaretDownIcon, CaretLeftIcon, CaretRightIcon,
|
|
11
|
+
import { CaretDownIcon, CaretLeftIcon, CaretRightIcon, FunnelSimpleIcon, XIcon, } from "@phosphor-icons/react";
|
|
11
12
|
import { useState } from "react";
|
|
12
13
|
import { css, cx } from "#primitives/css";
|
|
13
14
|
import { Button, IconButton } from "./button.js";
|
|
@@ -165,32 +166,28 @@ export function FilterChip({ label, icon: fieldIcon, operator, values, onEdit, o
|
|
|
165
166
|
const { labels } = useCiridaeLocale();
|
|
166
167
|
return (_jsxs("span", { ...props, className: cx(chip, toolbarEdge.className, className), "data-ciridae-ui": "", "data-edge": toolbarEdge["data-edge"], children: [_jsxs("button", { type: "button", className: chipBody, onClick: onEdit, children: [fieldIcon, label, " ", _jsx("span", { className: chipOperator, children: operator }), _jsx("span", { className: chipValue, children: values })] }), _jsx("button", { type: "button", className: chipRemove, "aria-label": labels.filters.remove(label), onClick: onRemove, children: _jsx(XIcon, { className: icon({ size: "small" }) }) })] }));
|
|
167
168
|
}
|
|
169
|
+
// The toolbar row: the list's own controls (the search), then the set filters and the Filter pill
|
|
170
|
+
// at the far edge, as the Figma's list toolbars draw them.
|
|
171
|
+
// One line: a full-width search shrinks to what the filters leave it; on a phone the filters wrap
|
|
172
|
+
// under it.
|
|
168
173
|
const bar = css({
|
|
169
174
|
display: "flex",
|
|
170
175
|
alignItems: "center",
|
|
171
|
-
justifyContent: "
|
|
172
|
-
flexWrap: "wrap",
|
|
176
|
+
justifyContent: "flex-end",
|
|
173
177
|
gap: "layout.controlGap",
|
|
174
178
|
minHeight: "control.default",
|
|
179
|
+
"& > *": { minWidth: "0" },
|
|
180
|
+
_phone: { flexWrap: "wrap" },
|
|
175
181
|
});
|
|
176
|
-
|
|
182
|
+
// The chips wrap among themselves before they push the pill off its line; the pill keeps its size.
|
|
183
|
+
const filterGroup = css({
|
|
177
184
|
display: "flex",
|
|
178
185
|
alignItems: "center",
|
|
179
|
-
flexWrap: "wrap",
|
|
180
|
-
gap: "layout.controlGap",
|
|
181
|
-
minWidth: "0",
|
|
182
|
-
});
|
|
183
|
-
// One line: the buttons keep their size and the search after them takes what the row leaves.
|
|
184
|
-
const tools = css({
|
|
185
|
-
display: "flex",
|
|
186
|
-
flex: "1",
|
|
187
|
-
alignItems: "center",
|
|
188
186
|
justifyContent: "flex-end",
|
|
187
|
+
flexWrap: "wrap",
|
|
189
188
|
gap: "layout.controlGap",
|
|
190
189
|
minWidth: "0",
|
|
191
|
-
marginInlineStart: "auto",
|
|
192
190
|
"& > button": { flexShrink: "0" },
|
|
193
|
-
"& > :not(button)": { minWidth: "0" },
|
|
194
191
|
});
|
|
195
192
|
const builder = css({
|
|
196
193
|
display: "flex",
|
|
@@ -231,12 +228,12 @@ const noMatches = css({
|
|
|
231
228
|
fontSize: "caption",
|
|
232
229
|
});
|
|
233
230
|
/**
|
|
234
|
-
*
|
|
235
|
-
* and
|
|
236
|
-
*
|
|
237
|
-
*
|
|
231
|
+
* A list toolbar's filters: the set ones as chips, Clear all, and the Figma's Filter pill (a
|
|
232
|
+
* funnel and "Filter") that opens the builder: pick a field, then its operator and values, which
|
|
233
|
+
* apply as they are picked. Pressing a chip reopens the builder on its field. It is one inline
|
|
234
|
+
* group, so it sits in a `Toolbar` beside the tabs and the search.
|
|
238
235
|
*/
|
|
239
|
-
export function
|
|
236
|
+
export function FilterButton({ fields, value, defaultValue = [], onValueChange, open: ownOpen, onOpenChange, className, ...props }) {
|
|
240
237
|
const locale = useCiridaeLocale();
|
|
241
238
|
const { labels } = locale;
|
|
242
239
|
const [filters, setFilters] = useControllableState(value, defaultValue, onValueChange && ((next) => onValueChange([...next])));
|
|
@@ -248,16 +245,25 @@ export function FilterBar({ fields, value, defaultValue = [], onValueChange, ope
|
|
|
248
245
|
if (!next)
|
|
249
246
|
setEditing(null);
|
|
250
247
|
};
|
|
251
|
-
return (_jsxs("div", { ...props, className: cx(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
248
|
+
return (_jsxs("div", { ...props, className: cx(filterGroup, className), "data-ciridae-ui": "", children: [filters.map((filter) => {
|
|
249
|
+
const field = fieldOf(filter.field);
|
|
250
|
+
if (!field)
|
|
251
|
+
return null;
|
|
252
|
+
const described = describeFilter(field, filter, locale);
|
|
253
|
+
return (_jsx(FilterChip, { label: field.label, operator: described.operator, values: described.values, onEdit: () => {
|
|
254
|
+
setEditing(field.key);
|
|
255
|
+
setOpen(true);
|
|
256
|
+
}, onRemove: () => setFilters(filters.filter((candidate) => candidate.field !== filter.field)) }, filter.field));
|
|
257
|
+
}), filters.length > 0 && (_jsx(Button, { variant: "ghost", onClick: () => setFilters([]), children: labels.filters.clearAll })), _jsx(Popover, { open: open, onOpenChange: changeOpen, density: "compact", align: "end", trigger: _jsx(Button, { variant: "secondary", size: "medium", icon: _jsx(FunnelSimpleIcon, { className: icon({ size: "small" }) }), onClick: () => setEditing(null), children: labels.filters.filter }), children: open && (_jsx(FilterBuilder, { fields: fields, startField: editing, filters: filters, onChange: (filter) => setFilters(replaceFilter(filters, filter)) }, editing ?? "")) })] }));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A list's filter row: `children` first, such as the list's search, then a `FilterButton` (the set
|
|
261
|
+
* filters as chips, Clear all and the Filter pill) at the row's far edge. Controlled with `value` /
|
|
262
|
+
* `onValueChange`, and the builder's `open` / `onOpenChange` when the page opens it too. In a
|
|
263
|
+
* toolbar that already holds the tabs and search, place a `FilterButton` there instead.
|
|
264
|
+
*/
|
|
265
|
+
export function FilterBar({ fields, value, defaultValue, onValueChange, open, onOpenChange, children, className, ...props }) {
|
|
266
|
+
return (_jsxs("div", { ...props, className: cx(bar, className), "data-ciridae-ui": "", children: [children, _jsx(FilterButton, { fields: fields, value: value, defaultValue: defaultValue, onValueChange: onValueChange, open: open, onOpenChange: onOpenChange })] }));
|
|
261
267
|
}
|
|
262
268
|
function FilterBuilder({ fields, startField, filters, onChange, }) {
|
|
263
269
|
const { labels } = useCiridaeLocale();
|
|
@@ -33,6 +33,11 @@ export type SearchFieldProps = Omit<ComponentProps<"input">, "size" | "type"> &
|
|
|
33
33
|
shortcut?: Hotkey;
|
|
34
34
|
/** In a menu or popover: the hairline alone, as the sheet's divider, with no hover or ring. */
|
|
35
35
|
quiet?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* `toolbar` is a list toolbar's fixed width (240, full on a phone); `fill` takes its container's.
|
|
38
|
+
* Defaults to `toolbar` in a `Toolbar`, `fill` elsewhere.
|
|
39
|
+
*/
|
|
40
|
+
width?: "fill" | "toolbar";
|
|
36
41
|
wrapperClassName?: string;
|
|
37
42
|
};
|
|
38
|
-
export declare function SearchField({ size: ownSize, onClear, quiet, shortcut, wrapperClassName, className, disabled, ...props }: SearchFieldProps): import("react").JSX.Element;
|
|
43
|
+
export declare function SearchField({ size: ownSize, onClear, quiet, shortcut, width: ownWidth, wrapperClassName, className, disabled, ...props }: SearchFieldProps): import("react").JSX.Element;
|
package/dist/components/input.js
CHANGED
|
@@ -218,8 +218,13 @@ const underline = cva({
|
|
|
218
218
|
},
|
|
219
219
|
true: { paddingInline: "none", borderBottomColor: "border.divider" },
|
|
220
220
|
},
|
|
221
|
+
// A list toolbar's search is the Figma's fixed 240, full width on a phone.
|
|
222
|
+
width: {
|
|
223
|
+
fill: {},
|
|
224
|
+
toolbar: { width: "search.toolbar", flexShrink: "0", _phone: { width: "full" } },
|
|
225
|
+
},
|
|
221
226
|
},
|
|
222
|
-
defaultVariants: { size: "regular", quiet: false },
|
|
227
|
+
defaultVariants: { size: "regular", quiet: false, width: "fill" },
|
|
223
228
|
});
|
|
224
229
|
const underlineText = css({
|
|
225
230
|
flex: "1",
|
|
@@ -254,9 +259,10 @@ const clear = css({
|
|
|
254
259
|
_hover: { color: "fg.primary", background: "bg.hover" },
|
|
255
260
|
_focusVisible: { focusRing: "inset" },
|
|
256
261
|
});
|
|
257
|
-
export function SearchField({ size: ownSize, onClear, quiet = false, shortcut, wrapperClassName, className, disabled, ...props }) {
|
|
262
|
+
export function SearchField({ size: ownSize, onClear, quiet = false, shortcut, width: ownWidth, wrapperClassName, className, disabled, ...props }) {
|
|
258
263
|
const inToolbar = useInToolbar();
|
|
259
264
|
const { labels } = useCiridaeLocale();
|
|
260
265
|
const size = ownSize ?? (inToolbar ? "compact" : "regular");
|
|
261
|
-
|
|
266
|
+
const width = ownWidth ?? (inToolbar ? "toolbar" : "fill");
|
|
267
|
+
return (_jsxs("label", { className: cx(underline({ size, quiet, width }), wrapperClassName), "data-ciridae-ui": "", children: [_jsx(MagnifyingGlassIcon, { className: icon({ size: "small" }) }), _jsx(BaseInput, { ...props, type: "search", disabled: disabled, className: cx(underlineText, className) }), onClear && (_jsx("button", { type: "button", className: clear, "aria-label": labels.common.clear, disabled: disabled, onClick: onClear, children: _jsx(XIcon, { className: icon({ size: "small" }) }) })), shortcut && !onClear && _jsx(ShortcutHint, { boxed: true, hotkey: shortcut })] }));
|
|
262
268
|
}
|