@behavioral-agentic-design-system/core 0.40.0 → 0.45.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 +2 -0
- package/package.json +41 -9
- package/scripts/a11y-lint.cjs +66 -3
- package/scripts/check-spec.mjs +73 -0
- package/scripts/deal-directions.mjs +186 -0
- package/scripts/health-report.mjs +23 -3
- package/scripts/lib/counted-lint.mjs +100 -0
- package/scripts/lib/marketing-library.mjs +129 -0
- package/scripts/lib/on-system.mjs +249 -0
- package/scripts/lib/random.mjs +22 -0
- package/scripts/lib/spec-parse.d.mts +25 -0
- package/scripts/lib/spec-parse.mjs +188 -0
- package/scripts/lib/tells.mjs +128 -0
- package/scripts/lint-css-vars.mjs +175 -0
- package/scripts/lint-html-nesting.mjs +116 -0
- package/scripts/lint-live-ctas.mjs +138 -0
- package/scripts/lint-slop.mjs +25 -1
- package/scripts/on-system-score.mjs +95 -0
- package/scripts/slop-rules.mjs +1 -1
- package/scripts/source-images.mjs +180 -0
- package/scripts/ux-tells.mjs +78 -0
- package/scripts/wcag-audit.cjs +72 -5
- package/src/api/brand-colors.ts +3 -0
- package/src/api/brand-fonts.ts +3 -0
- package/src/api/brand-mark.ts +6 -1
- package/src/api/dev-write-guard.ts +53 -0
- package/src/api/layers/file.ts +7 -4
- package/src/api/onboarding-extract.ts +85 -30
- package/src/api/onboarding.ts +3 -0
- package/src/api/save-tokens.ts +3 -0
- package/src/app/layout.tsx +6 -0
- package/src/app/opengraph-image.tsx +5 -0
- package/src/app/preview/canvas/page.tsx +12 -0
- package/src/app/preview/components/page.tsx +2003 -2
- package/src/app/preview/studio/blank-screen.tsx +143 -0
- package/src/app/preview/studio/page.tsx +7 -0
- package/src/app/shell.tsx +168 -49
- package/src/components/Foundations/Motion.stories.tsx +1 -0
- package/src/components/canvas/canvas.tsx +458 -0
- package/src/components/canvas/layout.ts +72 -0
- package/src/components/canvas/parse-canvas.ts +32 -0
- package/src/components/canvas/sample.ts +90 -0
- package/src/components/canvas/spec-frame.tsx +43 -0
- package/src/components/canvas/types.ts +33 -0
- package/src/components/customize/design-controls.tsx +16 -1
- package/src/components/docs-tab.tsx +7 -7
- package/src/components/home-recent.tsx +73 -0
- package/src/components/home-tab.tsx +13 -13
- package/src/components/layers-tab.tsx +2 -2
- package/src/components/markdown-preview.tsx +60 -12
- package/src/components/studio/control-panel.tsx +299 -0
- package/src/components/studio/control-row.tsx +77 -0
- package/src/components/studio/preview-frame.tsx +165 -0
- package/src/components/studio/preview-pane.tsx +247 -0
- package/src/components/studio/studio.tsx +158 -0
- package/src/components/studio/types.ts +218 -0
- package/src/components/studio/use-studio-tweaks.ts +128 -0
- package/src/components/studio/use-studio-view-state.ts +72 -0
- package/src/components/ui/anchor.tsx +37 -3
- package/src/components/ui/attachment.tsx +211 -0
- package/src/components/ui/autocomplete.tsx +1 -1
- package/src/components/ui/chart.tsx +3 -0
- package/src/components/ui/code.tsx +1 -1
- package/src/components/ui/color-picker.tsx +21 -5
- package/src/components/ui/data-table.tsx +64 -3
- package/src/components/ui/date-field.tsx +1 -1
- package/src/components/ui/editable.tsx +1 -0
- package/src/components/ui/faceted-filter.tsx +187 -0
- package/src/components/ui/gauge-chart.tsx +252 -0
- package/src/components/ui/heatmap.tsx +256 -0
- package/src/components/ui/index.ts +9 -0
- package/src/components/ui/infinite-scroll.tsx +103 -0
- package/src/components/ui/inline-edit.tsx +175 -0
- package/src/components/ui/json-input.tsx +351 -0
- package/src/components/ui/month-picker.tsx +1 -1
- package/src/components/ui/navigation-progress.tsx +281 -0
- package/src/components/ui/number-input.tsx +27 -7
- package/src/components/ui/otp-input.tsx +208 -0
- package/src/components/ui/password-input.tsx +2 -1
- package/src/components/ui/password-strength-input.tsx +288 -0
- package/src/components/ui/phone-input.tsx +274 -0
- package/src/components/ui/pill.tsx +140 -0
- package/src/components/ui/popover.tsx +27 -4
- package/src/components/ui/scroll-progress.tsx +100 -0
- package/src/components/ui/search-input.tsx +1 -1
- package/src/components/ui/snackbar.tsx +393 -0
- package/src/components/ui/sortable-list.tsx +342 -0
- package/src/components/ui/squircle.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tags-input.tsx +1 -1
- package/src/components/ui/timer.tsx +1 -0
- package/src/components/ui/tour.tsx +1 -3
- package/src/components/ui/transfer-list.tsx +13 -26
- package/src/components/ui/week-picker.tsx +1 -1
- package/src/components/ui/year-picker.tsx +1 -1
- package/src/data/component-added.json +958 -0
- package/src/data/docs-index.ts +36 -0
- package/src/hooks/use-global-mono-font.ts +1 -0
- package/src/hooks/use-global-primary-color.ts +1 -0
- package/src/hooks/use-global-sans-font.ts +1 -0
- package/src/hooks/use-global-serif-font.ts +1 -0
- package/src/hooks/use-global-type-scale.ts +17 -2
- package/src/hooks/use-mobile.ts +2 -0
- package/src/hooks/use-sync-type-scale.ts +7 -11
- package/src/lib/clamp.ts +2 -0
- package/src/lib/spec-parse.ts +4 -0
- package/src/lib/svg-sanitize.ts +19 -9
- package/src/stories/Anchor.stories.tsx +54 -0
- package/src/stories/Attachment.stories.tsx +189 -0
- package/src/stories/Autocomplete.stories.tsx +2 -0
- package/src/stories/Canvas.stories.tsx +45 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/Code.stories.tsx +1 -0
- package/src/stories/ColorPicker.stories.tsx +41 -0
- package/src/stories/DataTable.stories.tsx +30 -0
- package/src/stories/DateField.stories.tsx +21 -0
- package/src/stories/Editable.stories.tsx +2 -0
- package/src/stories/FacetedFilter.stories.tsx +197 -0
- package/src/stories/GaugeChart.stories.tsx +169 -0
- package/src/stories/Heatmap.stories.tsx +172 -0
- package/src/stories/InfiniteScroll.stories.tsx +225 -0
- package/src/stories/InlineEdit.stories.tsx +106 -0
- package/src/stories/JsonInput.stories.tsx +212 -0
- package/src/stories/MarkdownPreview.stories.tsx +53 -0
- package/src/stories/MonthPicker.stories.tsx +21 -0
- package/src/stories/NavigationProgress.stories.tsx +159 -0
- package/src/stories/NumberInput.stories.tsx +26 -0
- package/src/stories/OtpInput.stories.tsx +110 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
- package/src/stories/PhoneInput.stories.tsx +127 -0
- package/src/stories/Pill.stories.tsx +201 -0
- package/src/stories/Popover.stories.tsx +29 -1
- package/src/stories/Portal.stories.tsx +3 -1
- package/src/stories/ScrollProgress.stories.tsx +117 -0
- package/src/stories/SearchInput.stories.tsx +2 -0
- package/src/stories/Snackbar.stories.tsx +315 -0
- package/src/stories/SortableList.stories.tsx +263 -0
- package/src/stories/Squircle.stories.tsx +1 -0
- package/src/stories/Table.stories.tsx +1 -0
- package/src/stories/TagsInput.stories.tsx +2 -0
- package/src/stories/Timer.stories.tsx +26 -0
- package/src/stories/Tour.stories.tsx +1 -0
- package/src/stories/TransferList.stories.tsx +4 -0
- package/src/stories/WeekPicker.stories.tsx +21 -0
- package/src/stories/YearPicker.stories.tsx +21 -0
- package/src/stories/story-groups.json +33 -16
- package/src/tokens.json +82 -54
package/src/data/docs-index.ts
CHANGED
|
@@ -55,6 +55,9 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
55
55
|
{ title: "Layer 3 — Primitive tokens", path: "layer-3-primitive-tokens/README.md" },
|
|
56
56
|
{ title: "Layer 4 — Semantic tokens", path: "layer-4-semantic-tokens/README.md" },
|
|
57
57
|
{ title: "Layer 5 — Component registry", path: "layer-5-component-registry/README.md" },
|
|
58
|
+
{ title: "Component decision records", path: "layer-5-component-registry/decisions/README.md", summary: "One record per component: why it exists, decided edge cases, and every option ruled out. Read before changing a component; MCP get_decisions serves it." },
|
|
59
|
+
{ title: "Product decision record", path: "docs/product-decision-record.md", summary: "A markdown record for a decision a prototype forces: question, two or more options, facts labeled Observed/Requirement/Assumption/Unknown, a human owner, sign-off, and revisit triggers. A lint enforces it; agents draft but never own or sign. Includes a worked example." },
|
|
60
|
+
{ title: "Decision velocity brief evaluation", path: "docs/decision-velocity-brief-evaluation.md", summary: "Evaluation note (partly adopted): a ChatGPT brief for a decision-review product. Adopted the markdown record and lint; set aside the app, permissions, concurrency, AI summaries and measurement pilot until a client needs them." },
|
|
58
61
|
{ title: "Layer 6 — Patterns & rules", path: "layer-6-patterns-and-rules/README.md" },
|
|
59
62
|
{ title: "Layer 7 — Agent interface", path: "layer-7-agent-interface/README.md" },
|
|
60
63
|
{ title: "Layer 8 — Documentation", path: "layer-8-documentation/README.md" },
|
|
@@ -68,6 +71,7 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
68
71
|
description: "The exhaustive contract — file placement through PR shape, with the failure-mode catalog.",
|
|
69
72
|
entries: [
|
|
70
73
|
{ title: "Component build spec", path: "docs/component-build-spec.md", summary: "15-section contract every new component satisfies." },
|
|
74
|
+
{ title: "Hover states on shell-themed forks", path: "docs/shell-themed-hover-states.md", summary: "Why neutral muted and accent hovers read as gray patches on a brand-colored shell, and the per-theme override that fixes it." },
|
|
71
75
|
{ title: "Component readiness audit", path: "prompts/component-readiness-audit.md", summary: "13-question plan-time gate." },
|
|
72
76
|
{ title: "Component backlog", path: "docs/component-backlog.md", summary: "Figma-library primitives queued for Night Shift." },
|
|
73
77
|
{ title: "Component index", path: "COMPONENT_INDEX.md" },
|
|
@@ -108,9 +112,17 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
108
112
|
{ title: "Skill — persona-pressure-test", path: ".claude/skills/persona-pressure-test/SKILL.md" },
|
|
109
113
|
{ title: "Skill — promote-prototype", path: ".claude/skills/promote-prototype/SKILL.md" },
|
|
110
114
|
{ title: "Skill — visual-verify", path: ".claude/skills/visual-verify/SKILL.md" },
|
|
115
|
+
{ title: "Skill — verify", path: ".claude/skills/verify/SKILL.md", summary: "One command (pnpm verify) to look at Storybook in a real browser: start it on a free port, prove the server is this checkout's, screenshot a story in light and dark with console and network errors. Use before handing anyone a localhost URL." },
|
|
116
|
+
{ title: "Skill — parity-check", path: ".claude/skills/parity-check/SKILL.md", summary: "Strict, measured pixel parity against a specific external reference (Figma export, client HTML, competitor screenshot) — zero differing pixels, not a judgment call. Complements visual-verify (reference-free, qualitative) rather than overlapping it." },
|
|
117
|
+
{ title: "Skill — figma-to-code", path: ".claude/skills/figma-to-code/SKILL.md", summary: "Structured, gated workflow for building FROM a Figma node via live Figma MCP tooling — enumerate the real node tree (never a screenshot), map onto existing primitives/tokens, resolve gaps for real, then hand off to component-builder. Logs every unresolved mismatch to ledgers/divergence.jsonl instead of shipping it silently. Natural upstream companion to parity-check." },
|
|
111
118
|
{ title: "Skill — motion-review", path: ".claude/skills/motion-review/SKILL.md" },
|
|
112
119
|
{ title: "Skill — redesign", path: ".claude/skills/redesign/SKILL.md", summary: "Re-skin an existing surface WITHOUT changing what it does — preserve copy / IA / routes / brand, rebuild only the visual + interaction layer with a fresh (diversified) fingerprint. Distinct from design-exploration (new surface) and component-builder (one component). Adapted BADS-native from Hallmark's redesign verb." },
|
|
113
120
|
{ title: "Prompt — conceptual model", path: "prompts/conceptual-model.md", summary: "Before sketching a product surface, name its domain objects, states, relationships, and vocabulary — Jamie Mill's 'most neglected layer,' wired into Path B as design-exploration step 3.5. Feeds the real-content pool, state patterns, and primitive selection." },
|
|
121
|
+
{ title: "Prompt — subject inventory", path: "prompts/subject-inventory.md", summary: "For marketing and brand surfaces: list 8-12 facts that belong to this client and no competitor, each with a source, before any direction is drawn. The page idea and image searches come from the list. Adapted from taste-skill." },
|
|
122
|
+
{ title: "Marketing composition library", path: "disciplines/marketing/library/README.md", summary: "20 directions, 48 heroes and 172 section blueprints for marketing pages, dealt by bads-deal-directions so the choice among directions is real. Colors and fonts stay with brand tokens. Derived from taste-skill (MIT)." },
|
|
123
|
+
{ title: "Motion glossary", path: "disciplines/marketing/patterns/motion-glossary.md", summary: "24 web effects by name, each mapped to its BADS component or token, a status (default, expressive, caution, avoid) and a reduced-motion state, so a client or reviewer can ask for an effect by name." },
|
|
124
|
+
{ title: "motion-prompt evaluation", path: "docs/motion-prompt-evaluation.md", summary: "Evaluation note (idea adopted, library not installed): a library of 120 named effects for prompting. Adopted the naming idea as a BADS motion glossary mapped to tokens, components and the anti-defaults." },
|
|
125
|
+
{ title: "taste-skill evaluation", path: "docs/taste-skill-evaluation.md", summary: "Evaluation note (ideas adopted, skill not installed): what Leonxlnx/taste-skill adds beyond BADS's anti-defaults. Adopted a direction dealer, a subject inventory, open-license image sourcing and a rendered tells check, as BADS-native tools." },
|
|
114
126
|
{ title: "Prompt — parallel rollout", path: "prompts/parallel-rollout.md", summary: "For a Path B build that's N similar surfaces: build one reference screen, turn it into an explicit contract, sign off on the contract, then fan the rest out against it (via Workflow) and verify each to the contract. Stops multi-screen drift. Adapted from the design-spec-framework." },
|
|
115
127
|
{ title: "Prompt — design directions", path: "prompts/design-directions.md" },
|
|
116
128
|
{ title: "Prompt — color ramp", path: "prompts/color-ramp.md", summary: "Build a 9-shade ramp from the single brand hex a client hands you: place 500, find the edges, fill inward, and move with hue rotation (capped 20-30°) rather than lightness alone so dark shades don't go grey. Adapted to BADS's AAA floor, which is stricter than the source and pushes the dark end further than it looks." },
|
|
@@ -121,6 +133,8 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
121
133
|
{ title: "Prompt — independent critique", path: "prompts/independent-critique.md" },
|
|
122
134
|
{ title: "Prompt — futures check", path: "prompts/futures-check.md" },
|
|
123
135
|
{ title: "Prompt — persona pressure test", path: "prompts/persona-pressure-test.md" },
|
|
136
|
+
{ title: "Prompt — parity check", path: "prompts/parity-check.md", summary: "Deep playbook for the parity-check skill: capture methodology, the pixel-parity.mjs comparison tool, fix order, and the strict zero-diff acceptance bar." },
|
|
137
|
+
{ title: "Prompt — figma-to-code", path: "prompts/figma-to-code.md", summary: "Deep playbook for the figma-to-code skill: node-tree enumeration via get_metadata/get_design_context/get_variable_defs, the mapping-table shape, the token-gap resolution decision tree (fix the system, not the instance — parity-check's §4 philosophy applied one trigger earlier), the divergence-ledger entry format, and the conditional Code Connect final step." },
|
|
124
138
|
],
|
|
125
139
|
},
|
|
126
140
|
{
|
|
@@ -135,9 +149,16 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
135
149
|
{ title: "lieflat-charts evaluation", path: "docs/lieflat-charts-evaluation.md", summary: "Scouting note (not adopted): an editorial data-viz agent skill. Blocker — PolyForm Noncommercial license; its code must never be vendored into a commercial fork. BADS already holds the philosophy (chart-design.md). One license-clean idea borrowed: a data-shape → chart-type selector added to chart-design.md." },
|
|
136
150
|
{ title: "PRAXIST evaluation", path: "docs/praxist-evaluation.md", summary: "Scouting note (not vendored): sapientinc/PRAXIST, an autonomous measurable-research engine. Blocker — Fair Source License, and it optimizes a single number where most BADS research is qualitative. The loop shape (iterate-search-evaluate) is borrowed via the existing auto-research skill for the Night Shift weekly deep-dive (step 3a); the measurable-metric optimization lab is designed here but deferred." },
|
|
137
151
|
{ title: "Deep-dive research questions", path: "docs/research-questions.md", summary: "Sir-curated queue for the Night Shift's weekly deep-dive (step 3a, Monday). The agent takes the top open question, runs the auto-research skill against it, and lands a report in ledgers/reports/. Empty queue is fine — the agent derives a question from recurring open ledger themes." },
|
|
152
|
+
{ title: "Agent-era design systems evaluation", path: "docs/agent-era-design-systems-evaluation.md", summary: "Scouting note on the Hatch talk \"Design Systems in the Age of Agents\" (Unily/Resin). Seven ideas adopted: decision records, lifecycle check, gap ledger, page assemblies, the why tool, stewardship fields, the consumer matrix. Includes a correction to our first read of the readiness audit." },
|
|
138
153
|
{ title: "HumanLayer skills evaluation", path: "docs/humanlayer-skills-evaluation.md", summary: "Scouting note (MIT — no adoption blocker): humanlayer/skills. design-control-loop's sensor/controller/actuator vocabulary maps 1:1 onto the Night Shift crew (borrowed as docs/control-loop.md); improve-claude-md's <important if> technique complements the de-blobbing (proposal filed); narrow-react-prop-types wired into Carl. build-iterated-agentic-loop + show-me skipped as redundant." },
|
|
139
154
|
{ title: "jakubkrehel/skills evaluation", path: "docs/jakubkrehel-skills-evaluation.md", summary: "Scouting note (MIT, nothing adopted): a design-engineering skill collection on BADS's home turf — every dimension (UI, type, color, a11y, layout, writing) is already covered by BADS with enforcement (lints/tokens/contracts), not just review prompts. The one real borrow is the source, not a skill: Jakub Krehel's Interfaces magazine added to the Friday research rotation." },
|
|
140
155
|
{ title: "HIGAgentSkills evaluation", path: "docs/hig-agent-skills-evaluation.md", summary: "Scouting note (content not vendored): justinwetch/HIGAgentSkills, a distilled Apple HIG corpus. Blockers — no license + Apple IP, web-vs-native mismatch, and BADS deliberately diverges from Apple. But its tiered routing-index architecture validates BADS's manifest approach and surfaces one real gap (a unified keyword→file lookup), filed as a proposal." },
|
|
156
|
+
{ title: "arla6ka/skills (design.how) evaluation", path: "docs/arla6ka-skills-evaluation.md", summary: "Scouting note (MIT, partially adopted): six Claude Code skills that extract a design system FROM an existing shipped app, then migrate every screen onto it — the opposite entry point from BADS's fork-first CLIENT_ONBOARDING.md. Mostly redundant (component-docs, ui-review, design-system-boss all map onto existing BADS mechanisms, several more thoroughly), but checking token-mapping's 'match by purpose, not number' claim against token-nearest.mjs surfaced a real gap: borderRadius was resolved correctly at the resolver level since 2026-09-03 but lint-tokens.js never had a rule querying it. Shipped tailwind-arbitrary-radius + hardcoded-px-radius — 8 real hits in BADS's own primitives. build-design-system's extract-from-existing-app onboarding path and migrate-design-system's coordinator/worker shape are named as real, unscoped gaps." },
|
|
157
|
+
{ title: "spec-kit-design-system evaluation", path: "docs/spec-kit-design-system-evaluation.md", summary: "Scouting note (MIT, not adopted as a tool): a GitHub Spec Kit extension arguing agentic design systems solve consumption, not contribution, via a 'Recall→Reuse→Compose→Extend→Create' ladder. Ground-truthed as mostly redundant — BADS's Bucket A/B/C/D + 13-question readiness audit, independent critique + verifier panel + red-team, and intent-driven-context framework already cover it, more thoroughly in most cases. Two real gaps it surfaced: 'fails closed' was only prose convention, not a gate (shipped 2026-09-29 as check:component-audit-trail); Night Shift's Bucket-D builds have no probationary stage before joining the shared registry (filed as a roadmap item)." },
|
|
158
|
+
{ title: "shadcn/lint evaluation", path: "docs/shadcn-lint-evaluation.md", summary: "Scouting note (MIT, adopted in full): shadcn/ui's new agent-first Tailwind linter. Ground-truthed all 6 rules against BADS's existing lint suite — 2 partial gaps extended into lint-tokens.js, 4 genuinely novel rules built from scratch (no-restyle, unknown-classes via the real Tailwind compiler, static-classes, inline-styles with BADS's own sanctioned exceptions). Found and fixed a real production bug (a silently-broken dynamic Tailwind class) and several real lint-implementation bugs (comment-scanning false positives, brace-extraction) along the way." },
|
|
159
|
+
{ title: "Paper.design evaluation", path: "docs/paper-design-evaluation.md", summary: "Scouting note (proprietary, open alpha — not adopted): a code-native design canvas whose elements are real HTML/CSS/Tailwind, with a bidirectional MCP server (sync tokens, export to React/Tailwind, commit to GitHub). Structurally a better-fitting mechanism than Figma Variables sync for the already-deferred 'Bidirectional Figma ↔ code sync' roadmap item (its 40+ component activation signal has already fired), but blocked from adoption today by alpha instability, proprietary vendor lock-in (tension with BADS's portability principle), and a local-desktop-only MCP server that can never be wired into Night Shift's autonomous pipeline. Revisit after a manual trial and a stable release." },
|
|
160
|
+
{ title: "Dessn evaluation", path: "docs/dessn-evaluation.md", summary: "Scouting note (proprietary, early-stage — not adopted): reads a GitHub/GitLab repo read-only, runs the real codebase in the cloud, and lets a designer prototype against the actual components — no separate canvas to sync. Compared directly against paper.design (different half of the same gap: Dessn targets the 'Prototype to production loop' fidelity-capture problem in roadmap-closedloop-import.md item #11, not Path B direction-sketching). Blocked by early-stage maturity, per-seat cost, no agent/MCP surface, and a real per-client trust ask (repo read access, even with SOC2/no-storage assurances). Motivated a new roadmap entry on whether BADS could build a cheaper native equivalent." },
|
|
161
|
+
{ title: "Open Design System Bench evaluation", path: "docs/open-design-system-bench-evaluation.md", summary: "Trial note (MIT, adopted as a manual tool, not wired into CI): a harness that runs Claude Code against a component library and grades the output. About $13 of runs found an undeclared peer dependency and an import-path gap in the agent docs; both fixed. After the fix, full context compiled in every run and cut hard-gate failures from 4 of 15 to 1 of 15, with no change in judged design quality. Also records the grader setup traps (form-field vocabulary, autoFocus, lucide-react)." },
|
|
141
162
|
{ title: "Token migration", path: "docs/token-migration.md", summary: "The pattern for renaming/restructuring tokens in a fork without a heroic all-at-once PR: a token-migration.json old→new mapping enforced diff-aware (changed files held to new names, legacy tolerated in untouched files) via pnpm check:token-migration, plus a copy-pasteable mapping table. Adapted from web-common." },
|
|
142
163
|
{ title: "Chart color palette", path: "docs/chart-color-palette.md", summary: "Accessible 5-color categorical palette for data viz — Okabe-Ito-derived, reviewed against WCAG 1.4.11 non-text contrast." },
|
|
143
164
|
{ title: "Chart design", path: "docs/chart-design.md", summary: "Chart composition rules — grid, axes, labels, legend, tooltip, number formatting, states, motion. The 'data is the only saturated thing' register; companion to the color palette." },
|
|
@@ -145,6 +166,12 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
145
166
|
{ title: "Distress & reduced capacity", path: "layer-2-ethics-responsibility/distress-and-capacity.md", summary: "Designing critical flows for users in reduced-capacity states (stress, anxiety, grief, overwhelm) — a STATE, not a persona. The Low-Capacity Test release gate for high-stakes flows, plus the situational-distress persona and shame-free / no-silent-inference rules. Adapted from Matthew Stephens' 2026 mental-health-UX framework." },
|
|
146
167
|
{ title: "Gamification — responsible vs. manipulative", path: "layer-2-ethics-responsibility/gamification.md", summary: "Sir's 10 Core Drives (Octalysis 8 + Exploration & Discovery + Challenge & Competition) + the test gates that decide when Black Hat ships and when it refuses." },
|
|
147
168
|
{ title: "Corrections log", path: "corrections.md", summary: "Per-fork anti-pattern log. Read before every Path B build." },
|
|
169
|
+
{
|
|
170
|
+
title: "Decision log",
|
|
171
|
+
path: "docs/decision-log.md",
|
|
172
|
+
summary:
|
|
173
|
+
"Generated fast-scan index of decisions already made — tooling/scouting verdicts, anti-pattern corrections, and prototype build verdicts in one place, so an agent can check 'has this been decided before?' without grepping three sources. Never hand-edit; regenerate with `pnpm build:decision-log`.",
|
|
174
|
+
},
|
|
148
175
|
{ title: "Anti-defaults refresh", path: "prompts/anti-defaults-refresh.md", summary: "Quarterly pressure-test of the current anti-defaults." },
|
|
149
176
|
{ title: "Promote corrections", path: "prompts/promote-corrections.md", summary: "Monthly: corrections → lint promotion candidates." },
|
|
150
177
|
{ title: "Recipe miner", path: "prompts/recipe-miner.md", summary: "Monthly: ship-first vs bounce-recipe ranking." },
|
|
@@ -165,6 +192,12 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
165
192
|
{ title: "Client onboarding", path: "CLIENT_ONBOARDING.md", summary: "Canonical fork-to-client flow." },
|
|
166
193
|
{ title: "0 · Brand context", path: "prompts/0-brand-context.md" },
|
|
167
194
|
{ title: "0 · Personas", path: "prompts/0-personas.md" },
|
|
195
|
+
{
|
|
196
|
+
title: "0c · Design principles",
|
|
197
|
+
path: "prompts/0c-design-principles.md",
|
|
198
|
+
summary:
|
|
199
|
+
"Writes BRIEF.md's Design principles section — a short, falsifiable decision-making compass, grounded against real-world precedent from principles.design.",
|
|
200
|
+
},
|
|
168
201
|
{ title: "0 · Research", path: "prompts/0-research.md" },
|
|
169
202
|
{ title: "1 · Brand voice", path: "prompts/1-brand-voice.md" },
|
|
170
203
|
{ title: "2 · Microcopy", path: "prompts/2-microcopy.md" },
|
|
@@ -219,6 +252,7 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
219
252
|
description: "Deferred plans — what we'd build if the activation signal fires.",
|
|
220
253
|
entries: [
|
|
221
254
|
{ title: "Roadmap", path: "docs/roadmap.md", summary: "Layer 2/6/8/9/10 deferred work with the signal that should activate each one." },
|
|
255
|
+
{ title: "Prototype spec report", path: "docs/prototype-spec-report.md", summary: "Why each prototype is a container with a fixed-section spec.md (element inventory with an approver on every deferral, decisions, open questions, handoff), what shipped, and how the spec shows as a doc frame on the infinite canvas beside the live views, with pan-to-link, scrolling inside the frame, and a keyboard route." },
|
|
222
256
|
{ title: "Plan — skill package", path: "docs/plans/2026-08-21-skill-package.md", summary: "Approved plan: generate a per-fork, npx-installable agent skill — SKILL.md + drift-proof component recipes + token CSS — so the design system's rules travel into the client product repos where components are consumed. Phase A shipped; see the spec." },
|
|
223
257
|
{ title: "Spec — skill package", path: "docs/specs/2026-08-21-skill-package.md", summary: "The durable contract for packages/skill: generated-only output, usage-focused recipes, ≤2k-word SKILL.md, deterministic builds, the check:skill staleness gate, and the eval --context=skill acceptance instrument." },
|
|
224
258
|
{ title: "Plan — self-healing layer", path: "docs/plans/2026-08-21-self-healing-layer.md", summary: "Approved plan: the watch-half of the system — drift ledger, token intent validator, component health score, and a Health surface, assembled from signals BADS already owns; runtime telemetry deliberately deferred behind consent + futures-check." },
|
|
@@ -227,7 +261,9 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
227
261
|
{ title: "Spec — drift elimination", path: "docs/specs/2026-08-31-drift-elimination.md", summary: "Phase A contract: precision over recall (unverifiable is never reported as drift), advisory-by-default with one blocking generated-artifact gate, additive-only sync manifest, and declared expected-drift allowlists. Calibration: 51→0 false positives on the registry checker, and real drift caught including llms.txt advertising 79 components when there were 173." },
|
|
228
262
|
{ title: "Plan — Best-of-N", path: "docs/plans/2026-09-10-best-of-n.md", summary: "Run one judgment N times and treat disagreement as the signal. Two uses: a three-verifier unanimity panel before Code Review Carl can force-merge a fix, and an eval agreement score that finds the rules repeated runs resolve differently. Rejects a merge agent and majority vote for the gate, and says why." },
|
|
229
263
|
{ title: "Spec — Best-of-N", path: "docs/specs/2026-09-10-best-of-n.md", summary: "The contract for scripts/verifier-panel.mjs (unanimous, fail-closed, distinct lenses, evidence-backed approvals) and scripts/eval-agreement.mjs (check stability, primitive choice, import path, drift rows only from the with-context arm). Records the first measurement: a skill rule sending agents to the package root, 3 of 15 before the fix and 0 of 15 after." },
|
|
264
|
+
{ title: "Plan — Studio rebuild", path: "docs/plans/2026-10-07-studio-screen.md", summary: "Controls left, live iframe preview right. Five directions with real references, the pick and the runner-up, and five parallel work packages." },
|
|
230
265
|
{ title: "Roadmap — ClosedLoop import candidates", path: "docs/roadmap-closedloop-import.md", summary: "Fourteen production patterns surfaced by auditing the closedloop-ai GitHub org (40 repos, 17 cloned, 2026-09-03). Three shipped immediately; the rest carry activation signals matching the standard roadmap format." },
|
|
266
|
+
{ title: "Spec — Prototype role views", path: "docs/specs/2026-09-28-prototype-role-views.md", summary: "Pre-activation contract for the roadmap's visual-prototyping-surface item: five views (designer canvas, engineer diff, PM flow map, researcher participant mode, QA gate) over one shared state tree, with the load-bearing rule that every edit in every view must resolve to a value tokens.json/component-registry.json already declares legal — no view can produce an off-system state. The QA view makes the constraint's own deliberate-violation test runnable on demand, reusing ux-smoke.mjs and the ux-tests.jsonl findings shape. Not being built yet; written to scope what building it would mean." },
|
|
231
267
|
],
|
|
232
268
|
},
|
|
233
269
|
];
|
|
@@ -154,6 +154,7 @@ const COLOR_KEY = storageKey("primaryColor");
|
|
|
154
154
|
const CUSTOMS_KEY = storageKey("customPrimaryColors");
|
|
155
155
|
// First brand color (if any) wins as the default; otherwise fall back to shadcn neutral.
|
|
156
156
|
const DEFAULT = brand.colors[0]?.id ?? "neutral";
|
|
157
|
+
export const DEFAULT_PRIMARY_COLOR = DEFAULT;
|
|
157
158
|
|
|
158
159
|
const PRIMARY_OVERRIDE_VARIABLES = [
|
|
159
160
|
"--primary",
|
|
@@ -47,6 +47,7 @@ import { storageKey, readMigrated } from "@behavioral-agentic-design-system/core
|
|
|
47
47
|
const STORAGE_KEY = storageKey("sansFont");
|
|
48
48
|
// First brand font (if any) wins as the default; otherwise Hyperlegible.
|
|
49
49
|
const DEFAULT: SansFontKey = SANS_BRAND_FONTS[0]?.id ?? "hyperlegible";
|
|
50
|
+
export const DEFAULT_SANS_FONT = DEFAULT;
|
|
50
51
|
|
|
51
52
|
function isValidKey(value: string | null): value is SansFontKey {
|
|
52
53
|
return !!value && value in SANS_FONT_OPTIONS;
|
|
@@ -35,7 +35,7 @@ const STORAGE_KEY = storageKey("typeScale");
|
|
|
35
35
|
|
|
36
36
|
/** The Tailwind text-* utilities this design system exposes, mapped to their
|
|
37
37
|
* step offset from base. Steps are exponents on the ratio. */
|
|
38
|
-
const STEPS: Record<string, number> = {
|
|
38
|
+
export const STEPS: Record<string, number> = {
|
|
39
39
|
"text-xs": -2,
|
|
40
40
|
"text-sm": -1,
|
|
41
41
|
"text-base": 0,
|
|
@@ -53,8 +53,23 @@ export function computeSizes(scale: TypeScale): Record<string, number> {
|
|
|
53
53
|
return out;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
function applyScale(
|
|
56
|
+
function applyScale(requested: TypeScale) {
|
|
57
57
|
if (typeof document === "undefined") return;
|
|
58
|
+
// Enforce the 14px text-xs floor (WCAG 1.4.4) at the single choke point so
|
|
59
|
+
// no caller can bypass it. Base 18 with ratio 1.4 used to render text-xs at
|
|
60
|
+
// 9.2px (18 / 1.4^2). text-xs is two steps down: base / ratio^2. Raise base
|
|
61
|
+
// to 14 * ratio^2 when under (ratio is lowered first, as clampTypeScale does).
|
|
62
|
+
// Mirrors clampTypeScale in components/studio/types.ts,
|
|
63
|
+
// inlined because hooks/ must not import from components/.
|
|
64
|
+
const FLOOR = 14;
|
|
65
|
+
const ratio = Math.max(
|
|
66
|
+
TYPE_SCALE_RANGES.ratio.min,
|
|
67
|
+
Math.min(requested.ratio, TYPE_SCALE_RANGES.ratio.max, Math.sqrt(requested.base / FLOOR)),
|
|
68
|
+
);
|
|
69
|
+
const scale: TypeScale = {
|
|
70
|
+
base: Math.min(TYPE_SCALE_RANGES.base.max, Math.max(requested.base, FLOOR * ratio ** 2)),
|
|
71
|
+
ratio,
|
|
72
|
+
};
|
|
58
73
|
const sizes = computeSizes(scale);
|
|
59
74
|
const root = document.documentElement.style;
|
|
60
75
|
// The CSS variables that Tailwind's text-* utilities resolve to are named
|
package/src/hooks/use-mobile.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useLayoutEffect } from "react";
|
|
4
|
-
import { TYPE_SCALE_DEFAULTS } from "./use-global-type-scale";
|
|
4
|
+
import { TYPE_SCALE_DEFAULTS, STEPS } from "./use-global-type-scale";
|
|
5
5
|
import { readMigrated } from "@behavioral-agentic-design-system/core/lib/storage";
|
|
6
6
|
|
|
7
|
-
const STEPS = {
|
|
8
|
-
"text-xs": -2,
|
|
9
|
-
"text-sm": -1,
|
|
10
|
-
"text-base": 0,
|
|
11
|
-
"text-lg": 1,
|
|
12
|
-
"text-xl": 2,
|
|
13
|
-
"text-2xl": 3,
|
|
14
|
-
"text-3xl": 4,
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
7
|
function applyTypeScale() {
|
|
18
8
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
19
9
|
|
|
@@ -33,6 +23,12 @@ function applyTypeScale() {
|
|
|
33
23
|
// Use defaults
|
|
34
24
|
}
|
|
35
25
|
|
|
26
|
+
// Enforce the 14px text-xs floor (WCAG 1.4.4) on the persisted value.
|
|
27
|
+
// Mirrors applyScale() in use-global-type-scale.ts and the layout.tsx boot
|
|
28
|
+
// script. Lower ratio first, then raise base.
|
|
29
|
+
ratio = Math.max(1.05, Math.min(ratio, 1.4, Math.sqrt(base / 14)));
|
|
30
|
+
base = Math.min(22, Math.max(base, 14 * ratio * ratio));
|
|
31
|
+
|
|
36
32
|
// Apply computed sizes as CSS variables
|
|
37
33
|
for (const [name, step] of Object.entries(STEPS)) {
|
|
38
34
|
const size = base * Math.pow(ratio, step);
|
package/src/lib/clamp.ts
ADDED
package/src/lib/svg-sanitize.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { Element as XmlElement } from "@xmldom/xmldom";
|
|
|
15
15
|
* are intentional brand color choices.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const ALLOWED_TAGS_RAW = [
|
|
19
19
|
"svg",
|
|
20
20
|
"g",
|
|
21
21
|
"path",
|
|
@@ -48,9 +48,12 @@ const ALLOWED_TAGS = new Set([
|
|
|
48
48
|
"feMerge",
|
|
49
49
|
"feMergeNode",
|
|
50
50
|
"feColorMatrix",
|
|
51
|
-
]
|
|
51
|
+
];
|
|
52
|
+
// Compared lowercased below. The raw lists keep SVG's camelCase spelling for readability; a lookup of
|
|
53
|
+
// "viewbox" in a Set holding "viewBox" misses, which used to strip viewBox, gradients and clipPaths.
|
|
54
|
+
const ALLOWED_TAGS = new Set(ALLOWED_TAGS_RAW.map((t) => t.toLowerCase()));
|
|
52
55
|
|
|
53
|
-
const
|
|
56
|
+
const ALLOWED_ATTRS_RAW = [
|
|
54
57
|
"id",
|
|
55
58
|
"class",
|
|
56
59
|
"viewBox",
|
|
@@ -107,7 +110,8 @@ const ALLOWED_ATTRS = new Set([
|
|
|
107
110
|
"color-interpolation-filters",
|
|
108
111
|
"patternUnits",
|
|
109
112
|
"patternContentUnits",
|
|
110
|
-
]
|
|
113
|
+
];
|
|
114
|
+
const ALLOWED_ATTRS = new Set(ALLOWED_ATTRS_RAW.map((a) => a.toLowerCase()));
|
|
111
115
|
|
|
112
116
|
const URL_ATTRS = new Set(["href", "xlink:href"]);
|
|
113
117
|
|
|
@@ -129,12 +133,15 @@ function stripDangerous(node: XmlElement): boolean {
|
|
|
129
133
|
node.removeAttribute(attr.name);
|
|
130
134
|
continue;
|
|
131
135
|
}
|
|
132
|
-
//
|
|
136
|
+
// href / xlink:href may only point inside the document (#id). An external URL on <use> or a
|
|
137
|
+
// gradient would make the browser fetch it, and javascript:/data: are never safe.
|
|
133
138
|
if (URL_ATTRS.has(an)) {
|
|
134
|
-
const v = (attr.value || "").trim()
|
|
135
|
-
if (v.startsWith("
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
const v = (attr.value || "").trim();
|
|
140
|
+
if (!v.startsWith("#")) node.removeAttribute(attr.name);
|
|
141
|
+
}
|
|
142
|
+
// style may reference only in-document url(#id); anything else is a remote fetch.
|
|
143
|
+
if (an === "style" && /url\(\s*(?!['"]?#)/i.test(attr.value || "")) {
|
|
144
|
+
node.removeAttribute(attr.name);
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
|
|
@@ -153,6 +160,9 @@ function normalizeColor(raw: string): string | null {
|
|
|
153
160
|
const v = raw.trim().toLowerCase();
|
|
154
161
|
if (!v) return null;
|
|
155
162
|
if (v === "none" || v === "transparent" || v === "inherit" || v === "currentcolor") return null;
|
|
163
|
+
// A paint server (gradient, pattern) is not a flat colour. Counting it as one made a gradient-only mark
|
|
164
|
+
// look monotone and rewrote fill="url(#g)" to currentColor.
|
|
165
|
+
if (v.startsWith("url(")) return null;
|
|
156
166
|
// Expand 3-char hex (#abc) to 6-char (#aabbcc) so matches across formats.
|
|
157
167
|
if (/^#[0-9a-f]{3}$/.test(v)) {
|
|
158
168
|
return `#${v[1]}${v[1]}${v[2]}${v[2]}${v[3]}${v[3]}`;
|
|
@@ -179,6 +179,60 @@ export const Customized: Story = {
|
|
|
179
179
|
),
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
+
export const Controlled: Story = {
|
|
183
|
+
render: function ControlledStory() {
|
|
184
|
+
const [activeId, setActiveId] = React.useState<string | null>(
|
|
185
|
+
"anc-ctrl-tokens"
|
|
186
|
+
);
|
|
187
|
+
const items = [
|
|
188
|
+
{ id: "anc-ctrl-tokens", label: "Token audit" },
|
|
189
|
+
{ id: "anc-ctrl-stories", label: "Story coverage" },
|
|
190
|
+
{ id: "anc-ctrl-size", label: "CTA size contract" },
|
|
191
|
+
{ id: "anc-ctrl-slop", label: "Slop lint" },
|
|
192
|
+
];
|
|
193
|
+
const activeLabel =
|
|
194
|
+
items.find((item) => item.id === activeId)?.label ?? "none";
|
|
195
|
+
return (
|
|
196
|
+
<div className="w-[640px] max-w-full space-y-4">
|
|
197
|
+
<p className="text-sm text-muted-foreground">
|
|
198
|
+
Controlled: the highlight is whatever the consumer passes as{" "}
|
|
199
|
+
<code className="font-mono">activeId</code>. The scroll-spy keeps
|
|
200
|
+
reporting through <code className="font-mono">onActiveChange</code>,
|
|
201
|
+
and here it is mirrored straight back — the same wiring a docs site
|
|
202
|
+
uses to keep the URL hash and the nav in step. Currently reading:{" "}
|
|
203
|
+
<span className="font-medium text-foreground">{activeLabel}</span>.
|
|
204
|
+
</p>
|
|
205
|
+
<div className="flex gap-8">
|
|
206
|
+
<div className="h-72 min-w-0 flex-1 overflow-y-auto rounded-lg border border-border p-5" tabIndex={0}>
|
|
207
|
+
<DemoSection id="anc-ctrl-tokens" title="Token audit">
|
|
208
|
+
pnpm wcag:audit walks every shipped token pair and fails CI on
|
|
209
|
+
any text pair under 7:1 or non-text pair under 3:1.
|
|
210
|
+
</DemoSection>
|
|
211
|
+
<DemoSection id="anc-ctrl-stories" title="Story coverage">
|
|
212
|
+
A component file edited without its story in the same commit is
|
|
213
|
+
blocked at pre-commit; pnpm fix:stories seeds the baseline.
|
|
214
|
+
</DemoSection>
|
|
215
|
+
<DemoSection id="anc-ctrl-size" title="CTA size contract">
|
|
216
|
+
Every flow-changing control reads at text-sm, font-medium,
|
|
217
|
+
min-h-11. pnpm size-audit flags anything smaller.
|
|
218
|
+
</DemoSection>
|
|
219
|
+
<DemoSection id="anc-ctrl-slop" title="Slop lint">
|
|
220
|
+
Six code-detectable AI tics — gradient text, indigo gradients,
|
|
221
|
+
hover scale pops, 40px glows, decorative emoji, invented stats.
|
|
222
|
+
</DemoSection>
|
|
223
|
+
</div>
|
|
224
|
+
<Anchor
|
|
225
|
+
className="w-44 shrink-0 self-start"
|
|
226
|
+
activeId={activeId}
|
|
227
|
+
onActiveChange={setActiveId}
|
|
228
|
+
items={items}
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
182
236
|
export const RealisticUse: Story = {
|
|
183
237
|
render: () => (
|
|
184
238
|
<div className="w-[720px] max-w-full rounded-lg border border-border bg-card p-6">
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// Motion: the remove control is a CloseButton, so hover/focus/press inherit
|
|
2
|
+
// Button's token-driven transition-colors; the chip itself has no entrance
|
|
3
|
+
// or exit animation (removal is an undo — it should be instant).
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
5
|
+
import * as React from "react"
|
|
6
|
+
import { Paperclip, SendHorizontal } from "lucide-react"
|
|
7
|
+
|
|
8
|
+
import { Attachment } from "@behavioral-agentic-design-system/core/components/ui/attachment"
|
|
9
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
10
|
+
import { Card } from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
11
|
+
import { Textarea } from "@behavioral-agentic-design-system/core/components/ui/textarea"
|
|
12
|
+
|
|
13
|
+
// File names and byte counts from content/personas/bads.json → files[].
|
|
14
|
+
const FILES = {
|
|
15
|
+
roiReport: { name: "roi-report-2026-06.pdf", bytes: 1_536_000, type: "application/pdf" },
|
|
16
|
+
favicon: { name: "favicon.svg", bytes: 500, type: "image/svg+xml" },
|
|
17
|
+
styles: { name: "styles.css", bytes: 42_700, type: "text/css" },
|
|
18
|
+
brandFonts: { name: "brand-fonts.woff2", bytes: 84_512, type: "font/woff2" },
|
|
19
|
+
figProposal: { name: "tokens-v2-proposal.fig", bytes: 24_618_034, type: "" },
|
|
20
|
+
snapshots: {
|
|
21
|
+
name: "chromatic-snapshots-2026-06.zip",
|
|
22
|
+
bytes: 1_073_741_824,
|
|
23
|
+
type: "application/zip",
|
|
24
|
+
},
|
|
25
|
+
} as const
|
|
26
|
+
|
|
27
|
+
const meta: Meta<typeof Attachment> = {
|
|
28
|
+
title: "Components/Badges and avatars/Attachment",
|
|
29
|
+
component: Attachment,
|
|
30
|
+
tags: ["autodocs"],
|
|
31
|
+
parameters: {
|
|
32
|
+
layout: "centered",
|
|
33
|
+
docs: {
|
|
34
|
+
description: {
|
|
35
|
+
component:
|
|
36
|
+
"Pre-send file chip for a chat composer: file-type icon (picked from the MIME type, falling back to the extension), truncated name with the full value on title, formatted size via FormatByte, and a 44px CloseButton remove control labeled 'Remove <name>'. The root is role='group' with aria-label 'Attached file: <name>'. Omit onRemove for a read-only chip. Not a drop zone (FileUpload) and not a post-send card (FileCard).",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
args: {
|
|
41
|
+
onRemove: () => {},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default meta
|
|
46
|
+
type Story = StoryObj<typeof Attachment>
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
fileName: FILES.roiReport.name,
|
|
51
|
+
fileSize: FILES.roiReport.bytes,
|
|
52
|
+
fileType: FILES.roiReport.type,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const ImageAttachment: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
fileName: FILES.favicon.name,
|
|
59
|
+
fileSize: FILES.favicon.bytes,
|
|
60
|
+
fileType: FILES.favicon.type,
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const CodeAttachment: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
fileName: FILES.styles.name,
|
|
67
|
+
fileSize: FILES.styles.bytes,
|
|
68
|
+
fileType: FILES.styles.type,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A long archive name truncates; the full name stays on title and in the group label. */
|
|
73
|
+
export const LargeFile: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
fileName: FILES.snapshots.name,
|
|
76
|
+
fileSize: FILES.snapshots.bytes,
|
|
77
|
+
fileType: FILES.snapshots.type,
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Unknown MIME type (the browser reports "" for .fig) — the extension fallback picks the generic icon. */
|
|
82
|
+
export const UnknownType: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
fileName: FILES.figProposal.name,
|
|
85
|
+
fileSize: FILES.figProposal.bytes,
|
|
86
|
+
fileType: FILES.figProposal.type,
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** No onRemove → the remove button is not rendered; the chip is read-only. */
|
|
91
|
+
export const ReadOnly: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
fileName: FILES.brandFonts.name,
|
|
94
|
+
fileSize: FILES.brandFonts.bytes,
|
|
95
|
+
fileType: FILES.brandFonts.type,
|
|
96
|
+
onRemove: undefined,
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Dimmed, remove control disabled — the state while the message is sending. */
|
|
101
|
+
export const Disabled: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
fileName: FILES.roiReport.name,
|
|
104
|
+
fileSize: FILES.roiReport.bytes,
|
|
105
|
+
fileType: FILES.roiReport.type,
|
|
106
|
+
disabled: true,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function ComposerDemo() {
|
|
111
|
+
const [attached, setAttached] = React.useState<
|
|
112
|
+
Array<{ name: string; bytes: number; type: string }>
|
|
113
|
+
>([FILES.roiReport, FILES.styles, FILES.snapshots])
|
|
114
|
+
const [sending, setSending] = React.useState(false)
|
|
115
|
+
// Removing a chip unmounts the focused button; send focus back to the
|
|
116
|
+
// composer so a keyboard user is not dropped on <body>. The component
|
|
117
|
+
// leaves this to the consumer on purpose — only the composer knows where
|
|
118
|
+
// "back" is.
|
|
119
|
+
const composerRef = React.useRef<HTMLTextAreaElement>(null)
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Card className="w-[28rem] max-w-full gap-0 p-3">
|
|
123
|
+
<Textarea
|
|
124
|
+
ref={composerRef}
|
|
125
|
+
aria-label="Message to Jordan Reeves"
|
|
126
|
+
placeholder="Message Jordan Reeves"
|
|
127
|
+
defaultValue="Here's the June ROI export, the generated stylesheet, and last quarter's Chromatic baseline."
|
|
128
|
+
className="min-h-20 resize-none border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
|
|
129
|
+
/>
|
|
130
|
+
{attached.length > 0 && (
|
|
131
|
+
<div className="mt-2 flex flex-wrap gap-2 px-1" aria-label="Attachments">
|
|
132
|
+
{attached.map((f) => (
|
|
133
|
+
<Attachment
|
|
134
|
+
key={f.name}
|
|
135
|
+
fileName={f.name}
|
|
136
|
+
fileSize={f.bytes}
|
|
137
|
+
fileType={f.type}
|
|
138
|
+
disabled={sending}
|
|
139
|
+
onRemove={() => {
|
|
140
|
+
setAttached((prev) => prev.filter((p) => p.name !== f.name))
|
|
141
|
+
composerRef.current?.focus()
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
))}
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
<div className="mt-3 flex items-center justify-between gap-2">
|
|
148
|
+
<Button
|
|
149
|
+
type="button"
|
|
150
|
+
variant="ghost"
|
|
151
|
+
size="icon-xl"
|
|
152
|
+
aria-label="Attach a file"
|
|
153
|
+
disabled={sending}
|
|
154
|
+
onClick={() =>
|
|
155
|
+
setAttached((prev) =>
|
|
156
|
+
prev.some((p) => p.name === FILES.favicon.name)
|
|
157
|
+
? prev
|
|
158
|
+
: [...prev, FILES.favicon]
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
>
|
|
162
|
+
<Paperclip strokeWidth={1.5} aria-hidden="true" />
|
|
163
|
+
</Button>
|
|
164
|
+
<Button
|
|
165
|
+
type="button"
|
|
166
|
+
size="xl"
|
|
167
|
+
disabled={sending}
|
|
168
|
+
loading={sending}
|
|
169
|
+
onClick={() => {
|
|
170
|
+
setSending(true)
|
|
171
|
+
window.setTimeout(() => {
|
|
172
|
+
setSending(false)
|
|
173
|
+
setAttached([])
|
|
174
|
+
}, 1200)
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<SendHorizontal strokeWidth={1.5} aria-hidden="true" />
|
|
178
|
+
Send
|
|
179
|
+
</Button>
|
|
180
|
+
</div>
|
|
181
|
+
</Card>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Three chips inside a composer. Remove one, re-attach via the paperclip, send to watch the disabled state. */
|
|
186
|
+
export const RealisticUse: Story = {
|
|
187
|
+
render: () => <ComposerDemo />,
|
|
188
|
+
parameters: { controls: { disable: true } },
|
|
189
|
+
}
|
|
@@ -175,6 +175,8 @@ export const LongOptions: Story = {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
// Realistic use: assign a design review — pick a teammate or type any name.
|
|
178
|
+
// Enter pressed to confirm an IME candidate (Japanese, Chinese, Korean) is ignored by this component.
|
|
179
|
+
// Not scriptable in a story; check by hand with an IME on.
|
|
178
180
|
export const RealisticUse: Story = {
|
|
179
181
|
render: function RealisticUseStory() {
|
|
180
182
|
const [value, setValue] = React.useState("");
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Canvas } from "@behavioral-agentic-design-system/core/components/canvas/canvas";
|
|
3
|
+
import {
|
|
4
|
+
SAMPLE_CANVAS,
|
|
5
|
+
SAMPLE_SPEC,
|
|
6
|
+
sampleResolveView,
|
|
7
|
+
} from "@behavioral-agentic-design-system/core/components/canvas/sample";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Canvas> = {
|
|
10
|
+
title: "Components/Layout/Canvas",
|
|
11
|
+
component: Canvas,
|
|
12
|
+
parameters: { layout: "fullscreen" },
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (
|
|
16
|
+
<div className="h-[720px] p-4">
|
|
17
|
+
<Story />
|
|
18
|
+
</div>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
args: {
|
|
22
|
+
doc: SAMPLE_CANVAS,
|
|
23
|
+
docs: { "spec.md": SAMPLE_SPEC },
|
|
24
|
+
resolveView: sampleResolveView,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
/** The spec is a doc frame on the canvas. It pans and zooms with the live views and scrolls inside its own frame. */
|
|
32
|
+
export const Default: Story = {};
|
|
33
|
+
|
|
34
|
+
/** Opens on one frame instead of the whole canvas. */
|
|
35
|
+
export const FocusedOnAView: Story = { args: { initialFrame: "dashboard" } };
|
|
36
|
+
|
|
37
|
+
/** A doc frame whose source is missing says so instead of rendering an empty box. */
|
|
38
|
+
export const MissingDocument: Story = { args: { docs: {} } };
|
|
39
|
+
|
|
40
|
+
/** With the pop-out link the reader can leave the canvas for the full-width spec. */
|
|
41
|
+
export const WithPopOut: Story = { args: { specHref: "/prototypes/showcase-overview?view=spec" } };
|
|
42
|
+
|
|
43
|
+
export const RealisticUse: Story = {
|
|
44
|
+
args: { initialFrame: "cards", specHref: "/prototypes/showcase-overview?view=spec" },
|
|
45
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// ChartContainer's dot-fade-in keyframe + per-series --color-* custom
|
|
2
|
+
// properties are generated per instance via a raw <style> tag scoped to a
|
|
3
|
+
// runtime [data-chart=<id>] selector — see the escape-hatch note on that
|
|
4
|
+
// <style> element in chart.tsx for why (scripts/lint-inline-styles.mjs).
|
|
1
5
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
6
|
import {
|
|
3
7
|
ChartContainer,
|
|
@@ -52,6 +52,7 @@ export const Variant_Block: Story = {
|
|
|
52
52
|
// Long, non-wrapping lines overflow the container (whitespace-pre), so the block
|
|
53
53
|
// becomes a horizontal scroll region. tabIndex={0} makes it keyboard-reachable
|
|
54
54
|
// and it shows the system focus-visible ring when focused (a11y: SC 2.1.1 / 2.4.7).
|
|
55
|
+
// Scrollbar styled via native CSS: [scrollbar-width:thin] [scrollbar-color:...]
|
|
55
56
|
export const Variant_Block_Scroll: Story = {
|
|
56
57
|
render: () => (
|
|
57
58
|
<div className="w-[360px]">
|