@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,146 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { QRCode } from "@behavioral-agentic-design-system/core/components/ui/qr-code";
4
+ import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-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 { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
13
+
14
+ const meta: Meta<typeof QRCode> = {
15
+ title: "Components/QRCode",
16
+ component: QRCode,
17
+ parameters: {
18
+ layout: "centered",
19
+ docs: {
20
+ description: {
21
+ component:
22
+ "QR code display primitive. Encodes a string (URL, ID, TOTP URI) via the zero-dependency uqr encoder and renders the SVG with token-driven colors: dark modules inherit text-foreground through currentColor, the quiet zone comes from bg-background — no hardcoded #000/#fff, so brand re-theming propagates. A 4-module quiet zone (ISO/IEC 18004) is baked into the viewBox. Display-only: role=img with a required accessible name (aria-label ?? title ?? derived from value), never focusable, no motion. Scannability contract: keep the module/quiet-zone pair at or above ~3:1 contrast — the default pair sits near 21:1 in both modes. Dark mode renders an inverted (light-on-dark) code, which modern scanners read fine.",
23
+ },
24
+ },
25
+ },
26
+ argTypes: {
27
+ value: { control: "text" },
28
+ size: { control: { type: "number", min: 48, max: 480, step: 8 } },
29
+ errorCorrection: { control: "select", options: ["L", "M", "Q", "H"] },
30
+ title: { control: "text" },
31
+ },
32
+ };
33
+
34
+ export default meta;
35
+ type Story = StoryObj<typeof meta>;
36
+
37
+ export const Default: Story = {
38
+ args: {
39
+ value: "https://design.bads.com",
40
+ title: "Scan to open design.bads.com",
41
+ },
42
+ };
43
+
44
+ export const Size_Sm: Story = {
45
+ args: {
46
+ value: "https://design.bads.com",
47
+ size: 96,
48
+ title: "Scan to open design.bads.com",
49
+ },
50
+ };
51
+
52
+ export const Size_Default: Story = {
53
+ args: {
54
+ value: "https://design.bads.com",
55
+ size: 160,
56
+ title: "Scan to open design.bads.com",
57
+ },
58
+ };
59
+
60
+ export const Size_Lg: Story = {
61
+ args: {
62
+ value: "https://design.bads.com",
63
+ size: 240,
64
+ title: "Scan to open design.bads.com",
65
+ },
66
+ };
67
+
68
+ /**
69
+ * Higher error-correction levels survive more damage (L ≈ 7% → H ≈ 30%)
70
+ * at the cost of a denser matrix — same value, same rendered size, four
71
+ * densities side by side.
72
+ */
73
+ export const ErrorCorrection_Levels: Story = {
74
+ render: () => (
75
+ <div className="flex flex-wrap items-start gap-6">
76
+ {(["L", "M", "Q", "H"] as const).map((level) => (
77
+ <div key={level} className="flex flex-col items-center gap-2">
78
+ <QRCode
79
+ value="https://design.bads.com/docs/getting-started"
80
+ size={128}
81
+ errorCorrection={level}
82
+ title={`Getting-started guide, error correction ${level}`}
83
+ />
84
+ <p className="text-xs font-medium text-muted-foreground">
85
+ {level} ·{" "}
86
+ {level === "L"
87
+ ? "7%"
88
+ : level === "M"
89
+ ? "15%"
90
+ : level === "Q"
91
+ ? "25%"
92
+ : "30%"}{" "}
93
+ recovery
94
+ </p>
95
+ </div>
96
+ ))}
97
+ </div>
98
+ ),
99
+ };
100
+
101
+ /**
102
+ * A longer payload densifies the matrix at the same rendered size — the
103
+ * quiet zone and module contrast hold because both scale with the viewBox.
104
+ */
105
+ export const LongValue: Story = {
106
+ args: {
107
+ value:
108
+ "mailto:wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org?subject=Tokens%20v2%20proposal",
109
+ size: 200,
110
+ title: "Scan to email Wilhelmina-Constance Featherstonehaugh-Vance",
111
+ },
112
+ };
113
+
114
+ export const RealisticUse: Story = {
115
+ render: () => {
116
+ const shareUrl = "https://design.bads.com/share/tokens-v2-proposal";
117
+ return (
118
+ <Card className="w-[22rem]">
119
+ <CardHeader>
120
+ <CardTitle className="text-sm">Tokens v2 proposal</CardTitle>
121
+ <CardDescription>
122
+ Shared by Jordan Reeves · Design Systems Lead
123
+ </CardDescription>
124
+ </CardHeader>
125
+ <CardContent className="space-y-4">
126
+ <div className="flex justify-center rounded-md border bg-background p-4">
127
+ <QRCode
128
+ value={shareUrl}
129
+ size={176}
130
+ title="Scan to open the tokens v2 proposal"
131
+ />
132
+ </div>
133
+ <Separator />
134
+ <div className="flex items-center justify-between gap-3">
135
+ <p className="min-w-0 truncate text-sm text-muted-foreground" title={shareUrl}>
136
+ {shareUrl}
137
+ </p>
138
+ <CopyButton value={shareUrl} size="sm" className="min-h-11 shrink-0">
139
+ Copy link
140
+ </CopyButton>
141
+ </div>
142
+ </CardContent>
143
+ </Card>
144
+ );
145
+ },
146
+ };
@@ -2,6 +2,11 @@ import * as React from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
  import { RatingGroup } from "@behavioral-agentic-design-system/core/components/ui/rating-group";
4
4
 
5
+ // Note: the star's hover:scale-110 is a deliberate selection-preview affordance
6
+ // (documented via an allow-slop:BADS-SLOP-3 escape hatch in the component) —
7
+ // the star you're about to pick grows. This is the one place a scale hover is
8
+ // the affordance rather than a decorative pop.
9
+
5
10
  const meta: Meta<typeof RatingGroup> = {
6
11
  title: "Components/RatingGroup",
7
12
  component: RatingGroup,
@@ -19,10 +19,46 @@ export const Default: Story = {
19
19
  </div>),
20
20
  };
21
21
 
22
+ export const Label_Center: Story = {
23
+ render: () => (
24
+ <div className="w-[280px]">
25
+ <Separator label="or" />
26
+ </div>
27
+ ),
28
+ };
29
+
30
+ export const Label_Start: Story = {
31
+ render: () => (
32
+ <div className="w-[280px]">
33
+ <Separator label="Recent" labelPosition="start" />
34
+ </div>
35
+ ),
36
+ };
37
+
38
+ export const Label_End: Story = {
39
+ render: () => (
40
+ <div className="w-[280px]">
41
+ <Separator label="Archived" labelPosition="end" />
42
+ </div>
43
+ ),
44
+ };
45
+
46
+ // Regression guard: a long / non-Latin label must clip with an ellipsis inside
47
+ // its container, not push the rule out (caught by the persona UX-test pass).
48
+ export const Label_LongTruncates: Story = {
49
+ render: () => (
50
+ <div className="w-[280px]">
51
+ <Separator label="アーカイブされたプロジェクトとドラフト — a very long divider label" />
52
+ </div>
53
+ ),
54
+ };
55
+
22
56
  export const RealisticUse: Story = {
23
- render: () => (<div className="w-[280px] space-y-3">
24
- <p className="text-sm">Section one.</p>
25
- <Separator />
26
- <p className="text-sm">Section two.</p>
27
- </div>),
57
+ render: () => (
58
+ <div className="w-[280px] space-y-4">
59
+ <p className="text-sm">Continue with your work email.</p>
60
+ <Separator label="or" />
61
+ <p className="text-sm text-muted-foreground">Use a single sign-on provider instead.</p>
62
+ </div>
63
+ ),
28
64
  };
@@ -1,3 +1,4 @@
1
+ // Motion: rail hover narrowed transition-all → transition-colors (only the after-bg animates; explicit-properties rule).
1
2
  // Sidebar sticky container gained `h-svh` so the bg always spans the
2
3
  // viewport even when the menu is shorter than the screen. No new variants
3
4
  // or sizes — existing story matrix still covers the change.
@@ -50,4 +51,4 @@ export const RealisticUse: Story = {
50
51
  </SidebarContent>
51
52
  </Sidebar>
52
53
  </SidebarProvider>),
53
- };
54
+ };
@@ -0,0 +1,112 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import * as React from "react"
3
+ import { SignaturePad } from "@behavioral-agentic-design-system/core/components/ui/signature-pad"
4
+ import type { SignaturePadHandle } from "@behavioral-agentic-design-system/core/components/ui/signature-pad"
5
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
6
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label"
7
+ import {
8
+ Card,
9
+ CardContent,
10
+ CardDescription,
11
+ CardHeader,
12
+ CardTitle,
13
+ } from "@behavioral-agentic-design-system/core/components/ui/card"
14
+
15
+ const meta: Meta<typeof SignaturePad> = {
16
+ title: "Components/SignaturePad",
17
+ component: SignaturePad,
18
+ parameters: {
19
+ layout: "centered",
20
+ docs: {
21
+ description: {
22
+ component:
23
+ "Canvas-based freehand signature input for legal, consent, medical, and e-signing flows. Pointer events with setPointerCapture cover mouse, touch, and pen in one path; stroke history lives in refs so drawing never re-renders. Default ink is the computed --foreground (canvas strokeStyle can't consume var(), so var(--x) penColor values resolve via getComputedStyle at draw time — same pattern as Watermark), and a MutationObserver replays strokes on light/dark flip. Exports fill the computed --background before serializing so data URLs are opaque. Canvas is role=img + aria-label + tabIndex=0; Clear/Undo are 44×44px Button primitives (the keyboard-operable bypass for the pointer-only surface); captured/cleared state announces via aria-live=polite. Imperative handle: clear(), undo(), isEmpty(), toDataURL(type?). Strokes are held in memory only — persistence is the caller's responsibility (biometric-analog data; see the registry ethicsContract).",
24
+ },
25
+ },
26
+ },
27
+ argTypes: {
28
+ penColor: { control: "text" },
29
+ penWidth: { control: { type: "range", min: 1, max: 8, step: 0.5 } },
30
+ },
31
+ args: {
32
+ penColor: "var(--foreground)",
33
+ penWidth: 2,
34
+ },
35
+ }
36
+ export default meta
37
+ type Story = StoryObj<typeof SignaturePad>
38
+
39
+ export const Default: Story = {
40
+ render: (args) => (
41
+ <div className="w-96">
42
+ <SignaturePad {...args} />
43
+ </div>
44
+ ),
45
+ }
46
+
47
+ export const WithPenColor: Story = {
48
+ args: {
49
+ penColor: "var(--primary)",
50
+ penWidth: 3,
51
+ },
52
+ render: (args) => (
53
+ <div className="w-96">
54
+ <SignaturePad {...args} />
55
+ </div>
56
+ ),
57
+ }
58
+
59
+ export const Disabled: Story = {
60
+ render: (args) => (
61
+ <div className="w-96">
62
+ <SignaturePad {...args} disabled aria-label="Signature pad — signing is disabled" />
63
+ </div>
64
+ ),
65
+ }
66
+
67
+ export const RealisticUse: Story = {
68
+ render: function RealisticUseStory(args) {
69
+ const padRef = React.useRef<SignaturePadHandle>(null)
70
+ const [signed, setSigned] = React.useState(false)
71
+ return (
72
+ <Card className="w-[28rem]">
73
+ <CardHeader>
74
+ <CardTitle>Sign to confirm</CardTitle>
75
+ <CardDescription>
76
+ By signing below, Jordan Reeves agrees to the BADS design system
77
+ license terms effective 2026-07-25.
78
+ </CardDescription>
79
+ </CardHeader>
80
+ <CardContent className="flex flex-col gap-4">
81
+ <div className="flex flex-col gap-3">
82
+ {/* Visual heading only — the canvas's own aria-label is the
83
+ accessible name (a label can't reference a canvas). */}
84
+ <Label asChild>
85
+ <span>Signature</span>
86
+ </Label>
87
+ <SignaturePad
88
+ {...args}
89
+ ref={padRef}
90
+ aria-label="Signature pad — sign to accept the license terms"
91
+ onEnd={() => setSigned(true)}
92
+ />
93
+ </div>
94
+ <p className="text-sm text-muted-foreground">
95
+ Can&apos;t draw a signature? Contact support@bads.design to sign
96
+ with a typed name instead.
97
+ </p>
98
+ <Button
99
+ size="xl"
100
+ className="w-full"
101
+ disabled={!signed}
102
+ onClick={() => {
103
+ padRef.current?.toDataURL()
104
+ }}
105
+ >
106
+ Accept and submit
107
+ </Button>
108
+ </CardContent>
109
+ </Card>
110
+ )
111
+ },
112
+ }
@@ -21,12 +21,31 @@ export const Default: Story = {
21
21
  </div>),
