@behavioral-agentic-design-system/core 0.29.0 → 0.32.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/LICENSE +21 -0
- package/package.json +2 -1
- package/scripts/build-tokens.cjs +59 -10
- package/scripts/wcag-audit.cjs +30 -4
- package/src/app/preview/components/page.tsx +305 -1
- package/src/app/preview/health/page.tsx +201 -0
- package/src/app/shell.tsx +40 -4
- package/src/components/docs-tab.tsx +26 -9
- package/src/components/home-tab.tsx +12 -3
- package/src/components/ui/badge.tsx +16 -2
- package/src/components/ui/button.tsx +10 -0
- package/src/components/ui/checkbox.tsx +21 -6
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/input-clear-button.tsx +52 -0
- package/src/components/ui/input.tsx +5 -21
- package/src/components/ui/multi-select.tsx +20 -6
- package/src/components/ui/progress.tsx +23 -1
- package/src/components/ui/questionnaire.tsx +352 -0
- package/src/components/ui/sidebar.tsx +5 -0
- package/src/components/ui/skeleton.tsx +83 -1
- package/src/components/ui/tabs.tsx +34 -0
- package/src/components/ui/textarea.tsx +5 -0
- package/src/components/ui/toggle-tip.tsx +125 -0
- package/src/data/docs-index.ts +51 -3
- package/src/fonts-cdn.css +25 -0
- package/src/lib/fork.ts +21 -0
- package/src/lib/get-icon-color.ts +66 -0
- package/src/stories/Badge.stories.tsx +66 -0
- package/src/stories/Button.stories.tsx +3 -0
- package/src/stories/Checkbox.stories.tsx +58 -4
- package/src/stories/Input.stories.tsx +3 -0
- package/src/stories/InputClearButton.stories.tsx +53 -0
- package/src/stories/MultiSelect.stories.tsx +6 -2
- package/src/stories/Progress.stories.tsx +56 -4
- package/src/stories/Questionnaire.stories.tsx +287 -0
- package/src/stories/Sidebar.stories.tsx +2 -0
- package/src/stories/SkeletonTable.stories.tsx +97 -0
- package/src/stories/Stack.stories.tsx +2 -1
- package/src/stories/Tabs.stories.tsx +56 -8
- package/src/stories/Textarea.stories.tsx +2 -0
- package/src/stories/ToggleTip.stories.tsx +106 -0
- package/src/styles.css +22 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthew Stephens
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"./package.json": "./package.json",
|
|
53
53
|
"./styles.css": "./src/styles.css",
|
|
54
54
|
"./fonts.css": "./src/fonts.css",
|
|
55
|
+
"./fonts-cdn.css": "./src/fonts-cdn.css",
|
|
55
56
|
"./brand-fonts.css": "./src/brand-fonts.css",
|
|
56
57
|
"./density.css": "./src/density.css",
|
|
57
58
|
"./fonts/*": "./src/fonts/*",
|
package/scripts/build-tokens.cjs
CHANGED
|
@@ -33,6 +33,7 @@ const path = require('path');
|
|
|
33
33
|
const ROOT = process.cwd();
|
|
34
34
|
const TOKENS = path.join(ROOT, 'packages/core/src/tokens.json');
|
|
35
35
|
const PKG_CSS = path.join(ROOT, 'packages/core/src/styles.css');
|
|
36
|
+
const PKG_FONTS_CDN_CSS = path.join(ROOT, 'packages/core/src/fonts-cdn.css');
|
|
36
37
|
const APP_CSS = path.join(ROOT, 'styles/globals.css');
|
|
37
38
|
const CLIENT_EXTRAS = path.join(ROOT, 'styles/client-extras.css');
|
|
38
39
|
|
|
@@ -1060,20 +1061,31 @@ const pkgCss = `${banner}
|
|
|
1060
1061
|
/* @behavioral-agentic-design-system/core — single-file theme import.
|
|
1061
1062
|
*
|
|
1062
1063
|
* Usage in your app's global stylesheet:
|
|
1064
|
+
* @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
|
|
1063
1065
|
* @import "tailwindcss";
|
|
1064
1066
|
* @import "tw-animate-css";
|
|
1065
1067
|
* @import "@behavioral-agentic-design-system/core/styles.css";
|
|
1066
1068
|
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
+
* fonts-cdn.css goes FIRST and is optional — skip it if the app loads Inter
|
|
1070
|
+
* and Atkinson Hyperlegible itself (next/font, self-hosted woff2). Everything
|
|
1071
|
+
* else about font setup is zero-config. Override any token by re-declaring it
|
|
1072
|
+
* after this @import.
|
|
1069
1073
|
*/
|
|
1070
1074
|
|
|
1071
|
-
/*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1075
|
-
@import
|
|
1076
|
-
|
|
1075
|
+
/* This file deliberately contains NO remote \`@import url(...)\`.
|
|
1076
|
+
*
|
|
1077
|
+
* CSS only allows @import ahead of all rules. A consumer imports this file
|
|
1078
|
+
* AFTER \`@import "tailwindcss"\`, which expands into real rules — so a remote
|
|
1079
|
+
* @import here parses as invalid CSS, lightningcss/Turbopack fails the whole
|
|
1080
|
+
* stylesheet, and every route 500s. It went unnoticed for a long time because
|
|
1081
|
+
* the preview app in this repo never imports this file the way a consumer
|
|
1082
|
+
* does; it reads styles/globals.css, where the font imports lead. The Google
|
|
1083
|
+
* Fonts CDN faces now live in the separate fonts-cdn.css, which a consumer
|
|
1084
|
+
* places before Tailwind. check:consumer-css compiles the documented usage
|
|
1085
|
+
* above and fails if this ever regresses.
|
|
1086
|
+
*
|
|
1087
|
+
* The relative imports below are fine: the bundler inlines them rather than
|
|
1088
|
+
* leaving an @import statement in the output. */
|
|
1077
1089
|
|
|
1078
1090
|
/* Self-hosted brand faces shipped inside this package. fonts.css holds the
|
|
1079
1091
|
* canonical SIL OFL defaults (Hyperlegible Sans, 6 weights). brand-fonts.css
|
|
@@ -1082,8 +1094,9 @@ const pkgCss = `${banner}
|
|
|
1082
1094
|
* — consumers copy the binaries from
|
|
1083
1095
|
* \`node_modules/@behavioral-agentic-design-system/core/fonts/\` into their own
|
|
1084
1096
|
* \`public/fonts/\` so the URLs resolve. See CLIENT_ONBOARDING.md → Shipping
|
|
1085
|
-
* fonts.
|
|
1086
|
-
*
|
|
1097
|
+
* fonts. Load order still puts the CDN faces first (lowest priority fallback)
|
|
1098
|
+
* and these local @font-face rules after, so the brand stack wins — that
|
|
1099
|
+
* ordering is now the consumer's import order, not this file's.
|
|
1087
1100
|
*/
|
|
1088
1101
|
@import "./fonts.css";
|
|
1089
1102
|
@import "./brand-fonts.css";
|
|
@@ -1145,6 +1158,42 @@ ${borderColorUtilities}
|
|
|
1145
1158
|
fs.writeFileSync(PKG_CSS, pkgCss);
|
|
1146
1159
|
console.log(`✓ wrote ${path.relative(ROOT, PKG_CSS)}`);
|
|
1147
1160
|
|
|
1161
|
+
// ---- packages/core/src/fonts-cdn.css (consumer-facing, opt-in) ------------
|
|
1162
|
+
|
|
1163
|
+
// The Google Fonts CDN faces live here, alone, because a remote `@import
|
|
1164
|
+
// url(...)` is only valid ahead of every rule. Consumers import this file
|
|
1165
|
+
// FIRST — before `@import "tailwindcss"` — and styles.css third, which is the
|
|
1166
|
+
// only ordering CSS actually permits. Keep this file rule-free: one comment
|
|
1167
|
+
// and the @import statements, nothing else.
|
|
1168
|
+
const pkgFontsCdnCss = `${banner}
|
|
1169
|
+
|
|
1170
|
+
/* @behavioral-agentic-design-system/core — Google Fonts CDN faces (opt-in).
|
|
1171
|
+
*
|
|
1172
|
+
* Import this FIRST in your global stylesheet, ahead of Tailwind:
|
|
1173
|
+
* @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
|
|
1174
|
+
* @import "tailwindcss";
|
|
1175
|
+
* @import "tw-animate-css";
|
|
1176
|
+
* @import "@behavioral-agentic-design-system/core/styles.css";
|
|
1177
|
+
*
|
|
1178
|
+
* Remote @import statements are legal only before any rule, and Tailwind
|
|
1179
|
+
* expands into rules — so these cannot live in styles.css, which is imported
|
|
1180
|
+
* after it. Skip this file entirely if the app already loads Inter and
|
|
1181
|
+
* Atkinson Hyperlegible itself (next/font, or self-hosted woff2 copied out of
|
|
1182
|
+
* this package's fonts/ directory); the CDN is the zero-setup fallback, and
|
|
1183
|
+
* the local @font-face rules in fonts.css win over it either way.
|
|
1184
|
+
*
|
|
1185
|
+
* Inter Variable leads as the default sans; Atkinson Hyperlegible stays as
|
|
1186
|
+
* the accessibility-preserving secondary.
|
|
1187
|
+
*
|
|
1188
|
+
* This file must contain NO rules of its own — a single rule here would make
|
|
1189
|
+
* the @import statements below invalid for anyone importing it. */
|
|
1190
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1191
|
+
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
|
|
1192
|
+
`;
|
|
1193
|
+
|
|
1194
|
+
fs.writeFileSync(PKG_FONTS_CDN_CSS, pkgFontsCdnCss);
|
|
1195
|
+
console.log(`✓ wrote ${path.relative(ROOT, PKG_FONTS_CDN_CSS)}`);
|
|
1196
|
+
|
|
1148
1197
|
// ---- styles/globals.css (preview app) ------------------------------------
|
|
1149
1198
|
|
|
1150
1199
|
// Note: Google Fonts @imports are intentionally NOT emitted for the preview app.
|
package/scripts/wcag-audit.cjs
CHANGED
|
@@ -43,10 +43,36 @@
|
|
|
43
43
|
const fs = require('fs');
|
|
44
44
|
const path = require('path');
|
|
45
45
|
|
|
46
|
-
// Shipped as the `bads-wcag-audit` bin.
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
46
|
+
// Shipped as the `bads-wcag-audit` bin. The token file is consumer-owned, but
|
|
47
|
+
// "consumer" means three different repo layouts and only one of them has a
|
|
48
|
+
// packages/ directory:
|
|
49
|
+
//
|
|
50
|
+
// 1. upstream BADS / a fork → packages/core/src/tokens.json
|
|
51
|
+
// 2. an npm consumer → tokens.json at its own root
|
|
52
|
+
// 3. an npm consumer that → the package's shipped defaults, so the audit
|
|
53
|
+
// keeps @core's theme still runs instead of dying
|
|
54
|
+
//
|
|
55
|
+
// Resolving only against `<cwd>/packages/core/src/tokens.json` (the shape this
|
|
56
|
+
// script shipped with) made the command unusable for anyone who installed the
|
|
57
|
+
// package rather than forking it — it exited with ENOENT before printing
|
|
58
|
+
// anything. Found 2026-08-24 from a consumer repo.
|
|
59
|
+
const TOKEN_CANDIDATES = [
|
|
60
|
+
process.env.BADS_TOKENS,
|
|
61
|
+
path.join(process.cwd(), 'packages/core/src/tokens.json'),
|
|
62
|
+
path.join(process.cwd(), 'tokens.json'),
|
|
63
|
+
path.join(__dirname, '..', 'src', 'tokens.json'),
|
|
64
|
+
].filter(Boolean);
|
|
65
|
+
|
|
66
|
+
const TOKENS = TOKEN_CANDIDATES.find((p) => fs.existsSync(p));
|
|
67
|
+
if (!TOKENS) {
|
|
68
|
+
console.error(
|
|
69
|
+
'wcag-audit: no tokens.json found. Looked in:\n' +
|
|
70
|
+
TOKEN_CANDIDATES.map((p) => ` ${p}`).join('\n') +
|
|
71
|
+
'\n\nSet BADS_TOKENS=/path/to/tokens.json to point at it explicitly.'
|
|
72
|
+
);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
50
76
|
const BRAND_COLORS = path.join(process.cwd(), 'brand-colors.json');
|
|
51
77
|
|
|
52
78
|
const aa = process.argv.includes('--aa');
|
|
@@ -74,7 +74,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@beha
|
|
|
74
74
|
import { Alert, AlertDescription, AlertTitle } from "@behavioral-agentic-design-system/core/components/ui/alert";
|
|
75
75
|
import { Avatar, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
76
76
|
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
77
|
-
import { Skeleton } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
|
|
77
|
+
import { Skeleton, SkeletonTable } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
|
|
78
78
|
import { Progress } from "@behavioral-agentic-design-system/core/components/ui/progress";
|
|
79
79
|
import { Slider } from "@behavioral-agentic-design-system/core/components/ui/slider";
|
|
80
80
|
import { ScrollArea } from "@behavioral-agentic-design-system/core/components/ui/scroll-area";
|
|
@@ -412,6 +412,8 @@ import {
|
|
|
412
412
|
TreeSelect,
|
|
413
413
|
type TreeSelectNode,
|
|
414
414
|
} from "@behavioral-agentic-design-system/core/components/ui/tree-select";
|
|
415
|
+
import { Questionnaire } from "@behavioral-agentic-design-system/core/components/ui/questionnaire";
|
|
416
|
+
import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
|
|
415
417
|
|
|
416
418
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
417
419
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -932,6 +934,17 @@ export default function ComponentsPreview() {
|
|
|
932
934
|
</div>
|
|
933
935
|
<Separator className="my-4" />
|
|
934
936
|
<div className="space-y-3">
|
|
937
|
+
<Label>Checkbox sizes</Label>
|
|
938
|
+
<div className="flex items-center gap-6">
|
|
939
|
+
<div className="flex items-center gap-2">
|
|
940
|
+
<Checkbox id="cb-sm" size="sm" defaultChecked />
|
|
941
|
+
<Label htmlFor="cb-sm">Small (24px)</Label>
|
|
942
|
+
</div>
|
|
943
|
+
<div className="flex items-center gap-2">
|
|
944
|
+
<Checkbox id="cb-default-size" defaultChecked />
|
|
945
|
+
<Label htmlFor="cb-default-size">Default (32px)</Label>
|
|
946
|
+
</div>
|
|
947
|
+
</div>
|
|
935
948
|
<Label id="form-controls-slider-label">Slider</Label>
|
|
936
949
|
<Slider
|
|
937
950
|
defaultValue={[40]}
|
|
@@ -973,6 +986,13 @@ export default function ComponentsPreview() {
|
|
|
973
986
|
getValueLabel={(value, max) => `${value} of ${max} components`}
|
|
974
987
|
/>
|
|
975
988
|
</div>
|
|
989
|
+
<Label className="pt-3">Progress intents</Label>
|
|
990
|
+
<div className="space-y-4">
|
|
991
|
+
<Progress value={100} intent="success" label="Deployment complete" showValue />
|
|
992
|
+
<Progress value={78} intent="warning" label="Disk quota: 78% used" showValue />
|
|
993
|
+
<Progress value={100} intent="error" label="Build failed" showValue />
|
|
994
|
+
<Progress value={42} intent="info" label="Syncing design tokens" showValue />
|
|
995
|
+
</div>
|
|
976
996
|
</div>
|
|
977
997
|
</Section>
|
|
978
998
|
|
|
@@ -998,6 +1018,33 @@ export default function ComponentsPreview() {
|
|
|
998
1018
|
Preview
|
|
999
1019
|
</Badge>
|
|
1000
1020
|
</div>
|
|
1021
|
+
<div className="mt-4 space-y-2">
|
|
1022
|
+
<p className="text-xs font-medium text-muted-foreground">sizes:</p>
|
|
1023
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1024
|
+
<Badge size="sm">v2.4.1</Badge>
|
|
1025
|
+
<Badge size="sm" variant="success">
|
|
1026
|
+
<CircleCheck strokeWidth={1.5} aria-hidden />
|
|
1027
|
+
Passing
|
|
1028
|
+
</Badge>
|
|
1029
|
+
<Badge size="sm" variant="outline">sm</Badge>
|
|
1030
|
+
</div>
|
|
1031
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1032
|
+
<Badge>v2.4.1</Badge>
|
|
1033
|
+
<Badge variant="success">
|
|
1034
|
+
<CircleCheck strokeWidth={1.5} aria-hidden />
|
|
1035
|
+
Passing
|
|
1036
|
+
</Badge>
|
|
1037
|
+
<Badge variant="outline">default</Badge>
|
|
1038
|
+
</div>
|
|
1039
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1040
|
+
<Badge size="lg">v2.4.1</Badge>
|
|
1041
|
+
<Badge size="lg" variant="success">
|
|
1042
|
+
<CircleCheck strokeWidth={1.5} aria-hidden />
|
|
1043
|
+
Passing
|
|
1044
|
+
</Badge>
|
|
1045
|
+
<Badge size="lg" variant="outline">lg</Badge>
|
|
1046
|
+
</div>
|
|
1047
|
+
</div>
|
|
1001
1048
|
<Separator className="my-4" />
|
|
1002
1049
|
<div className="flex items-center gap-3">
|
|
1003
1050
|
<Avatar>
|
|
@@ -6008,6 +6055,93 @@ export default function ComponentsPreview() {
|
|
|
6008
6055
|
<Section title="CloseButton">
|
|
6009
6056
|
<CloseButtonShowcase />
|
|
6010
6057
|
</Section>
|
|
6058
|
+
|
|
6059
|
+
<Section title="Questionnaire">
|
|
6060
|
+
<QuestionnaireShowcase />
|
|
6061
|
+
</Section>
|
|
6062
|
+
|
|
6063
|
+
<Section title="Toggle Tip">
|
|
6064
|
+
<ToggleTipShowcase />
|
|
6065
|
+
</Section>
|
|
6066
|
+
<Section title="SkeletonTable">
|
|
6067
|
+
<SkeletonTableShowcase />
|
|
6068
|
+
</Section>
|
|
6069
|
+
</div>
|
|
6070
|
+
</div>
|
|
6071
|
+
);
|
|
6072
|
+
}
|
|
6073
|
+
|
|
6074
|
+
function ToggleTipShowcase() {
|
|
6075
|
+
return (
|
|
6076
|
+
<div className="space-y-8">
|
|
6077
|
+
<p className="text-sm text-muted-foreground">
|
|
6078
|
+
Click-triggered, toggleable information overlay with an arrow — the
|
|
6079
|
+
touch- and keyboard-accessible counterpart to Tooltip. Opens on
|
|
6080
|
+
click/tap/Enter/Space and toggles closed; Escape and outside-click
|
|
6081
|
+
dismiss. Rides the normal Popover token surface, so normal semantic
|
|
6082
|
+
tokens are safe inside. Not for interactive content (that's
|
|
6083
|
+
Popover) and not a Tooltip replacement on hover surfaces.
|
|
6084
|
+
</p>
|
|
6085
|
+
|
|
6086
|
+
<div>
|
|
6087
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
6088
|
+
Default — ghost icon Button trigger, tip on top.
|
|
6089
|
+
</p>
|
|
6090
|
+
<ToggleTip content="Semantic tokens alias primitives, so one brand change propagates everywhere.">
|
|
6091
|
+
<Button
|
|
6092
|
+
variant="ghost"
|
|
6093
|
+
size="icon"
|
|
6094
|
+
aria-label="More about semantic tokens"
|
|
6095
|
+
>
|
|
6096
|
+
<Info strokeWidth={1.5} className="size-4" />
|
|
6097
|
+
</Button>
|
|
6098
|
+
</ToggleTip>
|
|
6099
|
+
</div>
|
|
6100
|
+
|
|
6101
|
+
<div>
|
|
6102
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
6103
|
+
Disabled — the tip never opens while the trigger is disabled.
|
|
6104
|
+
</p>
|
|
6105
|
+
<ToggleTip
|
|
6106
|
+
disabled
|
|
6107
|
+
content="This tip never opens while the trigger is disabled."
|
|
6108
|
+
>
|
|
6109
|
+
<Button
|
|
6110
|
+
variant="ghost"
|
|
6111
|
+
size="icon"
|
|
6112
|
+
aria-label="More about semantic tokens"
|
|
6113
|
+
>
|
|
6114
|
+
<Info strokeWidth={1.5} className="size-4" />
|
|
6115
|
+
</Button>
|
|
6116
|
+
</ToggleTip>
|
|
6117
|
+
</div>
|
|
6118
|
+
|
|
6119
|
+
<div>
|
|
6120
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
6121
|
+
Form-label composition — the canonical placement: an info icon
|
|
6122
|
+
beside a Label, tip opening to the right.
|
|
6123
|
+
</p>
|
|
6124
|
+
<div className="w-80 space-y-3">
|
|
6125
|
+
<div className="flex items-center gap-1">
|
|
6126
|
+
<Label htmlFor="toggle-tip-npm-scope">npm scope</Label>
|
|
6127
|
+
<ToggleTip
|
|
6128
|
+
side="right"
|
|
6129
|
+
content="The package prefix your forks import from. The npm package name stays @behavioral-agentic-design-system/core even after a rename."
|
|
6130
|
+
>
|
|
6131
|
+
<Button
|
|
6132
|
+
variant="ghost"
|
|
6133
|
+
size="icon-sm"
|
|
6134
|
+
aria-label="What is an npm scope?"
|
|
6135
|
+
>
|
|
6136
|
+
<Info strokeWidth={1.5} className="size-4" />
|
|
6137
|
+
</Button>
|
|
6138
|
+
</ToggleTip>
|
|
6139
|
+
</div>
|
|
6140
|
+
<Input
|
|
6141
|
+
id="toggle-tip-npm-scope"
|
|
6142
|
+
defaultValue="@behavioral-agentic-design-system"
|
|
6143
|
+
/>
|
|
6144
|
+
</div>
|
|
6011
6145
|
</div>
|
|
6012
6146
|
</div>
|
|
6013
6147
|
);
|
|
@@ -6066,6 +6200,7 @@ function CloseButtonShowcase() {
|
|
|
6066
6200
|
Restore the dismissed notification
|
|
6067
6201
|
</Button>
|
|
6068
6202
|
) : (
|
|
6203
|
+
// lint-disable: card-bypass — inline notification row composition; CloseButton stories need the raw layout context, not a Card wrapper
|
|
6069
6204
|
<div className="flex w-full max-w-md items-start justify-between gap-3 rounded-lg border border-border bg-card p-4">
|
|
6070
6205
|
<div className="min-w-0">
|
|
6071
6206
|
<p className="text-sm font-medium text-foreground">
|
|
@@ -6112,6 +6247,7 @@ function SimpleGridShowcase() {
|
|
|
6112
6247
|
{Array.from({ length: n }, (_, i) => (
|
|
6113
6248
|
<div
|
|
6114
6249
|
key={i}
|
|
6250
|
+
// lint-disable: card-bypass — dashed-border placeholder cell for SimpleGrid columns demo; visual ruler cell, not content Card
|
|
6115
6251
|
className="flex h-12 items-center justify-center rounded-lg border border-dashed border-border bg-card"
|
|
6116
6252
|
>
|
|
6117
6253
|
<span className="text-sm text-muted-foreground">{`${
|
|
@@ -6133,6 +6269,7 @@ function SimpleGridShowcase() {
|
|
|
6133
6269
|
{Array.from({ length: 4 }, (_, i) => (
|
|
6134
6270
|
<div
|
|
6135
6271
|
key={i}
|
|
6272
|
+
// lint-disable: card-bypass — dashed-border placeholder cell for SimpleGrid responsive showcase; visual demo cell, not content Card
|
|
6136
6273
|
className="flex h-12 items-center justify-center rounded-lg border border-dashed border-border bg-card"
|
|
6137
6274
|
>
|
|
6138
6275
|
<span className="text-sm text-muted-foreground">
|
|
@@ -6213,6 +6350,7 @@ function ContainerShowcase() {
|
|
|
6213
6350
|
<div className="space-y-3 rounded-lg bg-muted/40 py-4">
|
|
6214
6351
|
{(["sm", "md", "lg", "xl", "full"] as const).map((size) => (
|
|
6215
6352
|
<Container key={size} size={size}>
|
|
6353
|
+
{/* lint-disable: card-bypass — dashed-border size label for Container showcase; visual ruler cell, not a Card */}
|
|
6216
6354
|
<div className="rounded-lg border border-dashed border-border bg-card px-4 py-2">
|
|
6217
6355
|
<p className="text-sm text-muted-foreground">{`size="${size}"`}</p>
|
|
6218
6356
|
</div>
|
|
@@ -6228,6 +6366,7 @@ function ContainerShowcase() {
|
|
|
6228
6366
|
</p>
|
|
6229
6367
|
<div className="rounded-lg bg-muted/40 py-4">
|
|
6230
6368
|
<Container size="sm" gutters={false}>
|
|
6369
|
+
{/* lint-disable: card-bypass — dashed-border label for Container gutters=false demo; visual ruler cell, not a Card */}
|
|
6231
6370
|
<div className="rounded-lg border border-dashed border-border bg-card px-4 py-2">
|
|
6232
6371
|
<p className="text-sm text-muted-foreground">
|
|
6233
6372
|
No horizontal padding of its own
|
|
@@ -6323,6 +6462,7 @@ function StatusBadgeShowcase() {
|
|
|
6323
6462
|
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
6324
6463
|
Realistic use — service health list.
|
|
6325
6464
|
</p>
|
|
6465
|
+
{/* lint-disable: card-bypass — divide-y service health list; divide-y pattern requires the raw border container, a Card would add conflicting inner padding */}
|
|
6326
6466
|
<div className="flex w-96 flex-col divide-y divide-border rounded-lg border border-border bg-card">
|
|
6327
6467
|
{(
|
|
6328
6468
|
[
|
|
@@ -11430,3 +11570,167 @@ function DateFieldShowcase() {
|
|
|
11430
11570
|
</div>
|
|
11431
11571
|
);
|
|
11432
11572
|
}
|
|
11573
|
+
|
|
11574
|
+
function QuestionnaireShowcase() {
|
|
11575
|
+
const AGENT_QUESTIONS = [
|
|
11576
|
+
{
|
|
11577
|
+
id: "intent",
|
|
11578
|
+
prompt: "What would you like to do with the tokens v2 proposal?",
|
|
11579
|
+
type: "single" as const,
|
|
11580
|
+
options: [
|
|
11581
|
+
{ value: "review", label: "Schedule a review with the full team" },
|
|
11582
|
+
{ value: "approve", label: "Approve it as-is and move to implementation" },
|
|
11583
|
+
{ value: "revise", label: "Request revisions before moving forward" },
|
|
11584
|
+
{ value: "defer", label: "Defer until Q4 planning" },
|
|
11585
|
+
],
|
|
11586
|
+
},
|
|
11587
|
+
{
|
|
11588
|
+
id: "stakeholders",
|
|
11589
|
+
prompt: "Who else needs to be in the loop?",
|
|
11590
|
+
type: "multiple" as const,
|
|
11591
|
+
options: [
|
|
11592
|
+
{ value: "riley", label: "Riley Okafor — brand lead" },
|
|
11593
|
+
{ value: "jordan", label: "Jordan Reeves — design systems" },
|
|
11594
|
+
{ value: "avery", label: "Avery Nakamura — engineering" },
|
|
11595
|
+
{ value: "morgan", label: "Morgan Castellano — product" },
|
|
11596
|
+
],
|
|
11597
|
+
},
|
|
11598
|
+
{
|
|
11599
|
+
id: "notes",
|
|
11600
|
+
prompt: "Any context you'd like added to the calendar invite? (optional)",
|
|
11601
|
+
type: "freeform" as const,
|
|
11602
|
+
skippable: true,
|
|
11603
|
+
skipLabel: "No context needed",
|
|
11604
|
+
},
|
|
11605
|
+
];
|
|
11606
|
+
|
|
11607
|
+
return (
|
|
11608
|
+
<div className="space-y-8">
|
|
11609
|
+
<p className="text-sm text-muted-foreground">
|
|
11610
|
+
One-question-at-a-time form primitive for agentic clarification prompts,
|
|
11611
|
+
onboarding flows, and configuration wizards. Supports single-choice (radio),
|
|
11612
|
+
multiple-choice (checkboxes), freeform (textarea), and skippable questions.
|
|
11613
|
+
</p>
|
|
11614
|
+
|
|
11615
|
+
<div>
|
|
11616
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11617
|
+
Single-choice — radio options with highlighted selected state.
|
|
11618
|
+
</p>
|
|
11619
|
+
<div className="w-96">
|
|
11620
|
+
<Questionnaire
|
|
11621
|
+
questions={[
|
|
11622
|
+
{
|
|
11623
|
+
id: "role",
|
|
11624
|
+
prompt: "What best describes your current role?",
|
|
11625
|
+
type: "single",
|
|
11626
|
+
options: [
|
|
11627
|
+
{ value: "designer", label: "Designer" },
|
|
11628
|
+
{ value: "engineer", label: "Engineer" },
|
|
11629
|
+
{ value: "product", label: "Product manager" },
|
|
11630
|
+
{ value: "founder", label: "Founder or executive" },
|
|
11631
|
+
],
|
|
11632
|
+
},
|
|
11633
|
+
]}
|
|
11634
|
+
/>
|
|
11635
|
+
</div>
|
|
11636
|
+
</div>
|
|
11637
|
+
|
|
11638
|
+
<div>
|
|
11639
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11640
|
+
Multiple-choice — checkboxes, multiple selections allowed.
|
|
11641
|
+
</p>
|
|
11642
|
+
<div className="w-96">
|
|
11643
|
+
<Questionnaire
|
|
11644
|
+
questions={[
|
|
11645
|
+
{
|
|
11646
|
+
id: "tools",
|
|
11647
|
+
prompt: "Which design tools does your team use? Select all that apply.",
|
|
11648
|
+
type: "multiple",
|
|
11649
|
+
options: [
|
|
11650
|
+
{ value: "figma", label: "Figma" },
|
|
11651
|
+
{ value: "sketch", label: "Sketch" },
|
|
11652
|
+
{ value: "framer", label: "Framer" },
|
|
11653
|
+
{ value: "storybook", label: "Storybook" },
|
|
11654
|
+
],
|
|
11655
|
+
},
|
|
11656
|
+
]}
|
|
11657
|
+
/>
|
|
11658
|
+
</div>
|
|
11659
|
+
</div>
|
|
11660
|
+
|
|
11661
|
+
<div>
|
|
11662
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11663
|
+
Realistic use — agent clarification flow with all three question types
|
|
11664
|
+
including a skippable freeform step.
|
|
11665
|
+
</p>
|
|
11666
|
+
<Card className="w-[420px] rounded-xl p-6">
|
|
11667
|
+
<p className="mb-4 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
|
11668
|
+
Agent · Clarify intent
|
|
11669
|
+
</p>
|
|
11670
|
+
<Questionnaire
|
|
11671
|
+
questions={AGENT_QUESTIONS}
|
|
11672
|
+
onComplete={(answers) => console.log("Questionnaire complete", answers)}
|
|
11673
|
+
onSkip={(id) => console.log("Skipped", id)}
|
|
11674
|
+
/>
|
|
11675
|
+
</Card>
|
|
11676
|
+
</div>
|
|
11677
|
+
</div>
|
|
11678
|
+
);
|
|
11679
|
+
}
|
|
11680
|
+
|
|
11681
|
+
function SkeletonTableShowcase() {
|
|
11682
|
+
return (
|
|
11683
|
+
<div className="space-y-8">
|
|
11684
|
+
<p className="text-sm text-muted-foreground">
|
|
11685
|
+
Table-shaped loading skeleton. Closes the DataTable loading-state gap —
|
|
11686
|
+
use while async data fetches, then swap for the real table on load. Row
|
|
11687
|
+
and column counts should match the real table shape; organic cell widths
|
|
11688
|
+
prevent the identical-block look.
|
|
11689
|
+
</p>
|
|
11690
|
+
|
|
11691
|
+
<div>
|
|
11692
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11693
|
+
Default — 5 rows × 4 columns, header row, pulse animation.
|
|
11694
|
+
</p>
|
|
11695
|
+
<SkeletonTable />
|
|
11696
|
+
</div>
|
|
11697
|
+
|
|
11698
|
+
<div>
|
|
11699
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11700
|
+
No header — for tables whose header is rendered separately or sticky.
|
|
11701
|
+
</p>
|
|
11702
|
+
<SkeletonTable showHeader={false} />
|
|
11703
|
+
</div>
|
|
11704
|
+
|
|
11705
|
+
<div>
|
|
11706
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11707
|
+
Custom shape — 3 rows × 6 columns.
|
|
11708
|
+
</p>
|
|
11709
|
+
<SkeletonTable rows={3} columns={6} />
|
|
11710
|
+
</div>
|
|
11711
|
+
|
|
11712
|
+
<div>
|
|
11713
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11714
|
+
Wave animation — same as Skeleton wave mode.
|
|
11715
|
+
</p>
|
|
11716
|
+
<SkeletonTable animation="wave" rows={3} />
|
|
11717
|
+
</div>
|
|
11718
|
+
|
|
11719
|
+
<div>
|
|
11720
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
11721
|
+
Realistic use — DataTable card with title + action button skeletons
|
|
11722
|
+
above the table.
|
|
11723
|
+
</p>
|
|
11724
|
+
<Card className="w-full">
|
|
11725
|
+
<CardHeader className="flex flex-row items-center justify-between pb-3">
|
|
11726
|
+
<Skeleton className="h-5 w-44" />
|
|
11727
|
+
<Skeleton className="h-9 w-24 rounded-md" />
|
|
11728
|
+
</CardHeader>
|
|
11729
|
+
<CardContent>
|
|
11730
|
+
<SkeletonTable rows={5} columns={4} showHeader />
|
|
11731
|
+
</CardContent>
|
|
11732
|
+
</Card>
|
|
11733
|
+
</div>
|
|
11734
|
+
</div>
|
|
11735
|
+
);
|
|
11736
|
+
}
|