@behavioral-agentic-design-system/core 0.39.0 → 0.40.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 -3
- package/scripts/a11y-lint.cjs +93 -39
- package/scripts/a11y-ratchet.mjs +10 -23
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +175 -17
- package/scripts/check-stories.mjs +1 -1
- package/scripts/health-report.mjs +52 -10
- package/scripts/lib/scan-roots.cjs +143 -0
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/lint-slop.mjs +21 -28
- package/scripts/lint-token-intent.mjs +10 -16
- package/scripts/size-audit.cjs +94 -27
- package/scripts/source-of-truth.cjs +58 -0
- package/scripts/ux-smoke.mjs +438 -0
- package/scripts/wcag-audit.cjs +49 -1
- package/src/api/layers/file.ts +2 -0
- package/src/app/preview/components/page.tsx +972 -0
- package/src/app/preview/health/page.tsx +8 -5
- package/src/app/preview/history/page.tsx +11 -0
- package/src/app/shell.tsx +261 -87
- package/src/components/customize/brand-mark-section.tsx +4 -2
- package/src/components/customize/design-controls.tsx +1 -1
- package/src/components/customize/discipline-section.tsx +91 -0
- package/src/components/customize/font-pickers.tsx +1 -1
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/save-bar.tsx +2 -2
- package/src/components/customize/theme-io.tsx +7 -7
- package/src/components/customize/type-scale.tsx +1 -1
- package/src/components/customize-tab.tsx +9 -4
- package/src/components/home-tab.tsx +3 -0
- package/src/components/ui/accordion.tsx +7 -0
- package/src/components/ui/alert.tsx +1 -0
- package/src/components/ui/announcement-bar.tsx +256 -0
- package/src/components/ui/badge.tsx +1 -0
- package/src/components/ui/callout.tsx +218 -0
- package/src/components/ui/chart.tsx +2 -14
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/format-relative-time.tsx +139 -0
- package/src/components/ui/grid.tsx +255 -0
- package/src/components/ui/icon.tsx +108 -0
- package/src/components/ui/index.ts +8 -0
- package/src/components/ui/page-header.tsx +63 -0
- package/src/components/ui/portal.tsx +111 -0
- package/src/components/ui/presence.tsx +172 -0
- package/src/components/ui/progress-stack.tsx +258 -0
- package/src/components/ui/select.tsx +89 -4
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/slider.tsx +83 -3
- package/src/components/ui/sparkline.tsx +15 -15
- package/src/components/ui/textarea.tsx +28 -1
- package/src/data/docs-index.ts +5 -0
- package/src/data/history.json +269 -0
- package/src/hooks/use-reduced-motion.ts +6 -0
- package/src/stories/Accordion.stories.tsx +59 -0
- package/src/stories/Alert.stories.tsx +3 -1
- package/src/stories/AnnouncementBar.stories.tsx +261 -0
- package/src/stories/Badge.stories.tsx +3 -0
- package/src/stories/Calendar.stories.tsx +1 -1
- package/src/stories/Callout.stories.tsx +219 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/ColorPicker.stories.tsx +23 -0
- package/src/stories/FormatRelativeTime.stories.tsx +116 -0
- package/src/stories/Grid.stories.tsx +197 -0
- package/src/stories/Icon.stories.tsx +175 -0
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/PageHeader.stories.tsx +102 -0
- package/src/stories/Portal.stories.tsx +189 -0
- package/src/stories/Presence.stories.tsx +228 -0
- package/src/stories/ProgressStack.stories.tsx +287 -0
- package/src/stories/Select.stories.tsx +25 -0
- package/src/stories/Separator.stories.tsx +3 -0
- package/src/stories/Sheet.stories.tsx +9 -3
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Sparkline.stories.tsx +39 -0
- package/src/stories/Textarea.stories.tsx +18 -0
- package/src/stories/story-groups.json +14 -5
- package/src/styles.css +133 -12
|
@@ -34,7 +34,14 @@ const USER_DATA = [82, 95, 104, 98, 117, 131, 128, 142]
|
|
|
34
34
|
const CHURN_DATA = [8.2, 7.9, 8.5, 7.4, 7.1, 6.8, 6.3, 6.0]
|
|
35
35
|
// Negative / mixed dataset
|
|
36
36
|
const NEGATIVE_DATA = [-12, 4, -8, 15, -3, 22, 8, -5]
|
|
37
|
+
// Flat dataset — a metric that hasn't moved. Exercises the `max === min`
|
|
38
|
+
// branch of the domain padding, which is the only path where the series has
|
|
39
|
+
// no range of its own to scale against.
|
|
40
|
+
const FLAT_DATA = [64, 64, 64, 64, 64, 64, 64, 64]
|
|
37
41
|
|
|
42
|
+
// The entrance draw-in follows the shared `useReducedMotion` hook
|
|
43
|
+
// (hooks/use-reduced-motion), the same one ChartContainer reads, so a
|
|
44
|
+
// reduced-motion user gets the final frame immediately in every story below.
|
|
38
45
|
export const Default: Story = {
|
|
39
46
|
render: () => (
|
|
40
47
|
<div className="flex flex-col gap-2">
|
|
@@ -110,6 +117,38 @@ export const Negative: Story = {
|
|
|
110
117
|
),
|
|
111
118
|
}
|
|
112
119
|
|
|
120
|
+
export const FlatData: Story = {
|
|
121
|
+
// Two sparklines side by side is the point of this story: it proves the flat
|
|
122
|
+
// path centres the series in both area and line mode. That can't be driven
|
|
123
|
+
// from a single set of args, so the Controls panel is disabled rather than
|
|
124
|
+
// left present and inert (check:story-controls).
|
|
125
|
+
parameters: { controls: { disable: true } },
|
|
126
|
+
render: () => (
|
|
127
|
+
<div className="flex flex-col gap-4">
|
|
128
|
+
<div className="flex flex-col gap-1">
|
|
129
|
+
<Sparkline
|
|
130
|
+
data={FLAT_DATA}
|
|
131
|
+
type="area"
|
|
132
|
+
className="w-32"
|
|
133
|
+
aria-label="Flat trend, no change over the period"
|
|
134
|
+
/>
|
|
135
|
+
<p className="text-xs text-muted-foreground">Area — no change</p>
|
|
136
|
+
</div>
|
|
137
|
+
<div className="flex flex-col gap-1">
|
|
138
|
+
<Sparkline
|
|
139
|
+
data={FLAT_DATA}
|
|
140
|
+
type="line"
|
|
141
|
+
className="w-32"
|
|
142
|
+
aria-label="Flat trend line, no change over the period"
|
|
143
|
+
/>
|
|
144
|
+
<p className="text-xs text-muted-foreground">
|
|
145
|
+
Line — the series sits mid-box rather than pinned to an edge
|
|
146
|
+
</p>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
),
|
|
150
|
+
}
|
|
151
|
+
|
|
113
152
|
export const RealisticUse: Story = {
|
|
114
153
|
render: () => {
|
|
115
154
|
const stats = [
|
|
@@ -119,3 +119,21 @@ export const RealisticUse: Story = {
|
|
|
119
119
|
</div>
|
|
120
120
|
),
|
|
121
121
|
};
|
|
122
|
+
|
|
123
|
+
export const MaxRows: Story = {
|
|
124
|
+
// Static story — maxRows is the feature under test, not a driven arg.
|
|
125
|
+
parameters: { controls: { disable: true } },
|
|
126
|
+
render: () => (
|
|
127
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
128
|
+
<Label htmlFor="maxrows-demo">Note (max 4 rows)</Label>
|
|
129
|
+
<Textarea
|
|
130
|
+
id="maxrows-demo"
|
|
131
|
+
placeholder="Start typing — the field grows up to 4 rows then scrolls."
|
|
132
|
+
maxRows={4}
|
|
133
|
+
/>
|
|
134
|
+
<p className="text-xs text-muted-foreground">
|
|
135
|
+
Auto-grows with content; caps at 4 lines.
|
|
136
|
+
</p>
|
|
137
|
+
</div>
|
|
138
|
+
),
|
|
139
|
+
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"story files.",
|
|
16
16
|
"",
|
|
17
17
|
"GROUP NAMES ARE FOR PEOPLE SCANNING A SIDEBAR. They are not an architectural",
|
|
18
|
-
"statement and they are not the layer model
|
|
18
|
+
"statement and they are not the layer model — they answer 'where would someone",
|
|
19
19
|
"look for this', which is why Accordion sits under Layout rather than Actions",
|
|
20
20
|
"and Carousel sits under Layout rather than Content.",
|
|
21
21
|
"",
|
|
@@ -124,12 +124,16 @@
|
|
|
124
124
|
"Meter",
|
|
125
125
|
"Timer",
|
|
126
126
|
"TypingIndicator",
|
|
127
|
-
"ToggleTip"
|
|
127
|
+
"ToggleTip",
|
|
128
|
+
"Presence",
|
|
129
|
+
"Callout",
|
|
130
|
+
"AnnouncementBar"
|
|
128
131
|
],
|
|
129
132
|
"Layout": [
|
|
130
133
|
"Container",
|
|
131
134
|
"Stack",
|
|
132
135
|
"SimpleGrid",
|
|
136
|
+
"Grid",
|
|
133
137
|
"Masonry",
|
|
134
138
|
"Separator",
|
|
135
139
|
"AspectRatio",
|
|
@@ -146,7 +150,8 @@
|
|
|
146
150
|
"FloatingIndicator",
|
|
147
151
|
"FloatingPanel",
|
|
148
152
|
"Carousel",
|
|
149
|
-
"Card"
|
|
153
|
+
"Card",
|
|
154
|
+
"PageHeader"
|
|
150
155
|
],
|
|
151
156
|
"Content and data": [
|
|
152
157
|
"Table",
|
|
@@ -166,12 +171,15 @@
|
|
|
166
171
|
"FormatByte",
|
|
167
172
|
"FormatNumber",
|
|
168
173
|
"FormatDate",
|
|
174
|
+
"FormatRelativeTime",
|
|
169
175
|
"RollingNumber",
|
|
170
176
|
"Watermark",
|
|
171
177
|
"Marquee",
|
|
172
178
|
"WordRotate",
|
|
173
179
|
"Reveal",
|
|
174
|
-
"Sparkline"
|
|
180
|
+
"Sparkline",
|
|
181
|
+
"Icon",
|
|
182
|
+
"ProgressStack"
|
|
175
183
|
],
|
|
176
184
|
"Badges and avatars": [
|
|
177
185
|
"Avatar",
|
|
@@ -194,6 +202,7 @@
|
|
|
194
202
|
"HoverCard",
|
|
195
203
|
"Tooltip",
|
|
196
204
|
"ContextMenu",
|
|
197
|
-
"DropdownMenu"
|
|
205
|
+
"DropdownMenu",
|
|
206
|
+
"Portal"
|
|
198
207
|
]
|
|
199
208
|
}
|
package/src/styles.css
CHANGED
|
@@ -272,10 +272,18 @@
|
|
|
272
272
|
:root above already defines --font-sans, and Tailwind picks it up
|
|
273
273
|
for the font-sans utility automatically. */
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
/* Per-step override hook, same shape as the type scale above: a fork whose
|
|
276
|
+
brand radius ramp isn't linear-from-one-base (e.g. Furnished Finder's
|
|
277
|
+
4/8/12/16, which no single --radius value produces from these calc()s)
|
|
278
|
+
sets --radius-sm-size etc. directly. Also closes the duplicate-value
|
|
279
|
+
trap this used to have — a brand file that declared --radius-lg in
|
|
280
|
+
:root created a second, silently-losing value under the same name as
|
|
281
|
+
this computed one; the override name is now distinct from the utility
|
|
282
|
+
name it feeds. */
|
|
283
|
+
--radius-sm: var(--radius-sm-size, calc(var(--radius) - 4px));
|
|
284
|
+
--radius-md: var(--radius-md-size, calc(var(--radius) - 2px));
|
|
285
|
+
--radius-lg: var(--radius-lg-size, var(--radius));
|
|
286
|
+
--radius-xl: var(--radius-xl-size, calc(var(--radius) + 4px));
|
|
279
287
|
|
|
280
288
|
/* Map Tailwind's shadow-* utilities through to the :root --shadow-* tokens
|
|
281
289
|
so the Customize tab's Shadow Opacity slider takes effect. Without this
|
|
@@ -328,12 +336,15 @@
|
|
|
328
336
|
/* Marketing tier — display sizes for landing pages, hero blocks, editorial.
|
|
329
337
|
Tailwind only emits utilities that get used, so a non-marketing fork pays
|
|
330
338
|
nothing for these. line-height drops to 1.1 at scale to keep big type
|
|
331
|
-
readable; tracking tightens slightly to compensate for optical loosening.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
--text-
|
|
336
|
-
--text-
|
|
339
|
+
readable; tracking tightens slightly to compensate for optical loosening.
|
|
340
|
+
Same --text-*-size override hook as the body tier above, so a fork with
|
|
341
|
+
its own display scale (corrections.md-class drift otherwise) can retarget
|
|
342
|
+
these steps too instead of hitting a cliff at text-4xl. */
|
|
343
|
+
--text-4xl: calc(var(--text-4xl-size, 36px) * var(--font-size-scale, 1));
|
|
344
|
+
--text-5xl: calc(var(--text-5xl-size, 48px) * var(--font-size-scale, 1));
|
|
345
|
+
--text-6xl: calc(var(--text-6xl-size, 60px) * var(--font-size-scale, 1));
|
|
346
|
+
--text-7xl: calc(var(--text-7xl-size, 72px) * var(--font-size-scale, 1));
|
|
347
|
+
--text-8xl: calc(var(--text-8xl-size, 96px) * var(--font-size-scale, 1));
|
|
337
348
|
--text-4xl--line-height: 1.15;
|
|
338
349
|
--text-5xl--line-height: 1.10;
|
|
339
350
|
--text-6xl--line-height: 1.05;
|
|
@@ -427,8 +438,19 @@
|
|
|
427
438
|
body { transition: none; }
|
|
428
439
|
}
|
|
429
440
|
/* WCAG AAA 1.4.8: paragraph spacing ≥ 1.5× line-height inside running
|
|
430
|
-
text.
|
|
431
|
-
|
|
441
|
+
text. Last-child has no trailing margin so containers don't get extra
|
|
442
|
+
padding.
|
|
443
|
+
|
|
444
|
+
"UI primitives stay tight" is NOT this rule's doing — it is the flex/grid
|
|
445
|
+
carve-out immediately below, and you cannot tell that by reading this
|
|
446
|
+
selector. Measured 2026-09-11 across all eight rail destinations: exactly
|
|
447
|
+
18 paragraphs in the whole app compute to 1.5em, all of them section
|
|
448
|
+
descriptions on the Components showcase, which is running text and is
|
|
449
|
+
what the rule is for. EmptyState, Stepper, Questionnaire, FileUpload and
|
|
450
|
+
HoverCard all compute to margin-bottom 0 because their content sits in a
|
|
451
|
+
flex column. Every one of those five had been reported as "loosened by
|
|
452
|
+
this rule" from counting <p> tags in source rather than reading the DOM.
|
|
453
|
+
If you are about to rescope or delete this rule, measure first. */
|
|
432
454
|
p:not(:last-child) {
|
|
433
455
|
margin-bottom: 1.5em;
|
|
434
456
|
}
|
|
@@ -792,6 +814,105 @@ html, body {
|
|
|
792
814
|
animation: progress-stripe var(--progress-stripe-duration, 1s) linear infinite;
|
|
793
815
|
}
|
|
794
816
|
|
|
817
|
+
/* Presence enter/exit keyframes — applied via the data-slot + data-transition
|
|
818
|
+
+ data-state selectors the Presence primitive sets (spec §4 pattern (b):
|
|
819
|
+
plain CSS in the design-system layer, no Tailwind utility generation in
|
|
820
|
+
the path). The component flips data-state to "closed" and waits on
|
|
821
|
+
element.getAnimations() before unmounting, so the -out keyframe is what
|
|
822
|
+
the user actually sees.
|
|
823
|
+
|
|
824
|
+
- fill-mode "both" is load-bearing: the -out keyframe must HOLD its final
|
|
825
|
+
frame (opacity 0) until React commits the unmount, otherwise the element
|
|
826
|
+
pops back to fully visible for one frame after animationend.
|
|
827
|
+
- Translate distances are small (0.5rem) so the motion reads as a settle,
|
|
828
|
+
not a slide; scale starts at .96 for the same reason.
|
|
829
|
+
- Reduced motion: the base layer forces animation-duration to 0.01ms; the
|
|
830
|
+
finished promise still resolves, so the unmount is effectively instant. */
|
|
831
|
+
@keyframes presence-fade-in {
|
|
832
|
+
from { opacity: 0; }
|
|
833
|
+
to { opacity: 1; }
|
|
834
|
+
}
|
|
835
|
+
@keyframes presence-fade-out {
|
|
836
|
+
from { opacity: 1; }
|
|
837
|
+
to { opacity: 0; }
|
|
838
|
+
}
|
|
839
|
+
@keyframes presence-scale-in {
|
|
840
|
+
from { opacity: 0; transform: scale(0.96); }
|
|
841
|
+
to { opacity: 1; transform: scale(1); }
|
|
842
|
+
}
|
|
843
|
+
@keyframes presence-scale-out {
|
|
844
|
+
from { opacity: 1; transform: scale(1); }
|
|
845
|
+
to { opacity: 0; transform: scale(0.96); }
|
|
846
|
+
}
|
|
847
|
+
@keyframes presence-slide-up-in {
|
|
848
|
+
from { opacity: 0; transform: translateY(0.5rem); }
|
|
849
|
+
to { opacity: 1; transform: translateY(0); }
|
|
850
|
+
}
|
|
851
|
+
@keyframes presence-slide-up-out {
|
|
852
|
+
from { opacity: 1; transform: translateY(0); }
|
|
853
|
+
to { opacity: 0; transform: translateY(0.5rem); }
|
|
854
|
+
}
|
|
855
|
+
@keyframes presence-slide-down-in {
|
|
856
|
+
from { opacity: 0; transform: translateY(-0.5rem); }
|
|
857
|
+
to { opacity: 1; transform: translateY(0); }
|
|
858
|
+
}
|
|
859
|
+
@keyframes presence-slide-down-out {
|
|
860
|
+
from { opacity: 1; transform: translateY(0); }
|
|
861
|
+
to { opacity: 0; transform: translateY(-0.5rem); }
|
|
862
|
+
}
|
|
863
|
+
@keyframes presence-slide-left-in {
|
|
864
|
+
from { opacity: 0; transform: translateX(0.5rem); }
|
|
865
|
+
to { opacity: 1; transform: translateX(0); }
|
|
866
|
+
}
|
|
867
|
+
@keyframes presence-slide-left-out {
|
|
868
|
+
from { opacity: 1; transform: translateX(0); }
|
|
869
|
+
to { opacity: 0; transform: translateX(0.5rem); }
|
|
870
|
+
}
|
|
871
|
+
@keyframes presence-slide-right-in {
|
|
872
|
+
from { opacity: 0; transform: translateX(-0.5rem); }
|
|
873
|
+
to { opacity: 1; transform: translateX(0); }
|
|
874
|
+
}
|
|
875
|
+
@keyframes presence-slide-right-out {
|
|
876
|
+
from { opacity: 1; transform: translateX(0); }
|
|
877
|
+
to { opacity: 0; transform: translateX(-0.5rem); }
|
|
878
|
+
}
|
|
879
|
+
[data-slot="presence"][data-transition="fade"][data-state="open"] {
|
|
880
|
+
animation: presence-fade-in var(--duration-base) var(--ease-out) both;
|
|
881
|
+
}
|
|
882
|
+
[data-slot="presence"][data-transition="fade"][data-state="closed"] {
|
|
883
|
+
animation: presence-fade-out var(--duration-base) var(--ease-out) both;
|
|
884
|
+
}
|
|
885
|
+
[data-slot="presence"][data-transition="scale"][data-state="open"] {
|
|
886
|
+
animation: presence-scale-in var(--duration-base) var(--ease-out) both;
|
|
887
|
+
}
|
|
888
|
+
[data-slot="presence"][data-transition="scale"][data-state="closed"] {
|
|
889
|
+
animation: presence-scale-out var(--duration-base) var(--ease-out) both;
|
|
890
|
+
}
|
|
891
|
+
[data-slot="presence"][data-transition="slide-up"][data-state="open"] {
|
|
892
|
+
animation: presence-slide-up-in var(--duration-base) var(--ease-out) both;
|
|
893
|
+
}
|
|
894
|
+
[data-slot="presence"][data-transition="slide-up"][data-state="closed"] {
|
|
895
|
+
animation: presence-slide-up-out var(--duration-base) var(--ease-out) both;
|
|
896
|
+
}
|
|
897
|
+
[data-slot="presence"][data-transition="slide-down"][data-state="open"] {
|
|
898
|
+
animation: presence-slide-down-in var(--duration-base) var(--ease-out) both;
|
|
899
|
+
}
|
|
900
|
+
[data-slot="presence"][data-transition="slide-down"][data-state="closed"] {
|
|
901
|
+
animation: presence-slide-down-out var(--duration-base) var(--ease-out) both;
|
|
902
|
+
}
|
|
903
|
+
[data-slot="presence"][data-transition="slide-left"][data-state="open"] {
|
|
904
|
+
animation: presence-slide-left-in var(--duration-base) var(--ease-out) both;
|
|
905
|
+
}
|
|
906
|
+
[data-slot="presence"][data-transition="slide-left"][data-state="closed"] {
|
|
907
|
+
animation: presence-slide-left-out var(--duration-base) var(--ease-out) both;
|
|
908
|
+
}
|
|
909
|
+
[data-slot="presence"][data-transition="slide-right"][data-state="open"] {
|
|
910
|
+
animation: presence-slide-right-in var(--duration-base) var(--ease-out) both;
|
|
911
|
+
}
|
|
912
|
+
[data-slot="presence"][data-transition="slide-right"][data-state="closed"] {
|
|
913
|
+
animation: presence-slide-right-out var(--duration-base) var(--ease-out) both;
|
|
914
|
+
}
|
|
915
|
+
|
|
795
916
|
/* Prose — long-form typographic rhythm for arbitrary HTML descendants
|
|
796
917
|
(MDX output, CMS articles, rendered markdown). Keyed off the .prose
|
|
797
918
|
class the Prose primitive (data-slot="prose") applies — same
|