@behavioral-agentic-design-system/core 0.23.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 +8 -4
- package/scripts/build-tokens.cjs +79 -5
- package/src/app/preview/components/page.tsx +4760 -213
- 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/data-list.tsx +169 -0
- package/src/components/ui/date-picker.tsx +6 -3
- package/src/components/ui/date-range-picker.tsx +6 -3
- package/src/components/ui/fieldset.tsx +8 -2
- 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 +52 -0
- package/src/components/ui/indicator.tsx +2 -2
- package/src/components/ui/input-group.tsx +11 -1
- 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/qr-code.tsx +107 -0
- 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 +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/DataList.stories.tsx +160 -0
- 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/Fieldset.stories.tsx +4 -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/InputGroup.stories.tsx +39 -41
- 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/QrCode.stories.tsx +146 -0
- 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,308 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { FormatNumber } from "@behavioral-agentic-design-system/core/components/ui/format-number"
|
|
4
|
+
import {
|
|
5
|
+
DataList,
|
|
6
|
+
DataListItem,
|
|
7
|
+
DataListLabel,
|
|
8
|
+
DataListValue,
|
|
9
|
+
} from "@behavioral-agentic-design-system/core/components/ui/data-list"
|
|
10
|
+
import {
|
|
11
|
+
Card,
|
|
12
|
+
CardContent,
|
|
13
|
+
CardDescription,
|
|
14
|
+
CardHeader,
|
|
15
|
+
CardTitle,
|
|
16
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
17
|
+
|
|
18
|
+
const meta: Meta<typeof FormatNumber> = {
|
|
19
|
+
title: "Components/FormatNumber",
|
|
20
|
+
component: FormatNumber,
|
|
21
|
+
parameters: { layout: "centered" },
|
|
22
|
+
tags: ["autodocs"],
|
|
23
|
+
argTypes: {
|
|
24
|
+
value: { control: "number" },
|
|
25
|
+
locale: { control: "text" },
|
|
26
|
+
tabular: { control: "boolean" },
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default meta
|
|
31
|
+
type Story = StoryObj<typeof meta>
|
|
32
|
+
|
|
33
|
+
// All figures come from content/personas/bads.json → primary.metrics
|
|
34
|
+
// (real-content rule — the pool grew these values before this story used them).
|
|
35
|
+
//
|
|
36
|
+
// FormatNumber defaults to tabular figures (`tabular` defaults to true). Beyond
|
|
37
|
+
// column alignment, tabular figures dodge a rendering collision in the default
|
|
38
|
+
// Hyperlegible Sans face, whose proportional figures cramp/overlap decimals in
|
|
39
|
+
// Chromium. The Proportional story below shows the opt-out (and the cramping on
|
|
40
|
+
// Hyperlegible). Stories that pass `tabular` explicitly are just being explicit.
|
|
41
|
+
|
|
42
|
+
export const Default: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<p className="text-sm text-foreground">
|
|
45
|
+
Orphan-token lint scanned{" "}
|
|
46
|
+
<FormatNumber value={12417} className="font-medium" /> token references
|
|
47
|
+
this quarter.
|
|
48
|
+
</p>
|
|
49
|
+
),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Currency: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
55
|
+
<p>
|
|
56
|
+
Client savings to date:{" "}
|
|
57
|
+
<FormatNumber
|
|
58
|
+
value={182450}
|
|
59
|
+
style="currency"
|
|
60
|
+
currency="USD"
|
|
61
|
+
className="font-medium"
|
|
62
|
+
/>
|
|
63
|
+
</p>
|
|
64
|
+
<p>
|
|
65
|
+
A11y defect exposure avoided:{" "}
|
|
66
|
+
<FormatNumber
|
|
67
|
+
value={24500}
|
|
68
|
+
style="currency"
|
|
69
|
+
currency="USD"
|
|
70
|
+
className="font-medium"
|
|
71
|
+
/>
|
|
72
|
+
</p>
|
|
73
|
+
<p>
|
|
74
|
+
Credit issued:{" "}
|
|
75
|
+
<FormatNumber
|
|
76
|
+
value={-1249.5}
|
|
77
|
+
style="currency"
|
|
78
|
+
currency="USD"
|
|
79
|
+
className="font-medium text-destructive"
|
|
80
|
+
/>
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Percent: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
89
|
+
<p>
|
|
90
|
+
Story coverage:{" "}
|
|
91
|
+
<FormatNumber
|
|
92
|
+
value={0.984}
|
|
93
|
+
style="percent"
|
|
94
|
+
maximumFractionDigits={1}
|
|
95
|
+
className="font-medium"
|
|
96
|
+
/>
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
Quarterly churn delta:{" "}
|
|
100
|
+
<FormatNumber
|
|
101
|
+
value={-0.082}
|
|
102
|
+
style="percent"
|
|
103
|
+
maximumFractionDigits={1}
|
|
104
|
+
signDisplay="always"
|
|
105
|
+
className="font-medium"
|
|
106
|
+
/>
|
|
107
|
+
</p>
|
|
108
|
+
</div>
|
|
109
|
+
),
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const Unit: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
115
|
+
<p>
|
|
116
|
+
Build hours avoided:{" "}
|
|
117
|
+
<FormatNumber
|
|
118
|
+
value={1432}
|
|
119
|
+
style="unit"
|
|
120
|
+
unit="hour"
|
|
121
|
+
unitDisplay="long"
|
|
122
|
+
className="font-medium"
|
|
123
|
+
/>
|
|
124
|
+
</p>
|
|
125
|
+
<p>
|
|
126
|
+
Core bundle:{" "}
|
|
127
|
+
<FormatNumber
|
|
128
|
+
value={42.7}
|
|
129
|
+
style="unit"
|
|
130
|
+
unit="kilobyte"
|
|
131
|
+
className="font-medium"
|
|
132
|
+
/>
|
|
133
|
+
</p>
|
|
134
|
+
</div>
|
|
135
|
+
),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const Compact: Story = {
|
|
139
|
+
render: () => (
|
|
140
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
141
|
+
<p>
|
|
142
|
+
Token references scanned:{" "}
|
|
143
|
+
<FormatNumber
|
|
144
|
+
value={12417}
|
|
145
|
+
notation="compact"
|
|
146
|
+
className="font-medium"
|
|
147
|
+
/>
|
|
148
|
+
</p>
|
|
149
|
+
<p className="text-xs text-muted-foreground">
|
|
150
|
+
Compact output automatically carries the full-precision value on the
|
|
151
|
+
native title attribute — hover the number to recover “12,417”.
|
|
152
|
+
</p>
|
|
153
|
+
</div>
|
|
154
|
+
),
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const Locales: Story = {
|
|
158
|
+
render: () => (
|
|
159
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
160
|
+
<p>
|
|
161
|
+
en-US:{" "}
|
|
162
|
+
<FormatNumber
|
|
163
|
+
value={182450}
|
|
164
|
+
style="currency"
|
|
165
|
+
currency="USD"
|
|
166
|
+
className="font-medium"
|
|
167
|
+
/>
|
|
168
|
+
</p>
|
|
169
|
+
<p>
|
|
170
|
+
sv-SE:{" "}
|
|
171
|
+
<FormatNumber
|
|
172
|
+
value={182450}
|
|
173
|
+
locale="sv-SE"
|
|
174
|
+
style="currency"
|
|
175
|
+
currency="SEK"
|
|
176
|
+
className="font-medium"
|
|
177
|
+
/>
|
|
178
|
+
</p>
|
|
179
|
+
<p>
|
|
180
|
+
ko-KR:{" "}
|
|
181
|
+
<FormatNumber
|
|
182
|
+
value={182450}
|
|
183
|
+
locale="ko-KR"
|
|
184
|
+
style="currency"
|
|
185
|
+
currency="KRW"
|
|
186
|
+
className="font-medium"
|
|
187
|
+
/>
|
|
188
|
+
</p>
|
|
189
|
+
<p className="text-xs text-muted-foreground">
|
|
190
|
+
The default locale is an explicit “en-US” (never navigator.language),
|
|
191
|
+
so server and client render the same string — pass your i18n locale to
|
|
192
|
+
localize.
|
|
193
|
+
</p>
|
|
194
|
+
</div>
|
|
195
|
+
),
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const Tabular: Story = {
|
|
199
|
+
render: () => (
|
|
200
|
+
<div className="grid w-64 grid-cols-[1fr_auto] gap-x-6 gap-y-1 text-sm text-foreground">
|
|
201
|
+
<span className="text-muted-foreground">Client savings</span>
|
|
202
|
+
<FormatNumber
|
|
203
|
+
value={182450}
|
|
204
|
+
style="currency"
|
|
205
|
+
currency="USD"
|
|
206
|
+
tabular
|
|
207
|
+
className="text-right font-medium"
|
|
208
|
+
/>
|
|
209
|
+
<span className="text-muted-foreground">Defect EV avoided</span>
|
|
210
|
+
<FormatNumber
|
|
211
|
+
value={24500}
|
|
212
|
+
style="currency"
|
|
213
|
+
currency="USD"
|
|
214
|
+
tabular
|
|
215
|
+
className="text-right font-medium"
|
|
216
|
+
/>
|
|
217
|
+
<span className="text-muted-foreground">Credit issued</span>
|
|
218
|
+
<FormatNumber
|
|
219
|
+
value={-1249.5}
|
|
220
|
+
style="currency"
|
|
221
|
+
currency="USD"
|
|
222
|
+
tabular
|
|
223
|
+
className="text-right font-medium"
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
),
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Opt-out: `tabular={false}` restores proportional figures. On the default
|
|
230
|
+
// Hyperlegible Sans face this is where the decimals cramp/overlap — which is
|
|
231
|
+
// exactly why tabular is the default.
|
|
232
|
+
export const Proportional: Story = {
|
|
233
|
+
render: () => (
|
|
234
|
+
<div className="space-y-2 text-sm text-foreground">
|
|
235
|
+
<p>
|
|
236
|
+
Default (tabular):{" "}
|
|
237
|
+
<FormatNumber value={182450} style="currency" currency="USD" />
|
|
238
|
+
</p>
|
|
239
|
+
<p>
|
|
240
|
+
Proportional (opt-out):{" "}
|
|
241
|
+
<FormatNumber
|
|
242
|
+
value={182450}
|
|
243
|
+
style="currency"
|
|
244
|
+
currency="USD"
|
|
245
|
+
tabular={false}
|
|
246
|
+
/>
|
|
247
|
+
</p>
|
|
248
|
+
</div>
|
|
249
|
+
),
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export const RealisticUse: Story = {
|
|
253
|
+
render: () => (
|
|
254
|
+
<Card className="w-96">
|
|
255
|
+
<CardHeader>
|
|
256
|
+
<CardTitle>ROI snapshot</CardTitle>
|
|
257
|
+
<CardDescription>
|
|
258
|
+
What the BADS engagement returned this quarter — from{" "}
|
|
259
|
+
<code className="text-xs">pnpm roi:report</code>.
|
|
260
|
+
</CardDescription>
|
|
261
|
+
</CardHeader>
|
|
262
|
+
<CardContent>
|
|
263
|
+
<DataList orientation="horizontal">
|
|
264
|
+
<DataListItem>
|
|
265
|
+
<DataListLabel>Client savings</DataListLabel>
|
|
266
|
+
<DataListValue>
|
|
267
|
+
<FormatNumber
|
|
268
|
+
value={182450}
|
|
269
|
+
style="currency"
|
|
270
|
+
currency="USD"
|
|
271
|
+
tabular
|
|
272
|
+
/>
|
|
273
|
+
</DataListValue>
|
|
274
|
+
</DataListItem>
|
|
275
|
+
<DataListItem>
|
|
276
|
+
<DataListLabel>Build hours avoided</DataListLabel>
|
|
277
|
+
<DataListValue>
|
|
278
|
+
<FormatNumber value={1432} style="unit" unit="hour" tabular />
|
|
279
|
+
</DataListValue>
|
|
280
|
+
</DataListItem>
|
|
281
|
+
<DataListItem>
|
|
282
|
+
<DataListLabel>Story coverage</DataListLabel>
|
|
283
|
+
<DataListValue>
|
|
284
|
+
<FormatNumber
|
|
285
|
+
value={0.984}
|
|
286
|
+
style="percent"
|
|
287
|
+
maximumFractionDigits={1}
|
|
288
|
+
tabular
|
|
289
|
+
/>
|
|
290
|
+
</DataListValue>
|
|
291
|
+
</DataListItem>
|
|
292
|
+
<DataListItem>
|
|
293
|
+
<DataListLabel>Token refs scanned</DataListLabel>
|
|
294
|
+
<DataListValue>
|
|
295
|
+
<FormatNumber value={12417} notation="compact" tabular />
|
|
296
|
+
</DataListValue>
|
|
297
|
+
</DataListItem>
|
|
298
|
+
<DataListItem>
|
|
299
|
+
<DataListLabel>Registry components</DataListLabel>
|
|
300
|
+
<DataListValue>
|
|
301
|
+
<FormatNumber value={88} tabular />
|
|
302
|
+
</DataListValue>
|
|
303
|
+
</DataListItem>
|
|
304
|
+
</DataList>
|
|
305
|
+
</CardContent>
|
|
306
|
+
</Card>
|
|
307
|
+
),
|
|
308
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Highlight } from "@behavioral-agentic-design-system/core/components/ui/highlight"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Highlight> = {
|
|
6
|
+
title: "Components/Highlight",
|
|
7
|
+
component: Highlight,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
highlight: { control: "text" },
|
|
12
|
+
children: { control: "text" },
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
type Story = StoryObj<typeof meta>
|
|
18
|
+
|
|
19
|
+
// Content pulled from content/personas/bads.json (primary persona pool).
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<p className="max-w-md text-sm leading-relaxed text-foreground">
|
|
24
|
+
<Highlight highlight="tokens">
|
|
25
|
+
BADS ships with tokens, components, and accessibility baked in. Fork
|
|
26
|
+
it, rename it, customize the brand colors, and start building.
|
|
27
|
+
</Highlight>
|
|
28
|
+
</p>
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const MultipleTerms: Story = {
|
|
33
|
+
render: () => (
|
|
34
|
+
<p className="max-w-md text-sm leading-relaxed text-foreground">
|
|
35
|
+
<Highlight highlight={["components", "AAA", "Storybook"]}>
|
|
36
|
+
36 components, all passing AAA contrast. Last token change was 3 days
|
|
37
|
+
ago. Your Storybook coverage is at 100%.
|
|
38
|
+
</Highlight>
|
|
39
|
+
</p>
|
|
40
|
+
),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const NoMatch: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<div className="max-w-md space-y-2 text-sm leading-relaxed text-foreground">
|
|
46
|
+
<p>
|
|
47
|
+
<Highlight highlight="figma">
|
|
48
|
+
Add your first component to see it here. Start with the primitives —
|
|
49
|
+
Button, Card, Input — and compose from there.
|
|
50
|
+
</Highlight>
|
|
51
|
+
</p>
|
|
52
|
+
<p className="text-xs text-muted-foreground">
|
|
53
|
+
No occurrence of the query (and an empty query behaves the same) —
|
|
54
|
+
the text renders unchanged, with no {"<mark>"} in the DOM.
|
|
55
|
+
</p>
|
|
56
|
+
</div>
|
|
57
|
+
),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Queries containing regex-special characters (:, $, parentheses, dots)
|
|
61
|
+
// must be escaped, not interpreted — an unescaped "(AAA)" would throw.
|
|
62
|
+
export const SpecialCharacters: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="max-w-md space-y-2 text-sm leading-relaxed text-foreground">
|
|
65
|
+
<p>
|
|
66
|
+
<Highlight highlight="7:1">
|
|
67
|
+
That color doesn't meet AAA contrast (current: 4.2:1, required:
|
|
68
|
+
7:1). You can still use it, but it'll show a warning.
|
|
69
|
+
</Highlight>
|
|
70
|
+
</p>
|
|
71
|
+
<p>
|
|
72
|
+
<Highlight highlight={["$249.00", "(AAA)"]}>
|
|
73
|
+
The Pro tier is $249.00 per seat and every shipped token pair passes
|
|
74
|
+
7:1 (AAA) in both light and dark mode.
|
|
75
|
+
</Highlight>
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const CustomMark: Story = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<p className="max-w-md text-sm leading-relaxed text-foreground">
|
|
84
|
+
<Highlight
|
|
85
|
+
highlight="semantic layer"
|
|
86
|
+
markClassName="bg-secondary text-secondary-foreground underline underline-offset-4 decoration-2"
|
|
87
|
+
>
|
|
88
|
+
A semantic layer names tokens for their purpose — like primary or
|
|
89
|
+
destructive — rather than their raw value.
|
|
90
|
+
</Highlight>
|
|
91
|
+
</p>
|
|
92
|
+
),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const RealisticUse: Story = {
|
|
96
|
+
render: () => {
|
|
97
|
+
const query = "token"
|
|
98
|
+
const results = [
|
|
99
|
+
{
|
|
100
|
+
title: "Customize your tokens",
|
|
101
|
+
snippet:
|
|
102
|
+
"Token changes saved. Run pnpm build:tokens to regenerate CSS.",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: "Set up your design system in five minutes",
|
|
106
|
+
snippet:
|
|
107
|
+
"Token build failed. Check tokens.json for syntax errors and run pnpm build:tokens again.",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: "Your design system at a glance",
|
|
111
|
+
snippet:
|
|
112
|
+
"36 components, all passing AAA contrast. Last token change was 3 days ago.",
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
return (
|
|
116
|
+
<div className="w-96 space-y-4">
|
|
117
|
+
<div className="space-y-1">
|
|
118
|
+
<p className="text-sm font-semibold text-foreground">
|
|
119
|
+
Search results
|
|
120
|
+
</p>
|
|
121
|
+
<p className="text-xs text-muted-foreground">
|
|
122
|
+
3 matches for “{query}” · docs.bads.com
|
|
123
|
+
</p>
|
|
124
|
+
</div>
|
|
125
|
+
<ul className="space-y-3">
|
|
126
|
+
{results.map((result) => (
|
|
127
|
+
<li key={result.title} className="space-y-0.5">
|
|
128
|
+
<p className="text-sm font-medium text-foreground">
|
|
129
|
+
<Highlight highlight={query}>{result.title}</Highlight>
|
|
130
|
+
</p>
|
|
131
|
+
<p className="text-xs leading-relaxed text-muted-foreground">
|
|
132
|
+
<Highlight highlight={query}>{result.snippet}</Highlight>
|
|
133
|
+
</p>
|
|
134
|
+
</li>
|
|
135
|
+
))}
|
|
136
|
+
</ul>
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
},
|
|
140
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { Image } from "@behavioral-agentic-design-system/core/components/ui/image";
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardDescription,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Image wraps a native img with the three behaviors product surfaces re-roll
|
|
14
|
+
* by hand: a Skeleton while loading, a token-styled fallback on a broken src
|
|
15
|
+
* (the accessible name survives via role="img" + aria-label), and an
|
|
16
|
+
* optional CSS aspect-ratio frame so layout doesn't shift. Lazy by default.
|
|
17
|
+
* Not a lightbox, and not a next/image substitute.
|
|
18
|
+
*/
|
|
19
|
+
const meta: Meta<typeof Image> = {
|
|
20
|
+
title: "Components/Image",
|
|
21
|
+
component: Image,
|
|
22
|
+
parameters: { layout: "centered" },
|
|
23
|
+
tags: ["autodocs"],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
29
|
+
const COVER = "/blog/web-dev-trends.jpg";
|
|
30
|
+
const AVATAR = "/avatars/01.png";
|
|
31
|
+
const BROKEN = "/blog/this-image-does-not-exist.jpg";
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<div className="w-96">
|
|
36
|
+
<Image src={COVER} alt="Abstract cover art for a web development trends article" />
|
|
37
|
+
</div>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Ratio_16x9: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<div className="w-96">
|
|
44
|
+
<Image
|
|
45
|
+
src={COVER}
|
|
46
|
+
alt="Abstract cover art cropped to a 16:9 frame"
|
|
47
|
+
ratio="16/9"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Ratio_Square: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<div className="w-48">
|
|
56
|
+
<Image src={AVATAR} alt="Portrait of Jordan Reeves" ratio="1/1" />
|
|
57
|
+
</div>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Fit_Contain: Story = {
|
|
62
|
+
render: () => (
|
|
63
|
+
<div className="w-96">
|
|
64
|
+
<Image
|
|
65
|
+
src={AVATAR}
|
|
66
|
+
alt="Portrait of Jordan Reeves, letterboxed inside a wide frame"
|
|
67
|
+
ratio="16/9"
|
|
68
|
+
fit="contain"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Radius_Full: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<div className="w-32">
|
|
77
|
+
<Image src={AVATAR} alt="Portrait of Seo-yun Park" ratio="1/1" radius="full" />
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const Fallback_Default: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<div className="w-96">
|
|
85
|
+
<Image
|
|
86
|
+
src={BROKEN}
|
|
87
|
+
alt="Cover art for a retired article"
|
|
88
|
+
ratio="16/9"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Fallback_Text: Story = {
|
|
95
|
+
render: () => (
|
|
96
|
+
<div className="w-96">
|
|
97
|
+
<Image
|
|
98
|
+
src={BROKEN}
|
|
99
|
+
alt="Cover art for a retired article"
|
|
100
|
+
ratio="16/9"
|
|
101
|
+
fallback="Image unavailable"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const WithCaption: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<div className="w-96">
|
|
110
|
+
<Image
|
|
111
|
+
src={COVER}
|
|
112
|
+
alt="Abstract geometric shapes in the BADS brand palette"
|
|
113
|
+
ratio="16/9"
|
|
114
|
+
caption="Cover art from the design.bads.com blog, July 2026."
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const RealisticUse: Story = {
|
|
121
|
+
render: () => (
|
|
122
|
+
<Card className="w-96 overflow-hidden pt-0">
|
|
123
|
+
<Image
|
|
124
|
+
src={COVER}
|
|
125
|
+
alt="Abstract cover art for a web development trends article"
|
|
126
|
+
ratio="16/9"
|
|
127
|
+
radius="none"
|
|
128
|
+
/>
|
|
129
|
+
<CardHeader>
|
|
130
|
+
<CardTitle>Set up your design system in five minutes</CardTitle>
|
|
131
|
+
<CardDescription>
|
|
132
|
+
BADS ships with tokens, components, and accessibility baked in. Fork it,
|
|
133
|
+
rename it, customize the brand colors, and start building.
|
|
134
|
+
</CardDescription>
|
|
135
|
+
</CardHeader>
|
|
136
|
+
<CardContent className="text-sm text-muted-foreground">
|
|
137
|
+
By Jordan Reeves · 2026-05-26
|
|
138
|
+
</CardContent>
|
|
139
|
+
</Card>
|
|
140
|
+
),
|
|
141
|
+
};
|
|
@@ -61,6 +61,9 @@ export const Variant_Destructive: Story = {
|
|
|
61
61
|
),
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// success/warning now paint the real oklch token: the class was
|
|
65
|
+
// bg-[hsl(var(--success))] — hsl() wrapping an oklch value is invalid CSS and
|
|
66
|
+
// silently fell back — fixed to bg-[var(--success)] (2026-07-24 paydown).
|
|
64
67
|
export const Variant_Success: Story = {
|
|
65
68
|
render: () => (
|
|
66
69
|
<Indicator variant="success">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
3
4
|
|
|
@@ -67,3 +68,35 @@ export const RealisticUse: Story = {
|
|
|
67
68
|
placeholder: "your@email.com",
|
|
68
69
|
},
|
|
69
70
|
};
|
|
71
|
+
|
|
72
|
+
export const Clearable: Story = {
|
|
73
|
+
name: "Clearable",
|
|
74
|
+
render: () => {
|
|
75
|
+
const [value, setValue] = React.useState("Clearable input");
|
|
76
|
+
return (
|
|
77
|
+
<Input
|
|
78
|
+
aria-label="Search"
|
|
79
|
+
value={value}
|
|
80
|
+
onChange={(e) => setValue(e.target.value)}
|
|
81
|
+
clearable
|
|
82
|
+
placeholder="Type something…"
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const ClearableEmpty: Story = {
|
|
89
|
+
name: "Clearable (empty — no X shown)",
|
|
90
|
+
render: () => {
|
|
91
|
+
const [value, setValue] = React.useState("");
|
|
92
|
+
return (
|
|
93
|
+
<Input
|
|
94
|
+
aria-label="Search"
|
|
95
|
+
value={value}
|
|
96
|
+
onChange={(e) => setValue(e.target.value)}
|
|
97
|
+
clearable
|
|
98
|
+
placeholder="X hidden when empty"
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
};
|