@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.
Files changed (92) hide show
  1. package/README.md +223 -0
  2. package/docs/README.md +83 -0
  3. package/docs/button.md +119 -0
  4. package/docs/charts.md +325 -0
  5. package/docs/data-display-code-panel.md +120 -0
  6. package/docs/feedback-alert-panel.md +117 -0
  7. package/docs/feedback-skeleton.md +54 -0
  8. package/docs/forms-form-field.md +490 -0
  9. package/docs/forms-input-primitives.md +311 -0
  10. package/docs/forms-select-primitives.md +362 -0
  11. package/docs/graphs.md +250 -0
  12. package/docs/layout-display-primitives.md +211 -0
  13. package/docs/overlays.md +414 -0
  14. package/docs/table-data-table.md +331 -0
  15. package/docs/typography-roles.md +182 -0
  16. package/docs/widget-frame-recipes.md +273 -0
  17. package/package.json +161 -0
  18. package/src/category-paths.ts +20 -0
  19. package/src/charts/chart-state-panel.tsx +103 -0
  20. package/src/charts/chart.tsx +287 -0
  21. package/src/charts/index.ts +21 -0
  22. package/src/data-display/code-panel.tsx +67 -0
  23. package/src/data-display/data-table.tsx +180 -0
  24. package/src/data-display/description-list.tsx +24 -0
  25. package/src/data-display/index.ts +34 -0
  26. package/src/data-display/table-layout.ts +12 -0
  27. package/src/data-display/table.tsx +131 -0
  28. package/src/feedback/alert-panel-semantics.ts +75 -0
  29. package/src/feedback/alert-panel.tsx +187 -0
  30. package/src/feedback/index.ts +21 -0
  31. package/src/feedback/skeleton.tsx +16 -0
  32. package/src/forms/index.ts +73 -0
  33. package/src/forms/package-checkbox.tsx +50 -0
  34. package/src/forms/package-enum-select.tsx +185 -0
  35. package/src/forms/package-file-input.tsx +25 -0
  36. package/src/forms/package-form-field.tsx +202 -0
  37. package/src/forms/package-input.tsx +25 -0
  38. package/src/forms/package-native-select.tsx +25 -0
  39. package/src/forms/package-select.tsx +209 -0
  40. package/src/forms/package-textarea.tsx +35 -0
  41. package/src/forms/select-icons.tsx +35 -0
  42. package/src/graphs/graph-edge-path.ts +241 -0
  43. package/src/graphs/graph-edge.tsx +130 -0
  44. package/src/graphs/graph-interactive-example.tsx +187 -0
  45. package/src/graphs/graph-node-button.tsx +51 -0
  46. package/src/graphs/graph-node-handle-badge.tsx +108 -0
  47. package/src/graphs/graph-node-handle.ts +28 -0
  48. package/src/graphs/graph-node-shell.tsx +111 -0
  49. package/src/graphs/graph-node-state-indicator.tsx +47 -0
  50. package/src/graphs/graph-node-state.ts +111 -0
  51. package/src/graphs/graph-viewport-surface.tsx +27 -0
  52. package/src/graphs/index.ts +41 -0
  53. package/src/icons/index.ts +4 -0
  54. package/src/index.ts +209 -0
  55. package/src/layout/action-row.tsx +53 -0
  56. package/src/layout/index.ts +9 -0
  57. package/src/layout/surface-panel.tsx +91 -0
  58. package/src/navigation/index.ts +4 -0
  59. package/src/overlays/collapsible.tsx +22 -0
  60. package/src/overlays/dialog.tsx +148 -0
  61. package/src/overlays/index.ts +31 -0
  62. package/src/overlays/overlay-layout.ts +9 -0
  63. package/src/overlays/popover.tsx +29 -0
  64. package/src/overlays/scroll-area.tsx +78 -0
  65. package/src/primitives/button-link.tsx +22 -0
  66. package/src/primitives/button.tsx +258 -0
  67. package/src/primitives/icon-button-shell.tsx +49 -0
  68. package/src/primitives/index.ts +31 -0
  69. package/src/primitives/package-text.tsx +29 -0
  70. package/src/primitives/typography-roles.ts +12 -0
  71. package/src/primitives/typography.tsx +165 -0
  72. package/src/recipes/index.ts +61 -0
  73. package/src/recipes/widget-frame-content.tsx +114 -0
  74. package/src/recipes/widget-frame-disclosure.tsx +161 -0
  75. package/src/recipes/widget-frame-layout.ts +40 -0
  76. package/src/recipes/widget-frame-skeleton.tsx +16 -0
  77. package/src/recipes/widget-frame-states.tsx +99 -0
  78. package/src/recipes/widget-frame-typography.ts +19 -0
  79. package/src/recipes/widget-frame.tsx +84 -0
  80. package/src/styles/color-palette-presets.css +167 -0
  81. package/src/styles/color-role-tokens.css +163 -0
  82. package/src/styles/layout-role-tokens.css +27 -0
  83. package/src/styles/text-color-role-tokens.css +29 -0
  84. package/src/styles/typography-role-tokens.css +72 -0
  85. package/src/styles/typography-role-utilities.css +73 -0
  86. package/src/styles/typography-roles.css +53 -0
  87. package/src/styles.css +32 -0
  88. package/src/testing/index.ts +13 -0
  89. package/src/testing/render.tsx +16 -0
  90. package/src/tokens/index.ts +4 -0
  91. package/src/utilities/cn.ts +5 -0
  92. package/src/utilities/index.ts +6 -0
