@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
@@ -1,114 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactNode } from "react";
2
-
3
- import { cn } from "../utilities/cn";
4
-
5
- import {
6
- WIDGET_FRAME_BODY_TEXT_CLASS,
7
- WIDGET_FRAME_SECTION_HEADING_CLASS,
8
- WIDGET_FRAME_SUBTITLE_CLASS,
9
- } from "./widget-frame-typography";
10
-
11
- const WIDGET_SUBTITLE_CLASS = cn("mt-0", WIDGET_FRAME_SUBTITLE_CLASS);
12
- const DETAIL_COPY_CLASS = cn("m-0", WIDGET_FRAME_BODY_TEXT_CLASS);
13
- const EMPTY_STATE_CLASS =
14
- "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";
15
- const EMPTY_STATE_COMPACT_CLASS = "min-h-0";
16
-
17
- export interface WidgetSubtitleProps extends HTMLAttributes<HTMLElement> {
18
- as?: ElementType;
19
- children: ReactNode;
20
- }
21
-
22
- export function WidgetSubtitle({
23
- as: Component = "p",
24
- children,
25
- className,
26
- ...props
27
- }: WidgetSubtitleProps) {
28
- return (
29
- <Component className={cn(WIDGET_SUBTITLE_CLASS, className)} {...props}>
30
- {children}
31
- </Component>
32
- );
33
- }
34
-
35
- export interface WidgetDetailCopyProps
36
- extends HTMLAttributes<HTMLParagraphElement> {
37
- children: ReactNode;
38
- }
39
-
40
- export function WidgetDetailCopy({
41
- children,
42
- className,
43
- ...props
44
- }: WidgetDetailCopyProps) {
45
- return (
46
- <p className={cn(DETAIL_COPY_CLASS, className)} {...props}>
47
- {children}
48
- </p>
49
- );
50
- }
51
-
52
- export interface WidgetEmptyStateProps extends HTMLAttributes<HTMLDivElement> {
53
- children: ReactNode;
54
- compact?: boolean;
55
- }
56
-
57
- export function WidgetEmptyState({
58
- children,
59
- className,
60
- compact = false,
61
- ...props
62
- }: WidgetEmptyStateProps) {
63
- return (
64
- <div
65
- className={cn(
66
- EMPTY_STATE_CLASS,
67
- compact && EMPTY_STATE_COMPACT_CLASS,
68
- className,
69
- )}
70
- {...props}
71
- >
72
- {children}
73
- </div>
74
- );
75
- }
76
-
77
- export interface WidgetEmptyStateTitleProps
78
- extends HTMLAttributes<HTMLElement> {
79
- as?: ElementType;
80
- children: ReactNode;
81
- }
82
-
83
- export function WidgetEmptyStateTitle({
84
- as: Component = "h3",
85
- children,
86
- className,
87
- ...props
88
- }: WidgetEmptyStateTitleProps) {
89
- return (
90
- <Component
91
- className={cn(WIDGET_FRAME_SECTION_HEADING_CLASS, className)}
92
- {...props}
93
- >
94
- {children}
95
- </Component>
96
- );
97
- }
98
-
99
- export interface WidgetEmptyStateTextProps
100
- extends HTMLAttributes<HTMLParagraphElement> {
101
- children: ReactNode;
102
- }
103
-
104
- export function WidgetEmptyStateText({
105
- children,
106
- className,
107
- ...props
108
- }: WidgetEmptyStateTextProps) {
109
- return (
110
- <p className={cn("m-0", WIDGET_FRAME_BODY_TEXT_CLASS, className)} {...props}>
111
- {children}
112
- </p>
113
- );
114
- }
@@ -1,161 +0,0 @@
1
- import {
2
- forwardRef,
3
- type ButtonHTMLAttributes,
4
- type HTMLAttributes,
5
- type ReactNode,
6
- } from "react";
7
-
8
- import { cn } from "../utilities/cn";
9
-
10
- import { WIDGET_FRAME_BODY_TEXT_CLASS } from "./widget-frame-typography";
11
-
12
- const WIDGET_FRAME_DISCLOSURE_CLASS = "grid min-w-0 gap-2.5";
13
- const WIDGET_FRAME_DISCLOSURE_TRIGGER_CLASS = cn(
14
- "inline-flex min-h-9 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-outline bg-surface-container-high px-2.5 py-2 text-on-surface-variant transition hover:border-outline-variant hover:bg-af-overlay hover:text-on-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-af-accent disabled:cursor-not-allowed disabled:border-outline disabled:bg-surface-container-low disabled:text-on-surface-disabled",
15
- WIDGET_FRAME_BODY_TEXT_CLASS,
16
- );
17
- const WIDGET_FRAME_DISCLOSURE_ICON_CLASS =
18
- "h-3.5 w-3.5 shrink-0 text-current transition-transform duration-150";
19
-
20
- export interface WidgetFrameDisclosureProps
21
- extends HTMLAttributes<HTMLDivElement> {
22
- children: ReactNode;
23
- }
24
-
25
- export function WidgetFrameDisclosure({
26
- children,
27
- className,
28
- ...props
29
- }: WidgetFrameDisclosureProps) {
30
- return (
31
- <div className={cn(WIDGET_FRAME_DISCLOSURE_CLASS, className)} {...props}>
32
- {children}
33
- </div>
34
- );
35
- }
36
-
37
- export interface WidgetFrameDisclosureIconProps {
38
- expanded: boolean;
39
- className?: string;
40
- }
41
-
42
- export function WidgetFrameDisclosureIcon({
43
- className,
44
- expanded,
45
- }: WidgetFrameDisclosureIconProps) {
46
- return (
47
- <svg
48
- aria-hidden="true"
49
- className={cn(
50
- WIDGET_FRAME_DISCLOSURE_ICON_CLASS,
51
- expanded ? "rotate-180" : "rotate-0",
52
- className,
53
- )}
54
- fill="none"
55
- focusable="false"
56
- viewBox="0 0 16 16"
57
- xmlns="http://www.w3.org/2000/svg"
58
- >
59
- <path
60
- d="M4 6l4 4 4-4"
61
- stroke="currentColor"
62
- strokeLinecap="round"
63
- strokeLinejoin="round"
64
- strokeWidth="1.8"
65
- />
66
- </svg>
67
- );
68
- }
69
-
70
- type WidgetFrameDisclosureTriggerBaseProps = Omit<
71
- ButtonHTMLAttributes<HTMLButtonElement>,
72
- "aria-expanded" | "aria-controls" | "children" | "type"
73
- > & {
74
- controlsID: string;
75
- expanded: boolean;
76
- onExpandedChange?: (expanded: boolean) => void;
77
- type?: "button";
78
- };
79
-
80
- type WidgetFrameDisclosureTriggerWithLabelProps =
81
- WidgetFrameDisclosureTriggerBaseProps & {
82
- children: ReactNode;
83
- "aria-label"?: string;
84
- };
85
-
86
- type WidgetFrameDisclosureTriggerIconOnlyProps =
87
- WidgetFrameDisclosureTriggerBaseProps & {
88
- children?: never;
89
- "aria-label": string;
90
- };
91
-
92
- export type WidgetFrameDisclosureTriggerProps =
93
- | WidgetFrameDisclosureTriggerWithLabelProps
94
- | WidgetFrameDisclosureTriggerIconOnlyProps;
95
-
96
- export const WidgetFrameDisclosureTrigger = forwardRef<
97
- HTMLButtonElement,
98
- WidgetFrameDisclosureTriggerProps
99
- >(function WidgetFrameDisclosureTrigger(
100
- {
101
- children,
102
- className,
103
- controlsID,
104
- expanded,
105
- onClick,
106
- onExpandedChange,
107
- type = "button",
108
- ...props
109
- },
110
- ref,
111
- ) {
112
- const handleClick: ButtonHTMLAttributes<HTMLButtonElement>["onClick"] = (
113
- event,
114
- ) => {
115
- onClick?.(event);
116
- if (!event.defaultPrevented) {
117
- onExpandedChange?.(!expanded);
118
- }
119
- };
120
-
121
- return (
122
- <button
123
- aria-controls={controlsID}
124
- aria-expanded={expanded}
125
- className={cn(WIDGET_FRAME_DISCLOSURE_TRIGGER_CLASS, className)}
126
- onClick={handleClick}
127
- ref={ref}
128
- type={type}
129
- {...props}
130
- >
131
- <WidgetFrameDisclosureIcon expanded={expanded} />
132
- {children}
133
- </button>
134
- );
135
- });
136
-
137
- export interface WidgetFrameDisclosurePanelProps
138
- extends HTMLAttributes<HTMLDivElement> {
139
- children: ReactNode;
140
- expanded: boolean;
141
- id: string;
142
- }
143
-
144
- export function WidgetFrameDisclosurePanel({
145
- children,
146
- className,
147
- expanded,
148
- id,
149
- ...props
150
- }: WidgetFrameDisclosurePanelProps) {
151
- return (
152
- <div
153
- className={cn("min-w-0", className)}
154
- hidden={!expanded}
155
- id={id}
156
- {...props}
157
- >
158
- {children}
159
- </div>
160
- );
161
- }
@@ -1,40 +0,0 @@
1
- import type { CSSProperties } from "react";
2
-
3
- import { cn } from "../utilities/cn";
4
-
5
- import { WIDGET_FRAME_SUPPORTING_LABELS_CLASS } from "./widget-frame-typography";
6
-
7
- export const WIDGET_FRAME_MIN_WIDTH_CLASS = "min-w-0";
8
-
9
- export const WIDGET_FRAME_WIDE_BODY_CLASS = "min-h-72";
10
-
11
- export const WIDGET_FRAME_RESPONSIVE_SHELL_CLASS = "min-w-0 w-full";
12
-
13
- export const WIDGET_FRAME_STORY_SHELL_DATA_ATTR = "data-widget-frame-story-shell";
14
-
15
- export const WIDGET_FRAME_OVERFLOW_TOLERANCE_PX = 1;
16
-
17
- /** Detail-card layout recipe for description lists inside widget frames. */
18
- export const widgetFrameDetailCardClass = cn(
19
- "[&_dd]:m-0 [&_dl]:m-0 [&_dl]:grid [&_dl]:gap-3 [&_dl_div:first-child]:border-t-0 [&_dl_div:first-child]:pt-0 [&_dl_div]:border-t [&_dl_div]:border-outline [&_dl_div]:pt-3 [&_dt]:mb-1 [&_h3]:mt-0",
20
- WIDGET_FRAME_SUPPORTING_LABELS_CLASS,
21
- );
22
-
23
- export function widgetFrameStoryShellStyle(maxWidth: string): {
24
- style: CSSProperties;
25
- } {
26
- return {
27
- style: {
28
- maxWidth,
29
- padding: "1rem",
30
- width: "100%",
31
- },
32
- };
33
- }
34
-
35
- export function widgetFrameHasNoHorizontalOverflow(
36
- element: HTMLElement,
37
- tolerancePx = WIDGET_FRAME_OVERFLOW_TOLERANCE_PX,
38
- ): boolean {
39
- return element.scrollWidth <= element.clientWidth + tolerancePx;
40
- }
@@ -1,16 +0,0 @@
1
- import type { HTMLAttributes } from "react";
2
-
3
- import { cn } from "../utilities/cn";
4
-
5
- export function WidgetFrameSkeleton({
6
- className,
7
- ...props
8
- }: HTMLAttributes<HTMLDivElement>) {
9
- return (
10
- <div
11
- aria-hidden="true"
12
- className={cn("animate-pulse rounded-xl bg-af-overlay", className)}
13
- {...props}
14
- />
15
- );
16
- }
@@ -1,99 +0,0 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
2
-
3
- import { cn } from "../utilities/cn";
4
-
5
- import { WidgetFrameSkeleton } from "./widget-frame-skeleton";
6
-
7
- const WIDGET_STATE_PANEL_CLASS = "grid gap-2";
8
- const WIDGET_ERROR_STATE_CLASS =
9
- "rounded-2xl border border-af-danger-border bg-error-container p-5 text-on-error-container";
10
- const WIDGET_SUCCESS_STATE_CLASS =
11
- "rounded-2xl border border-af-success-border bg-success-container p-5 text-on-success-container";
12
- const WIDGET_LOADING_PLACEHOLDER_CLASS = "grid gap-2 pt-2";
13
-
14
- export interface WidgetLoadingStateProps extends HTMLAttributes<HTMLDivElement> {
15
- children: ReactNode;
16
- placeholder?: ReactNode;
17
- showDefaultPlaceholder?: boolean;
18
- }
19
-
20
- export function WidgetLoadingState({
21
- children,
22
- className,
23
- placeholder,
24
- showDefaultPlaceholder = true,
25
- ...props
26
- }: WidgetLoadingStateProps) {
27
- const resolvedPlaceholder =
28
- placeholder ??
29
- (showDefaultPlaceholder ? (
30
- <>
31
- <WidgetFrameSkeleton className="h-4 w-full max-w-48" />
32
- <WidgetFrameSkeleton className="h-24 w-full" />
33
- <WidgetFrameSkeleton className="h-4 w-full max-w-48" />
34
- </>
35
- ) : null);
36
-
37
- return (
38
- <div
39
- aria-busy="true"
40
- className={cn(WIDGET_STATE_PANEL_CLASS, className)}
41
- role="status"
42
- {...props}
43
- >
44
- {children}
45
- {resolvedPlaceholder ? (
46
- <div
47
- aria-hidden="true"
48
- className={WIDGET_LOADING_PLACEHOLDER_CLASS}
49
- >
50
- {resolvedPlaceholder}
51
- </div>
52
- ) : null}
53
- </div>
54
- );
55
- }
56
-
57
- export interface WidgetErrorStateProps extends HTMLAttributes<HTMLDivElement> {
58
- children: ReactNode;
59
- }
60
-
61
- export function WidgetErrorState({
62
- children,
63
- className,
64
- ...props
65
- }: WidgetErrorStateProps) {
66
- return (
67
- <div
68
- className={cn(WIDGET_ERROR_STATE_CLASS, WIDGET_STATE_PANEL_CLASS, className)}
69
- role="alert"
70
- {...props}
71
- >
72
- {children}
73
- </div>
74
- );
75
- }
76
-
77
- export interface WidgetSuccessStateProps extends HTMLAttributes<HTMLDivElement> {
78
- children: ReactNode;
79
- }
80
-
81
- export function WidgetSuccessState({
82
- children,
83
- className,
84
- ...props
85
- }: WidgetSuccessStateProps) {
86
- return (
87
- <div
88
- className={cn(
89
- WIDGET_SUCCESS_STATE_CLASS,
90
- WIDGET_STATE_PANEL_CLASS,
91
- className,
92
- )}
93
- role="status"
94
- {...props}
95
- >
96
- {children}
97
- </div>
98
- );
99
- }
@@ -1,19 +0,0 @@
1
- /** Section heading typography for widget frame titles and empty-state headings. */
2
- export const WIDGET_FRAME_SECTION_HEADING_CLASS =
3
- "text-title-large uppercase text-on-surface";
4
-
5
- /** Body copy typography for widget frame detail regions. */
6
- export const WIDGET_FRAME_BODY_TEXT_CLASS =
7
- "text-body-medium text-on-surface-variant";
8
-
9
- /** Monospace subtitle typography for metric and metadata values. */
10
- export const WIDGET_FRAME_SUBTITLE_CLASS =
11
- "font-mono text-display-small text-on-surface-variant [overflow-wrap:anywhere]";
12
-
13
- /** Supporting label typography for description-list terms. */
14
- export const WIDGET_FRAME_SUPPORTING_LABEL_CLASS =
15
- "text-label-medium uppercase text-on-surface-subtle";
16
-
17
- /** Description-list label styling for widget detail cards. */
18
- export const WIDGET_FRAME_SUPPORTING_LABELS_CLASS =
19
- "[&_dt]:text-label-medium [&_dt]:uppercase [&_dt]:text-on-surface-subtle";
@@ -1,84 +0,0 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
2
-
3
- import { cn } from "../utilities/cn";
4
-
5
- import { WIDGET_FRAME_BODY_TEXT_CLASS } from "./widget-frame-typography";
6
- import {
7
- WIDGET_FRAME_MIN_WIDTH_CLASS,
8
- WIDGET_FRAME_WIDE_BODY_CLASS,
9
- widgetFrameDetailCardClass,
10
- } from "./widget-frame-layout";
11
-
12
- const WIDGET_FRAME_SHELL_CLASS =
13
- "flex min-w-0 flex-col rounded-lg border border-outline bg-surface-container-high text-on-surface shadow-af-card";
14
- const WIDGET_FRAME_SCROLL_CLASS = "overflow-hidden";
15
- const WIDGET_FRAME_HEADER_CLASS =
16
- "relative z-10 flex min-h-13 shrink-0 items-center justify-between gap-3 border-b border-outline bg-surface-container-high px-3.5 py-3";
17
- const WIDGET_FRAME_HEADER_TOOLS_CLASS =
18
- "flex min-w-0 shrink-0 items-center gap-2";
19
- const WIDGET_FRAME_BODY_SCROLL_CLASS = "min-h-0 flex-1 overflow-auto";
20
- const WIDGET_FRAME_BODY_CLASS = cn(
21
- "grid min-h-0 gap-2.5 px-3.5 pt-3.5 pb-4 [&>*]:pb-1 [&_p]:m-0",
22
- WIDGET_FRAME_BODY_TEXT_CLASS,
23
- );
24
-
25
- export interface WidgetFrameProps {
26
- bodyClassName?: string;
27
- bodyProps?: HTMLAttributes<HTMLDivElement>;
28
- bodyScroll?: boolean;
29
- children: ReactNode;
30
- className?: string;
31
- headerAction?: ReactNode;
32
- title: string;
33
- wide?: boolean;
34
- }
35
-
36
- export function WidgetFrame({
37
- bodyClassName,
38
- bodyProps,
39
- bodyScroll = true,
40
- children,
41
- className,
42
- headerAction,
43
- title,
44
- wide = false,
45
- }: WidgetFrameProps) {
46
- const cardClassName = cn(
47
- WIDGET_FRAME_SHELL_CLASS,
48
- WIDGET_FRAME_MIN_WIDTH_CLASS,
49
- widgetFrameDetailCardClass,
50
- wide && WIDGET_FRAME_WIDE_BODY_CLASS,
51
- bodyScroll && WIDGET_FRAME_SCROLL_CLASS,
52
- className,
53
- );
54
- const cardBodyClassName = cn(WIDGET_FRAME_BODY_CLASS, bodyClassName);
55
- const bodyClassNames = cn(
56
- "min-h-0 flex-1",
57
- bodyScroll && WIDGET_FRAME_BODY_SCROLL_CLASS,
58
- cardBodyClassName,
59
- );
60
-
61
- return (
62
- <article aria-label={title} className={cardClassName}>
63
- <header className={WIDGET_FRAME_HEADER_CLASS}>
64
- <div className="min-w-0 flex-1">
65
- <h3 className="m-0 min-w-0 flex-1 text-title-large uppercase text-on-surface [overflow-wrap:anywhere]">
66
- {title}
67
- </h3>
68
- </div>
69
- <div className={WIDGET_FRAME_HEADER_TOOLS_CLASS}>
70
- {headerAction ?? (
71
- <span
72
- aria-hidden="true"
73
- className="block h-10 w-10 shrink-0"
74
- data-widget-frame-header-action-spacer="true"
75
- />
76
- )}
77
- </div>
78
- </header>
79
- <div className={bodyClassNames} {...bodyProps}>
80
- {children}
81
- </div>
82
- </article>
83
- );
84
- }
@@ -1,13 +0,0 @@
1
- /** Stable category path for `@you-agent-factory/components/testing`. */
2
- export const COMPONENTS_CATEGORY = "testing" as const;
3
-
4
- export type ComponentsCategory = typeof COMPONENTS_CATEGORY;
5
-
6
- export {
7
- render,
8
- renderPackageComponent,
9
- screen,
10
- userEvent,
11
- waitFor,
12
- within,
13
- } from "./render";
@@ -1,16 +0,0 @@
1
- import {
2
- render,
3
- type RenderOptions,
4
- type RenderResult,
5
- } from "@testing-library/react";
6
- import type { ReactElement } from "react";
7
-
8
- export function renderPackageComponent(
9
- ui: ReactElement,
10
- options?: Omit<RenderOptions, "wrapper">,
11
- ): RenderResult {
12
- return render(ui, options);
13
- }
14
-
15
- export { fireEvent, render, screen, within, waitFor } from "@testing-library/react";
16
- export { default as userEvent } from "@testing-library/user-event";
@@ -1,5 +0,0 @@
1
- export function cn(
2
- ...classes: Array<false | null | string | undefined>
3
- ): string {
4
- return classes.filter(Boolean).join(" ");
5
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes