@syscore/ui-library 2.0.0-beta-publish-workflow-beta.10 → 2.0.0-beta-publish-workflow-beta.12
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/client/components/ui/avatar-identity.tsx +16 -3
- package/client/components/ui/avatar.tsx +32 -4
- package/client/components/ui/back-link.tsx +35 -0
- package/client/components/ui/button.tsx +3 -0
- package/client/components/ui/card.tsx +20 -3
- package/client/components/ui/centered-page.tsx +27 -0
- package/client/components/ui/checkbox-field.tsx +57 -0
- package/client/components/ui/data-grid.tsx +258 -0
- package/client/components/ui/dialog.tsx +6 -0
- package/client/components/ui/icon-button.tsx +45 -0
- package/client/components/ui/layout.tsx +32 -5
- package/client/components/ui/modal-panel.tsx +35 -4
- package/client/components/ui/outline-node.tsx +112 -0
- package/client/components/ui/radio-card.tsx +54 -0
- package/client/components/ui/resource-thumbnail.tsx +12 -1
- package/client/components/ui/side-nav.tsx +280 -0
- package/client/components/ui/status-pill.tsx +37 -4
- package/client/components/ui/table.tsx +26 -4
- package/client/components/ui/typography.tsx +33 -2
- package/client/global.css +980 -4
- package/client/ui/Avatar.stories.tsx +78 -0
- package/client/ui/BackLink.stories.tsx +50 -0
- package/client/ui/Button.stories.tsx +26 -0
- package/client/ui/Card.stories.tsx +30 -0
- package/client/ui/CenteredPage.stories.tsx +43 -0
- package/client/ui/CheckboxField.stories.tsx +68 -0
- package/client/ui/DataGrid.stories.tsx +114 -0
- package/client/ui/Dialog.stories.tsx +31 -0
- package/client/ui/IconButton.stories.tsx +77 -0
- package/client/ui/OutlineNode.stories.tsx +106 -0
- package/client/ui/RadioCard.stories.tsx +75 -0
- package/client/ui/SideNav.stories.tsx +105 -0
- package/client/ui/StatusPill.stories.tsx +78 -0
- package/client/ui/Table/Table.stories.tsx +32 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +105 -0
- package/dist/index.es.js +653 -40
- package/package.json +3 -1
|
@@ -19,10 +19,28 @@ import { cn } from "@/lib/utils";
|
|
|
19
19
|
|
|
20
20
|
/* The four invoice states in `Invoice::STATUS_*`, no more — an unknown status
|
|
21
21
|
falls back to `neutral` rather than inventing a colour for it. */
|
|
22
|
-
type StatusPillTone =
|
|
22
|
+
type StatusPillTone =
|
|
23
|
+
| "unpaid"
|
|
24
|
+
| "paid"
|
|
25
|
+
| "waived"
|
|
26
|
+
| "void"
|
|
27
|
+
| "neutral"
|
|
28
|
+
// Generic tones, for roles, record states and flags that are not invoice states.
|
|
29
|
+
| "info"
|
|
30
|
+
| "success"
|
|
31
|
+
| "warning"
|
|
32
|
+
| "danger"
|
|
33
|
+
| "accent"
|
|
34
|
+
| "inactive"
|
|
35
|
+
// A quiet gray chip for the ordinary case (a customer, an unset flag).
|
|
36
|
+
| "plain";
|
|
37
|
+
|
|
38
|
+
/** `chip` — sentence case in a slightly tighter pill (roles, record states), instead of the uppercase default. */
|
|
39
|
+
type StatusPillAppearance = "default" | "chip";
|
|
23
40
|
|
|
24
41
|
interface StatusPillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
25
42
|
tone?: StatusPillTone;
|
|
43
|
+
appearance?: StatusPillAppearance;
|
|
26
44
|
children: React.ReactNode;
|
|
27
45
|
}
|
|
28
46
|
|
|
@@ -32,6 +50,13 @@ const TONES: readonly StatusPillTone[] = [
|
|
|
32
50
|
"waived",
|
|
33
51
|
"void",
|
|
34
52
|
"neutral",
|
|
53
|
+
"info",
|
|
54
|
+
"success",
|
|
55
|
+
"warning",
|
|
56
|
+
"danger",
|
|
57
|
+
"accent",
|
|
58
|
+
"inactive",
|
|
59
|
+
"plain",
|
|
35
60
|
];
|
|
36
61
|
|
|
37
62
|
/** Maps an API status string onto a tone, defaulting to `neutral`. */
|
|
@@ -42,10 +67,18 @@ function toneForStatus(status?: string | null): StatusPillTone {
|
|
|
42
67
|
}
|
|
43
68
|
|
|
44
69
|
const StatusPill = React.forwardRef<HTMLSpanElement, StatusPillProps>(
|
|
45
|
-
(
|
|
70
|
+
(
|
|
71
|
+
{ tone = "neutral", appearance = "default", children, className, ...props },
|
|
72
|
+
ref,
|
|
73
|
+
) => (
|
|
46
74
|
<span
|
|
47
75
|
ref={ref}
|
|
48
|
-
className={cn(
|
|
76
|
+
className={cn(
|
|
77
|
+
"status-pill",
|
|
78
|
+
`status-pill--${tone}`,
|
|
79
|
+
appearance === "chip" && "status-pill--chip",
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
49
82
|
{...props}
|
|
50
83
|
>
|
|
51
84
|
{children}
|
|
@@ -55,4 +88,4 @@ const StatusPill = React.forwardRef<HTMLSpanElement, StatusPillProps>(
|
|
|
55
88
|
StatusPill.displayName = "StatusPill";
|
|
56
89
|
|
|
57
90
|
export { StatusPill, toneForStatus };
|
|
58
|
-
export type { StatusPillProps, StatusPillTone };
|
|
91
|
+
export type { StatusPillProps, StatusPillTone, StatusPillAppearance };
|
|
@@ -28,6 +28,8 @@ import { cn } from "@/lib/utils";
|
|
|
28
28
|
*/
|
|
29
29
|
type TableDensity = "compact" | "balanced" | "spacious";
|
|
30
30
|
type TableAlign = "left" | "center" | "right";
|
|
31
|
+
/** `card` wraps the table in a bordered, rounded card with a tinted header and row hover. */
|
|
32
|
+
type TableAppearance = "plain" | "card";
|
|
31
33
|
|
|
32
34
|
// ---------------------------------------------------------------------------
|
|
33
35
|
// Root
|
|
@@ -36,13 +38,30 @@ type TableAlign = "left" | "center" | "right";
|
|
|
36
38
|
interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
37
39
|
/** Figma `Density`. Sets the cell's vertical padding; heights follow. Default `compact`. */
|
|
38
40
|
density?: TableDensity;
|
|
41
|
+
/** Visual frame. Default `plain`; `card` is the admin / back-office look. */
|
|
42
|
+
appearance?: TableAppearance;
|
|
39
43
|
/** Wrapper class, for width or overflow handling. */
|
|
40
44
|
containerClassName?: string;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
const Table = React.forwardRef<HTMLTableElement, TableProps>(
|
|
44
|
-
(
|
|
45
|
-
|
|
48
|
+
(
|
|
49
|
+
{
|
|
50
|
+
className,
|
|
51
|
+
containerClassName,
|
|
52
|
+
density = "compact",
|
|
53
|
+
appearance = "plain",
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
56
|
+
ref,
|
|
57
|
+
) => (
|
|
58
|
+
<div
|
|
59
|
+
className={cn(
|
|
60
|
+
"table-wrapper",
|
|
61
|
+
appearance === "card" && "table-wrapper--card",
|
|
62
|
+
containerClassName,
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
46
65
|
<table
|
|
47
66
|
ref={ref}
|
|
48
67
|
data-density={density}
|
|
@@ -172,17 +191,19 @@ interface TableBodyCellProps
|
|
|
172
191
|
tag?: React.ReactNode;
|
|
173
192
|
/** Figma `Content type=… + Action`: pass one or more `TableAction`. */
|
|
174
193
|
action?: React.ReactNode;
|
|
194
|
+
/** Bold the cell's content (a total row, a key figure). */
|
|
195
|
+
strong?: boolean;
|
|
175
196
|
}
|
|
176
197
|
|
|
177
198
|
const TableCell = React.forwardRef<HTMLTableCellElement, TableBodyCellProps>(
|
|
178
199
|
(
|
|
179
|
-
{ className, align = "left", text, tag, action, children, ...props },
|
|
200
|
+
{ className, align = "left", strong = false, text, tag, action, children, ...props },
|
|
180
201
|
ref,
|
|
181
202
|
) => (
|
|
182
203
|
<td
|
|
183
204
|
ref={ref}
|
|
184
205
|
data-align={align}
|
|
185
|
-
className={cn("table-cell", className)}
|
|
206
|
+
className={cn("table-cell", strong && "table-cell--strong", className)}
|
|
186
207
|
{...props}
|
|
187
208
|
>
|
|
188
209
|
<span className="table-cell-inner">
|
|
@@ -251,5 +272,6 @@ export type {
|
|
|
251
272
|
TableCellProps,
|
|
252
273
|
TableBodyCellProps,
|
|
253
274
|
TableDensity,
|
|
275
|
+
TableAppearance,
|
|
254
276
|
TableAlign,
|
|
255
277
|
};
|
|
@@ -49,16 +49,47 @@ const defaultElementMap: Record<Variant, React.ElementType> = {
|
|
|
49
49
|
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
50
50
|
variant?: Variant;
|
|
51
51
|
as?: React.ElementType;
|
|
52
|
+
/** `muted` — quieter helper text (hints, secondary lines). Default inherits the surrounding colour. */
|
|
53
|
+
tone?: "default" | "muted";
|
|
54
|
+
/** `strong` — semibold, for a label inside running text. */
|
|
55
|
+
strong?: boolean;
|
|
56
|
+
/** `center` — centre the text (wrapped lines too). Default follows the surrounding alignment. */
|
|
57
|
+
align?: "start" | "center";
|
|
58
|
+
/** `relaxed` — a 1.5 line height for short paragraphs that should breathe. */
|
|
59
|
+
leading?: "default" | "relaxed";
|
|
60
|
+
/** `sans` — set a heading in the body typeface (Mazzard) instead of the display serif. */
|
|
61
|
+
family?: "default" | "sans";
|
|
52
62
|
}
|
|
53
63
|
|
|
54
64
|
const Text = React.forwardRef<HTMLElement, TextProps>(
|
|
55
|
-
(
|
|
65
|
+
(
|
|
66
|
+
{
|
|
67
|
+
className,
|
|
68
|
+
variant = "body-base",
|
|
69
|
+
as,
|
|
70
|
+
tone = "default",
|
|
71
|
+
strong = false,
|
|
72
|
+
align,
|
|
73
|
+
leading = "default",
|
|
74
|
+
family = "default",
|
|
75
|
+
...props
|
|
76
|
+
},
|
|
77
|
+
ref,
|
|
78
|
+
) => {
|
|
56
79
|
const Component = as || defaultElementMap[variant];
|
|
57
80
|
|
|
58
81
|
return (
|
|
59
82
|
<Component
|
|
60
83
|
ref={ref}
|
|
61
|
-
className={cn(
|
|
84
|
+
className={cn(
|
|
85
|
+
typographyVariants({ variant }),
|
|
86
|
+
tone === "muted" && "typo--muted",
|
|
87
|
+
strong && "typo--strong",
|
|
88
|
+
align === "center" && "typo--center",
|
|
89
|
+
leading === "relaxed" && "typo--relaxed",
|
|
90
|
+
family === "sans" && "typo--sans",
|
|
91
|
+
className,
|
|
92
|
+
)}
|
|
62
93
|
{...props}
|
|
63
94
|
/>
|
|
64
95
|
);
|