@you-agent-factory/components 0.0.0 → 0.0.2

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 (182) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +38 -7
  3. package/dist/category-paths.d.ts +3 -0
  4. package/dist/charts/chart-state-panel.d.ts +11 -0
  5. package/dist/charts/chart.d.ts +35 -0
  6. package/dist/charts/index.d.ts +5 -0
  7. package/dist/charts/index.js +287 -0
  8. package/dist/chunks/action-row.js +39 -0
  9. package/dist/chunks/alert-panel.js +182 -0
  10. package/dist/chunks/button.js +193 -0
  11. package/dist/chunks/cn.js +6 -0
  12. package/dist/chunks/factory-emulator-controls.js +123 -0
  13. package/dist/chunks/package-form-field.js +546 -0
  14. package/dist/chunks/scroll-area.js +261 -0
  15. package/dist/chunks/surface-panel.js +73 -0
  16. package/dist/chunks/table-layout.js +292 -0
  17. package/dist/chunks/typography-roles.js +26 -0
  18. package/dist/chunks/typography.js +129 -0
  19. package/dist/chunks/widget-frame.js +344 -0
  20. package/dist/data-display/code-panel.d.ts +12 -0
  21. package/dist/data-display/data-table.d.ts +27 -0
  22. package/dist/data-display/description-list.d.ts +4 -0
  23. package/{src/data-display/index.ts → dist/data-display/index.d.ts} +4 -26
  24. package/dist/data-display/index.js +20 -0
  25. package/dist/data-display/table-layout.d.ts +8 -0
  26. package/dist/data-display/table.d.ts +14 -0
  27. package/dist/factory-emulator/factory-emulator-controls.d.ts +23 -0
  28. package/dist/factory-emulator/index.d.ts +6 -0
  29. package/dist/factory-emulator/index.js +6 -0
  30. package/dist/feedback/alert-panel-semantics.d.ts +11 -0
  31. package/dist/feedback/alert-panel.d.ts +29 -0
  32. package/dist/feedback/index.d.ts +6 -0
  33. package/dist/feedback/index.js +10 -0
  34. package/dist/feedback/skeleton.d.ts +2 -0
  35. package/dist/forms/index.d.ts +19 -0
  36. package/dist/forms/index.js +37 -0
  37. package/dist/forms/package-checkbox.d.ts +3 -0
  38. package/dist/forms/package-enum-select.d.ts +42 -0
  39. package/dist/forms/package-file-input.d.ts +3 -0
  40. package/dist/forms/package-form-field.d.ts +49 -0
  41. package/dist/forms/package-input.d.ts +6 -0
  42. package/dist/forms/package-native-select.d.ts +3 -0
  43. package/dist/forms/package-select.d.ts +32 -0
  44. package/dist/forms/package-textarea.d.ts +10 -0
  45. package/dist/forms/select-icons.d.ts +3 -0
  46. package/dist/graphs/graph-edge-path.d.ts +18 -0
  47. package/dist/graphs/graph-edge.d.ts +15 -0
  48. package/dist/graphs/graph-node-button.d.ts +11 -0
  49. package/dist/graphs/graph-node-handle-badge.d.ts +5 -0
  50. package/dist/graphs/graph-node-handle.d.ts +18 -0
  51. package/dist/graphs/graph-node-shell.d.ts +13 -0
  52. package/dist/graphs/graph-node-state-indicator.d.ts +6 -0
  53. package/dist/graphs/graph-node-state.d.ts +23 -0
  54. package/dist/graphs/graph-viewport-surface.d.ts +5 -0
  55. package/dist/graphs/index.d.ts +13 -0
  56. package/dist/graphs/index.js +614 -0
  57. package/{src/icons/index.ts → dist/icons/index.d.ts} +1 -2
  58. package/dist/icons/index.js +4 -0
  59. package/dist/index.d.ts +26 -0
  60. package/dist/index.js +145 -0
  61. package/dist/layout/action-row.d.ts +8 -0
  62. package/{src/layout/index.ts → dist/layout/index.d.ts} +1 -3
  63. package/dist/layout/index.js +9 -0
  64. package/dist/layout/surface-panel.d.ts +15 -0
  65. package/{src/navigation/index.ts → dist/navigation/index.d.ts} +1 -2
  66. package/dist/navigation/index.js +4 -0
  67. package/dist/overlays/collapsible.d.ts +5 -0
  68. package/dist/overlays/dialog.d.ts +16 -0
  69. package/dist/overlays/index.d.ts +10 -0
  70. package/dist/overlays/index.js +27 -0
  71. package/dist/overlays/overlay-layout.d.ts +6 -0
  72. package/dist/overlays/popover.d.ts +6 -0
  73. package/dist/overlays/scroll-area.d.ts +9 -0
  74. package/dist/primitives/button-link.d.ts +5 -0
  75. package/dist/primitives/button.d.ts +9 -0
  76. package/dist/primitives/icon-button-shell.d.ts +10 -0
  77. package/{src/primitives/index.ts → dist/primitives/index.d.ts} +2 -19
  78. package/dist/primitives/index.js +49 -0
  79. package/dist/primitives/package-text.d.ts +6 -0
  80. package/dist/primitives/typography-roles.d.ts +12 -0
  81. package/dist/primitives/typography.d.ts +36 -0
  82. package/dist/recipes/index.d.ts +14 -0
  83. package/dist/recipes/index.js +32 -0
  84. package/dist/recipes/widget-frame-content.d.ts +24 -0
  85. package/dist/recipes/widget-frame-disclosure.d.ts +33 -0
  86. package/dist/recipes/widget-frame-layout.d.ts +12 -0
  87. package/dist/recipes/widget-frame-skeleton.d.ts +2 -0
  88. package/dist/recipes/widget-frame-states.d.ts +15 -0
  89. package/dist/recipes/widget-frame-typography.d.ts +10 -0
  90. package/dist/recipes/widget-frame.d.ts +12 -0
  91. package/{src → dist}/styles.css +36 -0
  92. package/dist/testing/index.d.ts +4 -0
  93. package/dist/testing/index.js +16 -0
  94. package/dist/testing/render.d.ts +5 -0
  95. package/{src/tokens/index.ts → dist/tokens/index.d.ts} +1 -2
  96. package/dist/tokens/index.js +4 -0
  97. package/dist/utilities/cn.d.ts +1 -0
  98. package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -3
  99. package/dist/utilities/index.js +6 -0
  100. package/package.json +65 -64
  101. package/docs/README.md +0 -83
  102. package/docs/button.md +0 -119
  103. package/docs/charts.md +0 -325
  104. package/docs/data-display-code-panel.md +0 -120
  105. package/docs/feedback-alert-panel.md +0 -117
  106. package/docs/feedback-skeleton.md +0 -54
  107. package/docs/forms-form-field.md +0 -490
  108. package/docs/forms-input-primitives.md +0 -311
  109. package/docs/forms-select-primitives.md +0 -362
  110. package/docs/graphs.md +0 -250
  111. package/docs/layout-display-primitives.md +0 -211
  112. package/docs/overlays.md +0 -414
  113. package/docs/table-data-table.md +0 -331
  114. package/docs/typography-roles.md +0 -182
  115. package/docs/widget-frame-recipes.md +0 -273
  116. package/src/category-paths.ts +0 -20
  117. package/src/charts/chart-state-panel.tsx +0 -103
  118. package/src/charts/chart.tsx +0 -287
  119. package/src/charts/index.ts +0 -21
  120. package/src/data-display/code-panel.tsx +0 -67
  121. package/src/data-display/data-table.tsx +0 -180
  122. package/src/data-display/description-list.tsx +0 -24
  123. package/src/data-display/table-layout.ts +0 -12
  124. package/src/data-display/table.tsx +0 -131
  125. package/src/feedback/alert-panel-semantics.ts +0 -75
  126. package/src/feedback/alert-panel.tsx +0 -187
  127. package/src/feedback/index.ts +0 -21
  128. package/src/feedback/skeleton.tsx +0 -16
  129. package/src/forms/index.ts +0 -73
  130. package/src/forms/package-checkbox.tsx +0 -50
  131. package/src/forms/package-enum-select.tsx +0 -185
  132. package/src/forms/package-file-input.tsx +0 -25
  133. package/src/forms/package-form-field.tsx +0 -202
  134. package/src/forms/package-input.tsx +0 -25
  135. package/src/forms/package-native-select.tsx +0 -25
  136. package/src/forms/package-select.tsx +0 -209
  137. package/src/forms/package-textarea.tsx +0 -35
  138. package/src/forms/select-icons.tsx +0 -35
  139. package/src/graphs/graph-edge-path.ts +0 -241
  140. package/src/graphs/graph-edge.tsx +0 -130
  141. package/src/graphs/graph-interactive-example.tsx +0 -187
  142. package/src/graphs/graph-node-button.tsx +0 -51
  143. package/src/graphs/graph-node-handle-badge.tsx +0 -108
  144. package/src/graphs/graph-node-handle.ts +0 -28
  145. package/src/graphs/graph-node-shell.tsx +0 -111
  146. package/src/graphs/graph-node-state-indicator.tsx +0 -47
  147. package/src/graphs/graph-node-state.ts +0 -111
  148. package/src/graphs/graph-viewport-surface.tsx +0 -27
  149. package/src/graphs/index.ts +0 -41
  150. package/src/index.ts +0 -209
  151. package/src/layout/action-row.tsx +0 -53
  152. package/src/layout/surface-panel.tsx +0 -91
  153. package/src/overlays/collapsible.tsx +0 -22
  154. package/src/overlays/dialog.tsx +0 -148
  155. package/src/overlays/index.ts +0 -31
  156. package/src/overlays/overlay-layout.ts +0 -9
  157. package/src/overlays/popover.tsx +0 -29
  158. package/src/overlays/scroll-area.tsx +0 -78
  159. package/src/primitives/button-link.tsx +0 -22
  160. package/src/primitives/button.tsx +0 -258
  161. package/src/primitives/icon-button-shell.tsx +0 -49
  162. package/src/primitives/package-text.tsx +0 -29
  163. package/src/primitives/typography-roles.ts +0 -12
  164. package/src/primitives/typography.tsx +0 -165
  165. package/src/recipes/index.ts +0 -61
  166. package/src/recipes/widget-frame-content.tsx +0 -114
  167. package/src/recipes/widget-frame-disclosure.tsx +0 -161
  168. package/src/recipes/widget-frame-layout.ts +0 -40
  169. package/src/recipes/widget-frame-skeleton.tsx +0 -16
  170. package/src/recipes/widget-frame-states.tsx +0 -99
  171. package/src/recipes/widget-frame-typography.ts +0 -19
  172. package/src/recipes/widget-frame.tsx +0 -84
  173. package/src/testing/index.ts +0 -13
  174. package/src/testing/render.tsx +0 -16
  175. package/src/utilities/cn.ts +0 -5
  176. /package/{src → dist}/styles/color-palette-presets.css +0 -0
  177. /package/{src → dist}/styles/color-role-tokens.css +0 -0
  178. /package/{src → dist}/styles/layout-role-tokens.css +0 -0
  179. /package/{src → dist}/styles/text-color-role-tokens.css +0 -0
  180. /package/{src → dist}/styles/typography-role-tokens.css +0 -0
  181. /package/{src → dist}/styles/typography-role-utilities.css +0 -0
  182. /package/{src → dist}/styles/typography-roles.css +0 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-2026 Andreas Abdi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,6 +4,10 @@ Presentation components, shared design tokens, and small utilities for building
