@behavioral-agentic-design-system/core 0.32.1 → 0.36.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/package.json +12 -6
- package/scripts/bads-doctor.mjs +217 -0
- package/scripts/build-tokens.cjs +29 -0
- package/scripts/check-sync.mjs +270 -0
- package/scripts/health-report.mjs +158 -0
- package/scripts/lint-ethics-contract.mjs +129 -0
- package/scripts/lint-slop.mjs +220 -0
- package/scripts/lint-token-intent.mjs +128 -0
- package/src/app/preview/components/page.tsx +221 -0
- package/src/components/home-tab.tsx +43 -12
- package/src/components/ui/data-table.tsx +20 -2
- package/src/components/ui/input.tsx +13 -2
- package/src/components/ui/pagination.tsx +65 -12
- package/src/components/ui/progress.tsx +18 -0
- package/src/components/ui/radio-group.tsx +39 -8
- package/src/components/ui/search-input.tsx +136 -0
- package/src/components/ui/select.tsx +2 -2
- package/src/components/ui/switch.tsx +4 -4
- package/src/components/ui/table.tsx +71 -67
- package/src/components/ui/textarea.tsx +22 -6
- package/src/data/docs-index.ts +2 -0
- package/src/stories/DataTable.stories.tsx +38 -0
- package/src/stories/Input.stories.tsx +54 -0
- package/src/stories/Pagination.stories.tsx +108 -0
- package/src/stories/Progress.stories.tsx +46 -0
- package/src/stories/RadioGroup.stories.tsx +40 -0
- package/src/stories/SearchInput.stories.tsx +162 -0
- package/src/stories/Select.stories.tsx +72 -0
- package/src/stories/Switch.stories.tsx +8 -3
- package/src/stories/Table.stories.tsx +88 -0
- package/src/stories/Textarea.stories.tsx +36 -0
- package/src/styles.css +29 -0
|
@@ -414,6 +414,7 @@ import {
|
|
|
414
414
|
} from "@behavioral-agentic-design-system/core/components/ui/tree-select";
|
|
415
415
|
import { Questionnaire } from "@behavioral-agentic-design-system/core/components/ui/questionnaire";
|
|
416
416
|
import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
|
|
417
|
+
import { SearchInput } from "@behavioral-agentic-design-system/core/components/ui/search-input";
|
|
417
418
|
|
|
418
419
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
419
420
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -868,6 +869,29 @@ export default function ComponentsPreview() {
|
|
|
868
869
|
/>
|
|
869
870
|
</div>
|
|
870
871
|
</div>
|
|
872
|
+
<div className="mt-6 space-y-2">
|
|
873
|
+
<p className="text-sm font-medium">Variants</p>
|
|
874
|
+
<div className="flex flex-col gap-4 sm:flex-row">
|
|
875
|
+
<div className="flex-1 space-y-2">
|
|
876
|
+
<Label htmlFor="in-variant-outline" className="text-muted-foreground">
|
|
877
|
+
outline (default)
|
|
878
|
+
</Label>
|
|
879
|
+
<Input id="in-variant-outline" variant="outline" placeholder="Search projects…" />
|
|
880
|
+
</div>
|
|
881
|
+
<div className="flex-1 space-y-2">
|
|
882
|
+
<Label htmlFor="in-variant-ghost" className="text-muted-foreground">
|
|
883
|
+
ghost
|
|
884
|
+
</Label>
|
|
885
|
+
<Input id="in-variant-ghost" variant="ghost" placeholder="Search projects…" />
|
|
886
|
+
</div>
|
|
887
|
+
<div className="flex-1 space-y-2">
|
|
888
|
+
<Label htmlFor="in-variant-filled" className="text-muted-foreground">
|
|
889
|
+
filled
|
|
890
|
+
</Label>
|
|
891
|
+
<Input id="in-variant-filled" variant="filled" placeholder="Search projects…" />
|
|
892
|
+
</div>
|
|
893
|
+
</div>
|
|
894
|
+
</div>
|
|
871
895
|
</Section>
|
|
872
896
|
|
|
873
897
|
<Section title="Password Input">
|
|
@@ -945,6 +969,21 @@ export default function ComponentsPreview() {
|
|
|
945
969
|
<Label htmlFor="cb-default-size">Default (32px)</Label>
|
|
946
970
|
</div>
|
|
947
971
|
</div>
|
|
972
|
+
<Label>Radio sizes</Label>
|
|
973
|
+
<RadioGroup defaultValue="default" className="flex items-center gap-6">
|
|
974
|
+
<div className="flex items-center gap-2">
|
|
975
|
+
<RadioGroupItem id="rg-sm" value="sm" size="sm" />
|
|
976
|
+
<Label htmlFor="rg-sm">sm (28px)</Label>
|
|
977
|
+
</div>
|
|
978
|
+
<div className="flex items-center gap-2">
|
|
979
|
+
<RadioGroupItem id="rg-default" value="default" />
|
|
980
|
+
<Label htmlFor="rg-default">default (36px)</Label>
|
|
981
|
+
</div>
|
|
982
|
+
<div className="flex items-center gap-2">
|
|
983
|
+
<RadioGroupItem id="rg-lg" value="lg" size="lg" />
|
|
984
|
+
<Label htmlFor="rg-lg">lg (44px)</Label>
|
|
985
|
+
</div>
|
|
986
|
+
</RadioGroup>
|
|
948
987
|
<Label id="form-controls-slider-label">Slider</Label>
|
|
949
988
|
<Slider
|
|
950
989
|
defaultValue={[40]}
|
|
@@ -993,6 +1032,13 @@ export default function ComponentsPreview() {
|
|
|
993
1032
|
<Progress value={100} intent="error" label="Build failed" showValue />
|
|
994
1033
|
<Progress value={42} intent="info" label="Syncing design tokens" showValue />
|
|
995
1034
|
</div>
|
|
1035
|
+
<Label className="pt-3">Progress striped & animated</Label>
|
|
1036
|
+
<div className="space-y-4">
|
|
1037
|
+
<Progress value={55} striped label="Processing tokens" showValue />
|
|
1038
|
+
<Progress value={40} striped animated label="Uploading brand-fonts.woff2" showValue />
|
|
1039
|
+
<Progress value={60} striped intent="success" label="Deployment" showValue />
|
|
1040
|
+
<Progress value={78} striped intent="warning" label="Disk quota: 78% used" showValue />
|
|
1041
|
+
</div>
|
|
996
1042
|
</div>
|
|
997
1043
|
</Section>
|
|
998
1044
|
|
|
@@ -1499,6 +1545,27 @@ export default function ComponentsPreview() {
|
|
|
1499
1545
|
</PaginationContent>
|
|
1500
1546
|
</Pagination>
|
|
1501
1547
|
</div>
|
|
1548
|
+
<div>
|
|
1549
|
+
<p className="mb-3 text-xs text-muted-foreground">Sizes: sm / default / lg</p>
|
|
1550
|
+
<div className="space-y-4">
|
|
1551
|
+
{(["sm", "default", "lg"] as const).map((size) => (
|
|
1552
|
+
<div key={size} className="space-y-1">
|
|
1553
|
+
<p className="text-xs text-muted-foreground/60">size="{size}"</p>
|
|
1554
|
+
<Pagination size={size}>
|
|
1555
|
+
<PaginationContent>
|
|
1556
|
+
<PaginationItem><PaginationPrevious href="#" /></PaginationItem>
|
|
1557
|
+
<PaginationItem><PaginationLink href="#">1</PaginationLink></PaginationItem>
|
|
1558
|
+
<PaginationItem><PaginationLink href="#" isActive>2</PaginationLink></PaginationItem>
|
|
1559
|
+
<PaginationItem><PaginationLink href="#">3</PaginationLink></PaginationItem>
|
|
1560
|
+
<PaginationItem><PaginationEllipsis /></PaginationItem>
|
|
1561
|
+
<PaginationItem><PaginationLink href="#">10</PaginationLink></PaginationItem>
|
|
1562
|
+
<PaginationItem><PaginationNext href="#" /></PaginationItem>
|
|
1563
|
+
</PaginationContent>
|
|
1564
|
+
</Pagination>
|
|
1565
|
+
</div>
|
|
1566
|
+
))}
|
|
1567
|
+
</div>
|
|
1568
|
+
</div>
|
|
1502
1569
|
</div>
|
|
1503
1570
|
</Section>
|
|
1504
1571
|
|
|
@@ -2909,6 +2976,41 @@ export default function ComponentsPreview() {
|
|
|
2909
2976
|
</TableRow>
|
|
2910
2977
|
</TableFooter>
|
|
2911
2978
|
</Table>
|
|
2979
|
+
<div className="mt-6 grid gap-6 lg:grid-cols-2">
|
|
2980
|
+
{([
|
|
2981
|
+
{ label: "Striped", props: { striped: true } },
|
|
2982
|
+
{ label: "Bordered", props: { bordered: true } },
|
|
2983
|
+
{ label: "Compact", props: { compact: true } },
|
|
2984
|
+
{ label: "Compact + striped + bordered", props: { compact: true, striped: true, bordered: true } },
|
|
2985
|
+
] as const).map(({ label, props }) => (
|
|
2986
|
+
<div key={label} className="space-y-2">
|
|
2987
|
+
<p className="text-sm font-medium text-muted-foreground">{label}</p>
|
|
2988
|
+
<Table {...props}>
|
|
2989
|
+
<TableHeader>
|
|
2990
|
+
<TableRow>
|
|
2991
|
+
<TableHead>Contributor</TableHead>
|
|
2992
|
+
<TableHead>Team</TableHead>
|
|
2993
|
+
<TableHead className="text-right">PRs</TableHead>
|
|
2994
|
+
</TableRow>
|
|
2995
|
+
</TableHeader>
|
|
2996
|
+
<TableBody>
|
|
2997
|
+
{[
|
|
2998
|
+
{ name: "Avery Castillo", squad: "Core", prs: "48" },
|
|
2999
|
+
{ name: "Noah Kim", squad: "Core", prs: "41" },
|
|
3000
|
+
{ name: "Priya Raman", squad: "Web", prs: "37" },
|
|
3001
|
+
{ name: "Liam O'Connor", squad: "Web", prs: "29" },
|
|
3002
|
+
].map((r) => (
|
|
3003
|
+
<TableRow key={r.name}>
|
|
3004
|
+
<TableCell className="font-medium">{r.name}</TableCell>
|
|
3005
|
+
<TableCell className="text-muted-foreground">{r.squad}</TableCell>
|
|
3006
|
+
<TableCell className="text-right font-mono tabular-nums">{r.prs}</TableCell>
|
|
3007
|
+
</TableRow>
|
|
3008
|
+
))}
|
|
3009
|
+
</TableBody>
|
|
3010
|
+
</Table>
|
|
3011
|
+
</div>
|
|
3012
|
+
))}
|
|
3013
|
+
</div>
|
|
2912
3014
|
</Section>
|
|
2913
3015
|
|
|
2914
3016
|
<Section title="Calendar">
|
|
@@ -2952,6 +3054,51 @@ export default function ComponentsPreview() {
|
|
|
2952
3054
|
</Select>
|
|
2953
3055
|
</div>
|
|
2954
3056
|
</div>
|
|
3057
|
+
<div className="mt-6 space-y-3">
|
|
3058
|
+
<p className="text-sm text-muted-foreground">Sizes — sm · default · lg · xl</p>
|
|
3059
|
+
<div className="flex flex-wrap items-end gap-3">
|
|
3060
|
+
<Select>
|
|
3061
|
+
<SelectTrigger size="sm" className="w-[180px]" aria-label="Environment (small)">
|
|
3062
|
+
<SelectValue placeholder="Environment" />
|
|
3063
|
+
</SelectTrigger>
|
|
3064
|
+
<SelectContent>
|
|
3065
|
+
<SelectItem value="prod">Production</SelectItem>
|
|
3066
|
+
<SelectItem value="staging">Staging</SelectItem>
|
|
3067
|
+
<SelectItem value="dev">Development</SelectItem>
|
|
3068
|
+
</SelectContent>
|
|
3069
|
+
</Select>
|
|
3070
|
+
<Select>
|
|
3071
|
+
<SelectTrigger size="default" className="w-[180px]" aria-label="Environment (default)">
|
|
3072
|
+
<SelectValue placeholder="Environment" />
|
|
3073
|
+
</SelectTrigger>
|
|
3074
|
+
<SelectContent>
|
|
3075
|
+
<SelectItem value="prod">Production</SelectItem>
|
|
3076
|
+
<SelectItem value="staging">Staging</SelectItem>
|
|
3077
|
+
<SelectItem value="dev">Development</SelectItem>
|
|
3078
|
+
</SelectContent>
|
|
3079
|
+
</Select>
|
|
3080
|
+
<Select>
|
|
3081
|
+
<SelectTrigger size="lg" className="w-[180px]" aria-label="Environment (large)">
|
|
3082
|
+
<SelectValue placeholder="Environment" />
|
|
3083
|
+
</SelectTrigger>
|
|
3084
|
+
<SelectContent>
|
|
3085
|
+
<SelectItem value="prod">Production</SelectItem>
|
|
3086
|
+
<SelectItem value="staging">Staging</SelectItem>
|
|
3087
|
+
<SelectItem value="dev">Development</SelectItem>
|
|
3088
|
+
</SelectContent>
|
|
3089
|
+
</Select>
|
|
3090
|
+
<Select>
|
|
3091
|
+
<SelectTrigger size="xl" className="w-[180px]" aria-label="Environment (extra-large)">
|
|
3092
|
+
<SelectValue placeholder="Environment" />
|
|
3093
|
+
</SelectTrigger>
|
|
3094
|
+
<SelectContent>
|
|
3095
|
+
<SelectItem value="prod">Production</SelectItem>
|
|
3096
|
+
<SelectItem value="staging">Staging</SelectItem>
|
|
3097
|
+
<SelectItem value="dev">Development</SelectItem>
|
|
3098
|
+
</SelectContent>
|
|
3099
|
+
</Select>
|
|
3100
|
+
</div>
|
|
3101
|
+
</div>
|
|
2955
3102
|
</Section>
|
|
2956
3103
|
|
|
2957
3104
|
<Section title="Textarea">
|
|
@@ -2989,6 +3136,27 @@ export default function ComponentsPreview() {
|
|
|
2989
3136
|
/>
|
|
2990
3137
|
</div>
|
|
2991
3138
|
</div>
|
|
3139
|
+
<div className="mt-6 space-y-3">
|
|
3140
|
+
<p className="text-sm font-medium text-muted-foreground">Size variants</p>
|
|
3141
|
+
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
|
3142
|
+
<div className="space-y-2">
|
|
3143
|
+
<Label htmlFor="ta-sm">sm</Label>
|
|
3144
|
+
<Textarea id="ta-sm" size="sm" placeholder="Brief note…" />
|
|
3145
|
+
</div>
|
|
3146
|
+
<div className="space-y-2">
|
|
3147
|
+
<Label htmlFor="ta-default-size">default</Label>
|
|
3148
|
+
<Textarea id="ta-default-size" placeholder="Message…" />
|
|
3149
|
+
</div>
|
|
3150
|
+
<div className="space-y-2">
|
|
3151
|
+
<Label htmlFor="ta-lg">lg</Label>
|
|
3152
|
+
<Textarea id="ta-lg" size="lg" placeholder="Describe your project…" />
|
|
3153
|
+
</div>
|
|
3154
|
+
<div className="space-y-2">
|
|
3155
|
+
<Label htmlFor="ta-xl">xl</Label>
|
|
3156
|
+
<Textarea id="ta-xl" size="xl" placeholder="Long-form content…" />
|
|
3157
|
+
</div>
|
|
3158
|
+
</div>
|
|
3159
|
+
</div>
|
|
2992
3160
|
</Section>
|
|
2993
3161
|
|
|
2994
3162
|
<Section title="Toggle & Toggle Group">
|
|
@@ -6066,6 +6234,9 @@ export default function ComponentsPreview() {
|
|
|
6066
6234
|
<Section title="SkeletonTable">
|
|
6067
6235
|
<SkeletonTableShowcase />
|
|
6068
6236
|
</Section>
|
|
6237
|
+
<Section title="SearchInput">
|
|
6238
|
+
<SearchInputShowcase />
|
|
6239
|
+
</Section>
|
|
6069
6240
|
</div>
|
|
6070
6241
|
</div>
|
|
6071
6242
|
);
|
|
@@ -10094,6 +10265,16 @@ function DataTableShowcase() {
|
|
|
10094
10265
|
pagination={{ pageSize: 5 }}
|
|
10095
10266
|
rowSelection={true}
|
|
10096
10267
|
/>
|
|
10268
|
+
<div className="space-y-2">
|
|
10269
|
+
<p className="text-xs font-medium text-muted-foreground">Sticky header — header stays visible as rows scroll (stickyHeader + scrollHeight)</p>
|
|
10270
|
+
<DataTable
|
|
10271
|
+
columns={SHOWCASE_TABLE_COLUMNS}
|
|
10272
|
+
data={SHOWCASE_TABLE_DATA}
|
|
10273
|
+
stickyHeader
|
|
10274
|
+
scrollHeight="220px"
|
|
10275
|
+
sorting={true}
|
|
10276
|
+
/>
|
|
10277
|
+
</div>
|
|
10097
10278
|
</div>
|
|
10098
10279
|
);
|
|
10099
10280
|
}
|
|
@@ -11734,3 +11915,43 @@ function SkeletonTableShowcase() {
|
|
|
11734
11915
|
</div>
|
|
11735
11916
|
);
|
|
11736
11917
|
}
|
|
11918
|
+
|
|
11919
|
+
function SearchInputShowcase() {
|
|
11920
|
+
const [q, setQ] = React.useState("");
|
|
11921
|
+
const [loading, setLoading] = React.useState(false);
|
|
11922
|
+
|
|
11923
|
+
function handleSearch(val: string) {
|
|
11924
|
+
if (!val.trim()) return;
|
|
11925
|
+
setLoading(true);
|
|
11926
|
+
setTimeout(() => setLoading(false), 800);
|
|
11927
|
+
}
|
|
11928
|
+
|
|
11929
|
+
return (
|
|
11930
|
+
<div className="space-y-4">
|
|
11931
|
+
<div>
|
|
11932
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Sizes</p>
|
|
11933
|
+
<div className="flex flex-col gap-2 max-w-xs">
|
|
11934
|
+
<SearchInput size="sm" placeholder="Size sm — h-8" />
|
|
11935
|
+
<SearchInput size="default" placeholder="Size default — h-9" />
|
|
11936
|
+
<SearchInput size="lg" placeholder="Size lg — h-11 (SC 2.5.5 touch target)" />
|
|
11937
|
+
</div>
|
|
11938
|
+
</div>
|
|
11939
|
+
<div>
|
|
11940
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With clear + loading</p>
|
|
11941
|
+
<div className="flex flex-col gap-2 max-w-xs">
|
|
11942
|
+
<SearchInput
|
|
11943
|
+
value={q}
|
|
11944
|
+
onValueChange={setQ}
|
|
11945
|
+
onSearch={handleSearch}
|
|
11946
|
+
loading={loading}
|
|
11947
|
+
placeholder="Type and press Enter…"
|
|
11948
|
+
/>
|
|
11949
|
+
</div>
|
|
11950
|
+
</div>
|
|
11951
|
+
<div>
|
|
11952
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Disabled</p>
|
|
11953
|
+
<SearchInput value="accessibility" disabled className="max-w-xs" />
|
|
11954
|
+
</div>
|
|
11955
|
+
</div>
|
|
11956
|
+
);
|
|
11957
|
+
}
|
|
@@ -112,6 +112,23 @@ const STARTER_CARDS: StarterCard[] = [
|
|
|
112
112
|
* (direction-first exploration, story coverage, token source-of-truth, AAA
|
|
113
113
|
* checks) in plain language so it works in any fork's CLAUDE.md context.
|
|
114
114
|
*/
|
|
115
|
+
// Shown only on the upstream template, where the reader has NOT installed the
|
|
116
|
+
// system yet and the one useful next step is starting their own copy. A fork's
|
|
117
|
+
// staff already have it installed, so this prompt is meaningless there — they
|
|
118
|
+
// see CLAUDE_PROMPTS instead. Gated on brand.isUpstreamTemplate.
|
|
119
|
+
const FORK_PROMPT: {
|
|
120
|
+
icon: React.ComponentType<{ className?: string; strokeWidth?: number }>;
|
|
121
|
+
title: string;
|
|
122
|
+
blurb: string;
|
|
123
|
+
prompt: string;
|
|
124
|
+
} = {
|
|
125
|
+
icon: GitBranch,
|
|
126
|
+
title: "Create your own fork",
|
|
127
|
+
blurb: "Stand up a branded copy of this system.",
|
|
128
|
+
prompt:
|
|
129
|
+
"I want to create my own design system by forking BADS (https://github.com/matthewlarn/behavioral-agentic-design-system). Interview me one question at a time — what the product or client is called, what it does and who uses it, the brand colors and typefaces if they exist yet, and the tone the interface should take. Do not assume any of it and do not start editing files until I have answered. Then walk the onboarding in CLIENT_ONBOARDING.md end to end: run the rename with the display name and slug I give you, point the fork at the published @behavioral-agentic-design-system/core package rather than a vendored copy so it keeps receiving updates, replace the placeholder tokens with my real brand values and regenerate the CSS through the token build, fill in the brand voice and BRIEF files, and seed the exemplars and real-content pool. When you are done, run the accessibility and drift checks and show me what is still a placeholder.",
|
|
130
|
+
};
|
|
131
|
+
|
|
115
132
|
const CLAUDE_PROMPTS: {
|
|
116
133
|
id: string;
|
|
117
134
|
icon: React.ComponentType<{ className?: string; strokeWidth?: number }>;
|
|
@@ -397,24 +414,38 @@ export function HomeTab({ onBrowseDocs, onBrowseComponents }: HomeTabProps) {
|
|
|
397
414
|
<section className="flex flex-col gap-5">
|
|
398
415
|
<div>
|
|
399
416
|
<h2 className="text-2xl font-semibold tracking-tight">
|
|
400
|
-
|
|
417
|
+
{brand.isUpstreamTemplate
|
|
418
|
+
? "Copy this prompt to create your own fork of BADS"
|
|
419
|
+
: `Copy a prompt to get started with ${brand.name}`}
|
|
401
420
|
</h2>
|
|
402
421
|
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
|
403
|
-
|
|
404
|
-
|
|
422
|
+
{brand.isUpstreamTemplate
|
|
423
|
+
? "Paste it into Claude Code exactly as written. It interviews you for the brand, the audience, and the tone, then walks the whole onboarding — so nothing needs filling in first."
|
|
424
|
+
: "Paste any of these into Claude Code exactly as written. Each one interviews you for the specifics, so nothing needs filling in first."}
|
|
405
425
|
</p>
|
|
406
426
|
</div>
|
|
407
|
-
|
|
408
|
-
|
|
427
|
+
{brand.isUpstreamTemplate ? (
|
|
428
|
+
<div className="grid grid-cols-1 gap-3 sm:max-w-md">
|
|
409
429
|
<PromptCard
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
prompt={p.prompt}
|
|
430
|
+
icon={FORK_PROMPT.icon}
|
|
431
|
+
title={FORK_PROMPT.title}
|
|
432
|
+
blurb={FORK_PROMPT.blurb}
|
|
433
|
+
prompt={FORK_PROMPT.prompt}
|
|
415
434
|
/>
|
|
416
|
-
|
|
417
|
-
|
|
435
|
+
</div>
|
|
436
|
+
) : (
|
|
437
|
+
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
438
|
+
{CLAUDE_PROMPTS.map((p) => (
|
|
439
|
+
<PromptCard
|
|
440
|
+
key={p.id}
|
|
441
|
+
icon={p.icon}
|
|
442
|
+
title={p.title}
|
|
443
|
+
blurb={p.blurb}
|
|
444
|
+
prompt={p.prompt}
|
|
445
|
+
/>
|
|
446
|
+
))}
|
|
447
|
+
</div>
|
|
448
|
+
)}
|
|
418
449
|
</section>
|
|
419
450
|
|
|
420
451
|
<Separator />
|
|
@@ -83,6 +83,18 @@ export interface DataTableProps<TData> extends VariantProps<typeof cellVariants>
|
|
|
83
83
|
* Defaults to the text "No results."
|
|
84
84
|
*/
|
|
85
85
|
emptyMessage?: React.ReactNode
|
|
86
|
+
/**
|
|
87
|
+
* When true, the header row sticks to the top of the table scroll container
|
|
88
|
+
* so it remains visible as rows scroll past. Pair with `scrollHeight` to cap
|
|
89
|
+
* the table's height; without a height cap the container never overflows and
|
|
90
|
+
* nothing scrolls.
|
|
91
|
+
*/
|
|
92
|
+
stickyHeader?: boolean
|
|
93
|
+
/**
|
|
94
|
+
* CSS length (e.g. `"400px"`, `"60vh"`) that caps the table's scrollable
|
|
95
|
+
* height when `stickyHeader` is true. Defaults to `"400px"`.
|
|
96
|
+
*/
|
|
97
|
+
scrollHeight?: string
|
|
86
98
|
className?: string
|
|
87
99
|
}
|
|
88
100
|
|
|
@@ -191,6 +203,8 @@ function DataTable<TData>({
|
|
|
191
203
|
rowSelection: rowSelectionEnabled = false,
|
|
192
204
|
onRowClick,
|
|
193
205
|
emptyMessage = "No results.",
|
|
206
|
+
stickyHeader = false,
|
|
207
|
+
scrollHeight = "400px",
|
|
194
208
|
density = "comfortable",
|
|
195
209
|
className,
|
|
196
210
|
}: DataTableProps<TData>) {
|
|
@@ -240,8 +254,12 @@ function DataTable<TData>({
|
|
|
240
254
|
>
|
|
241
255
|
{/* Scrollable table wrapper */}
|
|
242
256
|
<div className="overflow-x-auto">
|
|
243
|
-
<Table
|
|
244
|
-
|
|
257
|
+
<Table
|
|
258
|
+
role="grid"
|
|
259
|
+
wrapperClassName={stickyHeader ? "overflow-y-auto" : undefined}
|
|
260
|
+
wrapperStyle={stickyHeader ? { maxHeight: scrollHeight } : undefined}
|
|
261
|
+
>
|
|
262
|
+
<TableHeader className={stickyHeader ? "sticky top-0 z-10 bg-card" : undefined}>
|
|
245
263
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
246
264
|
<TableRow key={headerGroup.id}>
|
|
247
265
|
{headerGroup.headers.map((header) => {
|
|
@@ -4,9 +4,17 @@ import { cn } from "../../lib/utils"
|
|
|
4
4
|
import { InputClearButton } from "./input-clear-button"
|
|
5
5
|
|
|
6
6
|
const inputVariants = cva(
|
|
7
|
-
"w-full min-w-0 rounded-md
|
|
7
|
+
"w-full min-w-0 rounded-md transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:border-0 file:bg-transparent file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
outline:
|
|
12
|
+
"border border-input bg-transparent shadow-xs dark:bg-input/30 focus-visible:border-ring",
|
|
13
|
+
ghost:
|
|
14
|
+
"border-0 border-b border-transparent bg-transparent shadow-none rounded-none hover:border-b hover:border-input focus-visible:border-b-2 focus-visible:border-ring focus-visible:ring-0",
|
|
15
|
+
filled:
|
|
16
|
+
"border border-transparent bg-muted shadow-none dark:bg-muted/60 focus-visible:border-ring",
|
|
17
|
+
},
|
|
10
18
|
size: {
|
|
11
19
|
sm: "h-8 px-2.5 py-1 text-sm file:h-6 file:text-xs",
|
|
12
20
|
default: "h-9 px-3 py-1 text-base file:h-7 file:text-sm md:text-sm",
|
|
@@ -16,6 +24,7 @@ const inputVariants = cva(
|
|
|
16
24
|
},
|
|
17
25
|
},
|
|
18
26
|
defaultVariants: {
|
|
27
|
+
variant: "outline",
|
|
19
28
|
size: "default",
|
|
20
29
|
},
|
|
21
30
|
}
|
|
@@ -38,6 +47,7 @@ type InputProps = Omit<React.ComponentProps<"input">, "size"> &
|
|
|
38
47
|
function Input({
|
|
39
48
|
className,
|
|
40
49
|
type,
|
|
50
|
+
variant,
|
|
41
51
|
size,
|
|
42
52
|
clearable,
|
|
43
53
|
leftSection,
|
|
@@ -54,9 +64,10 @@ function Input({
|
|
|
54
64
|
<input
|
|
55
65
|
type={type}
|
|
56
66
|
data-slot="input"
|
|
67
|
+
data-variant={variant ?? "outline"}
|
|
57
68
|
data-size={size ?? "default"}
|
|
58
69
|
className={cn(
|
|
59
|
-
inputVariants({ size, className }),
|
|
70
|
+
inputVariants({ variant, size, className }),
|
|
60
71
|
clearable && "pr-8",
|
|
61
72
|
leftSection && "pl-9",
|
|
62
73
|
rightSection && "pr-9",
|
|
@@ -1,18 +1,62 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
4
|
import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
|
|
3
5
|
|
|
4
6
|
import { cn } from "../../lib/utils"
|
|
5
7
|
import { buttonVariants } from "./button"
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
type PaginationSize = "sm" | "default" | "lg"
|
|
10
|
+
|
|
11
|
+
// Context lets Pagination.size propagate to every PaginationLink /
|
|
12
|
+
// PaginationPrevious / PaginationNext / PaginationEllipsis without
|
|
13
|
+
// each consumer threading the prop manually.
|
|
14
|
+
const PaginationContext = React.createContext<PaginationSize>("default")
|
|
15
|
+
|
|
16
|
+
// Per-size target dimensions:
|
|
17
|
+
// sm → 36×36px (dense chrome — table footers, list paginators)
|
|
18
|
+
// default → 44×44px (CTA floor per CLAUDE.md min-h-11)
|
|
19
|
+
// lg → 48×48px (prominent surfaces — full-bleed paginators)
|
|
20
|
+
const linkSizeClass: Record<PaginationSize, string> = {
|
|
21
|
+
sm: "min-h-9 min-w-9",
|
|
22
|
+
default: "min-h-11 min-w-11",
|
|
23
|
+
lg: "min-h-12 min-w-12",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const prevNextSizeClass: Record<PaginationSize, string> = {
|
|
27
|
+
sm: "px-3",
|
|
28
|
+
default: "px-4",
|
|
29
|
+
lg: "px-5",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type PaginationProps = React.ComponentProps<"nav"> & {
|
|
33
|
+
/**
|
|
34
|
+
* Controls the hit-target size of every page link, Previous, Next, and
|
|
35
|
+
* ellipsis within this nav (peer parity: MUI Pagination `size`, Mantine
|
|
36
|
+
* Pagination `size`, Chakra UI Pagination `size`).
|
|
37
|
+
*
|
|
38
|
+
* sm = 36×36px (dense chrome — table footers, list paginators)
|
|
39
|
+
* default = 44×44px (CTA floor — the baseline)
|
|
40
|
+
* lg = 48×48px (prominent surfaces — full-bleed paginators)
|
|
41
|
+
*
|
|
42
|
+
* sm is below the WCAG 2.5.5 Enhanced 44px floor; use it only in dense
|
|
43
|
+
* non-CTA chrome where the layout cannot accommodate min-h-11 controls.
|
|
44
|
+
*/
|
|
45
|
+
size?: PaginationSize
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Pagination({ className, size = "default", ...props }: PaginationProps) {
|
|
8
49
|
return (
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
50
|
+
<PaginationContext.Provider value={size}>
|
|
51
|
+
<nav
|
|
52
|
+
role="navigation"
|
|
53
|
+
aria-label="pagination"
|
|
54
|
+
data-slot="pagination"
|
|
55
|
+
data-size={size}
|
|
56
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
</PaginationContext.Provider>
|
|
16
60
|
)
|
|
17
61
|
}
|
|
18
62
|
|
|
@@ -50,6 +94,7 @@ function PaginationLink({
|
|
|
50
94
|
disabled,
|
|
51
95
|
...props
|
|
52
96
|
}: PaginationLinkProps) {
|
|
97
|
+
const size = React.useContext(PaginationContext)
|
|
53
98
|
return (
|
|
54
99
|
<a
|
|
55
100
|
aria-current={isActive ? "page" : undefined}
|
|
@@ -61,7 +106,7 @@ function PaginationLink({
|
|
|
61
106
|
variant: isActive ? "default" : "ghost",
|
|
62
107
|
size: "icon",
|
|
63
108
|
}),
|
|
64
|
-
|
|
109
|
+
linkSizeClass[size],
|
|
65
110
|
disabled && "pointer-events-none opacity-50",
|
|
66
111
|
className
|
|
67
112
|
)}
|
|
@@ -75,12 +120,15 @@ function PaginationPrevious({
|
|
|
75
120
|
disabled,
|
|
76
121
|
...props
|
|
77
122
|
}: React.ComponentProps<typeof PaginationLink>) {
|
|
123
|
+
const size = React.useContext(PaginationContext)
|
|
78
124
|
return (
|
|
79
125
|
<PaginationLink
|
|
80
126
|
aria-label="Previous page"
|
|
81
127
|
disabled={disabled}
|
|
82
128
|
className={cn(
|
|
83
|
-
"w-auto gap-1
|
|
129
|
+
"w-auto gap-1 text-sm font-medium",
|
|
130
|
+
linkSizeClass[size],
|
|
131
|
+
prevNextSizeClass[size],
|
|
84
132
|
className
|
|
85
133
|
)}
|
|
86
134
|
{...props}
|
|
@@ -96,12 +144,15 @@ function PaginationNext({
|
|
|
96
144
|
disabled,
|
|
97
145
|
...props
|
|
98
146
|
}: React.ComponentProps<typeof PaginationLink>) {
|
|
147
|
+
const size = React.useContext(PaginationContext)
|
|
99
148
|
return (
|
|
100
149
|
<PaginationLink
|
|
101
150
|
aria-label="Next page"
|
|
102
151
|
disabled={disabled}
|
|
103
152
|
className={cn(
|
|
104
|
-
"w-auto gap-1
|
|
153
|
+
"w-auto gap-1 text-sm font-medium",
|
|
154
|
+
linkSizeClass[size],
|
|
155
|
+
prevNextSizeClass[size],
|
|
105
156
|
className
|
|
106
157
|
)}
|
|
107
158
|
{...props}
|
|
@@ -116,12 +167,14 @@ function PaginationEllipsis({
|
|
|
116
167
|
className,
|
|
117
168
|
...props
|
|
118
169
|
}: React.ComponentProps<"span">) {
|
|
170
|
+
const size = React.useContext(PaginationContext)
|
|
119
171
|
return (
|
|
120
172
|
<span
|
|
121
173
|
aria-hidden
|
|
122
174
|
data-slot="pagination-ellipsis"
|
|
123
175
|
className={cn(
|
|
124
|
-
"flex
|
|
176
|
+
"flex items-center justify-center text-muted-foreground",
|
|
177
|
+
linkSizeClass[size],
|
|
125
178
|
className
|
|
126
179
|
)}
|
|
127
180
|
{...props}
|
|
@@ -40,6 +40,20 @@ type ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root> & {
|
|
|
40
40
|
* pair with a label or aria-label that names the state.
|
|
41
41
|
*/
|
|
42
42
|
intent?: "default" | "success" | "warning" | "error" | "info"
|
|
43
|
+
/**
|
|
44
|
+
* Renders diagonal stripe marks across the indicator fill. Stripes are a
|
|
45
|
+
* semi-transparent white overlay so they read on every intent without
|
|
46
|
+
* hardcoded colors. Pair with `animated` to animate the stripe sweep.
|
|
47
|
+
* Never use stripes as the sole signal of a state — pair with a label
|
|
48
|
+
* or aria-label (e.g. "Uploading…", "Processing…").
|
|
49
|
+
*/
|
|
50
|
+
striped?: boolean
|
|
51
|
+
/**
|
|
52
|
+
* Animates the stripe pattern with a left-to-right sweep (ambient loop).
|
|
53
|
+
* Only meaningful when `striped` is also true. Reduced-motion users see
|
|
54
|
+
* a static stripe — the base layer collapses the animation to 0.01ms.
|
|
55
|
+
*/
|
|
56
|
+
animated?: boolean
|
|
43
57
|
}
|
|
44
58
|
|
|
45
59
|
// Mirrors Radix Progress's built-in getValueLabel default so the visible
|
|
@@ -65,6 +79,8 @@ function Progress({
|
|
|
65
79
|
showValue,
|
|
66
80
|
size = "default",
|
|
67
81
|
intent = "default",
|
|
82
|
+
striped = false,
|
|
83
|
+
animated = false,
|
|
68
84
|
...props
|
|
69
85
|
}: ProgressProps) {
|
|
70
86
|
const labelId = React.useId()
|
|
@@ -119,6 +135,8 @@ function Progress({
|
|
|
119
135
|
<ProgressPrimitive.Indicator
|
|
120
136
|
data-slot="progress-indicator"
|
|
121
137
|
data-intent={intent}
|
|
138
|
+
data-striped={striped ? "true" : undefined}
|
|
139
|
+
data-animated={striped && animated ? "true" : undefined}
|
|
122
140
|
className={cn(
|
|
123
141
|
"h-full w-full flex-1 transition-transform",
|
|
124
142
|
intentIndicatorClass[intent]
|