@you-agent-factory/components 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -0
- package/docs/README.md +83 -0
- package/docs/button.md +119 -0
- package/docs/charts.md +325 -0
- package/docs/data-display-code-panel.md +120 -0
- package/docs/feedback-alert-panel.md +117 -0
- package/docs/feedback-skeleton.md +54 -0
- package/docs/forms-form-field.md +490 -0
- package/docs/forms-input-primitives.md +311 -0
- package/docs/forms-select-primitives.md +362 -0
- package/docs/graphs.md +250 -0
- package/docs/layout-display-primitives.md +211 -0
- package/docs/overlays.md +414 -0
- package/docs/table-data-table.md +331 -0
- package/docs/typography-roles.md +182 -0
- package/docs/widget-frame-recipes.md +273 -0
- package/package.json +161 -0
- package/src/category-paths.ts +20 -0
- package/src/charts/chart-state-panel.tsx +103 -0
- package/src/charts/chart.tsx +287 -0
- package/src/charts/index.ts +21 -0
- package/src/data-display/code-panel.tsx +67 -0
- package/src/data-display/data-table.tsx +180 -0
- package/src/data-display/description-list.tsx +24 -0
- package/src/data-display/index.ts +34 -0
- package/src/data-display/table-layout.ts +12 -0
- package/src/data-display/table.tsx +131 -0
- package/src/feedback/alert-panel-semantics.ts +75 -0
- package/src/feedback/alert-panel.tsx +187 -0
- package/src/feedback/index.ts +21 -0
- package/src/feedback/skeleton.tsx +16 -0
- package/src/forms/index.ts +73 -0
- package/src/forms/package-checkbox.tsx +50 -0
- package/src/forms/package-enum-select.tsx +185 -0
- package/src/forms/package-file-input.tsx +25 -0
- package/src/forms/package-form-field.tsx +202 -0
- package/src/forms/package-input.tsx +25 -0
- package/src/forms/package-native-select.tsx +25 -0
- package/src/forms/package-select.tsx +209 -0
- package/src/forms/package-textarea.tsx +35 -0
- package/src/forms/select-icons.tsx +35 -0
- package/src/graphs/graph-edge-path.ts +241 -0
- package/src/graphs/graph-edge.tsx +130 -0
- package/src/graphs/graph-interactive-example.tsx +187 -0
- package/src/graphs/graph-node-button.tsx +51 -0
- package/src/graphs/graph-node-handle-badge.tsx +108 -0
- package/src/graphs/graph-node-handle.ts +28 -0
- package/src/graphs/graph-node-shell.tsx +111 -0
- package/src/graphs/graph-node-state-indicator.tsx +47 -0
- package/src/graphs/graph-node-state.ts +111 -0
- package/src/graphs/graph-viewport-surface.tsx +27 -0
- package/src/graphs/index.ts +41 -0
- package/src/icons/index.ts +4 -0
- package/src/index.ts +209 -0
- package/src/layout/action-row.tsx +53 -0
- package/src/layout/index.ts +9 -0
- package/src/layout/surface-panel.tsx +91 -0
- package/src/navigation/index.ts +4 -0
- package/src/overlays/collapsible.tsx +22 -0
- package/src/overlays/dialog.tsx +148 -0
- package/src/overlays/index.ts +31 -0
- package/src/overlays/overlay-layout.ts +9 -0
- package/src/overlays/popover.tsx +29 -0
- package/src/overlays/scroll-area.tsx +78 -0
- package/src/primitives/button-link.tsx +22 -0
- package/src/primitives/button.tsx +258 -0
- package/src/primitives/icon-button-shell.tsx +49 -0
- package/src/primitives/index.ts +31 -0
- package/src/primitives/package-text.tsx +29 -0
- package/src/primitives/typography-roles.ts +12 -0
- package/src/primitives/typography.tsx +165 -0
- package/src/recipes/index.ts +61 -0
- package/src/recipes/widget-frame-content.tsx +114 -0
- package/src/recipes/widget-frame-disclosure.tsx +161 -0
- package/src/recipes/widget-frame-layout.ts +40 -0
- package/src/recipes/widget-frame-skeleton.tsx +16 -0
- package/src/recipes/widget-frame-states.tsx +99 -0
- package/src/recipes/widget-frame-typography.ts +19 -0
- package/src/recipes/widget-frame.tsx +84 -0
- package/src/styles/color-palette-presets.css +167 -0
- package/src/styles/color-role-tokens.css +163 -0
- package/src/styles/layout-role-tokens.css +27 -0
- package/src/styles/text-color-role-tokens.css +29 -0
- package/src/styles/typography-role-tokens.css +72 -0
- package/src/styles/typography-role-utilities.css +73 -0
- package/src/styles/typography-roles.css +53 -0
- package/src/styles.css +32 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/render.tsx +16 -0
- package/src/tokens/index.ts +4 -0
- package/src/utilities/cn.ts +5 -0
- package/src/utilities/index.ts +6 -0
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
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";
|
|
@@ -0,0 +1,21 @@
|
|
|
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";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../utilities/cn";
|
|
4
|
+
|
|
5
|
+
export function Skeleton({
|
|
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
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Stable category path for `@you-agent-factory/components/forms`. */
|
|
2
|
+
export const COMPONENTS_CATEGORY = "forms" as const;
|
|
3
|
+
|
|
4
|
+
export type ComponentsCategory = typeof COMPONENTS_CATEGORY;
|
|
5
|
+
|
|
6
|
+
export { PackageCheckbox } from "./package-checkbox";
|
|
7
|
+
export type { PackageCheckboxProps } from "./package-checkbox";
|
|
8
|
+
export {
|
|
9
|
+
EnumSelect,
|
|
10
|
+
ENUM_SELECT_EMPTY_VALUE,
|
|
11
|
+
OptionalEnumSelect,
|
|
12
|
+
ResetEnumSelect,
|
|
13
|
+
} from "./package-enum-select";
|
|
14
|
+
export type {
|
|
15
|
+
EnumSelectOption,
|
|
16
|
+
EnumSelectProps,
|
|
17
|
+
OptionalEnumSelectProps,
|
|
18
|
+
ResetEnumSelectProps,
|
|
19
|
+
} from "./package-enum-select";
|
|
20
|
+
export { PackageFileInput } from "./package-file-input";
|
|
21
|
+
export type { PackageFileInputProps } from "./package-file-input";
|
|
22
|
+
export { PackageInput, inputVariants } from "./package-input";
|
|
23
|
+
export type { PackageInputProps } from "./package-input";
|
|
24
|
+
export { NativeSelect } from "./package-native-select";
|
|
25
|
+
export type { NativeSelectProps } from "./package-native-select";
|
|
26
|
+
export {
|
|
27
|
+
Select,
|
|
28
|
+
SELECT_EMPTY_STATE_VALUE,
|
|
29
|
+
SelectContent,
|
|
30
|
+
SelectEmpty,
|
|
31
|
+
SelectField,
|
|
32
|
+
SelectGroup,
|
|
33
|
+
SelectItem,
|
|
34
|
+
SelectLabel,
|
|
35
|
+
SelectSeparator,
|
|
36
|
+
SelectTrigger,
|
|
37
|
+
SelectValue,
|
|
38
|
+
} from "./package-select";
|
|
39
|
+
export type {
|
|
40
|
+
SelectContentProps,
|
|
41
|
+
SelectEmptyProps,
|
|
42
|
+
SelectFieldProps,
|
|
43
|
+
SelectItemProps,
|
|
44
|
+
SelectLabelProps,
|
|
45
|
+
SelectSeparatorProps,
|
|
46
|
+
SelectTriggerProps,
|
|
47
|
+
} from "./package-select";
|
|
48
|
+
export { PackageTextarea, textareaVariants } from "./package-textarea";
|
|
49
|
+
export type { PackageTextareaProps } from "./package-textarea";
|
|
50
|
+
export {
|
|
51
|
+
buildFormFieldAriaDescribedBy,
|
|
52
|
+
FormDescription,
|
|
53
|
+
FormError,
|
|
54
|
+
FormField,
|
|
55
|
+
FormFieldGroup,
|
|
56
|
+
FormFieldGroupLabel,
|
|
57
|
+
FormHelperText,
|
|
58
|
+
FormLabel,
|
|
59
|
+
FormSuccess,
|
|
60
|
+
FormWarning,
|
|
61
|
+
} from "./package-form-field";
|
|
62
|
+
export type {
|
|
63
|
+
FormDescriptionProps,
|
|
64
|
+
FormErrorProps,
|
|
65
|
+
FormFieldGroupLabelProps,
|
|
66
|
+
FormFieldGroupProps,
|
|
67
|
+
FormFieldMessageIds,
|
|
68
|
+
FormFieldProps,
|
|
69
|
+
FormHelperTextProps,
|
|
70
|
+
FormLabelProps,
|
|
71
|
+
FormSuccessProps,
|
|
72
|
+
FormWarningProps,
|
|
73
|
+
} from "./package-form-field";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { forwardRef, type InputHTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../utilities/cn";
|
|
4
|
+
|
|
5
|
+
export type PackageCheckboxProps = Omit<
|
|
6
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
7
|
+
"type"
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
const CHECKBOX_ROOT_CLASS =
|
|
11
|
+
"relative inline-flex size-4 shrink-0 items-center justify-center [&:has(:disabled)]:cursor-not-allowed";
|
|
12
|
+
|
|
13
|
+
function CheckboxCheckIcon() {
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
className="size-3 opacity-0"
|
|
18
|
+
fill="none"
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
strokeLinecap="round"
|
|
21
|
+
strokeLinejoin="round"
|
|
22
|
+
strokeWidth={2.5}
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
>
|
|
25
|
+
<path d="M20 6 9 17l-5-5" />
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const PackageCheckbox = forwardRef<
|
|
31
|
+
HTMLInputElement,
|
|
32
|
+
PackageCheckboxProps
|
|
33
|
+
>(function PackageCheckbox({ className, ...props }, ref) {
|
|
34
|
+
return (
|
|
35
|
+
<span className={cn(CHECKBOX_ROOT_CLASS, className)}>
|
|
36
|
+
<input
|
|
37
|
+
className="peer sr-only"
|
|
38
|
+
ref={ref}
|
|
39
|
+
type="checkbox"
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
<span
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
className="pointer-events-none flex size-4 items-center justify-center rounded border border-outline bg-surface-container-high text-on-primary transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-af-focus-ring peer-disabled:border-outline peer-disabled:bg-surface-container-low peer-checked:border-primary peer-checked:bg-primary peer-aria-invalid:ring-2 peer-aria-invalid:ring-af-danger-border peer-checked:[&_svg]:opacity-100"
|
|
45
|
+
>
|
|
46
|
+
<CheckboxCheckIcon />
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
49
|
+
);
|
|
50
|
+
});
|