@you-agent-factory/components 0.0.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/README.md +223 -0
- package/docs/README.md +83 -0
- package/docs/button.md +119 -0
- package/docs/charts.md +325 -0
- package/docs/data-display-code-panel.md +120 -0
- package/docs/feedback-alert-panel.md +117 -0
- package/docs/feedback-skeleton.md +54 -0
- package/docs/forms-form-field.md +490 -0
- package/docs/forms-input-primitives.md +311 -0
- package/docs/forms-select-primitives.md +362 -0
- package/docs/graphs.md +250 -0
- package/docs/layout-display-primitives.md +211 -0
- package/docs/overlays.md +414 -0
- package/docs/table-data-table.md +331 -0
- package/docs/typography-roles.md +182 -0
- package/docs/widget-frame-recipes.md +273 -0
- package/package.json +161 -0
- package/src/category-paths.ts +20 -0
- package/src/charts/chart-state-panel.tsx +103 -0
- package/src/charts/chart.tsx +287 -0
- package/src/charts/index.ts +21 -0
- package/src/data-display/code-panel.tsx +67 -0
- package/src/data-display/data-table.tsx +180 -0
- package/src/data-display/description-list.tsx +24 -0
- package/src/data-display/index.ts +34 -0
- package/src/data-display/table-layout.ts +12 -0
- package/src/data-display/table.tsx +131 -0
- package/src/feedback/alert-panel-semantics.ts +75 -0
- package/src/feedback/alert-panel.tsx +187 -0
- package/src/feedback/index.ts +21 -0
- package/src/feedback/skeleton.tsx +16 -0
- package/src/forms/index.ts +73 -0
- package/src/forms/package-checkbox.tsx +50 -0
- package/src/forms/package-enum-select.tsx +185 -0
- package/src/forms/package-file-input.tsx +25 -0
- package/src/forms/package-form-field.tsx +202 -0
- package/src/forms/package-input.tsx +25 -0
- package/src/forms/package-native-select.tsx +25 -0
- package/src/forms/package-select.tsx +209 -0
- package/src/forms/package-textarea.tsx +35 -0
- package/src/forms/select-icons.tsx +35 -0
- package/src/graphs/graph-edge-path.ts +241 -0
- package/src/graphs/graph-edge.tsx +130 -0
- package/src/graphs/graph-interactive-example.tsx +187 -0
- package/src/graphs/graph-node-button.tsx +51 -0
- package/src/graphs/graph-node-handle-badge.tsx +108 -0
- package/src/graphs/graph-node-handle.ts +28 -0
- package/src/graphs/graph-node-shell.tsx +111 -0
- package/src/graphs/graph-node-state-indicator.tsx +47 -0
- package/src/graphs/graph-node-state.ts +111 -0
- package/src/graphs/graph-viewport-surface.tsx +27 -0
- package/src/graphs/index.ts +41 -0
- package/src/icons/index.ts +4 -0
- package/src/index.ts +209 -0
- package/src/layout/action-row.tsx +53 -0
- package/src/layout/index.ts +9 -0
- package/src/layout/surface-panel.tsx +91 -0
- package/src/navigation/index.ts +4 -0
- package/src/overlays/collapsible.tsx +22 -0
- package/src/overlays/dialog.tsx +148 -0
- package/src/overlays/index.ts +31 -0
- package/src/overlays/overlay-layout.ts +9 -0
- package/src/overlays/popover.tsx +29 -0
- package/src/overlays/scroll-area.tsx +78 -0
- package/src/primitives/button-link.tsx +22 -0
- package/src/primitives/button.tsx +258 -0
- package/src/primitives/icon-button-shell.tsx +49 -0
- package/src/primitives/index.ts +31 -0
- package/src/primitives/package-text.tsx +29 -0
- package/src/primitives/typography-roles.ts +12 -0
- package/src/primitives/typography.tsx +165 -0
- package/src/recipes/index.ts +61 -0
- package/src/recipes/widget-frame-content.tsx +114 -0
- package/src/recipes/widget-frame-disclosure.tsx +161 -0
- package/src/recipes/widget-frame-layout.ts +40 -0
- package/src/recipes/widget-frame-skeleton.tsx +16 -0
- package/src/recipes/widget-frame-states.tsx +99 -0
- package/src/recipes/widget-frame-typography.ts +19 -0
- package/src/recipes/widget-frame.tsx +84 -0
- package/src/styles/color-palette-presets.css +167 -0
- package/src/styles/color-role-tokens.css +163 -0
- package/src/styles/layout-role-tokens.css +27 -0
- package/src/styles/text-color-role-tokens.css +29 -0
- package/src/styles/typography-role-tokens.css +72 -0
- package/src/styles/typography-role-utilities.css +73 -0
- package/src/styles/typography-roles.css +53 -0
- package/src/styles.css +32 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/render.tsx +16 -0
- package/src/tokens/index.ts +4 -0
- package/src/utilities/cn.ts +5 -0
- package/src/utilities/index.ts +6 -0
package/docs/graphs.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Graph primitives (`@you-agent-factory/components/graphs`)
|
|
2
|
+
|
|
3
|
+
Generic React Flow presentation primitives for graph nodes, edges, handles, and
|
|
4
|
+
viewport chrome. The graph category is domain-free: it does not import factory,
|
|
5
|
+
workstation, work-state, generated OpenAPI, dashboard API, or dashboard feature
|
|
6
|
+
types.
|
|
7
|
+
|
|
8
|
+
Host applications own graph data fetching, durable graph state, domain node
|
|
9
|
+
renderers, layout projection, copy, and business workflows. Pass generic props
|
|
10
|
+
and callbacks into these components; keep product-specific graph logic in host
|
|
11
|
+
feature code.
|
|
12
|
+
|
|
13
|
+
## Install and import
|
|
14
|
+
|
|
15
|
+
Graph primitives import from the graphs category entrypoint:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {
|
|
19
|
+
GraphNodeShell,
|
|
20
|
+
GraphNodeButton,
|
|
21
|
+
GraphEdge,
|
|
22
|
+
GRAPH_EDGE_TYPES,
|
|
23
|
+
GraphViewportSurface,
|
|
24
|
+
GraphNodeHandleBadge,
|
|
25
|
+
buildGraphEdgePathThroughWaypoints,
|
|
26
|
+
type GraphNodeHandle,
|
|
27
|
+
type GraphNodeState,
|
|
28
|
+
} from "@you-agent-factory/components/graphs";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import package styles once in the host application:
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
@import "@you-agent-factory/components/styles.css";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## React Flow dependency
|
|
38
|
+
|
|
39
|
+
`@xyflow/react` is a direct dependency of `@you-agent-factory/components`, not
|
|
40
|
+
a dashboard-only peer. Graph primitives that integrate with React Flow resolve
|
|
41
|
+
it from the component package dependency graph.
|
|
42
|
+
|
|
43
|
+
| Package surface | React Flow boundary |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `GraphNodeHandleBadge` | Wraps React Flow `Handle` for source/target affordances |
|
|
46
|
+
| `GraphEdge` | Registered as a React Flow custom edge type (`graphEdge`) |
|
|
47
|
+
| `GraphInteractiveExample` | Composes `ReactFlow`, `Controls`, and package node shells |
|
|
48
|
+
| `GraphNodeShell`, `GraphNodeButton`, `GraphViewportSurface` | Plain React markup; mount inside React Flow node renderers or viewport chrome |
|
|
49
|
+
|
|
50
|
+
When composing a full canvas, wrap node renderers in `ReactFlowProvider` and
|
|
51
|
+
register `GRAPH_EDGE_TYPES` (or a host-specific alias that forwards to
|
|
52
|
+
`GraphEdge`) on the `ReactFlow` instance. Import `@xyflow/react/dist/style.css`
|
|
53
|
+
in components that render `ReactFlow` controls or backgrounds.
|
|
54
|
+
|
|
55
|
+
## Component contracts
|
|
56
|
+
|
|
57
|
+
### `GraphNodeShell`
|
|
58
|
+
|
|
59
|
+
Presentation shell for a graph node body and handle rails.
|
|
60
|
+
|
|
61
|
+
- **Props:** `handles` (required), `children`, optional `nodeKind`, `state`,
|
|
62
|
+
`stateLabel`, `showStateIndicator` (default `true`), and standard
|
|
63
|
+
`article` attributes.
|
|
64
|
+
- **States:** `default`, `selected`, `disabled`, `loading`, `error`.
|
|
65
|
+
- **Accessibility:** Selected shells expose `aria-selected`; error shells expose
|
|
66
|
+
`aria-invalid`; loading shells expose `aria-busy`; disabled shells expose
|
|
67
|
+
`aria-disabled`. Selected and error shells use border weight/style and shadow
|
|
68
|
+
in addition to color.
|
|
69
|
+
- **Layout:** Loading and loaded shells reserve a fixed-height state indicator
|
|
70
|
+
row (`GRAPH_NODE_CONTENT_MIN_HEIGHT_CLASS`) to avoid layout shift.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<GraphNodeShell
|
|
74
|
+
handles={[
|
|
75
|
+
{ id: "in", label: "Input", side: "left", type: "target" },
|
|
76
|
+
{ id: "out", label: "Output", side: "right", type: "source" },
|
|
77
|
+
]}
|
|
78
|
+
nodeKind="example"
|
|
79
|
+
state="selected"
|
|
80
|
+
stateLabel="Selected node"
|
|
81
|
+
>
|
|
82
|
+
<GraphNodeButton graphState="selected">Example node</GraphNodeButton>
|
|
83
|
+
</GraphNodeShell>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `GraphNodeButton`
|
|
87
|
+
|
|
88
|
+
Interactive control inside a node shell. Uses `graphState` (not `state`) to
|
|
89
|
+
avoid clashing with native button state.
|
|
90
|
+
|
|
91
|
+
- **States:** same `GraphNodeState` union as the shell.
|
|
92
|
+
- **Disabled behavior:** `disabled`, `loading`, and native `disabled` block
|
|
93
|
+
activation while preserving readable labels.
|
|
94
|
+
- **Accessibility:** `aria-pressed` for selected buttons; `aria-busy`,
|
|
95
|
+
`aria-invalid`, and `aria-disabled` mirror shell semantics.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<GraphNodeButton
|
|
99
|
+
graphState="loading"
|
|
100
|
+
stateLabel="Loading node"
|
|
101
|
+
onClick={() => activateNode()}
|
|
102
|
+
>
|
|
103
|
+
Run step
|
|
104
|
+
</GraphNodeButton>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Shared state helpers (`graphNodeShellStateClassName`,
|
|
108
|
+
`graphNodeButtonStateAttributes`, `defaultGraphNodeStateLabel`, and related
|
|
109
|
+
exports) are available when host wrappers need the same contract.
|
|
110
|
+
|
|
111
|
+
### `GraphEdge`
|
|
112
|
+
|
|
113
|
+
Custom React Flow edge renderer. Accepts standard `EdgeProps` plus optional
|
|
114
|
+
`edgeClassName` and `labelClassName` for host styling.
|
|
115
|
+
|
|
116
|
+
- **Data:** optional `label`, `alwaysShowLabel`, and `waypoints` on edge `data`.
|
|
117
|
+
- **Geometry:** uses `buildGraphEdgePathThroughWaypoints` when waypoints are
|
|
118
|
+
present; otherwise falls back to React Flow `getBezierPath`.
|
|
119
|
+
- **Registration:** export `GRAPH_EDGE_TYPES` or alias `graphEdge` in host edge
|
|
120
|
+
type maps.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
const edgeTypes = { graphEdge: GraphEdge };
|
|
124
|
+
|
|
125
|
+
<ReactFlow edgeTypes={edgeTypes} /* ... */ />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `GraphViewportSurface`
|
|
129
|
+
|
|
130
|
+
Semantic viewport chrome (`section` with `role="region"` by default) for graph
|
|
131
|
+
frames. Accepts children (typically `ReactFlow`) and standard section attributes.
|
|
132
|
+
|
|
133
|
+
Pass an explicit height (`h-*`, `min-h-*`) for Storybook or standalone examples.
|
|
134
|
+
Wrap interactive examples in an explicit width (`w-[48rem]`, `w-80`, etc.) when
|
|
135
|
+
Storybook uses centered layout; `w-full` alone can collapse to a few pixels wide.
|
|
136
|
+
Hosts that fill flex parents should add `h-full` (and usually `min-h-0`) via
|
|
137
|
+
`className`; the primitive does not force `h-full` so explicit heights are not
|
|
138
|
+
capped by a collapsed parent.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<GraphViewportSurface className="h-[480px] border-outline">
|
|
142
|
+
<ReactFlow /* ... */ />
|
|
143
|
+
</GraphViewportSurface>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `GraphNodeHandleBadge`
|
|
147
|
+
|
|
148
|
+
Renders a single source or target handle with accessible labels and tone-based
|
|
149
|
+
dot styling. Usually composed by `GraphNodeShell`; import directly when building
|
|
150
|
+
custom node layouts.
|
|
151
|
+
|
|
152
|
+
- **Props:** `handle: GraphNodeHandle` with `id`, `label`, `side`, `type`, and
|
|
153
|
+
optional tone, variant, validation, and button interaction fields.
|
|
154
|
+
- **Accessibility:** `aria-label` from `buttonAriaLabel` or `label`; invalid
|
|
155
|
+
handles expose `aria-invalid`.
|
|
156
|
+
|
|
157
|
+
### `buildGraphEdgePathThroughWaypoints`
|
|
158
|
+
|
|
159
|
+
Pure edge-path helper for waypoint-routed geometry. Returns `{ path, labelX,
|
|
160
|
+
labelY }` for representative straight, stepped, curved, and bezier-fallback
|
|
161
|
+
cases. Safe to call from host layout code without importing dashboard models.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
const routed = buildGraphEdgePathThroughWaypoints({
|
|
165
|
+
sourceX,
|
|
166
|
+
sourceY,
|
|
167
|
+
targetX,
|
|
168
|
+
targetY,
|
|
169
|
+
sourcePosition,
|
|
170
|
+
targetPosition,
|
|
171
|
+
waypoints: [{ x: 120, y: 80 }],
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Storybook examples
|
|
176
|
+
|
|
177
|
+
Package Storybook discovers stories under `src/graphs/*.stories.tsx` without
|
|
178
|
+
dashboard providers. Run from `ui/packages/components`:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
bun run build-storybook
|
|
182
|
+
bunx http-server storybook-static -p 6017 -a 127.0.0.1 -s
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Open `http://127.0.0.1:6017` and use the story IDs below.
|
|
186
|
+
|
|
187
|
+
### Node states (`Graphs/GraphNodeStates`)
|
|
188
|
+
|
|
189
|
+
| Story | Storybook ID | What it shows |
|
|
190
|
+
| --- | --- | --- |
|
|
191
|
+
| Selected | `graphs-graphnodestates--selected` | Selected shell and button affordances |
|
|
192
|
+
| Disabled | `graphs-graphnodestates--disabled` | Non-activating disabled node |
|
|
193
|
+
| Loading | `graphs-graphnodestates--loading` | Stable loading dimensions and `aria-busy` |
|
|
194
|
+
| Loaded | `graphs-graphnodestates--loaded` | Default loaded node after loading |
|
|
195
|
+
| Error | `graphs-graphnodestates--error-state` | Error border style and `aria-invalid` |
|
|
196
|
+
|
|
197
|
+
### Edges and handles (`Graphs/GraphEdgesAndHandles`)
|
|
198
|
+
|
|
199
|
+
| Story | Storybook ID | What it shows |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| Bezier edge | `graphs-graphedgesandhandles--bezier-edge` | Default bezier edge path |
|
|
202
|
+
| Waypoint edge | `graphs-graphedgesandhandles--waypoint-edge` | Routed path through waypoints |
|
|
203
|
+
| Source/target handles | `graphs-graphedgesandhandles--source-target-handles` | Accessible handle labels |
|
|
204
|
+
| Selected node handles | `graphs-graphedgesandhandles--selected-node-handles` | Handle placement on selected shell |
|
|
205
|
+
| Desktop viewport | `graphs-graphedgesandhandles--desktop-viewport` | Desktop-width edge/handle layout |
|
|
206
|
+
| Narrow viewport | `graphs-graphedgesandhandles--narrow-viewport` | Narrow-width readability |
|
|
207
|
+
|
|
208
|
+
### Interactive and responsive (`Graphs/GraphInteractiveExamples`)
|
|
209
|
+
|
|
210
|
+
| Story | Storybook ID | What it shows |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| Interactive | `graphs-graphinteractiveexamples--interactive` | Pointer/keyboard node selection in a React Flow canvas |
|
|
213
|
+
| Selected | `graphs-graphinteractiveexamples--selected` | Selected state panel |
|
|
214
|
+
| Disabled | `graphs-graphinteractiveexamples--disabled` | Disabled state panel |
|
|
215
|
+
| Loading | `graphs-graphinteractiveexamples--loading` | Visible loading state without hover |
|
|
216
|
+
| Error | `graphs-graphinteractiveexamples--error-state` | Visible error state without hover |
|
|
217
|
+
| Desktop viewport | `graphs-graphinteractiveexamples--desktop-viewport` | Desktop canvas with controls |
|
|
218
|
+
| Narrow viewport | `graphs-graphinteractiveexamples--narrow-viewport` | Narrow canvas without horizontal overflow |
|
|
219
|
+
|
|
220
|
+
Loading, error, disabled, and selected states are visible in the story canvas
|
|
221
|
+
without opening addon panels.
|
|
222
|
+
|
|
223
|
+
## Host responsibilities
|
|
224
|
+
|
|
225
|
+
Keep these concerns in host application code, not in the graph package:
|
|
226
|
+
|
|
227
|
+
- Fetching graph topology, work items, and runtime facts from APIs
|
|
228
|
+
- Durable editor state, undo/redo, and save/discard workflows
|
|
229
|
+
- Domain node renderers that map product models onto `GraphNodeShell` /
|
|
230
|
+
`GraphNodeButton` props
|
|
231
|
+
- Layout projection, edge routing policy beyond generic waypoints, and product copy
|
|
232
|
+
- React Flow `nodes`, `edges`, `onNodesChange`, and business interaction handlers
|
|
233
|
+
|
|
234
|
+
The dashboard follows this boundary: `features/graphs/public/` re-exports package
|
|
235
|
+
primitives and adds domain wrappers (for example activity-graph shells and
|
|
236
|
+
factory edge class names) without forking generic presentation logic.
|
|
237
|
+
|
|
238
|
+
## Development checks
|
|
239
|
+
|
|
240
|
+
From `ui/packages/components`:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
bun run typecheck
|
|
244
|
+
bun run test
|
|
245
|
+
bun run build-storybook
|
|
246
|
+
bun run verify:storybook-browser
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Graph tests use `ReactFlowProvider` and, for full-canvas cases,
|
|
250
|
+
`installReactFlowTestShims()` from `@you-agent-factory/components/testing`.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Layout and display primitives
|
|
2
|
+
|
|
3
|
+
Domain-free layout and key-value display primitives for panels, action toolbars,
|
|
4
|
+
and description lists. Use these components when you need bordered surfaces,
|
|
5
|
+
responsive action rows, and scan-friendly metadata layouts without dashboard
|
|
6
|
+
routes, providers, API clients, or generated OpenAPI types.
|
|
7
|
+
|
|
8
|
+
The package ships three primitives:
|
|
9
|
+
|
|
10
|
+
| Component | Role |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `SurfacePanel` | Bordered container with semantic surface, padding, radius, and tone options. |
|
|
13
|
+
| `ActionRow` | Responsive row for status chips and action controls. |
|
|
14
|
+
| `DescriptionList` | Semantic `<dl>` scaffold for label/value rows supplied by the host. |
|
|
15
|
+
|
|
16
|
+
These components are **presentation layout**. They provide structure, spacing,
|
|
17
|
+
and responsive wrapping. They do not fetch data, orchestrate workflows, or embed
|
|
18
|
+
product copy.
|
|
19
|
+
|
|
20
|
+
## Required setup
|
|
21
|
+
|
|
22
|
+
Import package styles once in your host application before rendering layout
|
|
23
|
+
primitives:
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
@import "@you-agent-factory/components/styles.css";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Layout primitives depend on package semantic tokens such as `border-outline`,
|
|
30
|
+
`surface-container-high`, and `primary-container`. They do not require
|
|
31
|
+
dashboard `styles.css`, dashboard providers, generated OpenAPI types, React
|
|
32
|
+
Query, or Zustand.
|
|
33
|
+
|
|
34
|
+
## Import paths
|
|
35
|
+
|
|
36
|
+
Prefer category entrypoints for explicit boundaries:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import {
|
|
40
|
+
ActionRow,
|
|
41
|
+
SurfacePanel,
|
|
42
|
+
surfacePanelVariants,
|
|
43
|
+
type ActionRowProps,
|
|
44
|
+
type SurfacePanelProps,
|
|
45
|
+
} from "@you-agent-factory/components/layout";
|
|
46
|
+
|
|
47
|
+
import {
|
|
48
|
+
DescriptionList,
|
|
49
|
+
type DescriptionListProps,
|
|
50
|
+
} from "@you-agent-factory/components/data-display";
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The same exports are also available from the package root:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import {
|
|
57
|
+
ActionRow,
|
|
58
|
+
DescriptionList,
|
|
59
|
+
SurfacePanel,
|
|
60
|
+
} from "@you-agent-factory/components";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Compose layout primitives with typography from `@you-agent-factory/components`
|
|
64
|
+
or `@you-agent-factory/components/primitives` for headings, labels, and body
|
|
65
|
+
copy inside panels and description lists.
|
|
66
|
+
|
|
67
|
+
## Surface panel structure
|
|
68
|
+
|
|
69
|
+
`SurfacePanel` renders a bordered container with token-backed surface styling.
|
|
70
|
+
Use it to group related content, headings, and action rows.
|
|
71
|
+
|
|
72
|
+
### Variants
|
|
73
|
+
|
|
74
|
+
| Prop | Values | Purpose |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| `padding` | `default`, `compact`, `none` | Inner spacing (`p-3`, `p-2`, or none). |
|
|
77
|
+
| `radius` | `lg`, `xl`, `2xl`, `3xl`, `full` | Corner radius. |
|
|
78
|
+
| `surface` | `high`, `low` | `bg-surface-container-high` or `bg-surface-container-low`. |
|
|
79
|
+
| `tone` | `default`, `accent`, `selected` | Border and fill emphasis for accent or selected states. |
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Heading, Text } from "@you-agent-factory/components";
|
|
83
|
+
import { SurfacePanel } from "@you-agent-factory/components/layout";
|
|
84
|
+
|
|
85
|
+
<SurfacePanel padding="default" radius="xl" surface="high">
|
|
86
|
+
<Heading level="section">Panel title supplied by the host</Heading>
|
|
87
|
+
<Text>Panel body copy supplied by the host</Text>
|
|
88
|
+
</SurfacePanel>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use `surfacePanelVariants` when you need the same class bundle on a non-panel
|
|
92
|
+
element. `asChild` merges panel styles onto a single child through Radix Slot;
|
|
93
|
+
verify your host bundler deduplicates React and Radix dependencies when using
|
|
94
|
+
`asChild`.
|
|
95
|
+
|
|
96
|
+
The package owns border, padding, radius, and surface tokens. Host applications
|
|
97
|
+
own headings, body copy, footer actions, and when a panel is accent or selected
|
|
98
|
+
in product context.
|
|
99
|
+
|
|
100
|
+
## Action row wrapping
|
|
101
|
+
|
|
102
|
+
`ActionRow` lays out optional `statuses` and `actions` sections in a responsive
|
|
103
|
+
flex row:
|
|
104
|
+
|
|
105
|
+
- Root: `flex flex-wrap items-center gap-2 max-md:justify-start`
|
|
106
|
+
- Sections (`data-action-row-section`): `flex min-w-0 flex-wrap items-center gap-2`
|
|
107
|
+
|
|
108
|
+
Statuses render before actions when both are provided. The row returns `null`
|
|
109
|
+
when neither slot has content.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { ActionRow } from "@you-agent-factory/components/layout";
|
|
113
|
+
|
|
114
|
+
<ActionRow
|
|
115
|
+
statuses={<span>Status copy supplied by the host</span>}
|
|
116
|
+
actions={
|
|
117
|
+
<>
|
|
118
|
+
<button type="button">Secondary action</button>
|
|
119
|
+
<button type="button">Primary action</button>
|
|
120
|
+
</>
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Responsive behavior
|
|
126
|
+
|
|
127
|
+
On wide viewports, action groups stay aligned in a single row when space allows.
|
|
128
|
+
On narrow viewports (`max-md`), the row uses `justify-start` so wrapped controls
|
|
129
|
+
remain reachable without clipping focus rings.
|
|
130
|
+
|
|
131
|
+
Long host labels inside action sections should use typography `truncate` or live
|
|
132
|
+
inside width-constrained parents so wrapping does not create horizontal page
|
|
133
|
+
overflow. Pass custom section classes through `statusesClassName` and
|
|
134
|
+
`actionsClassName` when a host layout needs tighter gaps or alignment overrides.
|
|
135
|
+
|
|
136
|
+
The package owns flex structure, `min-w-0` overflow guards, and section
|
|
137
|
+
ordering. Host applications own button labels, click handlers, disabled and
|
|
138
|
+
loading state, and which actions appear in each section.
|
|
139
|
+
|
|
140
|
+
## Description list layout
|
|
141
|
+
|
|
142
|
+
`DescriptionList` renders a semantic `<dl>` with:
|
|
143
|
+
|
|
144
|
+
- `grid min-w-0 gap-1.5` on the root
|
|
145
|
+
- `BODY_TEXT_CLASS` defaults for readable values
|
|
146
|
+
- `[&_div]:grid [&_div]:min-w-0` so each row can define its own column template
|
|
147
|
+
|
|
148
|
+
Host applications supply row structure, labels, values, and empty placeholders:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { DescriptionList } from "@you-agent-factory/components/data-display";
|
|
152
|
+
import { Label, Text } from "@you-agent-factory/components";
|
|
153
|
+
|
|
154
|
+
<DescriptionList className="[&_div]:grid-cols-[8.5rem_minmax(0,1fr)]">
|
|
155
|
+
<div>
|
|
156
|
+
<Label as="dt">Status</Label>
|
|
157
|
+
<Text as="dd">{statusLabel}</Text>
|
|
158
|
+
</div>
|
|
159
|
+
<div>
|
|
160
|
+
<Label as="dt">Owner</Label>
|
|
161
|
+
<Text as="dd">{ownerName ?? emptyPlaceholder}</Text>
|
|
162
|
+
</div>
|
|
163
|
+
</DescriptionList>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Layout guidance
|
|
167
|
+
|
|
168
|
+
| Scenario | Host pattern |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| Compact metadata rows | `className="gap-1 [&_div]:grid-cols-[7rem_minmax(0,1fr)]"` plus `Text variant="dense"`. |
|
|
171
|
+
| Wide or multi-column lists | `className="md:grid-cols-2 [&_div]:grid-cols-[8.5rem_minmax(0,1fr)]"` on `DescriptionList`. |
|
|
172
|
+
| Long labels | `Label truncate` inside a width-constrained parent. |
|
|
173
|
+
| Long values | `Text wrap` on `dd` elements. |
|
|
174
|
+
| Missing values | Host supplies placeholder copy such as `"—"`; the package does not invent empty text. |
|
|
175
|
+
|
|
176
|
+
The root and `dd` elements include `min-w-0` so nested grids shrink inside narrow
|
|
177
|
+
panels without forcing horizontal overflow.
|
|
178
|
+
|
|
179
|
+
## Host application responsibilities
|
|
180
|
+
|
|
181
|
+
The component package owns presentation markup, semantic structure, responsive
|
|
182
|
+
flex and grid defaults, and token-backed borders and surfaces.
|
|
183
|
+
|
|
184
|
+
Host applications own:
|
|
185
|
+
|
|
186
|
+
| Concern | Owner |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| Panel headings, body copy, and footer actions | Host |
|
|
189
|
+
| Status chips, badges, and action button labels | Host |
|
|
190
|
+
| Description-list labels, values, and empty placeholders | Host |
|
|
191
|
+
| Multi-column layouts and custom grid templates via `className` | Host |
|
|
192
|
+
| Loading, empty, error, and success states around layout primitives | Host |
|
|
193
|
+
| Click handlers, routing, and workflow orchestration for actions | Host |
|
|
194
|
+
| When a surface is accent, selected, or compact in product context | Host |
|
|
195
|
+
|
|
196
|
+
Pass content, callbacks, and layout overrides into primitives as props. Do not
|
|
197
|
+
expect the package to read from your routers, stores, or API layers.
|
|
198
|
+
|
|
199
|
+
## Storybook examples
|
|
200
|
+
|
|
201
|
+
Package Storybook stories demonstrate layout behavior with package imports only:
|
|
202
|
+
|
|
203
|
+
- `Layout/ActionRow` — default, dense, long-label, wrapped, wide, and mobile or
|
|
204
|
+
desktop viewport examples.
|
|
205
|
+
- `Layout/SurfacePanel` — default, dense, structured heading or content or
|
|
206
|
+
footer, and mobile or desktop viewport examples.
|
|
207
|
+
- `Data Display/DescriptionList` — default, compact, wide, long-label,
|
|
208
|
+
long-value, empty-value, narrow, and mobile or desktop viewport examples.
|
|
209
|
+
|
|
210
|
+
Run `bun run storybook` from `ui/packages/components` or inspect the static
|
|
211
|
+
build with `bun run build-storybook`.
|