@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.
Files changed (38) hide show
  1. package/client/components/ui/avatar-identity.tsx +16 -3
  2. package/client/components/ui/avatar.tsx +32 -4
  3. package/client/components/ui/back-link.tsx +35 -0
  4. package/client/components/ui/button.tsx +3 -0
  5. package/client/components/ui/card.tsx +20 -3
  6. package/client/components/ui/centered-page.tsx +27 -0
  7. package/client/components/ui/checkbox-field.tsx +57 -0
  8. package/client/components/ui/data-grid.tsx +258 -0
  9. package/client/components/ui/dialog.tsx +6 -0
  10. package/client/components/ui/icon-button.tsx +45 -0
  11. package/client/components/ui/layout.tsx +32 -5
  12. package/client/components/ui/modal-panel.tsx +35 -4
  13. package/client/components/ui/outline-node.tsx +112 -0
  14. package/client/components/ui/radio-card.tsx +54 -0
  15. package/client/components/ui/resource-thumbnail.tsx +12 -1
  16. package/client/components/ui/side-nav.tsx +280 -0
  17. package/client/components/ui/status-pill.tsx +37 -4
  18. package/client/components/ui/table.tsx +26 -4
  19. package/client/components/ui/typography.tsx +33 -2
  20. package/client/global.css +980 -4
  21. package/client/ui/Avatar.stories.tsx +78 -0
  22. package/client/ui/BackLink.stories.tsx +50 -0
  23. package/client/ui/Button.stories.tsx +26 -0
  24. package/client/ui/Card.stories.tsx +30 -0
  25. package/client/ui/CenteredPage.stories.tsx +43 -0
  26. package/client/ui/CheckboxField.stories.tsx +68 -0
  27. package/client/ui/DataGrid.stories.tsx +114 -0
  28. package/client/ui/Dialog.stories.tsx +31 -0
  29. package/client/ui/IconButton.stories.tsx +77 -0
  30. package/client/ui/OutlineNode.stories.tsx +106 -0
  31. package/client/ui/RadioCard.stories.tsx +75 -0
  32. package/client/ui/SideNav.stories.tsx +105 -0
  33. package/client/ui/StatusPill.stories.tsx +78 -0
  34. package/client/ui/Table/Table.stories.tsx +32 -0
  35. package/dist/index.cjs.js +1 -1
  36. package/dist/index.d.ts +105 -0
  37. package/dist/index.es.js +653 -40
  38. package/package.json +3 -1
@@ -14,10 +14,16 @@ const avatarIdentityVariants = cva("avatar-identity", {
14
14
  right: "avatar-identity--right",
15
15
  left: "avatar-identity--left",
16
16
  },
17
+ /** `soft` — a table-row identity: pale initials disc, no ring, name over a quieter email. */
18
+ appearance: {
19
+ default: "",
20
+ soft: "avatar-identity--soft",
21
+ },
17
22
  },
18
23
  defaultVariants: {
19
24
  size: "xlarge",
20
25
  textDirection: "right",
26
+ appearance: "default",
21
27
  },
22
28
  });
23
29
 
@@ -38,6 +44,8 @@ export interface AvatarIdentityProps
38
44
  email?: string;
39
45
  /** Override initials. Defaults to the first letters of `name`. */
40
46
  initials?: string;
47
+ /** A glyph shown on the face instead of initials (for an account with no readable name). */
48
+ icon?: React.ReactNode;
41
49
  src?: string;
42
50
  alt?: string;
43
51
  showText?: boolean;
