@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.
- package/dist/chat/contract.js +12 -2
- package/dist/chat/message-text.js +8 -7
- package/dist/ciridae.css +12 -1
- 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/button.js +7 -3
- 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 +9 -3
- package/dist/components/panel.js +38 -6
- 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/switch.d.ts +7 -3
- package/dist/components/switch.js +17 -3
- package/dist/components/tabs.js +10 -1
- package/dist/components/theme-toggle.js +4 -1
- package/dist/components/value-change.d.ts +13 -0
- package/dist/components/value-change.js +59 -0
- package/dist/preset.js +27 -3
- package/dist/styled-system/styles.css +190 -61
- package/dist/styled-system/tokens/index.mjs +33 -1
- package/dist/styled-system/tokens/tokens.d.ts +3 -3
- package/dist/styles.css +12 -1
- package/dist/theme/palette.js +9 -5
- package/package.json +9 -1
|
@@ -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
|
}
|
|
@@ -12,7 +12,10 @@ export type StackProps = useRender.ComponentProps<"div"> & {
|
|
|
12
12
|
export declare function Stack({ gap, align, justify, render, className, ...props }: StackProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
13
13
|
export type ClusterProps = useRender.ComponentProps<"div"> & {
|
|
14
14
|
gap?: Gap;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Wraps onto more lines when narrow; `false` keeps one line. Defaults to true, and in a `Toolbar`
|
|
17
|
+
* to one line above a phone's width.
|
|
18
|
+
*/
|
|
16
19
|
wrap?: boolean;
|
|
17
20
|
};
|
|
18
21
|
/** Children in a row, centered on one line. */
|
|
@@ -152,6 +155,8 @@ export type ListRowProps = Omit<useRender.ComponentProps<"div">, "children"> & {
|
|
|
152
155
|
/** The leading checkbox's state, such as `checked` and `onCheckedChange`. */
|
|
153
156
|
checkbox?: Omit<ComponentProps<typeof Checkbox>, "children" | "className" | "wrapperClassName">;
|
|
154
157
|
flush?: boolean;
|
|
158
|
+
/** A hairline above the row when another precedes it, with the roomier block padding of a settings list. */
|
|
159
|
+
divider?: boolean;
|
|
155
160
|
loading?: boolean;
|
|
156
161
|
/**
|
|
157
162
|
* Makes the whole row a link to this address; `render` takes a router's link instead. Keep
|
|
@@ -159,7 +164,7 @@ export type ListRowProps = Omit<useRender.ComponentProps<"div">, "children"> & {
|
|
|
159
164
|
*/
|
|
160
165
|
href?: string;
|
|
161
166
|
};
|
|
162
|
-
export declare function ListRow({ leading, label, detail, trailing, checkbox, flush, loading, href, render, className, ...props }: ListRowProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
167
|
+
export declare function ListRow({ leading, label, detail, trailing, checkbox, flush, divider, loading, href, render, className, ...props }: ListRowProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
163
168
|
/** A responsive grid of ChoiceCards, shared by provider, role, and client pickers. */
|
|
164
169
|
export declare function ChoiceGrid({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
165
170
|
/**
|
|
@@ -58,18 +58,22 @@ const cluster = cva({
|
|
|
58
58
|
// One line: the cluster and its children shrink, so a long label truncates instead of
|
|
59
59
|
// pushing the row wider.
|
|
60
60
|
false: { flexWrap: "nowrap", minWidth: "0", "& > *": { minWidth: "0" } },
|
|
61
|
+
// A toolbar's controls stay on the tab row, as the Figma draws them, and wrap only on a
|
|
62
|
+
// phone; unlike `false`, its controls keep their own widths.
|
|
63
|
+
toolbar: { flexWrap: "nowrap", _phone: { flexWrap: "wrap" } },
|
|
61
64
|
},
|
|
62
65
|
},
|
|
63
66
|
});
|
|
64
67
|
/** Children in a row, centered on one line. */
|
|
65
|
-
export function Cluster({ gap = "8", wrap
|
|
68
|
+
export function Cluster({ gap = "8", wrap, render, className, ...props }) {
|
|
69
|
+
const inToolbar = useInToolbar();
|
|
66
70
|
return useRender({
|
|
67
71
|
defaultTagName: "div",
|
|
68
72
|
render,
|
|
69
73
|
props: {
|
|
70
74
|
...props,
|
|
71
75
|
"data-ciridae-ui": "",
|
|
72
|
-
className: cx(cluster({ wrap }), layoutGap({ gap }), className),
|
|
76
|
+
className: cx(cluster({ wrap: wrap ?? (inToolbar ? "toolbar" : true) }), layoutGap({ gap }), className),
|
|
73
77
|
},
|
|
74
78
|
});
|
|
75
79
|
}
|
|
@@ -159,8 +163,15 @@ const ToolbarContext = createContext(false);
|
|
|
159
163
|
export function useInToolbar() {
|
|
160
164
|
return useContext(ToolbarContext);
|
|
161
165
|
}
|
|
166
|
+
// At least the 38 of the controls it holds, so a row of tabs alone keeps the toolbar's height.
|
|
162
167
|
const toolbar = cva({
|
|
163
|
-
base: {
|
|
168
|
+
base: {
|
|
169
|
+
display: "flex",
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
flexWrap: "wrap",
|
|
172
|
+
minWidth: "0",
|
|
173
|
+
minHeight: "control.default",
|
|
174
|
+
},
|
|
164
175
|
variants: {
|
|
165
176
|
justify: { start: {}, between: { justifyContent: "space-between" } },
|
|
166
177
|
stackOnPhone: {
|
|
@@ -205,8 +216,16 @@ const listRow = cva({
|
|
|
205
216
|
},
|
|
206
217
|
true: {},
|
|
207
218
|
},
|
|
219
|
+
// The Figma's settings and agent lists: 14 above and below, and a hairline between rows.
|
|
220
|
+
divider: {
|
|
221
|
+
true: {
|
|
222
|
+
paddingBlock: "listRow.dividedBlock",
|
|
223
|
+
"&:not(:first-child)": { borderTop: "1px solid token(colors.border.divider)" },
|
|
224
|
+
},
|
|
225
|
+
false: {},
|
|
226
|
+
},
|
|
208
227
|
},
|
|
209
|
-
defaultVariants: { flush: false },
|
|
228
|
+
defaultVariants: { flush: false, divider: false },
|
|
210
229
|
});
|
|
211
230
|
const listRowLink = css({
|
|
212
231
|
color: "[inherit]",
|
|
@@ -215,7 +234,15 @@ const listRowLink = css({
|
|
|
215
234
|
_hover: { background: "bg.rowHover" },
|
|
216
235
|
_focusVisible: { focusRing: "inset" },
|
|
217
236
|
});
|
|
218
|
-
|
|
237
|
+
// Its own leading, so a label and its detail sit 17 apart, as the Figma's list rows draw them,
|
|
238
|
+
// even in a table whose single-line cells are set at 100%.
|
|
239
|
+
const stackedText = css({
|
|
240
|
+
display: "flex",
|
|
241
|
+
flexDirection: "column",
|
|
242
|
+
flex: "1",
|
|
243
|
+
minWidth: "0",
|
|
244
|
+
lineHeight: "stacked",
|
|
245
|
+
});
|
|
219
246
|
// A flush row stays one line, as a table row does: the detail follows the label, and both cut
|
|
220
247
|
// with an ellipsis.
|
|
221
248
|
const inlineText = css({
|
|
@@ -238,7 +265,7 @@ const rowCheckboxBox = css({ flexShrink: "0" });
|
|
|
238
265
|
export function ListRowText({ label, detail, inline = false, }) {
|
|
239
266
|
return (_jsxs("span", { className: inline ? inlineText : stackedText, children: [label, detail && _jsx("span", { className: cx(rowDetail, inline && inlineRowDetail), children: detail })] }));
|
|
240
267
|
}
|
|
241
|
-
export function ListRow({ leading, label, detail, trailing, checkbox, flush = false, loading = false, href, render, className, ...props }) {
|
|
268
|
+
export function ListRow({ leading, label, detail, trailing, checkbox, flush = false, divider = false, loading = false, href, render, className, ...props }) {
|
|
242
269
|
const link = href !== undefined || render !== undefined;
|
|
243
270
|
return useRender({
|
|
244
271
|
defaultTagName: href !== undefined ? "a" : "div",
|
|
@@ -247,7 +274,7 @@ export function ListRow({ leading, label, detail, trailing, checkbox, flush = fa
|
|
|
247
274
|
...(href !== undefined ? { href } : {}),
|
|
248
275
|
...props,
|
|
249
276
|
"aria-busy": loading || undefined,
|
|
250
|
-
className: cx(listRow({ flush }), link && listRowLink, className),
|
|
277
|
+
className: cx(listRow({ flush, divider }), link && listRowLink, className),
|
|
251
278
|
"data-ciridae-ui": "",
|
|
252
279
|
children: loading ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { shape: "circle", style: { width: 16 } }), _jsx("span", { className: stackedText, children: _jsx(Skeleton, { shape: "text", style: { width: "40%" } }) })] })) : checkbox ? (_jsxs(_Fragment, { children: [_jsxs(Checkbox, { ...checkbox, wrapperClassName: rowCheckbox, className: rowCheckboxBox, children: [leading && (_jsx("span", { className: rowLeading, "aria-hidden": "true", children: leading })), _jsx(ListRowText, { label: label, detail: detail, inline: flush })] }), trailing] })) : (_jsxs(_Fragment, { children: [leading && _jsx("span", { className: rowLeading, children: leading }), _jsx(ListRowText, { label: label, detail: detail, inline: flush }), trailing] })),
|
|
253
280
|
},
|
|
@@ -320,6 +320,9 @@ export declare const englishLabels: {
|
|
|
320
320
|
noMatches: (search: string) => string;
|
|
321
321
|
};
|
|
322
322
|
filters: {
|
|
323
|
+
/** The Filter pill that opens the builder. */
|
|
324
|
+
filter: string;
|
|
325
|
+
/** No longer drawn: the pill reads `filter`. Kept so a locale that sets it still compiles. */
|
|
323
326
|
addFilter: string;
|
|
324
327
|
clearAll: string;
|
|
325
328
|
filterBy: string;
|
|
@@ -432,6 +435,23 @@ export declare const englishLabels: {
|
|
|
432
435
|
status: string;
|
|
433
436
|
localBuild: string;
|
|
434
437
|
updateAvailable: string;
|
|
438
|
+
/** The settings sidebar's first row, and the name of its navigation. */
|
|
439
|
+
backToApp: string;
|
|
440
|
+
settings: string;
|
|
441
|
+
};
|
|
442
|
+
/** `Priority`'s words for its three levels. */
|
|
443
|
+
priority: {
|
|
444
|
+
high: string;
|
|
445
|
+
medium: string;
|
|
446
|
+
low: string;
|
|
447
|
+
};
|
|
448
|
+
objectiveHeader: {
|
|
449
|
+
objective: string;
|
|
450
|
+
};
|
|
451
|
+
/** Read before a `ValueChange`'s old and new values, which a screen reader does not mark as struck. */
|
|
452
|
+
valueChange: {
|
|
453
|
+
from: string;
|
|
454
|
+
to: string;
|
|
435
455
|
};
|
|
436
456
|
accountMenu: {
|
|
437
457
|
menu: string;
|
|
@@ -295,6 +295,9 @@ export const englishLabels = {
|
|
|
295
295
|
noMatches: (search) => `No matches for “${search}”`,
|
|
296
296
|
},
|
|
297
297
|
filters: {
|
|
298
|
+
/** The Filter pill that opens the builder. */
|
|
299
|
+
filter: "Filter",
|
|
300
|
+
/** No longer drawn: the pill reads `filter`. Kept so a locale that sets it still compiles. */
|
|
298
301
|
addFilter: "Add filter",
|
|
299
302
|
clearAll: "Clear all",
|
|
300
303
|
filterBy: "Filter by…",
|
|
@@ -394,7 +397,19 @@ export const englishLabels = {
|
|
|
394
397
|
fullScreen: "Full screen",
|
|
395
398
|
exitFullScreen: "Exit full screen",
|
|
396
399
|
},
|
|
397
|
-
appFrame: {
|
|
400
|
+
appFrame: {
|
|
401
|
+
status: "Status",
|
|
402
|
+
localBuild: "local",
|
|
403
|
+
updateAvailable: "Update available",
|
|
404
|
+
/** The settings sidebar's first row, and the name of its navigation. */
|
|
405
|
+
backToApp: "Back to app",
|
|
406
|
+
settings: "Settings",
|
|
407
|
+
},
|
|
408
|
+
/** `Priority`'s words for its three levels. */
|
|
409
|
+
priority: { high: "High", medium: "Medium", low: "Low" },
|
|
410
|
+
objectiveHeader: { objective: "Objective" },
|
|
411
|
+
/** Read before a `ValueChange`'s old and new values, which a screen reader does not mark as struck. */
|
|
412
|
+
valueChange: { from: "from", to: "to" },
|
|
398
413
|
accountMenu: { menu: "Account menu", signOut: "Sign out" },
|
|
399
414
|
themeCustomizer: {
|
|
400
415
|
colorTheme: "Color theme",
|
|
@@ -483,6 +498,9 @@ function mergeLabels(overrides) {
|
|
|
483
498
|
clipboard: { ...englishLabels.clipboard, ...overrides.clipboard },
|
|
484
499
|
accountMenu: { ...englishLabels.accountMenu, ...overrides.accountMenu },
|
|
485
500
|
appFrame: { ...englishLabels.appFrame, ...overrides.appFrame },
|
|
501
|
+
priority: { ...englishLabels.priority, ...overrides.priority },
|
|
502
|
+
objectiveHeader: { ...englishLabels.objectiveHeader, ...overrides.objectiveHeader },
|
|
503
|
+
valueChange: { ...englishLabels.valueChange, ...overrides.valueChange },
|
|
486
504
|
};
|
|
487
505
|
}
|
|
488
506
|
/** The locale value `useCiridaeLocale` returns, for use outside React or in tests. */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
/** One fact on the measure line: its muted label, then its value, such as "Reads" "Invoices". */
|
|
3
|
+
export type ObjectiveMeasure = {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export type ObjectiveHeaderProps = Omit<ComponentProps<"section">, "title"> & {
|
|
8
|
+
/** What the agent is trying to achieve. */
|
|
9
|
+
objective: ReactNode;
|
|
10
|
+
/** The muted label over it; the locale's "Objective" when left out. */
|
|
11
|
+
eyebrow?: ReactNode;
|
|
12
|
+
/** The line under it, split by dots, such as "Measured as" and "Reads". */
|
|
13
|
+
measures?: readonly ObjectiveMeasure[];
|
|
14
|
+
/** The large figure at the far edge, such as "94%". */
|
|
15
|
+
figure?: ReactNode;
|
|
16
|
+
/** Under the figure, such as "Last 30 days · up 3 pts". */
|
|
17
|
+
caption?: ReactNode;
|
|
18
|
+
/** After a hairline at the far edge, such as an Edit button. */
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* An agent's objective as a card: the objective with its measure line, and at the far edge the
|
|
23
|
+
* figure with its caption under it, then the actions.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ObjectiveHeader({ objective, eyebrow, measures, figure, caption, actions, className, ...props }: ObjectiveHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* The objective an agent works toward, as the Figma's Agent policies page opens with it: a muted
|
|
4
|
+
* "Objective" eyebrow, the objective, and a line of what it is measured as and reads; at the far
|
|
5
|
+
* edge the figure for the last period with its caption under it, a hairline, and the actions.
|
|
6
|
+
*/
|
|
7
|
+
import { Fragment } from "react";
|
|
8
|
+
import { css, cx } from "#primitives/css";
|
|
9
|
+
import { useCiridaeLocale } from "./locale.js";
|
|
10
|
+
import { cardSurface } from "./panel.js";
|
|
11
|
+
const card = css(cardSurface, {
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
gap: "layout.clusterGap",
|
|
16
|
+
padding: "panel.comfortable",
|
|
17
|
+
_phone: { flexDirection: "column", alignItems: "stretch" },
|
|
18
|
+
});
|
|
19
|
+
const copy = css({ display: "grid", gap: "layout.controlGap", minWidth: "0" });
|
|
20
|
+
const heading = css({ display: "grid", gap: "layout.tightGap", minWidth: "0" });
|
|
21
|
+
const small = css({
|
|
22
|
+
fontSize: "code",
|
|
23
|
+
fontWeight: "medium",
|
|
24
|
+
letterSpacing: "compact",
|
|
25
|
+
lineHeight: "tight",
|
|
26
|
+
});
|
|
27
|
+
const muted = css({ color: "fg.label" });
|
|
28
|
+
const statement = css({
|
|
29
|
+
margin: "none",
|
|
30
|
+
fontSize: "body",
|
|
31
|
+
fontWeight: "medium",
|
|
32
|
+
letterSpacing: "compact",
|
|
33
|
+
lineHeight: "tight",
|
|
34
|
+
});
|
|
35
|
+
const measureLine = css({
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexWrap: "wrap",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: "layout.controlGap",
|
|
40
|
+
color: "fg.primary",
|
|
41
|
+
});
|
|
42
|
+
const measure = css({ display: "inline-flex", gap: "layout.tightGap" });
|
|
43
|
+
const result = css({
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
gap: "layout.clusterGap",
|
|
47
|
+
flexShrink: "0",
|
|
48
|
+
});
|
|
49
|
+
const score = css({ display: "grid", justifyItems: "end", gap: "control.iconGap" });
|
|
50
|
+
const figureText = css({
|
|
51
|
+
fontSize: "heading.page",
|
|
52
|
+
fontWeight: "medium",
|
|
53
|
+
letterSpacing: "compact",
|
|
54
|
+
lineHeight: "tight",
|
|
55
|
+
});
|
|
56
|
+
const divider = css({
|
|
57
|
+
width: "border.hairline",
|
|
58
|
+
alignSelf: "stretch",
|
|
59
|
+
background: "border.divider",
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* An agent's objective as a card: the objective with its measure line, and at the far edge the
|
|
63
|
+
* figure with its caption under it, then the actions.
|
|
64
|
+
*/
|
|
65
|
+
export function ObjectiveHeader({ objective, eyebrow, measures = [], figure, caption, actions, className, ...props }) {
|
|
66
|
+
const { labels } = useCiridaeLocale();
|
|
67
|
+
const label = eyebrow ?? labels.objectiveHeader.objective;
|
|
68
|
+
const hasResult = figure !== undefined || caption !== undefined;
|
|
69
|
+
return (_jsxs("section", { "aria-label": typeof label === "string" ? label : undefined, ...props, className: cx(card, className), "data-ciridae-ui": "", children: [_jsxs("div", { className: copy, children: [_jsxs("div", { className: heading, children: [_jsx("span", { className: cx(small, muted), children: label }), _jsx("p", { className: statement, children: objective })] }), measures.length > 0 && (_jsx("span", { className: cx(small, measureLine), children: measures.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && (_jsx("span", { className: muted, "aria-hidden": "true", children: "\u00B7" })), _jsxs("span", { className: measure, children: [_jsx("span", { className: muted, children: item.label }), _jsx("span", { children: item.value })] })] }, index))) }))] }), (hasResult || actions !== undefined) && (_jsxs("div", { className: result, children: [hasResult && (_jsxs("div", { className: score, children: [figure !== undefined && _jsx("span", { className: figureText, children: figure }), caption !== undefined && _jsx("span", { className: cx(small, muted), children: caption })] })), hasResult && actions !== undefined && _jsx("span", { className: divider, "aria-hidden": "true" }), actions] }))] }));
|
|
70
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useRender } from "@base-ui/react/use-render";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The card's surface as a style object, to merge into a `css()` call that adds layout. The edge
|
|
5
|
+
* comes through `--card-edge` so a `compact` panel, whose own hairline runs 4px outside it, can
|
|
6
|
+
* turn it off for the cards it insets.
|
|
7
|
+
*/
|
|
4
8
|
export declare const cardSurface: import("../styled-system/types/index.js").SystemStyleObject;
|
|
5
9
|
export type CardProps = useRender.ComponentProps<"div">;
|
|
6
10
|
export declare function Card({ render, className, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -13,6 +17,8 @@ export type PanelProps = useRender.ComponentProps<"section"> & {
|
|
|
13
17
|
export declare function Panel({ padding, tone, render, className, ...props }: PanelProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
14
18
|
export type PanelHeaderProps = Omit<useRender.ComponentProps<"div">, "title"> & {
|
|
15
19
|
title: ReactNode;
|
|
20
|
+
/** A muted line under the title saying what the panel holds or does. */
|
|
21
|
+
description?: ReactNode;
|
|
16
22
|
/** Muted at the row's far edge, before the actions, such as a count or the period it covers. */
|
|
17
23
|
meta?: ReactNode;
|
|
18
24
|
/** At the row's end, such as a link to the full list. */
|
|
@@ -20,5 +26,5 @@ export type PanelHeaderProps = Omit<useRender.ComponentProps<"div">, "title"> &
|
|
|
20
26
|
/** The title's heading level; a plain line when left out. */
|
|
21
27
|
level?: 2 | 3 | 4;
|
|
22
28
|
};
|
|
23
|
-
/** A panel's top row: its title and
|
|
24
|
-
export declare function PanelHeader({ title, meta, actions, level, render, className, ...props }: PanelHeaderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
29
|
+
/** A panel's top row: its title and any description under it, and its meta and actions at the far edge. */
|
|
30
|
+
export declare function PanelHeader({ title, description, meta, actions, level, render, className, ...props }: PanelHeaderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
package/dist/components/panel.js
CHANGED
|
@@ -10,10 +10,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
import { useRender } from "@base-ui/react/use-render";
|
|
11
11
|
import { css, cva, cx } from "#primitives/css";
|
|
12
12
|
import { singleLineText } from "./single-line-text.js";
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The card's surface as a style object, to merge into a `css()` call that adds layout. The edge
|
|
15
|
+
* comes through `--card-edge` so a `compact` panel, whose own hairline runs 4px outside it, can
|
|
16
|
+
* turn it off for the cards it insets.
|
|
17
|
+
*/
|
|
14
18
|
export const cardSurface = css.raw({
|
|
15
19
|
minWidth: "0",
|
|
16
|
-
border: "1px solid token(colors.border.card)",
|
|
20
|
+
border: "1px solid var(--card-edge, token(colors.border.card))",
|
|
17
21
|
borderRadius: "action",
|
|
18
22
|
background: "[token(gradients.card)]",
|
|
19
23
|
});
|
|
@@ -30,11 +34,16 @@ const panel = cva({
|
|
|
30
34
|
variants: {
|
|
31
35
|
padding: {
|
|
32
36
|
none: { overflow: "hidden" },
|
|
33
|
-
|
|
37
|
+
/*
|
|
38
|
+
* A `PanelHeader` on top is the panel's top inset; without one, the hairline runs round.
|
|
39
|
+
* The panel's edge is the only one round the cards it insets: a card's own hairline 4px
|
|
40
|
+
* inside it drew a second rule of the same weight, which read as a double border.
|
|
41
|
+
*/
|
|
34
42
|
compact: {
|
|
35
43
|
paddingInline: "panel.hairline",
|
|
36
44
|
paddingBottom: "panel.hairline",
|
|
37
45
|
"&:not(:has(> [data-panel-header]:first-child))": { paddingTop: "panel.hairline" },
|
|
46
|
+
"--card-edge": "transparent",
|
|
38
47
|
},
|
|
39
48
|
default: { gap: "layout.contentGap", padding: "panel.default" },
|
|
40
49
|
},
|
|
@@ -66,6 +75,12 @@ const panelHeader = css({
|
|
|
66
75
|
paddingInline: "none",
|
|
67
76
|
paddingBottom: "panel.comfortable",
|
|
68
77
|
marginBottom: "[calc(token(spacing.layout.contentGap) * -1)]",
|
|
78
|
+
"&[data-described]": { paddingTop: "none" },
|
|
79
|
+
},
|
|
80
|
+
"&[data-described]": {
|
|
81
|
+
height: "auto",
|
|
82
|
+
paddingTop: "panel.comfortable",
|
|
83
|
+
paddingBottom: "panelHeader.describedBottom",
|
|
69
84
|
},
|
|
70
85
|
});
|
|
71
86
|
const panelHeaderTitle = css(singleLineText, {
|
|
@@ -76,6 +91,20 @@ const panelHeaderTitle = css(singleLineText, {
|
|
|
76
91
|
font: "inherit",
|
|
77
92
|
});
|
|
78
93
|
const panelHeaderMeta = css({ color: "fg.subtle", fontSize: "code" });
|
|
94
|
+
// A title over its one-line description, 4 apart, as the Figma's settings panels draw them; the
|
|
95
|
+
// header then takes the description's height (16 above, 14 below, as the Figma pads it).
|
|
96
|
+
const panelHeaderCopy = css({
|
|
97
|
+
display: "flex",
|
|
98
|
+
flexDirection: "column",
|
|
99
|
+
gap: "layout.tightGap",
|
|
100
|
+
minWidth: "0",
|
|
101
|
+
});
|
|
102
|
+
const panelHeaderDescription = css(singleLineText, {
|
|
103
|
+
color: "fg.label",
|
|
104
|
+
fontSize: "code",
|
|
105
|
+
fontWeight: "medium",
|
|
106
|
+
letterSpacing: "compact",
|
|
107
|
+
});
|
|
79
108
|
const panelHeaderActions = css({ display: "flex", alignItems: "center", gap: "layout.tightGap" });
|
|
80
109
|
export function Card({ render, className, ...props }) {
|
|
81
110
|
return useRender({
|
|
@@ -96,9 +125,10 @@ export function Panel({ padding = "default", tone, render, className, ...props }
|
|
|
96
125
|
},
|
|
97
126
|
});
|
|
98
127
|
}
|
|
99
|
-
/** A panel's top row: its title and
|
|
100
|
-
export function PanelHeader({ title, meta, actions, level, render, className, ...props }) {
|
|
128
|
+
/** A panel's top row: its title and any description under it, and its meta and actions at the far edge. */
|
|
129
|
+
export function PanelHeader({ title, description, meta, actions, level, render, className, ...props }) {
|
|
101
130
|
const Title = level ? `h${level}` : "span";
|
|
131
|
+
const hasDescription = description !== undefined && description !== null;
|
|
102
132
|
return useRender({
|
|
103
133
|
defaultTagName: "div",
|
|
104
134
|
render,
|
|
@@ -107,7 +137,9 @@ export function PanelHeader({ title, meta, actions, level, render, className, ..
|
|
|
107
137
|
className: cx(panelHeader, className),
|
|
108
138
|
"data-ciridae-ui": "",
|
|
109
139
|
"data-panel-header": "",
|
|
110
|
-
|
|
140
|
+
"data-described": hasDescription || undefined,
|
|
141
|
+
children: (_jsxs(_Fragment, { children: [hasDescription ? (_jsxs("span", { className: panelHeaderCopy, children: [title !== undefined && title !== null && (_jsx(Title, { className: panelHeaderTitle, children: title })), _jsx("span", { className: panelHeaderDescription, children: description })] })) : (title !== undefined &&
|
|
142
|
+
title !== null && _jsx(Title, { className: panelHeaderTitle, children: title })), (meta !== undefined || actions !== undefined) && (_jsxs("span", { className: panelHeaderActions, children: [meta !== undefined && _jsx("span", { className: panelHeaderMeta, children: meta }), actions] }))] })),
|
|
111
143
|
},
|
|
112
144
|
});
|
|
113
145
|
}
|
|
@@ -23,9 +23,14 @@ export type SettingsLayoutProps<Value extends string> = Omit<ComponentProps<"div
|
|
|
23
23
|
export declare function SettingsLayout<Value extends string>({ sections, value, onValueChange, children, labels: ownLabels, className, ...props }: SettingsLayoutProps<Value>): import("react").JSX.Element;
|
|
24
24
|
/** A settings section's single column of panels; the shell header carries the page's title. */
|
|
25
25
|
export declare function SettingsColumn({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* One group of settings, under an optional heading, a muted description under it and an optional
|
|
28
|
+
* action beside it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function SettingsPanel({ title, description, action, children, ...props }: Omit<PanelProps, "title" | "padding" | "tone"> & {
|
|
28
31
|
title?: ReactNode;
|
|
32
|
+
/** A muted line under the title, such as what turning a setting off does. */
|
|
33
|
+
description?: ReactNode;
|
|
29
34
|
action?: ReactNode;
|
|
30
35
|
}): import("react").JSX.Element;
|
|
31
36
|
/** A label and its value or control on one line inside a settings panel. */
|
|
@@ -27,12 +27,17 @@ const column = css({
|
|
|
27
27
|
gap: "layout.clusterGap",
|
|
28
28
|
maxWidth: "settings.column",
|
|
29
29
|
});
|
|
30
|
+
// A hairline between rows, as the Figma's settings panels divide them.
|
|
30
31
|
const row = css({
|
|
31
32
|
display: "flex",
|
|
32
33
|
alignItems: "center",
|
|
33
34
|
justifyContent: "space-between",
|
|
34
35
|
gap: "layout.contentGap",
|
|
35
36
|
paddingBlock: "control.compactBlock",
|
|
37
|
+
"& + &": {
|
|
38
|
+
borderTop: "1px solid token(colors.border.divider)",
|
|
39
|
+
paddingTop: "layout.contentGap",
|
|
40
|
+
},
|
|
36
41
|
});
|
|
37
42
|
export function SettingsLayout({ sections, value, onValueChange, children, labels: ownLabels, className, ...props }) {
|
|
38
43
|
const labels = { ...useCiridaeLocale().labels.settings, ...ownLabels };
|
|
@@ -46,9 +51,12 @@ export function SettingsLayout({ sections, value, onValueChange, children, label
|
|
|
46
51
|
export function SettingsColumn({ className, ...props }) {
|
|
47
52
|
return _jsx("div", { ...props, className: cx(column, className), "data-ciridae-ui": "" });
|
|
48
53
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
/**
|
|
55
|
+
* One group of settings, under an optional heading, a muted description under it and an optional
|
|
56
|
+
* action beside it.
|
|
57
|
+
*/
|
|
58
|
+
export function SettingsPanel({ title, description, action, children, ...props }) {
|
|
59
|
+
return (_jsxs(Panel, { ...props, tone: "outline", children: [(title || action) && (_jsx(PanelHeader, { title: title, description: description, actions: action, level: title ? 2 : undefined })), children] }));
|
|
52
60
|
}
|
|
53
61
|
/** A label and its value or control on one line inside a settings panel. */
|
|
54
62
|
export function SettingsRow({ label, children, className, ...props }) {
|