@behavioral-agentic-design-system/core 0.45.0 → 0.47.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 +17 -3
- package/scripts/a11y-lint.cjs +78 -15
- package/scripts/bads-sync.mjs +1 -1
- package/scripts/build-tokens.cjs +122 -7
- package/scripts/check-dark-contrast.mjs +204 -0
- package/scripts/check-flush-edges.mjs +245 -0
- package/scripts/design-system-advisory/README.md +239 -0
- package/scripts/design-system-advisory/check-copy-punctuation.mjs +44 -0
- package/scripts/design-system-advisory/check-even-padding.mjs +35 -0
- package/scripts/design-system-advisory/check-hand-built-button.mjs +46 -0
- package/scripts/design-system-advisory/check-html-nesting.mjs +51 -0
- package/scripts/design-system-advisory/check-icon-sizing.mjs +79 -0
- package/scripts/design-system-advisory/check-label-case.mjs +92 -0
- package/scripts/design-system-advisory/check-native-form-controls.mjs +53 -0
- package/scripts/design-system-advisory/check-radius.mjs +56 -0
- package/scripts/design-system-advisory/check-raw-values.mjs +61 -0
- package/scripts/design-system-advisory/check-small-text.mjs +72 -0
- package/scripts/design-system-advisory/check-tap-target.mjs +70 -0
- package/scripts/design-system-advisory/defaults.mjs +90 -0
- package/scripts/design-system-advisory/fixtures/clean.tsx.fixture +12 -0
- package/scripts/design-system-advisory/fixtures/violations.tsx.fixture +19 -0
- package/scripts/design-system-advisory/lib.mjs +255 -0
- package/scripts/design-system-advisory/run.mjs +189 -0
- package/scripts/design-system-advisory/workflow.yml +82 -0
- package/scripts/lib/copy-strings.mjs +146 -0
- package/scripts/lib/dark-contrast.mjs +120 -0
- package/scripts/lib/flush-edges.mjs +294 -0
- package/scripts/lib/lab-lint.mjs +62 -0
- package/scripts/lib/mount-page.mjs +25 -0
- package/scripts/lib/source-scan.mjs +173 -0
- package/scripts/lib/tells.mjs +240 -2
- package/scripts/lint-arbitrary-tokens.mjs +47 -0
- package/scripts/lint-component-token-refs.mjs +63 -0
- package/scripts/lint-content-hierarchy.mjs +114 -0
- package/scripts/lint-control-baseline.mjs +72 -0
- package/scripts/lint-copy-punctuation.mjs +60 -0
- package/scripts/lint-even-padding.mjs +58 -0
- package/scripts/lint-label-case.mjs +219 -0
- package/scripts/lint-microanimation.mjs +2 -2
- package/scripts/lint-proximity.mjs +181 -0
- package/scripts/lint-slop.mjs +1 -1
- package/scripts/lint-spacing-scale.mjs +78 -0
- package/scripts/lint-target-size.cjs +132 -0
- package/scripts/lint-token-primitives.mjs +307 -0
- package/scripts/size-audit.cjs +2 -2
- package/scripts/ux-tells.mjs +8 -6
- package/scripts/wcag-audit.cjs +25 -4
- package/src/api/layers/file.ts +2 -0
- package/src/api/site-auth.ts +14 -2
- package/src/app/preview/components/page.tsx +94 -14
- package/src/app/preview/sticker-sheet/page.tsx +329 -0
- package/src/app/preview/sticker-sheet/specimens.tsx +296 -0
- package/src/app/shell.tsx +4 -3
- package/src/components/Foundations/Colors.stories.tsx +119 -8
- package/src/components/home-tab.tsx +6 -1
- package/src/components/onboarding-wizard.tsx +1 -1
- package/src/components/ui/avatar.tsx +4 -0
- package/src/components/ui/chart.tsx +134 -42
- package/src/components/ui/checkbox-group.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +1 -0
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/date-picker.tsx +2 -0
- package/src/components/ui/date-range-picker.tsx +4 -0
- package/src/components/ui/file-upload.tsx +21 -2
- package/src/components/ui/heatmap.tsx +3 -1
- package/src/components/ui/input-group.tsx +5 -2
- package/src/components/ui/multi-select.tsx +1 -0
- package/src/components/ui/radio-group.tsx +2 -2
- package/src/components/ui/sparkline.tsx +33 -4
- package/src/components/ui/spinner.tsx +23 -4
- package/src/components/ui/table.tsx +9 -0
- package/src/components/ui/week-picker.tsx +0 -12
- package/src/data/component-added.json +8 -0
- package/src/data/docs-index.ts +22 -1
- package/src/data/history.json +161 -161
- package/src/data/sticker-sheet.json +9244 -0
- package/src/docs-trace-globs.json +1 -0
- package/src/lib/chart-motion.ts +41 -0
- package/src/lib/get-icon-color.ts +1 -1
- package/src/stories/Accordion.stories.tsx +7 -0
- package/src/stories/ActionBar.stories.tsx +5 -0
- package/src/stories/Affix.stories.tsx +4 -0
- package/src/stories/AiBadge.stories.tsx +9 -7
- package/src/stories/Alert.stories.tsx +13 -0
- package/src/stories/AlertDialog.stories.tsx +4 -0
- package/src/stories/Anchor.stories.tsx +5 -0
- package/src/stories/AngleSlider.stories.tsx +6 -3
- package/src/stories/AspectRatio.stories.tsx +4 -0
- package/src/stories/Autocomplete.stories.tsx +6 -0
- package/src/stories/Avatar.stories.tsx +10 -0
- package/src/stories/Badge.stories.tsx +14 -6
- package/src/stories/Blockquote.stories.tsx +6 -0
- package/src/stories/BottomNavigation.stories.tsx +4 -0
- package/src/stories/Breadcrumb.stories.tsx +3 -0
- package/src/stories/Burger.stories.tsx +1 -0
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ButtonGroup.stories.tsx +9 -0
- package/src/stories/Calendar.stories.tsx +3 -0
- package/src/stories/Card.stories.tsx +4 -0
- package/src/stories/Carousel.stories.tsx +6 -0
- package/src/stories/Cascader.stories.tsx +4 -0
- package/src/stories/Chart.stories.tsx +46 -1
- package/src/stories/ChatBubble.stories.tsx +8 -2
- package/src/stories/ChatMarker.stories.tsx +1 -0
- package/src/stories/Checkbox.stories.tsx +40 -0
- package/src/stories/CheckboxCard.stories.tsx +8 -0
- package/src/stories/CheckboxGroup.stories.tsx +19 -0
- package/src/stories/Chip.stories.tsx +10 -19
- package/src/stories/CircularProgress.stories.tsx +13 -27
- package/src/stories/Clipboard.stories.tsx +6 -0
- package/src/stories/CloseButton.stories.tsx +6 -4
- package/src/stories/Code.stories.tsx +8 -1
- package/src/stories/Collapsible.stories.tsx +2 -0
- package/src/stories/ColorPicker.stories.tsx +6 -0
- package/src/stories/ColorSwatch.stories.tsx +1 -0
- package/src/stories/Combobox.stories.tsx +9 -0
- package/src/stories/Command.stories.tsx +2 -0
- package/src/stories/Container.stories.tsx +8 -0
- package/src/stories/ContextMenu.stories.tsx +9 -0
- package/src/stories/CopyButton.stories.tsx +12 -36
- package/src/stories/DataList.stories.tsx +8 -0
- package/src/stories/DataTable.stories.tsx +9 -0
- package/src/stories/DateField.stories.tsx +7 -0
- package/src/stories/DatePicker.stories.tsx +34 -0
- package/src/stories/DateRangePicker.stories.tsx +32 -0
- package/src/stories/Dialog.stories.tsx +8 -0
- package/src/stories/Drawer.stories.tsx +6 -0
- package/src/stories/DropdownMenu.stories.tsx +2 -0
- package/src/stories/Editable.stories.tsx +10 -0
- package/src/stories/EmptyState.stories.tsx +9 -0
- package/src/stories/Field.stories.tsx +7 -0
- package/src/stories/Fieldset.stories.tsx +8 -0
- package/src/stories/FileButton.stories.tsx +4 -0
- package/src/stories/FileUpload.stories.tsx +16 -17
- package/src/stories/FloatLabel.stories.tsx +3 -8
- package/src/stories/FloatingActionButton.stories.tsx +10 -0
- package/src/stories/FloatingIndicator.stories.tsx +4 -0
- package/src/stories/FloatingPanel.stories.tsx +6 -0
- package/src/stories/FocusTrap.stories.tsx +5 -0
- package/src/stories/FormatByte.stories.tsx +6 -0
- package/src/stories/FormatDate.stories.tsx +8 -0
- package/src/stories/FormatNumber.stories.tsx +9 -0
- package/src/stories/Heatmap.stories.tsx +11 -0
- package/src/stories/Highlight.stories.tsx +6 -0
- package/src/stories/HoverCard.stories.tsx +4 -0
- package/src/stories/Image.stories.tsx +9 -0
- package/src/stories/Indicator.stories.tsx +19 -0
- package/src/stories/Input.stories.tsx +7 -0
- package/src/stories/InputClearButton.stories.tsx +3 -0
- package/src/stories/InputGroup.stories.tsx +40 -0
- package/src/stories/Kbd.stories.tsx +7 -1
- package/src/stories/KeyboardShortcut.stories.tsx +2 -0
- package/src/stories/Label.stories.tsx +2 -0
- package/src/stories/Link.stories.tsx +9 -0
- package/src/stories/List.stories.tsx +8 -0
- package/src/stories/Listbox.stories.tsx +1 -0
- package/src/stories/LoadingDots.stories.tsx +5 -3
- package/src/stories/LoadingOverlay.stories.tsx +5 -1
- package/src/stories/Mark.stories.tsx +5 -0
- package/src/stories/Marquee.stories.tsx +4 -0
- package/src/stories/Masonry.stories.tsx +5 -0
- package/src/stories/Menubar.stories.tsx +3 -0
- package/src/stories/Meter.stories.tsx +11 -17
- package/src/stories/MonthPicker.stories.tsx +5 -1
- package/src/stories/MotionToggle.stories.tsx +1 -0
- package/src/stories/MultiSelect.stories.tsx +9 -0
- package/src/stories/NativeSelect.stories.tsx +1 -0
- package/src/stories/NavLink.stories.tsx +7 -0
- package/src/stories/NavigationMenu.stories.tsx +5 -0
- package/src/stories/NavigationRail.stories.tsx +10 -0
- package/src/stories/Notification.stories.tsx +13 -34
- package/src/stories/NumberInput.stories.tsx +8 -1
- package/src/stories/Overlay.stories.tsx +5 -1
- package/src/stories/Pagination.stories.tsx +8 -0
- package/src/stories/PasswordInput.stories.tsx +2 -0
- package/src/stories/PinInput.stories.tsx +9 -2
- package/src/stories/Popover.stories.tsx +2 -0
- package/src/stories/Progress.stories.tsx +6 -1
- package/src/stories/Prose.stories.tsx +8 -0
- package/src/stories/QrCode.stories.tsx +2 -0
- package/src/stories/Questionnaire.stories.tsx +7 -0
- package/src/stories/RadioGroup.stories.tsx +40 -0
- package/src/stories/RatingGroup.stories.tsx +8 -4
- package/src/stories/Resizable.stories.tsx +4 -2
- package/src/stories/Result.stories.tsx +3 -0
- package/src/stories/Reveal.stories.tsx +2 -0
- package/src/stories/RollingNumber.stories.tsx +5 -0
- package/src/stories/ScrollArea.stories.tsx +3 -1
- package/src/stories/SearchInput.stories.tsx +8 -6
- package/src/stories/SegmentedControl.stories.tsx +11 -0
- package/src/stories/Select.stories.tsx +7 -0
- package/src/stories/Separator.stories.tsx +6 -0
- package/src/stories/Sheet.stories.tsx +5 -0
- package/src/stories/Sidebar.stories.tsx +40 -1
- package/src/stories/SimpleGrid.stories.tsx +5 -0
- package/src/stories/Skeleton.stories.tsx +8 -0
- package/src/stories/SkeletonTable.stories.tsx +6 -5
- package/src/stories/SkipLink.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +2 -1
- package/src/stories/Sonner.stories.tsx +7 -0
- package/src/stories/Sparkline.stories.tsx +14 -1
- package/src/stories/Spinner.stories.tsx +20 -10
- package/src/stories/Spoiler.stories.tsx +5 -0
- package/src/stories/Squircle.stories.tsx +7 -0
- package/src/stories/Stack.stories.tsx +7 -0
- package/src/stories/StatusBadge.stories.tsx +12 -6
- package/src/stories/Stepper.stories.tsx +5 -0
- package/src/stories/Switch.stories.tsx +4 -0
- package/src/stories/Table.stories.tsx +10 -1
- package/src/stories/Tabs.stories.tsx +8 -0
- package/src/stories/Tag.stories.tsx +13 -5
- package/src/stories/TagsInput.stories.tsx +13 -0
- package/src/stories/Text.stories.tsx +12 -0
- package/src/stories/Textarea.stories.tsx +9 -0
- package/src/stories/ThemeIcon.stories.tsx +6 -3
- package/src/stories/TimePicker.stories.tsx +2 -0
- package/src/stories/Timeline.stories.tsx +12 -0
- package/src/stories/Timer.stories.tsx +4 -0
- package/src/stories/Toggle.stories.tsx +7 -5
- package/src/stories/ToggleGroup.stories.tsx +5 -0
- package/src/stories/ToggleTip.stories.tsx +4 -0
- package/src/stories/Toolbar.stories.tsx +6 -0
- package/src/stories/Tooltip.stories.tsx +3 -0
- package/src/stories/Tour.stories.tsx +3 -0
- package/src/stories/TransferList.stories.tsx +3 -0
- package/src/stories/TreeSelect.stories.tsx +4 -0
- package/src/stories/TreeView.stories.tsx +5 -0
- package/src/stories/TypingIndicator.stories.tsx +4 -0
- package/src/stories/VisuallyHidden.stories.tsx +3 -0
- package/src/stories/Watermark.stories.tsx +6 -0
- package/src/stories/WeekPicker.stories.tsx +4 -1
- package/src/stories/WordRotate.stories.tsx +5 -0
- package/src/stories/YearPicker.stories.tsx +5 -11
- package/src/styles.css +50 -2
- package/src/tokens.json +4 -4
- package/LICENSE +0 -21
|
@@ -124,6 +124,8 @@ import { FloatingPanel } from "@behavioral-agentic-design-system/core/components
|
|
|
124
124
|
import { NumberInput } from "@behavioral-agentic-design-system/core/components/ui/number-input";
|
|
125
125
|
import { InlineEdit } from "@behavioral-agentic-design-system/core/components/ui/inline-edit";
|
|
126
126
|
import { OTPInput } from "@behavioral-agentic-design-system/core/components/ui/otp-input";
|
|
127
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@behavioral-agentic-design-system/core/components/ui/collapsible";
|
|
128
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
127
129
|
import { FileUpload } from "@behavioral-agentic-design-system/core/components/ui/file-upload";
|
|
128
130
|
import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/spinner";
|
|
129
131
|
import { CircularProgress } from "@behavioral-agentic-design-system/core/components/ui/circular-progress";
|
|
@@ -1634,7 +1636,7 @@ export default function ComponentsPreview() {
|
|
|
1634
1636
|
<div className="space-y-4">
|
|
1635
1637
|
{(["sm", "default", "lg"] as const).map((size) => (
|
|
1636
1638
|
<div key={size} className="space-y-1">
|
|
1637
|
-
<p className="text-xs text-muted-foreground
|
|
1639
|
+
<p className="text-xs text-muted-foreground">size="{size}"</p>
|
|
1638
1640
|
<Pagination size={size}>
|
|
1639
1641
|
<PaginationContent>
|
|
1640
1642
|
<PaginationItem><PaginationPrevious href="#" /></PaginationItem>
|
|
@@ -2019,9 +2021,8 @@ export default function ComponentsPreview() {
|
|
|
2019
2021
|
<span className="text-xs text-muted-foreground">muted</span>
|
|
2020
2022
|
</div>
|
|
2021
2023
|
<div className="flex flex-col items-center gap-2">
|
|
2022
|
-
<div className="flex size-16 items-center justify-center rounded-md bg-
|
|
2023
|
-
|
|
2024
|
-
<Spinner variant="primary" className="[&>svg]:text-primary-foreground" />
|
|
2024
|
+
<div className="flex size-16 items-center justify-center rounded-md border bg-card">
|
|
2025
|
+
<Spinner variant="primary" />
|
|
2025
2026
|
</div>
|
|
2026
2027
|
<span className="text-xs text-muted-foreground">primary</span>
|
|
2027
2028
|
</div>
|
|
@@ -2032,7 +2033,7 @@ export default function ComponentsPreview() {
|
|
|
2032
2033
|
<p className="text-sm font-medium text-muted-foreground">Button loading state</p>
|
|
2033
2034
|
<div className="flex flex-wrap items-center gap-3">
|
|
2034
2035
|
<Button disabled className="gap-2">
|
|
2035
|
-
<Spinner size="xs"
|
|
2036
|
+
<Spinner size="xs" label="Saving" />
|
|
2036
2037
|
Saving changes…
|
|
2037
2038
|
</Button>
|
|
2038
2039
|
<Button variant="outline" disabled className="gap-2">
|
|
@@ -3037,7 +3038,7 @@ export default function ComponentsPreview() {
|
|
|
3037
3038
|
</Section>
|
|
3038
3039
|
|
|
3039
3040
|
<Section title="Table">
|
|
3040
|
-
<Table>
|
|
3041
|
+
<Table aria-label="Design System Team contributions, Q2">
|
|
3041
3042
|
<TableCaption>Design System Team — Q2 contributions</TableCaption>
|
|
3042
3043
|
<TableHeader>
|
|
3043
3044
|
<TableRow>
|
|
@@ -4250,7 +4251,7 @@ export default function ComponentsPreview() {
|
|
|
4250
4251
|
<ColorSwatch color="#171717" size="lg" aria-label="Selected: near-black">
|
|
4251
4252
|
<CheckIcon strokeWidth={1.5} className="text-white" />
|
|
4252
4253
|
</ColorSwatch>
|
|
4253
|
-
{/* Picker's own label pattern (see
|
|
4254
|
+
{/* Picker's own label pattern (see AGENTS.md -> Customize Tab):
|
|
4254
4255
|
shows the user's raw hex pick back as text, not a style
|
|
4255
4256
|
value — SC 1.4.6 doesn't apply to displayed data. */}
|
|
4256
4257
|
<span className="tabular-nums text-muted-foreground">
|
|
@@ -6447,6 +6448,9 @@ export default function ComponentsPreview() {
|
|
|
6447
6448
|
<Section title="OTPInput">
|
|
6448
6449
|
<OTPInputShowcase />
|
|
6449
6450
|
</Section>
|
|
6451
|
+
<Section title="Collapsible">
|
|
6452
|
+
<CollapsibleShowcase />
|
|
6453
|
+
</Section>
|
|
6450
6454
|
</div>
|
|
6451
6455
|
</div>
|
|
6452
6456
|
);
|
|
@@ -11858,7 +11862,7 @@ function LoadingDotsShowcase() {
|
|
|
11858
11862
|
<LoadingDots size="xs" aria-label="Saving" />
|
|
11859
11863
|
</Button>
|
|
11860
11864
|
<p className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
11861
|
-
Fetching results <LoadingDots size="sm"
|
|
11865
|
+
Fetching results <LoadingDots size="sm" tone="muted" />
|
|
11862
11866
|
</p>
|
|
11863
11867
|
<div className="flex h-12 w-full items-center justify-center rounded-md border border-dashed">
|
|
11864
11868
|
<LoadingDots tone="muted" aria-label="Loading content" />
|
|
@@ -12472,12 +12476,21 @@ function SparklineShowcase() {
|
|
|
12472
12476
|
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12473
12477
|
withDot — marks last data point
|
|
12474
12478
|
</p>
|
|
12475
|
-
<
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12479
|
+
<div className="flex gap-4">
|
|
12480
|
+
<Sparkline
|
|
12481
|
+
data={revenueData}
|
|
12482
|
+
withDot
|
|
12483
|
+
className="w-40"
|
|
12484
|
+
aria-label="Monthly revenue trend with current-value dot"
|
|
12485
|
+
/>
|
|
12486
|
+
<Sparkline
|
|
12487
|
+
data={revenueData}
|
|
12488
|
+
type="line"
|
|
12489
|
+
withDot
|
|
12490
|
+
className="w-40"
|
|
12491
|
+
aria-label="Monthly revenue line with current-value dot"
|
|
12492
|
+
/>
|
|
12493
|
+
</div>
|
|
12481
12494
|
</div>
|
|
12482
12495
|
|
|
12483
12496
|
<div>
|
|
@@ -15291,3 +15304,70 @@ function OTPInputShowcase() {
|
|
|
15291
15304
|
</div>
|
|
15292
15305
|
)
|
|
15293
15306
|
}
|
|
15307
|
+
|
|
15308
|
+
function CollapsibleShowcase() {
|
|
15309
|
+
const [open, setOpen] = React.useState(false)
|
|
15310
|
+
return (
|
|
15311
|
+
<div className="flex flex-col gap-6">
|
|
15312
|
+
<div className="flex flex-col items-start gap-3">
|
|
15313
|
+
<p className="text-xs font-medium text-muted-foreground">Default — closed, one disclosure</p>
|
|
15314
|
+
<Collapsible className="w-full max-w-md rounded-lg border p-4">
|
|
15315
|
+
<CollapsibleTrigger asChild>
|
|
15316
|
+
<Button variant="ghost" size="xl" className="group w-full justify-between px-3">
|
|
15317
|
+
What changed in this release
|
|
15318
|
+
<ChevronDownIcon strokeWidth={1.5} className="size-5 transition-transform group-data-[state=open]:rotate-180" />
|
|
15319
|
+
</Button>
|
|
15320
|
+
</CollapsibleTrigger>
|
|
15321
|
+
<CollapsibleContent className="px-3 pt-2 text-sm text-muted-foreground">
|
|
15322
|
+
Variants and sizes now match the registry, upload rejections are announced to screen readers, and
|
|
15323
|
+
the date fields stay controlled when they start empty.
|
|
15324
|
+
</CollapsibleContent>
|
|
15325
|
+
</Collapsible>
|
|
15326
|
+
</div>
|
|
15327
|
+
<div className="flex flex-col items-start gap-3">
|
|
15328
|
+
<p className="text-xs font-medium text-muted-foreground">Open by default</p>
|
|
15329
|
+
<Collapsible defaultOpen className="w-full max-w-md rounded-lg border p-4">
|
|
15330
|
+
<CollapsibleTrigger asChild>
|
|
15331
|
+
<Button variant="ghost" size="xl" className="group w-full justify-between px-3">
|
|
15332
|
+
Accessibility floor
|
|
15333
|
+
<ChevronDownIcon strokeWidth={1.5} className="size-5 transition-transform group-data-[state=open]:rotate-180" />
|
|
15334
|
+
</Button>
|
|
15335
|
+
</CollapsibleTrigger>
|
|
15336
|
+
<CollapsibleContent className="px-3 pt-2 text-sm text-muted-foreground">
|
|
15337
|
+
7:1 text contrast, 44px touch targets, and a visible focus ring on every control.
|
|
15338
|
+
</CollapsibleContent>
|
|
15339
|
+
</Collapsible>
|
|
15340
|
+
</div>
|
|
15341
|
+
<div className="flex flex-col items-start gap-3">
|
|
15342
|
+
<p className="text-xs font-medium text-muted-foreground">Disabled</p>
|
|
15343
|
+
<Collapsible disabled className="w-full max-w-md rounded-lg border p-4">
|
|
15344
|
+
<CollapsibleTrigger asChild>
|
|
15345
|
+
<Button variant="ghost" size="xl" className="group w-full justify-between px-3" disabled>
|
|
15346
|
+
Details unavailable
|
|
15347
|
+
<ChevronDownIcon strokeWidth={1.5} className="size-5" />
|
|
15348
|
+
</Button>
|
|
15349
|
+
</CollapsibleTrigger>
|
|
15350
|
+
<CollapsibleContent className="px-3 pt-2 text-sm text-muted-foreground">Hidden.</CollapsibleContent>
|
|
15351
|
+
</Collapsible>
|
|
15352
|
+
</div>
|
|
15353
|
+
<div className="flex flex-col items-start gap-3">
|
|
15354
|
+
<p className="text-xs font-medium text-muted-foreground">Realistic use — controlled, with a count</p>
|
|
15355
|
+
<Collapsible open={open} onOpenChange={setOpen} className="w-full max-w-md rounded-lg border p-4">
|
|
15356
|
+
<div className="flex items-center justify-between gap-3">
|
|
15357
|
+
<p className="text-sm font-medium">3 reviews waiting on you</p>
|
|
15358
|
+
<CollapsibleTrigger asChild>
|
|
15359
|
+
<Button variant="outline" size="xl">
|
|
15360
|
+
{open ? "Hide details" : "Show details"}
|
|
15361
|
+
</Button>
|
|
15362
|
+
</CollapsibleTrigger>
|
|
15363
|
+
</div>
|
|
15364
|
+
<CollapsibleContent className="mt-3 flex flex-col gap-2 text-sm text-muted-foreground">
|
|
15365
|
+
<p>Priya Nair: table row spacing at the dense size.</p>
|
|
15366
|
+
<p>Theo Okafor: focus ring on the date field.</p>
|
|
15367
|
+
<p>Seo-yun Park: new variant for the tag primitive.</p>
|
|
15368
|
+
</CollapsibleContent>
|
|
15369
|
+
</Collapsible>
|
|
15370
|
+
</div>
|
|
15371
|
+
</div>
|
|
15372
|
+
)
|
|
15373
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// Sticker sheet: every registered component, every declared state, light and
|
|
4
|
+
// dark, with the measured contrast beside it. The registry supplies the list,
|
|
5
|
+
// data/sticker-sheet.json (generated from wcag-audit --json) supplies every
|
|
6
|
+
// number, and specimens.tsx supplies the states. A registry key with no
|
|
7
|
+
// specimen renders as a dashed "not defined" box, never as a blank.
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import registry from "@/layer-5-component-registry/component-registry.json";
|
|
10
|
+
import data from "../../../data/sticker-sheet.json";
|
|
11
|
+
import { SPECIMENS, STATE_LABEL, stateAttrs, type Specimen } from "./specimens";
|
|
12
|
+
|
|
13
|
+
type Theme = "light" | "dark";
|
|
14
|
+
type Pair = (typeof data.contrast)[number];
|
|
15
|
+
type TokenMap = Record<string, { hex: string; alpha?: number }>;
|
|
16
|
+
|
|
17
|
+
const THEMES: Theme[] = ["light", "dark"];
|
|
18
|
+
|
|
19
|
+
interface StoryEntry {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
interface StoryGroup {
|
|
24
|
+
title: string;
|
|
25
|
+
entries: StoryEntry[];
|
|
26
|
+
}
|
|
27
|
+
const STORIES = data.stories as Record<string, StoryGroup>;
|
|
28
|
+
const OTHER_STORIES = data.otherStories as StoryGroup[];
|
|
29
|
+
|
|
30
|
+
// Same resolution the shell uses for its Storybook link: a fork can point
|
|
31
|
+
// NEXT_PUBLIC_STORYBOOK_URL at its own deploy, dev uses the local server, and
|
|
32
|
+
// production uses the static build served same-origin.
|
|
33
|
+
const STORYBOOK_BASE = (
|
|
34
|
+
process.env.NEXT_PUBLIC_STORYBOOK_URL ??
|
|
35
|
+
(process.env.NODE_ENV === "development"
|
|
36
|
+
? "http://localhost:6080"
|
|
37
|
+
: `/storybook/${process.env.NEXT_PUBLIC_STORYBOOK_VERSION || "dev"}`)
|
|
38
|
+
).replace(/\/index\.html$/, "").replace(/\/$/, "");
|
|
39
|
+
|
|
40
|
+
const storyHref = (id: string) => `${STORYBOOK_BASE}/?path=/story/${id}`;
|
|
41
|
+
const storyFrame = (id: string, theme: Theme) => `${STORYBOOK_BASE}/iframe.html?id=${id}&viewMode=story&globals=theme:${theme}`;
|
|
42
|
+
|
|
43
|
+
// ~1,600 stories x 2 themes is far too many live iframes for one page (headless
|
|
44
|
+
// Chromium crashes). Mount a pair only while its cell is within ~1.5 screens of
|
|
45
|
+
// the viewport and drop it again after it leaves, so memory stays bounded and
|
|
46
|
+
// scrolling still lands on a loaded frame.
|
|
47
|
+
//
|
|
48
|
+
// `?all=1` mounts every frame up front with native loading="lazy"; the static
|
|
49
|
+
// export (scripts/export-sticker-sheet.mjs) uses it so the saved HTML carries
|
|
50
|
+
// every frame's src.
|
|
51
|
+
function useNearViewport<T extends Element>() {
|
|
52
|
+
const ref = React.useRef<T>(null);
|
|
53
|
+
const [near, setNear] = React.useState(false);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
const el = ref.current;
|
|
56
|
+
if (!el || typeof IntersectionObserver === "undefined" || new URLSearchParams(window.location.search).has("all")) {
|
|
57
|
+
setNear(true);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const io = new IntersectionObserver(([entry]) => setNear(entry.isIntersecting), { rootMargin: "1400px 0px" });
|
|
61
|
+
io.observe(el);
|
|
62
|
+
return () => io.disconnect();
|
|
63
|
+
}, []);
|
|
64
|
+
return [ref, near] as const;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function StoryCell({ entry }: { entry: StoryEntry }) {
|
|
68
|
+
const [ref, near] = useNearViewport<HTMLDivElement>();
|
|
69
|
+
// Whole-screen stories need room; a single control does not. The frame is
|
|
70
|
+
// resizable either way, and Storybook is one click away for the rest.
|
|
71
|
+
const tall = /realistic|screen|page|layout|dashboard/i.test(entry.name);
|
|
72
|
+
const height = tall ? "h-96" : "h-44";
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex min-w-0 flex-col gap-2" data-story={entry.id}>
|
|
75
|
+
<div className="flex flex-wrap items-baseline justify-between gap-x-3">
|
|
76
|
+
<h4 className="text-sm font-medium">{entry.name}</h4>
|
|
77
|
+
<a href={storyHref(entry.id)} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-xs underline underline-offset-4">
|
|
78
|
+
Open in Storybook
|
|
79
|
+
</a>
|
|
80
|
+
</div>
|
|
81
|
+
<div ref={ref} className="grid gap-3 sm:grid-cols-2">
|
|
82
|
+
{THEMES.map((theme) =>
|
|
83
|
+
near ? (
|
|
84
|
+
<iframe
|
|
85
|
+
key={theme}
|
|
86
|
+
loading="lazy"
|
|
87
|
+
src={storyFrame(entry.id, theme)}
|
|
88
|
+
title={`${entry.name}, ${theme}`}
|
|
89
|
+
className={`${height} w-full resize-y rounded-md border border-border bg-background`}
|
|
90
|
+
/>
|
|
91
|
+
) : (
|
|
92
|
+
<div key={theme} aria-hidden className={`${height} w-full rounded-md border border-dashed border-border`} />
|
|
93
|
+
),
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function StoryList({ group }: { group: StoryGroup }) {
|
|
101
|
+
return (
|
|
102
|
+
<div className="flex flex-col gap-6">
|
|
103
|
+
{group.entries.map((e) => (
|
|
104
|
+
<StoryCell key={e.id} entry={e} />
|
|
105
|
+
))}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const TOKENS = data.tokens as Record<Theme, TokenMap>;
|
|
110
|
+
|
|
111
|
+
function pairFor(theme: Theme, key: string): Pair | undefined {
|
|
112
|
+
const [fg, bg] = key.split("|");
|
|
113
|
+
return data.contrast.find((p) => p.mode === theme && p.fgKey === fg && p.bgKey === bg);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function Verdict({ pair }: { pair: Pair | undefined }) {
|
|
117
|
+
if (!pair) return <span className="rounded border border-dashed border-border px-2 py-0.5 text-xs text-muted-foreground">not audited</span>;
|
|
118
|
+
const pass = pair.ratio >= pair.floor;
|
|
119
|
+
return (
|
|
120
|
+
<span className="tabular-nums">
|
|
121
|
+
{pair.ratio.toFixed(2)}:1 <span className="text-muted-foreground">/ {pair.floor}:1</span>{" "}
|
|
122
|
+
<span className="font-semibold">{pass ? "pass" : "FAIL"}</span>
|
|
123
|
+
</span>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function Swatch({ token, theme }: { token: string; theme: Theme }) {
|
|
128
|
+
const entry = TOKENS[theme][token];
|
|
129
|
+
return (
|
|
130
|
+
<li className="flex items-center gap-2">
|
|
131
|
+
{/* lint-disable: checkbox-bypass a square token color chip, not a control */}
|
|
132
|
+
<span aria-hidden className="size-4 shrink-0 rounded-sm border border-border" style={{ background: `var(--${token})` }} />
|
|
133
|
+
<code className="text-xs">{token}</code>
|
|
134
|
+
<span className="text-xs text-muted-foreground tabular-nums">{entry ? `${entry.hex}${entry.alpha ? ` @ ${entry.alpha}` : ""}` : "unresolved"}</span>
|
|
135
|
+
</li>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function Band({ name, specimen, theme }: { name: string; specimen: Specimen; theme: Theme }) {
|
|
140
|
+
const rows = specimen.variants ?? [{ label: "default", props: {} }];
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
data-theme-band={theme}
|
|
144
|
+
className={`${theme === "dark" ? "dark " : ""}rounded-lg border border-border bg-background p-6 text-foreground`}
|
|
145
|
+
>
|
|
146
|
+
<p className="mb-4 text-xs font-medium uppercase tracking-wide text-muted-foreground">{theme}</p>
|
|
147
|
+
<div className="flex flex-col gap-6">
|
|
148
|
+
{rows.map((row) => (
|
|
149
|
+
<div key={row.label}>
|
|
150
|
+
{specimen.variants && <p className="mb-2 text-sm font-medium">{row.label}</p>}
|
|
151
|
+
<div className="flex flex-wrap gap-x-8 gap-y-5">
|
|
152
|
+
{specimen.states.map((state) => (
|
|
153
|
+
<div key={state} className="flex min-w-0 flex-col gap-2" data-specimen={`${theme}:${name}:${row.label}:${state}`}>
|
|
154
|
+
<span className="text-xs text-muted-foreground">{STATE_LABEL[state]}</span>
|
|
155
|
+
<div className="min-h-11 overflow-hidden p-1">
|
|
156
|
+
{specimen.render({ variant: row.props ?? {}, state, attrs: stateAttrs(state) })}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
))}
|
|
163
|
+
</div>
|
|
164
|
+
{specimen.limits?.map((note) => (
|
|
165
|
+
<p key={note} className="mt-4 rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground">
|
|
166
|
+
Pinning limit: {note}
|
|
167
|
+
</p>
|
|
168
|
+
))}
|
|
169
|
+
<div className="mt-6 grid gap-6 border-t border-border pt-4 sm:grid-cols-2">
|
|
170
|
+
<div>
|
|
171
|
+
<p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">Contrast</p>
|
|
172
|
+
<ul className="flex flex-col gap-1 text-xs">
|
|
173
|
+
{specimen.pairs.map((key) => (
|
|
174
|
+
<li key={key} className="flex flex-wrap items-baseline justify-between gap-x-3">
|
|
175
|
+
<code>{key.replace("|", " on ")}</code>
|
|
176
|
+
<Verdict pair={pairFor(theme, key)} />
|
|
177
|
+
</li>
|
|
178
|
+
))}
|
|
179
|
+
</ul>
|
|
180
|
+
</div>
|
|
181
|
+
<div>
|
|
182
|
+
<p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">Tokens</p>
|
|
183
|
+
<ul className="flex flex-col gap-1">
|
|
184
|
+
{specimen.tokens.map((t) => (
|
|
185
|
+
<Swatch key={t} token={t} theme={theme} />
|
|
186
|
+
))}
|
|
187
|
+
</ul>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default function StickerSheetPage() {
|
|
195
|
+
// The sheet shows both themes itself, so the document must be light: the
|
|
196
|
+
// light band reads :root, and a dark document would repaint it. Runs after
|
|
197
|
+
// DarkModeClient's effect, so it wins over ?dark=1.
|
|
198
|
+
React.useEffect(() => {
|
|
199
|
+
document.documentElement.classList.remove("dark");
|
|
200
|
+
}, []);
|
|
201
|
+
|
|
202
|
+
const [query, setQuery] = React.useState("");
|
|
203
|
+
const deferred = React.useDeferredValue(query.trim().toLowerCase());
|
|
204
|
+
|
|
205
|
+
const keys = Object.keys(registry as Record<string, unknown>);
|
|
206
|
+
const noStories = keys.filter((k) => !STORIES[k] && !SPECIMENS[k]);
|
|
207
|
+
const pinned = keys.filter((k) => SPECIMENS[k]);
|
|
208
|
+
const storyCount = Object.values(STORIES).reduce((n, g) => n + g.entries.length, 0);
|
|
209
|
+
const failing = data.contrast.filter((p) => p.ratio < p.floor);
|
|
210
|
+
const shown = keys.filter((k) => (STORIES[k] || SPECIMENS[k]) && k.toLowerCase().includes(deferred));
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<main className="mx-auto flex max-w-6xl flex-col gap-10 px-4 py-8 sm:px-6">
|
|
214
|
+
<header className="flex flex-col gap-4">
|
|
215
|
+
<h1 className="text-2xl font-semibold">Sticker sheet</h1>
|
|
216
|
+
<p className="max-w-prose text-sm text-muted-foreground">
|
|
217
|
+
{keys.length} registered components. {keys.length - noStories.length} have stories ({storyCount} in all, each shown in light and dark and linked to Storybook), {pinned.length} also have a pinned state matrix, and {noStories.length} have neither. Every contrast number comes from <code>wcag:audit</code>, which currently reports {failing.length} failing pairs across {data.contrast.length}.
|
|
218
|
+
</p>
|
|
219
|
+
<label className="flex max-w-sm flex-col gap-2 text-sm">
|
|
220
|
+
Filter components
|
|
221
|
+
<input
|
|
222
|
+
type="search"
|
|
223
|
+
value={query}
|
|
224
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
225
|
+
placeholder="Button, Dialog, Tabs"
|
|
226
|
+
className="min-h-11 rounded-md border border-input bg-background px-3 text-sm"
|
|
227
|
+
/>
|
|
228
|
+
</label>
|
|
229
|
+
</header>
|
|
230
|
+
|
|
231
|
+
{shown.map((name) => {
|
|
232
|
+
const group = STORIES[name];
|
|
233
|
+
return (
|
|
234
|
+
<section key={name} id={name} aria-labelledby={`${name}-h`} className="flex flex-col gap-4 border-t border-border pt-8">
|
|
235
|
+
<div className="flex flex-wrap items-baseline justify-between gap-x-4">
|
|
236
|
+
<h2 id={`${name}-h`} className="text-xl font-semibold">
|
|
237
|
+
{name}
|
|
238
|
+
</h2>
|
|
239
|
+
{group && (
|
|
240
|
+
<a href={`${STORYBOOK_BASE}/?path=/docs/${group.entries[0].id.split("--")[0]}--docs`} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-sm underline underline-offset-4">
|
|
241
|
+
{group.title} in Storybook
|
|
242
|
+
</a>
|
|
243
|
+
)}
|
|
244
|
+
</div>
|
|
245
|
+
{SPECIMENS[name] ? (
|
|
246
|
+
<div className="flex flex-col gap-4">
|
|
247
|
+
{THEMES.map((theme) => (
|
|
248
|
+
<Band key={theme} name={name} specimen={SPECIMENS[name]} theme={theme} />
|
|
249
|
+
))}
|
|
250
|
+
</div>
|
|
251
|
+
) : (
|
|
252
|
+
<p className="rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground">Pinned state matrix: not defined</p>
|
|
253
|
+
)}
|
|
254
|
+
{group ? <StoryList group={group} /> : <p className="rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground">Stories: not defined</p>}
|
|
255
|
+
</section>
|
|
256
|
+
);
|
|
257
|
+
})}
|
|
258
|
+
|
|
259
|
+
{OTHER_STORIES.length > 0 && !deferred && (
|
|
260
|
+
<section aria-labelledby="other-h" className="flex flex-col gap-6 border-t border-border pt-8">
|
|
261
|
+
<h2 id="other-h" className="text-xl font-semibold">
|
|
262
|
+
Stories with no registry entry
|
|
263
|
+
</h2>
|
|
264
|
+
{OTHER_STORIES.map((g) => (
|
|
265
|
+
<div key={g.title} className="flex flex-col gap-4">
|
|
266
|
+
<h3 className="text-base font-semibold">{g.title}</h3>
|
|
267
|
+
<StoryList group={g} />
|
|
268
|
+
</div>
|
|
269
|
+
))}
|
|
270
|
+
</section>
|
|
271
|
+
)}
|
|
272
|
+
|
|
273
|
+
{noStories.length > 0 && (
|
|
274
|
+
<section aria-labelledby="gaps-h" className="flex flex-col gap-4 border-t border-border pt-8">
|
|
275
|
+
<h2 id="gaps-h" className="text-xl font-semibold">
|
|
276
|
+
Not defined ({noStories.length})
|
|
277
|
+
</h2>
|
|
278
|
+
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
|
|
279
|
+
{noStories.map((k) => (
|
|
280
|
+
<li key={k} className="min-w-0 overflow-hidden rounded-md border border-dashed border-border p-3">
|
|
281
|
+
<p className="truncate text-sm font-medium" title={k}>
|
|
282
|
+
{k}
|
|
283
|
+
</p>
|
|
284
|
+
<p className="text-xs text-muted-foreground">registered, no story</p>
|
|
285
|
+
</li>
|
|
286
|
+
))}
|
|
287
|
+
</ul>
|
|
288
|
+
</section>
|
|
289
|
+
)}
|
|
290
|
+
|
|
291
|
+
<section aria-labelledby="pairs-h" className="flex flex-col gap-4">
|
|
292
|
+
<h2 id="pairs-h" className="text-xl font-semibold">
|
|
293
|
+
Every audited pair
|
|
294
|
+
</h2>
|
|
295
|
+
{THEMES.map((theme) => (
|
|
296
|
+
<details key={theme} className="rounded-lg border border-border p-4">
|
|
297
|
+
<summary className="min-h-11 cursor-pointer text-sm font-medium">
|
|
298
|
+
{theme} ({data.contrast.filter((p) => p.mode === theme).length} pairs)
|
|
299
|
+
</summary>
|
|
300
|
+
<table className="mt-3 w-full text-xs">
|
|
301
|
+
<thead>
|
|
302
|
+
<tr className="text-left text-muted-foreground">
|
|
303
|
+
<th className="py-1 pr-3 font-medium">Pair</th>
|
|
304
|
+
<th className="py-1 pr-3 font-medium">Kind</th>
|
|
305
|
+
<th className="py-1 font-medium">Ratio</th>
|
|
306
|
+
</tr>
|
|
307
|
+
</thead>
|
|
308
|
+
<tbody>
|
|
309
|
+
{data.contrast
|
|
310
|
+
.filter((p) => p.mode === theme)
|
|
311
|
+
.map((p) => (
|
|
312
|
+
<tr key={`${p.fgKey}|${p.bgKey}`} className="border-t border-border">
|
|
313
|
+
<td className="py-1 pr-3">
|
|
314
|
+
<code>{p.fgKey}</code> on <code>{p.bgKey}</code>
|
|
315
|
+
</td>
|
|
316
|
+
<td className="py-1 pr-3">{p.kind}</td>
|
|
317
|
+
<td className="py-1">
|
|
318
|
+
<Verdict pair={p} />
|
|
319
|
+
</td>
|
|
320
|
+
</tr>
|
|
321
|
+
))}
|
|
322
|
+
</tbody>
|
|
323
|
+
</table>
|
|
324
|
+
</details>
|
|
325
|
+
))}
|
|
326
|
+
</section>
|
|
327
|
+
</main>
|
|
328
|
+
);
|
|
329
|
+
}
|