@behavioral-agentic-design-system/core 0.8.3 → 0.8.4
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 +2 -1
- package/scripts/build-tokens.cjs +58 -15
- package/src/app/layout.tsx +1 -0
- package/src/app/preview/components/page.tsx +27 -0
- package/src/density.css +74 -0
- package/src/styles.css +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
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)",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"./styles.css": "./src/styles.css",
|
|
47
47
|
"./fonts.css": "./src/fonts.css",
|
|
48
48
|
"./brand-fonts.css": "./src/brand-fonts.css",
|
|
49
|
+
"./density.css": "./src/density.css",
|
|
49
50
|
"./fonts/*": "./src/fonts/*",
|
|
50
51
|
"./tokens.json": "./src/tokens.json",
|
|
51
52
|
"./tokens.default.json": "./src/tokens.default.json",
|
package/scripts/build-tokens.cjs
CHANGED
|
@@ -529,6 +529,42 @@ const baseLayer = `@layer base {
|
|
|
529
529
|
color: GrayText;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
+
/* Clickable cursor — every interactive primitive gets cursor: pointer
|
|
533
|
+
* so click affordance is visually consistent. Tailwind v4 dropped the
|
|
534
|
+
* implicit pointer on <button> from v3's preflight; this restores it
|
|
535
|
+
* + extends to every other clickable native element and ARIA widget
|
|
536
|
+
* role. Disabled state → cursor: not-allowed so "off" reads as
|
|
537
|
+
* intentional rather than broken.
|
|
538
|
+
*
|
|
539
|
+
* Promoted from swimtopia-prototypes globals.css (2026-06-10) per
|
|
540
|
+
* Sir's "if it's clickable, the cursor says so" rule. */
|
|
541
|
+
button:not(:disabled),
|
|
542
|
+
a[href]:not([aria-disabled="true"]),
|
|
543
|
+
[role="button"]:not([aria-disabled="true"]),
|
|
544
|
+
[role="link"]:not([aria-disabled="true"]),
|
|
545
|
+
[role="tab"]:not([aria-disabled="true"]),
|
|
546
|
+
[role="menuitem"]:not([aria-disabled="true"]),
|
|
547
|
+
[role="option"]:not([aria-disabled="true"]),
|
|
548
|
+
[role="checkbox"]:not([aria-disabled="true"]),
|
|
549
|
+
[role="radio"]:not([aria-disabled="true"]),
|
|
550
|
+
[role="switch"]:not([aria-disabled="true"]),
|
|
551
|
+
input[type="button"]:not(:disabled),
|
|
552
|
+
input[type="submit"]:not(:disabled),
|
|
553
|
+
input[type="reset"]:not(:disabled),
|
|
554
|
+
input[type="checkbox"]:not(:disabled),
|
|
555
|
+
input[type="radio"]:not(:disabled),
|
|
556
|
+
select:not(:disabled),
|
|
557
|
+
label[for],
|
|
558
|
+
summary {
|
|
559
|
+
cursor: pointer;
|
|
560
|
+
}
|
|
561
|
+
button:disabled,
|
|
562
|
+
input:disabled,
|
|
563
|
+
select:disabled,
|
|
564
|
+
textarea:disabled,
|
|
565
|
+
[aria-disabled="true"] {
|
|
566
|
+
cursor: not-allowed;
|
|
567
|
+
}
|
|
532
568
|
}
|
|
533
569
|
|
|
534
570
|
/* Global tracking offset — the Letter Spacing slider in the Customize
|
|
@@ -570,23 +606,30 @@ html, body {
|
|
|
570
606
|
::view-transition-new(root) { animation: none; }
|
|
571
607
|
}`;
|
|
572
608
|
|
|
573
|
-
// ---- Border-color utilities (workaround for a
|
|
609
|
+
// ---- Border-color utilities (workaround for a TURBOPACK bug) --------------
|
|
610
|
+
//
|
|
611
|
+
// ROOT CAUSE (confirmed 2026-06-09, see ledgers/research.jsonl): Next's
|
|
612
|
+
// Turbopack does NOT emit PLAIN named border-color utilities (`border-primary`,
|
|
613
|
+
// `border-destructive`, `border-l-primary`, ...). It keeps the `/opacity`
|
|
614
|
+
// variants (`border-primary/30`), arbitrary values (`border-[var(--x)]`), and
|
|
615
|
+
// every other utility family (`text-*`, `bg-*`, ...) — only the plain
|
|
616
|
+
// border-color set is dropped. The class lands on the element but no rule is
|
|
617
|
+
// emitted, so the color falls through to the `:where(:root *)` default and
|
|
618
|
+
// renders as --border grey. Proven by a same-source A/B: `@tailwindcss/postcss`
|
|
619
|
+
// (webpack / Storybook) generates `.border-primary {…}` fine; `next build`
|
|
620
|
+
// (Turbopack) does not. Nothing in this theme or the base reset causes it —
|
|
621
|
+
// ruled out via real builds (theme var-indirection, @apply-vs-raw reset).
|
|
574
622
|
//
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//
|
|
578
|
-
// through to the `:where(:root *)` default and renders as --border grey. Only
|
|
579
|
-
// the opacity variants (`border-primary/30`) and arbitrary `border-[var(--x)]`
|
|
580
|
-
// generate. That made ~20 components render colored borders as grey (mostly
|
|
581
|
-
// hidden on filled controls, visible on outlined ones — checkbox/radio boxes,
|
|
582
|
-
// input error borders, selected-card borders, alerts).
|
|
623
|
+
// That made ~20 components render colored borders as grey (mostly hidden on
|
|
624
|
+
// filled controls, visible on outlined ones — checkbox/radio boxes, input
|
|
625
|
+
// error borders, selected-card borders, alerts).
|
|
583
626
|
//
|
|
584
|
-
// Rather than convert every call site to arbitrary values
|
|
585
|
-
// utilities here, once, for the whole semantic palette — so
|
|
586
|
-
// `border-<color>` across all components AND every downstream
|
|
587
|
-
// Emitted in @layer utilities so they beat
|
|
588
|
-
// component's own higher-specificity state
|
|
589
|
-
//
|
|
627
|
+
// Rather than convert every call site to arbitrary values or drop Turbopack,
|
|
628
|
+
// we emit the plain utilities here, once, for the whole semantic palette — so
|
|
629
|
+
// every existing `border-<color>` across all components AND every downstream
|
|
630
|
+
// fork just works under Turbopack. Emitted in @layer utilities so they beat
|
|
631
|
+
// the base reset but still lose to a component's own higher-specificity state
|
|
632
|
+
// variants (e.g. hover:border-*). Revisit if/when Turbopack fixes the gap.
|
|
590
633
|
const BORDER_COLOR_NAMES = [
|
|
591
634
|
'background', 'foreground', 'card', 'card-foreground', 'popover',
|
|
592
635
|
'popover-foreground', 'primary', 'primary-foreground', 'link', 'secondary',
|
package/src/app/layout.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import fs from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Atkinson_Hyperlegible, Inter, JetBrains_Mono, Lora, Source_Serif_4 } from "next/font/google";
|
|
5
5
|
import "@/styles/globals.css";
|
|
6
|
+
import "../density.css";
|
|
6
7
|
import { brand } from "@/brand.config";
|
|
7
8
|
import Providers from "./providers";
|
|
8
9
|
import { FontReady } from "./font-ready";
|
|
@@ -190,6 +190,33 @@ export default function ComponentsPreview() {
|
|
|
190
190
|
</div>
|
|
191
191
|
</Section>
|
|
192
192
|
|
|
193
|
+
<Section title="Density">
|
|
194
|
+
<p className="text-sm text-muted-foreground">
|
|
195
|
+
Opt in with <code className="font-mono text-xs">data-density="compact"</code> or{" "}
|
|
196
|
+
<code className="font-mono text-xs">"comfortable"</code>{" "}on any container. It tightens or
|
|
197
|
+
loosens non-interactive rhythm (card padding, gaps, table rows) — interactive
|
|
198
|
+
controls keep the 44×44 touch-target floor. Same card, three densities:
|
|
199
|
+
</p>
|
|
200
|
+
<div className="grid gap-4 sm:grid-cols-3">
|
|
201
|
+
{(["compact", undefined, "comfortable"] as const).map((d, i) => (
|
|
202
|
+
<div key={i} data-density={d}>
|
|
203
|
+
<p className="mb-2 text-xs uppercase tracking-wide text-muted-foreground">
|
|
204
|
+
{d ?? "default"}
|
|
205
|
+
</p>
|
|
206
|
+
<Card>
|
|
207
|
+
<CardHeader>
|
|
208
|
+
<CardTitle>Card title</CardTitle>
|
|
209
|
+
<CardDescription>One line of supporting copy.</CardDescription>
|
|
210
|
+
</CardHeader>
|
|
211
|
+
<CardContent>
|
|
212
|
+
<p className="text-sm text-muted-foreground">Card body content lives here.</p>
|
|
213
|
+
</CardContent>
|
|
214
|
+
</Card>
|
|
215
|
+
</div>
|
|
216
|
+
))}
|
|
217
|
+
</div>
|
|
218
|
+
</Section>
|
|
219
|
+
|
|
193
220
|
<Section title="Tabs & Dialog">
|
|
194
221
|
<Tabs defaultValue="one" className="w-full">
|
|
195
222
|
<TabsList>
|
package/src/density.css
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* BADS density — opt-in.
|
|
2
|
+
*
|
|
3
|
+
* Set `data-density="compact"` or `data-density="comfortable"` on any
|
|
4
|
+
* container (a section, a card grid, the whole app) and the surfaces inside
|
|
5
|
+
* it tighten or loosen. Default (no attribute) is the canonical spacing.
|
|
6
|
+
*
|
|
7
|
+
* AAA SAFETY (load-bearing): density adjusts ONLY non-interactive rhythm —
|
|
8
|
+
* container padding, stack gaps, and data-table row height. It deliberately
|
|
9
|
+
* does NOT scale Button / Input / Select / Switch / Checkbox / Radio or any
|
|
10
|
+
* other hit area, because BADS mandates a 44×44 touch-target floor
|
|
11
|
+
* (WCAG 2.2 AAA, SC 2.5.5). shadcn's "Rhea" compact style shrinks control
|
|
12
|
+
* heights below that; BADS can't and won't. Compact here means a denser
|
|
13
|
+
* *layout*, not smaller targets.
|
|
14
|
+
*
|
|
15
|
+
* Mechanism: attribute selectors keyed on `data-slot` (BADS components stamp
|
|
16
|
+
* these). `[data-density=…] [data-slot=…]` is specificity (0,2,0), which beats
|
|
17
|
+
* Tailwind's (0,1,0) utilities, so these override the components' default
|
|
18
|
+
* padding without !important. The rules are inert until the attribute is set.
|
|
19
|
+
*
|
|
20
|
+
* Usage (consumer): `@import "@behavioral-agentic-design-system/core/density.css";`
|
|
21
|
+
* then `<div data-density="compact">…</div>`. Extend per-component by adding a
|
|
22
|
+
* `[data-density=compact] [data-slot=<your-slot>]` rule here.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
[data-density="compact"] {
|
|
26
|
+
--density: compact;
|
|
27
|
+
}
|
|
28
|
+
[data-density="comfortable"] {
|
|
29
|
+
--density: comfortable;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* ---- Card --------------------------------------------------------------- */
|
|
33
|
+
[data-density="compact"] [data-slot="card"] {
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
}
|
|
36
|
+
[data-density="compact"] [data-slot="card-header"],
|
|
37
|
+
[data-density="compact"] [data-slot="card-content"],
|
|
38
|
+
[data-density="compact"] [data-slot="card-footer"] {
|
|
39
|
+
padding-left: 1rem;
|
|
40
|
+
padding-right: 1rem;
|
|
41
|
+
padding-top: 0.625rem;
|
|
42
|
+
padding-bottom: 0.625rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-density="comfortable"] [data-slot="card"] {
|
|
46
|
+
gap: 1.25rem;
|
|
47
|
+
}
|
|
48
|
+
[data-density="comfortable"] [data-slot="card-header"],
|
|
49
|
+
[data-density="comfortable"] [data-slot="card-content"],
|
|
50
|
+
[data-density="comfortable"] [data-slot="card-footer"] {
|
|
51
|
+
padding-left: 2rem;
|
|
52
|
+
padding-right: 2rem;
|
|
53
|
+
padding-top: 1.5rem;
|
|
54
|
+
padding-bottom: 1.5rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ---- Data table (row rhythm only; cell *content* keeps its own size) ---- */
|
|
58
|
+
[data-density="compact"] [data-slot="table-cell"] {
|
|
59
|
+
padding-top: 0.25rem;
|
|
60
|
+
padding-bottom: 0.25rem;
|
|
61
|
+
}
|
|
62
|
+
[data-density="compact"] [data-slot="table-head"] {
|
|
63
|
+
height: 2rem;
|
|
64
|
+
}
|
|
65
|
+
[data-density="comfortable"] [data-slot="table-cell"] {
|
|
66
|
+
padding-top: 0.75rem;
|
|
67
|
+
padding-bottom: 0.75rem;
|
|
68
|
+
}
|
|
69
|
+
[data-density="comfortable"] [data-slot="table-head"] {
|
|
70
|
+
height: 3rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Reduced-motion / forced-colors need no special handling: this file only
|
|
74
|
+
* changes spacing, never color or motion. */
|
package/src/styles.css
CHANGED
|
@@ -465,6 +465,42 @@
|
|
|
465
465
|
color: GrayText;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
+
/* Clickable cursor — every interactive primitive gets cursor: pointer
|
|
469
|
+
* so click affordance is visually consistent. Tailwind v4 dropped the
|
|
470
|
+
* implicit pointer on <button> from v3's preflight; this restores it
|
|
471
|
+
* + extends to every other clickable native element and ARIA widget
|
|
472
|
+
* role. Disabled state → cursor: not-allowed so "off" reads as
|
|
473
|
+
* intentional rather than broken.
|
|
474
|
+
*
|
|
475
|
+
* Promoted from swimtopia-prototypes globals.css (2026-06-10) per
|
|
476
|
+
* Sir's "if it's clickable, the cursor says so" rule. */
|
|
477
|
+
button:not(:disabled),
|
|
478
|
+
a[href]:not([aria-disabled="true"]),
|
|
479
|
+
[role="button"]:not([aria-disabled="true"]),
|
|
480
|
+
[role="link"]:not([aria-disabled="true"]),
|
|
481
|
+
[role="tab"]:not([aria-disabled="true"]),
|
|
482
|
+
[role="menuitem"]:not([aria-disabled="true"]),
|
|
483
|
+
[role="option"]:not([aria-disabled="true"]),
|
|
484
|
+
[role="checkbox"]:not([aria-disabled="true"]),
|
|
485
|
+
[role="radio"]:not([aria-disabled="true"]),
|
|
486
|
+
[role="switch"]:not([aria-disabled="true"]),
|
|
487
|
+
input[type="button"]:not(:disabled),
|
|
488
|
+
input[type="submit"]:not(:disabled),
|
|
489
|
+
input[type="reset"]:not(:disabled),
|
|
490
|
+
input[type="checkbox"]:not(:disabled),
|
|
491
|
+
input[type="radio"]:not(:disabled),
|
|
492
|
+
select:not(:disabled),
|
|
493
|
+
label[for],
|
|
494
|
+
summary {
|
|
495
|
+
cursor: pointer;
|
|
496
|
+
}
|
|
497
|
+
button:disabled,
|
|
498
|
+
input:disabled,
|
|
499
|
+
select:disabled,
|
|
500
|
+
textarea:disabled,
|
|
501
|
+
[aria-disabled="true"] {
|
|
502
|
+
cursor: not-allowed;
|
|
503
|
+
}
|
|
468
504
|
}
|
|
469
505
|
|
|
470
506
|
/* Global tracking offset — the Letter Spacing slider in the Customize
|