@ciridae/ui 1.0.14 → 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/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/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 +165 -48
- 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
|
@@ -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
|
+
}
|
|
@@ -17,6 +17,8 @@ export type PanelProps = useRender.ComponentProps<"section"> & {
|
|
|
17
17
|
export declare function Panel({ padding, tone, render, className, ...props }: PanelProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
18
18
|
export type PanelHeaderProps = Omit<useRender.ComponentProps<"div">, "title"> & {
|
|
19
19
|
title: ReactNode;
|
|
20
|
+
/** A muted line under the title saying what the panel holds or does. */
|
|
21
|
+
description?: ReactNode;
|
|
20
22
|
/** Muted at the row's far edge, before the actions, such as a count or the period it covers. */
|
|
21
23
|
meta?: ReactNode;
|
|
22
24
|
/** At the row's end, such as a link to the full list. */
|
|
@@ -24,5 +26,5 @@ export type PanelHeaderProps = Omit<useRender.ComponentProps<"div">, "title"> &
|
|
|
24
26
|
/** The title's heading level; a plain line when left out. */
|
|
25
27
|
level?: 2 | 3 | 4;
|
|
26
28
|
};
|
|
27
|
-
/** A panel's top row: its title and
|
|
28
|
-
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
|
@@ -75,6 +75,12 @@ const panelHeader = css({
|
|
|
75
75
|
paddingInline: "none",
|
|
76
76
|
paddingBottom: "panel.comfortable",
|
|
77
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",
|
|
78
84
|
},
|
|
79
85
|
});
|
|
80
86
|
const panelHeaderTitle = css(singleLineText, {
|
|
@@ -85,6 +91,20 @@ const panelHeaderTitle = css(singleLineText, {
|
|
|
85
91
|
font: "inherit",
|
|
86
92
|
});
|
|
87
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
|
+
});
|
|
88
108
|
const panelHeaderActions = css({ display: "flex", alignItems: "center", gap: "layout.tightGap" });
|
|
89
109
|
export function Card({ render, className, ...props }) {
|
|
90
110
|
return useRender({
|
|
@@ -105,9 +125,10 @@ export function Panel({ padding = "default", tone, render, className, ...props }
|
|
|
105
125
|
},
|
|
106
126
|
});
|
|
107
127
|
}
|
|
108
|
-
/** A panel's top row: its title and
|
|
109
|
-
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 }) {
|
|
110
130
|
const Title = level ? `h${level}` : "span";
|
|
131
|
+
const hasDescription = description !== undefined && description !== null;
|
|
111
132
|
return useRender({
|
|
112
133
|
defaultTagName: "div",
|
|
113
134
|
render,
|
|
@@ -116,7 +137,9 @@ export function PanelHeader({ title, meta, actions, level, render, className, ..
|
|
|
116
137
|
className: cx(panelHeader, className),
|
|
117
138
|
"data-ciridae-ui": "",
|
|
118
139
|
"data-panel-header": "",
|
|
119
|
-
|
|
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] }))] })),
|
|
120
143
|
},
|
|
121
144
|
});
|
|
122
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 }) {
|
package/dist/components/shell.js
CHANGED
|
@@ -136,10 +136,16 @@ const headerTitle = css({
|
|
|
136
136
|
fontWeight: "medium",
|
|
137
137
|
lineHeight: "tight",
|
|
138
138
|
});
|
|
139
|
+
// A page's blocks (heading, toolbar, list) stack 16 apart, as every page frame in the Figma draws
|
|
140
|
+
// them. Each keeps its own height (`ciridae.css`), so the page scrolls as a whole; a block that sets
|
|
141
|
+
// its own `flex`, such as a `fill` list, wins over that base-layer default and takes what is left.
|
|
139
142
|
const content = css({
|
|
140
143
|
flex: "1",
|
|
141
144
|
minHeight: "0",
|
|
142
145
|
overflow: "auto",
|
|
146
|
+
display: "flex",
|
|
147
|
+
flexDirection: "column",
|
|
148
|
+
gap: "layout.clusterGap",
|
|
143
149
|
// Exposed so sticky descendants (table headers) can pin to the scroller's edge, not its padding.
|
|
144
150
|
"--app-content-inset": "token(spacing.page.inline)",
|
|
145
151
|
padding: "var(--app-content-inset)",
|
|
@@ -237,7 +243,7 @@ export function AppHeader({ className, children, actions, ...props }) {
|
|
|
237
243
|
return (_jsxs("header", { ...props, className: cx(header, className), "data-ciridae-ui": "", children: [_jsx(AppMenuButton, {}), _jsx("div", { className: headerTitle, "data-header-title": "", children: children }), actions] }));
|
|
238
244
|
}
|
|
239
245
|
export function AppContent({ className, ...props }) {
|
|
240
|
-
return _jsx("div", { ...props, className: cx(content, className), "data-ciridae-ui": "" });
|
|
246
|
+
return (_jsx("div", { ...props, className: cx(content, className), "data-ciridae-ui": "", "data-app-content": "" }));
|
|
241
247
|
}
|
|
242
248
|
// Sidebar pieces. The sidebar shows either its expanded content or, as a rail, its compact twins;
|
|
243
249
|
// `AppSidebar` does the switching through these data attributes.
|
|
@@ -4,7 +4,7 @@ export type SidePanelProps = Omit<ComponentProps<"aside">, "title"> & {
|
|
|
4
4
|
/** A muted line above the title, such as where the item sits in its list; the title then drops under the header row. */
|
|
5
5
|
eyebrow?: ReactNode;
|
|
6
6
|
subtitle?: ReactNode;
|
|
7
|
-
/** Beside the title, such as a status badge. */
|
|
7
|
+
/** Beside the title, such as a status badge; the title then drops under the header row. */
|
|
8
8
|
titleAccessory?: ReactNode;
|
|
9
9
|
/** Header controls before the close button, such as a menu. */
|
|
10
10
|
actions?: ReactNode;
|
|
@@ -28,8 +28,18 @@ export type SidePanelProps = Omit<ComponentProps<"aside">, "title"> & {
|
|
|
28
28
|
* the list in a `SidePanelLayout`.
|
|
29
29
|
*/
|
|
30
30
|
export declare function SidePanel({ title, eyebrow, subtitle, titleAccessory, actions, headerContent, footer, onClose, stepper, onPrevious, onNext, flushBody, bodyClassName, className, children, ...props }: SidePanelProps): import("react").JSX.Element;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
export type SidePanelLayoutProps = ComponentProps<"div"> & {
|
|
32
|
+
/**
|
|
33
|
+
* Hold the list and the panel to the height left in the page, the list scrolling inside: for a
|
|
34
|
+
* layout placed straight in a `PageFrame`, with a `DataGrid fill` as its list.
|
|
35
|
+
*/
|
|
36
|
+
fill?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A list and its `SidePanel` side by side; the list takes the room the panel leaves and ends after
|
|
40
|
+
* its last row, and the panel stays in view while the page scrolls.
|
|
41
|
+
*/
|
|
42
|
+
export declare function SidePanelLayout({ fill, className, ...props }: SidePanelLayoutProps): import("react").JSX.Element;
|
|
33
43
|
/** A labelled block of a side panel's body. */
|
|
34
44
|
export declare function SidePanelSection({ label, className, children, ...props }: Omit<ComponentProps<"section">, "title"> & {
|
|
35
45
|
label: ReactNode;
|
|
@@ -61,15 +61,18 @@ const titleBlock = css({
|
|
|
61
61
|
paddingBlockStart: "panel.default",
|
|
62
62
|
paddingInline: "panel.comfortable",
|
|
63
63
|
});
|
|
64
|
+
// The Figma's preview panel sets its title at the list row's size (14, medium) with the status
|
|
65
|
+
// beside it, so a long log headline stays on a line or two rather than a page heading's three.
|
|
64
66
|
const titleLine = css({
|
|
65
67
|
display: "flex",
|
|
66
68
|
alignItems: "center",
|
|
67
69
|
flexWrap: "wrap",
|
|
68
70
|
gap: "layout.controlGap",
|
|
69
71
|
margin: "none",
|
|
70
|
-
fontSize: "
|
|
72
|
+
fontSize: "body",
|
|
71
73
|
fontWeight: "medium",
|
|
72
|
-
|
|
74
|
+
letterSpacing: "compact",
|
|
75
|
+
lineHeight: "compact",
|
|
73
76
|
});
|
|
74
77
|
const subtitleLine = css({
|
|
75
78
|
margin: "none",
|
|
@@ -106,12 +109,24 @@ const sheetBody = css({
|
|
|
106
109
|
alignContent: "start",
|
|
107
110
|
gap: "layout.clusterGap",
|
|
108
111
|
});
|
|
112
|
+
// The list ends after its last row, as the Figma draws a short one, and the panel keeps its own
|
|
113
|
+
// height and stays in view while the page scrolls the list. `fill` instead holds both to the
|
|
114
|
+
// page's remaining height, as the Figma's list-and-panel frames draw them: the list scrolls inside
|
|
115
|
+
// (a `DataGrid fill` pins its head) and the panel stays put.
|
|
109
116
|
const layout = css({
|
|
110
117
|
display: "flex",
|
|
111
|
-
alignItems: "
|
|
118
|
+
alignItems: "flex-start",
|
|
112
119
|
gap: "layout.contentGap",
|
|
113
120
|
minWidth: "0",
|
|
114
121
|
"& > :first-child": { flex: "1", minWidth: "0" },
|
|
122
|
+
"& > aside": { position: "sticky", top: "none" },
|
|
123
|
+
"&[data-fill]": {
|
|
124
|
+
flex: "1",
|
|
125
|
+
minHeight: "0",
|
|
126
|
+
alignItems: "stretch",
|
|
127
|
+
"& > :first-child": { minHeight: "0", overflowY: "auto" },
|
|
128
|
+
"& > aside": { position: "static" },
|
|
129
|
+
},
|
|
115
130
|
});
|
|
116
131
|
const section = css({ display: "grid", gap: "layout.controlGap", minWidth: "0" });
|
|
117
132
|
const sectionLabel = css({
|
|
@@ -172,11 +187,17 @@ export function SidePanel({ title, eyebrow, subtitle, titleAccessory, actions, h
|
|
|
172
187
|
}, title: title, subtitle: subtitle, eyebrow: eyebrow, titleAccessory: titleAccessory, actions: _jsxs(_Fragment, { children: [stepButtons, actions] }), children: [_jsxs(DrawerBody, { flush: flushBody, className: cx(!flushBody && sheetBody, bodyClassName), children: [_jsx(SidePanelHotkeys, { ...stepHandlers }), headerContent, children] }), footer && _jsx(DrawerFooter, { children: footer })] }));
|
|
173
188
|
}
|
|
174
189
|
const titleContent = (_jsxs(_Fragment, { children: [title, titleAccessory] }));
|
|
175
|
-
|
|
190
|
+
// A title with an accessory, such as a status badge, drops under the header row as one with an
|
|
191
|
+
// eyebrow does, so the stepper and close never squeeze the badge.
|
|
192
|
+
const titleUnderHeader = Boolean(eyebrow || titleAccessory);
|
|
193
|
+
return (_jsxs(HotkeysProvider, { scope: scope, children: [_jsx(SidePanelHotkeys, { ...stepHandlers, onClose: onClose }), _jsxs("aside", { ...props, className: cx(aside, className), "data-ciridae-ui": "", children: [_jsxs("div", { className: headerRow, children: [_jsx("span", { className: headerLead, "data-eyebrow": eyebrow ? "" : undefined, children: titleUnderHeader ? eyebrow : titleContent }), _jsxs("span", { className: headerActions, children: [stepButtons, actions, _jsx(IconButton, { "aria-label": labels.common.close, size: "small", onClick: onClose, children: _jsx(XIcon, { className: icon({ size: "small" }) }) })] })] }), (titleUnderHeader || subtitle || headerContent) && (_jsxs("div", { className: titleBlock, children: [titleUnderHeader && _jsx("h2", { className: titleLine, children: titleContent }), subtitle && _jsx("p", { className: subtitleLine, children: subtitle }), headerContent] })), _jsx("div", { className: cx(body, bodyClassName), "data-flush": flushBody || undefined, children: children }), footer && _jsx("div", { className: footerRow, children: footer })] })] }));
|
|
176
194
|
}
|
|
177
|
-
/**
|
|
178
|
-
|
|
179
|
-
|
|
195
|
+
/**
|
|
196
|
+
* A list and its `SidePanel` side by side; the list takes the room the panel leaves and ends after
|
|
197
|
+
* its last row, and the panel stays in view while the page scrolls.
|
|
198
|
+
*/
|
|
199
|
+
export function SidePanelLayout({ fill = false, className, ...props }) {
|
|
200
|
+
return (_jsx("div", { ...props, className: cx(layout, className), "data-ciridae-ui": "", "data-fill": fill || undefined }));
|
|
180
201
|
}
|
|
181
202
|
/** A labelled block of a side panel's body. */
|
|
182
203
|
export function SidePanelSection({ label, className, children, ...props }) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
3
|
-
export type SwitchProps = Omit<ComponentProps<typeof BaseSwitch.Root>, "className"> & {
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
|
+
export type SwitchProps = Omit<ComponentProps<typeof BaseSwitch.Root>, "className" | "children"> & {
|
|
4
|
+
/** The visible label after the track, which names the switch and toggles it when pressed. */
|
|
5
|
+
children?: ReactNode;
|
|
4
6
|
className?: string;
|
|
7
|
+
/** The label's class, with `children`. */
|
|
8
|
+
wrapperClassName?: string;
|
|
5
9
|
};
|
|
6
|
-
export declare function Switch({ className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
10
|
+
export declare function Switch({ children, className, wrapperClassName, ...props }: SwitchProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
3
3
|
import { css, cx } from "#primitives/css";
|
|
4
4
|
// The Round 2 toggle: a short track two insets wider than its knob, grey off and green on.
|
|
@@ -34,6 +34,20 @@ const thumb = css({
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// A switch's visible label after its track, as a checkbox's sits after its box.
|
|
38
|
+
const label = css({
|
|
39
|
+
display: "inline-flex",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
gap: "layout.controlGap",
|
|
42
|
+
color: "fg.primary",
|
|
43
|
+
fontSize: "caption",
|
|
44
|
+
fontWeight: "[normal]",
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
"&:has([data-disabled])": { cursor: "not-allowed" },
|
|
47
|
+
});
|
|
48
|
+
export function Switch({ children, className, wrapperClassName, ...props }) {
|
|
49
|
+
const control = (_jsx(BaseSwitch.Root, { ...props, className: cx(track, className), "data-ciridae-ui": "", children: _jsx(BaseSwitch.Thumb, { className: thumb }) }));
|
|
50
|
+
if (children === undefined || children === null || children === false)
|
|
51
|
+
return control;
|
|
52
|
+
return (_jsxs("label", { className: cx(label, wrapperClassName), "data-ciridae-ui": "", children: [control, children] }));
|
|
39
53
|
}
|
package/dist/components/tabs.js
CHANGED
|
@@ -228,6 +228,8 @@ const bar = css({
|
|
|
228
228
|
flexWrap: "nowrap",
|
|
229
229
|
gap: "layout.contentGap",
|
|
230
230
|
minWidth: "0",
|
|
231
|
+
// The row keeps the 38 of the controls the open section puts on it, with or without them.
|
|
232
|
+
minHeight: "control.default",
|
|
231
233
|
"& > :first-child": { flex: "[1 1 auto]", minWidth: "0", maxWidth: "full" },
|
|
232
234
|
_phone: { flexWrap: "wrap" },
|
|
233
235
|
});
|
|
@@ -235,7 +237,8 @@ const barActions = css({
|
|
|
235
237
|
display: "flex",
|
|
236
238
|
alignItems: "center",
|
|
237
239
|
justifyContent: "flex-end",
|
|
238
|
-
flexWrap: "
|
|
240
|
+
flexWrap: "nowrap",
|
|
241
|
+
_phone: { flexWrap: "wrap" },
|
|
239
242
|
gap: "layout.controlGap",
|
|
240
243
|
marginInlineStart: "auto",
|
|
241
244
|
flexShrink: "0",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export type ValueChangeProps = Omit<ComponentProps<"div">, "children"> & {
|
|
3
|
+
/** The field that changed, such as "Bank account". */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** Its value before the change, struck through. */
|
|
6
|
+
before: ReactNode;
|
|
7
|
+
/** Its value after the change. */
|
|
8
|
+
after: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/** One field's change: its label, the old value struck through, an arrow, then the new value. */
|
|
11
|
+
export declare function ValueChange({ label: fieldLabel, before, after, className, ...props }: ValueChangeProps): import("react").JSX.Element;
|
|
12
|
+
/** The rows of what changed, in a field well with hairlines between them; children are `ValueChange`s. */
|
|
13
|
+
export declare function ValueChangeList({ className, ...props }: ComponentProps<"dl">): import("react").JSX.Element;
|