@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.
Files changed (139) hide show
  1. package/package.json +8 -4
  2. package/scripts/build-tokens.cjs +79 -5
  3. package/src/app/preview/components/page.tsx +4760 -213
  4. package/src/app/shell.tsx +18 -6
  5. package/src/components/customize/brand-mark-section.tsx +1 -1
  6. package/src/components/customize-tab.tsx +2 -2
  7. package/src/components/home-tab.tsx +2 -2
  8. package/src/components/ui/action-bar.tsx +142 -0
  9. package/src/components/ui/affix.tsx +109 -0
  10. package/src/components/ui/alert.tsx +37 -3
  11. package/src/components/ui/anchor.tsx +136 -0
  12. package/src/components/ui/angle-slider.tsx +265 -0
  13. package/src/components/ui/autocomplete.tsx +223 -0
  14. package/src/components/ui/avatar.tsx +8 -2
  15. package/src/components/ui/blockquote.tsx +112 -0
  16. package/src/components/ui/bottom-navigation.tsx +144 -0
  17. package/src/components/ui/burger.tsx +117 -0
  18. package/src/components/ui/button.tsx +101 -3
  19. package/src/components/ui/calendar.tsx +1 -1
  20. package/src/components/ui/card.tsx +43 -5
  21. package/src/components/ui/carousel.tsx +10 -5
  22. package/src/components/ui/cascader.tsx +253 -0
  23. package/src/components/ui/checkbox-card.tsx +176 -0
  24. package/src/components/ui/checkbox-group.tsx +231 -0
  25. package/src/components/ui/checkbox.tsx +14 -3
  26. package/src/components/ui/chip.tsx +143 -0
  27. package/src/components/ui/circular-progress.tsx +2 -2
  28. package/src/components/ui/color-swatch.tsx +73 -0
  29. package/src/components/ui/copy-button.tsx +21 -4
  30. package/src/components/ui/data-list.tsx +169 -0
  31. package/src/components/ui/date-picker.tsx +6 -3
  32. package/src/components/ui/date-range-picker.tsx +6 -3
  33. package/src/components/ui/fieldset.tsx +8 -2
  34. package/src/components/ui/float-label.tsx +114 -0
  35. package/src/components/ui/floating-panel.tsx +129 -0
  36. package/src/components/ui/format-number.tsx +122 -0
  37. package/src/components/ui/highlight.tsx +85 -0
  38. package/src/components/ui/image.tsx +195 -0
  39. package/src/components/ui/index.ts +52 -0
  40. package/src/components/ui/indicator.tsx +2 -2
  41. package/src/components/ui/input-group.tsx +11 -1
  42. package/src/components/ui/input.tsx +48 -4
  43. package/src/components/ui/kbd.tsx +1 -1
  44. package/src/components/ui/link.tsx +158 -0
  45. package/src/components/ui/listbox.tsx +426 -0
  46. package/src/components/ui/loading-overlay.tsx +80 -0
  47. package/src/components/ui/marquee.tsx +193 -0
  48. package/src/components/ui/masonry.tsx +164 -0
  49. package/src/components/ui/meter.tsx +186 -0
  50. package/src/components/ui/motion-toggle.tsx +170 -0
  51. package/src/components/ui/notification.tsx +175 -0
  52. package/src/components/ui/overlay.tsx +63 -0
  53. package/src/components/ui/progress.tsx +95 -4
  54. package/src/components/ui/qr-code.tsx +107 -0
  55. package/src/components/ui/rating-group.tsx +1 -0
  56. package/src/components/ui/separator.tsx +57 -1
  57. package/src/components/ui/sidebar.tsx +1 -1
  58. package/src/components/ui/signature-pad.tsx +381 -0
  59. package/src/components/ui/skeleton.tsx +59 -2
  60. package/src/components/ui/skip-link.tsx +117 -0
  61. package/src/components/ui/slider.tsx +86 -1
  62. package/src/components/ui/spoiler.tsx +131 -0
  63. package/src/components/ui/tabs.tsx +1 -1
  64. package/src/components/ui/text.tsx +135 -0
  65. package/src/components/ui/textarea.tsx +66 -2
  66. package/src/components/ui/timeline.tsx +71 -14
  67. package/src/components/ui/timer.tsx +183 -0
  68. package/src/components/ui/tour.tsx +332 -0
  69. package/src/components/ui/transfer-list.tsx +308 -0
  70. package/src/components/ui/visually-hidden.tsx +42 -0
  71. package/src/components/ui/watermark.tsx +0 -0
  72. package/src/data/docs-index.ts +10 -2
  73. package/src/stories/ActionBar.stories.tsx +201 -0
  74. package/src/stories/Affix.stories.tsx +165 -0
  75. package/src/stories/Alert.stories.tsx +58 -0
  76. package/src/stories/Anchor.stories.tsx +236 -0
  77. package/src/stories/AngleSlider.stories.tsx +128 -0
  78. package/src/stories/Autocomplete.stories.tsx +216 -0
  79. package/src/stories/Avatar.stories.tsx +73 -1
  80. package/src/stories/Blockquote.stories.tsx +148 -0
  81. package/src/stories/BottomNavigation.stories.tsx +195 -0
  82. package/src/stories/Burger.stories.tsx +79 -0
  83. package/src/stories/Button.stories.tsx +103 -2
  84. package/src/stories/Calendar.stories.tsx +4 -0
  85. package/src/stories/Card.stories.tsx +30 -0
  86. package/src/stories/Carousel.stories.tsx +2 -1
  87. package/src/stories/Cascader.stories.tsx +285 -0
  88. package/src/stories/Checkbox.stories.tsx +13 -0
  89. package/src/stories/CheckboxCard.stories.tsx +210 -0
  90. package/src/stories/CheckboxGroup.stories.tsx +186 -0
  91. package/src/stories/Chip.stories.tsx +173 -0
  92. package/src/stories/CircularProgress.stories.tsx +3 -0
  93. package/src/stories/ColorSwatch.stories.tsx +81 -0
  94. package/src/stories/CopyButton.stories.tsx +3 -3
  95. package/src/stories/DataList.stories.tsx +160 -0
  96. package/src/stories/DatePicker.stories.tsx +3 -0
  97. package/src/stories/DateRangePicker.stories.tsx +3 -0
  98. package/src/stories/Editable.stories.tsx +14 -0
  99. package/src/stories/Fieldset.stories.tsx +4 -0
  100. package/src/stories/FloatLabel.stories.tsx +148 -0
  101. package/src/stories/FloatingPanel.stories.tsx +176 -0
  102. package/src/stories/FormatNumber.stories.tsx +308 -0
  103. package/src/stories/Highlight.stories.tsx +140 -0
  104. package/src/stories/Image.stories.tsx +141 -0
  105. package/src/stories/Indicator.stories.tsx +3 -0
  106. package/src/stories/Input.stories.tsx +33 -0
  107. package/src/stories/InputGroup.stories.tsx +39 -41
  108. package/src/stories/Kbd.stories.tsx +3 -0
  109. package/src/stories/Link.stories.tsx +198 -0
  110. package/src/stories/Listbox.stories.tsx +240 -0
  111. package/src/stories/LoadingOverlay.stories.tsx +148 -0
  112. package/src/stories/Marquee.stories.tsx +170 -0
  113. package/src/stories/Masonry.stories.tsx +227 -0
  114. package/src/stories/Meter.stories.tsx +143 -0
  115. package/src/stories/MotionToggle.stories.tsx +85 -0
  116. package/src/stories/Notification.stories.tsx +264 -0
  117. package/src/stories/Overlay.stories.tsx +169 -0
  118. package/src/stories/PasswordInput.stories.tsx +4 -0
  119. package/src/stories/Progress.stories.tsx +70 -27
  120. package/src/stories/QrCode.stories.tsx +146 -0
  121. package/src/stories/RatingGroup.stories.tsx +5 -0
  122. package/src/stories/Separator.stories.tsx +41 -5
  123. package/src/stories/Sidebar.stories.tsx +2 -1
  124. package/src/stories/SignaturePad.stories.tsx +112 -0
  125. package/src/stories/Skeleton.stories.tsx +23 -4
  126. package/src/stories/SkipLink.stories.tsx +137 -0
  127. package/src/stories/Slider.stories.tsx +28 -0
  128. package/src/stories/Spoiler.stories.tsx +122 -0
  129. package/src/stories/Tabs.stories.tsx +2 -1
  130. package/src/stories/Text.stories.tsx +191 -0
  131. package/src/stories/Textarea.stories.tsx +58 -6
  132. package/src/stories/Timeline.stories.tsx +82 -0
  133. package/src/stories/Timer.stories.tsx +160 -0
  134. package/src/stories/Tour.stories.tsx +191 -0
  135. package/src/stories/TransferList.stories.tsx +169 -0
  136. package/src/stories/VisuallyHidden.stories.tsx +105 -0
  137. package/src/stories/Watermark.stories.tsx +212 -0
  138. package/src/styles.css +80 -6
  139. package/src/tokens.json +2 -2