22
22
  };
23
23
 
24
+ export const Variant_Circle: Story = {
25
+ render: () => (
26
+ <div className="flex items-center gap-3">
27
+ <Skeleton shape="circle" className="size-6" />
28
+ <Skeleton shape="circle" />
29
+ <Skeleton shape="circle" className="size-14" />
30
+ </div>
31
+ ),
32
+ };
33
+
34
+ export const Variant_Text: Story = {
35
+ render: () => (
36
+ <div className="w-[320px] space-y-6">
37
+ <Skeleton shape="text" />
38
+ <Skeleton shape="text" lines={3} />
39
+ </div>
40
+ ),
41
+ };
42
+
24
43
  export const RealisticUse: Story = {
25
- render: () => (<div className="flex items-center gap-3 w-[320px]">
26
- <Skeleton className="h-12 w-12 rounded-full" />
44
+ render: () => (<div className="flex items-start gap-3 w-[320px]">
45
+ <Skeleton shape="circle" className="size-12" />
27
46
  <div className="flex-1 space-y-2">
28
- <Skeleton className="h-4 w-[80%]" />
29
- <Skeleton className="h-4 w-[60%]" />
47
+ <Skeleton shape="text" className="w-[45%]" />
48
+ <Skeleton shape="text" lines={3} />
30
49
  </div>
31
50
  </div>),
32
51
  };
@@ -0,0 +1,137 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import {
4
+ SkipLink,
5
+ SkipTarget,
6
+ } from "@behavioral-agentic-design-system/core/components/ui/skip-link";
7
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
8
+ import {
9
+ Card,
10
+ CardContent,
11
+ CardHeader,
12
+ CardTitle,
13
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
14
+
15
+ const meta: Meta<typeof SkipLink> = {
16
+ title: "Components/SkipLink",
17
+ component: SkipLink,
18
+ parameters: {
19
+ layout: "padded",
20
+ docs: {
21
+ description: {
22
+ component:
23
+ "WCAG 2.4.1 (Bypass Blocks) pair: SkipLink is sr-only until keyboard focus reveals it as a fixed top-left pill (Button-primary styling, min-h-11 target, focus ring); activating it moves both scroll AND sequential focus to the paired SkipTarget (tabIndex −1, never a Tab stop). Render the link as the first focusable element on the page. Try it: click into the story canvas, then press Tab — the link appears top-left.",
24
+ },
25
+ },
26
+ },
27
+ tags: ["autodocs"],
28
+ };
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ export const Default: Story = {
34
+ render: () => (
35
+ <div>
36
+ <SkipLink href="#skiplink-demo-main" />
37
+ <p className="text-sm text-muted-foreground">
38
+ Press <kbd className="rounded border border-border px-1.5 py-0.5 font-mono text-xs">Tab</kbd>{" "}
39
+ with focus in this story — the skip link appears at the top-left of
40
+ the viewport. Activate it (Enter) and focus jumps past the fake nav
41
+ below, straight to the main region.
42
+ </p>
43
+ <nav aria-label="Primary" className="mt-4 flex gap-2">
44
+ <Button variant="ghost">Docs</Button>
45
+ <Button variant="ghost">Components</Button>
46
+ <Button variant="ghost">Tokens</Button>
47
+ <Button variant="ghost">Customize</Button>
48
+ </nav>
49
+ <SkipTarget id="skiplink-demo-main" />
50
+ <main className="mt-4 rounded-lg border border-border p-4">
51
+ <h3 className="text-base font-semibold text-foreground">
52
+ Your design system at a glance
53
+ </h3>
54
+ <p className="mt-1 text-sm text-muted-foreground">
55
+ Focus lands here after the skip — the next Tab press reaches the
56
+ first control inside the main content instead of the nav.
57
+ </p>
58
+ <Button className="mt-3" size="xl">
59
+ Review token changes
60
+ </Button>
61
+ </main>
62
+ </div>
63
+ ),
64
+ };
65
+
66
+ export const WithCustomLabel: Story = {
67
+ render: () => (
68
+ <div>
69
+ <SkipLink href="#skiplink-custom-main">Skip to token dashboard</SkipLink>
70
+ <p className="text-sm text-muted-foreground">
71
+ The visible label is the children — keep it action-shaped and
72
+ specific when the destination isn&apos;t generic (&quot;Skip to token
73
+ dashboard&quot;, &quot;Skip to search results&quot;).
74
+ </p>
75
+ <SkipTarget id="skiplink-custom-main" />
76
+ <main className="mt-4 rounded-lg border border-border p-4">
77
+ <p className="text-sm text-foreground">
78
+ Token dashboard — 12,417 references scanned, 0 orphans flagged.
79
+ </p>
80
+ </main>
81
+ </div>
82
+ ),
83
+ };
84
+
85
+ // Real content from content/personas/bads.json (primary persona pool).
86
+ export const RealisticUse: Story = {
87
+ render: () => (
88
+ <div className="overflow-hidden rounded-lg border border-border">
89
+ <SkipLink href="#skiplink-shell-main" />
90
+ <header className="flex items-center justify-between border-b border-border bg-muted px-4 py-3">
91
+ <span className="text-sm font-semibold text-foreground">
92
+ design.bads.com
93
+ </span>
94
+ <nav aria-label="Account" className="flex items-center gap-2">
95
+ <Button variant="ghost" size="sm">
96
+ Docs
97
+ </Button>
98
+ <Button variant="ghost" size="sm">
99
+ jordan.reeves
100
+ </Button>
101
+ </nav>
102
+ </header>
103
+ <div className="flex">
104
+ <nav
105
+ aria-label="Sections"
106
+ className="w-44 shrink-0 border-r border-border p-3"
107
+ >
108
+ <ul className="space-y-1 text-sm text-muted-foreground">
109
+ <li>Getting started</li>
110
+ <li>Tokens</li>
111
+ <li>Components</li>
112
+ <li>A11y contracts</li>
113
+ <li>Voice &amp; tone</li>
114
+ </ul>
115
+ </nav>
116
+ <div className="min-w-0 flex-1 p-4">
117
+ <SkipTarget id="skiplink-shell-main" />
118
+ <main>
119
+ <Card>
120
+ <CardHeader>
121
+ <CardTitle>Tokens v2 proposal</CardTitle>
122
+ </CardHeader>
123
+ <CardContent className="space-y-2">
124
+ <p className="text-sm text-muted-foreground">
125
+ Jordan Reeves shared 36 components for review at
126
+ design.bads.com/share/tokens-v2-proposal. Every pair holds
127
+ the 7:1 contrast floor.
128
+ </p>
129
+ <Button size="xl">Open review</Button>
130
+ </CardContent>
131
+ </Card>
132
+ </main>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ ),
137
+ };
@@ -38,6 +38,34 @@ export const Disabled: Story = {
38
38
  ),
39
39
  };
40
40
 
41
+ /**
42
+ * `marks` renders decorative tick dots along the track. The object form
43
+ * (`{ value, label }`) adds a label below each tick; the bare-number form
44
+ * renders a dot only. Marks are `aria-hidden` — the thumb still announces the
45
+ * value — and never change the default rendering when omitted.
46
+ */
47
+ export const WithMarks: Story = {
48
+ args: {
49
+ defaultValue: [50],
50
+ min: 0,
51
+ max: 100,
52
+ step: 25,
53
+ "aria-label": "Quality",
54
+ marks: [
55
+ { value: 0, label: "Low" },
56
+ { value: 25 },
57
+ { value: 50, label: "Medium" },
58
+ { value: 75 },
59
+ { value: 100, label: "High" },
60
+ ],
61
+ },
62
+ render: (args) => (
63
+ <div className="w-72">
64
+ <Slider {...args} />
65
+ </div>
66
+ ),
67
+ };
68
+
41
69
  export const RealisticUse: Story = {
42
70
  render: () => (
43
71
  <div className="w-80 space-y-6">
@@ -0,0 +1,122 @@
1
+ import * as React from "react"
2
+ import type { Meta, StoryObj } from "@storybook/react"
3
+ import { Spoiler } from "@behavioral-agentic-design-system/core/components/ui/spoiler"
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardHeader,
8
+ CardTitle,
9
+ CardDescription,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card"
11
+
12
+ const meta: Meta<typeof Spoiler> = {
13
+ title: "Components/Spoiler",
14
+ component: Spoiler,
15
+ parameters: { layout: "centered" },
16
+ tags: ["autodocs"],
17
+ argTypes: {
18
+ maxHeight: { control: "number" },
19
+ showLabel: { control: "text" },
20
+ hideLabel: { control: "text" },
21
+ },
22
+ }
23
+
24
+ export default meta
25
+ type Story = StoryObj<typeof meta>
26
+
27
+ // Content pulled from content/personas/bads.json (primary persona pool,
28
+ // long_form entries added alongside this component).
29
+
30
+ const JORDAN_BIO =
31
+ "Jordan Reeves leads the design systems practice at a mid-size product company in Austin. They spent six years shipping component libraries before this one — first a homegrown Sass framework nobody documented, then a Figma-library-only system that drifted from the code within a quarter. Now they run a three-person team that owns the tokens, reviews every new primitive against its a11y contract, and pressure-tests each release against the personas file before it ships. Jordan reads component source before adopting anything, cares about 7:1 contrast the way other people care about typography, and will absolutely bounce a PR for a hardcoded hex value."
32
+
33
+ const SEOYUN_BIO =
34
+ "Seo-yun Park is a senior design engineer who joined the platform team to stop the same button being rebuilt in four codebases. She wrote the team's first token pipeline, wired Storybook coverage into pre-commit, and now spends most weeks reviewing variants against the registry and talking product teams out of one-off components. Her rule of thumb: if a primitive needs a paragraph of explanation, the API is wrong."
35
+
36
+ const RELEASE_NOTE =
37
+ "This release adds three primitives to the registry, tightens the focus-ring offset to 2px across every interactive component, and regenerates both CSS files from tokens.json. The orphan-token lint now runs quarterly instead of weekly after two false-positive cycles flagged chart-config inputs that were never meant to be utility classes. Upgrading is a standard package bump — no breaking API changes, but re-run pnpm build:tokens if your fork overrides the motion durations."
38
+
39
+ export const Default: Story = {
40
+ render: () => (
41
+ <div className="w-96">
42
+ <Spoiler maxHeight={96}>
43
+ <p className="text-sm leading-relaxed text-foreground">{JORDAN_BIO}</p>
44
+ </Spoiler>
45
+ </div>
46
+ ),
47
+ }
48
+
49
+ // Content shorter than maxHeight → NO toggle renders. The measured,
50
+ // conditional control is the component's contract — short content must
51
+ // never grow a dead "Show more" button.
52
+ export const ShortContent: Story = {
53
+ render: () => (
54
+ <div className="w-96 space-y-2">
55
+ <Spoiler maxHeight={96}>
56
+ <p className="text-sm leading-relaxed text-foreground">
57
+ 36 components, all passing AAA contrast. Last token change was 3
58
+ days ago.
59
+ </p>
60
+ </Spoiler>
61
+ <p className="text-xs text-muted-foreground">
62
+ Fits under maxHeight — the content renders plain, with no toggle in
63
+ the DOM.
64
+ </p>
65
+ </div>
66
+ ),
67
+ }
68
+
69
+ function ControlledExpanded() {
70
+ const [expanded, setExpanded] = React.useState(true)
71
+ return (
72
+ <div className="w-96 space-y-2">
73
+ <Spoiler
74
+ maxHeight={96}
75
+ expanded={expanded}
76
+ onExpandedChange={setExpanded}
77
+ >
78
+ <p className="text-sm leading-relaxed text-foreground">{SEOYUN_BIO}</p>
79
+ </Spoiler>
80
+ <p className="text-xs text-muted-foreground">
81
+ Controlled — currently {expanded ? "expanded" : "collapsed"} via the
82
+ expanded / onExpandedChange pair.
83
+ </p>
84
+ </div>
85
+ )
86
+ }
87
+
88
+ export const Expanded: Story = {
89
+ render: () => <ControlledExpanded />,
90
+ }
91
+
92
+ export const CustomLabels: Story = {
93
+ render: () => (
94
+ <div className="w-96">
95
+ <Spoiler
96
+ maxHeight={96}
97
+ showLabel="Read the full bio"
98
+ hideLabel="Collapse bio"
99
+ >
100
+ <p className="text-sm leading-relaxed text-foreground">{JORDAN_BIO}</p>
101
+ </Spoiler>
102
+ </div>
103
+ ),
104
+ }
105
+
106
+ export const RealisticUse: Story = {
107
+ render: () => (
108
+ <Card className="w-96">
109
+ <CardHeader>
110
+ <CardTitle>Release notes — v2.4.0</CardTitle>
111
+ <CardDescription>Published 2026-05-26 · design.bads.com</CardDescription>
112
+ </CardHeader>
113
+ <CardContent>
114
+ <Spoiler maxHeight={72} showLabel="Read full notes" hideLabel="Show less">
115
+ <p className="text-sm leading-relaxed text-muted-foreground">
116
+ {RELEASE_NOTE}
117
+ </p>
118
+ </Spoiler>
119
+ </CardContent>
120
+ </Card>
121
+ ),
122
+ }
@@ -1,3 +1,4 @@
1
+ // Motion: trigger narrowed transition-all → transition-colors (explicit-properties rule).
1
2
  // scrollbar-none (Tailwind v4.3 utility) replaces old scrollbar-width/webkit-scrollbar workaround
2
3
  import { useState } from "react";
3
4
  import { Meta, StoryObj } from "@storybook/react";
@@ -149,4 +150,4 @@ export const Interaction_Switches: Story = {
149
150
  expect(usageTab).toHaveAttribute("data-state", "active");
150
151
  expect(canvas.getByText("Usage statistics panel.")).toBeVisible();
151
152
  },
152
- };
153
+ };