@behavioral-agentic-design-system/core 0.27.0 → 0.28.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.
@@ -0,0 +1,226 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { RollingNumber } from "@behavioral-agentic-design-system/core/components/ui/rolling-number";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardHeader,
8
+ CardTitle,
9
+ CardDescription,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
12
+
13
+ const meta: Meta<typeof RollingNumber> = {
14
+ title: "Components/RollingNumber",
15
+ component: RollingNumber,
16
+ parameters: {
17
+ layout: "centered",
18
+ docs: {
19
+ description: {
20
+ component:
21
+ "Animated digit counter — each digit independently scrolls (odometer/slot-machine style) when the value prop changes. Distinct from FormatNumber (static), Stat (layout), and Timer (live interval). Use for KPI milestones, revenue counters, real-time stats. Token-driven motion: var(--duration-base) + var(--ease-spring). aria-label carries the formatted value; aria-live='polite' announces changes to screen readers. Reduced-motion users see an instant value swap.",
22
+ },
23
+ },
24
+ },
25
+ tags: ["autodocs"],
26
+ };
27
+
28
+ export default meta;
29
+ type Story = StoryObj<typeof meta>;
30
+
31
+ export const Default: Story = {
32
+ render: () => {
33
+ const [value, setValue] = React.useState(1247);
34
+ return (
35
+ <div className="flex flex-col items-center gap-4">
36
+ <RollingNumber value={value} className="text-4xl font-bold" />
37
+ <div className="flex gap-2">
38
+ <Button
39
+ size="xl"
40
+ variant="outline"
41
+ onClick={() => setValue((v) => Math.max(0, v - 137))}
42
+ >
43
+ −137
44
+ </Button>
45
+ <Button size="xl" onClick={() => setValue((v) => v + 137)}>
46
+ +137
47
+ </Button>
48
+ </div>
49
+ <p className="text-sm text-muted-foreground">
50
+ Each digit column animates independently on value change.
51
+ </p>
52
+ </div>
53
+ );
54
+ },
55
+ };
56
+
57
+ export const WithPrefix: Story = {
58
+ render: () => {
59
+ const [value, setValue] = React.useState(24819);
60
+ return (
61
+ <div className="flex flex-col items-center gap-4">
62
+ <RollingNumber
63
+ value={value}
64
+ prefix="$"
65
+ thousandSeparator=","
66
+ className="text-3xl font-semibold tabular-nums"
67
+ />
68
+ <div className="flex gap-2">
69
+ <Button
70
+ size="xl"
71
+ variant="outline"
72
+ onClick={() => setValue((v) => Math.max(0, v - 1000))}
73
+ >
74
+ −$1,000
75
+ </Button>
76
+ <Button size="xl" onClick={() => setValue((v) => v + 1000)}>
77
+ +$1,000
78
+ </Button>
79
+ </div>
80
+ </div>
81
+ );
82
+ },
83
+ };
84
+
85
+ export const WithSuffix: Story = {
86
+ render: () => {
87
+ const [value, setValue] = React.useState(87);
88
+ return (
89
+ <div className="flex flex-col items-center gap-4">
90
+ <RollingNumber
91
+ value={value}
92
+ suffix="%"
93
+ decimalScale={1}
94
+ fixedDecimalScale
95
+ className="text-4xl font-bold"
96
+ />
97
+ <div className="flex gap-2">
98
+ <Button
99
+ size="xl"
100
+ variant="outline"
101
+ onClick={() => setValue((v) => Math.max(0, parseFloat((v - 2.3).toFixed(1))))}
102
+ >
103
+ −2.3
104
+ </Button>
105
+ <Button
106
+ size="xl"
107
+ onClick={() => setValue((v) => Math.min(100, parseFloat((v + 2.3).toFixed(1))))}
108
+ >
109
+ +2.3
110
+ </Button>
111
+ </div>
112
+ </div>
113
+ );
114
+ },
115
+ };
116
+
117
+ export const WithDecimals: Story = {
118
+ render: () => {
119
+ const [value, setValue] = React.useState(3.14159);
120
+ return (
121
+ <div className="flex flex-col items-center gap-4">
122
+ <RollingNumber
123
+ value={value}
124
+ decimalScale={2}
125
+ fixedDecimalScale
126
+ prefix="π ≈ "
127
+ className="text-3xl font-mono"
128
+ />
129
+ <div className="flex gap-2">
130
+ <Button
131
+ size="xl"
132
+ variant="outline"
133
+ onClick={() => setValue((v) => parseFloat((v - 0.37).toFixed(2)))}
134
+ >
135
+ −0.37
136
+ </Button>
137
+ <Button
138
+ size="xl"
139
+ onClick={() => setValue((v) => parseFloat((v + 0.37).toFixed(2)))}
140
+ >
141
+ +0.37
142
+ </Button>
143
+ </div>
144
+ </div>
145
+ );
146
+ },
147
+ };
148
+
149
+ export const RealisticUse: Story = {
150
+ render: () => {
151
+ const [revenue, setRevenue] = React.useState(142830);
152
+ const [users, setUsers] = React.useState(8471);
153
+ const [rate, setRate] = React.useState(94);
154
+
155
+ return (
156
+ <div className="w-full max-w-2xl space-y-4">
157
+ <div className="grid grid-cols-3 gap-4">
158
+ <Card>
159
+ <CardHeader className="pb-2">
160
+ <CardDescription>Monthly Revenue</CardDescription>
161
+ </CardHeader>
162
+ <CardContent>
163
+ <RollingNumber
164
+ value={revenue}
165
+ prefix="$"
166
+ thousandSeparator=","
167
+ className="text-2xl font-bold"
168
+ />
169
+ </CardContent>
170
+ </Card>
171
+ <Card>
172
+ <CardHeader className="pb-2">
173
+ <CardDescription>Active Users</CardDescription>
174
+ </CardHeader>
175
+ <CardContent>
176
+ <RollingNumber
177
+ value={users}
178
+ thousandSeparator=","
179
+ className="text-2xl font-bold"
180
+ />
181
+ </CardContent>
182
+ </Card>
183
+ <Card>
184
+ <CardHeader className="pb-2">
185
+ <CardDescription>Uptime</CardDescription>
186
+ </CardHeader>
187
+ <CardContent>
188
+ <RollingNumber
189
+ value={rate}
190
+ suffix="%"
191
+ decimalScale={1}
192
+ fixedDecimalScale
193
+ className="text-2xl font-bold"
194
+ />
195
+ </CardContent>
196
+ </Card>
197
+ </div>
198
+ <div className="flex gap-2">
199
+ <Button
200
+ size="xl"
201
+ variant="outline"
202
+ className="flex-1"
203
+ onClick={() => {
204
+ setRevenue((v) => v + Math.floor(Math.random() * 5000) + 500);
205
+ setUsers((v) => v + Math.floor(Math.random() * 50) + 10);
206
+ setRate((v) => Math.min(99.9, parseFloat((v + 0.1).toFixed(1))));
207
+ }}
208
+ >
209
+ Simulate update
210
+ </Button>
211
+ <Button
212
+ size="xl"
213
+ variant="ghost"
214
+ onClick={() => {
215
+ setRevenue(142830);
216
+ setUsers(8471);
217
+ setRate(94);
218
+ }}
219
+ >
220
+ Reset
221
+ </Button>
222
+ </div>
223
+ </div>
224
+ );
225
+ },
226
+ };
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ // sm/default vertical padding bumped (py-1→py-1.5, py-1.5→py-2) for breathing room, 2026-08-06
2
3
  import type { Meta, StoryObj } from "@storybook/react";
3
4
  import { TypingIndicator } from "@behavioral-agentic-design-system/core/components/ui/typing-indicator";
4
5
  import { Avatar, AvatarFallback, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react"
2
+ // word-rotate baseline (inline-block+overflow-hidden dropped the baseline; fixed to align-baseline, 2026-08-06)
2
3
  import { WordRotate } from "@behavioral-agentic-design-system/core/components/ui/word-rotate"
3
4
 
4
5
  const meta: Meta<typeof WordRotate> = {