@behavioral-agentic-design-system/core 0.27.0 → 0.29.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 +5 -5
- package/scripts/a11y-lint.cjs +78 -9
- package/scripts/build-tokens.cjs +273 -15
- package/scripts/wcag-audit.cjs +37 -7
- package/src/api/layers/file.ts +1 -0
- package/src/app/font-ready.tsx +6 -5
- package/src/app/layout.tsx +54 -3
- package/src/app/preview/components/page.tsx +5735 -2500
- package/src/app/preview/layout.tsx +4 -1
- package/src/app/preview/showcase-filter.tsx +66 -0
- package/src/app/preview/tab-replay.tsx +63 -0
- package/src/app/shell.tsx +91 -18
- package/src/components/customize/save-bar.tsx +19 -6
- package/src/components/docs-tab.tsx +36 -24
- package/src/components/layers-tab.tsx +37 -5
- package/src/components/ui/ai-badge.tsx +74 -0
- package/src/components/ui/alert.tsx +12 -0
- package/src/components/ui/badge.tsx +19 -0
- package/src/components/ui/chat-bubble.tsx +298 -0
- package/src/components/ui/chat-marker.tsx +120 -0
- package/src/components/ui/checkbox.tsx +9 -1
- package/src/components/ui/clipboard.tsx +291 -0
- package/src/components/ui/close-button.tsx +71 -0
- package/src/components/ui/combobox.tsx +62 -3
- package/src/components/ui/container.tsx +65 -0
- package/src/components/ui/copy-button.tsx +5 -1
- package/src/components/ui/data-table.tsx +388 -0
- package/src/components/ui/date-field.tsx +368 -0
- package/src/components/ui/drawer.tsx +334 -0
- package/src/components/ui/file-button.tsx +145 -0
- package/src/components/ui/floating-indicator.tsx +217 -0
- package/src/components/ui/focus-trap.tsx +184 -0
- package/src/components/ui/format-byte.tsx +113 -0
- package/src/components/ui/index.ts +28 -0
- package/src/components/ui/input.tsx +38 -3
- package/src/components/ui/keyboard-shortcut.tsx +146 -0
- package/src/components/ui/loading-dots.tsx +99 -0
- package/src/components/ui/mark.tsx +69 -0
- package/src/components/ui/month-picker.tsx +296 -0
- package/src/components/ui/multi-select.tsx +15 -13
- package/src/components/ui/nav-link.tsx +200 -0
- package/src/components/ui/navigation-rail.tsx +256 -0
- package/src/components/ui/notification.tsx +20 -0
- package/src/components/ui/password-input.tsx +34 -1
- package/src/components/ui/progress.tsx +15 -1
- package/src/components/ui/prose.tsx +62 -0
- package/src/components/ui/result.tsx +151 -0
- package/src/components/ui/rolling-number.tsx +201 -0
- package/src/components/ui/simple-grid.tsx +110 -0
- package/src/components/ui/skeleton.tsx +52 -3
- package/src/components/ui/squircle.tsx +274 -0
- package/src/components/ui/stack.tsx +105 -0
- package/src/components/ui/status-badge.tsx +93 -0
- package/src/components/ui/tabs.tsx +34 -7
- package/src/components/ui/tag.tsx +46 -5
- package/src/components/ui/theme-icon.tsx +138 -0
- package/src/components/ui/timeline.tsx +27 -10
- package/src/components/ui/tooltip.tsx +12 -1
- package/src/components/ui/tree-select.tsx +386 -0
- package/src/components/ui/typing-indicator.tsx +2 -2
- package/src/components/ui/word-rotate.tsx +6 -1
- package/src/components/ui/year-picker.tsx +307 -0
- package/src/data/docs-index.ts +10 -0
- package/src/hooks/use-global-primary-color.ts +57 -6
- package/src/stories/AiBadge.stories.tsx +67 -0
- package/src/stories/Alert.stories.tsx +31 -1
- package/src/stories/Badge.stories.tsx +63 -6
- package/src/stories/ChatBubble.stories.tsx +222 -0
- package/src/stories/ChatMarker.stories.tsx +59 -0
- package/src/stories/Checkbox.stories.tsx +5 -0
- package/src/stories/Clipboard.stories.tsx +136 -0
- package/src/stories/CloseButton.stories.tsx +65 -0
- package/src/stories/Combobox.stories.tsx +74 -3
- package/src/stories/Container.stories.tsx +134 -0
- package/src/stories/CopyButton.stories.tsx +2 -0
- package/src/stories/DataTable.stories.tsx +271 -0
- package/src/stories/DateField.stories.tsx +114 -0
- package/src/stories/Drawer.stories.tsx +211 -0
- package/src/stories/FileButton.stories.tsx +117 -0
- package/src/stories/FloatingIndicator.stories.tsx +343 -0
- package/src/stories/FocusTrap.stories.tsx +218 -0
- package/src/stories/FormatByte.stories.tsx +142 -0
- package/src/stories/Input.stories.tsx +91 -0
- package/src/stories/KeyboardShortcut.stories.tsx +87 -0
- package/src/stories/LoadingDots.stories.tsx +73 -0
- package/src/stories/Mark.stories.tsx +84 -0
- package/src/stories/MonthPicker.stories.tsx +99 -0
- package/src/stories/MultiSelect.stories.tsx +3 -1
- package/src/stories/NavLink.stories.tsx +213 -0
- package/src/stories/NavigationRail.stories.tsx +413 -0
- package/src/stories/Notification.stories.tsx +53 -0
- package/src/stories/PasswordInput.stories.tsx +21 -0
- package/src/stories/Progress.stories.tsx +38 -0
- package/src/stories/Prose.stories.tsx +232 -0
- package/src/stories/Result.stories.tsx +145 -0
- package/src/stories/RollingNumber.stories.tsx +226 -0
- package/src/stories/SimpleGrid.stories.tsx +130 -0
- package/src/stories/Skeleton.stories.tsx +62 -1
- package/src/stories/Squircle.stories.tsx +127 -0
- package/src/stories/Stack.stories.tsx +139 -0
- package/src/stories/StatusBadge.stories.tsx +125 -0
- package/src/stories/Tabs.stories.tsx +56 -1
- package/src/stories/Tag.stories.tsx +31 -0
- package/src/stories/ThemeIcon.stories.tsx +97 -0
- package/src/stories/Timeline.stories.tsx +69 -0
- package/src/stories/Tooltip.stories.tsx +18 -0
- package/src/stories/TreeSelect.stories.tsx +222 -0
- package/src/stories/TypingIndicator.stories.tsx +1 -0
- package/src/stories/WordRotate.stories.tsx +1 -0
- package/src/stories/YearPicker.stories.tsx +100 -0
- package/src/styles.css +289 -15
- package/src/tokens.json +96 -1
- package/LICENSE +0 -21
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { Button } from "./button"
|
|
8
|
+
|
|
9
|
+
export interface YearPickerProps {
|
|
10
|
+
/** Controlled selected year (e.g. 2026). */
|
|
11
|
+
value?: number
|
|
12
|
+
/** Fires with the picked year, or `undefined` when the selected year is re-clicked (clear). */
|
|
13
|
+
onValueChange?: (year: number | undefined) => void
|
|
14
|
+
/** Uncontrolled initial selection. */
|
|
15
|
+
defaultValue?: number
|
|
16
|
+
/**
|
|
17
|
+
* Earliest selectable year (inclusive).
|
|
18
|
+
* @default currentYear - 100
|
|
19
|
+
*/
|
|
20
|
+
minYear?: number
|
|
21
|
+
/**
|
|
22
|
+
* Latest selectable year (inclusive).
|
|
23
|
+
* @default currentYear + 10
|
|
24
|
+
*/
|
|
25
|
+
maxYear?: number
|
|
26
|
+
/** Disables the entire control — decade navigation and every year cell. */
|
|
27
|
+
disabled?: boolean
|
|
28
|
+
className?: string
|
|
29
|
+
/** Forwarded to the root container — pair with an external Label. */
|
|
30
|
+
id?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 4-column × 3-row year grid — the cross-library consensus shape for year pickers
|
|
34
|
+
// (Mantine YearPicker, MUI-X YearCalendar, Ant Design picker="year",
|
|
35
|
+
// Ark UI DatePicker view=year).
|
|
36
|
+
const COLS = 4
|
|
37
|
+
const ROWS = 3
|
|
38
|
+
const PAGE_SIZE = COLS * ROWS // 12 years per window
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Inline year-selection grid with decade navigation — yields a plain year
|
|
42
|
+
* integer without drilling into months or days. Use for graduation years,
|
|
43
|
+
* fiscal-year filters, birth-year selectors, and any surface where the answer
|
|
44
|
+
* is a year, not a date.
|
|
45
|
+
*
|
|
46
|
+
* ARIA grid pattern: grid → row → gridcell buttons with roving tabindex.
|
|
47
|
+
* Arrow keys move ±1 / ±4 years, Home/End jump to first/last enabled year in
|
|
48
|
+
* the view, PageUp/PageDown change the 12-year window.
|
|
49
|
+
*
|
|
50
|
+
* Clicking the already-selected year fires `onValueChange(undefined)` — a
|
|
51
|
+
* clear/deselect signal. To disable this, check your own state and no-op.
|
|
52
|
+
*/
|
|
53
|
+
function YearPicker({
|
|
54
|
+
value,
|
|
55
|
+
onValueChange,
|
|
56
|
+
defaultValue,
|
|
57
|
+
minYear,
|
|
58
|
+
maxYear,
|
|
59
|
+
disabled = false,
|
|
60
|
+
className,
|
|
61
|
+
id,
|
|
62
|
+
}: YearPickerProps) {
|
|
63
|
+
const currentYear = React.useMemo(() => new Date().getFullYear(), [])
|
|
64
|
+
const resolvedMin = minYear ?? currentYear - 100
|
|
65
|
+
const resolvedMax = maxYear ?? currentYear + 10
|
|
66
|
+
|
|
67
|
+
const isControlled = value !== undefined
|
|
68
|
+
const [internalValue, setInternalValue] = React.useState<number | undefined>(
|
|
69
|
+
defaultValue
|
|
70
|
+
)
|
|
71
|
+
const selected = isControlled ? value : internalValue
|
|
72
|
+
|
|
73
|
+
// The 12-year window start: first year of the page that contains the anchor year.
|
|
74
|
+
const [viewStart, setViewStart] = React.useState<number>(() => {
|
|
75
|
+
const anchor = selected ?? currentYear
|
|
76
|
+
return Math.floor(anchor / PAGE_SIZE) * PAGE_SIZE
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Roving tabindex: the cell index within the current window the user last focused.
|
|
80
|
+
const [focusedIdx, setFocusedIdx] = React.useState<number | null>(null)
|
|
81
|
+
const cellRefs = React.useRef<Array<HTMLButtonElement | null>>([])
|
|
82
|
+
|
|
83
|
+
// Follow a controlled value into its decade window so the selection stays visible.
|
|
84
|
+
React.useEffect(() => {
|
|
85
|
+
if (value !== undefined) {
|
|
86
|
+
const newStart = Math.floor(value / PAGE_SIZE) * PAGE_SIZE
|
|
87
|
+
setViewStart(newStart)
|
|
88
|
+
}
|
|
89
|
+
}, [value])
|
|
90
|
+
|
|
91
|
+
const years = React.useMemo(
|
|
92
|
+
() => Array.from({ length: PAGE_SIZE }, (_, i) => viewStart + i),
|
|
93
|
+
[viewStart]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
const isYearDisabled = React.useCallback(
|
|
97
|
+
(year: number) => disabled || year < resolvedMin || year > resolvedMax,
|
|
98
|
+
[disabled, resolvedMin, resolvedMax]
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
// When every cell in the current window is out-of-range / disabled, the grid
|
|
102
|
+
// div itself becomes the keyboard tab stop (no individual button can carry tabIndex=0).
|
|
103
|
+
const allDisabled = React.useMemo(
|
|
104
|
+
() => years.every((y) => isYearDisabled(y)),
|
|
105
|
+
[years, isYearDisabled]
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
const defaultTabbable = React.useMemo(() => {
|
|
109
|
+
// Prefer the selected year, then today's year, then the first enabled year.
|
|
110
|
+
if (selected !== undefined) {
|
|
111
|
+
const idx = years.indexOf(selected)
|
|
112
|
+
if (idx !== -1 && !isYearDisabled(selected)) return idx
|
|
113
|
+
}
|
|
114
|
+
const todayIdx = years.indexOf(currentYear)
|
|
115
|
+
if (todayIdx !== -1 && !isYearDisabled(currentYear)) return todayIdx
|
|
116
|
+
const first = years.findIndex((y) => !isYearDisabled(y))
|
|
117
|
+
return first !== -1 ? first : 0
|
|
118
|
+
}, [selected, currentYear, years, isYearDisabled])
|
|
119
|
+
|
|
120
|
+
const tabbableIdx =
|
|
121
|
+
focusedIdx !== null &&
|
|
122
|
+
focusedIdx < PAGE_SIZE &&
|
|
123
|
+
!isYearDisabled(years[focusedIdx])
|
|
124
|
+
? focusedIdx
|
|
125
|
+
: defaultTabbable
|
|
126
|
+
|
|
127
|
+
function selectYear(year: number) {
|
|
128
|
+
if (isYearDisabled(year)) return
|
|
129
|
+
// Toggle: re-clicking the selected year clears the selection.
|
|
130
|
+
const next = selected === year ? undefined : year
|
|
131
|
+
if (!isControlled) setInternalValue(next)
|
|
132
|
+
onValueChange?.(next)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function focusCell(idx: number) {
|
|
136
|
+
cellRefs.current[idx]?.focus()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function handleGridKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
|
|
140
|
+
const from = focusedIdx ?? tabbableIdx
|
|
141
|
+
let delta = 0
|
|
142
|
+
switch (event.key) {
|
|
143
|
+
case "ArrowLeft":
|
|
144
|
+
delta = -1
|
|
145
|
+
break
|
|
146
|
+
case "ArrowRight":
|
|
147
|
+
delta = 1
|
|
148
|
+
break
|
|
149
|
+
case "ArrowUp":
|
|
150
|
+
// Move one row up = -COLS cells in a 4-column grid.
|
|
151
|
+
delta = -COLS
|
|
152
|
+
break
|
|
153
|
+
case "ArrowDown":
|
|
154
|
+
// Move one row down = +COLS cells.
|
|
155
|
+
delta = COLS
|
|
156
|
+
break
|
|
157
|
+
case "Home": {
|
|
158
|
+
event.preventDefault()
|
|
159
|
+
const first = years.findIndex((y) => !isYearDisabled(y))
|
|
160
|
+
if (first !== -1) focusCell(first)
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
case "End": {
|
|
164
|
+
event.preventDefault()
|
|
165
|
+
for (let i = years.length - 1; i >= 0; i--) {
|
|
166
|
+
if (!isYearDisabled(years[i])) {
|
|
167
|
+
focusCell(i)
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
case "PageUp":
|
|
174
|
+
event.preventDefault()
|
|
175
|
+
if (!disabled) setViewStart((s) => s - PAGE_SIZE)
|
|
176
|
+
return
|
|
177
|
+
case "PageDown":
|
|
178
|
+
event.preventDefault()
|
|
179
|
+
if (!disabled) setViewStart((s) => s + PAGE_SIZE)
|
|
180
|
+
return
|
|
181
|
+
default:
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
event.preventDefault()
|
|
185
|
+
// Skip over disabled cells in the direction of travel.
|
|
186
|
+
let next = from + delta
|
|
187
|
+
while (next >= 0 && next < PAGE_SIZE && isYearDisabled(years[next])) {
|
|
188
|
+
next += delta
|
|
189
|
+
}
|
|
190
|
+
if (next < 0 || next >= PAGE_SIZE) return
|
|
191
|
+
focusCell(next)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Slice years into ROWS rows of COLS columns.
|
|
195
|
+
const grid = Array.from({ length: ROWS }, (_, r) =>
|
|
196
|
+
years.slice(r * COLS, r * COLS + COLS)
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<div
|
|
201
|
+
id={id}
|
|
202
|
+
data-slot="year-picker"
|
|
203
|
+
data-disabled={disabled || undefined}
|
|
204
|
+
className={cn("w-fit bg-background p-3", className)}
|
|
205
|
+
>
|
|
206
|
+
{/* Header: prev/next decade chevrons + range label */}
|
|
207
|
+
<div
|
|
208
|
+
data-slot="year-picker-header"
|
|
209
|
+
className="mb-2 flex items-center justify-between gap-1"
|
|
210
|
+
>
|
|
211
|
+
<Button
|
|
212
|
+
type="button"
|
|
213
|
+
variant="ghost"
|
|
214
|
+
size="icon-xl"
|
|
215
|
+
aria-label="Previous period"
|
|
216
|
+
disabled={disabled}
|
|
217
|
+
onClick={() => setViewStart((s) => s - PAGE_SIZE)}
|
|
218
|
+
>
|
|
219
|
+
<ChevronLeftIcon strokeWidth={1.5} aria-hidden="true" />
|
|
220
|
+
</Button>
|
|
221
|
+
<span
|
|
222
|
+
aria-live="polite"
|
|
223
|
+
className={cn(
|
|
224
|
+
"text-sm font-medium tabular-nums select-none",
|
|
225
|
+
disabled ? "text-muted-foreground" : "text-foreground"
|
|
226
|
+
)}
|
|
227
|
+
>
|
|
228
|
+
{viewStart} – {viewStart + PAGE_SIZE - 1}
|
|
229
|
+
</span>
|
|
230
|
+
<Button
|
|
231
|
+
type="button"
|
|
232
|
+
variant="ghost"
|
|
233
|
+
size="icon-xl"
|
|
234
|
+
aria-label="Next period"
|
|
235
|
+
disabled={disabled}
|
|
236
|
+
onClick={() => setViewStart((s) => s + PAGE_SIZE)}
|
|
237
|
+
>
|
|
238
|
+
<ChevronRightIcon strokeWidth={1.5} aria-hidden="true" />
|
|
239
|
+
</Button>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
{/* 4 × 3 year grid */}
|
|
243
|
+
<div
|
|
244
|
+
role="grid"
|
|
245
|
+
aria-label="Year picker"
|
|
246
|
+
aria-disabled={disabled || undefined}
|
|
247
|
+
data-slot="year-picker-grid"
|
|
248
|
+
tabIndex={allDisabled ? 0 : -1}
|
|
249
|
+
onKeyDown={handleGridKeyDown}
|
|
250
|
+
className="w-64 space-y-1"
|
|
251
|
+
>
|
|
252
|
+
{grid.map((row, rowIdx) => (
|
|
253
|
+
<div key={rowIdx} role="row" className="grid grid-cols-4 gap-1">
|
|
254
|
+
{row.map((year, colIdx) => {
|
|
255
|
+
const idx = rowIdx * COLS + colIdx
|
|
256
|
+
const isSelected = selected === year
|
|
257
|
+
const isToday = currentYear === year
|
|
258
|
+
const isDisabled = isYearDisabled(year)
|
|
259
|
+
return (
|
|
260
|
+
<button
|
|
261
|
+
key={year}
|
|
262
|
+
ref={(el) => {
|
|
263
|
+
cellRefs.current[idx] = el
|
|
264
|
+
}}
|
|
265
|
+
type="button"
|
|
266
|
+
role="gridcell"
|
|
267
|
+
data-slot="year-picker-cell"
|
|
268
|
+
data-selected={isSelected || undefined}
|
|
269
|
+
data-today={isToday || undefined}
|
|
270
|
+
aria-label={String(year)}
|
|
271
|
+
aria-selected={isSelected}
|
|
272
|
+
aria-disabled={isDisabled || undefined}
|
|
273
|
+
disabled={isDisabled}
|
|
274
|
+
tabIndex={!isDisabled && idx === tabbableIdx ? 0 : -1}
|
|
275
|
+
onClick={() => selectYear(year)}
|
|
276
|
+
onFocus={() => setFocusedIdx(idx)}
|
|
277
|
+
// Motion pattern (c): token-driven one-off transition —
|
|
278
|
+
// never Tailwind duration-* classes (silent failure in v4).
|
|
279
|
+
style={{
|
|
280
|
+
transitionDuration: "var(--duration-fast)",
|
|
281
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
282
|
+
}}
|
|
283
|
+
className={cn(
|
|
284
|
+
"inline-flex min-h-11 items-center justify-center rounded-md px-2 py-2 text-sm select-none",
|
|
285
|
+
"transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
286
|
+
"disabled:pointer-events-none disabled:opacity-40",
|
|
287
|
+
isSelected
|
|
288
|
+
? "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
289
|
+
: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
290
|
+
// Today's year: underline + weight, never color alone (SC 1.4.1).
|
|
291
|
+
isToday &&
|
|
292
|
+
!isSelected &&
|
|
293
|
+
"font-medium text-primary underline underline-offset-4"
|
|
294
|
+
)}
|
|
295
|
+
>
|
|
296
|
+
{year}
|
|
297
|
+
</button>
|
|
298
|
+
)
|
|
299
|
+
})}
|
|
300
|
+
</div>
|
|
301
|
+
))}
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export { YearPicker }
|
package/src/data/docs-index.ts
CHANGED
|
@@ -58,6 +58,7 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
58
58
|
{ title: "Component backlog", path: "docs/component-backlog.md", summary: "Figma-library primitives queued for Night Shift." },
|
|
59
59
|
{ title: "Component index", path: "COMPONENT_INDEX.md" },
|
|
60
60
|
{ title: "Component design rules", path: "COMPONENT_DESIGN.md" },
|
|
61
|
+
{ title: "Atomic design taxonomy", path: "ATOMIC_DESIGN.md", summary: "Atoms → molecules → organisms → templates → pages, in RFC-2119 language (MUST/MUST NOT/SHOULD/MAY): what each level may do (business logic, data fetching, local state) and where it lives in BADS, plus a bucket A–D ↔ level cheat sheet. For engineers and AI agents; makes promoting a BADS component into a client library 1:1. Adapted from web-common." },
|
|
61
62
|
{ title: "Storybook rule", path: "STORYBOOK_RULE.md" },
|
|
62
63
|
{ title: "CTA size contract", path: "prompts/cta-size-contract.md" },
|
|
63
64
|
{ title: "Motion spec", path: "prompts/motion-spec.md" },
|
|
@@ -90,10 +91,15 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
90
91
|
{ title: "Skill — persona-pressure-test", path: ".claude/skills/persona-pressure-test/SKILL.md" },
|
|
91
92
|
{ title: "Skill — promote-prototype", path: ".claude/skills/promote-prototype/SKILL.md" },
|
|
92
93
|
{ title: "Skill — visual-verify", path: ".claude/skills/visual-verify/SKILL.md" },
|
|
94
|
+
{ title: "Skill — motion-review", path: ".claude/skills/motion-review/SKILL.md" },
|
|
95
|
+
{ 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." },
|
|
93
96
|
{ 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." },
|
|
94
97
|
{ 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." },
|
|
95
98
|
{ title: "Prompt — design directions", path: "prompts/design-directions.md" },
|
|
99
|
+
{ title: "Prompt — plan & spec", path: "prompts/plan-and-spec.md", summary: "Lightweight per-feature convention: a matched plan (how you'll build it) + spec (the durable contract, in RFC-2119 language) under docs/plans/ and docs/specs/, dated and slugged the same. The trail that lets the next agent — or the client's team after the engagement — reconstruct why. Adapted from web-common's superpowers/plans + specs." },
|
|
100
|
+
{ title: "Prompt — macrostructures", path: "prompts/macrostructures.md", summary: "Named menu of ~16 structural paradigms (the positive counterpart to the anti-defaults) with when-it-fits / what-it-costs each, plus a diversification rule so a fork's screens don't converge on one shape. Consumed at design-exploration step 3.7. Adapted BADS-native from Nutlope's Hallmark." },
|
|
96
101
|
{ title: "Prompt — design critique", path: "prompts/design-critique.md" },
|
|
102
|
+
{ title: "Prompt — design DNA", path: "prompts/design-dna.md", summary: "Extract a single admired reference's DNA along three axes (macrostructure + type-pairing + colour anchor), refuse templates/marketplaces, and seed it into the fork's exemplars as a portable visual target. The single-reference counterpart to art-direction's gallery sweep. Adapted BADS-native from Hallmark's study verb." },
|
|
97
103
|
{ title: "Prompt — independent critique", path: "prompts/independent-critique.md" },
|
|
98
104
|
{ title: "Prompt — futures check", path: "prompts/futures-check.md" },
|
|
99
105
|
{ title: "Prompt — persona pressure test", path: "prompts/persona-pressure-test.md" },
|
|
@@ -105,6 +111,8 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
105
111
|
description: "How the system stays honest — anti-patterns, the corrections log, the ethics floor.",
|
|
106
112
|
entries: [
|
|
107
113
|
{ title: "Design rules", path: "DESIGN.md", summary: "Visual system + accessibility baseline." },
|
|
114
|
+
{ title: "Release-please evaluation", path: "docs/release-please-evaluation.md", summary: "Decision record: release-please vs changesets. Recommendation — stay on changesets (BADS ships one package; human-authored changelogs fit the intentional-output ethos), revisit release-please when BADS goes multi-package or Night Shift's auto-merge cadence outpaces manual changeset authoring. Item 12 from the web-common spec." },
|
|
115
|
+
{ 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." },
|
|
108
116
|
{ 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." },
|
|
109
117
|
{ 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." },
|
|
110
118
|
{ title: "Privacy-first design (8 principles)", path: "layer-2-ethics-responsibility/privacy-first-design.md", summary: "Matthew Stephens' 8-principle privacy framework: minimize collection, transparency, expiration, no dark patterns, user control, ethical monetization, sustainable practices, accountability — mapped to BADS enforcement." },
|
|
@@ -177,6 +185,8 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
177
185
|
description: "Deferred plans — what we'd build if the activation signal fires.",
|
|
178
186
|
entries: [
|
|
179
187
|
{ title: "Roadmap", path: "docs/roadmap.md", summary: "Layer 2/6/8/9/10 deferred work with the signal that should activate each one." },
|
|
188
|
+
{ 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." },
|
|
189
|
+
{ 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." },
|
|
180
190
|
],
|
|
181
191
|
},
|
|
182
192
|
];
|
|
@@ -278,12 +278,57 @@ function clearPrimaryColor() {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Floor for the brand primary in dark mode. --primary feeds fills, the focus ring, and (via
|
|
283
|
+
* --link) inline link text, so the text floor is the one that has to hold.
|
|
284
|
+
*/
|
|
285
|
+
const PRIMARY_DARK_FLOOR = 4.5;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Should the brand primary be written inline at all?
|
|
289
|
+
*
|
|
290
|
+
* The picker used to write --primary unconditionally, in both themes. That is fine for a brand
|
|
291
|
+
* colour with mid-to-high luminance and wrong for a dark one. A client fork whose brand primary is
|
|
292
|
+
* a deep navy measured 1.79:1 on the dark card and 1.98:1 on the dark page, producing 25 rendered
|
|
293
|
+
* contrast failures the moment dark mode actually rendered. tokens.json already carries a
|
|
294
|
+
* luminance-tuned dark primary for exactly this reason — the inline write was overwriting it.
|
|
295
|
+
*
|
|
296
|
+
* Same discipline as pickAccentForeground below, and the same rationale: an inline override that
|
|
297
|
+
* fails contrast is worse than no override, because the stylesheet value it replaces was tuned.
|
|
298
|
+
* Both are invisible to wcag:audit, which only sees declared tokens — pnpm check:contrast is what
|
|
299
|
+
* catches this class of bug.
|
|
300
|
+
*/
|
|
301
|
+
function shouldWritePrimary(opt: PrimaryColorOption): boolean {
|
|
302
|
+
if (typeof document === "undefined") return true;
|
|
303
|
+
const html = document.documentElement;
|
|
304
|
+
if (!html.classList.contains("dark")) return true;
|
|
305
|
+
const bg = parseCssColorToRgb(
|
|
306
|
+
getComputedStyle(html).getPropertyValue("--background").trim(),
|
|
307
|
+
);
|
|
308
|
+
if (!bg) return true; // can't tell — leave existing behaviour alone
|
|
309
|
+
try {
|
|
310
|
+
return contrastRatio(rgbFromHex(opt.primary), bg) >= PRIMARY_DARK_FLOOR;
|
|
311
|
+
} catch {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
281
316
|
function applyColor(opt: PrimaryColorOption) {
|
|
282
317
|
if (typeof document === "undefined") return;
|
|
283
318
|
const root = document.documentElement.style;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
319
|
+
const writePrimary = shouldWritePrimary(opt);
|
|
320
|
+
if (writePrimary) {
|
|
321
|
+
root.setProperty("--primary", opt.primary);
|
|
322
|
+
root.setProperty("--primary-foreground", opt.primaryForeground);
|
|
323
|
+
root.setProperty("--ring", opt.primary);
|
|
324
|
+
} else {
|
|
325
|
+
// Remove rather than substitute. --primary-foreground goes too: it is paired with the brand
|
|
326
|
+
// colour, and leaving it behind would put the brand's foreground on the stylesheet's tuned
|
|
327
|
+
// dark primary — a pairing nobody chose and which measures worse than either default.
|
|
328
|
+
root.removeProperty("--primary");
|
|
329
|
+
root.removeProperty("--primary-foreground");
|
|
330
|
+
root.removeProperty("--ring");
|
|
331
|
+
}
|
|
287
332
|
|
|
288
333
|
// --accent-foreground used to be set unconditionally to opt.primary. That
|
|
289
334
|
// produced silent contrast failures when the brand color was too close in
|
|
@@ -300,9 +345,15 @@ function applyColor(opt: PrimaryColorOption) {
|
|
|
300
345
|
root.removeProperty("--accent-foreground");
|
|
301
346
|
}
|
|
302
347
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
348
|
+
if (writePrimary) {
|
|
349
|
+
root.setProperty("--sidebar-primary", opt.primary);
|
|
350
|
+
root.setProperty("--sidebar-primary-foreground", opt.primaryForeground);
|
|
351
|
+
root.setProperty("--sidebar-ring", opt.primary);
|
|
352
|
+
} else {
|
|
353
|
+
root.removeProperty("--sidebar-primary");
|
|
354
|
+
root.removeProperty("--sidebar-primary-foreground");
|
|
355
|
+
root.removeProperty("--sidebar-ring");
|
|
356
|
+
}
|
|
306
357
|
// Inline-write the chart ramp so brand picker changes reach charts. The
|
|
307
358
|
// stylesheet rule is precomputed by Lightning CSS into a frozen lab().
|
|
308
359
|
writeChartRamp();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AiBadge } from "@behavioral-agentic-design-system/core/components/ui/ai-badge";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AiBadge> = {
|
|
5
|
+
title: "Components/AiBadge",
|
|
6
|
+
component: AiBadge,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<div className="flex items-center gap-2">
|
|
17
|
+
<AiBadge />
|
|
18
|
+
<AiBadge variant="solid" />
|
|
19
|
+
<AiBadge variant="outline" />
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Variant_Subtle: Story = {
|
|
25
|
+
render: () => <AiBadge variant="subtle" />,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Variant_Solid: Story = {
|
|
29
|
+
render: () => <AiBadge variant="solid" />,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Variant_Outline: Story = {
|
|
33
|
+
render: () => <AiBadge variant="outline" />,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Size_Sm: Story = {
|
|
37
|
+
render: () => <AiBadge size="sm" />,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Size_Default: Story = {
|
|
41
|
+
render: () => <AiBadge size="default" />,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const NoIcon: Story = {
|
|
45
|
+
render: () => <AiBadge showIcon={false} />,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const CustomLabel: Story = {
|
|
49
|
+
render: () => <AiBadge>AI summary</AiBadge>,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const RealisticUse: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div className="max-w-sm space-y-2 rounded-lg border border-border bg-card p-4">
|
|
55
|
+
<div className="flex items-center gap-2">
|
|
56
|
+
<span className="text-sm font-semibold text-foreground">
|
|
57
|
+
Weekly recap
|
|
58
|
+
</span>
|
|
59
|
+
<AiBadge size="sm" />
|
|
60
|
+
</div>
|
|
61
|
+
<p className="text-sm text-muted-foreground">
|
|
62
|
+
Deploys were up 18% this week, with the mail service accounting for most
|
|
63
|
+
of the increase. No incidents were reported.
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// Dismissible + WithAction: onDismiss renders a top-right × button; action
|
|
10
10
|
// renders a row below AlertDescription. Both are optional and compose freely.
|
|
11
11
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
12
|
-
import { AlertCircleIcon } from "lucide-react";
|
|
12
|
+
import { AlertCircleIcon, CheckCircle2Icon, TriangleAlertIcon, InfoIcon } from "lucide-react";
|
|
13
13
|
import { Alert, AlertTitle, AlertDescription } from "@behavioral-agentic-design-system/core/components/ui/alert";
|
|
14
14
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
15
15
|
import { Card, CardContent, CardHeader, CardTitle } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
@@ -59,6 +59,36 @@ export const Variant_Destructive: Story = {
|
|
|
59
59
|
</div>),
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
export const Variant_Success: Story = {
|
|
63
|
+
render: () => (<div className="w-[420px]">
|
|
64
|
+
<Alert variant="success">
|
|
65
|
+
<CheckCircle2Icon className="h-5 w-5" />
|
|
66
|
+
<AlertTitle>Changes saved</AlertTitle>
|
|
67
|
+
<AlertDescription>Your profile has been updated successfully.</AlertDescription>
|
|
68
|
+
</Alert>
|
|
69
|
+
</div>),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Variant_Warning: Story = {
|
|
73
|
+
render: () => (<div className="w-[420px]">
|
|
74
|
+
<Alert variant="warning">
|
|
75
|
+
<TriangleAlertIcon className="h-5 w-5" />
|
|
76
|
+
<AlertTitle>Plan limit approaching</AlertTitle>
|
|
77
|
+
<AlertDescription>You've used 80% of your monthly API calls.</AlertDescription>
|
|
78
|
+
</Alert>
|
|
79
|
+
</div>),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const Variant_Info: Story = {
|
|
83
|
+
render: () => (<div className="w-[420px]">
|
|
84
|
+
<Alert variant="info">
|
|
85
|
+
<InfoIcon className="h-5 w-5" />
|
|
86
|
+
<AlertTitle>Maintenance scheduled</AlertTitle>
|
|
87
|
+
<AlertDescription>We'll be down for 15 minutes on Sunday at 2am UTC.</AlertDescription>
|
|
88
|
+
</Alert>
|
|
89
|
+
</div>),
|
|
90
|
+
};
|
|
91
|
+
|
|
62
92
|
// NestedInCard verifies the hierarchy contract — an Alert sitting inside a
|
|
63
93
|
// Card must remain visually distinct. Pre-fix, both surfaces used bg-card and
|
|
64
94
|
// the alert disappeared into the card.
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { CircleCheck, TriangleAlert, Info } from "lucide-react";
|
|
2
3
|
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Badge ships six neutral variants plus three semantic status variants
|
|
7
|
+
* (success / warning / info — peer parity: Mantine Badge color, Chakra
|
|
8
|
+
* colorPalette, Ant Design status Tags). Status variants share Alert's
|
|
9
|
+
* color language: semantic-token border + tinted background + icon in the
|
|
10
|
+
* semantic color, while the label stays text-foreground so it holds the
|
|
11
|
+
* AAA 7:1 floor. Pair status badges with an icon or distinct label — never
|
|
12
|
+
* color alone.
|
|
13
|
+
*/
|
|
4
14
|
const meta: Meta<typeof Badge> = {
|
|
5
15
|
title: "Components/Badge",
|
|
6
16
|
component: Badge,
|
|
@@ -44,11 +54,58 @@ export const Variant_Link: Story = {
|
|
|
44
54
|
render: () => <Badge variant="link">Link</Badge>,
|
|
45
55
|
};
|
|
46
56
|
|
|
57
|
+
export const Variant_Success: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<Badge variant="success">
|
|
60
|
+
<CircleCheck strokeWidth={1.5} aria-hidden />
|
|
61
|
+
Passing
|
|
62
|
+
</Badge>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Variant_Warning: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<Badge variant="warning">
|
|
69
|
+
<TriangleAlert strokeWidth={1.5} aria-hidden />
|
|
70
|
+
Degraded
|
|
71
|
+
</Badge>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const Variant_Info: Story = {
|
|
76
|
+
render: () => (
|
|
77
|
+
<Badge variant="info">
|
|
78
|
+
<Info strokeWidth={1.5} aria-hidden />
|
|
79
|
+
Preview
|
|
80
|
+
</Badge>
|
|
81
|
+
),
|
|
82
|
+
};
|
|
83
|
+
|
|
47
84
|
export const RealisticUse: Story = {
|
|
48
|
-
render: () => (
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
85
|
+
render: () => (
|
|
86
|
+
<div className="flex max-w-md flex-col gap-3">
|
|
87
|
+
<div className="flex items-center gap-2">
|
|
88
|
+
<Badge>Default</Badge>
|
|
89
|
+
<Badge variant="secondary">Secondary</Badge>
|
|
90
|
+
<Badge variant="destructive">Destructive</Badge>
|
|
91
|
+
<Badge variant="outline">Outline</Badge>
|
|
92
|
+
</div>
|
|
93
|
+
{/* Status row as it appears in a component-registry table: the icon
|
|
94
|
+
carries the non-color signal alongside the label. */}
|
|
95
|
+
<div className="flex items-center gap-2">
|
|
96
|
+
<Badge variant="success">
|
|
97
|
+
<CircleCheck strokeWidth={1.5} aria-hidden />
|
|
98
|
+
AAA audit passing
|
|
99
|
+
</Badge>
|
|
100
|
+
<Badge variant="warning">
|
|
101
|
+
<TriangleAlert strokeWidth={1.5} aria-hidden />
|
|
102
|
+
2 advisory warnings
|
|
103
|
+
</Badge>
|
|
104
|
+
<Badge variant="info">
|
|
105
|
+
<Info strokeWidth={1.5} aria-hidden />
|
|
106
|
+
Tokens v2 preview
|
|
107
|
+
</Badge>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
),
|
|
54
111
|
};
|