@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.
- package/LICENSE.md +21 -0
- package/README.md +38 -7
- package/dist/category-paths.d.ts +3 -0
- package/dist/charts/chart-state-panel.d.ts +11 -0
- package/dist/charts/chart.d.ts +35 -0
- package/dist/charts/index.d.ts +5 -0
- package/dist/charts/index.js +287 -0
- package/dist/chunks/action-row.js +39 -0
- package/dist/chunks/alert-panel.js +182 -0
- package/dist/chunks/button.js +193 -0
- package/dist/chunks/cn.js +6 -0
- package/dist/chunks/factory-emulator-controls.js +123 -0
- package/dist/chunks/package-form-field.js +546 -0
- package/dist/chunks/scroll-area.js +261 -0
- package/dist/chunks/surface-panel.js +73 -0
- package/dist/chunks/table-layout.js +292 -0
- package/dist/chunks/typography-roles.js +26 -0
- package/dist/chunks/typography.js +129 -0
- package/dist/chunks/widget-frame.js +344 -0
- package/dist/data-display/code-panel.d.ts +12 -0
- package/dist/data-display/data-table.d.ts +27 -0
- package/dist/data-display/description-list.d.ts +4 -0
- package/{src/data-display/index.ts → dist/data-display/index.d.ts} +4 -26
- package/dist/data-display/index.js +20 -0
- package/dist/data-display/table-layout.d.ts +8 -0
- package/dist/data-display/table.d.ts +14 -0
- package/dist/factory-emulator/factory-emulator-controls.d.ts +23 -0
- package/dist/factory-emulator/index.d.ts +6 -0
- package/dist/factory-emulator/index.js +6 -0
- package/dist/feedback/alert-panel-semantics.d.ts +11 -0
- package/dist/feedback/alert-panel.d.ts +29 -0
- package/dist/feedback/index.d.ts +6 -0
- package/dist/feedback/index.js +10 -0
- package/dist/feedback/skeleton.d.ts +2 -0
- package/dist/forms/index.d.ts +19 -0
- package/dist/forms/index.js +37 -0
- package/dist/forms/package-checkbox.d.ts +3 -0
- package/dist/forms/package-enum-select.d.ts +42 -0
- package/dist/forms/package-file-input.d.ts +3 -0
- package/dist/forms/package-form-field.d.ts +49 -0
- package/dist/forms/package-input.d.ts +6 -0
- package/dist/forms/package-native-select.d.ts +3 -0
- package/dist/forms/package-select.d.ts +32 -0
- package/dist/forms/package-textarea.d.ts +10 -0
- package/dist/forms/select-icons.d.ts +3 -0
- package/dist/graphs/graph-edge-path.d.ts +18 -0
- package/dist/graphs/graph-edge.d.ts +15 -0
- package/dist/graphs/graph-node-button.d.ts +11 -0
- package/dist/graphs/graph-node-handle-badge.d.ts +5 -0
- package/dist/graphs/graph-node-handle.d.ts +18 -0
- package/dist/graphs/graph-node-shell.d.ts +13 -0
- package/dist/graphs/graph-node-state-indicator.d.ts +6 -0
- package/dist/graphs/graph-node-state.d.ts +23 -0
- package/dist/graphs/graph-viewport-surface.d.ts +5 -0
- package/dist/graphs/index.d.ts +13 -0
- package/dist/graphs/index.js +614 -0
- package/{src/icons/index.ts → dist/icons/index.d.ts} +1 -2
- package/dist/icons/index.js +4 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +145 -0
- package/dist/layout/action-row.d.ts +8 -0
- package/{src/layout/index.ts → dist/layout/index.d.ts} +1 -3
- package/dist/layout/index.js +9 -0
- package/dist/layout/surface-panel.d.ts +15 -0
- package/{src/navigation/index.ts → dist/navigation/index.d.ts} +1 -2
- package/dist/navigation/index.js +4 -0
- package/dist/overlays/collapsible.d.ts +5 -0
- package/dist/overlays/dialog.d.ts +16 -0
- package/dist/overlays/index.d.ts +10 -0
- package/dist/overlays/index.js +27 -0
- package/dist/overlays/overlay-layout.d.ts +6 -0
- package/dist/overlays/popover.d.ts +6 -0
- package/dist/overlays/scroll-area.d.ts +9 -0
- package/dist/primitives/button-link.d.ts +5 -0
- package/dist/primitives/button.d.ts +9 -0
- package/dist/primitives/icon-button-shell.d.ts +10 -0
- package/{src/primitives/index.ts → dist/primitives/index.d.ts} +2 -19
- package/dist/primitives/index.js +49 -0
- package/dist/primitives/package-text.d.ts +6 -0
- package/dist/primitives/typography-roles.d.ts +12 -0
- package/dist/primitives/typography.d.ts +36 -0
- package/dist/recipes/index.d.ts +14 -0
- package/dist/recipes/index.js +32 -0
- package/dist/recipes/widget-frame-content.d.ts +24 -0
- package/dist/recipes/widget-frame-disclosure.d.ts +33 -0
- package/dist/recipes/widget-frame-layout.d.ts +12 -0
- package/dist/recipes/widget-frame-skeleton.d.ts +2 -0
- package/dist/recipes/widget-frame-states.d.ts +15 -0
- package/dist/recipes/widget-frame-typography.d.ts +10 -0
- package/dist/recipes/widget-frame.d.ts +12 -0
- package/{src → dist}/styles.css +36 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +16 -0
- package/dist/testing/render.d.ts +5 -0
- package/{src/tokens/index.ts → dist/tokens/index.d.ts} +1 -2
- package/dist/tokens/index.js +4 -0
- package/dist/utilities/cn.d.ts +1 -0
- package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -3
- package/dist/utilities/index.js +6 -0
- package/package.json +65 -64
- package/docs/README.md +0 -83
- package/docs/button.md +0 -119
- package/docs/charts.md +0 -325
- package/docs/data-display-code-panel.md +0 -120
- package/docs/feedback-alert-panel.md +0 -117
- package/docs/feedback-skeleton.md +0 -54
- package/docs/forms-form-field.md +0 -490
- package/docs/forms-input-primitives.md +0 -311
- package/docs/forms-select-primitives.md +0 -362
- package/docs/graphs.md +0 -250
- package/docs/layout-display-primitives.md +0 -211
- package/docs/overlays.md +0 -414
- package/docs/table-data-table.md +0 -331
- package/docs/typography-roles.md +0 -182
- package/docs/widget-frame-recipes.md +0 -273
- package/src/category-paths.ts +0 -20
- package/src/charts/chart-state-panel.tsx +0 -103
- package/src/charts/chart.tsx +0 -287
- package/src/charts/index.ts +0 -21
- package/src/data-display/code-panel.tsx +0 -67
- package/src/data-display/data-table.tsx +0 -180
- package/src/data-display/description-list.tsx +0 -24
- package/src/data-display/table-layout.ts +0 -12
- package/src/data-display/table.tsx +0 -131
- package/src/feedback/alert-panel-semantics.ts +0 -75
- package/src/feedback/alert-panel.tsx +0 -187
- package/src/feedback/index.ts +0 -21
- package/src/feedback/skeleton.tsx +0 -16
- package/src/forms/index.ts +0 -73
- package/src/forms/package-checkbox.tsx +0 -50
- package/src/forms/package-enum-select.tsx +0 -185
- package/src/forms/package-file-input.tsx +0 -25
- package/src/forms/package-form-field.tsx +0 -202
- package/src/forms/package-input.tsx +0 -25
- package/src/forms/package-native-select.tsx +0 -25
- package/src/forms/package-select.tsx +0 -209
- package/src/forms/package-textarea.tsx +0 -35
- package/src/forms/select-icons.tsx +0 -35
- package/src/graphs/graph-edge-path.ts +0 -241
- package/src/graphs/graph-edge.tsx +0 -130
- package/src/graphs/graph-interactive-example.tsx +0 -187
- package/src/graphs/graph-node-button.tsx +0 -51
- package/src/graphs/graph-node-handle-badge.tsx +0 -108
- package/src/graphs/graph-node-handle.ts +0 -28
- package/src/graphs/graph-node-shell.tsx +0 -111
- package/src/graphs/graph-node-state-indicator.tsx +0 -47
- package/src/graphs/graph-node-state.ts +0 -111
- package/src/graphs/graph-viewport-surface.tsx +0 -27
- package/src/graphs/index.ts +0 -41
- package/src/index.ts +0 -209
- package/src/layout/action-row.tsx +0 -53
- package/src/layout/surface-panel.tsx +0 -91
- package/src/overlays/collapsible.tsx +0 -22
- package/src/overlays/dialog.tsx +0 -148
- package/src/overlays/index.ts +0 -31
- package/src/overlays/overlay-layout.ts +0 -9
- package/src/overlays/popover.tsx +0 -29
- package/src/overlays/scroll-area.tsx +0 -78
- package/src/primitives/button-link.tsx +0 -22
- package/src/primitives/button.tsx +0 -258
- package/src/primitives/icon-button-shell.tsx +0 -49
- package/src/primitives/package-text.tsx +0 -29
- package/src/primitives/typography-roles.ts +0 -12
- package/src/primitives/typography.tsx +0 -165
- package/src/recipes/index.ts +0 -61
- package/src/recipes/widget-frame-content.tsx +0 -114
- package/src/recipes/widget-frame-disclosure.tsx +0 -161
- package/src/recipes/widget-frame-layout.ts +0 -40
- package/src/recipes/widget-frame-skeleton.tsx +0 -16
- package/src/recipes/widget-frame-states.tsx +0 -99
- package/src/recipes/widget-frame-typography.ts +0 -19
- package/src/recipes/widget-frame.tsx +0 -84
- package/src/testing/index.ts +0 -13
- package/src/testing/render.tsx +0 -16
- package/src/utilities/cn.ts +0 -5
- /package/{src → dist}/styles/color-palette-presets.css +0 -0
- /package/{src → dist}/styles/color-role-tokens.css +0 -0
- /package/{src → dist}/styles/layout-role-tokens.css +0 -0
- /package/{src → dist}/styles/text-color-role-tokens.css +0 -0
- /package/{src → dist}/styles/typography-role-tokens.css +0 -0
- /package/{src → dist}/styles/typography-role-utilities.css +0 -0
- /package/{src → dist}/styles/typography-roles.css +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type HTMLAttributes } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../utilities/cn";
|
|
4
|
-
|
|
5
|
-
type CodePanelPadding = "compact" | "default";
|
|
6
|
-
type CodePanelSurface = "high" | "low";
|
|
7
|
-
type CodePanelMaxHeight = "none" | "sm" | "md" | "lg";
|
|
8
|
-
|
|
9
|
-
export interface CodePanelProps extends HTMLAttributes<HTMLPreElement> {
|
|
10
|
-
maxHeight?: CodePanelMaxHeight;
|
|
11
|
-
padding?: CodePanelPadding;
|
|
12
|
-
surface?: CodePanelSurface;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const CODE_PANEL_PADDING_CLASS: Record<CodePanelPadding, string> = {
|
|
16
|
-
compact: "p-2",
|
|
17
|
-
default: "p-3",
|
|
18
|
-
};
|
|
19
|
-
const CODE_PANEL_SURFACE_CLASS: Record<CodePanelSurface, string> = {
|
|
20
|
-
high: "bg-surface-container-high",
|
|
21
|
-
low: "bg-surface-container-low",
|
|
22
|
-
};
|
|
23
|
-
const CODE_PANEL_MAX_HEIGHT_CLASS: Record<CodePanelMaxHeight, string> = {
|
|
24
|
-
none: "",
|
|
25
|
-
sm: "max-h-48 overflow-y-auto",
|
|
26
|
-
md: "max-h-72 overflow-y-auto",
|
|
27
|
-
lg: "max-h-96 overflow-y-auto",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const CODE_PANEL_BODY_CODE_CLASS = "font-mono text-code-medium text-code";
|
|
31
|
-
|
|
32
|
-
const CODE_PANEL_CONTAINMENT_CLASS =
|
|
33
|
-
"m-0 min-w-0 w-full max-w-full overflow-x-auto whitespace-pre-wrap rounded-lg border border-outline [overflow-wrap:anywhere] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
|
|
34
|
-
|
|
35
|
-
export function codePanelVariants({
|
|
36
|
-
className,
|
|
37
|
-
maxHeight = "none",
|
|
38
|
-
padding = "compact",
|
|
39
|
-
surface = "high",
|
|
40
|
-
}: Pick<CodePanelProps, "className" | "maxHeight" | "padding" | "surface">) {
|
|
41
|
-
return cn(
|
|
42
|
-
CODE_PANEL_CONTAINMENT_CLASS,
|
|
43
|
-
CODE_PANEL_PADDING_CLASS[padding],
|
|
44
|
-
CODE_PANEL_SURFACE_CLASS[surface],
|
|
45
|
-
CODE_PANEL_MAX_HEIGHT_CLASS[maxHeight],
|
|
46
|
-
CODE_PANEL_BODY_CODE_CLASS,
|
|
47
|
-
className,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const CodePanel = forwardRef<HTMLPreElement, CodePanelProps>(
|
|
52
|
-
function CodePanel(
|
|
53
|
-
{ className, maxHeight = "none", padding, surface, tabIndex, ...props },
|
|
54
|
-
ref,
|
|
55
|
-
) {
|
|
56
|
-
const isScrollable = maxHeight !== "none";
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<pre
|
|
60
|
-
className={codePanelVariants({ className, maxHeight, padding, surface })}
|
|
61
|
-
ref={ref}
|
|
62
|
-
tabIndex={tabIndex ?? (isScrollable ? 0 : undefined)}
|
|
63
|
-
{...props}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
);
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../utilities/cn";
|
|
4
|
-
import {
|
|
5
|
-
Table,
|
|
6
|
-
type TableSize,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCaption,
|
|
9
|
-
TableCell,
|
|
10
|
-
TableHead,
|
|
11
|
-
TableHeader,
|
|
12
|
-
TableRow,
|
|
13
|
-
} from "./table";
|
|
14
|
-
|
|
15
|
-
export type DataTableState = "empty" | "error" | "loading" | "success";
|
|
16
|
-
|
|
17
|
-
export interface DataTableColumn<Row> {
|
|
18
|
-
cell: (row: Row) => ReactNode;
|
|
19
|
-
header: ReactNode;
|
|
20
|
-
id: string;
|
|
21
|
-
cellClassName?: string;
|
|
22
|
-
headerClassName?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface DataTableProps<Row> {
|
|
26
|
-
columns: DataTableColumn<Row>[];
|
|
27
|
-
data: Row[];
|
|
28
|
-
getRowKey: (row: Row) => string;
|
|
29
|
-
ariaLabel?: string;
|
|
30
|
-
caption?: ReactNode;
|
|
31
|
-
containerClassName?: string;
|
|
32
|
-
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
33
|
-
emptyMessage?: ReactNode;
|
|
34
|
-
errorMessage?: ReactNode;
|
|
35
|
-
loadingMessage?: ReactNode;
|
|
36
|
-
rowClassName?: (row: Row) => string | undefined;
|
|
37
|
-
size?: TableSize;
|
|
38
|
-
state?: DataTableState;
|
|
39
|
-
tableClassName?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function DataTablePlaceholderBar({ className }: { className?: string }) {
|
|
43
|
-
return (
|
|
44
|
-
<div
|
|
45
|
-
aria-hidden="true"
|
|
46
|
-
className={cn("animate-pulse rounded-xl bg-af-overlay", className)}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function DataTableStatusRow({
|
|
52
|
-
children,
|
|
53
|
-
colSpan,
|
|
54
|
-
role,
|
|
55
|
-
ariaBusy,
|
|
56
|
-
ariaLive,
|
|
57
|
-
cellClassName,
|
|
58
|
-
}: {
|
|
59
|
-
children: ReactNode;
|
|
60
|
-
colSpan: number;
|
|
61
|
-
role: "alert" | "status";
|
|
62
|
-
ariaBusy?: boolean;
|
|
63
|
-
ariaLive?: "assertive" | "polite";
|
|
64
|
-
cellClassName?: string;
|
|
65
|
-
}) {
|
|
66
|
-
return (
|
|
67
|
-
<TableRow>
|
|
68
|
-
<TableCell className={cellClassName} colSpan={colSpan}>
|
|
69
|
-
<div
|
|
70
|
-
aria-busy={ariaBusy || undefined}
|
|
71
|
-
aria-live={ariaLive}
|
|
72
|
-
role={role}
|
|
73
|
-
>
|
|
74
|
-
{children}
|
|
75
|
-
</div>
|
|
76
|
-
</TableCell>
|
|
77
|
-
</TableRow>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function DataTable<Row>({
|
|
82
|
-
columns,
|
|
83
|
-
data,
|
|
84
|
-
getRowKey,
|
|
85
|
-
ariaLabel,
|
|
86
|
-
caption,
|
|
87
|
-
containerClassName,
|
|
88
|
-
containerProps,
|
|
89
|
-
emptyMessage,
|
|
90
|
-
errorMessage,
|
|
91
|
-
loadingMessage,
|
|
92
|
-
rowClassName,
|
|
93
|
-
size,
|
|
94
|
-
state = "success",
|
|
95
|
-
tableClassName,
|
|
96
|
-
}: DataTableProps<Row>) {
|
|
97
|
-
const renderBody = () => {
|
|
98
|
-
if (state === "loading") {
|
|
99
|
-
return (
|
|
100
|
-
<DataTableStatusRow
|
|
101
|
-
ariaBusy
|
|
102
|
-
ariaLive="polite"
|
|
103
|
-
colSpan={columns.length}
|
|
104
|
-
role="status"
|
|
105
|
-
>
|
|
106
|
-
<div className="grid gap-3 py-1">
|
|
107
|
-
{loadingMessage}
|
|
108
|
-
<div aria-hidden="true" className="grid gap-2">
|
|
109
|
-
<DataTablePlaceholderBar className="h-4 w-full max-w-48" />
|
|
110
|
-
<DataTablePlaceholderBar className="h-8 w-full" />
|
|
111
|
-
<DataTablePlaceholderBar className="h-4 w-full max-w-48" />
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</DataTableStatusRow>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (state === "error") {
|
|
119
|
-
return (
|
|
120
|
-
<DataTableStatusRow
|
|
121
|
-
ariaLive="assertive"
|
|
122
|
-
cellClassName="text-af-text-subtle"
|
|
123
|
-
colSpan={columns.length}
|
|
124
|
-
role="alert"
|
|
125
|
-
>
|
|
126
|
-
{errorMessage}
|
|
127
|
-
</DataTableStatusRow>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (state === "empty" || (state === "success" && data.length === 0)) {
|
|
132
|
-
return (
|
|
133
|
-
<DataTableStatusRow
|
|
134
|
-
ariaLive="polite"
|
|
135
|
-
cellClassName="text-af-text-subtle"
|
|
136
|
-
colSpan={columns.length}
|
|
137
|
-
role="status"
|
|
138
|
-
>
|
|
139
|
-
{emptyMessage}
|
|
140
|
-
</DataTableStatusRow>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return data.map((row) => (
|
|
145
|
-
<TableRow className={rowClassName?.(row)} key={getRowKey(row)}>
|
|
146
|
-
{columns.map((column) => (
|
|
147
|
-
<TableCell className={column.cellClassName} key={column.id}>
|
|
148
|
-
{column.cell(row)}
|
|
149
|
-
</TableCell>
|
|
150
|
-
))}
|
|
151
|
-
</TableRow>
|
|
152
|
-
));
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<Table
|
|
157
|
-
aria-label={ariaLabel}
|
|
158
|
-
className={tableClassName}
|
|
159
|
-
containerClassName={containerClassName}
|
|
160
|
-
containerProps={containerProps}
|
|
161
|
-
size={size}
|
|
162
|
-
>
|
|
163
|
-
{caption ? <TableCaption>{caption}</TableCaption> : null}
|
|
164
|
-
<TableHeader>
|
|
165
|
-
<TableRow>
|
|
166
|
-
{columns.map((column) => (
|
|
167
|
-
<TableHead
|
|
168
|
-
className={column.headerClassName}
|
|
169
|
-
key={column.id}
|
|
170
|
-
scope="col"
|
|
171
|
-
>
|
|
172
|
-
{column.header}
|
|
173
|
-
</TableHead>
|
|
174
|
-
))}
|
|
175
|
-
</TableRow>
|
|
176
|
-
</TableHeader>
|
|
177
|
-
<TableBody>{renderBody()}</TableBody>
|
|
178
|
-
</Table>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type HTMLAttributes } from "react";
|
|
2
|
-
|
|
3
|
-
import { BODY_TEXT_CLASS } from "../primitives/typography-roles";
|
|
4
|
-
import { cn } from "../utilities/cn";
|
|
5
|
-
|
|
6
|
-
export interface DescriptionListProps
|
|
7
|
-
extends HTMLAttributes<HTMLDListElement> {}
|
|
8
|
-
|
|
9
|
-
export const DescriptionList = forwardRef<
|
|
10
|
-
HTMLDListElement,
|
|
11
|
-
DescriptionListProps
|
|
12
|
-
>(function DescriptionList({ className, ...props }, ref) {
|
|
13
|
-
return (
|
|
14
|
-
<dl
|
|
15
|
-
className={cn(
|
|
16
|
-
"m-0 grid min-w-0 gap-1.5 [&_dd]:m-0 [&_dd]:min-w-0 [&_div]:grid [&_div]:min-w-0 [&_div]:gap-2",
|
|
17
|
-
BODY_TEXT_CLASS,
|
|
18
|
-
className,
|
|
19
|
-
)}
|
|
20
|
-
ref={ref}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** Wrap long cell content without forcing page-level horizontal overflow. */
|
|
2
|
-
export const tableCellWrapClassName = "min-w-0 [overflow-wrap:anywhere]";
|
|
3
|
-
|
|
4
|
-
/** Truncate overflowing cell content with ellipsis. */
|
|
5
|
-
export const tableCellTruncateClassName =
|
|
6
|
-
"block min-w-0 max-w-full truncate whitespace-nowrap";
|
|
7
|
-
|
|
8
|
-
/** Minimum table width for wide datasets; pair with a narrow scroll container. */
|
|
9
|
-
export const tableMinWidthWideClassName = "min-w-2xl";
|
|
10
|
-
|
|
11
|
-
/** Scroll container classes for narrow viewport table containment. */
|
|
12
|
-
export const tableNarrowContainerClassName = "min-w-0 overscroll-x-contain";
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
type HTMLAttributes,
|
|
4
|
-
type TableHTMLAttributes,
|
|
5
|
-
type TdHTMLAttributes,
|
|
6
|
-
type ThHTMLAttributes,
|
|
7
|
-
} from "react";
|
|
8
|
-
|
|
9
|
-
import { cn } from "../utilities/cn";
|
|
10
|
-
|
|
11
|
-
export type TableSize = "default" | "dense";
|
|
12
|
-
|
|
13
|
-
export interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
14
|
-
containerClassName?: string;
|
|
15
|
-
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
16
|
-
size?: TableSize;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Table = forwardRef<HTMLTableElement, TableProps>(function Table(
|
|
20
|
-
{ className, containerClassName, containerProps, size = "default", ...props },
|
|
21
|
-
ref,
|
|
22
|
-
) {
|
|
23
|
-
return (
|
|
24
|
-
<div
|
|
25
|
-
className={cn(
|
|
26
|
-
"group/table w-full overflow-x-auto overflow-y-clip rounded-2xl border border-outline",
|
|
27
|
-
containerClassName,
|
|
28
|
-
)}
|
|
29
|
-
data-size={size}
|
|
30
|
-
{...containerProps}
|
|
31
|
-
>
|
|
32
|
-
<table
|
|
33
|
-
className={cn("w-full caption-bottom text-sm", className)}
|
|
34
|
-
ref={ref}
|
|
35
|
-
{...props}
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export const TableHeader = forwardRef<
|
|
42
|
-
HTMLTableSectionElement,
|
|
43
|
-
HTMLAttributes<HTMLTableSectionElement>
|
|
44
|
-
>(function TableHeader({ className, ...props }, ref) {
|
|
45
|
-
return (
|
|
46
|
-
<thead
|
|
47
|
-
className={cn("[&_tr]:border-b [&_tr]:border-outline", className)}
|
|
48
|
-
ref={ref}
|
|
49
|
-
{...props}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const TableBody = forwardRef<
|
|
55
|
-
HTMLTableSectionElement,
|
|
56
|
-
HTMLAttributes<HTMLTableSectionElement>
|
|
57
|
-
>(function TableBody({ className, ...props }, ref) {
|
|
58
|
-
return (
|
|
59
|
-
<tbody
|
|
60
|
-
className={cn(
|
|
61
|
-
"[&_tr:last-child]:border-0 [&_tr]:border-b [&_tr]:border-outline",
|
|
62
|
-
className,
|
|
63
|
-
)}
|
|
64
|
-
ref={ref}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export const TableRow = forwardRef<
|
|
71
|
-
HTMLTableRowElement,
|
|
72
|
-
HTMLAttributes<HTMLTableRowElement>
|
|
73
|
-
>(function TableRow({ className, ...props }, ref) {
|
|
74
|
-
return (
|
|
75
|
-
<tr
|
|
76
|
-
className={cn(
|
|
77
|
-
"transition-colors hover:bg-af-overlay data-[state=selected]:bg-af-overlay",
|
|
78
|
-
className,
|
|
79
|
-
)}
|
|
80
|
-
ref={ref}
|
|
81
|
-
{...props}
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export const TableHead = forwardRef<
|
|
87
|
-
HTMLTableCellElement,
|
|
88
|
-
ThHTMLAttributes<HTMLTableCellElement>
|
|
89
|
-
>(function TableHead({ className, ...props }, ref) {
|
|
90
|
-
return (
|
|
91
|
-
<th
|
|
92
|
-
className={cn(
|
|
93
|
-
"h-11 px-4 text-left align-middle text-xs font-bold uppercase tracking-[0.08em] text-af-text-subtle",
|
|
94
|
-
"group-data-[size=dense]/table:h-8 group-data-[size=dense]/table:px-3 group-data-[size=dense]/table:py-2",
|
|
95
|
-
className,
|
|
96
|
-
)}
|
|
97
|
-
ref={ref}
|
|
98
|
-
{...props}
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
export const TableCell = forwardRef<
|
|
104
|
-
HTMLTableCellElement,
|
|
105
|
-
TdHTMLAttributes<HTMLTableCellElement>
|
|
106
|
-
>(function TableCell({ className, ...props }, ref) {
|
|
107
|
-
return (
|
|
108
|
-
<td
|
|
109
|
-
className={cn(
|
|
110
|
-
"min-w-0 px-4 py-3 align-middle text-on-surface",
|
|
111
|
-
"group-data-[size=dense]/table:px-3 group-data-[size=dense]/table:py-2",
|
|
112
|
-
className,
|
|
113
|
-
)}
|
|
114
|
-
ref={ref}
|
|
115
|
-
{...props}
|
|
116
|
-
/>
|
|
117
|
-
);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
export const TableCaption = forwardRef<
|
|
121
|
-
HTMLTableCaptionElement,
|
|
122
|
-
HTMLAttributes<HTMLTableCaptionElement>
|
|
123
|
-
>(function TableCaption({ className, ...props }, ref) {
|
|
124
|
-
return (
|
|
125
|
-
<caption
|
|
126
|
-
className={cn("mt-4 text-sm text-af-text-subtle", className)}
|
|
127
|
-
ref={ref}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { AlertPanelTone, AlertPanelVariant } from "./alert-panel";
|
|
2
|
-
|
|
3
|
-
export type AlertPanelSemanticVariant =
|
|
4
|
-
| "danger"
|
|
5
|
-
| "empty"
|
|
6
|
-
| "error"
|
|
7
|
-
| "info"
|
|
8
|
-
| "loading"
|
|
9
|
-
| "neutral"
|
|
10
|
-
| "success"
|
|
11
|
-
| "warning";
|
|
12
|
-
|
|
13
|
-
export interface AlertPanelSemanticConfig {
|
|
14
|
-
busy?: boolean;
|
|
15
|
-
role: "alert" | "status";
|
|
16
|
-
statusLabel?: string;
|
|
17
|
-
tone: AlertPanelTone;
|
|
18
|
-
variant: AlertPanelVariant;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const ALERT_PANEL_SEMANTIC_CONFIG: Record<
|
|
22
|
-
AlertPanelSemanticVariant,
|
|
23
|
-
AlertPanelSemanticConfig
|
|
24
|
-
> = {
|
|
25
|
-
neutral: {
|
|
26
|
-
role: "status",
|
|
27
|
-
tone: "neutral",
|
|
28
|
-
variant: "default",
|
|
29
|
-
},
|
|
30
|
-
info: {
|
|
31
|
-
role: "status",
|
|
32
|
-
tone: "info",
|
|
33
|
-
variant: "default",
|
|
34
|
-
},
|
|
35
|
-
success: {
|
|
36
|
-
role: "status",
|
|
37
|
-
tone: "success",
|
|
38
|
-
variant: "default",
|
|
39
|
-
},
|
|
40
|
-
warning: {
|
|
41
|
-
role: "alert",
|
|
42
|
-
tone: "warning",
|
|
43
|
-
variant: "default",
|
|
44
|
-
},
|
|
45
|
-
danger: {
|
|
46
|
-
role: "alert",
|
|
47
|
-
tone: "danger",
|
|
48
|
-
variant: "default",
|
|
49
|
-
},
|
|
50
|
-
error: {
|
|
51
|
-
role: "alert",
|
|
52
|
-
statusLabel: "Error",
|
|
53
|
-
tone: "error",
|
|
54
|
-
variant: "default",
|
|
55
|
-
},
|
|
56
|
-
loading: {
|
|
57
|
-
busy: true,
|
|
58
|
-
role: "status",
|
|
59
|
-
statusLabel: "Loading",
|
|
60
|
-
tone: "neutral",
|
|
61
|
-
variant: "loading",
|
|
62
|
-
},
|
|
63
|
-
empty: {
|
|
64
|
-
role: "status",
|
|
65
|
-
statusLabel: "Empty",
|
|
66
|
-
tone: "neutral",
|
|
67
|
-
variant: "empty",
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export function resolveAlertPanelSemantic(
|
|
72
|
-
semantic: AlertPanelSemanticVariant,
|
|
73
|
-
): AlertPanelSemanticConfig {
|
|
74
|
-
return ALERT_PANEL_SEMANTIC_CONFIG[semantic];
|
|
75
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ElementType,
|
|
3
|
-
forwardRef,
|
|
4
|
-
type HTMLAttributes,
|
|
5
|
-
type ReactNode,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
import { SurfacePanel, type SurfacePanelProps } from "../layout/surface-panel";
|
|
9
|
-
import { cn } from "../utilities/cn";
|
|
10
|
-
import {
|
|
11
|
-
type AlertPanelSemanticVariant,
|
|
12
|
-
resolveAlertPanelSemantic,
|
|
13
|
-
} from "./alert-panel-semantics";
|
|
14
|
-
import { Skeleton } from "./skeleton";
|
|
15
|
-
|
|
16
|
-
export type AlertPanelTone =
|
|
17
|
-
| "danger"
|
|
18
|
-
| "error"
|
|
19
|
-
| "info"
|
|
20
|
-
| "neutral"
|
|
21
|
-
| "success"
|
|
22
|
-
| "warning";
|
|
23
|
-
export type AlertPanelVariant = "default" | "empty" | "loading";
|
|
24
|
-
|
|
25
|
-
export interface AlertPanelProps
|
|
26
|
-
extends Omit<SurfacePanelProps, "surface" | "tone"> {
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
compact?: boolean;
|
|
29
|
-
semantic?: AlertPanelSemanticVariant;
|
|
30
|
-
showStatusLabel?: boolean;
|
|
31
|
-
tone?: AlertPanelTone;
|
|
32
|
-
variant?: AlertPanelVariant;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ALERT_PANEL_TONE_CLASS: Record<AlertPanelTone, string> = {
|
|
36
|
-
danger: "border-af-danger-border bg-error-container text-on-error-container",
|
|
37
|
-
error: "border-af-danger-border bg-error-container text-on-error-container",
|
|
38
|
-
info: "border-af-info-border bg-info-container text-on-info-container",
|
|
39
|
-
neutral: "border-outline bg-surface-container-low text-on-surface-variant",
|
|
40
|
-
success:
|
|
41
|
-
"border-af-success-border bg-success-container text-on-success-container",
|
|
42
|
-
warning:
|
|
43
|
-
"border-af-warning-border bg-warning-container text-on-warning-container",
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const ALERT_PANEL_VARIANT_CLASS: Record<AlertPanelVariant, string> = {
|
|
47
|
-
default: "grid gap-2",
|
|
48
|
-
empty: "grid items-start gap-1.5 rounded-2xl border-dashed p-5 [&_h3]:m-0",
|
|
49
|
-
loading: "grid gap-2",
|
|
50
|
-
};
|
|
51
|
-
const ALERT_PANEL_COMPACT_CLASS: Record<AlertPanelVariant, string> = {
|
|
52
|
-
default: "",
|
|
53
|
-
empty: "min-h-0",
|
|
54
|
-
loading: "",
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const ALERT_PANEL_BODY_TEXT_CLASS = "text-body-medium text-on-surface-variant";
|
|
58
|
-
const ALERT_PANEL_STATUS_LABEL_CLASS =
|
|
59
|
-
"text-body-small font-medium uppercase tracking-wide text-current";
|
|
60
|
-
|
|
61
|
-
export const AlertPanel = forwardRef<HTMLDivElement, AlertPanelProps>(
|
|
62
|
-
function AlertPanel(
|
|
63
|
-
{
|
|
64
|
-
"aria-busy": ariaBusy,
|
|
65
|
-
children,
|
|
66
|
-
className,
|
|
67
|
-
compact = false,
|
|
68
|
-
padding = "default",
|
|
69
|
-
radius = "xl",
|
|
70
|
-
role,
|
|
71
|
-
semantic,
|
|
72
|
-
showStatusLabel,
|
|
73
|
-
tone: toneProp = "warning",
|
|
74
|
-
variant: variantProp = "default",
|
|
75
|
-
...props
|
|
76
|
-
},
|
|
77
|
-
ref,
|
|
78
|
-
) {
|
|
79
|
-
const semanticConfig = semantic
|
|
80
|
-
? resolveAlertPanelSemantic(semantic)
|
|
81
|
-
: undefined;
|
|
82
|
-
const tone = semanticConfig?.tone ?? toneProp;
|
|
83
|
-
const variant = semanticConfig?.variant ?? variantProp;
|
|
84
|
-
const resolvedRole = role ?? semanticConfig?.role;
|
|
85
|
-
const resolvedAriaBusy = ariaBusy ?? semanticConfig?.busy;
|
|
86
|
-
const shouldShowStatusLabel =
|
|
87
|
-
showStatusLabel ?? (semanticConfig?.statusLabel !== undefined);
|
|
88
|
-
const statusLabel = semanticConfig?.statusLabel;
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<SurfacePanel
|
|
92
|
-
aria-busy={resolvedAriaBusy === true ? true : undefined}
|
|
93
|
-
className={cn(
|
|
94
|
-
ALERT_PANEL_VARIANT_CLASS[variant],
|
|
95
|
-
compact && ALERT_PANEL_COMPACT_CLASS[variant],
|
|
96
|
-
ALERT_PANEL_TONE_CLASS[tone],
|
|
97
|
-
ALERT_PANEL_BODY_TEXT_CLASS,
|
|
98
|
-
className,
|
|
99
|
-
)}
|
|
100
|
-
data-af-feedback-variant={semantic}
|
|
101
|
-
padding={padding}
|
|
102
|
-
radius={radius}
|
|
103
|
-
ref={ref}
|
|
104
|
-
role={resolvedRole}
|
|
105
|
-
{...props}
|
|
106
|
-
>
|
|
107
|
-
{shouldShowStatusLabel && statusLabel ? (
|
|
108
|
-
<AlertPanelStatusLabel>{statusLabel}</AlertPanelStatusLabel>
|
|
109
|
-
) : null}
|
|
110
|
-
{variant === "loading" && children === undefined ? (
|
|
111
|
-
<>
|
|
112
|
-
<Skeleton className="h-4 w-full" />
|
|
113
|
-
<Skeleton className="h-4 w-4/5" />
|
|
114
|
-
</>
|
|
115
|
-
) : (
|
|
116
|
-
children
|
|
117
|
-
)}
|
|
118
|
-
</SurfacePanel>
|
|
119
|
-
);
|
|
120
|
-
},
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
export interface AlertPanelStatusLabelProps
|
|
124
|
-
extends HTMLAttributes<HTMLSpanElement> {
|
|
125
|
-
children?: ReactNode;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export const AlertPanelStatusLabel = forwardRef<
|
|
129
|
-
HTMLSpanElement,
|
|
130
|
-
AlertPanelStatusLabelProps
|
|
131
|
-
>(function AlertPanelStatusLabel({ className, ...props }, ref) {
|
|
132
|
-
return (
|
|
133
|
-
<span
|
|
134
|
-
className={cn(ALERT_PANEL_STATUS_LABEL_CLASS, className)}
|
|
135
|
-
ref={ref}
|
|
136
|
-
{...props}
|
|
137
|
-
/>
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
export interface AlertPanelTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
142
|
-
children?: ReactNode;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const AlertPanelTitle = forwardRef<HTMLHeadingElement, AlertPanelTitleProps>(
|
|
146
|
-
function AlertPanelTitle({ className, ...props }, ref) {
|
|
147
|
-
return (
|
|
148
|
-
<h3
|
|
149
|
-
className={cn("m-0 text-body-medium !text-current", className)}
|
|
150
|
-
ref={ref}
|
|
151
|
-
{...props}
|
|
152
|
-
/>
|
|
153
|
-
);
|
|
154
|
-
},
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
export interface AlertPanelTextProps extends HTMLAttributes<HTMLElement> {
|
|
158
|
-
as?: ElementType;
|
|
159
|
-
children?: ReactNode;
|
|
160
|
-
variant?: "body" | "supporting";
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const ALERT_PANEL_SUPPORTING_TEXT_CLASS =
|
|
164
|
-
"text-body-small text-on-surface-variant";
|
|
165
|
-
|
|
166
|
-
export const AlertPanelText = forwardRef<HTMLElement, AlertPanelTextProps>(
|
|
167
|
-
function AlertPanelText(
|
|
168
|
-
{ as: Component = "p", className, variant = "body", ...props },
|
|
169
|
-
ref,
|
|
170
|
-
) {
|
|
171
|
-
return (
|
|
172
|
-
<Component
|
|
173
|
-
className={cn(
|
|
174
|
-
"m-0 !text-current",
|
|
175
|
-
variant === "body"
|
|
176
|
-
? ALERT_PANEL_BODY_TEXT_CLASS
|
|
177
|
-
: ALERT_PANEL_SUPPORTING_TEXT_CLASS,
|
|
178
|
-
className,
|
|
179
|
-
)}
|
|
180
|
-
ref={ref}
|
|
181
|
-
{...props}
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
184
|
-
},
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
export type { AlertPanelSemanticVariant } from "./alert-panel-semantics";
|
package/src/feedback/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Stable category path for `@you-agent-factory/components/feedback`. */
|
|
2
|
-
export const COMPONENTS_CATEGORY = "feedback" as const;
|
|
3
|
-
|
|
4
|
-
export type ComponentsCategory = typeof COMPONENTS_CATEGORY;
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
AlertPanel,
|
|
8
|
-
AlertPanelStatusLabel,
|
|
9
|
-
AlertPanelText,
|
|
10
|
-
AlertPanelTitle,
|
|
11
|
-
} from "./alert-panel";
|
|
12
|
-
export type {
|
|
13
|
-
AlertPanelProps,
|
|
14
|
-
AlertPanelSemanticVariant,
|
|
15
|
-
AlertPanelStatusLabelProps,
|
|
16
|
-
AlertPanelTextProps,
|
|
17
|
-
AlertPanelTitleProps,
|
|
18
|
-
AlertPanelTone,
|
|
19
|
-
AlertPanelVariant,
|
|
20
|
-
} from "./alert-panel";
|
|
21
|
-
export { Skeleton } from "./skeleton";
|