@behavioral-agentic-design-system/core 0.24.0 → 0.27.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 +87 -5
- package/src/app/preview/components/page.tsx +4745 -244
- 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-action-button.tsx +179 -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 +51 -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 +343 -0
- package/src/components/ui/typing-indicator.tsx +96 -0
- package/src/components/ui/visually-hidden.tsx +42 -0
- package/src/components/ui/watermark.tsx +0 -0
- package/src/components/ui/word-rotate.tsx +82 -0
- package/src/data/docs-index.ts +10 -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/FloatingActionButton.stories.tsx +215 -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 +150 -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 +190 -0
- package/src/stories/TypingIndicator.stories.tsx +139 -0
- package/src/stories/VisuallyHidden.stories.tsx +105 -0
- package/src/stories/Watermark.stories.tsx +212 -0
- package/src/stories/WordRotate.stories.tsx +101 -0
- package/src/styles.css +88 -6
- package/src/tokens.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Avatar, AvatarFallback, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
2
|
+
import { Avatar, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Avatar> = {
|
|
5
5
|
title: "Components/Avatar",
|
|
@@ -23,6 +23,78 @@ export const Default: Story = {
|
|
|
23
23
|
</div>),
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
export const Shape_Circle: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<div className="flex items-center gap-3">
|
|
29
|
+
<Avatar shape="circle" size="lg">
|
|
30
|
+
<AvatarImage src="/avatars/01.png" alt="Jordan Reeves" />
|
|
31
|
+
<AvatarFallback>JR</AvatarFallback>
|
|
32
|
+
</Avatar>
|
|
33
|
+
<Avatar shape="circle" size="lg">
|
|
34
|
+
<AvatarFallback>SP</AvatarFallback>
|
|
35
|
+
</Avatar>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Shape_Square: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<div className="flex items-center gap-3">
|
|
43
|
+
<Avatar shape="square" size="lg">
|
|
44
|
+
<AvatarImage src="/avatars/01.png" alt="Anika Patel" />
|
|
45
|
+
<AvatarFallback>AP</AvatarFallback>
|
|
46
|
+
</Avatar>
|
|
47
|
+
<Avatar shape="square" size="lg">
|
|
48
|
+
<AvatarFallback>KA</AvatarFallback>
|
|
49
|
+
</Avatar>
|
|
50
|
+
</div>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Group: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<AvatarGroup aria-label="Project contributors: Jordan Reeves, Seo-yun Park, Marcus Lindqvist, and 3 more">
|
|
57
|
+
<Avatar>
|
|
58
|
+
<AvatarImage src="/avatars/01.png" alt="Jordan Reeves" />
|
|
59
|
+
<AvatarFallback>JR</AvatarFallback>
|
|
60
|
+
</Avatar>
|
|
61
|
+
<Avatar>
|
|
62
|
+
<AvatarFallback>SP</AvatarFallback>
|
|
63
|
+
</Avatar>
|
|
64
|
+
<Avatar>
|
|
65
|
+
<AvatarFallback>ML</AvatarFallback>
|
|
66
|
+
</Avatar>
|
|
67
|
+
<AvatarGroupCount title="Anika Patel and 2 more">+3</AvatarGroupCount>
|
|
68
|
+
</AvatarGroup>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Group_Sizes: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<div className="flex flex-col items-start gap-4">
|
|
75
|
+
<AvatarGroup aria-label="Reviewers: Jordan Reeves, Seo-yun Park, and 2 more">
|
|
76
|
+
<Avatar size="sm">
|
|
77
|
+
<AvatarFallback>JR</AvatarFallback>
|
|
78
|
+
</Avatar>
|
|
79
|
+
<Avatar size="sm">
|
|
80
|
+
<AvatarFallback>SP</AvatarFallback>
|
|
81
|
+
</Avatar>
|
|
82
|
+
<AvatarGroupCount>+2</AvatarGroupCount>
|
|
83
|
+
</AvatarGroup>
|
|
84
|
+
<AvatarGroup aria-label="Workshop attendees: Marcus Lindqvist, Anika Patel, and 4 more">
|
|
85
|
+
<Avatar size="lg">
|
|
86
|
+
<AvatarImage src="/avatars/01.png" alt="Marcus Lindqvist" />
|
|
87
|
+
<AvatarFallback>ML</AvatarFallback>
|
|
88
|
+
</Avatar>
|
|
89
|
+
<Avatar size="lg">
|
|
90
|
+
<AvatarFallback>AP</AvatarFallback>
|
|
91
|
+
</Avatar>
|
|
92
|
+
<AvatarGroupCount>+4</AvatarGroupCount>
|
|
93
|
+
</AvatarGroup>
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
};
|
|
97
|
+
|
|
26
98
|
export const RealisticUse: Story = {
|
|
27
99
|
render: () => (<div className="flex items-center gap-3">
|
|
28
100
|
<Avatar>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import {
|
|
4
|
+
Blockquote,
|
|
5
|
+
BlockquoteContent,
|
|
6
|
+
BlockquoteAttribution,
|
|
7
|
+
} from "@behavioral-agentic-design-system/core/components/ui/blockquote"
|
|
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 Blockquote> = {
|
|
16
|
+
title: "Components/Blockquote",
|
|
17
|
+
component: Blockquote,
|
|
18
|
+
parameters: { layout: "centered" },
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
variant: { control: "select", options: ["default", "accent", "plain"] },
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default meta
|
|
26
|
+
type Story = StoryObj<typeof meta>
|
|
27
|
+
|
|
28
|
+
// Content pulled from content/personas/bads.json (real-content rule) —
|
|
29
|
+
// quotes are verbatim lines from the persona pool's long_form entries.
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<div className="max-w-md">
|
|
34
|
+
<Blockquote>
|
|
35
|
+
<BlockquoteContent>
|
|
36
|
+
If a primitive needs a paragraph of explanation, the API is wrong.
|
|
37
|
+
</BlockquoteContent>
|
|
38
|
+
<BlockquoteAttribution>
|
|
39
|
+
— Seo-yun Park, Senior Design Engineer
|
|
40
|
+
</BlockquoteAttribution>
|
|
41
|
+
</Blockquote>
|
|
42
|
+
</div>
|
|
43
|
+
),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Variant_Accent: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<div className="max-w-md">
|
|
49
|
+
<Blockquote variant="accent">
|
|
50
|
+
<BlockquoteContent>
|
|
51
|
+
Jordan reads component source before adopting anything, and will
|
|
52
|
+
absolutely bounce a PR for a hardcoded hex value.
|
|
53
|
+
</BlockquoteContent>
|
|
54
|
+
<BlockquoteAttribution>
|
|
55
|
+
— Design Systems Team, Austin
|
|
56
|
+
</BlockquoteAttribution>
|
|
57
|
+
</Blockquote>
|
|
58
|
+
</div>
|
|
59
|
+
),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Variant_Plain: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="max-w-md space-y-3 text-sm leading-relaxed text-foreground">
|
|
65
|
+
<p>
|
|
66
|
+
The onboarding doc opens with the team’s working rule for every
|
|
67
|
+
new primitive:
|
|
68
|
+
</p>
|
|
69
|
+
<Blockquote variant="plain">
|
|
70
|
+
<BlockquoteContent className="text-sm">
|
|
71
|
+
Fork it, rename it, customize the brand colors, and start building.
|
|
72
|
+
</BlockquoteContent>
|
|
73
|
+
<BlockquoteAttribution>— BADS onboarding</BlockquoteAttribution>
|
|
74
|
+
</Blockquote>
|
|
75
|
+
</div>
|
|
76
|
+
),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// The native cite attribute carries the machine-readable source URL;
|
|
80
|
+
// the visible <cite> element inside the attribution names the work.
|
|
81
|
+
export const WithCitation: Story = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<div className="max-w-md">
|
|
84
|
+
<Blockquote>
|
|
85
|
+
<BlockquoteContent cite="https://design.bads.com/docs/getting-started">
|
|
86
|
+
BADS ships with tokens, components, and accessibility baked in.
|
|
87
|
+
</BlockquoteContent>
|
|
88
|
+
<BlockquoteAttribution>
|
|
89
|
+
— Jordan Reeves, <cite>Getting started guide</cite>
|
|
90
|
+
</BlockquoteAttribution>
|
|
91
|
+
</Blockquote>
|
|
92
|
+
</div>
|
|
93
|
+
),
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Long quote + long attribution in a narrow container — exercises the
|
|
97
|
+
// overflow contract (min-w-0 + overflow-wrap:anywhere): the unbroken
|
|
98
|
+
// long email wraps instead of bleeding out of the 320px box.
|
|
99
|
+
export const LongContent: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<div className="w-[320px]">
|
|
102
|
+
<Blockquote>
|
|
103
|
+
<BlockquoteContent>
|
|
104
|
+
This release adds three primitives to the registry, tightens the
|
|
105
|
+
focus-ring offset to 2px across every interactive component, and
|
|
106
|
+
regenerates both CSS files from tokens.json. Upgrading is a standard
|
|
107
|
+
package bump — no breaking API changes, but re-run pnpm build:tokens
|
|
108
|
+
if your fork overrides the motion durations.
|
|
109
|
+
</BlockquoteContent>
|
|
110
|
+
<BlockquoteAttribution>
|
|
111
|
+
— Wilhelmina-Constance Featherstonehaugh-Vance,
|
|
112
|
+
wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org
|
|
113
|
+
</BlockquoteAttribution>
|
|
114
|
+
</Blockquote>
|
|
115
|
+
</div>
|
|
116
|
+
),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const RealisticUse: Story = {
|
|
120
|
+
render: () => (
|
|
121
|
+
<Card className="w-96">
|
|
122
|
+
<CardHeader>
|
|
123
|
+
<CardTitle className="text-lg">What adopters say</CardTitle>
|
|
124
|
+
</CardHeader>
|
|
125
|
+
<CardContent className="space-y-6">
|
|
126
|
+
<Blockquote variant="accent">
|
|
127
|
+
<BlockquoteContent cite="https://design.bads.com/share/tokens-v2-proposal">
|
|
128
|
+
She wrote the team’s first token pipeline, wired Storybook
|
|
129
|
+
coverage into pre-commit, and now spends most weeks talking product
|
|
130
|
+
teams out of one-off components.
|
|
131
|
+
</BlockquoteContent>
|
|
132
|
+
<BlockquoteAttribution>
|
|
133
|
+
— Seo-yun Park, Senior Design Engineer
|
|
134
|
+
</BlockquoteAttribution>
|
|
135
|
+
</Blockquote>
|
|
136
|
+
<Blockquote>
|
|
137
|
+
<BlockquoteContent>
|
|
138
|
+
36 components, all passing AAA contrast. Last token change was 3
|
|
139
|
+
days ago. Your Storybook coverage is at 100%.
|
|
140
|
+
</BlockquoteContent>
|
|
141
|
+
<BlockquoteAttribution>
|
|
142
|
+
— Jordan Reeves, <cite>adoption review, 2026-05-26</cite>
|
|
143
|
+
</BlockquoteAttribution>
|
|
144
|
+
</Blockquote>
|
|
145
|
+
</CardContent>
|
|
146
|
+
</Card>
|
|
147
|
+
),
|
|
148
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
HomeIcon,
|
|
5
|
+
SearchIcon,
|
|
6
|
+
LibraryIcon,
|
|
7
|
+
BellIcon,
|
|
8
|
+
UserIcon,
|
|
9
|
+
PaletteIcon,
|
|
10
|
+
BookOpenIcon,
|
|
11
|
+
} from "lucide-react";
|
|
12
|
+
import {
|
|
13
|
+
BottomNavigation,
|
|
14
|
+
BottomNavigationItem,
|
|
15
|
+
} from "@behavioral-agentic-design-system/core/components/ui/bottom-navigation";
|
|
16
|
+
import {
|
|
17
|
+
Card,
|
|
18
|
+
CardContent,
|
|
19
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
20
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
21
|
+
|
|
22
|
+
const meta: Meta<typeof BottomNavigation> = {
|
|
23
|
+
title: "Components/BottomNavigation",
|
|
24
|
+
component: BottomNavigation,
|
|
25
|
+
parameters: { layout: "centered" },
|
|
26
|
+
tags: ["autodocs"],
|
|
27
|
+
argTypes: {
|
|
28
|
+
fixed: { control: "boolean" },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof BottomNavigation>;
|
|
34
|
+
|
|
35
|
+
// Controlled wrapper for interactive stories. `fixed` stays off so the bar
|
|
36
|
+
// renders in-flow inside the Storybook canvas instead of escaping to the
|
|
37
|
+
// iframe viewport edge.
|
|
38
|
+
function Controlled({
|
|
39
|
+
defaultValue,
|
|
40
|
+
label,
|
|
41
|
+
children,
|
|
42
|
+
}: {
|
|
43
|
+
defaultValue: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}) {
|
|
47
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
48
|
+
return (
|
|
49
|
+
<div className="w-80 overflow-hidden rounded-lg border border-border">
|
|
50
|
+
<BottomNavigation value={value} onValueChange={setValue} label={label ?? "Demo"}>
|
|
51
|
+
{children}
|
|
52
|
+
</BottomNavigation>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<Controlled defaultValue="home" label="Primary">
|
|
60
|
+
<BottomNavigationItem
|
|
61
|
+
value="home"
|
|
62
|
+
icon={<HomeIcon strokeWidth={1.5} />}
|
|
63
|
+
label="Home"
|
|
64
|
+
/>
|
|
65
|
+
<BottomNavigationItem
|
|
66
|
+
value="search"
|
|
67
|
+
icon={<SearchIcon strokeWidth={1.5} />}
|
|
68
|
+
label="Search"
|
|
69
|
+
/>
|
|
70
|
+
<BottomNavigationItem
|
|
71
|
+
value="library"
|
|
72
|
+
icon={<LibraryIcon strokeWidth={1.5} />}
|
|
73
|
+
label="Library"
|
|
74
|
+
/>
|
|
75
|
+
</Controlled>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const FiveItems: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<Controlled defaultValue="components" label="Design system">
|
|
82
|
+
<BottomNavigationItem
|
|
83
|
+
value="home"
|
|
84
|
+
icon={<HomeIcon strokeWidth={1.5} />}
|
|
85
|
+
label="Home"
|
|
86
|
+
/>
|
|
87
|
+
<BottomNavigationItem
|
|
88
|
+
value="components"
|
|
89
|
+
icon={<LibraryIcon strokeWidth={1.5} />}
|
|
90
|
+
label="Components"
|
|
91
|
+
/>
|
|
92
|
+
<BottomNavigationItem
|
|
93
|
+
value="tokens"
|
|
94
|
+
icon={<PaletteIcon strokeWidth={1.5} />}
|
|
95
|
+
label="Tokens"
|
|
96
|
+
/>
|
|
97
|
+
<BottomNavigationItem
|
|
98
|
+
value="docs"
|
|
99
|
+
icon={<BookOpenIcon strokeWidth={1.5} />}
|
|
100
|
+
label="Docs"
|
|
101
|
+
/>
|
|
102
|
+
<BottomNavigationItem
|
|
103
|
+
value="profile"
|
|
104
|
+
icon={<UserIcon strokeWidth={1.5} />}
|
|
105
|
+
label="Profile"
|
|
106
|
+
/>
|
|
107
|
+
</Controlled>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const Disabled: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<Controlled defaultValue="home" label="Primary">
|
|
114
|
+
<BottomNavigationItem
|
|
115
|
+
value="home"
|
|
116
|
+
icon={<HomeIcon strokeWidth={1.5} />}
|
|
117
|
+
label="Home"
|
|
118
|
+
/>
|
|
119
|
+
<BottomNavigationItem
|
|
120
|
+
value="alerts"
|
|
121
|
+
icon={<BellIcon strokeWidth={1.5} />}
|
|
122
|
+
label="Alerts"
|
|
123
|
+
disabled
|
|
124
|
+
/>
|
|
125
|
+
<BottomNavigationItem
|
|
126
|
+
value="profile"
|
|
127
|
+
icon={<UserIcon strokeWidth={1.5} />}
|
|
128
|
+
label="Profile"
|
|
129
|
+
/>
|
|
130
|
+
</Controlled>
|
|
131
|
+
),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Realistic use: mobile frame of the BADS docs app — content region above,
|
|
135
|
+
// bottom navigation anchored to the frame's bottom edge. Content pulled from
|
|
136
|
+
// content/personas/bads.json (design-system practitioner audience).
|
|
137
|
+
export const RealisticUse: Story = {
|
|
138
|
+
render: () => {
|
|
139
|
+
const [section, setSection] = React.useState("components");
|
|
140
|
+
const screens: Record<string, { title: string; body: string }> = {
|
|
141
|
+
home: {
|
|
142
|
+
title: "Welcome back, Jordan",
|
|
143
|
+
body: "Story coverage is at 98.4%. Last token change was 3 days ago.",
|
|
144
|
+
},
|
|
145
|
+
components: {
|
|
146
|
+
title: "Component registry",
|
|
147
|
+
body: "88 registry components with a11y contracts. Newest: QRCode, DataList, FormatNumber.",
|
|
148
|
+
},
|
|
149
|
+
tokens: {
|
|
150
|
+
title: "Tokens",
|
|
151
|
+
body: "12,417 token references scanned in the last orphan-lint sweep. Zero orphans flagged.",
|
|
152
|
+
},
|
|
153
|
+
profile: {
|
|
154
|
+
title: "Jordan Reeves",
|
|
155
|
+
body: "Design Systems Lead · jordan@reeves.design · Austin, TX",
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
const screen = screens[section];
|
|
159
|
+
return (
|
|
160
|
+
<div className="flex h-[480px] w-72 flex-col overflow-hidden rounded-xl border border-border bg-background shadow-sm">
|
|
161
|
+
<div className="flex-1 space-y-3 overflow-y-auto p-4">
|
|
162
|
+
<Badge variant="secondary">design.bads.com</Badge>
|
|
163
|
+
<h2 className="text-lg font-semibold">{screen.title}</h2>
|
|
164
|
+
<Card>
|
|
165
|
+
<CardContent className="p-4">
|
|
166
|
+
<p className="text-sm text-muted-foreground">{screen.body}</p>
|
|
167
|
+
</CardContent>
|
|
168
|
+
</Card>
|
|
169
|
+
</div>
|
|
170
|
+
<BottomNavigation value={section} onValueChange={setSection} label="Primary">
|
|
171
|
+
<BottomNavigationItem
|
|
172
|
+
value="home"
|
|
173
|
+
icon={<HomeIcon strokeWidth={1.5} />}
|
|
174
|
+
label="Home"
|
|
175
|
+
/>
|
|
176
|
+
<BottomNavigationItem
|
|
177
|
+
value="components"
|
|
178
|
+
icon={<LibraryIcon strokeWidth={1.5} />}
|
|
179
|
+
label="Components"
|
|
180
|
+
/>
|
|
181
|
+
<BottomNavigationItem
|
|
182
|
+
value="tokens"
|
|
183
|
+
icon={<PaletteIcon strokeWidth={1.5} />}
|
|
184
|
+
label="Tokens"
|
|
185
|
+
/>
|
|
186
|
+
<BottomNavigationItem
|
|
187
|
+
value="profile"
|
|
188
|
+
icon={<UserIcon strokeWidth={1.5} />}
|
|
189
|
+
label="Profile"
|
|
190
|
+
/>
|
|
191
|
+
</BottomNavigation>
|
|
192
|
+
</div>
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Burger } from "@behavioral-agentic-design-system/core/components/ui/burger";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Burger> = {
|
|
6
|
+
title: "Components/Burger",
|
|
7
|
+
component: Burger,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: { "aria-label": "Toggle navigation" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Opened: Story = {
|
|
20
|
+
args: { "aria-label": "Toggle navigation", opened: true },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Size_SmClosed: Story = {
|
|
24
|
+
args: { "aria-label": "Toggle navigation", size: "sm" },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Size_SmOpened: Story = {
|
|
28
|
+
args: { "aria-label": "Toggle navigation", size: "sm", opened: true },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Size_MdClosed: Story = {
|
|
32
|
+
args: { "aria-label": "Toggle navigation", size: "md" },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Size_LgClosed: Story = {
|
|
36
|
+
args: { "aria-label": "Toggle navigation", size: "lg" },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Size_LgOpened: Story = {
|
|
40
|
+
args: { "aria-label": "Toggle navigation", size: "lg", opened: true },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Disabled: Story = {
|
|
44
|
+
args: { "aria-label": "Toggle navigation", disabled: true },
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function RealisticUseDemo() {
|
|
48
|
+
const [opened, setOpened] = React.useState(false);
|
|
49
|
+
return (
|
|
50
|
+
<div className="w-72 rounded-lg border border-border bg-background">
|
|
51
|
+
<header className="flex items-center justify-between border-b border-border p-2 pl-4">
|
|
52
|
+
<span className="text-sm font-semibold">BADS Docs</span>
|
|
53
|
+
<Burger
|
|
54
|
+
opened={opened}
|
|
55
|
+
onClick={() => setOpened((v) => !v)}
|
|
56
|
+
aria-label="Toggle navigation"
|
|
57
|
+
aria-controls="storybook-burger-nav"
|
|
58
|
+
/>
|
|
59
|
+
</header>
|
|
60
|
+
<nav
|
|
61
|
+
id="storybook-burger-nav"
|
|
62
|
+
aria-label="Main"
|
|
63
|
+
hidden={!opened}
|
|
64
|
+
className="p-4"
|
|
65
|
+
>
|
|
66
|
+
<ul className="space-y-2 text-sm text-muted-foreground">
|
|
67
|
+
<li>Getting started</li>
|
|
68
|
+
<li>Tokens</li>
|
|
69
|
+
<li>Components</li>
|
|
70
|
+
<li>Accessibility</li>
|
|
71
|
+
</ul>
|
|
72
|
+
</nav>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const RealisticUse: Story = {
|
|
78
|
+
render: () => <RealisticUseDemo />,
|
|
79
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Motion: base transition narrowed transition-all → transition-colors (Vercel/Rauno "list only the properties you animate" + BADS microanimation rule). Focus ring now appears instantly rather than fading — strictly better for a11y.
|
|
1
2
|
import { Meta, StoryObj } from "@storybook/react"
|
|
2
3
|
import { userEvent, within, expect, fn } from "storybook/test"
|
|
3
4
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
@@ -84,6 +85,69 @@ export const Disabled: Story = {
|
|
|
84
85
|
},
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
export const Loading: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
loading: true,
|
|
91
|
+
children: "Saving",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Loading_Variants: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
98
|
+
<Button loading>Saving</Button>
|
|
99
|
+
<Button loading variant="secondary">
|
|
100
|
+
Saving
|
|
101
|
+
</Button>
|
|
102
|
+
<Button loading variant="outline">
|
|
103
|
+
Saving
|
|
104
|
+
</Button>
|
|
105
|
+
<Button loading variant="destructive">
|
|
106
|
+
Deleting
|
|
107
|
+
</Button>
|
|
108
|
+
<Button loading size="xl">
|
|
109
|
+
Publishing
|
|
110
|
+
</Button>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// asChild forwards Button's styling to a single slotted element (e.g. an <a>
|
|
116
|
+
// used as a link-button). Slot calls React.Children.only, so Button must pass
|
|
117
|
+
// exactly one child through — regression guard: the loading-prop refactor once
|
|
118
|
+
// emitted a `[null, children]` array here that threw at prerender and broke the
|
|
119
|
+
// production deploy. Rendered in every showcase shell header via asChild.
|
|
120
|
+
export const AsChild: Story = {
|
|
121
|
+
render: () => (
|
|
122
|
+
<Button asChild variant="outline">
|
|
123
|
+
<a href="#docs">Read the docs</a>
|
|
124
|
+
</Button>
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// A loading button must announce aria-busy and refuse re-fire (disabled), so a
|
|
129
|
+
// double-click can't submit twice while the request is in flight.
|
|
130
|
+
export const Interaction_LoadingBlocksClick: Story = {
|
|
131
|
+
tags: ["test"],
|
|
132
|
+
args: {
|
|
133
|
+
loading: true,
|
|
134
|
+
children: "Saving",
|
|
135
|
+
onClick: fn(),
|
|
136
|
+
},
|
|
137
|
+
play: async ({ canvasElement, args }) => {
|
|
138
|
+
const canvas = within(canvasElement);
|
|
139
|
+
const button = canvas.getByRole("button", { name: /saving/i });
|
|
140
|
+
// A loading button is disabled + aria-busy, and disabled:pointer-events-none
|
|
141
|
+
// means a real pointer can't even reach it — asserting those attributes is
|
|
142
|
+
// the complete guarantee that onClick can't fire (a native disabled button
|
|
143
|
+
// can't dispatch click). Attempting userEvent.click here would fail on the
|
|
144
|
+
// pointer-events:none element rather than exercise the guard.
|
|
145
|
+
expect(button).toHaveAttribute("aria-busy", "true");
|
|
146
|
+
expect(button).toBeDisabled();
|
|
147
|
+
expect(args.onClick).not.toHaveBeenCalled();
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
87
151
|
export const Icon_XS: Story = {
|
|
88
152
|
args: {
|
|
89
153
|
size: "icon-xs",
|
|
@@ -140,6 +204,44 @@ export const Interaction_Click: Story = {
|
|
|
140
204
|
},
|
|
141
205
|
};
|
|
142
206
|
|
|
207
|
+
// aria-disabled pattern: `disabledReason` keeps the button focusable so a
|
|
208
|
+
// keyboard / screen-reader user can reach it and hear WHY it's unavailable —
|
|
209
|
+
// a natively-disabled button drops out of the tab order and its reason is
|
|
210
|
+
// undiscoverable. Prefer this on form-gating buttons.
|
|
211
|
+
export const Disabled_WithReason: Story = {
|
|
212
|
+
args: {
|
|
213
|
+
disabledReason: "Enter your email before saving",
|
|
214
|
+
children: "Save",
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// Verifies the aria-disabled contract: focusable (NOT native [disabled]),
|
|
219
|
+
// aria-disabled=true, activation blocked (onClick never fires), and the reason
|
|
220
|
+
// wired via aria-describedby to an sr-only sibling that is NOT part of the name.
|
|
221
|
+
export const Interaction_DisabledReason: Story = {
|
|
222
|
+
tags: ["test"],
|
|
223
|
+
args: {
|
|
224
|
+
disabledReason: "Enter your email before saving",
|
|
225
|
+
children: "Save",
|
|
226
|
+
onClick: fn(),
|
|
227
|
+
},
|
|
228
|
+
play: async ({ canvasElement, args }) => {
|
|
229
|
+
const canvas = within(canvasElement);
|
|
230
|
+
// Accessible name is just the label — the reason is description-only.
|
|
231
|
+
const button = canvas.getByRole("button", { name: "Save" });
|
|
232
|
+
expect(button).toHaveAttribute("aria-disabled", "true");
|
|
233
|
+
expect(button).not.toBeDisabled(); // stays focusable
|
|
234
|
+
button.focus();
|
|
235
|
+
expect(button).toHaveFocus();
|
|
236
|
+
await userEvent.click(button);
|
|
237
|
+
expect(args.onClick).not.toHaveBeenCalled(); // activation blocked
|
|
238
|
+
const describedby = button.getAttribute("aria-describedby");
|
|
239
|
+
expect(describedby).toBeTruthy();
|
|
240
|
+
const reason = document.getElementById(describedby!.split(" ").pop()!);
|
|
241
|
+
expect(reason).toHaveTextContent("Enter your email before saving");
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
|
|
143
245
|
export const AllSizes: Story = {
|
|
144
246
|
render: () => (
|
|
145
247
|
<div className="flex flex-wrap items-center gap-3">
|
|
@@ -155,5 +257,4 @@ export const AllSizes: Story = {
|
|
|
155
257
|
</Button>
|
|
156
258
|
</div>
|
|
157
259
|
),
|
|
158
|
-
};
|
|
159
|
-
|
|
260
|
+
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// `allow-font-normal-small` escape hatch in calendar.tsx). A font-medium bump to
|
|
3
3
|
// satisfy the SADS-1 weight floor is a deferred design decision on this shared
|
|
4
4
|
// primitive, not a mechanical fix.
|
|
5
|
+
//
|
|
6
|
+
// react-day-picker v10: the grid element's classNames key is `month_grid`
|
|
7
|
+
// (v10 renamed the old `table` key). The migration left `table`, which type-
|
|
8
|
+
// checked under nothing and broke `next build`; fixed in calendar.tsx.
|
|
5
9
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
10
|
import { useState } from "react";
|
|
7
11
|
import { Calendar } from "@behavioral-agentic-design-system/core/components/ui/calendar";
|
|
@@ -27,6 +27,36 @@ export const Default: Story = {
|
|
|
27
27
|
</Card>),
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export const Variant_Default: Story = {
|
|
31
|
+
render: () => (<Card variant="default" className="w-[360px]">
|
|
32
|
+
<CardHeader>
|
|
33
|
+
<CardTitle>Total Revenue</CardTitle>
|
|
34
|
+
<CardDescription>+20.1% from last month</CardDescription>
|
|
35
|
+
</CardHeader>
|
|
36
|
+
<CardContent>
|
|
37
|
+
<p className="text-3xl font-semibold tabular-nums">$15,231.89</p>
|
|
38
|
+
</CardContent>
|
|
39
|
+
<CardFooter>
|
|
40
|
+
<Button size="sm">View report</Button>
|
|
41
|
+
</CardFooter>
|
|
42
|
+
</Card>),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Variant_Elevated: Story = {
|
|
46
|
+
render: () => (<Card variant="elevated" className="w-[360px]">
|
|
47
|
+
<CardHeader>
|
|
48
|
+
<CardTitle>Total Revenue</CardTitle>
|
|
49
|
+
<CardDescription>+20.1% from last month</CardDescription>
|
|
50
|
+
</CardHeader>
|
|
51
|
+
<CardContent>
|
|
52
|
+
<p className="text-3xl font-semibold tabular-nums">$15,231.89</p>
|
|
53
|
+
</CardContent>
|
|
54
|
+
<CardFooter>
|
|
55
|
+
<Button size="sm">View report</Button>
|
|
56
|
+
</CardFooter>
|
|
57
|
+
</Card>),
|
|
58
|
+
};
|
|
59
|
+
|
|
30
60
|
export const RealisticUse: Story = {
|
|
31
61
|
render: () => (<Card className="w-[360px]">
|
|
32
62
|
<CardHeader>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// A11y: indicator dots changed from role=tab/tablist/aria-selected (a tab controlling no tabpanel — an ARIA anti-pattern) to plain buttons + aria-current on the active slide, per the APG carousel dot pattern.
|
|
1
2
|
// scrollbar-none (Tailwind v4.3 utility) replaces [scrollbar-width:none] [&::-webkit-scrollbar]:hidden
|
|
2
3
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
4
|
import {
|
|
@@ -230,4 +231,4 @@ export const RealisticUse: Story = {
|
|
|
230
231
|
</Carousel>
|
|
231
232
|
</div>
|
|
232
233
|
),
|
|
233
|
-
};
|
|
234
|
+
};
|