@behavioral-agentic-design-system/core 0.39.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +26 -5
- package/scripts/a11y-lint.cjs +88 -8
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +133 -12
- package/scripts/check-stories.mjs +1 -1
- package/scripts/health-report.mjs +16 -2
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/lint-slop.mjs +25 -1
- package/scripts/size-audit.cjs +79 -0
- package/scripts/source-of-truth.cjs +58 -0
- package/scripts/ux-smoke.mjs +438 -0
- package/scripts/wcag-audit.cjs +121 -6
- package/src/api/layers/file.ts +1 -0
- package/src/app/opengraph-image.tsx +5 -0
- package/src/app/preview/components/page.tsx +2237 -2
- package/src/app/shell.tsx +17 -16
- package/src/components/Foundations/Motion.stories.tsx +1 -0
- package/src/components/customize/brand-mark-section.tsx +4 -2
- package/src/components/customize/design-controls.tsx +17 -2
- package/src/components/customize/discipline-section.tsx +3 -6
- package/src/components/customize/font-pickers.tsx +1 -1
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/save-bar.tsx +2 -2
- package/src/components/customize/theme-io.tsx +7 -7
- package/src/components/customize/type-scale.tsx +1 -1
- package/src/components/customize-tab.tsx +7 -4
- package/src/components/home-tab.tsx +3 -0
- package/src/components/studio/studio.tsx +153 -0
- package/src/components/ui/accordion.tsx +7 -0
- package/src/components/ui/alert.tsx +1 -0
- package/src/components/ui/anchor.tsx +37 -3
- package/src/components/ui/announcement-bar.tsx +256 -0
- package/src/components/ui/attachment.tsx +211 -0
- package/src/components/ui/badge.tsx +1 -0
- package/src/components/ui/callout.tsx +218 -0
- package/src/components/ui/chart.tsx +5 -14
- package/src/components/ui/code.tsx +1 -1
- package/src/components/ui/color-picker.tsx +2 -2
- package/src/components/ui/format-relative-time.tsx +139 -0
- package/src/components/ui/gauge-chart.tsx +238 -0
- package/src/components/ui/grid.tsx +255 -0
- package/src/components/ui/heatmap.tsx +256 -0
- package/src/components/ui/icon.tsx +108 -0
- package/src/components/ui/index.ts +17 -0
- package/src/components/ui/infinite-scroll.tsx +103 -0
- package/src/components/ui/json-input.tsx +351 -0
- package/src/components/ui/navigation-progress.tsx +281 -0
- package/src/components/ui/number-input.tsx +1 -4
- package/src/components/ui/page-header.tsx +63 -0
- package/src/components/ui/password-input.tsx +2 -1
- package/src/components/ui/password-strength-input.tsx +288 -0
- package/src/components/ui/pill.tsx +140 -0
- package/src/components/ui/popover.tsx +27 -4
- package/src/components/ui/portal.tsx +111 -0
- package/src/components/ui/presence.tsx +172 -0
- package/src/components/ui/progress-stack.tsx +258 -0
- package/src/components/ui/scroll-progress.tsx +100 -0
- package/src/components/ui/select.tsx +89 -4
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/slider.tsx +83 -3
- package/src/components/ui/snackbar.tsx +393 -0
- package/src/components/ui/sortable-list.tsx +342 -0
- package/src/components/ui/sparkline.tsx +2 -14
- package/src/components/ui/squircle.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/textarea.tsx +28 -1
- package/src/components/ui/tour.tsx +1 -3
- package/src/data/docs-index.ts +25 -0
- package/src/hooks/use-reduced-motion.ts +6 -0
- package/src/lib/clamp.ts +2 -0
- package/src/stories/Accordion.stories.tsx +59 -0
- package/src/stories/Alert.stories.tsx +3 -1
- package/src/stories/Anchor.stories.tsx +54 -0
- package/src/stories/AnnouncementBar.stories.tsx +261 -0
- package/src/stories/Attachment.stories.tsx +189 -0
- package/src/stories/Badge.stories.tsx +3 -0
- package/src/stories/Calendar.stories.tsx +1 -1
- package/src/stories/Callout.stories.tsx +219 -0
- package/src/stories/Chart.stories.tsx +8 -0
- package/src/stories/Code.stories.tsx +1 -0
- package/src/stories/ColorPicker.stories.tsx +24 -0
- package/src/stories/FormatRelativeTime.stories.tsx +116 -0
- package/src/stories/GaugeChart.stories.tsx +163 -0
- package/src/stories/Grid.stories.tsx +197 -0
- package/src/stories/Heatmap.stories.tsx +172 -0
- package/src/stories/Icon.stories.tsx +175 -0
- package/src/stories/InfiniteScroll.stories.tsx +225 -0
- package/src/stories/JsonInput.stories.tsx +212 -0
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/NavigationProgress.stories.tsx +159 -0
- package/src/stories/NumberInput.stories.tsx +1 -0
- package/src/stories/PageHeader.stories.tsx +102 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
- package/src/stories/Pill.stories.tsx +201 -0
- package/src/stories/Popover.stories.tsx +29 -1
- package/src/stories/Portal.stories.tsx +191 -0
- package/src/stories/Presence.stories.tsx +228 -0
- package/src/stories/ProgressStack.stories.tsx +287 -0
- package/src/stories/ScrollProgress.stories.tsx +117 -0
- package/src/stories/Select.stories.tsx +25 -0
- package/src/stories/Separator.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Snackbar.stories.tsx +315 -0
- package/src/stories/SortableList.stories.tsx +263 -0
- package/src/stories/Sparkline.stories.tsx +3 -0
- package/src/stories/Squircle.stories.tsx +1 -0
- package/src/stories/Table.stories.tsx +1 -0
- package/src/stories/Textarea.stories.tsx +18 -0
- package/src/stories/Tour.stories.tsx +1 -0
- package/src/stories/story-groups.json +26 -6
- package/src/styles.css +133 -12
- package/LICENSE +0 -21
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { PageHeader } from "@behavioral-agentic-design-system/core/components/ui/page-header"
|
|
3
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof PageHeader> = {
|
|
6
|
+
title: "Components/Layout/PageHeader",
|
|
7
|
+
component: PageHeader,
|
|
8
|
+
parameters: { layout: "padded" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
}
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
title: "Workspace settings",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const WithDescription: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
title: "Workspace settings",
|
|
23
|
+
description: "Manage your workspace preferences, integrations, and team access.",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const WithEyebrow: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
eyebrow: "Account",
|
|
30
|
+
title: "Billing & plans",
|
|
31
|
+
description: "Manage your subscription and payment methods.",
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const WithAction: Story = {
|
|
36
|
+
parameters: { controls: { disable: true } },
|
|
37
|
+
render: () => (
|
|
38
|
+
<PageHeader
|
|
39
|
+
title="Team members"
|
|
40
|
+
description="Invite people and manage their roles."
|
|
41
|
+
action={<Button size="xl">Invite member</Button>}
|
|
42
|
+
/>
|
|
43
|
+
),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const WithEyebrowAndAction: Story = {
|
|
47
|
+
parameters: { controls: { disable: true } },
|
|
48
|
+
render: () => (
|
|
49
|
+
<PageHeader
|
|
50
|
+
eyebrow="Projects"
|
|
51
|
+
title="Meridian rebrand"
|
|
52
|
+
description="Brand identity, design tokens, and component library for Meridian Financial."
|
|
53
|
+
action={
|
|
54
|
+
<>
|
|
55
|
+
<Button variant="outline" size="lg">Export</Button>
|
|
56
|
+
<Button size="xl">New component</Button>
|
|
57
|
+
</>
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Bordered: Story = {
|
|
64
|
+
parameters: { controls: { disable: true } },
|
|
65
|
+
render: () => (
|
|
66
|
+
<div>
|
|
67
|
+
<PageHeader
|
|
68
|
+
title="Notifications"
|
|
69
|
+
description="Choose what you want to be notified about."
|
|
70
|
+
bordered
|
|
71
|
+
/>
|
|
72
|
+
<p className="mt-6 text-sm text-muted-foreground">Content below the border…</p>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const RealisticUse: Story = {
|
|
78
|
+
parameters: { controls: { disable: true } },
|
|
79
|
+
render: () => (
|
|
80
|
+
<div className="w-full max-w-3xl space-y-6">
|
|
81
|
+
<PageHeader
|
|
82
|
+
eyebrow="Design system"
|
|
83
|
+
title="Component library"
|
|
84
|
+
description="149 primitives and compositions ready for your next client engagement. All WCAG AAA."
|
|
85
|
+
bordered
|
|
86
|
+
action={
|
|
87
|
+
<>
|
|
88
|
+
<Button variant="outline" size="lg">Import tokens</Button>
|
|
89
|
+
<Button size="xl">Add component</Button>
|
|
90
|
+
</>
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
<div className="space-y-3">
|
|
94
|
+
{["Button", "Combobox", "MultiSelect"].map((name) => (
|
|
95
|
+
<div key={name} className="rounded-md border border-border p-4 text-sm text-foreground">
|
|
96
|
+
{name}
|
|
97
|
+
</div>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
),
|
|
102
|
+
}
|
|
@@ -12,6 +12,10 @@ const meta: Meta<typeof PasswordInput> = {
|
|
|
12
12
|
export default meta;
|
|
13
13
|
type Story = StoryObj<typeof PasswordInput>;
|
|
14
14
|
|
|
15
|
+
// Tab to the show/hide toggle button and confirm it paints the standard
|
|
16
|
+
// focus-visible ring (ring-ring/50) rather than falling back to the UA
|
|
17
|
+
// default outline — see corrections.md and ledgers/ux-tests.jsonl
|
|
18
|
+
// (PasswordInput, 2026-07-14, resolved 2026-10-05).
|
|
15
19
|
export const Default: Story = {};
|
|
16
20
|
|
|
17
21
|
export const Size_Sm: Story = {
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { PasswordStrengthInput } from "@behavioral-agentic-design-system/core/components/ui/password-strength-input"
|
|
4
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label"
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof PasswordStrengthInput> = {
|
|
8
|
+
title: "Components/Forms/PasswordStrengthInput",
|
|
9
|
+
component: PasswordStrengthInput,
|
|
10
|
+
parameters: { layout: "centered" },
|
|
11
|
+
args: {
|
|
12
|
+
placeholder: "New password",
|
|
13
|
+
autoComplete: "new-password",
|
|
14
|
+
style: { width: 320 },
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof PasswordStrengthInput>
|
|
20
|
+
|
|
21
|
+
// ─── Basic states ─────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {}
|
|
24
|
+
|
|
25
|
+
export const ShowHints: Story = {
|
|
26
|
+
args: { showHints: true },
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const HideLabel: Story = {
|
|
30
|
+
args: { showLabel: false },
|
|
31
|
+
name: "Variant_HideLabel",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Segments_3: Story = {
|
|
35
|
+
name: "Variant_Segments3",
|
|
36
|
+
args: { segments: 3 },
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Segments_5: Story = {
|
|
40
|
+
name: "Variant_Segments5",
|
|
41
|
+
args: { segments: 5 },
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ─── Sizes ────────────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export const Size_Sm: Story = {
|
|
47
|
+
args: { size: "sm" },
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Size_Lg: Story = {
|
|
51
|
+
args: { size: "lg" },
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Size_Xl: Story = {
|
|
55
|
+
args: { size: "xl" },
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ─── Disabled ─────────────────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
export const Disabled: Story = {
|
|
61
|
+
args: { disabled: true },
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ─── Strength levels (controlled) ────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
/** Demonstrates the four filled visual states without user interaction. */
|
|
67
|
+
export const Variant_StrengthWeak: Story = {
|
|
68
|
+
name: "Variant_StrengthWeak",
|
|
69
|
+
args: { value: "pass", onChange: () => {} },
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Variant_StrengthFair: Story = {
|
|
73
|
+
name: "Variant_StrengthFair",
|
|
74
|
+
args: { value: "password1", onChange: () => {} },
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Variant_StrengthGood: Story = {
|
|
78
|
+
name: "Variant_StrengthGood",
|
|
79
|
+
args: { value: "Password123", onChange: () => {} },
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const Variant_StrengthStrong: Story = {
|
|
83
|
+
name: "Variant_StrengthStrong",
|
|
84
|
+
args: { value: "P@ssword123!!", onChange: () => {} },
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ─── Realistic use: signup form ───────────────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A signup form using real names from the BADS content pool.
|
|
91
|
+
* Demonstrates controlled usage with form submission.
|
|
92
|
+
*/
|
|
93
|
+
export const RealisticUse: Story = {
|
|
94
|
+
parameters: { controls: { disable: true } },
|
|
95
|
+
render: () => {
|
|
96
|
+
function SignupForm() {
|
|
97
|
+
const [password, setPassword] = React.useState("")
|
|
98
|
+
const [submitted, setSubmitted] = React.useState(false)
|
|
99
|
+
|
|
100
|
+
return submitted ? (
|
|
101
|
+
<div className="flex w-80 flex-col gap-3 rounded-lg border border-border bg-card p-5">
|
|
102
|
+
<p className="text-sm text-muted-foreground">
|
|
103
|
+
Welcome, Jordan — your account is ready.
|
|
104
|
+
</p>
|
|
105
|
+
<Button
|
|
106
|
+
size="sm"
|
|
107
|
+
variant="outline"
|
|
108
|
+
onClick={() => {
|
|
109
|
+
setPassword("")
|
|
110
|
+
setSubmitted(false)
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
Start over
|
|
114
|
+
</Button>
|
|
115
|
+
</div>
|
|
116
|
+
) : (
|
|
117
|
+
<form
|
|
118
|
+
className="flex w-80 flex-col gap-4 rounded-lg border border-border bg-card p-5"
|
|
119
|
+
onSubmit={(e) => {
|
|
120
|
+
e.preventDefault()
|
|
121
|
+
if (password.length >= 6) setSubmitted(true)
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<div className="space-y-1">
|
|
125
|
+
<h2 className="text-base font-semibold">Create your account</h2>
|
|
126
|
+
<p className="text-sm text-muted-foreground">
|
|
127
|
+
Northwind Health — design system access
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div className="flex flex-col gap-1.5">
|
|
132
|
+
<Label htmlFor="signup-email">Email</Label>
|
|
133
|
+
<input
|
|
134
|
+
id="signup-email"
|
|
135
|
+
type="email"
|
|
136
|
+
defaultValue="jordan.reeves@northwindhealth.com"
|
|
137
|
+
readOnly
|
|
138
|
+
className="h-9 rounded-md border border-input bg-transparent px-3 text-sm opacity-60 cursor-not-allowed"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div className="flex flex-col gap-1.5">
|
|
143
|
+
<Label htmlFor="signup-password">Password</Label>
|
|
144
|
+
<PasswordStrengthInput
|
|
145
|
+
id="signup-password"
|
|
146
|
+
value={password}
|
|
147
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
148
|
+
placeholder="Create a strong password"
|
|
149
|
+
autoComplete="new-password"
|
|
150
|
+
showHints
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<Button
|
|
155
|
+
type="submit"
|
|
156
|
+
size="xl"
|
|
157
|
+
className="w-full"
|
|
158
|
+
disabled={password.length < 6}
|
|
159
|
+
>
|
|
160
|
+
Create account
|
|
161
|
+
</Button>
|
|
162
|
+
</form>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
return <SignupForm />
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ─── Custom strength function ─────────────────────────────────────────────────
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Demonstrates a custom strengthFn that enforces strict rules
|
|
173
|
+
* (e.g., minimum 10 chars + special char required for "Strong").
|
|
174
|
+
*/
|
|
175
|
+
export const Variant_CustomStrengthFn: Story = {
|
|
176
|
+
name: "Variant_CustomStrengthFn",
|
|
177
|
+
parameters: { controls: { disable: true } },
|
|
178
|
+
render: () => {
|
|
179
|
+
function StrictForm() {
|
|
180
|
+
const [pw, setPw] = React.useState("")
|
|
181
|
+
|
|
182
|
+
function strictStrengthFn(value: string): 0 | 1 | 2 | 3 | 4 {
|
|
183
|
+
if (!value.length) return 0
|
|
184
|
+
let score = 0
|
|
185
|
+
if (value.length >= 10) score++
|
|
186
|
+
if (value.length >= 16) score++
|
|
187
|
+
if (/[A-Z]/.test(value) && /[a-z]/.test(value)) score++
|
|
188
|
+
if (/[0-9]/.test(value) && /[^A-Za-z0-9]/.test(value)) score++
|
|
189
|
+
return Math.min(4, Math.max(1, score)) as 0 | 1 | 2 | 3 | 4
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<div className="flex w-80 flex-col gap-3">
|
|
194
|
+
<p className="text-sm text-muted-foreground">
|
|
195
|
+
Strict scorer — requires ≥10 chars + symbol + mixed case for
|
|
196
|
+
"Strong."
|
|
197
|
+
</p>
|
|
198
|
+
<PasswordStrengthInput
|
|
199
|
+
value={pw}
|
|
200
|
+
onChange={(e) => setPw(e.target.value)}
|
|
201
|
+
placeholder="API key passphrase"
|
|
202
|
+
strengthFn={strictStrengthFn}
|
|
203
|
+
segments={5}
|
|
204
|
+
showHints
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
return <StrictForm />
|
|
210
|
+
},
|
|
211
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Pill, PillGroup } from "@behavioral-agentic-design-system/core/components/ui/pill";
|
|
3
|
+
import { Avatar, AvatarFallback } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
4
|
+
import { GitBranch, Globe, Lock, Palette } from "lucide-react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Pill> = {
|
|
7
|
+
title: "Components/Badges and avatars/Pill",
|
|
8
|
+
component: Pill,
|
|
9
|
+
parameters: { layout: "centered" },
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: { control: "select", options: ["default", "outline", "muted"] },
|
|
13
|
+
size: { control: "select", options: ["sm", "md", "lg"] },
|
|
14
|
+
disabled: { control: "boolean" },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
// Labels come from content/personas/bads.json → primary.jargon / names / orgs
|
|
22
|
+
// (the real-content rule — no placeholder strings). Pill takes its text as
|
|
23
|
+
// children, unlike Tag's `label` prop.
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: { children: "design tokens" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Variant and size stories spread args into every pill in the row, so the
|
|
29
|
+
// Controls panel re-themes the whole group while the three labels stay fixed.
|
|
30
|
+
const jargonRow = (args: Story["args"]) => (
|
|
31
|
+
<PillGroup>
|
|
32
|
+
<Pill {...args}>design tokens</Pill>
|
|
33
|
+
<Pill {...args}>semantic layer</Pill>
|
|
34
|
+
<Pill {...args}>a11y contract</Pill>
|
|
35
|
+
</PillGroup>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const Variant_Default: Story = {
|
|
39
|
+
args: { variant: "default" },
|
|
40
|
+
render: (args) => jargonRow(args),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Variant_Outline: Story = {
|
|
44
|
+
args: { variant: "outline" },
|
|
45
|
+
render: (args) => jargonRow(args),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Variant_Muted: Story = {
|
|
49
|
+
args: { variant: "muted" },
|
|
50
|
+
render: (args) => jargonRow(args),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// One of each variant at the given size. sm is the default: 14px text (BADS
|
|
54
|
+
// text-xs), the dense-metadata register.
|
|
55
|
+
const variantRow = (args: Story["args"]) => (
|
|
56
|
+
<PillGroup>
|
|
57
|
+
<Pill {...args}>design tokens</Pill>
|
|
58
|
+
<Pill {...args} variant="outline">semantic layer</Pill>
|
|
59
|
+
<Pill {...args} variant="muted">a11y contract</Pill>
|
|
60
|
+
</PillGroup>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export const Size_SM: Story = {
|
|
64
|
+
args: { size: "sm" },
|
|
65
|
+
render: (args) => variantRow(args),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Size_MD: Story = {
|
|
69
|
+
args: { size: "md" },
|
|
70
|
+
render: (args) => variantRow(args),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const Size_LG: Story = {
|
|
74
|
+
args: { size: "lg" },
|
|
75
|
+
render: (args) => variantRow(args),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Presentational only — Pill has no interactive state to disable. The dim
|
|
79
|
+
// mirrors a disabled owning control (an archived row, a locked fieldset);
|
|
80
|
+
// that control carries the disabled semantics for assistive tech.
|
|
81
|
+
export const Disabled: Story = {
|
|
82
|
+
args: { disabled: true },
|
|
83
|
+
render: (args) => variantRow(args),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Leading icon slot: Lucide at strokeWidth 1.5, sized per pill size
|
|
87
|
+
// (size-3 at sm, size-3.5 at md, size-4 at lg). Fixed demo — three pills at
|
|
88
|
+
// three sizes, so there is nothing for the Controls panel to drive.
|
|
89
|
+
export const WithIcon: Story = {
|
|
90
|
+
parameters: { controls: { disable: true } },
|
|
91
|
+
render: () => (
|
|
92
|
+
<PillGroup>
|
|
93
|
+
<Pill icon={<GitBranch strokeWidth={1.5} />}>main</Pill>
|
|
94
|
+
<Pill size="md" variant="outline" icon={<Globe strokeWidth={1.5} />}>
|
|
95
|
+
design.bads.com
|
|
96
|
+
</Pill>
|
|
97
|
+
<Pill size="lg" variant="muted" icon={<Lock strokeWidth={1.5} />}>
|
|
98
|
+
private
|
|
99
|
+
</Pill>
|
|
100
|
+
</PillGroup>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// An owner pill: the icon slot takes a 20px Avatar (size="xs") and the pill
|
|
105
|
+
// drops its left padding so the avatar sits flush, Mantine-style. lg gives
|
|
106
|
+
// the avatar room; at sm the avatar would be taller than the text line.
|
|
107
|
+
export const WithAvatar: Story = {
|
|
108
|
+
parameters: { controls: { disable: true } },
|
|
109
|
+
render: () => (
|
|
110
|
+
<PillGroup>
|
|
111
|
+
<Pill
|
|
112
|
+
size="lg"
|
|
113
|
+
className="pl-1"
|
|
114
|
+
icon={
|
|
115
|
+
<Avatar size="xs">
|
|
116
|
+
<AvatarFallback className="text-xs">JR</AvatarFallback>
|
|
117
|
+
</Avatar>
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
Jordan Reeves
|
|
121
|
+
</Pill>
|
|
122
|
+
<Pill
|
|
123
|
+
size="lg"
|
|
124
|
+
variant="outline"
|
|
125
|
+
className="pl-1"
|
|
126
|
+
icon={
|
|
127
|
+
<Avatar size="xs">
|
|
128
|
+
<AvatarFallback className="text-xs">SP</AvatarFallback>
|
|
129
|
+
</Avatar>
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
Seo-yun Park
|
|
133
|
+
</Pill>
|
|
134
|
+
</PillGroup>
|
|
135
|
+
),
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Long-label contract: the pill truncates inside a narrow parent instead of
|
|
139
|
+
// bleeding sideways. The full value stays recoverable via `title`.
|
|
140
|
+
export const LongLabel: Story = {
|
|
141
|
+
parameters: { controls: { disable: true } },
|
|
142
|
+
render: () => (
|
|
143
|
+
<div className="w-56 rounded-lg border p-3">
|
|
144
|
+
<PillGroup>
|
|
145
|
+
<Pill title="Wilhelmina-Constance Featherstonehaugh-Vance">
|
|
146
|
+
Wilhelmina-Constance Featherstonehaugh-Vance
|
|
147
|
+
</Pill>
|
|
148
|
+
<Pill variant="outline" title="antidisestablishmentarianismphilosophical-test">
|
|
149
|
+
antidisestablishmentarianismphilosophical-test
|
|
150
|
+
</Pill>
|
|
151
|
+
<Pill variant="muted">李雪芹</Pill>
|
|
152
|
+
</PillGroup>
|
|
153
|
+
</div>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Metadata row on a component-registry card: taxonomy pills, an owner pill,
|
|
158
|
+
// a count pill. Nothing here is a status (Badge), nothing is removable (Tag),
|
|
159
|
+
// nothing toggles (Chip).
|
|
160
|
+
export const RealisticUse: Story = {
|
|
161
|
+
parameters: { controls: { disable: true } },
|
|
162
|
+
render: () => (
|
|
163
|
+
<div className="w-[360px] space-y-3 rounded-lg border p-4">
|
|
164
|
+
<div className="flex items-start justify-between gap-3">
|
|
165
|
+
<div className="min-w-0">
|
|
166
|
+
<p className="text-base font-semibold">Button</p>
|
|
167
|
+
<p className="text-sm text-muted-foreground">
|
|
168
|
+
Northwind Health · updated 2026-05-26
|
|
169
|
+
</p>
|
|
170
|
+
</div>
|
|
171
|
+
<Pill variant="outline" icon={<Palette strokeWidth={1.5} />}>
|
|
172
|
+
36 components
|
|
173
|
+
</Pill>
|
|
174
|
+
</div>
|
|
175
|
+
<PillGroup aria-label="Topics">
|
|
176
|
+
<Pill>design tokens</Pill>
|
|
177
|
+
<Pill>a11y contract</Pill>
|
|
178
|
+
<Pill>CVA variants</Pill>
|
|
179
|
+
<Pill variant="muted">7:1 contrast</Pill>
|
|
180
|
+
<Pill variant="muted">44×44px target</Pill>
|
|
181
|
+
</PillGroup>
|
|
182
|
+
<div className="flex items-center justify-between gap-3 border-t pt-3">
|
|
183
|
+
<Pill
|
|
184
|
+
size="md"
|
|
185
|
+
variant="outline"
|
|
186
|
+
className="pl-1"
|
|
187
|
+
icon={
|
|
188
|
+
<Avatar size="xs">
|
|
189
|
+
<AvatarFallback className="text-xs">JR</AvatarFallback>
|
|
190
|
+
</Avatar>
|
|
191
|
+
}
|
|
192
|
+
>
|
|
193
|
+
jordan.reeves
|
|
194
|
+
</Pill>
|
|
195
|
+
<Pill size="md" variant="muted" icon={<GitBranch strokeWidth={1.5} />}>
|
|
196
|
+
main
|
|
197
|
+
</Pill>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
),
|
|
201
|
+
};
|
|
@@ -27,11 +27,39 @@ export const Default: Story = {
|
|
|
27
27
|
</Popover>),
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export const Variant_WithArrow: Story = {
|
|
31
|
+
name: "Variant — with arrow",
|
|
32
|
+
parameters: { controls: { disable: true } },
|
|
33
|
+
render: () => (
|
|
34
|
+
<div className="flex gap-6 items-start pt-12">
|
|
35
|
+
<Popover>
|
|
36
|
+
<PopoverTrigger asChild><Button variant="outline" size="sm">Below</Button></PopoverTrigger>
|
|
37
|
+
<PopoverContent showArrow className="w-56">
|
|
38
|
+
<p className="text-sm">Arrow points up at the trigger.</p>
|
|
39
|
+
</PopoverContent>
|
|
40
|
+
</Popover>
|
|
41
|
+
<Popover>
|
|
42
|
+
<PopoverTrigger asChild><Button variant="outline" size="sm">Start-aligned</Button></PopoverTrigger>
|
|
43
|
+
<PopoverContent showArrow align="start" className="w-56">
|
|
44
|
+
<p className="text-sm">Arrow tracks to the start side of the panel.</p>
|
|
45
|
+
</PopoverContent>
|
|
46
|
+
</Popover>
|
|
47
|
+
<Popover>
|
|
48
|
+
<PopoverTrigger asChild><Button variant="outline" size="sm">End-aligned</Button></PopoverTrigger>
|
|
49
|
+
<PopoverContent showArrow align="end" className="w-56">
|
|
50
|
+
<p className="text-sm">Arrow tracks to the end side of the panel.</p>
|
|
51
|
+
</PopoverContent>
|
|
52
|
+
</Popover>
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
30
57
|
export const RealisticUse: Story = {
|
|
31
58
|
render: () => (<Popover>
|
|
32
59
|
<PopoverTrigger asChild><Button variant="outline">Open popover</Button></PopoverTrigger>
|
|
33
|
-
<PopoverContent className="w-64">
|
|
60
|
+
<PopoverContent showArrow className="w-64">
|
|
34
61
|
<p className="text-sm">Place anything inside the popover — settings, filters, a small form.</p>
|
|
35
62
|
</PopoverContent>
|
|
36
63
|
</Popover>),
|
|
37
64
|
};
|
|
65
|
+
|