@@ -59,10 +67,12 @@ const AvatarIdentity = React.forwardRef<HTMLDivElement, AvatarIdentityProps>(
59
67
  className,
60
68
  size,
61
69
  textDirection,
70
+ appearance,
62
71
  variant = "placeholder",
63
72
  name = "",
64
73
  email = "",
65
74
  initials,
75
+ icon,
66
76
  src,
67
77
  alt,
68
78
  showText = true,
@@ -76,7 +86,10 @@ const AvatarIdentity = React.forwardRef<HTMLDivElement, AvatarIdentityProps>(
76
86
  return (
77
87
  <div
78
88
  ref={ref}
79
- className={cn(avatarIdentityVariants({ size, textDirection }), className)}
89
+ className={cn(
90
+ avatarIdentityVariants({ size, textDirection, appearance }),
91
+ className,
92
+ )}
80
93
  {...props}
81
94
  >
82
95
  <div className="avatar-identity__face" data-face={face}>
@@ -90,7 +103,7 @@ const AvatarIdentity = React.forwardRef<HTMLDivElement, AvatarIdentityProps>(
90
103
 
91
104
  {face === "initials" ? (
92
105
  <span className="avatar-identity__initials" aria-hidden={showText}>
93
- {letters}
106
+ {icon ?? letters}
94
107
  </span>
95
108
  ) : null}
96
109
 
@@ -110,7 +123,7 @@ const AvatarIdentity = React.forwardRef<HTMLDivElement, AvatarIdentityProps>(
110
123
  {showText ? (
111
124
  <div className="avatar-identity__text">
112
125
  <p className="avatar-identity__name">{name}</p>
113
- <p className="avatar-identity__email">{email}</p>
126
+ {email ? <p className="avatar-identity__email">{email}</p> : null}
114
127
  </div>
115
128
  ) : null}
116
129
  </div>
@@ -1,15 +1,43 @@
1
1
  import * as React from "react";
2
2
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
+ import { cva, type VariantProps } from "class-variance-authority";
3
4
 
4
5
  import { cn } from "@/lib/utils";
5
6
 
7
+ /**
8
+ * Avatar sizes and the `brand` look (initials on the brand teal, with a thin gradient ring —
9
+ * the signed-in user's disc in a header). Defaults reproduce the previous avatar exactly.
10
+ */
11
+ const avatarVariants = cva("avatar", {
12
+ variants: {
13
+ size: {
14
+ sm: "avatar--sm",
15
+ md: "",
16
+ lg: "avatar--lg",
17
+ xl: "avatar--xl",
18
+ },
19
+ appearance: {
20
+ default: "",
21
+ brand: "avatar--brand",
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ size: "md",
26
+ appearance: "default",
27
+ },
28
+ });
29
+
30
+ export interface AvatarProps
31
+ extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>,
32
+ VariantProps<typeof avatarVariants> {}
33
+
6
34
  const Avatar = React.forwardRef<
7
35
  React.ElementRef<typeof AvatarPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
9
- >(({ className, ...props }, ref) => (
36
+ AvatarProps
37
+ >(({ className, size, appearance, ...props }, ref) => (
10
38
  <AvatarPrimitive.Root
11
39
  ref={ref}
12
- className={cn("avatar", className)}
40
+ className={cn(avatarVariants({ size, appearance }), className)}
13
41
  {...props}
14
42
  />
15
43
  ));
@@ -39,4 +67,4 @@ const AvatarFallback = React.forwardRef<
39
67
  ));
40
68
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
41
69
 
42
- export { Avatar, AvatarImage, AvatarFallback };
70
+ export { Avatar, AvatarImage, AvatarFallback, avatarVariants };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Slot, Slottable } from "@radix-ui/react-slot";
3
+ import { ArrowLeft } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ /**
8
+ * BackLink — the "← Back to <list>" control above a detail page's title.
9
+ * Renders a `<button>`; pass `asChild` with a router `<Link>` or `<a>` to navigate by href
10
+ * (the arrow is placed inside that element).
11
+ */
12
+ interface BackLinkProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
13
+ asChild?: boolean;
14
+ }
15
+
16
+ const BackLink = React.forwardRef<HTMLButtonElement, BackLinkProps>(
17
+ ({ className, asChild = false, children, ...props }, ref) => {
18
+ const Comp = asChild ? Slot : "button";
19
+ return (
20
+ <Comp
21
+ ref={ref}
22
+ {...(asChild ? {} : { type: "button" })}
23
+ className={cn("back-link", className)}
24
+ {...props}
25
+ >
26
+ <ArrowLeft className="back-link__icon" aria-hidden="true" />
27
+ {asChild ? <Slottable>{children}</Slottable> : <span>{children}</span>}
28
+ </Comp>
29
+ );
30
+ },
31
+ );
32
+ BackLink.displayName = "BackLink";
33
+
34
+ export { BackLink };
35
+ export type { BackLinkProps };
@@ -20,6 +20,9 @@ const buttonVariants = cva(
20
20
  "general-primary": "button--general-primary",
21
21
  "general-secondary": "button--general-secondary",
22
22
  "general-tertiary": "button--general-tertiary",
23
+ // Destructive actions: delete, remove, deactivate, void. `primary` confirms, `secondary` starts the action.
24
+ "danger-primary": "button--danger-primary",
25
+ "danger-secondary": "button--danger-secondary",
23
26
  "transparent-tertiary": "button--transparent-tertiary",
24
27
  "tooltip-primary": "button--tooltip-primary",
25
28
  "tooltip-secondary": "button--tooltip-secondary",
@@ -12,27 +12,44 @@ const cardVariants = cva("card", {
12
12
  elevated: "card--elevated",
13
13
  filled: "card--filled",
14
14
  interactive: "card--interactive",
15
+ /** A bordered 16px-radius panel for a side summary. */
16
+ panel: "card--panel",
17
+ /** A bordered 12px-radius box nested inside a form or another card. */
18
+ inset: "card--inset",
15
19
  },
16
20
  padding: {
17
21
  default: "",
18
22
  spacious: "card--padding-spacious",
19
23
  },
24
+ /** `relaxed` — more air between heading, description and content (dense back-office pages). */
25
+ spacing: {
26
+ default: "",
27
+ relaxed: "card--spacing-relaxed",
28
+ },
20
29
  },
21
30
  defaultVariants: {
22
31
  variant: "default",
23
32
  padding: "default",
33
+ spacing: "default",
24
34
  },
25
35
  });
26
36
 
27
37
  interface CardProps
28
38
  extends React.HTMLAttributes<HTMLDivElement>,
29
- VariantProps<typeof cardVariants> {}
39
+ VariantProps<typeof cardVariants> {
40
+ /** Pin the card 96px from the top of the window while the page scrolls (a live summary beside a long form). */
41
+ sticky?: boolean;
42
+ }
30
43
 
31
44
  const Card = React.forwardRef<HTMLDivElement, CardProps>(
32
- ({ className, variant, padding, ...props }, ref) => (
45
+ ({ className, variant, padding, spacing, sticky = false, ...props }, ref) => (
33
46
  <div
34
47
  ref={ref}
35
- className={cn(cardVariants({ variant, padding }), className)}
48
+ className={cn(
49
+ cardVariants({ variant, padding, spacing }),
50
+ sticky && "card--sticky",
51
+ className,
52
+ )}
36
53
  {...props}
37
54
  />
38
55
  ),
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ /**
6
+ * CenteredPage — a full-window page that sets a single panel near the top, centred, on the page
7
+ * background (a signed-out landing, an error or a hand-off screen). The panel is 420px wide and
8
+ * never wider than the window.
9
+ *
10
+ * <CenteredPage>
11
+ * <ModalPanel align="center">…</ModalPanel>
12
+ * </CenteredPage>
13
+ */
14
+ export interface CenteredPageProps extends React.HTMLAttributes<HTMLElement> {
15
+ as?: React.ElementType;
16
+ }
17
+
18
+ const CenteredPage = React.forwardRef<HTMLElement, CenteredPageProps>(
19
+ ({ as: Component = "main", className, children, ...props }, ref) => (
20
+ <Component ref={ref} className={cn("centered-page", className)} {...props}>
21
+ <div className="centered-page__body">{children}</div>
22
+ </Component>
23
+ ),
24
+ );
25
+ CenteredPage.displayName = "CenteredPage";
26
+
27
+ export { CenteredPage };
@@ -0,0 +1,57 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+ import { Checkbox } from "./checkbox";
5
+
6
+ /**
7
+ * CheckboxField — a checkbox with its label (and optional description) as one control.
8
+ * Clicking the text toggles the box. `onCheckedChange` receives `boolean | "indeterminate"`
9
+ * exactly as the plain `Checkbox` does.
10
+ */
11
+ interface CheckboxFieldProps
12
+ extends Omit<React.ComponentPropsWithoutRef<typeof Checkbox>, "children"> {
13
+ label: React.ReactNode;
14
+ /** Quieter helper text under the label. */
15
+ description?: React.ReactNode;
16
+ }
17
+
18
+ const CheckboxField = React.forwardRef<
19
+ React.ElementRef<typeof Checkbox>,
20
+ CheckboxFieldProps
21
+ >(({ className, label, description, id, disabled, ...props }, ref) => {
22
+ const generatedId = React.useId();
23
+ const fieldId = id ?? generatedId;
24
+ const descriptionId = description ? `${fieldId}-description` : undefined;
25
+
26
+ return (
27
+ <div
28
+ className={cn(
29
+ "checkbox-field",
30
+ disabled && "checkbox-field--disabled",
31
+ className,
32
+ )}
33
+ >
34
+ <Checkbox
35
+ ref={ref}
36
+ id={fieldId}
37
+ disabled={disabled}
38
+ aria-describedby={descriptionId}
39
+ {...props}
40
+ />
41
+ <div className="checkbox-field__text">
42
+ <label htmlFor={fieldId} className="checkbox-field__label">
43
+ {label}
44
+ </label>
45
+ {description ? (
46
+ <span id={descriptionId} className="checkbox-field__description">
47
+ {description}
48
+ </span>
49
+ ) : null}
50
+ </div>
51
+ </div>
52
+ );
53
+ });
54
+ CheckboxField.displayName = "CheckboxField";
55
+
56
+ export { CheckboxField };
57
+ export type { CheckboxFieldProps };
@@ -0,0 +1,258 @@
1
+ import * as React from "react";
2
+ import { AgGridReact } from "ag-grid-react";
3
+ import {
4
+ AllCommunityModule,
5
+ ModuleRegistry,
6
+ themeQuartz,
7
+ type ColDef,
8
+ type ICellRendererParams,
9
+ type SortChangedEvent,
10
+ } from "ag-grid-community";
11
+
12
+ import { cn } from "@/lib/utils";
13
+
14
+ ModuleRegistry.registerModules([AllCommunityModule]);
15
+
16
+ /**
17
+ * The grid's look comes from the design system, not from AG Grid's own stylesheet: the values below mirror the
18
+ * `Table appearance="card"` (tinted header, soft row dividers, hover highlight, rounded card), so a screen can
19
+ * move from one to the other without changing how it reads.
20
+ */
21
+ const dataGridTheme = themeQuartz.withParams({
22
+ fontFamily: "var(--font-mazzard, 'Mazzard Soft M'), sans-serif",
23
+ fontSize: 14,
24
+ foregroundColor: "#1f2430",
25
+ backgroundColor: "#ffffff",
26
+ accentColor: "#0f748a",
27
+ borderColor: "#e3e8ef",
28
+ wrapperBorderRadius: 16,
29
+ headerBackgroundColor: "#f6f8fb",
30
+ headerTextColor: "#6b7280",
31
+ headerFontSize: 12,
32
+ headerFontWeight: 600,
33
+ // The pinned (action) column joins the rest of the row; no divider line.
34
+ pinnedColumnBorder: false,
35
+ rowHoverColor: "#f4f9fd",
36
+ columnBorder: false,
37
+ headerColumnBorder: false,
38
+ // The resize handle stays (the column still drags) but is drawn as a faint tick, not a separator line.
39
+ headerColumnResizeHandleColor: "transparent",
40
+ spacing: 8,
41
+ });
42
+
43
+ type DataGridAlign = "left" | "center" | "right";
44
+
45
+ interface DataGridColumn<T> {
46
+ /** Stable id of the column; also the key reported by `onSortChange`. */
47
+ key: string;
48
+ header: string;
49
+ /**
50
+ * The cell's plain value. It is what sorting, filtering and the quick search work on, and what is shown unless
51
+ * `cell` is given.
52
+ */
53
+ value?: (row: T) => string | number | boolean | null | undefined;
54
+ /** A custom cell (a badge, a row of buttons). Give `value` as well if the column should sort or be searched. */
55
+ cell?: (row: T) => React.ReactNode;
56
+ /** The user can sort by this column. Default `false`. */
57
+ sortable?: boolean;
58
+ /** Show a filter on this column's header menu (client-side data). Default `false`. */
59
+ filter?: boolean;
60
+ /** The user can drag the column edge to resize it. Default `true`. */
61
+ resizable?: boolean;
62
+ /** Fixed width in px. Leave out and use `flex` to share the leftover space. */
63
+ width?: number;
64
+ minWidth?: number;
65
+ /** Share of the leftover width relative to the other `flex` columns. Default `1` when no `width` is set. */
66
+ flex?: number;
67
+ align?: DataGridAlign;
68
+ pinned?: "left" | "right";
69
+ /** Let long text wrap onto more lines and grow the row, instead of being cut off with an ellipsis. */
70
+ wrap?: boolean;
71
+ }
72
+
73
+ interface DataGridSort {
74
+ key: string;
75
+ direction: "asc" | "desc";
76
+ }
77
+
78
+ interface DataGridProps<T> {
79
+ columns: DataGridColumn<T>[];
80
+ rows: T[];
81
+ /** A stable id for a row, so the grid keeps focus and scroll when the data refreshes. */
82
+ getRowId?: (row: T) => string;
83
+ loading?: boolean;
84
+ /** Shown when `rows` is empty. */
85
+ emptyText?: string;
86
+ /** Hides rows that do not contain this text in any column (client-side data). */
87
+ quickFilter?: string;
88
+ /**
89
+ * Controlled sort for data the SERVER sorts. When `onSortChange` is given the grid never reorders rows itself: it
90
+ * shows the sort indicator for `sort` and reports the user's choice, and the parent refetches in that order.
91
+ */
92
+ sort?: DataGridSort | null;
93
+ onSortChange?: (sort: DataGridSort | null) => void;
94
+ onRowClick?: (row: T) => void;
95
+ /** Accessible name of the grid. */
96
+ "aria-label"?: string;
97
+ className?: string;
98
+ }
99
+
100
+ const ALIGN_CLASS: Record<DataGridAlign, string | undefined> = {
101
+ left: undefined,
102
+ center: "data-grid__cell--center",
103
+ right: "data-grid__cell--right",
104
+ };
105
+
106
+ /**
107
+ * The grid only gets new column definitions when a column's SHAPE changes (its key, header, width, sorting, ...), not
108
+ * every time the parent re-renders and builds a fresh `columns` array: new definitions make AG Grid forget the user's
109
+ * sort and column sizes. The functions (`value`, `cell`) are read from the latest `columns` at call time, so they are
110
+ * never stale.
111
+ */
112
+ function shapeOf<T>(columns: DataGridColumn<T>[]): string {
113
+ return JSON.stringify(
114
+ columns.map((c) => [
115
+ c.key,
116
+ c.header,
117
+ c.sortable ?? false,
118
+ c.filter ?? false,
119
+ c.resizable ?? true,
120
+ c.width ?? null,
121
+ c.minWidth ?? null,
122
+ c.flex ?? null,
123
+ c.align ?? null,
124
+ c.pinned ?? null,
125
+ c.wrap ?? false,
126
+ Boolean(c.value),
127
+ Boolean(c.cell),
128
+ ]),
129
+ );
130
+ }
131
+
132
+ /**
133
+ * DataGrid — an interactive table: sortable and resizable columns, filters, a quick search, custom cells, loading and
134
+ * empty states. It renders the rows it is given; paging stays with the screen (a pagination bar below), so the same
135
+ * grid works for a short list held in memory and for one page of a long list from the server.
136
+ *
137
+ * <DataGrid
138
+ * aria-label="Roles"
139
+ * rows={roles}
140
+ * getRowId={(role) => String(role.id)}
141
+ * columns={[
142
+ * { key: "name", header: "Role", value: (role) => role.name, sortable: true },
143
+ * { key: "scope", header: "Applies to", value: (role) => role.scopeType, sortable: true, filter: true },
144
+ * ]}
145
+ * quickFilter={search}
146
+ * />
147
+ *
148
+ * Client-side data: leave `onSortChange` out and the grid sorts and filters the rows itself.
149
+ * Server-side data: pass `sort` and `onSortChange` and refetch in that order.
150
+ */
151
+ function DataGrid<T>({
152
+ columns,
153
+ rows,
154
+ getRowId,
155
+ loading = false,
156
+ emptyText = "Nothing to show.",
157
+ quickFilter,
158
+ sort,
159
+ onSortChange,
160
+ onRowClick,
161
+ className,
162
+ "aria-label": ariaLabel,
163
+ }: DataGridProps<T>) {
164
+ const serverSorted = onSortChange !== undefined;
165
+ const latest = React.useRef(columns);
166
+ latest.current = columns;
167
+ const shape = shapeOf(columns);
168
+ const sortKey = sort?.key ?? null;
169
+ const sortDirection = sort?.direction ?? null;
170
+
171
+ const columnDefs = React.useMemo<ColDef<T>[]>(
172
+ () =>
173
+ latest.current.map((column) => {
174
+ const fixed = column.width !== undefined;
175
+ const find = () => latest.current.find((c) => c.key === column.key);
176
+ return {
177
+ colId: column.key,
178
+ headerName: column.header,
179
+ valueGetter: column.value
180
+ ? (params) => (params.data ? find()?.value?.(params.data) : undefined)
181
+ : undefined,
182
+ cellRenderer: column.cell
183
+ ? (params: ICellRendererParams<T>) => (params.data ? find()?.cell?.(params.data) : null)
184
+ : undefined,
185
+ sortable: column.sortable ?? false,
186
+ filter: column.filter ?? false,
187
+ resizable: column.resizable ?? true,
188
+ suppressMovable: true,
189
+ width: column.width,
190
+ minWidth: column.minWidth ?? (fixed ? column.width : 96),
191
+ flex: fixed ? undefined : (column.flex ?? 1),
192
+ pinned: column.pinned,
193
+ wrapText: column.wrap ?? false,
194
+ autoHeight: column.wrap ?? false,
195
+ cellClass: column.align ? ALIGN_CLASS[column.align] : undefined,
196
+ headerClass: column.align ? ALIGN_CLASS[column.align] : undefined,
197
+ // Server-sorted data keeps the order it arrived in; the grid only draws the indicator.
198
+ ...(serverSorted
199
+ ? {
200
+ comparator: () => 0,
201
+ // Server-side sort has no "no sort": clicking again flips the direction.
202
+ sortingOrder: ["asc", "desc"] as ColDef<T>["sortingOrder"],
203
+ sort: sortKey === column.key ? sortDirection : null,
204
+ }
205
+ : {}),
206
+ };
207
+ }),
208
+ // `shape` stands for the column list; the list itself is a new array on most renders.
209
+ // eslint-disable-next-line react-hooks/exhaustive-deps
210
+ [shape, serverSorted, sortKey, sortDirection],
211
+ );
212
+
213
+ const handleSortChanged = React.useCallback(
214
+ (event: SortChangedEvent<T>) => {
215
+ if (!serverSorted) return;
216
+ const active = event.api.getColumnState().find((state) => state.sort);
217
+ const next: DataGridSort | null = active?.colId
218
+ ? { key: active.colId, direction: active.sort === "desc" ? "desc" : "asc" }
219
+ : null;
220
+ if (next?.key === sort?.key && next?.direction === sort?.direction) return;
221
+ if (!next && !sort) return;
222
+ onSortChange?.(next);
223
+ },
224
+ [serverSorted, sort, onSortChange],
225
+ );
226
+
227
+ return (
228
+ <div
229
+ role="region"
230
+ aria-label={ariaLabel}
231
+ className={cn(
232
+ "data-grid",
233
+ rows.length === 0 && "data-grid--empty",
234
+ onRowClick && "data-grid--clickable",
235
+ className,
236
+ )}
237
+ >
238
+ <AgGridReact<T>
239
+ theme={dataGridTheme}
240
+ rowData={rows}
241
+ columnDefs={columnDefs}
242
+ domLayout="autoHeight"
243
+ rowHeight={64}
244
+ headerHeight={48}
245
+ loading={loading}
246
+ quickFilterText={quickFilter}
247
+ getRowId={getRowId ? (params) => getRowId(params.data) : undefined}
248
+ onSortChanged={handleSortChanged}
249
+ onRowClicked={onRowClick ? (event) => event.data && onRowClick(event.data) : undefined}
250
+ suppressCellFocus
251
+ localeText={{ noRowsToShow: emptyText }}
252
+ />
253
+ </div>
254
+ );
255
+ }
256
+
257
+ export { DataGrid };
258
+ export type { DataGridColumn, DataGridProps, DataGridSort, DataGridAlign };
@@ -51,6 +51,7 @@ function DialogContent({
51
51
  children,
52
52
  showCloseButton = true,
53
53
  size = "default",
54
+ appearance = "default",
54
55
  ...props
55
56
  }: React.ComponentProps<typeof DialogPrimitive.Content> & {
56
57
  showCloseButton?: boolean;
@@ -60,6 +61,10 @@ function DialogContent({
60
61
  * (`height: calc(100vh - 90px)`), no fixed max-width. Default is the
61
62
  * existing centered modal. */
62
63
  size?: "default" | "fullscreen";
64
+ /** `"form"` — the back-office dialog: a 560px panel with roomier padding, a
65
+ * left-aligned title and description (16px, page font) and a 12px footer gap.
66
+ * Default is the centred customer-facing modal, unchanged. */
67
+ appearance?: "default" | "form";
63
68
  }) {
64
69
  return (
65
70
  <DialogPortal data-slot="dialog-portal">
@@ -74,6 +79,7 @@ function DialogContent({
74
79
  className={cn(
75
80
  "dialog-content",
76
81
  size === "fullscreen" && "dialog-content--fullscreen",
82
+ appearance === "form" && "dialog-content--form",
77
83
  className,
78
84
  )}
79
85
  {...props}
@@ -0,0 +1,45 @@
1
+ import * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ /**
7
+ * IconButton — a quiet, icon-only button for toolbars, tree rows and shell chrome (a sidebar
8
+ * toggle, move up / down, edit, delete). It has no label, so always pass `aria-label`.
9
+ *
10
+ * <IconButton aria-label="Edit" size="sm"><Pencil size={15} /></IconButton>
11
+ *
12
+ * `md` (36px) is for chrome, `sm` (28px) for rows, and `bare` has no box at all — it only adds the
13
+ * focus ring and pointer around its child (an `Avatar`, for example).
14
+ */
15
+ const iconButtonVariants = cva("icon-button", {
16
+ variants: {
17
+ size: {
18
+ sm: "icon-button--sm",
19
+ md: "icon-button--md",
20
+ bare: "icon-button--bare",
21
+ },
22
+ },
23
+ defaultVariants: { size: "md" },
24
+ });
25
+
26
+ export interface IconButtonProps
27
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
28
+ VariantProps<typeof iconButtonVariants> {
29
+ /** The accessible name; an icon alone has none. */
30
+ "aria-label": string;
31
+ }
32
+
33
+ const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
34
+ ({ className, size, type = "button", ...props }, ref) => (
35
+ <button
36
+ ref={ref}
37
+ type={type}
38
+ className={cn(iconButtonVariants({ size }), className)}
39
+ {...props}
40
+ />
41
+ ),
42
+ );
43
+ IconButton.displayName = "IconButton";
44
+
45
+ export { IconButton, iconButtonVariants };