4
4
  factory-style UIs outside the dashboard. The package is domain-free: it does not
5
5
  ship data fetching, durable state, business workflows, or product copy.
6
6
 
7
+ See the [public package family guide](https://github.com/portpowered/you-agent-factory/blob/main/ui/packages/README.md)
8
+ for this presentation layer's position beneath the controlled Factory
9
+ visualizers and for the full execution/host ownership boundary.
10
+
7
11
  ## Install and workspace setup
8
12
 
9
13
  Add the package to your application dependencies. In this monorepo the dashboard
@@ -25,9 +29,9 @@ Peer dependencies:
25
29
  - `react` ^19.0.0
26
30
  - `react-dom` ^19.0.0
27
31
 
28
- Some category entrypoints (for example charts and graphs) also require the
29
- package's direct dependencies (`recharts`, `@xyflow/react`). Install those in
30
- the host app when you import those categories.
32
+ Runtime libraries used by category entrypoints (for example `recharts`,
33
+ `@xyflow/react`, and Radix UI) are installed as direct package dependencies.
34
+ Hosts only need to provide compatible React and React DOM peers.
31
35
 
32
36
  ## Import package styles
33
37
 
@@ -66,7 +70,8 @@ import { cn } from "@you-agent-factory/components/utilities";
66
70
  `COMPONENTS_PACKAGE_NAME` is the stable package identifier
67
71
  (`"@you-agent-factory/components"`). Category paths include `primitives`, `forms`,
68
72
  `layout`, `feedback`, `data-display`, `navigation`, `overlays`, `charts`,
69
- `graphs`, `recipes`, `icons`, `utilities`, `testing`, and `tokens`.
73
+ `factory-emulator`, `graphs`, `recipes`, `icons`, `utilities`, `testing`, and
74
+ `tokens`.
70
75
 
71
76
  Use `cn` from `@you-agent-factory/components/utilities` for class name composition
72
77
  in component code instead of dashboard-local helpers.
@@ -163,6 +168,8 @@ route, generated registry, or additional build-time documentation tooling.
163
168
 
164
169
  - [Charts](./docs/charts.md) — config, presentation, tooltip and legend,
165
170
  state panels, and caller-owned series state
171
+ - [Factory emulator controls](./docs/factory-emulator.md) — controlled playback,
172
+ speed, and host-owned runtime status
166
173
 
167
174
  ## Development
168
175
 
@@ -171,6 +178,9 @@ From `ui/packages/components`:
171
178
  ```bash
172
179
  bun run typecheck
173
180
  bun run test
181
+ bun run test:build
182
+ bun run check:pack
183
+ bun run check:installed-consumer
174
184
  bun run check:package-boundary
175
185
  bun run check:package-dependency-direction
176
186
  bun run build-storybook
@@ -182,6 +192,22 @@ for DOM cleanup, accessible assertions, and user interactions. They do not
182
192
  require dashboard routes, providers, generated clients, API mocks, React
183
193
  Query, Zustand, Monaco, or Sonner.
184
194
 
195
+ `check:pack` performs a clean production build, creates the registry-format
196
+ tarball in a temporary directory, and validates npm's reported file inventory.
197
+ It checks every manifest export and transitive local stylesheet or asset
198
+ reference, rejects development-only files, and removes the temporary artifact
199
+ after verification. `test:build` covers both the compiled output and this real
200
+ pack flow, including actionable failure diagnostics.
201
+
202
+ `check:installed-consumer` installs that registry-format tarball and compatible
203
+ React peers into a new temporary npm application, then typechecks and creates a
204
+ Vite production bundle without workspace links, source aliases, or package
205
+ source files. Chromium loads only the built consumer output at mobile and
206
+ desktop viewports and verifies package styles, representative primitive,
207
+ feedback, chart, and graph rendering, keyboard activation and focus, accessible
208
+ state semantics, the shared React runtime, and page-level overflow. The check
209
+ removes its temporary install and closes its verification server on exit.
210
+
185
211
  Package Storybook lives in `.storybook/` and discovers `src/**/*.stories.tsx`
186
212
  files. Preview decorators import the package token fixture stylesheet and
187
213
  apply `data-color-palette` locally; they do not mount dashboard session,
@@ -206,14 +232,19 @@ make ui-components-test
206
232
  make ui-components-storybook
207
233
  make ui-components-boundary
208
234
  make ui-components-dependency-direction
235
+ make ui-components-build
236
+ make ui-components-pack
237
+ make ui-components-installed-consumer
209
238
  make ui-components-verify
210
239
  make ui-lint
211
240
  ```
212
241
 
213
242
  `make ui-components-verify` runs the full component package harness with labeled
214
- failure output for typecheck, tests, Storybook build, boundary checks, and
215
- dependency-direction checks. CI runs the same harness in the Build, Lint, and API
216
- workflow after dashboard lint.
243
+ failure output. It creates the production build first so package self-imports
244
+ resolve on a clean checkout, then runs typecheck, tests, Storybook build,
245
+ boundary checks, dependency-direction checks, registry-pack inventory, and the
246
+ clean installed-consumer smoke. CI installs Chromium and runs the same harness
247
+ in the Lint workflow after dashboard lint.
217
248
 
218
249
  From the `ui` workspace root:
219
250
 
@@ -0,0 +1,3 @@
1
+ /** Planned deep import paths for `@you-agent-factory/components` category entrypoints. */
2
+ export declare const COMPONENT_CATEGORY_EXPORT_PATHS: readonly ["primitives", "forms", "layout", "feedback", "data-display", "navigation", "overlays", "charts", "factory-emulator", "graphs", "recipes", "icons", "utilities", "testing", "tokens"];
3
+ export type ComponentCategoryExportPath = (typeof COMPONENT_CATEGORY_EXPORT_PATHS)[number];
@@ -0,0 +1,11 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ import type { ChartPresentation } from "./chart";
3
+ export type ChartStateStatus = "empty" | "error" | "loading" | "success";
4
+ export interface ChartStatePanelProps extends HTMLAttributes<HTMLDivElement> {
5
+ action?: ReactNode;
6
+ description: string;
7
+ presentation?: ChartPresentation;
8
+ status: ChartStateStatus;
9
+ title: string;
10
+ }
11
+ export declare function ChartStatePanel({ action, className, description, presentation, status, title, ...props }: ChartStatePanelProps): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import type { CSSProperties, HTMLAttributes, ReactNode } from "react";
2
+ import { Tooltip as RechartsTooltip, type TooltipContentProps } from "recharts";
3
+ import type { Props as RechartsLegendContentProps } from "recharts/types/component/DefaultLegendContent";
4
+ import type { NameType, ValueType } from "recharts/types/component/DefaultTooltipContent";
5
+ export interface ChartConfigEntry {
6
+ color: string;
7
+ label: string;
8
+ }
9
+ export type ChartConfig = Record<string, ChartConfigEntry>;
10
+ export type ChartPresentation = "embedded" | "standalone";
11
+ export declare function ChartContainer({ children, className, config, footer, interactionAttributes, overlay, presentation, rootAttributes, style, title, }: {
12
+ children: ReactNode;
13
+ className?: string;
14
+ config: ChartConfig;
15
+ footer?: ReactNode;
16
+ interactionAttributes?: HTMLAttributes<HTMLDivElement>;
17
+ overlay?: ReactNode;
18
+ presentation?: ChartPresentation;
19
+ rootAttributes?: Record<string, string>;
20
+ style?: CSSProperties;
21
+ title: string;
22
+ }): import("react").JSX.Element;
23
+ export declare const ChartTooltip: typeof RechartsTooltip;
24
+ export declare const ChartLegend: import("react").MemoExoticComponent<(outsideProps: import("recharts").LegendProps) => React.ReactPortal | null>;
25
+ export declare function ChartTooltipContent({ active, className, label, payload, }: TooltipContentProps<ValueType, NameType> & {
26
+ className?: string;
27
+ }): import("react").JSX.Element | null;
28
+ export declare function ChartLegendContent({ className, getToggleLabel, hiddenSeries, itemClassName, onToggleSeries, payload, swatchClassName, }: RechartsLegendContentProps & {
29
+ className?: string;
30
+ getToggleLabel?: (label: string, hidden: boolean) => string;
31
+ hiddenSeries?: ReadonlySet<string>;
32
+ itemClassName?: string;
33
+ onToggleSeries?: (key: string) => void;
34
+ swatchClassName?: string;
35
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ /** Stable category path for `@you-agent-factory/components/charts`. */
2
+ export declare const COMPONENTS_CATEGORY: "charts";
3
+ export type ComponentsCategory = typeof COMPONENTS_CATEGORY;
4
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, type ChartConfig, type ChartConfigEntry, type ChartPresentation, } from "./chart";
5
+ export { ChartStatePanel, type ChartStatePanelProps, type ChartStateStatus, } from "./chart-state-panel";
@@ -0,0 +1,287 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ import { Legend, Tooltip, ResponsiveContainer } from "recharts";
4
+ import { c as cn } from "../chunks/cn.js";
5
+ const ChartContext = createContext(null);
6
+ const CHART_CONTAINER_STANDALONE_CLASS = "relative h-[18rem] rounded-2xl border border-outline bg-surface-container-low p-4 text-on-surface";
7
+ const CHART_CONTAINER_EMBEDDED_CLASS = "relative flex h-full min-h-0 min-w-0 w-full flex-1 flex-col text-on-surface";
8
+ const DEFAULT_CHART_INITIAL_DIMENSION = { height: 288, width: 640 };
9
+ const CHART_LEGEND_BUTTON_CLASS = "inline-flex min-h-0 items-center justify-center rounded-md border border-transparent bg-transparent px-0 py-1 text-left text-xs font-normal text-on-surface-variant focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-af-focus";
10
+ function chartContainerClassName(presentation, className) {
11
+ return cn(
12
+ presentation === "embedded" ? CHART_CONTAINER_EMBEDDED_CLASS : CHART_CONTAINER_STANDALONE_CLASS,
13
+ className
14
+ );
15
+ }
16
+ function useChartConfig() {
17
+ const context = useContext(ChartContext);
18
+ if (context === null) {
19
+ throw new Error("Chart components must be rendered inside ChartContainer.");
20
+ }
21
+ return context;
22
+ }
23
+ function ChartContainer({
24
+ children,
25
+ className,
26
+ config,
27
+ footer,
28
+ interactionAttributes,
29
+ overlay,
30
+ presentation = "standalone",
31
+ rootAttributes,
32
+ style,
33
+ title
34
+ }) {
35
+ const chartSurface = /* @__PURE__ */ jsx(
36
+ ResponsiveContainer,
37
+ {
38
+ height: "100%",
39
+ initialDimension: DEFAULT_CHART_INITIAL_DIMENSION,
40
+ minHeight: 0,
41
+ minWidth: 0,
42
+ width: "100%",
43
+ children
44
+ }
45
+ );
46
+ return /* @__PURE__ */ jsx(ChartContext.Provider, { value: config, children: /* @__PURE__ */ jsxs(
47
+ "div",
48
+ {
49
+ "aria-label": title,
50
+ className: chartContainerClassName(presentation, className),
51
+ "data-chart-container": "",
52
+ "data-chart-presentation": presentation,
53
+ role: "img",
54
+ ...interactionAttributes,
55
+ ...rootAttributes,
56
+ style: {
57
+ ...Object.fromEntries(
58
+ Object.entries(config).map(([key, value]) => [
59
+ `--color-${key}`,
60
+ value.color
61
+ ])
62
+ ),
63
+ ...style
64
+ },
65
+ children: [
66
+ overlay ? /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0", children: overlay }) : null,
67
+ footer ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 basis-0 flex-col", children: [
68
+ /* @__PURE__ */ jsx("div", { className: "h-full min-h-0 flex-1 basis-0", children: chartSurface }),
69
+ footer
70
+ ] }) : chartSurface
71
+ ]
72
+ }
73
+ ) });
74
+ }
75
+ const ChartTooltip = Tooltip;
76
+ const ChartLegend = Legend;
77
+ function ChartTooltipContent({
78
+ active,
79
+ className,
80
+ label,
81
+ payload
82
+ }) {
83
+ const config = useChartConfig();
84
+ if (!active || !payload?.length) {
85
+ return null;
86
+ }
87
+ return /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ className: cn(
91
+ "grid min-w-40 gap-2 rounded-xl border border-outline bg-surface-container-high px-3 py-2 text-sm shadow-af-card",
92
+ className
93
+ ),
94
+ children: [
95
+ /* @__PURE__ */ jsx("p", { className: "m-0 font-semibold text-on-surface", children: String(label) }),
96
+ /* @__PURE__ */ jsx("div", { className: "grid gap-1", children: payload.map((entry) => {
97
+ const key = entry.dataKey?.toString() ?? "";
98
+ const item = config[key];
99
+ return /* @__PURE__ */ jsxs(
100
+ "div",
101
+ {
102
+ className: "flex items-center justify-between gap-3 text-on-surface-variant",
103
+ children: [
104
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
105
+ /* @__PURE__ */ jsx(
106
+ "span",
107
+ {
108
+ className: "h-2.5 w-2.5 rounded-full",
109
+ style: {
110
+ backgroundColor: item?.color ?? entry.color ?? "currentColor"
111
+ }
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsx("span", { children: item?.label ?? key })
115
+ ] }),
116
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-on-surface", children: entry.value })
117
+ ]
118
+ },
119
+ key
120
+ );
121
+ }) })
122
+ ]
123
+ }
124
+ );
125
+ }
126
+ function ChartLegendContent({
127
+ className,
128
+ getToggleLabel,
129
+ hiddenSeries = /* @__PURE__ */ new Set(),
130
+ itemClassName,
131
+ onToggleSeries,
132
+ payload,
133
+ swatchClassName
134
+ }) {
135
+ const config = useChartConfig();
136
+ if (!payload?.length) {
137
+ return null;
138
+ }
139
+ const stopChartInteraction = (event) => {
140
+ event.stopPropagation();
141
+ };
142
+ return /* @__PURE__ */ jsx(
143
+ "div",
144
+ {
145
+ className: cn(
146
+ "flex flex-wrap items-center gap-4 pt-3 text-xs text-on-surface-variant",
147
+ className
148
+ ),
149
+ children: payload.map((entry) => {
150
+ const key = entry.dataKey?.toString() ?? "";
151
+ const item = config[key];
152
+ const label = item?.label ?? key;
153
+ const hidden = hiddenSeries.has(key);
154
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
155
+ /* @__PURE__ */ jsx(
156
+ "span",
157
+ {
158
+ "aria-hidden": "true",
159
+ className: cn(
160
+ "rounded-full",
161
+ swatchClassName ?? "h-2.5 w-2.5",
162
+ hidden ? "border border-outline bg-surface-container-low" : ""
163
+ ),
164
+ style: {
165
+ backgroundColor: hidden ? void 0 : item?.color ?? entry.color ?? "currentColor"
166
+ }
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsx("span", { children: label })
170
+ ] });
171
+ if (!onToggleSeries) {
172
+ return /* @__PURE__ */ jsx(
173
+ "div",
174
+ {
175
+ className: cn("flex items-center gap-2", itemClassName),
176
+ children: content
177
+ },
178
+ key
179
+ );
180
+ }
181
+ return /* @__PURE__ */ jsx(
182
+ "button",
183
+ {
184
+ "aria-label": getToggleLabel?.(label, hidden) ?? label,
185
+ "aria-pressed": !hidden,
186
+ className: cn(
187
+ CHART_LEGEND_BUTTON_CLASS,
188
+ hidden ? "text-on-surface-disabled" : "",
189
+ itemClassName
190
+ ),
191
+ "data-chart-legend-series": key,
192
+ "data-chart-legend-series-hidden": hidden ? "true" : "false",
193
+ onClick: (event) => {
194
+ event.stopPropagation();
195
+ onToggleSeries(key);
196
+ },
197
+ onMouseDown: stopChartInteraction,
198
+ type: "button",
199
+ children: content
200
+ },
201
+ key
202
+ );
203
+ })
204
+ }
205
+ );
206
+ }
207
+ const CHART_STATE_PANEL_CLASS = "flex h-full min-h-[14rem] min-w-0 w-full flex-1 flex-col justify-center";
208
+ const CHART_STATE_PANEL_EMBEDDED_CLASS = "grid min-h-[14rem] min-w-0 w-full flex-1 flex-col items-start justify-center gap-1.5 p-0 [&_h3]:m-0";
209
+ const CHART_STATE_PANEL_STANDALONE_SHELL_CLASS = "grid min-h-60 items-start gap-1.5 rounded-2xl border border-dashed border-outline-variant bg-surface-container-low p-5 [&_h3]:m-0";
210
+ const CHART_STATE_PANEL_TITLE_CLASS = "m-0 text-title-medium font-semibold text-on-surface";
211
+ const CHART_STATE_PANEL_DESCRIPTION_CLASS = "m-0 text-body-medium text-on-surface-variant";
212
+ const CHART_STATE_PANEL_SKELETON_CLASS = "animate-pulse rounded-xl bg-af-overlay";
213
+ function chartStateRole(status) {
214
+ return status === "error" ? "alert" : "status";
215
+ }
216
+ function chartStateLive(status) {
217
+ return status === "error" ? "assertive" : "polite";
218
+ }
219
+ function ChartStatePanel({
220
+ action,
221
+ className,
222
+ description,
223
+ presentation = "standalone",
224
+ status,
225
+ title,
226
+ ...props
227
+ }) {
228
+ const embedded = presentation === "embedded";
229
+ const role = chartStateRole(status);
230
+ const ariaLive = chartStateLive(status);
231
+ const loading = status === "loading";
232
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
233
+ loading ? /* @__PURE__ */ jsxs("div", { "aria-hidden": "true", className: "grid w-full gap-3", children: [
234
+ /* @__PURE__ */ jsx("div", { className: cn(CHART_STATE_PANEL_SKELETON_CLASS, "h-4 w-32") }),
235
+ /* @__PURE__ */ jsx("div", { className: cn(CHART_STATE_PANEL_SKELETON_CLASS, "h-28 w-full") })
236
+ ] }) : null,
237
+ /* @__PURE__ */ jsx("h3", { className: CHART_STATE_PANEL_TITLE_CLASS, children: title }),
238
+ /* @__PURE__ */ jsx("p", { className: CHART_STATE_PANEL_DESCRIPTION_CLASS, children: description }),
239
+ action ? /* @__PURE__ */ jsx("div", { className: "mt-2", children: action }) : null
240
+ ] });
241
+ if (!embedded) {
242
+ return /* @__PURE__ */ jsx(
243
+ "div",
244
+ {
245
+ "aria-busy": loading || void 0,
246
+ "aria-live": ariaLive,
247
+ className: cn(
248
+ CHART_STATE_PANEL_STANDALONE_SHELL_CLASS,
249
+ CHART_STATE_PANEL_CLASS,
250
+ className
251
+ ),
252
+ "data-chart-presentation": presentation,
253
+ "data-chart-state": status,
254
+ role,
255
+ ...props,
256
+ children: content
257
+ }
258
+ );
259
+ }
260
+ return /* @__PURE__ */ jsx(
261
+ "div",
262
+ {
263
+ "aria-busy": loading || void 0,
264
+ "aria-live": ariaLive,
265
+ className: cn(
266
+ CHART_STATE_PANEL_EMBEDDED_CLASS,
267
+ CHART_STATE_PANEL_CLASS,
268
+ className
269
+ ),
270
+ "data-chart-presentation": presentation,
271
+ "data-chart-state": status,
272
+ role,
273
+ ...props,
274
+ children: content
275
+ }
276
+ );
277
+ }
278
+ const COMPONENTS_CATEGORY = "charts";
279
+ export {
280
+ COMPONENTS_CATEGORY,
281
+ ChartContainer,
282
+ ChartLegend,
283
+ ChartLegendContent,
284
+ ChartStatePanel,
285
+ ChartTooltip,
286
+ ChartTooltipContent
287
+ };
@@ -0,0 +1,39 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as cn } from "./cn.js";
3
+ const ACTION_ROW_CLASS = "flex min-w-0 flex-wrap items-center gap-2 max-md:justify-start";
4
+ const ACTION_ROW_SECTION_CLASS = "flex min-w-0 flex-wrap items-center gap-2";
5
+ function ActionRow({
6
+ actions,
7
+ actionsClassName,
8
+ className,
9
+ statuses,
10
+ statusesClassName,
11
+ ...props
12
+ }) {
13
+ const hasStatuses = statuses !== void 0 && statuses !== null;
14
+ const hasActions = actions !== void 0 && actions !== null;
15
+ if (!hasStatuses && !hasActions) {
16
+ return null;
17
+ }
18
+ return /* @__PURE__ */ jsxs("div", { className: cn(ACTION_ROW_CLASS, className), ...props, children: [
19
+ hasStatuses ? /* @__PURE__ */ jsx(
20
+ "div",
21
+ {
22
+ className: cn(ACTION_ROW_SECTION_CLASS, statusesClassName),
23
+ "data-action-row-section": "statuses",
24
+ children: statuses
25
+ }
26
+ ) : null,
27
+ hasActions ? /* @__PURE__ */ jsx(
28
+ "div",
29
+ {
30
+ className: cn(ACTION_ROW_SECTION_CLASS, actionsClassName),
31
+ "data-action-row-section": "actions",
32
+ children: actions
33
+ }
34
+ ) : null
35
+ ] });
36
+ }
37
+ export {
38
+ ActionRow as A
39
+ };
@@ -0,0 +1,182 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { S as SurfacePanel } from "./surface-panel.js";
4
+ import { c as cn } from "./cn.js";
5
+ const ALERT_PANEL_SEMANTIC_CONFIG = {
6
+ neutral: {
7
+ role: "status",
8
+ tone: "neutral",
9
+ variant: "default"
10
+ },
11
+ info: {
12
+ role: "status",
13
+ tone: "info",
14
+ variant: "default"
15
+ },
16
+ success: {
17
+ role: "status",
18
+ tone: "success",
19
+ variant: "default"
20
+ },
21
+ warning: {
22
+ role: "alert",
23
+ tone: "warning",
24
+ variant: "default"
25
+ },
26
+ danger: {
27
+ role: "alert",
28
+ tone: "danger",
29
+ variant: "default"
30
+ },
31
+ error: {
32
+ role: "alert",
33
+ statusLabel: "Error",
34
+ tone: "error",
35
+ variant: "default"
36
+ },
37
+ loading: {
38
+ busy: true,
39
+ role: "status",
40
+ statusLabel: "Loading",
41
+ tone: "neutral",
42
+ variant: "loading"
43
+ },
44
+ empty: {
45
+ role: "status",
46
+ statusLabel: "Empty",
47
+ tone: "neutral",
48
+ variant: "empty"
49
+ }
50
+ };
51
+ function resolveAlertPanelSemantic(semantic) {
52
+ return ALERT_PANEL_SEMANTIC_CONFIG[semantic];
53
+ }
54
+ function Skeleton({
55
+ className,
56
+ ...props
57
+ }) {
58
+ return /* @__PURE__ */ jsx(
59
+ "div",
60
+ {
61
+ "aria-hidden": "true",
62
+ className: cn("animate-pulse rounded-xl bg-af-overlay", className),
63
+ ...props
64
+ }
65
+ );
66
+ }
67
+ const ALERT_PANEL_TONE_CLASS = {
68
+ danger: "border-af-danger-border bg-error-container text-on-error-container",
69
+ error: "border-af-danger-border bg-error-container text-on-error-container",
70
+ info: "border-af-info-border bg-info-container text-on-info-container",
71
+ neutral: "border-outline bg-surface-container-low text-on-surface-variant",
72
+ success: "border-af-success-border bg-success-container text-on-success-container",
73
+ warning: "border-af-warning-border bg-warning-container text-on-warning-container"
74
+ };
75
+ const ALERT_PANEL_VARIANT_CLASS = {
76
+ default: "grid gap-2",
77
+ empty: "grid items-start gap-1.5 rounded-2xl border-dashed p-5 [&_h3]:m-0",
78
+ loading: "grid gap-2"
79
+ };
80
+ const ALERT_PANEL_COMPACT_CLASS = {
81
+ default: "",
82
+ empty: "min-h-0",
83
+ loading: ""
84
+ };
85
+ const ALERT_PANEL_BODY_TEXT_CLASS = "text-body-medium text-on-surface-variant";
86
+ const ALERT_PANEL_STATUS_LABEL_CLASS = "text-body-small font-medium uppercase tracking-wide text-current";
87
+ const AlertPanel = forwardRef(
88
+ function AlertPanel2({
89
+ "aria-busy": ariaBusy,
90
+ children,
91
+ className,
92
+ compact = false,
93
+ padding = "default",
94
+ radius = "xl",
95
+ role,
96
+ semantic,
97
+ showStatusLabel,
98
+ tone: toneProp = "warning",
99
+ variant: variantProp = "default",
100
+ ...props
101
+ }, ref) {
102
+ const semanticConfig = semantic ? resolveAlertPanelSemantic(semantic) : void 0;
103
+ const tone = semanticConfig?.tone ?? toneProp;
104
+ const variant = semanticConfig?.variant ?? variantProp;
105
+ const resolvedRole = role ?? semanticConfig?.role;
106
+ const resolvedAriaBusy = ariaBusy ?? semanticConfig?.busy;
107
+ const shouldShowStatusLabel = showStatusLabel ?? semanticConfig?.statusLabel !== void 0;
108
+ const statusLabel = semanticConfig?.statusLabel;
109
+ return /* @__PURE__ */ jsxs(
110
+ SurfacePanel,
111
+ {
112
+ "aria-busy": resolvedAriaBusy === true ? true : void 0,
113
+ className: cn(
114
+ ALERT_PANEL_VARIANT_CLASS[variant],
115
+ compact && ALERT_PANEL_COMPACT_CLASS[variant],
116
+ ALERT_PANEL_TONE_CLASS[tone],
117
+ ALERT_PANEL_BODY_TEXT_CLASS,
118
+ className
119
+ ),
120
+ "data-af-feedback-variant": semantic,
121
+ padding,
122
+ radius,
123
+ ref,
124
+ role: resolvedRole,
125
+ ...props,
126
+ children: [
127
+ shouldShowStatusLabel && statusLabel ? /* @__PURE__ */ jsx(AlertPanelStatusLabel, { children: statusLabel }) : null,
128
+ variant === "loading" && children === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
129
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }),
130
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4/5" })
131
+ ] }) : children
132
+ ]
133
+ }
134
+ );
135
+ }
136
+ );
137
+ const AlertPanelStatusLabel = forwardRef(function AlertPanelStatusLabel2({ className, ...props }, ref) {
138
+ return /* @__PURE__ */ jsx(
139
+ "span",
140
+ {
141
+ className: cn(ALERT_PANEL_STATUS_LABEL_CLASS, className),
142
+ ref,
143
+ ...props
144
+ }
145
+ );
146
+ });
147
+ const AlertPanelTitle = forwardRef(
148
+ function AlertPanelTitle2({ className, ...props }, ref) {
149
+ return /* @__PURE__ */ jsx(
150
+ "h3",
151
+ {
152
+ className: cn("m-0 text-body-medium !text-current", className),
153
+ ref,
154
+ ...props
155
+ }
156
+ );
157
+ }
158
+ );
159
+ const ALERT_PANEL_SUPPORTING_TEXT_CLASS = "text-body-small text-on-surface-variant";
160
+ const AlertPanelText = forwardRef(
161
+ function AlertPanelText2({ as: Component = "p", className, variant = "body", ...props }, ref) {
162
+ return /* @__PURE__ */ jsx(
163
+ Component,
164
+ {
165
+ className: cn(
166
+ "m-0 !text-current",
167
+ variant === "body" ? ALERT_PANEL_BODY_TEXT_CLASS : ALERT_PANEL_SUPPORTING_TEXT_CLASS,
168
+ className
169
+ ),
170
+ ref,
171
+ ...props
172
+ }
173
+ );
174
+ }
175
+ );
176
+ export {
177
+ AlertPanel as A,
178
+ Skeleton as S,
179
+ AlertPanelStatusLabel as a,
180
+ AlertPanelText as b,
181
+ AlertPanelTitle as c
182
+ };