@@ -0,0 +1,414 @@
1
+ # Overlay and disclosure primitives
2
+
3
+ Domain-free Dialog, Popover, Collapsible, and ScrollArea primitives built on
4
+ Radix UI. Use these components when you need accessible overlays, disclosure
5
+ sections, and scrollable regions without importing dashboard features, generated
6
+ OpenAPI types, API clients, or app-specific providers.
7
+
8
+ ## Required setup
9
+
10
+ Import package styles once in your host application before rendering overlay
11
+ primitives:
12
+
13
+ ```css
14
+ @import "@you-agent-factory/components/styles.css";
15
+ ```
16
+
17
+ Overlay shells depend on package role tokens (`--color-surface`,
18
+ `--color-outline`, typography roles) and Tailwind utility classes compiled from
19
+ those tokens. They do not require dashboard `styles.css`, dashboard providers,
20
+ generated OpenAPI types, React Query, Zustand, or app localization context.
21
+
22
+ ## Import paths
23
+
24
+ Prefer the overlays category entrypoint for tree-shaking and explicit category
25
+ boundaries:
26
+
27
+ ```ts
28
+ import {
29
+ Dialog,
30
+ DialogClose,
31
+ DialogContent,
32
+ DialogDescription,
33
+ DialogFooter,
34
+ DialogHeader,
35
+ DialogTitle,
36
+ DialogTrigger,
37
+ Popover,
38
+ PopoverAnchor,
39
+ PopoverContent,
40
+ PopoverTrigger,
41
+ Collapsible,
42
+ CollapsibleContent,
43
+ CollapsibleTrigger,
44
+ ScrollArea,
45
+ ScrollBar,
46
+ } from "@you-agent-factory/components/overlays";
47
+ ```
48
+
49
+ The same exports are also available from the package root:
50
+
51
+ ```ts
52
+ import { Dialog, Popover, Collapsible, ScrollArea } from "@you-agent-factory/components";
53
+ ```
54
+
55
+ ## Host ownership
56
+
57
+ The package owns presentation markup, Radix wiring, focus guards, and default
58
+ layout spacing. Host applications own everything domain-specific:
59
+
60
+ | Concern | Owner |
61
+ | --- | --- |
62
+ | Dialog titles, descriptions, and body copy | Host |
63
+ | Popover trigger labels and panel content | Host |
64
+ | Collapsible trigger text and disclosed content | Host |
65
+ | Scroll region labels and scrollable content | Host |
66
+ | Open/closed boolean state when controlled | Host |
67
+ | Close button labels (`closeLabel` on `DialogContent`) | Host |
68
+ | Data fetching, routing, and business workflows | Host |
69
+
70
+ Pass copy, labels, ids, and state into overlay primitives as props and children.
71
+ Do not expect the package to read from your routers, stores, or API layers.
72
+
73
+ ## Composition overview
74
+
75
+ A typical dialog stacks:
76
+
77
+ 1. `Dialog` — root with optional `open` / `onOpenChange` for controlled state.
78
+ 2. `DialogTrigger` — host-provided trigger button or link.
79
+ 3. `DialogContent` — portaled panel with built-in overlay and close affordance.
80
+ 4. `DialogHeader`, `DialogTitle`, `DialogDescription`, and footer slots — host copy.
81
+
82
+ ```tsx
83
+ import { useState } from "react";
84
+ import {
85
+ Dialog,
86
+ DialogContent,
87
+ DialogDescription,
88
+ DialogHeader,
89
+ DialogTitle,
90
+ DialogTrigger,
91
+ } from "@you-agent-factory/components";
92
+
93
+ export function ConfirmActionDialog({
94
+ description,
95
+ title,
96
+ }: {
97
+ description: string;
98
+ title: string;
99
+ }) {
100
+ const [open, setOpen] = useState(false);
101
+
102
+ return (
103
+ <Dialog onOpenChange={setOpen} open={open}>
104
+ <DialogTrigger className="rounded-lg border border-outline px-4 py-2">
105
+ Open dialog
106
+ </DialogTrigger>
107
+ <DialogContent aria-describedby={undefined} closeLabel="Close dialog">
108
+ <DialogHeader>
109
+ <DialogTitle>{title}</DialogTitle>
110
+ <DialogDescription>{description}</DialogDescription>
111
+ </DialogHeader>
112
+ <p className="text-body-medium text-on-surface">
113
+ Host-provided dialog body copy.
114
+ </p>
115
+ </DialogContent>
116
+ </Dialog>
117
+ );
118
+ }
119
+ ```
120
+
121
+ Popover, collapsible, and scroll-area examples follow the same host-owned copy
122
+ pattern:
123
+
124
+ ```tsx
125
+ import {
126
+ Collapsible,
127
+ CollapsibleContent,
128
+ CollapsibleTrigger,
129
+ Popover,
130
+ PopoverContent,
131
+ PopoverTrigger,
132
+ ScrollArea,
133
+ } from "@you-agent-factory/components/overlays";
134
+
135
+ export function DisclosureAndScrollExample() {
136
+ return (
137
+ <div className="space-y-6">
138
+ <Popover>
139
+ <PopoverTrigger className="rounded-lg border border-outline px-4 py-2">
140
+ Open popover
141
+ </PopoverTrigger>
142
+ <PopoverContent aria-label="Host-provided popover label">
143
+ <p className="text-body-medium text-on-surface">
144
+ Host-provided popover content.
145
+ </p>
146
+ </PopoverContent>
147
+ </Popover>
148
+
149
+ <Collapsible className="w-72 rounded-2xl border border-outline p-3">
150
+ <CollapsibleTrigger className="w-full text-left">
151
+ Toggle details
152
+ </CollapsibleTrigger>
153
+ <CollapsibleContent className="pt-3 text-body-medium text-on-surface-variant">
154
+ Host-provided collapsible content.
155
+ </CollapsibleContent>
156
+ </Collapsible>
157
+
158
+ <ScrollArea
159
+ aria-label="Host-provided scroll region"
160
+ className="h-32 w-72 rounded-2xl border border-outline p-3"
161
+ >
162
+ <div className="space-y-3 text-body-medium text-on-surface">
163
+ <p>Scrollable host content.</p>
164
+ </div>
165
+ </ScrollArea>
166
+ </div>
167
+ );
168
+ }
169
+ ```
170
+
171
+ ## Accessible labels and naming
172
+
173
+ Every overlay surface needs an accessible name supplied by the host. The package
174
+ does not invent product copy.
175
+
176
+ ### Dialog
177
+
178
+ - Render `DialogTitle` for the required accessible name. Radix wires the title to
179
+ the dialog content region.
180
+ - Use `DialogDescription` when supplementary text helps screen-reader users
181
+ understand the dialog purpose. Omit it with `aria-describedby={undefined}` on
182
+ `DialogContent` when no description is needed.
183
+ - Pass `closeLabel` to `DialogContent` so the built-in close button exposes an
184
+ `aria-label` in the host locale.
185
+ - Triggers must have visible text or an `aria-label`.
186
+
187
+ ### Popover
188
+
189
+ - Popover panels are not modal dialogs. Give `PopoverContent` an accessible name
190
+ with `aria-label` or by including visible heading text inside the panel.
191
+ - Triggers must have visible text or an `aria-label`.
192
+ - Use `PopoverAnchor` when the visual anchor differs from the trigger element.
193
+
194
+ ### Collapsible
195
+
196
+ - `CollapsibleTrigger` must expose visible trigger text or `aria-label`.
197
+ - Radix reflects expanded/collapsed state through `aria-expanded` on the trigger.
198
+ - Nested collapsibles should use distinct trigger labels so users can tell
199
+ sections apart.
200
+
201
+ ### ScrollArea
202
+
203
+ - When the scroll region is meaningful on its own, pass `aria-label` or
204
+ `aria-labelledby` on `ScrollArea` pointing at host-visible labeling text.
205
+ - Focusable children inside the viewport remain keyboard reachable; do not
206
+ suppress focus outlines inside the scroll viewport.
207
+
208
+ ## Trigger and content relationships
209
+
210
+ | Primitive | Trigger | Content | Package behavior |
211
+ | --- | --- | --- | --- |
212
+ | Dialog | `DialogTrigger` opens the modal | `DialogContent` portals above the page | Focus moves into the dialog, is trapped while open, and returns to the trigger on close |
213
+ | Popover | `PopoverTrigger` toggles the popover | `PopoverContent` portals near the trigger | Focus stays in the popover while open; outside interaction dismisses |
214
+ | Collapsible | `CollapsibleTrigger` toggles disclosure | `CollapsibleContent` expands inline | Trigger `aria-expanded` mirrors open state |
215
+ | ScrollArea | No separate trigger | Children scroll inside the viewport | Viewport keeps native scrolling and focus visibility |
216
+
217
+ Host apps choose trigger elements, placement classes, and panel children. The
218
+ package wires Radix primitives and default shell styling only.
219
+
220
+ ## Focus, Escape, and controlled open state
221
+
222
+ ### Dialog
223
+
224
+ - Opens from its trigger, moves focus into the dialog, and traps focus while
225
+ open.
226
+ - Closes on Escape and returns focus to the trigger.
227
+ - Supports controlled usage with `open` and `onOpenChange` on `Dialog`, or
228
+ uncontrolled usage with `defaultOpen`.
229
+
230
+ ### Popover
231
+
232
+ - Opens from its trigger and supports controlled `open` / `onOpenChange`.
233
+ - Closes on Escape and outside interaction.
234
+ - Returns focus to the trigger or another sensible host-provided target after
235
+ dismiss.
236
+
237
+ ### Collapsible
238
+
239
+ - Toggles from keyboard activation on `CollapsibleTrigger` (Enter/Space).
240
+ - Supports controlled `open` / `onOpenChange` or uncontrolled `defaultOpen`.
241
+ - Exposes expanded/collapsed state to assistive technology through Radix trigger
242
+ semantics.
243
+
244
+ ### ScrollArea
245
+
246
+ - Remains keyboard reachable when it contains focusable or scrollable content.
247
+ - Preserves focus outlines inside the viewport (`outline-none` applies to the
248
+ viewport shell, not to focusable descendants).
249
+
250
+ Use controlled open state when multiple host controls need to open, close, or
251
+ reflect the same overlay. Use uncontrolled state for simple trigger-only flows.
252
+
253
+ ## Mobile sizing and overflow guidance
254
+
255
+ Long host content must stay reachable without forcing horizontal page overflow.
256
+
257
+ ### Dialog
258
+
259
+ - `DialogContent` uses `max-h-dvh`, horizontal inset padding, and `overflow-y-auto`
260
+ so tall content scrolls inside the dialog shell.
261
+ - Keep body copy in a single column. Avoid fixed widths wider than the viewport.
262
+ - Review the `MobileViewport` Storybook story before shipping long forms or dense
263
+ tables inside dialogs.
264
+
265
+ ### Popover
266
+
267
+ - Default `PopoverContent` width is responsive (`w-72` / `sm:w-80`). Add
268
+ `max-h-*` and `overflow-y-auto` for long panels.
269
+ - Use `collisionPadding`, `side`, and `align` props when placing popovers near
270
+ viewport edges so content stays on screen.
271
+
272
+ ### Collapsible
273
+
274
+ - Disclosed content expands inline. Constrain width with host layout classes and
275
+ avoid unbreakable horizontal content inside narrow panels.
276
+
277
+ ### ScrollArea
278
+
279
+ - Set explicit `className` height/width bounds on `ScrollArea` so overflow is
280
+ obvious.
281
+ - Add `ScrollBar` with `orientation="horizontal"` only when horizontal scrolling
282
+ is intentional.
283
+ - Use `viewportClassName` or `viewportProps` when the host needs additional
284
+ viewport semantics.
285
+
286
+ ## Key props
287
+
288
+ ### `DialogContent`
289
+
290
+ | Prop | Purpose |
291
+ | --- | --- |
292
+ | `closeLabel` | Accessible name for the built-in close button. Defaults to `"Close"`. |
293
+ | `closeDisabled` | Renders a disabled close affordance without dismiss behavior. |
294
+ | `className` | Host layout overrides on the portaled panel. |
295
+
296
+ ### `PopoverContent`
297
+
298
+ | Prop | Purpose |
299
+ | --- | --- |
300
+ | `align` / `side` / `sideOffset` | Placement relative to the trigger. |
301
+ | `collisionPadding` | Keeps content inside the viewport near screen edges. |
302
+ | `className` | Host sizing and overflow classes (`max-h-*`, `overflow-y-auto`). |
303
+
304
+ ### `Collapsible`
305
+
306
+ | Prop | Purpose |
307
+ | --- | --- |
308
+ | `open` / `onOpenChange` | Controlled disclosure state. |
309
+ | `defaultOpen` | Initial state for uncontrolled usage. |
310
+
311
+ ### `ScrollArea`
312
+
313
+ | Prop | Purpose |
314
+ | --- | --- |
315
+ | `viewportClassName` / `viewportProps` | Host viewport overrides. |
316
+ | `type` | Radix scrollbar visibility (`auto`, `always`, `scroll`, `hover`). |
317
+ | `aria-label` / `aria-labelledby` | Host-provided region labeling. |
318
+
319
+ Layout helpers exported from the overlays category:
320
+
321
+ - `OVERLAY_DIALOG_CONTENT_SHELL_CLASS` — default dialog content padding shell.
322
+ - `OVERLAY_DIALOG_BODY_CLASS` — body spacing helper for dialog children.
323
+ - `OVERLAY_FORM_GROUP_CLASS` — header/footer grouping spacing.
324
+
325
+ ## Accessibility expectations
326
+
327
+ - Dialogs require a `DialogTitle` or equivalent `aria-labelledby` relationship.
328
+ - Popover panels need host-provided names via `aria-label` or visible headings.
329
+ - Collapsible triggers must be keyboard operable buttons or links with visible
330
+ text or `aria-label`.
331
+ - Scroll regions that organize distinct content need host-provided
332
+ `aria-label` / `aria-labelledby`.
333
+ - Do not remove focus outlines from interactive children inside overlays.
334
+ - Icon-only triggers and close buttons must include `aria-label`.
335
+ - Controlled open state does not remove the host responsibility to supply
336
+ accessible names and trigger text.
337
+
338
+ ## Storybook visual reference
339
+
340
+ Package Storybook lives under `Overlays/*`. Stories use package imports and
341
+ package token decorators only — no dashboard providers.
342
+
343
+ | Component | Story | Storybook id | Demonstrates |
344
+ | --- | --- | --- | --- |
345
+ | Dialog | Default | `overlays-dialog--default` | Baseline dialog render |
346
+ | Dialog | Long content | `overlays-dialog--long-content` | Vertical overflow inside the shell |
347
+ | Dialog | Controlled open | `overlays-dialog--controlled-open` | Host-controlled `open` state |
348
+ | Dialog | Escape close | `overlays-dialog--escape-close` | Escape dismiss and focus return |
349
+ | Dialog | Mobile viewport | `overlays-dialog--mobile-viewport` | Narrow viewport reachability |
350
+ | Dialog | Keyboard focus | `overlays-dialog--keyboard-focus` | Focus trap and keyboard operation |
351
+ | Popover | Default | `overlays-popover--default` | Baseline popover render |
352
+ | Popover | Long content | `overlays-popover--long-content` | Scrollable popover panel |
353
+ | Popover | Controlled open | `overlays-popover--controlled-open` | Host-controlled `open` state |
354
+ | Popover | Keyboard open | `overlays-popover--keyboard-open` | Keyboard trigger activation |
355
+ | Popover | Viewport placement | `overlays-popover--viewport-placement` | Collision-safe edge placement |
356
+ | Popover | Keyboard focus | `overlays-popover--keyboard-focus` | Focus and dismiss behavior |
357
+ | Collapsible | Default | `overlays-collapsible--default` | Baseline disclosure |
358
+ | Collapsible | Open | `overlays-collapsible--open` | Expanded default state |
359
+ | Collapsible | Controlled | `overlays-collapsible--controlled` | Host-controlled disclosure |
360
+ | Collapsible | Nested content | `overlays-collapsible--nested-content` | Nested disclosure sections |
361
+ | Collapsible | Keyboard focus | `overlays-collapsible--keyboard-focus` | Keyboard toggle |
362
+ | ScrollArea | Default | `overlays-scroll-area--default` | Vertical overflow scrolling |
363
+ | ScrollArea | Horizontal overflow | `overlays-scroll-area--horizontal-overflow` | Intentional horizontal scroll |
364
+ | ScrollArea | Keyboard focus | `overlays-scroll-area--keyboard-focus` | Nested focus reachability |
365
+ | ScrollArea | Mobile width | `overlays-scroll-area--mobile-width` | Narrow viewport scrolling |
366
+
367
+ Run package Storybook locally:
368
+
369
+ ```bash
370
+ cd ui/packages/components
371
+ bun run storybook
372
+ ```
373
+
374
+ Browser verification for overlay stories:
375
+
376
+ ```bash
377
+ cd ui/packages/components
378
+ bun run verify:storybook-browser
379
+ ```
380
+
381
+ ## Allowed dependencies
382
+
383
+ Overlay source may import:
384
+
385
+ - Package utilities (`cn` from `@you-agent-factory/components/utilities`)
386
+ - Package layout helpers from `overlay-layout.ts`
387
+ - Radix overlay primitives (`@radix-ui/react-dialog`, `react-popover`,
388
+ `react-collapsible`, `react-scroll-area`)
389
+ - Package token CSS via the host `styles.css` import
390
+ - React and `react-dom` peer dependencies
391
+
392
+ Overlay source must **not** import:
393
+
394
+ - Dashboard feature modules, routes, or providers
395
+ - Generated OpenAPI clients or dashboard API adapters
396
+ - React Query, Zustand, Monaco, Sonner, or dashboard i18n/session providers
397
+ - Factory/work/session/provider domain types
398
+
399
+ `check:package-boundary` enforces these rules in CI.
400
+
401
+ ## Source-copy guidance
402
+
403
+ Teams may copy overlay files into a host repository to customize markup while
404
+ keeping the same token foundation:
405
+
406
+ 1. Import `@you-agent-factory/components/styles.css` in the host app.
407
+ 2. Copy only the overlay files you need from `src/overlays/`.
408
+ 3. Keep copied code on the package side of your boundary — do not pull dashboard
409
+ modules into copied overlay files.
410
+ 4. Retain host ownership of labels, trigger text, open state, and overflow-safe
411
+ content.
412
+
413
+ **No source-copy CLI or generator ships with this package.** Copy-and-adapt
414
+ workflows are manual and maintained by the host application.