@behavioral-agentic-design-system/core 0.24.0 → 0.26.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 -2
- package/scripts/build-tokens.cjs +79 -5
- package/src/app/preview/components/page.tsx +4474 -208
- package/src/app/shell.tsx +18 -6
- package/src/components/customize/brand-mark-section.tsx +1 -1
- package/src/components/customize-tab.tsx +2 -2
- package/src/components/home-tab.tsx +2 -2
- package/src/components/ui/action-bar.tsx +142 -0
- package/src/components/ui/affix.tsx +109 -0
- package/src/components/ui/alert.tsx +37 -3
- package/src/components/ui/anchor.tsx +136 -0
- package/src/components/ui/angle-slider.tsx +265 -0
- package/src/components/ui/autocomplete.tsx +223 -0
- package/src/components/ui/avatar.tsx +8 -2
- package/src/components/ui/blockquote.tsx +112 -0
- package/src/components/ui/bottom-navigation.tsx +144 -0
- package/src/components/ui/burger.tsx +117 -0
- package/src/components/ui/button.tsx +101 -3
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/card.tsx +43 -5
- package/src/components/ui/carousel.tsx +10 -5
- package/src/components/ui/cascader.tsx +253 -0
- package/src/components/ui/checkbox-card.tsx +176 -0
- package/src/components/ui/checkbox-group.tsx +231 -0
- package/src/components/ui/checkbox.tsx +14 -3
- package/src/components/ui/chip.tsx +143 -0
- package/src/components/ui/circular-progress.tsx +2 -2
- package/src/components/ui/color-swatch.tsx +73 -0
- package/src/components/ui/copy-button.tsx +21 -4
- package/src/components/ui/date-picker.tsx +6 -3
- package/src/components/ui/date-range-picker.tsx +6 -3
- package/src/components/ui/float-label.tsx +114 -0
- package/src/components/ui/floating-panel.tsx +129 -0
- package/src/components/ui/format-number.tsx +122 -0
- package/src/components/ui/highlight.tsx +85 -0
- package/src/components/ui/image.tsx +195 -0
- package/src/components/ui/index.ts +50 -0
- package/src/components/ui/indicator.tsx +2 -2
- package/src/components/ui/input.tsx +48 -4
- package/src/components/ui/kbd.tsx +1 -1
- package/src/components/ui/link.tsx +158 -0
- package/src/components/ui/listbox.tsx +426 -0
- package/src/components/ui/loading-overlay.tsx +80 -0
- package/src/components/ui/marquee.tsx +193 -0
- package/src/components/ui/masonry.tsx +164 -0
- package/src/components/ui/meter.tsx +186 -0
- package/src/components/ui/motion-toggle.tsx +170 -0
- package/src/components/ui/notification.tsx +175 -0
- package/src/components/ui/overlay.tsx +63 -0
- package/src/components/ui/progress.tsx +95 -4
- package/src/components/ui/rating-group.tsx +1 -0
- package/src/components/ui/separator.tsx +57 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/signature-pad.tsx +381 -0
- package/src/components/ui/skeleton.tsx +59 -2
- package/src/components/ui/skip-link.tsx +117 -0
- package/src/components/ui/slider.tsx +86 -1
- package/src/components/ui/spoiler.tsx +131 -0
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/text.tsx +135 -0
- package/src/components/ui/textarea.tsx +66 -2
- package/src/components/ui/timeline.tsx +71 -14
- package/src/components/ui/timer.tsx +183 -0
- package/src/components/ui/tour.tsx +332 -0
- package/src/components/ui/transfer-list.tsx +308 -0
- package/src/components/ui/visually-hidden.tsx +42 -0
- package/src/components/ui/watermark.tsx +0 -0
- package/src/data/docs-index.ts +9 -2
- package/src/stories/ActionBar.stories.tsx +201 -0
- package/src/stories/Affix.stories.tsx +165 -0
- package/src/stories/Alert.stories.tsx +58 -0
- package/src/stories/Anchor.stories.tsx +236 -0
- package/src/stories/AngleSlider.stories.tsx +128 -0
- package/src/stories/Autocomplete.stories.tsx +216 -0
- package/src/stories/Avatar.stories.tsx +73 -1
- package/src/stories/Blockquote.stories.tsx +148 -0
- package/src/stories/BottomNavigation.stories.tsx +195 -0
- package/src/stories/Burger.stories.tsx +79 -0
- package/src/stories/Button.stories.tsx +103 -2
- package/src/stories/Calendar.stories.tsx +4 -0
- package/src/stories/Card.stories.tsx +30 -0
- package/src/stories/Carousel.stories.tsx +2 -1
- package/src/stories/Cascader.stories.tsx +285 -0
- package/src/stories/Checkbox.stories.tsx +13 -0
- package/src/stories/CheckboxCard.stories.tsx +210 -0
- package/src/stories/CheckboxGroup.stories.tsx +186 -0
- package/src/stories/Chip.stories.tsx +173 -0
- package/src/stories/CircularProgress.stories.tsx +3 -0
- package/src/stories/ColorSwatch.stories.tsx +81 -0
- package/src/stories/CopyButton.stories.tsx +3 -3
- package/src/stories/DatePicker.stories.tsx +3 -0
- package/src/stories/DateRangePicker.stories.tsx +3 -0
- package/src/stories/Editable.stories.tsx +14 -0
- package/src/stories/FloatLabel.stories.tsx +148 -0
- package/src/stories/FloatingPanel.stories.tsx +176 -0
- package/src/stories/FormatNumber.stories.tsx +308 -0
- package/src/stories/Highlight.stories.tsx +140 -0
- package/src/stories/Image.stories.tsx +141 -0
- package/src/stories/Indicator.stories.tsx +3 -0
- package/src/stories/Input.stories.tsx +33 -0
- package/src/stories/Kbd.stories.tsx +3 -0
- package/src/stories/Link.stories.tsx +198 -0
- package/src/stories/Listbox.stories.tsx +240 -0
- package/src/stories/LoadingOverlay.stories.tsx +148 -0
- package/src/stories/Marquee.stories.tsx +170 -0
- package/src/stories/Masonry.stories.tsx +227 -0
- package/src/stories/Meter.stories.tsx +143 -0
- package/src/stories/MotionToggle.stories.tsx +85 -0
- package/src/stories/Notification.stories.tsx +264 -0
- package/src/stories/Overlay.stories.tsx +169 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/Progress.stories.tsx +70 -27
- package/src/stories/RatingGroup.stories.tsx +5 -0
- package/src/stories/Separator.stories.tsx +41 -5
- package/src/stories/Sidebar.stories.tsx +2 -1
- package/src/stories/SignaturePad.stories.tsx +112 -0
- package/src/stories/Skeleton.stories.tsx +23 -4
- package/src/stories/SkipLink.stories.tsx +137 -0
- package/src/stories/Slider.stories.tsx +28 -0
- package/src/stories/Spoiler.stories.tsx +122 -0
- package/src/stories/Tabs.stories.tsx +2 -1
- package/src/stories/Text.stories.tsx +191 -0
- package/src/stories/Textarea.stories.tsx +58 -6
- package/src/stories/Timeline.stories.tsx +82 -0
- package/src/stories/Timer.stories.tsx +160 -0
- package/src/stories/Tour.stories.tsx +191 -0
- package/src/stories/TransferList.stories.tsx +169 -0
- package/src/stories/VisuallyHidden.stories.tsx +105 -0
- package/src/stories/Watermark.stories.tsx +212 -0
- package/src/styles.css +80 -6
- package/src/tokens.json +2 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { SignaturePad } from "@behavioral-agentic-design-system/core/components/ui/signature-pad"
|
|
4
|
+
import type { SignaturePadHandle } from "@behavioral-agentic-design-system/core/components/ui/signature-pad"
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
6
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label"
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardDescription,
|
|
11
|
+
CardHeader,
|
|
12
|
+
CardTitle,
|
|
13
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof SignaturePad> = {
|
|
16
|
+
title: "Components/SignaturePad",
|
|
17
|
+
component: SignaturePad,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "centered",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component:
|
|
23
|
+
"Canvas-based freehand signature input for legal, consent, medical, and e-signing flows. Pointer events with setPointerCapture cover mouse, touch, and pen in one path; stroke history lives in refs so drawing never re-renders. Default ink is the computed --foreground (canvas strokeStyle can't consume var(), so var(--x) penColor values resolve via getComputedStyle at draw time — same pattern as Watermark), and a MutationObserver replays strokes on light/dark flip. Exports fill the computed --background before serializing so data URLs are opaque. Canvas is role=img + aria-label + tabIndex=0; Clear/Undo are 44×44px Button primitives (the keyboard-operable bypass for the pointer-only surface); captured/cleared state announces via aria-live=polite. Imperative handle: clear(), undo(), isEmpty(), toDataURL(type?). Strokes are held in memory only — persistence is the caller's responsibility (biometric-analog data; see the registry ethicsContract).",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
penColor: { control: "text" },
|
|
29
|
+
penWidth: { control: { type: "range", min: 1, max: 8, step: 0.5 } },
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
penColor: "var(--foreground)",
|
|
33
|
+
penWidth: 2,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
export default meta
|
|
37
|
+
type Story = StoryObj<typeof SignaturePad>
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
render: (args) => (
|
|
41
|
+
<div className="w-96">
|
|
42
|
+
<SignaturePad {...args} />
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const WithPenColor: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
penColor: "var(--primary)",
|
|
50
|
+
penWidth: 3,
|
|
51
|
+
},
|
|
52
|
+
render: (args) => (
|
|
53
|
+
<div className="w-96">
|
|
54
|
+
<SignaturePad {...args} />
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Disabled: Story = {
|
|
60
|
+
render: (args) => (
|
|
61
|
+
<div className="w-96">
|
|
62
|
+
<SignaturePad {...args} disabled aria-label="Signature pad — signing is disabled" />
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const RealisticUse: Story = {
|
|
68
|
+
render: function RealisticUseStory(args) {
|
|
69
|
+
const padRef = React.useRef<SignaturePadHandle>(null)
|
|
70
|
+
const [signed, setSigned] = React.useState(false)
|
|
71
|
+
return (
|
|
72
|
+
<Card className="w-[28rem]">
|
|
73
|
+
<CardHeader>
|
|
74
|
+
<CardTitle>Sign to confirm</CardTitle>
|
|
75
|
+
<CardDescription>
|
|
76
|
+
By signing below, Jordan Reeves agrees to the BADS design system
|
|
77
|
+
license terms effective 2026-07-25.
|
|
78
|
+
</CardDescription>
|
|
79
|
+
</CardHeader>
|
|
80
|
+
<CardContent className="flex flex-col gap-4">
|
|
81
|
+
<div className="flex flex-col gap-3">
|
|
82
|
+
{/* Visual heading only — the canvas's own aria-label is the
|
|
83
|
+
accessible name (a label can't reference a canvas). */}
|
|
84
|
+
<Label asChild>
|
|
85
|
+
<span>Signature</span>
|
|
86
|
+
</Label>
|
|
87
|
+
<SignaturePad
|
|
88
|
+
{...args}
|
|
89
|
+
ref={padRef}
|
|
90
|
+
aria-label="Signature pad — sign to accept the license terms"
|
|
91
|
+
onEnd={() => setSigned(true)}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
<p className="text-sm text-muted-foreground">
|
|
95
|
+
Can't draw a signature? Contact support@bads.design to sign
|
|
96
|
+
with a typed name instead.
|
|
97
|
+
</p>
|
|
98
|
+
<Button
|
|
99
|
+
size="xl"
|
|
100
|
+
className="w-full"
|
|
101
|
+
disabled={!signed}
|
|
102
|
+
onClick={() => {
|
|
103
|
+
padRef.current?.toDataURL()
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
Accept and submit
|
|
107
|
+
</Button>
|
|
108
|
+
</CardContent>
|
|
109
|
+
</Card>
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
}
|
|
@@ -21,12 +21,31 @@ export const Default: Story = {
|
|
|
21
21
|
</div>),
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
export const Variant_Circle: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<div className="flex items-center gap-3">
|
|
27
|
+
<Skeleton shape="circle" className="size-6" />
|
|
28
|
+
<Skeleton shape="circle" />
|
|
29
|
+
<Skeleton shape="circle" className="size-14" />
|
|
30
|
+
</div>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Variant_Text: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div className="w-[320px] space-y-6">
|
|
37
|
+
<Skeleton shape="text" />
|
|
38
|
+
<Skeleton shape="text" lines={3} />
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
|
|
24
43
|
export const RealisticUse: Story = {
|
|
25
|
-
render: () => (<div className="flex items-
|
|
26
|
-
<Skeleton className="
|
|
44
|
+
render: () => (<div className="flex items-start gap-3 w-[320px]">
|
|
45
|
+
<Skeleton shape="circle" className="size-12" />
|
|
27
46
|
<div className="flex-1 space-y-2">
|
|
28
|
-
<Skeleton className="
|
|
29
|
-
<Skeleton
|
|
47
|
+
<Skeleton shape="text" className="w-[45%]" />
|
|
48
|
+
<Skeleton shape="text" lines={3} />
|
|
30
49
|
</div>
|
|
31
50
|
</div>),
|
|
32
51
|
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import {
|
|
4
|
+
SkipLink,
|
|
5
|
+
SkipTarget,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/skip-link";
|
|
7
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardContent,
|
|
11
|
+
CardHeader,
|
|
12
|
+
CardTitle,
|
|
13
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof SkipLink> = {
|
|
16
|
+
title: "Components/SkipLink",
|
|
17
|
+
component: SkipLink,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component:
|
|
23
|
+
"WCAG 2.4.1 (Bypass Blocks) pair: SkipLink is sr-only until keyboard focus reveals it as a fixed top-left pill (Button-primary styling, min-h-11 target, focus ring); activating it moves both scroll AND sequential focus to the paired SkipTarget (tabIndex −1, never a Tab stop). Render the link as the first focusable element on the page. Try it: click into the story canvas, then press Tab — the link appears top-left.",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<div>
|
|
36
|
+
<SkipLink href="#skiplink-demo-main" />
|
|
37
|
+
<p className="text-sm text-muted-foreground">
|
|
38
|
+
Press <kbd className="rounded border border-border px-1.5 py-0.5 font-mono text-xs">Tab</kbd>{" "}
|
|
39
|
+
with focus in this story — the skip link appears at the top-left of
|
|
40
|
+
the viewport. Activate it (Enter) and focus jumps past the fake nav
|
|
41
|
+
below, straight to the main region.
|
|
42
|
+
</p>
|
|
43
|
+
<nav aria-label="Primary" className="mt-4 flex gap-2">
|
|
44
|
+
<Button variant="ghost">Docs</Button>
|
|
45
|
+
<Button variant="ghost">Components</Button>
|
|
46
|
+
<Button variant="ghost">Tokens</Button>
|
|
47
|
+
<Button variant="ghost">Customize</Button>
|
|
48
|
+
</nav>
|
|
49
|
+
<SkipTarget id="skiplink-demo-main" />
|
|
50
|
+
<main className="mt-4 rounded-lg border border-border p-4">
|
|
51
|
+
<h3 className="text-base font-semibold text-foreground">
|
|
52
|
+
Your design system at a glance
|
|
53
|
+
</h3>
|
|
54
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
55
|
+
Focus lands here after the skip — the next Tab press reaches the
|
|
56
|
+
first control inside the main content instead of the nav.
|
|
57
|
+
</p>
|
|
58
|
+
<Button className="mt-3" size="xl">
|
|
59
|
+
Review token changes
|
|
60
|
+
</Button>
|
|
61
|
+
</main>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const WithCustomLabel: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<div>
|
|
69
|
+
<SkipLink href="#skiplink-custom-main">Skip to token dashboard</SkipLink>
|
|
70
|
+
<p className="text-sm text-muted-foreground">
|
|
71
|
+
The visible label is the children — keep it action-shaped and
|
|
72
|
+
specific when the destination isn't generic ("Skip to token
|
|
73
|
+
dashboard", "Skip to search results").
|
|
74
|
+
</p>
|
|
75
|
+
<SkipTarget id="skiplink-custom-main" />
|
|
76
|
+
<main className="mt-4 rounded-lg border border-border p-4">
|
|
77
|
+
<p className="text-sm text-foreground">
|
|
78
|
+
Token dashboard — 12,417 references scanned, 0 orphans flagged.
|
|
79
|
+
</p>
|
|
80
|
+
</main>
|
|
81
|
+
</div>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Real content from content/personas/bads.json (primary persona pool).
|
|
86
|
+
export const RealisticUse: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<div className="overflow-hidden rounded-lg border border-border">
|
|
89
|
+
<SkipLink href="#skiplink-shell-main" />
|
|
90
|
+
<header className="flex items-center justify-between border-b border-border bg-muted px-4 py-3">
|
|
91
|
+
<span className="text-sm font-semibold text-foreground">
|
|
92
|
+
design.bads.com
|
|
93
|
+
</span>
|
|
94
|
+
<nav aria-label="Account" className="flex items-center gap-2">
|
|
95
|
+
<Button variant="ghost" size="sm">
|
|
96
|
+
Docs
|
|
97
|
+
</Button>
|
|
98
|
+
<Button variant="ghost" size="sm">
|
|
99
|
+
jordan.reeves
|
|
100
|
+
</Button>
|
|
101
|
+
</nav>
|
|
102
|
+
</header>
|
|
103
|
+
<div className="flex">
|
|
104
|
+
<nav
|
|
105
|
+
aria-label="Sections"
|
|
106
|
+
className="w-44 shrink-0 border-r border-border p-3"
|
|
107
|
+
>
|
|
108
|
+
<ul className="space-y-1 text-sm text-muted-foreground">
|
|
109
|
+
<li>Getting started</li>
|
|
110
|
+
<li>Tokens</li>
|
|
111
|
+
<li>Components</li>
|
|
112
|
+
<li>A11y contracts</li>
|
|
113
|
+
<li>Voice & tone</li>
|
|
114
|
+
</ul>
|
|
115
|
+
</nav>
|
|
116
|
+
<div className="min-w-0 flex-1 p-4">
|
|
117
|
+
<SkipTarget id="skiplink-shell-main" />
|
|
118
|
+
<main>
|
|
119
|
+
<Card>
|
|
120
|
+
<CardHeader>
|
|
121
|
+
<CardTitle>Tokens v2 proposal</CardTitle>
|
|
122
|
+
</CardHeader>
|
|
123
|
+
<CardContent className="space-y-2">
|
|
124
|
+
<p className="text-sm text-muted-foreground">
|
|
125
|
+
Jordan Reeves shared 36 components for review at
|
|
126
|
+
design.bads.com/share/tokens-v2-proposal. Every pair holds
|
|
127
|
+
the 7:1 contrast floor.
|
|
128
|
+
</p>
|
|
129
|
+
<Button size="xl">Open review</Button>
|
|
130
|
+
</CardContent>
|
|
131
|
+
</Card>
|
|
132
|
+
</main>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
),
|
|
137
|
+
};
|
|
@@ -38,6 +38,34 @@ export const Disabled: Story = {
|
|
|
38
38
|
),
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* `marks` renders decorative tick dots along the track. The object form
|
|
43
|
+
* (`{ value, label }`) adds a label below each tick; the bare-number form
|
|
44
|
+
* renders a dot only. Marks are `aria-hidden` — the thumb still announces the
|
|
45
|
+
* value — and never change the default rendering when omitted.
|
|
46
|
+
*/
|
|
47
|
+
export const WithMarks: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
defaultValue: [50],
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 100,
|
|
52
|
+
step: 25,
|
|
53
|
+
"aria-label": "Quality",
|
|
54
|
+
marks: [
|
|
55
|
+
{ value: 0, label: "Low" },
|
|
56
|
+
{ value: 25 },
|
|
57
|
+
{ value: 50, label: "Medium" },
|
|
58
|
+
{ value: 75 },
|
|
59
|
+
{ value: 100, label: "High" },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
render: (args) => (
|
|
63
|
+
<div className="w-72">
|
|
64
|
+
<Slider {...args} />
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
41
69
|
export const RealisticUse: Story = {
|
|
42
70
|
render: () => (
|
|
43
71
|
<div className="w-80 space-y-6">
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Spoiler } from "@behavioral-agentic-design-system/core/components/ui/spoiler"
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
CardDescription,
|
|
10
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Spoiler> = {
|
|
13
|
+
title: "Components/Spoiler",
|
|
14
|
+
component: Spoiler,
|
|
15
|
+
parameters: { layout: "centered" },
|
|
16
|
+
tags: ["autodocs"],
|
|
17
|
+
argTypes: {
|
|
18
|
+
maxHeight: { control: "number" },
|
|
19
|
+
showLabel: { control: "text" },
|
|
20
|
+
hideLabel: { control: "text" },
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
|
|
27
|
+
// Content pulled from content/personas/bads.json (primary persona pool,
|
|
28
|
+
// long_form entries added alongside this component).
|
|
29
|
+
|
|
30
|
+
const JORDAN_BIO =
|
|
31
|
+
"Jordan Reeves leads the design systems practice at a mid-size product company in Austin. They spent six years shipping component libraries before this one — first a homegrown Sass framework nobody documented, then a Figma-library-only system that drifted from the code within a quarter. Now they run a three-person team that owns the tokens, reviews every new primitive against its a11y contract, and pressure-tests each release against the personas file before it ships. Jordan reads component source before adopting anything, cares about 7:1 contrast the way other people care about typography, and will absolutely bounce a PR for a hardcoded hex value."
|
|
32
|
+
|
|
33
|
+
const SEOYUN_BIO =
|
|
34
|
+
"Seo-yun Park is a senior design engineer who joined the platform team to stop the same button being rebuilt in four codebases. She wrote the team's first token pipeline, wired Storybook coverage into pre-commit, and now spends most weeks reviewing variants against the registry and talking product teams out of one-off components. Her rule of thumb: if a primitive needs a paragraph of explanation, the API is wrong."
|
|
35
|
+
|
|
36
|
+
const RELEASE_NOTE =
|
|
37
|
+
"This release adds three primitives to the registry, tightens the focus-ring offset to 2px across every interactive component, and regenerates both CSS files from tokens.json. The orphan-token lint now runs quarterly instead of weekly after two false-positive cycles flagged chart-config inputs that were never meant to be utility classes. Upgrading is a standard package bump — no breaking API changes, but re-run pnpm build:tokens if your fork overrides the motion durations."
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div className="w-96">
|
|
42
|
+
<Spoiler maxHeight={96}>
|
|
43
|
+
<p className="text-sm leading-relaxed text-foreground">{JORDAN_BIO}</p>
|
|
44
|
+
</Spoiler>
|
|
45
|
+
</div>
|
|
46
|
+
),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Content shorter than maxHeight → NO toggle renders. The measured,
|
|
50
|
+
// conditional control is the component's contract — short content must
|
|
51
|
+
// never grow a dead "Show more" button.
|
|
52
|
+
export const ShortContent: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div className="w-96 space-y-2">
|
|
55
|
+
<Spoiler maxHeight={96}>
|
|
56
|
+
<p className="text-sm leading-relaxed text-foreground">
|
|
57
|
+
36 components, all passing AAA contrast. Last token change was 3
|
|
58
|
+
days ago.
|
|
59
|
+
</p>
|
|
60
|
+
</Spoiler>
|
|
61
|
+
<p className="text-xs text-muted-foreground">
|
|
62
|
+
Fits under maxHeight — the content renders plain, with no toggle in
|
|
63
|
+
the DOM.
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function ControlledExpanded() {
|
|
70
|
+
const [expanded, setExpanded] = React.useState(true)
|
|
71
|
+
return (
|
|
72
|
+
<div className="w-96 space-y-2">
|
|
73
|
+
<Spoiler
|
|
74
|
+
maxHeight={96}
|
|
75
|
+
expanded={expanded}
|
|
76
|
+
onExpandedChange={setExpanded}
|
|
77
|
+
>
|
|
78
|
+
<p className="text-sm leading-relaxed text-foreground">{SEOYUN_BIO}</p>
|
|
79
|
+
</Spoiler>
|
|
80
|
+
<p className="text-xs text-muted-foreground">
|
|
81
|
+
Controlled — currently {expanded ? "expanded" : "collapsed"} via the
|
|
82
|
+
expanded / onExpandedChange pair.
|
|
83
|
+
</p>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const Expanded: Story = {
|
|
89
|
+
render: () => <ControlledExpanded />,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const CustomLabels: Story = {
|
|
93
|
+
render: () => (
|
|
94
|
+
<div className="w-96">
|
|
95
|
+
<Spoiler
|
|
96
|
+
maxHeight={96}
|
|
97
|
+
showLabel="Read the full bio"
|
|
98
|
+
hideLabel="Collapse bio"
|
|
99
|
+
>
|
|
100
|
+
<p className="text-sm leading-relaxed text-foreground">{JORDAN_BIO}</p>
|
|
101
|
+
</Spoiler>
|
|
102
|
+
</div>
|
|
103
|
+
),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const RealisticUse: Story = {
|
|
107
|
+
render: () => (
|
|
108
|
+
<Card className="w-96">
|
|
109
|
+
<CardHeader>
|
|
110
|
+
<CardTitle>Release notes — v2.4.0</CardTitle>
|
|
111
|
+
<CardDescription>Published 2026-05-26 · design.bads.com</CardDescription>
|
|
112
|
+
</CardHeader>
|
|
113
|
+
<CardContent>
|
|
114
|
+
<Spoiler maxHeight={72} showLabel="Read full notes" hideLabel="Show less">
|
|
115
|
+
<p className="text-sm leading-relaxed text-muted-foreground">
|
|
116
|
+
{RELEASE_NOTE}
|
|
117
|
+
</p>
|
|
118
|
+
</Spoiler>
|
|
119
|
+
</CardContent>
|
|
120
|
+
</Card>
|
|
121
|
+
),
|
|
122
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Motion: trigger narrowed transition-all → transition-colors (explicit-properties rule).
|
|
1
2
|
// scrollbar-none (Tailwind v4.3 utility) replaces old scrollbar-width/webkit-scrollbar workaround
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { Meta, StoryObj } from "@storybook/react";
|
|
@@ -149,4 +150,4 @@ export const Interaction_Switches: Story = {
|
|
|
149
150
|
expect(usageTab).toHaveAttribute("data-state", "active");
|
|
150
151
|
expect(canvas.getByText("Usage statistics panel.")).toBeVisible();
|
|
151
152
|
},
|
|
152
|
-
};
|
|
153
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import {
|
|
4
|
+
Text,
|
|
5
|
+
Heading,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/text"
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
13
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator"
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Text> = {
|
|
16
|
+
title: "Components/Text",
|
|
17
|
+
component: Text,
|
|
18
|
+
parameters: { layout: "centered" },
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
as: { control: "select", options: ["p", "span", "div"] },
|
|
22
|
+
variant: { control: "select", options: ["body", "body-sm", "caption"] },
|
|
23
|
+
tone: { control: "select", options: ["default", "muted"] },
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
29
|
+
|
|
30
|
+
// Content pulled from content/personas/bads.json (real-content rule) —
|
|
31
|
+
// onboarding/dashboard copy, persona names, and unit strings are verbatim
|
|
32
|
+
// pool entries.
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div className="max-w-md">
|
|
37
|
+
<Text>
|
|
38
|
+
BADS ships with tokens, components, and accessibility baked in. Fork
|
|
39
|
+
it, rename it, customize the brand colors, and start building.
|
|
40
|
+
</Text>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Variant_Body: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<div className="max-w-md">
|
|
48
|
+
<Text variant="body">
|
|
49
|
+
Add your first component to see it here. Start with the primitives —
|
|
50
|
+
Button, Card, Input — and compose from there.
|
|
51
|
+
</Text>
|
|
52
|
+
</div>
|
|
53
|
+
),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Variant_BodySm: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<div className="max-w-md">
|
|
59
|
+
<Text variant="body-sm">
|
|
60
|
+
36 components, all passing AAA contrast. Last token change was 3 days
|
|
61
|
+
ago. Your Storybook coverage is at 100%.
|
|
62
|
+
</Text>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const Variant_Caption: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="max-w-md">
|
|
70
|
+
<Text variant="caption" tone="muted">
|
|
71
|
+
Updated 2026-05-26 by Jordan Reeves · 7:1 contrast · 44×44px target
|
|
72
|
+
</Text>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Tone_Muted: Story = {
|
|
78
|
+
render: () => (
|
|
79
|
+
<div className="max-w-md space-y-2">
|
|
80
|
+
<Text variant="body-sm">
|
|
81
|
+
Tokens propagate to both CSS files when you run pnpm build:tokens.
|
|
82
|
+
</Text>
|
|
83
|
+
<Text variant="body-sm" tone="muted">
|
|
84
|
+
Changes via the Customize tab are per-user overrides only.
|
|
85
|
+
</Text>
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// One story per Heading size — each maps 1:1 to a tokens.json textStyle
|
|
91
|
+
// (heading-sm/md/lg/xl). The size prop never changes the outline level.
|
|
92
|
+
|
|
93
|
+
export const Size_Sm: Story = {
|
|
94
|
+
render: () => <Heading size="sm">Customize your tokens</Heading>,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const Size_Md: Story = {
|
|
98
|
+
render: () => <Heading size="md">Your design system at a glance</Heading>,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Size_Lg: Story = {
|
|
102
|
+
render: () => <Heading size="lg">Set up your design system in five minutes</Heading>,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const Size_Xl: Story = {
|
|
106
|
+
render: () => <Heading size="xl">Your design system at a glance</Heading>,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The SC 1.3.1 story: three different outline levels, one visual size.
|
|
110
|
+
// `as` is the document structure; `size` is the look. A screen reader walks
|
|
111
|
+
// h2 → h3 → h4 here even though all three render identically.
|
|
112
|
+
export const HeadingLevelsDecoupled: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="max-w-md space-y-3">
|
|
115
|
+
<Heading as="h2" size="sm">
|
|
116
|
+
Design tokens
|
|
117
|
+
</Heading>
|
|
118
|
+
<Heading as="h3" size="sm">
|
|
119
|
+
Semantic layer
|
|
120
|
+
</Heading>
|
|
121
|
+
<Heading as="h4" size="sm">
|
|
122
|
+
CVA variants
|
|
123
|
+
</Heading>
|
|
124
|
+
<Text variant="body-sm" tone="muted">
|
|
125
|
+
Three outline levels, one visual size — the level comes from the page
|
|
126
|
+
structure, never from the look.
|
|
127
|
+
</Text>
|
|
128
|
+
</div>
|
|
129
|
+
),
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Unbroken long strings in a 320px box — exercises the overflow contract
|
|
133
|
+
// (min-w-0 + overflow-wrap:anywhere): the email wraps instead of bleeding.
|
|
134
|
+
export const LongContent: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className="w-[320px] space-y-2">
|
|
137
|
+
<Heading size="sm">Account owner</Heading>
|
|
138
|
+
<Text variant="body-sm">
|
|
139
|
+
Wilhelmina-Constance Featherstonehaugh-Vance,
|
|
140
|
+
wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org
|
|
141
|
+
</Text>
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const RealisticUse: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<div className="w-[560px] space-y-6">
|
|
149
|
+
<div className="space-y-2">
|
|
150
|
+
<Heading as="h1" size="xl">
|
|
151
|
+
Customize your tokens
|
|
152
|
+
</Heading>
|
|
153
|
+
<Text tone="muted">
|
|
154
|
+
Colors, spacing, and typography for every fork of this system.
|
|
155
|
+
</Text>
|
|
156
|
+
</div>
|
|
157
|
+
<Card>
|
|
158
|
+
<CardHeader>
|
|
159
|
+
<CardTitle className="text-lg">Token health</CardTitle>
|
|
160
|
+
</CardHeader>
|
|
161
|
+
<CardContent className="space-y-4">
|
|
162
|
+
<div className="space-y-1">
|
|
163
|
+
<Heading as="h3" size="sm">
|
|
164
|
+
Contrast audit
|
|
165
|
+
</Heading>
|
|
166
|
+
<Text variant="body-sm">
|
|
167
|
+
36 components, all passing AAA contrast. Last token change was 3
|
|
168
|
+
days ago.
|
|
169
|
+
</Text>
|
|
170
|
+
<Text variant="caption" tone="muted">
|
|
171
|
+
Ran 2026-05-26 · floor 7:1 normal text, 3:1 non-text
|
|
172
|
+
</Text>
|
|
173
|
+
</div>
|
|
174
|
+
<Separator />
|
|
175
|
+
<div className="space-y-1">
|
|
176
|
+
<Heading as="h3" size="sm">
|
|
177
|
+
Type floor
|
|
178
|
+
</Heading>
|
|
179
|
+
<Text variant="body-sm">
|
|
180
|
+
Smallest rendered size is 14px minimum — the caption style sits
|
|
181
|
+
exactly on the floor.
|
|
182
|
+
</Text>
|
|
183
|
+
<Text variant="caption" tone="muted">
|
|
184
|
+
Verified by Seo-yun Park · seoyun.park@figma.com
|
|
185
|
+
</Text>
|
|
186
|
+
</div>
|
|
187
|
+
</CardContent>
|
|
188
|
+
</Card>
|
|
189
|
+
</div>
|
|
190
|
+
),
|
|
191
|
+
}
|