@@ -0,0 +1,148 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { LoadingOverlay } from "@behavioral-agentic-design-system/core/components/ui/loading-overlay";
4
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
12
+ import {
13
+ DataList,
14
+ DataListItem,
15
+ DataListLabel,
16
+ DataListValue,
17
+ } from "@behavioral-agentic-design-system/core/components/ui/data-list";
18
+
19
+ const meta: Meta<typeof LoadingOverlay> = {
20
+ title: "Components/LoadingOverlay",
21
+ component: LoadingOverlay,
22
+ parameters: {
23
+ layout: "centered",
24
+ docs: {
25
+ description: {
26
+ component:
27
+ "Full-coverage loading state for a container or the viewport. Wraps children in a positioned container and fades a semi-transparent backdrop with a centered Spinner over them while loading. The overlay owns the role=status polite live-region announcement; the fade uses the motion tokens and collapses under reduced motion via the base layer.",
28
+ },
29
+ },
30
+ },
31
+ tags: ["autodocs"],
32
+ };
33
+
34
+ export default meta;
35
+ type Story = StoryObj<typeof meta>;
36
+
37
+ // Real content from content/personas/bads.json (primary persona pool).
38
+ function TokenProposalBody() {
39
+ return (
40
+ <div className="w-80 space-y-2 rounded-lg border border-border p-4">
41
+ <p className="text-sm font-medium text-foreground">
42
+ tokens-v2-proposal
43
+ </p>
44
+ <p className="text-sm text-muted-foreground">
45
+ Jordan Reeves shared 36 components for review at
46
+ design.bads.com/share/tokens-v2-proposal.
47
+ </p>
48
+ </div>
49
+ );
50
+ }
51
+
52
+ export const Default: Story = {
53
+ render: () => (
54
+ <LoadingOverlay loading>
55
+ <TokenProposalBody />
56
+ </LoadingOverlay>
57
+ ),
58
+ };
59
+
60
+ export const FullScreen: Story = {
61
+ parameters: { layout: "fullscreen" },
62
+ render: () => (
63
+ <div className="p-8">
64
+ <p className="text-sm text-muted-foreground">
65
+ Fullscreen mode positions the overlay with{" "}
66
+ <code>position: fixed</code>, covering the whole viewport — reserve
67
+ it for page-level transitions.
68
+ </p>
69
+ <LoadingOverlay loading fullscreen>
70
+ <TokenProposalBody />
71
+ </LoadingOverlay>
72
+ </div>
73
+ ),
74
+ };
75
+
76
+ export const WithBlur: Story = {
77
+ render: () => (
78
+ <LoadingOverlay loading blur>
79
+ <TokenProposalBody />
80
+ </LoadingOverlay>
81
+ ),
82
+ };
83
+
84
+ function ControlledDemo() {
85
+ const [loading, setLoading] = React.useState(false);
86
+ return (
87
+ <div className="flex flex-col items-start gap-4">
88
+ <Button
89
+ size="xl"
90
+ variant="outline"
91
+ onClick={() => setLoading((l) => !l)}
92
+ >
93
+ {loading ? "Finish loading" : "Start loading"}
94
+ </Button>
95
+ <LoadingOverlay loading={loading}>
96
+ <TokenProposalBody />
97
+ </LoadingOverlay>
98
+ </div>
99
+ );
100
+ }
101
+
102
+ export const Controlled: Story = {
103
+ render: () => <ControlledDemo />,
104
+ };
105
+
106
+ function RealisticUseDemo() {
107
+ const [loading, setLoading] = React.useState(true);
108
+ React.useEffect(() => {
109
+ const t = setTimeout(() => setLoading(false), 2400);
110
+ return () => clearTimeout(t);
111
+ }, []);
112
+ return (
113
+ <LoadingOverlay loading={loading}>
114
+ <Card className="w-96">
115
+ <CardHeader>
116
+ <CardTitle className="text-2xl">Workspace usage</CardTitle>
117
+ <CardDescription>
118
+ design.bads.com &middot; Jordan Reeves&rsquo; workspace
119
+ </CardDescription>
120
+ </CardHeader>
121
+ <CardContent>
122
+ <DataList>
123
+ <DataListItem>
124
+ <DataListLabel>Plan</DataListLabel>
125
+ <DataListValue>$249.00 / yr</DataListValue>
126
+ </DataListItem>
127
+ <DataListItem>
128
+ <DataListLabel>Components</DataListLabel>
129
+ <DataListValue>36 components</DataListValue>
130
+ </DataListItem>
131
+ <DataListItem>
132
+ <DataListLabel>Contrast floor</DataListLabel>
133
+ <DataListValue>7:1 contrast</DataListValue>
134
+ </DataListItem>
135
+ <DataListItem>
136
+ <DataListLabel>Billing contact</DataListLabel>
137
+ <DataListValue>jordan@reeves.design</DataListValue>
138
+ </DataListItem>
139
+ </DataList>
140
+ </CardContent>
141
+ </Card>
142
+ </LoadingOverlay>
143
+ );
144
+ }
145
+
146
+ export const RealisticUse: Story = {
147
+ render: () => <RealisticUseDemo />,
148
+ };
@@ -0,0 +1,170 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import {
4
+ Marquee,
5
+ MarqueeItem,
6
+ } from "@behavioral-agentic-design-system/core/components/ui/marquee";
7
+ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
8
+ import {
9
+ Card,
10
+ CardContent,
11
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
12
+
13
+ const meta: Meta<typeof Marquee> = {
14
+ title: "Components/Marquee",
15
+ component: Marquee,
16
+ parameters: { layout: "padded" },
17
+ tags: ["autodocs"],
18
+ argTypes: {
19
+ speed: { control: { type: "number", min: 10, max: 200 } },
20
+ direction: { control: "radio", options: ["left", "right"] },
21
+ fade: { control: "boolean" },
22
+ showControl: { control: "boolean" },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof Marquee>;
28
+
29
+ // Real content from content/personas/bads.json — the primary persona's
30
+ // jargon pool (docs-topic ticker) and testimonials pool (strip of quotes).
31
+ const TOPICS = [
32
+ "design tokens",
33
+ "semantic layer",
34
+ "a11y contract",
35
+ "CVA variants",
36
+ "Radix primitive",
37
+ "anti-pattern",
38
+ "token drift",
39
+ "visual regression",
40
+ "forced colors",
41
+ "focus trap",
42
+ ];
43
+
44
+ const TESTIMONIALS = [
45
+ {
46
+ name: "Jordan Reeves",
47
+ role: "Design Systems Lead",
48
+ quote:
49
+ "First system I've adopted without reading a single apology in the docs. The a11y contracts are actually enforced.",
50
+ },
51
+ {
52
+ name: "Seo-yun Park",
53
+ role: "Senior Design Engineer",
54
+ quote:
55
+ "The token pipeline paid for itself in a week. One tokens.json change, both CSS files regenerate, every fork picks it up.",
56
+ },
57
+ {
58
+ name: "Marcus Lindqvist",
59
+ role: "Staff Engineer",
60
+ quote:
61
+ "Storybook coverage wired into pre-commit means nobody ships a variant without a story. That alone ended our drift problem.",
62
+ },
63
+ {
64
+ name: "Anika Patel",
65
+ role: "Design Engineer",
66
+ quote:
67
+ "7:1 contrast out of the box. I stopped auditing every PR for hardcoded hex values because the lint does it for me.",
68
+ },
69
+ ];
70
+
71
+ function TopicChips() {
72
+ return (
73
+ <>
74
+ {TOPICS.map((topic) => (
75
+ <MarqueeItem key={topic}>
76
+ <Badge variant="secondary">{topic}</Badge>
77
+ </MarqueeItem>
78
+ ))}
79
+ </>
80
+ );
81
+ }
82
+
83
+ export const Default: Story = {
84
+ render: () => (
85
+ <div className="w-full max-w-2xl">
86
+ <Marquee aria-label="Documentation topics">
87
+ <TopicChips />
88
+ </Marquee>
89
+ </div>
90
+ ),
91
+ };
92
+
93
+ export const Variant_ReverseDirection: Story = {
94
+ render: () => (
95
+ <div className="w-full max-w-2xl">
96
+ <Marquee aria-label="Documentation topics" direction="right">
97
+ <TopicChips />
98
+ </Marquee>
99
+ </div>
100
+ ),
101
+ };
102
+
103
+ export const Variant_EdgeFade: Story = {
104
+ render: () => (
105
+ <div className="w-full max-w-2xl">
106
+ <Marquee aria-label="Documentation topics" fade>
107
+ <TopicChips />
108
+ </Marquee>
109
+ </div>
110
+ ),
111
+ };
112
+
113
+ export const WithoutControl: Story = {
114
+ parameters: {
115
+ docs: {
116
+ description: {
117
+ story:
118
+ "SC 2.2.2 consumer contract: with `showControl={false}` the built-in pause button is gone, and hover / focus-within pause alone does not cover touch users — the consumer MUST provide its own pause mechanism (here, the toggle below the strip).",
119
+ },
120
+ },
121
+ },
122
+ render: function WithoutControlStory() {
123
+ const [paused, setPaused] = React.useState(false);
124
+ return (
125
+ <div className="w-full max-w-2xl space-y-3">
126
+ <Marquee
127
+ aria-label="Documentation topics"
128
+ showControl={false}
129
+ data-state={paused ? "paused" : "running"}
130
+ >
131
+ <TopicChips />
132
+ </Marquee>
133
+ <button
134
+ type="button"
135
+ className="min-h-11 rounded-md border px-4 text-sm font-medium"
136
+ aria-pressed={paused}
137
+ onClick={() => setPaused((p) => !p)}
138
+ >
139
+ {paused ? "Resume ticker" : "Pause ticker"}
140
+ </button>
141
+ </div>
142
+ );
143
+ },
144
+ };
145
+
146
+ export const RealisticUse: Story = {
147
+ render: () => (
148
+ <div className="w-full max-w-3xl space-y-3">
149
+ <p className="text-sm font-medium text-muted-foreground">
150
+ What design systems teams say
151
+ </p>
152
+ <Marquee aria-label="Customer testimonials" fade speed={30}>
153
+ {TESTIMONIALS.map((t) => (
154
+ <MarqueeItem key={t.name}>
155
+ <Card className="w-80 shadow-none">
156
+ <CardContent className="space-y-2 p-4">
157
+ <p className="text-sm leading-relaxed">&ldquo;{t.quote}&rdquo;</p>
158
+ <p className="text-xs text-muted-foreground">
159
+ <span className="font-medium text-foreground">{t.name}</span>
160
+ {" — "}
161
+ {t.role}
162
+ </p>
163
+ </CardContent>
164
+ </Card>
165
+ </MarqueeItem>
166
+ ))}
167
+ </Marquee>
168
+ </div>
169
+ ),
170
+ };
@@ -0,0 +1,227 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Masonry } from "@behavioral-agentic-design-system/core/components/ui/masonry";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
12
+ import {
13
+ Avatar,
14
+ AvatarFallback,
15
+ } from "@behavioral-agentic-design-system/core/components/ui/avatar";
16
+
17
+ const meta: Meta<typeof Masonry> = {
18
+ title: "Components/Masonry",
19
+ component: Masonry,
20
+ parameters: { layout: "padded" },
21
+ tags: ["autodocs"],
22
+ argTypes: {
23
+ gap: {
24
+ control: "select",
25
+ options: ["0", "1", "2", "3", "4", "5", "6", "8"],
26
+ },
27
+ },
28
+ };
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof Masonry>;
32
+
33
+ // Real content from content/personas/bads.json — the primary persona's
34
+ // jargon pool as doc-note tiles of deliberately uneven length, so the
35
+ // columns actually stagger the way variable-height content does.
36
+ const DOC_NOTES = [
37
+ {
38
+ topic: "design tokens",
39
+ body: "tokens.json is the source of truth. Run pnpm build:tokens and both CSS files regenerate.",
40
+ },
41
+ {
42
+ topic: "a11y contract",
43
+ body: "Every registry entry declares role, keyboard, focus, and target size. 7:1 contrast, 14px minimum, 44×44px target.",
44
+ },
45
+ {
46
+ topic: "token drift",
47
+ body: "The orphan lint scans every shipped theme token and flags zeros.",
48
+ },
49
+ {
50
+ topic: "visual regression",
51
+ body: "Chromatic runs on every push to main. First run establishes the baseline; every PR after that gets visual diffs against it, so a stray token change can't reflow a surface unnoticed.",
52
+ },
53
+ {
54
+ topic: "focus trap",
55
+ body: "Dialog and Sheet trap focus while open and return it to the trigger on close.",
56
+ },
57
+ {
58
+ topic: "semantic layer",
59
+ body: "Primitives resolve through semantic tokens — bg-card, text-muted-foreground — never raw hex. Rebrand by editing the semantic layer once.",
60
+ },
61
+ ];
62
+
63
+ function DocNoteCard({ topic, body }: { topic: string; body: string }) {
64
+ return (
65
+ <Card>
66
+ <CardHeader>
67
+ <CardTitle className="text-lg">{topic}</CardTitle>
68
+ </CardHeader>
69
+ <CardContent>
70
+ <p className="text-sm text-muted-foreground">{body}</p>
71
+ </CardContent>
72
+ </Card>
73
+ );
74
+ }
75
+
76
+ export const Default: Story = {
77
+ render: () => (
78
+ <Masonry>
79
+ {DOC_NOTES.map((note) => (
80
+ <DocNoteCard key={note.topic} {...note} />
81
+ ))}
82
+ </Masonry>
83
+ ),
84
+ };
85
+
86
+ export const TwoColumns: Story = {
87
+ render: () => (
88
+ <Masonry columns={2}>
89
+ {DOC_NOTES.map((note) => (
90
+ <DocNoteCard key={note.topic} {...note} />
91
+ ))}
92
+ </Masonry>
93
+ ),
94
+ };
95
+
96
+ export const FourColumns: Story = {
97
+ render: () => (
98
+ <Masonry columns={4} gap="3">
99
+ {DOC_NOTES.map((note) => (
100
+ <DocNoteCard key={note.topic} {...note} />
101
+ ))}
102
+ </Masonry>
103
+ ),
104
+ };
105
+
106
+ export const Responsive: Story = {
107
+ name: "Responsive ({ sm: 1, md: 2, lg: 3 })",
108
+ render: () => (
109
+ <Masonry columns={{ sm: 1, md: 2, lg: 3 }}>
110
+ {DOC_NOTES.map((note) => (
111
+ <DocNoteCard key={note.topic} {...note} />
112
+ ))}
113
+ </Masonry>
114
+ ),
115
+ };
116
+
117
+ // Real content from content/personas/bads.json — testimonials pool plus the
118
+ // metrics pool as interleaved stat tiles: the canonical masonry use case of
119
+ // mixed-height cards on a community wall.
120
+ const TESTIMONIALS = [
121
+ {
122
+ name: "Jordan Reeves",
123
+ role: "Design Systems Lead",
124
+ quote:
125
+ "First system I've adopted without reading a single apology in the docs. The a11y contracts are actually enforced.",
126
+ },
127
+ {
128
+ name: "Seo-yun Park",
129
+ role: "Senior Design Engineer",
130
+ quote:
131
+ "The token pipeline paid for itself in a week. One tokens.json change, both CSS files regenerate, every fork picks it up.",
132
+ },
133
+ {
134
+ name: "Marcus Lindqvist",
135
+ role: "Staff Engineer",
136
+ quote:
137
+ "Storybook coverage wired into pre-commit means nobody ships a variant without a story. That alone ended our drift problem.",
138
+ },
139
+ {
140
+ name: "Anika Patel",
141
+ role: "Design Engineer",
142
+ quote:
143
+ "7:1 contrast out of the box. I stopped auditing every PR for hardcoded hex values because the lint does it for me.",
144
+ },
145
+ ];
146
+
147
+ const STATS = [
148
+ { label: "Client savings to date", value: "$182,450" },
149
+ { label: "Build hours avoided", value: "1,432 hrs" },
150
+ { label: "Story coverage", value: "98.4%" },
151
+ ];
152
+
153
+ function initials(name: string) {
154
+ return name
155
+ .split(" ")
156
+ .map((part) => part[0])
157
+ .join("");
158
+ }
159
+
160
+ export const RealisticUse: Story = {
161
+ render: () => (
162
+ <Masonry columns={{ sm: 1, md: 2, lg: 3 }} gap="4">
163
+ {TESTIMONIALS.slice(0, 2).map((t) => (
164
+ <Card key={t.name}>
165
+ <CardContent className="pt-6">
166
+ <blockquote className="text-sm text-foreground">
167
+ &ldquo;{t.quote}&rdquo;
168
+ </blockquote>
169
+ <div className="mt-4 flex items-center gap-3">
170
+ <Avatar>
171
+ <AvatarFallback>{initials(t.name)}</AvatarFallback>
172
+ </Avatar>
173
+ <div className="min-w-0">
174
+ <p className="truncate text-sm font-medium">{t.name}</p>
175
+ <p className="truncate text-xs text-muted-foreground">
176
+ {t.role}
177
+ </p>
178
+ </div>
179
+ </div>
180
+ </CardContent>
181
+ </Card>
182
+ ))}
183
+ {STATS.map((stat) => (
184
+ <Card key={stat.label}>
185
+ <CardHeader>
186
+ <CardDescription>{stat.label}</CardDescription>
187
+ <CardTitle className="text-3xl tabular-nums">
188
+ {stat.value}
189
+ </CardTitle>
190
+ </CardHeader>
191
+ </Card>
192
+ ))}
193
+ {TESTIMONIALS.slice(2).map((t) => (
194
+ <Card key={t.name}>
195
+ <CardContent className="pt-6">
196
+ <blockquote className="text-sm text-foreground">
197
+ &ldquo;{t.quote}&rdquo;
198
+ </blockquote>
199
+ <div className="mt-4 flex items-center gap-3">
200
+ <Avatar>
201
+ <AvatarFallback>{initials(t.name)}</AvatarFallback>
202
+ </Avatar>
203
+ <div className="min-w-0">
204
+ <p className="truncate text-sm font-medium">{t.name}</p>
205
+ <p className="truncate text-xs text-muted-foreground">
206
+ {t.role}
207
+ </p>
208
+ </div>
209
+ </div>
210
+ </CardContent>
211
+ </Card>
212
+ ))}
213
+ <Card>
214
+ <CardHeader>
215
+ <div className="flex items-center gap-2">
216
+ <CardTitle className="text-lg">BADS 1.0</CardTitle>
217
+ <Badge variant="secondary">shipped 2026-05-26</Badge>
218
+ </div>
219
+ <CardDescription>
220
+ 88 registry components, 7:1 contrast floor, 44×44px targets — every
221
+ fork starts here.
222
+ </CardDescription>
223
+ </CardHeader>
224
+ </Card>
225
+ </Masonry>
226
+ ),
227
+ };
@@ -0,0 +1,143 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import * as React from "react"
3
+ import { Meter } from "@behavioral-agentic-design-system/core/components/ui/meter"
4
+
5
+ const meta: Meta<typeof Meter> = {
6
+ title: "Components/Meter",
7
+ component: Meter,
8
+ parameters: {
9
+ layout: "centered",
10
+ docs: {
11
+ description: {
12
+ component:
13
+ "Linear gauge for where a measurement falls within a known range — battery, disk usage, vote share. role=\"meter\" (ARIA 1.1) with aria-valuenow/min/max/valuetext; the semantic sibling of Progress (which tracks work toward a goal as role=\"progressbar\"). Fill width and threshold color ease via var(--duration-base) + var(--ease-out). Display-only — not focusable, target size n/a.",
14
+ },
15
+ },
16
+ },
17
+ decorators: [
18
+ (Story) => (
19
+ <div className="w-80">
20
+ <Story />
21
+ </div>
22
+ ),
23
+ ],
24
+ }
25
+ export default meta
26
+ type Story = StoryObj<typeof Meter>
27
+
28
+ export const Default: Story = {
29
+ render: () => <Meter value={62} aria-label="Storage used" />,
30
+ }
31
+
32
+ export const WithLabel: Story = {
33
+ render: () => (
34
+ <Meter value={12.4} min={0} max={20} label="Asset storage" showValue getValueLabel={(v, _min, max) => `${v} GB of ${max} GB`} />
35
+ ),
36
+ }
37
+
38
+ export const Variant_Success: Story = {
39
+ render: () => (
40
+ <Meter value={98.4} variant="success" label="Story coverage" showValue getValueLabel={(v) => `${v}%`} />
41
+ ),
42
+ }
43
+
44
+ export const Variant_Warning: Story = {
45
+ render: () => (
46
+ <Meter value={78} variant="warning" label="Token budget used" showValue />
47
+ ),
48
+ }
49
+
50
+ export const Variant_Destructive: Story = {
51
+ render: () => (
52
+ <Meter value={94} variant="destructive" label="Contrast failures quota" showValue />
53
+ ),
54
+ }
55
+
56
+ export const WithVariants: Story = {
57
+ name: "WithVariants (threshold walk)",
58
+ render: () => {
59
+ // The variant is explicit — the consumer maps value → threshold. This is
60
+ // the canonical mapping for a "remaining capacity" reading.
61
+ const readings = [
62
+ { label: "Battery — healthy", value: 82, variant: "success" as const },
63
+ { label: "Battery — getting low", value: 34, variant: "warning" as const },
64
+ { label: "Battery — critical", value: 9, variant: "destructive" as const },
65
+ ]
66
+ return (
67
+ <div className="flex flex-col gap-5">
68
+ {readings.map((r) => (
69
+ <Meter
70
+ key={r.label}
71
+ value={r.value}
72
+ variant={r.variant}
73
+ label={r.label}
74
+ showValue
75
+ />
76
+ ))}
77
+ </div>
78
+ )
79
+ },
80
+ }
81
+
82
+ export const Size_Sm: Story = {
83
+ render: () => <Meter value={62} size="sm" aria-label="Storage used (small)" />,
84
+ }
85
+
86
+ export const Size_Default: Story = {
87
+ render: () => (
88
+ <Meter value={62} size="default" aria-label="Storage used (default)" />
89
+ ),
90
+ }
91
+
92
+ export const Size_Lg: Story = {
93
+ render: () => <Meter value={62} size="lg" aria-label="Storage used (large)" />,
94
+ }
95
+
96
+ export const Disabled: Story = {
97
+ render: () => (
98
+ <Meter value={62} disabled label="Asset storage (workspace archived)" showValue />
99
+ ),
100
+ }
101
+
102
+ export const RealisticUse: Story = {
103
+ render: () => {
104
+ // Persona content pool (content/personas/bads.json): Jordan Reeves,
105
+ // design.bads.com, registry/story-coverage metrics.
106
+ const [used, setUsed] = React.useState(12.4)
107
+ const max = 20
108
+ const pct = (used / max) * 100
109
+ const variant = pct >= 90 ? "destructive" : pct >= 75 ? "warning" : "default"
110
+ return (
111
+ <div className="flex w-80 flex-col gap-4 rounded-lg border border-border bg-card p-5">
112
+ <div>
113
+ <p className="text-base font-semibold text-card-foreground">
114
+ design.bads.com storage
115
+ </p>
116
+ <p className="text-sm text-muted-foreground">
117
+ Jordan Reeves&rsquo; workspace &middot; 88 registry components
118
+ </p>
119
+ </div>
120
+ <Meter
121
+ value={used}
122
+ min={0}
123
+ max={max}
124
+ variant={variant}
125
+ label="Asset storage"
126
+ showValue
127
+ getValueLabel={(v, _min, m) => `${v.toFixed(1)} GB of ${m} GB`}
128
+ />
129
+ <button
130
+ type="button"
131
+ className="min-h-11 rounded-md border border-border px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted"
132
+ style={{
133
+ transitionDuration: "var(--duration-fast)",
134
+ transitionTimingFunction: "var(--ease-out)",
135
+ }}
136
+ onClick={() => setUsed((u) => (u >= max - 2 ? 12.4 : Math.round((u + 2.4) * 10) / 10))}
137
+ >
138
+ Upload exemplar batch (+2.4 GB)
139
+ </button>
140
+ </div>
141
+ )
142
+ },
143
+ }