@behavioral-agentic-design-system/core 0.36.0 → 0.37.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.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)",
|
package/scripts/lint-slop.mjs
CHANGED
|
@@ -64,6 +64,8 @@ import path from "node:path";
|
|
|
64
64
|
// into a client fork, invoked as `npx bads-lint-slop` from the fork's own
|
|
65
65
|
// repo root.
|
|
66
66
|
const ROOT = process.cwd();
|
|
67
|
+
import { RULES } from "./slop-rules.mjs";
|
|
68
|
+
|
|
67
69
|
const advisory = process.argv.includes("--warn");
|
|
68
70
|
const explicitPaths = process.argv.slice(2).filter((a) => !a.startsWith("--"));
|
|
69
71
|
|
|
@@ -77,70 +79,8 @@ const SCAN_ROOTS = [
|
|
|
77
79
|
// Decorative-emoji set — the classic AI-product sprinkle. Excludes ✓/✗/→ and
|
|
78
80
|
// other functional glyphs; excludes the crescent-moon etc. used in Slack briefs
|
|
79
81
|
// (those live in scripts/, out of scan scope).
|
|
80
|
-
const SLOP_EMOJI = /[\u{1F680}\u{2728}\u{26A1}\u{1F389}\u{1F525}\u{1F4A1}\u{1F3AF}\u{1F31F}\u{1F6A8}\u{1F4AA}\u{1F44B}\u{1F984}\u{1F4A5}\u{1F60D}]/u;
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
code: "BADS-SLOP-1",
|
|
85
|
-
name: "gradient-text",
|
|
86
|
-
why: "Rainbow gradient headline (bg-clip-text). Carries no information; the classic 'look premium' move. Use a solid foreground token.",
|
|
87
|
-
test: (line) =>
|
|
88
|
-
(/\bbg-clip-text\b/.test(line) && /\btext-transparent\b/.test(line)) ||
|
|
89
|
-
/background-clip:\s*text/.test(line) ||
|
|
90
|
-
/-webkit-background-clip:\s*text/.test(line),
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
code: "BADS-SLOP-2",
|
|
94
|
-
name: "indigo-violet-gradient",
|
|
95
|
-
why: "Indigo→purple diagonal blend — the single most recognizable AI-default gradient. Use a flat brand or semantic surface.",
|
|
96
|
-
// Only the Tailwind gradient-direction stops — a bare violet hex (e.g. a
|
|
97
|
-
// ColorPicker swatch value) is a color, not a gradient, and must not flag.
|
|
98
|
-
// A raw slop-hex only counts when it sits in an actual gradient function.
|
|
99
|
-
test: (line) =>
|
|
100
|
-
/\b(from|via|to)-(indigo|violet|purple|fuchsia)-\d/.test(line) ||
|
|
101
|
-
(/(linear|radial|conic)-gradient|bg-gradient-to-/.test(line) &&
|
|
102
|
-
/#6366f1|#a855f7|#8b5cf6|#7c3aed/i.test(line)),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
code: "BADS-SLOP-3",
|
|
106
|
-
name: "springy-hover",
|
|
107
|
-
why: "hover:scale-105/110 — the bouncy 'pop' every AI card gets. BADS uses token-driven color/elevation shifts on hover, not scale jumps.",
|
|
108
|
-
test: (line) => /\bhover:scale-1(05|10)\b/.test(line),
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
code: "BADS-SLOP-4",
|
|
112
|
-
name: "oversized-shadow",
|
|
113
|
-
why: "Shadow blur ≥ 40px — the soft 'glow' that bleeds far past the element. BADS uses the --shadow token scale.",
|
|
114
|
-
test: (line) => {
|
|
115
|
-
// arbitrary Tailwind shadow: shadow-[...40px...]
|
|
116
|
-
const arb = line.match(/shadow-\[[^\]]*?\b(\d{2,})px/);
|
|
117
|
-
if (arb && Number(arb[1]) >= 40) return true;
|
|
118
|
-
// inline box-shadow with a blur radius ≥ 40px (3rd length in the list)
|
|
119
|
-
const inline = line.match(/box-?[Ss]hadow[^;"'`]*?\b(\d{2,})px/);
|
|
120
|
-
if (inline && Number(inline[1]) >= 40) return true;
|
|
121
|
-
return false;
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
code: "BADS-SLOP-5",
|
|
126
|
-
name: "emoji-in-ui",
|
|
127
|
-
why: "Decorative emoji in rendered UI copy — 🚀/✨/🔥 on headings and buttons. BADS carries meaning in words, not emoji sprinkle.",
|
|
128
|
-
test: (line, { isComment }) => !isComment && SLOP_EMOJI.test(line),
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
code: "BADS-SLOP-6",
|
|
132
|
-
name: "fake-stat-cliche",
|
|
133
|
-
why: "Invented-metric marketing cliché hardcoded as copy (99.9% uptime, 10k+/1M+ counts, ★★★★★). Real metrics come from data, not string literals — a hardcoded one manufactures trust. Use real content from the personas pool, or escape-hatch a genuine, sourced claim.",
|
|
134
|
-
test: (line, { isComment }) => {
|
|
135
|
-
if (isComment) return false;
|
|
136
|
-
return (
|
|
137
|
-
/\b99\.9{1,2}\s*%/.test(line) || // 99.9% / 99.99% uptime cliché
|
|
138
|
-
/\b\d{1,3}[kKmMbB]\+/.test(line) || // 10k+ / 100k+ / 1M+ vanity counts
|
|
139
|
-
/★{3,}/.test(line) // ★★★★★ rating-star cliché row (filled-star glyph)
|
|
140
|
-
);
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
];
|
|
83
|
+
|
|
144
84
|
|
|
145
85
|
function walk(dir, out = []) {
|
|
146
86
|
if (!fs.existsSync(dir)) return out;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AI-slop signal set — the single definition shared by the lint that
|
|
3
|
+
* enforces it and the eval rubric that scores it.
|
|
4
|
+
*
|
|
5
|
+
* These lived inside lint-slop.mjs as a private const, so the eval had no way
|
|
6
|
+
* to score them without keeping a second copy. Two copies of "what slop is"
|
|
7
|
+
* would drift, which is the failure this whole rule set exists to prevent one
|
|
8
|
+
* level down. Extracted 2026-09-01 so both sides read the same array.
|
|
9
|
+
*
|
|
10
|
+
* Each rule: { code, name, why, test: (line: string) => boolean }.
|
|
11
|
+
* `test` is per-line, so a caller splits source on newlines and applies it.
|
|
12
|
+
*/
|
|
13
|
+
// Decorative-emoji set (BADS-SLOP-5). Lives here because only the rules use it.
|
|
14
|
+
const SLOP_EMOJI = /[\u{1F680}\u{2728}\u{26A1}\u{1F389}\u{1F525}\u{1F4A1}\u{1F3AF}\u{1F31F}\u{1F6A8}\u{1F4AA}\u{1F44B}\u{1F984}\u{1F4A5}\u{1F60D}]/u;
|
|
15
|
+
|
|
16
|
+
export const RULES = [
|
|
17
|
+
{
|
|
18
|
+
code: "BADS-SLOP-1",
|
|
19
|
+
name: "gradient-text",
|
|
20
|
+
why: "Rainbow gradient headline (bg-clip-text). Carries no information; the classic 'look premium' move. Use a solid foreground token.",
|
|
21
|
+
test: (line) =>
|
|
22
|
+
(/\bbg-clip-text\b/.test(line) && /\btext-transparent\b/.test(line)) ||
|
|
23
|
+
/background-clip:\s*text/.test(line) ||
|
|
24
|
+
/-webkit-background-clip:\s*text/.test(line),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
code: "BADS-SLOP-2",
|
|
28
|
+
name: "indigo-violet-gradient",
|
|
29
|
+
why: "Indigo→purple diagonal blend — the single most recognizable AI-default gradient. Use a flat brand or semantic surface.",
|
|
30
|
+
// Only the Tailwind gradient-direction stops — a bare violet hex (e.g. a
|
|
31
|
+
// ColorPicker swatch value) is a color, not a gradient, and must not flag.
|
|
32
|
+
// A raw slop-hex only counts when it sits in an actual gradient function.
|
|
33
|
+
test: (line) =>
|
|
34
|
+
/\b(from|via|to)-(indigo|violet|purple|fuchsia)-\d/.test(line) ||
|
|
35
|
+
(/(linear|radial|conic)-gradient|bg-gradient-to-/.test(line) &&
|
|
36
|
+
/#6366f1|#a855f7|#8b5cf6|#7c3aed/i.test(line)),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: "BADS-SLOP-3",
|
|
40
|
+
name: "springy-hover",
|
|
41
|
+
why: "hover:scale-105/110 — the bouncy 'pop' every AI card gets. BADS uses token-driven color/elevation shifts on hover, not scale jumps.",
|
|
42
|
+
test: (line) => /\bhover:scale-1(05|10)\b/.test(line),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
code: "BADS-SLOP-4",
|
|
46
|
+
name: "oversized-shadow",
|
|
47
|
+
why: "Shadow blur ≥ 40px — the soft 'glow' that bleeds far past the element. BADS uses the --shadow token scale.",
|
|
48
|
+
test: (line) => {
|
|
49
|
+
// arbitrary Tailwind shadow: shadow-[...40px...]
|
|
50
|
+
const arb = line.match(/shadow-\[[^\]]*?\b(\d{2,})px/);
|
|
51
|
+
if (arb && Number(arb[1]) >= 40) return true;
|
|
52
|
+
// inline box-shadow with a blur radius ≥ 40px (3rd length in the list)
|
|
53
|
+
const inline = line.match(/box-?[Ss]hadow[^;"'`]*?\b(\d{2,})px/);
|
|
54
|
+
if (inline && Number(inline[1]) >= 40) return true;
|
|
55
|
+
return false;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
code: "BADS-SLOP-5",
|
|
60
|
+
name: "emoji-in-ui",
|
|
61
|
+
why: "Decorative emoji in rendered UI copy — 🚀/✨/🔥 on headings and buttons. BADS carries meaning in words, not emoji sprinkle.",
|
|
62
|
+
test: (line, { isComment }) => !isComment && SLOP_EMOJI.test(line),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
code: "BADS-SLOP-6",
|
|
66
|
+
name: "fake-stat-cliche",
|
|
67
|
+
why: "Invented-metric marketing cliché hardcoded as copy (99.9% uptime, 10k+/1M+ counts, ★★★★★). Real metrics come from data, not string literals — a hardcoded one manufactures trust. Use real content from the personas pool, or escape-hatch a genuine, sourced claim.",
|
|
68
|
+
test: (line, { isComment }) => {
|
|
69
|
+
if (isComment) return false;
|
|
70
|
+
return (
|
|
71
|
+
/\b99\.9{1,2}\s*%/.test(line) || // 99.9% / 99.99% uptime cliché
|
|
72
|
+
/\b\d{1,3}[kKmMbB]\+/.test(line) || // 10k+ / 100k+ / 1M+ vanity counts
|
|
73
|
+
/★{3,}/.test(line) // ★★★★★ rating-star cliché row (filled-star glyph)
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
@@ -31,6 +31,12 @@ export interface ComboboxProps {
|
|
|
31
31
|
emptyText?: string
|
|
32
32
|
disabled?: boolean
|
|
33
33
|
className?: string
|
|
34
|
+
/**
|
|
35
|
+
* Trigger button height. Maps directly to the Button size prop.
|
|
36
|
+
* Use "xl" (h-11, 44px) for flow-changing CTAs to meet WCAG SC 2.5.5 Enhanced.
|
|
37
|
+
* Default "default" (h-9) is for dense form chrome.
|
|
38
|
+
*/
|
|
39
|
+
size?: "sm" | "default" | "lg" | "xl"
|
|
34
40
|
/**
|
|
35
41
|
* When true, shows a "Create [typed text]" option at the bottom of the dropdown
|
|
36
42
|
* if the typed text does not exactly match any existing option label.
|
|
@@ -53,6 +59,7 @@ function Combobox({
|
|
|
53
59
|
emptyText = "No results found.",
|
|
54
60
|
disabled = false,
|
|
55
61
|
className,
|
|
62
|
+
size = "default",
|
|
56
63
|
creatable = false,
|
|
57
64
|
onCreateOption,
|
|
58
65
|
}: ComboboxProps) {
|
|
@@ -81,6 +88,7 @@ function Combobox({
|
|
|
81
88
|
<Button
|
|
82
89
|
data-slot="combobox"
|
|
83
90
|
variant="outline"
|
|
91
|
+
size={size}
|
|
84
92
|
aria-expanded={open}
|
|
85
93
|
aria-haspopup="listbox"
|
|
86
94
|
disabled={disabled}
|
|
@@ -30,8 +30,21 @@ export interface MultiSelectProps {
|
|
|
30
30
|
disabled?: boolean
|
|
31
31
|
maxCount?: number
|
|
32
32
|
className?: string
|
|
33
|
+
/**
|
|
34
|
+
* Trigger container minimum height. "xl" (min-h-11, 44px) meets WCAG SC 2.5.5
|
|
35
|
+
* Enhanced — use it for flow-changing filter controls and form CTAs.
|
|
36
|
+
* "default" (min-h-9, 36px) is correct for dense form chrome.
|
|
37
|
+
*/
|
|
38
|
+
size?: "sm" | "default" | "lg" | "xl"
|
|
33
39
|
}
|
|
34
40
|
|
|
41
|
+
const SIZE_STYLES = {
|
|
42
|
+
sm: "min-h-7 py-0.5 px-2.5",
|
|
43
|
+
default: "min-h-9 py-1.5 px-3",
|
|
44
|
+
lg: "min-h-10 py-2 px-3",
|
|
45
|
+
xl: "min-h-11 py-2.5 px-3",
|
|
46
|
+
} as const
|
|
47
|
+
|
|
35
48
|
function MultiSelect({
|
|
36
49
|
options,
|
|
37
50
|
value = [],
|
|
@@ -42,6 +55,7 @@ function MultiSelect({
|
|
|
42
55
|
disabled = false,
|
|
43
56
|
maxCount,
|
|
44
57
|
className,
|
|
58
|
+
size = "default",
|
|
45
59
|
}: MultiSelectProps) {
|
|
46
60
|
const [open, setOpen] = React.useState(false)
|
|
47
61
|
|
|
@@ -87,7 +101,8 @@ function MultiSelect({
|
|
|
87
101
|
data-slot="multi-select"
|
|
88
102
|
aria-disabled={disabled || undefined}
|
|
89
103
|
className={cn(
|
|
90
|
-
"relative flex w-full
|
|
104
|
+
"relative flex w-full h-auto items-center justify-between gap-1 rounded-md border border-input bg-background text-sm font-medium shadow-xs",
|
|
105
|
+
SIZE_STYLES[size],
|
|
91
106
|
"cursor-default select-none",
|
|
92
107
|
"hover:bg-accent/50",
|
|
93
108
|
"has-[:focus-visible]:outline-none has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50 has-[:focus-visible]:border-ring",
|
|
@@ -138,6 +138,54 @@ export const Variant_Creatable: Story = {
|
|
|
138
138
|
},
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
+
export const Size_Sm: Story = {
|
|
142
|
+
name: "Size — sm",
|
|
143
|
+
render: () => {
|
|
144
|
+
const [value, setValue] = React.useState("");
|
|
145
|
+
return (
|
|
146
|
+
<Combobox
|
|
147
|
+
options={frameworks}
|
|
148
|
+
value={value}
|
|
149
|
+
onValueChange={setValue}
|
|
150
|
+
placeholder="Select framework..."
|
|
151
|
+
size="sm"
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const Size_Lg: Story = {
|
|
158
|
+
name: "Size — lg",
|
|
159
|
+
render: () => {
|
|
160
|
+
const [value, setValue] = React.useState("");
|
|
161
|
+
return (
|
|
162
|
+
<Combobox
|
|
163
|
+
options={frameworks}
|
|
164
|
+
value={value}
|
|
165
|
+
onValueChange={setValue}
|
|
166
|
+
placeholder="Select framework..."
|
|
167
|
+
size="lg"
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const Size_Xl: Story = {
|
|
174
|
+
name: "Size — xl (CTA floor, 44px)",
|
|
175
|
+
render: () => {
|
|
176
|
+
const [value, setValue] = React.useState("");
|
|
177
|
+
return (
|
|
178
|
+
<Combobox
|
|
179
|
+
options={frameworks}
|
|
180
|
+
value={value}
|
|
181
|
+
onValueChange={setValue}
|
|
182
|
+
placeholder="Select framework..."
|
|
183
|
+
size="xl"
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
141
189
|
export const RealisticUse: Story = {
|
|
142
190
|
decorators: [
|
|
143
191
|
(Story) => (
|
|
@@ -92,6 +92,42 @@ export const EmptyState: Story = {
|
|
|
92
92
|
),
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
export const Size_Sm: Story = {
|
|
96
|
+
name: "Size — sm",
|
|
97
|
+
render: () => {
|
|
98
|
+
const [val, setVal] = React.useState<string[]>([])
|
|
99
|
+
return (
|
|
100
|
+
<div className="w-72">
|
|
101
|
+
<MultiSelect options={FRAMEWORKS} value={val} onValueChange={setVal} size="sm" placeholder="Select frameworks..." />
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const Size_Lg: Story = {
|
|
108
|
+
name: "Size — lg",
|
|
109
|
+
render: () => {
|
|
110
|
+
const [val, setVal] = React.useState<string[]>([])
|
|
111
|
+
return (
|
|
112
|
+
<div className="w-72">
|
|
113
|
+
<MultiSelect options={FRAMEWORKS} value={val} onValueChange={setVal} size="lg" placeholder="Select frameworks..." />
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const Size_Xl: Story = {
|
|
120
|
+
name: "Size — xl (CTA floor, 44 px)",
|
|
121
|
+
render: () => {
|
|
122
|
+
const [val, setVal] = React.useState<string[]>([])
|
|
123
|
+
return (
|
|
124
|
+
<div className="w-72">
|
|
125
|
+
<MultiSelect options={FRAMEWORKS} value={val} onValueChange={setVal} size="xl" placeholder="Select frameworks..." />
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|
|
95
131
|
export const RealisticUse: Story = {
|
|
96
132
|
render: () => {
|
|
97
133
|
const [tags, setTags] = React.useState<string[]>(["next", "remix"])
|