@behavioral-agentic-design-system/core 0.40.0 → 0.42.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/README.md +2 -0
- package/package.json +19 -3
- package/scripts/a11y-lint.cjs +41 -2
- package/scripts/health-report.mjs +16 -2
- package/scripts/lint-slop.mjs +25 -1
- package/scripts/wcag-audit.cjs +72 -5
- package/src/app/opengraph-image.tsx +5 -0
- package/src/app/preview/components/page.tsx +1269 -2
- package/src/app/shell.tsx +8 -5
- package/src/components/Foundations/Motion.stories.tsx +1 -0
- package/src/components/customize/design-controls.tsx +16 -1
- package/src/components/studio/studio.tsx +153 -0
- package/src/components/ui/anchor.tsx +37 -3
- package/src/components/ui/attachment.tsx +211 -0
- package/src/components/ui/chart.tsx +3 -0
- package/src/components/ui/code.tsx +1 -1
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/gauge-chart.tsx +238 -0
- package/src/components/ui/heatmap.tsx +256 -0
- package/src/components/ui/index.ts +9 -0
- package/src/components/ui/infinite-scroll.tsx +103 -0
- package/src/components/ui/json-input.tsx +351 -0
- package/src/components/ui/navigation-progress.tsx +281 -0
- package/src/components/ui/number-input.tsx +1 -4
- package/src/components/ui/password-input.tsx +2 -1
- package/src/components/ui/password-strength-input.tsx +288 -0
- package/src/components/ui/pill.tsx +140 -0
- package/src/components/ui/popover.tsx +27 -4
- package/src/components/ui/scroll-progress.tsx +100 -0
- package/src/components/ui/snackbar.tsx +393 -0
- package/src/components/ui/sortable-list.tsx +342 -0
- package/src/components/ui/squircle.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tour.tsx +1 -3
- package/src/data/docs-index.ts +24 -0
- package/src/lib/clamp.ts +2 -0
- package/src/stories/Anchor.stories.tsx +54 -0
- package/src/stories/Attachment.stories.tsx +189 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/Code.stories.tsx +1 -0
- package/src/stories/ColorPicker.stories.tsx +1 -0
- package/src/stories/GaugeChart.stories.tsx +163 -0
- package/src/stories/Heatmap.stories.tsx +172 -0
- package/src/stories/InfiniteScroll.stories.tsx +225 -0
- package/src/stories/JsonInput.stories.tsx +212 -0
- package/src/stories/NavigationProgress.stories.tsx +159 -0
- package/src/stories/NumberInput.stories.tsx +1 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
- package/src/stories/Pill.stories.tsx +201 -0
- package/src/stories/Popover.stories.tsx +29 -1
- package/src/stories/Portal.stories.tsx +3 -1
- package/src/stories/ScrollProgress.stories.tsx +117 -0
- package/src/stories/Snackbar.stories.tsx +315 -0
- package/src/stories/SortableList.stories.tsx +263 -0
- package/src/stories/Squircle.stories.tsx +1 -0
- package/src/stories/Table.stories.tsx +1 -0
- package/src/stories/Tour.stories.tsx +1 -0
- package/src/stories/story-groups.json +17 -6
- package/LICENSE +0 -21
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
InputGroupInput,
|
|
35
35
|
InputGroupAddon,
|
|
36
36
|
InputGroupText,
|
|
37
|
-
InputGroupButton,
|
|
38
37
|
} from "@behavioral-agentic-design-system/core/components/ui/input-group";
|
|
39
38
|
import {
|
|
40
39
|
Fieldset,
|
|
@@ -260,6 +259,7 @@ import { MotionToggle } from "@behavioral-agentic-design-system/core/components/
|
|
|
260
259
|
import { Timeline, TimelineItem } from "@behavioral-agentic-design-system/core/components/ui/timeline";
|
|
261
260
|
import { TagsInput } from "@behavioral-agentic-design-system/core/components/ui/tags-input";
|
|
262
261
|
import { Tag } from "@behavioral-agentic-design-system/core/components/ui/tag";
|
|
262
|
+
import { Pill, PillGroup } from "@behavioral-agentic-design-system/core/components/ui/pill";
|
|
263
263
|
import { Autocomplete } from "@behavioral-agentic-design-system/core/components/ui/autocomplete";
|
|
264
264
|
import { TimePicker } from "@behavioral-agentic-design-system/core/components/ui/time-picker";
|
|
265
265
|
import { VisuallyHidden } from "@behavioral-agentic-design-system/core/components/ui/visually-hidden";
|
|
@@ -356,7 +356,7 @@ import {
|
|
|
356
356
|
SheetTitle,
|
|
357
357
|
SheetTrigger,
|
|
358
358
|
} from "@behavioral-agentic-design-system/core/components/ui/sheet";
|
|
359
|
-
import {
|
|
359
|
+
import { MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search, Archive as ArchiveIcon, Trash2 as Trash2Icon } from "lucide-react";
|
|
360
360
|
import {
|
|
361
361
|
Tree,
|
|
362
362
|
TreeItem,
|
|
@@ -427,8 +427,35 @@ import { Portal } from "@behavioral-agentic-design-system/core/components/ui/por
|
|
|
427
427
|
import { Icon } from "@behavioral-agentic-design-system/core/components/ui/icon";
|
|
428
428
|
import { ICON_ROLES } from "@behavioral-agentic-design-system/core/lib/get-icon-color";
|
|
429
429
|
import { ProgressStack } from "@behavioral-agentic-design-system/core/components/ui/progress-stack";
|
|
430
|
+
import { GaugeChart } from "@behavioral-agentic-design-system/core/components/ui/gauge-chart";
|
|
431
|
+
import { PasswordStrengthInput } from "@behavioral-agentic-design-system/core/components/ui/password-strength-input";
|
|
432
|
+
import { InfiniteScroll } from "@behavioral-agentic-design-system/core/components/ui/infinite-scroll";
|
|
433
|
+
import { ScrollProgress } from "@behavioral-agentic-design-system/core/components/ui/scroll-progress";
|
|
434
|
+
import {
|
|
435
|
+
SnackbarProvider,
|
|
436
|
+
useSnackbar,
|
|
437
|
+
SNACKBAR_ANCHORS,
|
|
438
|
+
type SnackbarAnchor,
|
|
439
|
+
} from "@behavioral-agentic-design-system/core/components/ui/snackbar";
|
|
440
|
+
import {
|
|
441
|
+
Archive as SnackbarArchiveIcon,
|
|
442
|
+
CircleCheck as SnackbarCheckIcon,
|
|
443
|
+
Send as SnackbarSendIcon,
|
|
444
|
+
} from "lucide-react";
|
|
430
445
|
import { Callout } from "@behavioral-agentic-design-system/core/components/ui/callout";
|
|
431
446
|
import { AnnouncementBar } from "@behavioral-agentic-design-system/core/components/ui/announcement-bar";
|
|
447
|
+
import { JsonInput } from "@behavioral-agentic-design-system/core/components/ui/json-input";
|
|
448
|
+
import { SortableList, type SortableItem } from "@behavioral-agentic-design-system/core/components/ui/sortable-list";
|
|
449
|
+
import { Heatmap } from "@behavioral-agentic-design-system/core/components/ui/heatmap";
|
|
450
|
+
import {
|
|
451
|
+
NavigationProgress,
|
|
452
|
+
useNavigationProgress,
|
|
453
|
+
} from "@behavioral-agentic-design-system/core/components/ui/navigation-progress";
|
|
454
|
+
import { Attachment } from "@behavioral-agentic-design-system/core/components/ui/attachment";
|
|
455
|
+
import {
|
|
456
|
+
Paperclip as AttachmentPaperclipIcon,
|
|
457
|
+
SendHorizontal as AttachmentSendIcon,
|
|
458
|
+
} from "lucide-react";
|
|
432
459
|
|
|
433
460
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
434
461
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -3271,6 +3298,14 @@ export default function ComponentsPreview() {
|
|
|
3271
3298
|
</div>
|
|
3272
3299
|
</PopoverContent>
|
|
3273
3300
|
</Popover>
|
|
3301
|
+
<Popover>
|
|
3302
|
+
<PopoverTrigger asChild>
|
|
3303
|
+
<Button variant="outline" size="sm">With arrow</Button>
|
|
3304
|
+
</PopoverTrigger>
|
|
3305
|
+
<PopoverContent showArrow className="w-56">
|
|
3306
|
+
<p className="text-sm">Arrow caret pointing at the trigger. Matches popover border and background.</p>
|
|
3307
|
+
</PopoverContent>
|
|
3308
|
+
</Popover>
|
|
3274
3309
|
</div>
|
|
3275
3310
|
</Section>
|
|
3276
3311
|
|
|
@@ -6336,6 +6371,39 @@ export default function ComponentsPreview() {
|
|
|
6336
6371
|
<Section title="Grid">
|
|
6337
6372
|
<GridShowcase />
|
|
6338
6373
|
</Section>
|
|
6374
|
+
<Section title="GaugeChart">
|
|
6375
|
+
<GaugeChartShowcase />
|
|
6376
|
+
</Section>
|
|
6377
|
+
<Section title="PasswordStrengthInput">
|
|
6378
|
+
<PasswordStrengthInputShowcase />
|
|
6379
|
+
</Section>
|
|
6380
|
+
<Section title="InfiniteScroll">
|
|
6381
|
+
<InfiniteScrollShowcase />
|
|
6382
|
+
</Section>
|
|
6383
|
+
<Section title="ScrollProgress">
|
|
6384
|
+
<ScrollProgressShowcase />
|
|
6385
|
+
</Section>
|
|
6386
|
+
<Section title="Pill">
|
|
6387
|
+
<PillShowcase />
|
|
6388
|
+
</Section>
|
|
6389
|
+
<Section title="Snackbar">
|
|
6390
|
+
<SnackbarShowcase />
|
|
6391
|
+
</Section>
|
|
6392
|
+
<Section title="JsonInput">
|
|
6393
|
+
<JsonInputShowcase />
|
|
6394
|
+
</Section>
|
|
6395
|
+
<Section title="SortableList">
|
|
6396
|
+
<SortableListShowcase />
|
|
6397
|
+
</Section>
|
|
6398
|
+
<Section title="Heatmap">
|
|
6399
|
+
<HeatmapShowcase />
|
|
6400
|
+
</Section>
|
|
6401
|
+
<Section title="NavigationProgress">
|
|
6402
|
+
<NavigationProgressShowcase />
|
|
6403
|
+
</Section>
|
|
6404
|
+
<Section title="Attachment">
|
|
6405
|
+
<AttachmentShowcase />
|
|
6406
|
+
</Section>
|
|
6339
6407
|
</div>
|
|
6340
6408
|
</div>
|
|
6341
6409
|
);
|
|
@@ -7167,6 +7235,11 @@ function SignaturePadShowcase() {
|
|
|
7167
7235
|
}
|
|
7168
7236
|
|
|
7169
7237
|
function AnchorShowcase() {
|
|
7238
|
+
// Controlled demo: mirror the scroll-spy result back in, the way a docs
|
|
7239
|
+
// site keeps the URL hash and the nav in step.
|
|
7240
|
+
const [controlledActive, setControlledActive] = React.useState<string | null>(
|
|
7241
|
+
"anchor-demo-fork"
|
|
7242
|
+
);
|
|
7170
7243
|
const sections: { id: string; title: string; body: string; depth?: number }[] = [
|
|
7171
7244
|
{
|
|
7172
7245
|
id: "anchor-demo-fork",
|
|
@@ -7244,6 +7317,26 @@ function AnchorShowcase() {
|
|
|
7244
7317
|
]}
|
|
7245
7318
|
/>
|
|
7246
7319
|
</div>
|
|
7320
|
+
<div>
|
|
7321
|
+
<p className="mb-3 text-sm font-medium text-muted-foreground">
|
|
7322
|
+
Controlled — pass <code className="font-mono">activeId</code> and{" "}
|
|
7323
|
+
<code className="font-mono">onActiveChange</code> to own the
|
|
7324
|
+
highlight (URL hash, shared store). This one observes the article
|
|
7325
|
+
above and mirrors the result back; currently reading{" "}
|
|
7326
|
+
<span className="font-medium text-foreground">
|
|
7327
|
+
{sections.find((s) => s.id === controlledActive)?.title ?? "none"}
|
|
7328
|
+
</span>
|
|
7329
|
+
. Anchor is BADS's table-of-contents primitive — the registry
|
|
7330
|
+
lists <code className="font-mono">TableOfContents</code> as its alias.
|
|
7331
|
+
</p>
|
|
7332
|
+
<Anchor
|
|
7333
|
+
className="w-56"
|
|
7334
|
+
label="Onboarding steps (controlled)"
|
|
7335
|
+
activeId={controlledActive}
|
|
7336
|
+
onActiveChange={setControlledActive}
|
|
7337
|
+
items={sections.map((s) => ({ id: s.id, label: s.title, depth: s.depth }))}
|
|
7338
|
+
/>
|
|
7339
|
+
</div>
|
|
7247
7340
|
</div>
|
|
7248
7341
|
);
|
|
7249
7342
|
}
|
|
@@ -12594,6 +12687,114 @@ function PresenceShowcase() {
|
|
|
12594
12687
|
);
|
|
12595
12688
|
}
|
|
12596
12689
|
|
|
12690
|
+
function GaugeChartShowcase() {
|
|
12691
|
+
return (
|
|
12692
|
+
<div className="space-y-8">
|
|
12693
|
+
<p className="text-sm text-muted-foreground">
|
|
12694
|
+
Radial arc dial for a single reading within a known range. A quiet{" "}
|
|
12695
|
+
<code className="text-xs">--muted</code> track sweeps 270°; the value
|
|
12696
|
+
arc in a <code className="text-xs">--chart-*</code> color fills the
|
|
12697
|
+
proportion the reading represents. Root is{" "}
|
|
12698
|
+
<code className="text-xs">{"<div data-slot=\"gauge-chart\" role=\"meter\">"}</code>{" "}
|
|
12699
|
+
with aria-valuenow/min/max/valuetext — the same contract as Meter,
|
|
12700
|
+
drawn radially. Recharts 3.x with the ChartContainer mount-gate.
|
|
12701
|
+
</p>
|
|
12702
|
+
|
|
12703
|
+
<div>
|
|
12704
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12705
|
+
Default — value 72 of 0–100, md size, --chart-1
|
|
12706
|
+
</p>
|
|
12707
|
+
<GaugeChart value={72} className="w-48" />
|
|
12708
|
+
</div>
|
|
12709
|
+
|
|
12710
|
+
<div>
|
|
12711
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12712
|
+
Sizes — sm 120px, md 160px, lg 200px, xl 240px
|
|
12713
|
+
</p>
|
|
12714
|
+
<div className="flex flex-wrap items-end gap-6">
|
|
12715
|
+
{(["sm", "md", "lg", "xl"] as const).map((size) => (
|
|
12716
|
+
<div key={size} className="flex flex-col items-center gap-2">
|
|
12717
|
+
<GaugeChart
|
|
12718
|
+
value={72}
|
|
12719
|
+
size={size}
|
|
12720
|
+
label="Coverage"
|
|
12721
|
+
className="w-auto"
|
|
12722
|
+
style={{ width: { sm: 120, md: 160, lg: 200, xl: 240 }[size] }}
|
|
12723
|
+
/>
|
|
12724
|
+
<code className="text-xs text-muted-foreground">{size}</code>
|
|
12725
|
+
</div>
|
|
12726
|
+
))}
|
|
12727
|
+
</div>
|
|
12728
|
+
</div>
|
|
12729
|
+
|
|
12730
|
+
<div>
|
|
12731
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12732
|
+
With label — caption under the value, also the default accessible name
|
|
12733
|
+
</p>
|
|
12734
|
+
<GaugeChart value={85} label="CPU usage" className="w-48" />
|
|
12735
|
+
</div>
|
|
12736
|
+
|
|
12737
|
+
<div>
|
|
12738
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12739
|
+
Colors — the Okabe-Ito series in palette order
|
|
12740
|
+
</p>
|
|
12741
|
+
<div className="flex flex-wrap items-end gap-6">
|
|
12742
|
+
{[1, 2, 3, 4, 5].map((n) => (
|
|
12743
|
+
<div key={n} className="flex w-32 flex-col items-center gap-2">
|
|
12744
|
+
<GaugeChart
|
|
12745
|
+
value={72}
|
|
12746
|
+
size="sm"
|
|
12747
|
+
color={`var(--chart-${n})`}
|
|
12748
|
+
aria-label={`Sample reading in chart color ${n}`}
|
|
12749
|
+
/>
|
|
12750
|
+
<code className="text-xs text-muted-foreground">--chart-{n}</code>
|
|
12751
|
+
</div>
|
|
12752
|
+
))}
|
|
12753
|
+
</div>
|
|
12754
|
+
</div>
|
|
12755
|
+
|
|
12756
|
+
<div>
|
|
12757
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12758
|
+
Realistic use — system health card, one hero gauge and three small multiples
|
|
12759
|
+
</p>
|
|
12760
|
+
<Card className="w-[480px]">
|
|
12761
|
+
<CardHeader>
|
|
12762
|
+
<CardTitle>System health</CardTitle>
|
|
12763
|
+
<CardDescription>BADS core — nightly gate run, 2026-09-15</CardDescription>
|
|
12764
|
+
</CardHeader>
|
|
12765
|
+
<CardContent className="flex flex-col gap-6">
|
|
12766
|
+
<div className="flex justify-center">
|
|
12767
|
+
<GaugeChart value={67} label="Overall" size="lg" className="w-52" />
|
|
12768
|
+
</div>
|
|
12769
|
+
<div className="grid grid-cols-3 gap-4">
|
|
12770
|
+
<GaugeChart
|
|
12771
|
+
value={98.4}
|
|
12772
|
+
label="Story coverage"
|
|
12773
|
+
size="sm"
|
|
12774
|
+
formatValue={(v) => `${v.toFixed(1)}%`}
|
|
12775
|
+
/>
|
|
12776
|
+
<GaugeChart
|
|
12777
|
+
value={88}
|
|
12778
|
+
max={120}
|
|
12779
|
+
label="Registry entries"
|
|
12780
|
+
size="sm"
|
|
12781
|
+
color="var(--chart-2)"
|
|
12782
|
+
/>
|
|
12783
|
+
<GaugeChart
|
|
12784
|
+
value={4}
|
|
12785
|
+
max={12}
|
|
12786
|
+
label="Open advisories"
|
|
12787
|
+
size="sm"
|
|
12788
|
+
color="var(--chart-3)"
|
|
12789
|
+
/>
|
|
12790
|
+
</div>
|
|
12791
|
+
</CardContent>
|
|
12792
|
+
</Card>
|
|
12793
|
+
</div>
|
|
12794
|
+
</div>
|
|
12795
|
+
);
|
|
12796
|
+
}
|
|
12797
|
+
|
|
12597
12798
|
function ProgressStackShowcase() {
|
|
12598
12799
|
const storageSegments = [
|
|
12599
12800
|
{ value: 38, label: "Documents" },
|
|
@@ -13290,3 +13491,1069 @@ function GridShowcase() {
|
|
|
13290
13491
|
</div>
|
|
13291
13492
|
);
|
|
13292
13493
|
}
|
|
13494
|
+
|
|
13495
|
+
function PasswordStrengthInputShowcase() {
|
|
13496
|
+
const [controlled, setControlled] = React.useState("")
|
|
13497
|
+
|
|
13498
|
+
return (
|
|
13499
|
+
<div className="space-y-8">
|
|
13500
|
+
<p className="text-sm text-muted-foreground">
|
|
13501
|
+
Composes PasswordInput + a segmented strength bar + live-region label.
|
|
13502
|
+
Strength is driven by a pluggable{" "}
|
|
13503
|
+
<code className="text-xs font-mono">strengthFn</code> — swap in zxcvbn
|
|
13504
|
+
or a backend scorer without changing the visual contract. Four source
|
|
13505
|
+
parity: Mantine PasswordInput strength prop, shadcn/ui Auth block, MUI
|
|
13506
|
+
PasswordStrength example, Ark UI composition.
|
|
13507
|
+
</p>
|
|
13508
|
+
|
|
13509
|
+
{/* Default uncontrolled */}
|
|
13510
|
+
<div>
|
|
13511
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13512
|
+
Default — 4 segments, label visible, hints hidden
|
|
13513
|
+
</p>
|
|
13514
|
+
<PasswordStrengthInput
|
|
13515
|
+
placeholder="New password"
|
|
13516
|
+
autoComplete="new-password"
|
|
13517
|
+
className="max-w-xs"
|
|
13518
|
+
/>
|
|
13519
|
+
</div>
|
|
13520
|
+
|
|
13521
|
+
{/* With hints */}
|
|
13522
|
+
<div>
|
|
13523
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13524
|
+
showHints — requirements list below the bar
|
|
13525
|
+
</p>
|
|
13526
|
+
<PasswordStrengthInput
|
|
13527
|
+
placeholder="New password"
|
|
13528
|
+
autoComplete="new-password"
|
|
13529
|
+
showHints
|
|
13530
|
+
className="max-w-xs"
|
|
13531
|
+
/>
|
|
13532
|
+
</div>
|
|
13533
|
+
|
|
13534
|
+
{/* Strength levels side by side */}
|
|
13535
|
+
<div>
|
|
13536
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13537
|
+
Four strength levels — weak · fair · good · strong
|
|
13538
|
+
</p>
|
|
13539
|
+
<div className="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
|
13540
|
+
{(
|
|
13541
|
+
[
|
|
13542
|
+
{ value: "pass", label: "Weak" },
|
|
13543
|
+
{ value: "password1", label: "Fair" },
|
|
13544
|
+
{ value: "Password123", label: "Good" },
|
|
13545
|
+
{ value: "P@ssword123!!", label: "Strong" },
|
|
13546
|
+
] as const
|
|
13547
|
+
).map(({ value, label }) => (
|
|
13548
|
+
<div key={label} className="flex flex-col gap-1">
|
|
13549
|
+
<span className="text-xs text-muted-foreground">{label}</span>
|
|
13550
|
+
<PasswordStrengthInput
|
|
13551
|
+
value={value}
|
|
13552
|
+
onChange={() => {}}
|
|
13553
|
+
size="sm"
|
|
13554
|
+
showLabel={false}
|
|
13555
|
+
/>
|
|
13556
|
+
</div>
|
|
13557
|
+
))}
|
|
13558
|
+
</div>
|
|
13559
|
+
</div>
|
|
13560
|
+
|
|
13561
|
+
{/* Controlled + segment variants */}
|
|
13562
|
+
<div>
|
|
13563
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13564
|
+
Controlled (live) — 5 segments
|
|
13565
|
+
</p>
|
|
13566
|
+
<PasswordStrengthInput
|
|
13567
|
+
value={controlled}
|
|
13568
|
+
onChange={(e) => setControlled(e.target.value)}
|
|
13569
|
+
placeholder="Type to see strength update"
|
|
13570
|
+
autoComplete="new-password"
|
|
13571
|
+
segments={5}
|
|
13572
|
+
className="max-w-xs"
|
|
13573
|
+
/>
|
|
13574
|
+
</div>
|
|
13575
|
+
|
|
13576
|
+
{/* Sizes */}
|
|
13577
|
+
<div>
|
|
13578
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13579
|
+
Sizes — sm · default · lg · xl
|
|
13580
|
+
</p>
|
|
13581
|
+
<div className="flex flex-col gap-4 max-w-xs">
|
|
13582
|
+
{(["sm", "default", "lg", "xl"] as const).map((size) => (
|
|
13583
|
+
<PasswordStrengthInput
|
|
13584
|
+
key={size}
|
|
13585
|
+
size={size}
|
|
13586
|
+
placeholder={`size="${size}"`}
|
|
13587
|
+
autoComplete="new-password"
|
|
13588
|
+
showLabel={false}
|
|
13589
|
+
/>
|
|
13590
|
+
))}
|
|
13591
|
+
</div>
|
|
13592
|
+
</div>
|
|
13593
|
+
|
|
13594
|
+
{/* Disabled */}
|
|
13595
|
+
<div>
|
|
13596
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13597
|
+
Disabled
|
|
13598
|
+
</p>
|
|
13599
|
+
<PasswordStrengthInput
|
|
13600
|
+
disabled
|
|
13601
|
+
placeholder="Disabled"
|
|
13602
|
+
className="max-w-xs"
|
|
13603
|
+
/>
|
|
13604
|
+
</div>
|
|
13605
|
+
</div>
|
|
13606
|
+
);
|
|
13607
|
+
}
|
|
13608
|
+
|
|
13609
|
+
function InfiniteScrollShowcase() {
|
|
13610
|
+
type Item = { id: number; name: string; role: string; initials: string }
|
|
13611
|
+
const names = [
|
|
13612
|
+
{ name: "Priya Chandrasekaran", role: "Product designer", initials: "PC" },
|
|
13613
|
+
{ name: "Marcus Oliveira", role: "Frontend engineer", initials: "MO" },
|
|
13614
|
+
{ name: "Aisha Tanaka", role: "Engineering manager", initials: "AT" },
|
|
13615
|
+
{ name: "Samuel Adeyemi", role: "Backend engineer", initials: "SA" },
|
|
13616
|
+
{ name: "Lena Bergmann", role: "UX researcher", initials: "LB" },
|
|
13617
|
+
]
|
|
13618
|
+
function makeItems(start: number, count: number): Item[] {
|
|
13619
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
13620
|
+
id: start + i,
|
|
13621
|
+
...names[(start + i) % names.length],
|
|
13622
|
+
}))
|
|
13623
|
+
}
|
|
13624
|
+
const PAGE = 8
|
|
13625
|
+
const MAX = 32
|
|
13626
|
+
const [items, setItems] = React.useState<Item[]>(() => makeItems(0, PAGE))
|
|
13627
|
+
const [loading, setLoading] = React.useState(false)
|
|
13628
|
+
|
|
13629
|
+
function loadMore() {
|
|
13630
|
+
if (loading) return
|
|
13631
|
+
setLoading(true)
|
|
13632
|
+
setTimeout(() => {
|
|
13633
|
+
setItems((prev) => [...prev, ...makeItems(prev.length, PAGE)])
|
|
13634
|
+
setLoading(false)
|
|
13635
|
+
}, 800)
|
|
13636
|
+
}
|
|
13637
|
+
|
|
13638
|
+
return (
|
|
13639
|
+
<div className="space-y-6">
|
|
13640
|
+
{/* lint-disable: card-bypass — InfiniteScroll wraps the list; a Card here would double-wrap */}
|
|
13641
|
+
<div className="max-h-[360px] overflow-y-auto rounded-lg border bg-card">
|
|
13642
|
+
<InfiniteScroll
|
|
13643
|
+
onLoadMore={loadMore}
|
|
13644
|
+
hasMore={items.length < MAX}
|
|
13645
|
+
endMessage={
|
|
13646
|
+
<p className="py-6 text-center text-sm text-muted-foreground">
|
|
13647
|
+
All {MAX} team members loaded
|
|
13648
|
+
</p>
|
|
13649
|
+
}
|
|
13650
|
+
>
|
|
13651
|
+
<ul>
|
|
13652
|
+
{items.map((item, i) => (
|
|
13653
|
+
<li key={item.id}>
|
|
13654
|
+
{i > 0 && <div className="border-t" />}
|
|
13655
|
+
<div className="flex items-center gap-3 px-4 py-3">
|
|
13656
|
+
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium">
|
|
13657
|
+
{item.initials}
|
|
13658
|
+
</div>
|
|
13659
|
+
<div className="min-w-0 flex-1">
|
|
13660
|
+
<p className="truncate text-sm font-medium">{item.name}</p>
|
|
13661
|
+
<p className="truncate text-xs text-muted-foreground">{item.role}</p>
|
|
13662
|
+
</div>
|
|
13663
|
+
</div>
|
|
13664
|
+
</li>
|
|
13665
|
+
))}
|
|
13666
|
+
</ul>
|
|
13667
|
+
</InfiniteScroll>
|
|
13668
|
+
</div>
|
|
13669
|
+
<p className="text-xs text-muted-foreground">
|
|
13670
|
+
Scroll the list to trigger IntersectionObserver load-more. Loads {PAGE} items per page up to {MAX}.
|
|
13671
|
+
</p>
|
|
13672
|
+
</div>
|
|
13673
|
+
)
|
|
13674
|
+
}
|
|
13675
|
+
|
|
13676
|
+
function ScrollProgressShowcase() {
|
|
13677
|
+
const stickyRef = React.useRef<HTMLDivElement>(null)
|
|
13678
|
+
const inlineRef = React.useRef<HTMLDivElement>(null)
|
|
13679
|
+
return (
|
|
13680
|
+
<div className="space-y-6">
|
|
13681
|
+
<div>
|
|
13682
|
+
<p className="mb-2 text-xs text-muted-foreground">Sticky — inside a scroll container header</p>
|
|
13683
|
+
<div ref={stickyRef} className="relative max-h-[280px] overflow-y-auto rounded-lg border">
|
|
13684
|
+
<ScrollProgress containerRef={stickyRef} position="sticky" />
|
|
13685
|
+
<div className="space-y-4 p-5">
|
|
13686
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
13687
|
+
<p key={i} className="text-sm text-muted-foreground">
|
|
13688
|
+
Paragraph {i + 1}: Scroll down to see the progress bar advance along the top of this container.
|
|
13689
|
+
</p>
|
|
13690
|
+
))}
|
|
13691
|
+
</div>
|
|
13692
|
+
</div>
|
|
13693
|
+
</div>
|
|
13694
|
+
<div>
|
|
13695
|
+
<p className="mb-2 text-xs text-muted-foreground">Custom style — 4 px height, destructive color, no track</p>
|
|
13696
|
+
<div ref={inlineRef} className="relative max-h-[200px] overflow-y-auto rounded-lg border">
|
|
13697
|
+
<ScrollProgress
|
|
13698
|
+
containerRef={inlineRef}
|
|
13699
|
+
position="sticky"
|
|
13700
|
+
height="4px"
|
|
13701
|
+
color="var(--destructive)"
|
|
13702
|
+
trackColor="transparent"
|
|
13703
|
+
/>
|
|
13704
|
+
<div className="space-y-4 p-5">
|
|
13705
|
+
{Array.from({ length: 10 }, (_, i) => (
|
|
13706
|
+
<p key={i} className="text-sm text-muted-foreground">
|
|
13707
|
+
Item {i + 1}: Custom bar — 4 px height, destructive color, no track.
|
|
13708
|
+
</p>
|
|
13709
|
+
))}
|
|
13710
|
+
</div>
|
|
13711
|
+
</div>
|
|
13712
|
+
</div>
|
|
13713
|
+
</div>
|
|
13714
|
+
)
|
|
13715
|
+
}
|
|
13716
|
+
|
|
13717
|
+
function PillShowcase() {
|
|
13718
|
+
return (
|
|
13719
|
+
<div className="space-y-6">
|
|
13720
|
+
<p className="text-sm text-muted-foreground">
|
|
13721
|
+
Compact, non-removable, read-only label — the neutral member of the
|
|
13722
|
+
label family. Tag carries a dismiss affordance and status variants,
|
|
13723
|
+
Badge carries status semantics, Chip toggles; Pill is for metadata
|
|
13724
|
+
that is none of those: taxonomy terms, owners, environments, counts.
|
|
13725
|
+
Plain span, no role, never a CTA (the 44px floor does not apply).
|
|
13726
|
+
</p>
|
|
13727
|
+
<div className="space-y-2">
|
|
13728
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13729
|
+
Variants — default (secondary) / outline / muted
|
|
13730
|
+
</p>
|
|
13731
|
+
<PillGroup>
|
|
13732
|
+
<Pill>design tokens</Pill>
|
|
13733
|
+
<Pill variant="outline">semantic layer</Pill>
|
|
13734
|
+
<Pill variant="muted">a11y contract</Pill>
|
|
13735
|
+
</PillGroup>
|
|
13736
|
+
</div>
|
|
13737
|
+
<div className="space-y-2">
|
|
13738
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13739
|
+
Sizes — sm (default, 14px) / md / lg
|
|
13740
|
+
</p>
|
|
13741
|
+
<PillGroup>
|
|
13742
|
+
<Pill size="sm">CVA variants</Pill>
|
|
13743
|
+
<Pill size="md">Radix primitive</Pill>
|
|
13744
|
+
<Pill size="lg">forced colors</Pill>
|
|
13745
|
+
</PillGroup>
|
|
13746
|
+
</div>
|
|
13747
|
+
<div className="space-y-2">
|
|
13748
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13749
|
+
Leading icon slot (strokeWidth 1.5, scaled per size) and a 20px
|
|
13750
|
+
Avatar for owner pills
|
|
13751
|
+
</p>
|
|
13752
|
+
<PillGroup>
|
|
13753
|
+
<Pill icon={<GitPullRequestIcon strokeWidth={1.5} />}>main</Pill>
|
|
13754
|
+
<Pill size="md" variant="outline" icon={<ShieldCheckIcon strokeWidth={1.5} />}>
|
|
13755
|
+
7:1 contrast
|
|
13756
|
+
</Pill>
|
|
13757
|
+
<Pill
|
|
13758
|
+
size="lg"
|
|
13759
|
+
variant="outline"
|
|
13760
|
+
className="pl-1"
|
|
13761
|
+
icon={
|
|
13762
|
+
<Avatar size="xs">
|
|
13763
|
+
<AvatarFallback className="text-xs">JR</AvatarFallback>
|
|
13764
|
+
</Avatar>
|
|
13765
|
+
}
|
|
13766
|
+
>
|
|
13767
|
+
Jordan Reeves
|
|
13768
|
+
</Pill>
|
|
13769
|
+
</PillGroup>
|
|
13770
|
+
</div>
|
|
13771
|
+
<div className="space-y-2">
|
|
13772
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13773
|
+
Disabled — presentational dim only; the owning control conveys the
|
|
13774
|
+
state
|
|
13775
|
+
</p>
|
|
13776
|
+
<PillGroup>
|
|
13777
|
+
<Pill disabled>token drift</Pill>
|
|
13778
|
+
<Pill disabled variant="outline">visual regression</Pill>
|
|
13779
|
+
<Pill disabled variant="muted">focus trap</Pill>
|
|
13780
|
+
</PillGroup>
|
|
13781
|
+
</div>
|
|
13782
|
+
<div className="space-y-2">
|
|
13783
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13784
|
+
Long labels truncate inside a narrow parent (full value in title)
|
|
13785
|
+
</p>
|
|
13786
|
+
<div className="w-56 rounded-lg border p-3">
|
|
13787
|
+
<PillGroup>
|
|
13788
|
+
<Pill title="Wilhelmina-Constance Featherstonehaugh-Vance">
|
|
13789
|
+
Wilhelmina-Constance Featherstonehaugh-Vance
|
|
13790
|
+
</Pill>
|
|
13791
|
+
<Pill variant="muted">李雪芹</Pill>
|
|
13792
|
+
</PillGroup>
|
|
13793
|
+
</div>
|
|
13794
|
+
</div>
|
|
13795
|
+
</div>
|
|
13796
|
+
);
|
|
13797
|
+
}
|
|
13798
|
+
|
|
13799
|
+
function SnackbarShowcase() {
|
|
13800
|
+
const [anchor, setAnchor] = React.useState<SnackbarAnchor>("bottom-center");
|
|
13801
|
+
return (
|
|
13802
|
+
<div className="space-y-8">
|
|
13803
|
+
<p className="text-sm text-muted-foreground">
|
|
13804
|
+
One transient feedback message at a time, anchored to the bottom of the
|
|
13805
|
+
screen, that auto-dismisses. <code className="font-mono">useSnackbar()</code>{" "}
|
|
13806
|
+
gives you <code className="font-mono">show()</code> and{" "}
|
|
13807
|
+
<code className="font-mono">dismiss()</code>; the next message queues
|
|
13808
|
+
behind the current one and nothing ever stacks — that is Sonner's
|
|
13809
|
+
job, for async events the user needs to see several of at once. The
|
|
13810
|
+
timer pauses on hover and focus; a sticky message is always
|
|
13811
|
+
dismissible; the live region is mounted before the first message so
|
|
13812
|
+
screen readers announce it. Enter/exit ride the existing Presence
|
|
13813
|
+
slide-up keyframes.
|
|
13814
|
+
</p>
|
|
13815
|
+
{/* The provider is local to this section: the preview app has no
|
|
13816
|
+
app-level SnackbarProvider, and the outlet portals to this iframe's
|
|
13817
|
+
own <body>, so it pins to the bottom of the Components tab. */}
|
|
13818
|
+
<SnackbarProvider anchor={anchor}>
|
|
13819
|
+
<div className="flex flex-col gap-6">
|
|
13820
|
+
<SegmentedControl
|
|
13821
|
+
value={anchor}
|
|
13822
|
+
onValueChange={(v) => setAnchor(v as SnackbarAnchor)}
|
|
13823
|
+
label="Snackbar anchor"
|
|
13824
|
+
className="w-fit"
|
|
13825
|
+
>
|
|
13826
|
+
{SNACKBAR_ANCHORS.map((a) => (
|
|
13827
|
+
<SegmentedControlItem key={a} value={a}>
|
|
13828
|
+
{a}
|
|
13829
|
+
</SegmentedControlItem>
|
|
13830
|
+
))}
|
|
13831
|
+
</SegmentedControl>
|
|
13832
|
+
<SnackbarShowcaseTriggers />
|
|
13833
|
+
</div>
|
|
13834
|
+
</SnackbarProvider>
|
|
13835
|
+
</div>
|
|
13836
|
+
);
|
|
13837
|
+
}
|
|
13838
|
+
|
|
13839
|
+
function SnackbarShowcaseTriggers() {
|
|
13840
|
+
const { show, dismiss } = useSnackbar();
|
|
13841
|
+
const [archived, setArchived] = React.useState<string[]>([]);
|
|
13842
|
+
return (
|
|
13843
|
+
<div className="space-y-6">
|
|
13844
|
+
<div>
|
|
13845
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13846
|
+
Default — message only, 4 s
|
|
13847
|
+
</p>
|
|
13848
|
+
<Button variant="outline" size="xl" onClick={() => show("Settings saved")}>
|
|
13849
|
+
Save settings
|
|
13850
|
+
</Button>
|
|
13851
|
+
</div>
|
|
13852
|
+
<div>
|
|
13853
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13854
|
+
With action + icon — Undo restores the archived member
|
|
13855
|
+
</p>
|
|
13856
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
13857
|
+
<Button
|
|
13858
|
+
variant="outline"
|
|
13859
|
+
size="xl"
|
|
13860
|
+
onClick={() => {
|
|
13861
|
+
const name = "Seo-yun Park";
|
|
13862
|
+
setArchived((a) => [...a, name]);
|
|
13863
|
+
show({
|
|
13864
|
+
message: `${name} archived`,
|
|
13865
|
+
icon: <SnackbarArchiveIcon strokeWidth={1.5} />,
|
|
13866
|
+
action: {
|
|
13867
|
+
label: "Undo",
|
|
13868
|
+
onClick: () => setArchived((a) => a.filter((n) => n !== name)),
|
|
13869
|
+
},
|
|
13870
|
+
});
|
|
13871
|
+
}}
|
|
13872
|
+
>
|
|
13873
|
+
Archive Seo-yun Park
|
|
13874
|
+
</Button>
|
|
13875
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
13876
|
+
{archived.length} archived
|
|
13877
|
+
</span>
|
|
13878
|
+
</div>
|
|
13879
|
+
</div>
|
|
13880
|
+
<div>
|
|
13881
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13882
|
+
Success icon, 1.5 s — a quick confirmation that gets out of the way
|
|
13883
|
+
</p>
|
|
13884
|
+
<Button
|
|
13885
|
+
variant="outline"
|
|
13886
|
+
size="xl"
|
|
13887
|
+
onClick={() =>
|
|
13888
|
+
show({
|
|
13889
|
+
message: "Copied --primary to clipboard",
|
|
13890
|
+
duration: 1500,
|
|
13891
|
+
icon: <SnackbarCheckIcon strokeWidth={1.5} className="text-icon-success" />,
|
|
13892
|
+
})
|
|
13893
|
+
}
|
|
13894
|
+
>
|
|
13895
|
+
Copy token name
|
|
13896
|
+
</Button>
|
|
13897
|
+
</div>
|
|
13898
|
+
<div>
|
|
13899
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13900
|
+
Sticky — duration Infinity, dismiss × shows by default
|
|
13901
|
+
</p>
|
|
13902
|
+
<Button
|
|
13903
|
+
variant="outline"
|
|
13904
|
+
size="xl"
|
|
13905
|
+
onClick={() =>
|
|
13906
|
+
show({
|
|
13907
|
+
message: "You're offline. Changes to Harborline Logistics sync when you reconnect.",
|
|
13908
|
+
duration: Infinity,
|
|
13909
|
+
})
|
|
13910
|
+
}
|
|
13911
|
+
>
|
|
13912
|
+
Go offline
|
|
13913
|
+
</Button>
|
|
13914
|
+
</div>
|
|
13915
|
+
<div>
|
|
13916
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13917
|
+
Queue — three calls, one visible, the rest wait their turn
|
|
13918
|
+
</p>
|
|
13919
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
13920
|
+
<Button
|
|
13921
|
+
variant="outline"
|
|
13922
|
+
size="xl"
|
|
13923
|
+
onClick={() => {
|
|
13924
|
+
show({
|
|
13925
|
+
message: "Invitation sent to Tomás Herrera",
|
|
13926
|
+
icon: <SnackbarSendIcon strokeWidth={1.5} />,
|
|
13927
|
+
duration: 2000,
|
|
13928
|
+
});
|
|
13929
|
+
show({ message: "Role updated to Editor", duration: 2000 });
|
|
13930
|
+
show({ message: "Workspace settings saved", duration: 2000 });
|
|
13931
|
+
}}
|
|
13932
|
+
>
|
|
13933
|
+
Queue three messages
|
|
13934
|
+
</Button>
|
|
13935
|
+
<Button variant="ghost" size="xl" onClick={() => dismiss("all")}>
|
|
13936
|
+
Clear queue
|
|
13937
|
+
</Button>
|
|
13938
|
+
</div>
|
|
13939
|
+
</div>
|
|
13940
|
+
</div>
|
|
13941
|
+
);
|
|
13942
|
+
}
|
|
13943
|
+
|
|
13944
|
+
// ─── JsonInput ────────────────────────────────────────────────────────────────
|
|
13945
|
+
|
|
13946
|
+
function JsonInputShowcase() {
|
|
13947
|
+
const [value, setValue] = React.useState<string>("");
|
|
13948
|
+
const [parsed, setParsed] = React.useState<unknown>(null);
|
|
13949
|
+
const [error, setError] = React.useState<string | null>(null);
|
|
13950
|
+
|
|
13951
|
+
return (
|
|
13952
|
+
<div className="space-y-8">
|
|
13953
|
+
<p className="text-sm text-muted-foreground">
|
|
13954
|
+
A <code className="font-mono">{"<Textarea>"}</code> specialized for JSON
|
|
13955
|
+
text entry. Validates on every keystroke (or on blur) via native{" "}
|
|
13956
|
+
<code className="font-mono">JSON.parse</code> and shows an inline error
|
|
13957
|
+
with <code className="font-mono">role="alert"</code> when the
|
|
13958
|
+
text is not valid JSON. Fires{" "}
|
|
13959
|
+
<code className="font-mono">onValidChange(parsed)</code> whenever valid
|
|
13960
|
+
JSON is present. An optional Format button auto-indents the content.
|
|
13961
|
+
Zero new dependencies.
|
|
13962
|
+
</p>
|
|
13963
|
+
|
|
13964
|
+
<div className="space-y-2">
|
|
13965
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13966
|
+
Default — empty field, no error shown until the user types
|
|
13967
|
+
</p>
|
|
13968
|
+
<JsonInput placeholder='{"key": "value"}' className="w-80" />
|
|
13969
|
+
</div>
|
|
13970
|
+
|
|
13971
|
+
<div className="space-y-2">
|
|
13972
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13973
|
+
With valid JSON pre-filled — Format button is enabled
|
|
13974
|
+
</p>
|
|
13975
|
+
<JsonInput
|
|
13976
|
+
defaultValue={JSON.stringify(
|
|
13977
|
+
{ brand: "Meridian Payments", primaryColor: "#1a56db", radius: "md" },
|
|
13978
|
+
null,
|
|
13979
|
+
2
|
|
13980
|
+
)}
|
|
13981
|
+
className="w-96"
|
|
13982
|
+
/>
|
|
13983
|
+
</div>
|
|
13984
|
+
|
|
13985
|
+
<div className="space-y-2">
|
|
13986
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13987
|
+
With invalid JSON pre-filled — error shown immediately (dirty on
|
|
13988
|
+
defaultValue)
|
|
13989
|
+
</p>
|
|
13990
|
+
<JsonInput
|
|
13991
|
+
defaultValue='{"brand": "Fieldnote Labs", missing_quote: true}'
|
|
13992
|
+
className="w-96"
|
|
13993
|
+
/>
|
|
13994
|
+
</div>
|
|
13995
|
+
|
|
13996
|
+
<div className="space-y-2">
|
|
13997
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13998
|
+
Validate on blur — errors deferred until the field loses focus
|
|
13999
|
+
</p>
|
|
14000
|
+
<JsonInput
|
|
14001
|
+
validateOn="blur"
|
|
14002
|
+
placeholder='{"brand": "Lumen Analytics"}'
|
|
14003
|
+
className="w-80"
|
|
14004
|
+
/>
|
|
14005
|
+
</div>
|
|
14006
|
+
|
|
14007
|
+
<div className="space-y-2">
|
|
14008
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14009
|
+
External error — server-side validation message overrides the built-in
|
|
14010
|
+
parse error
|
|
14011
|
+
</p>
|
|
14012
|
+
<JsonInput
|
|
14013
|
+
defaultValue='{"plan":"enterprise","seats":25}'
|
|
14014
|
+
externalError={'"seats" must be 50 or greater on the enterprise plan'}
|
|
14015
|
+
className="w-96"
|
|
14016
|
+
/>
|
|
14017
|
+
</div>
|
|
14018
|
+
|
|
14019
|
+
<div className="space-y-2">
|
|
14020
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14021
|
+
Without Format button
|
|
14022
|
+
</p>
|
|
14023
|
+
<JsonInput
|
|
14024
|
+
showFormatButton={false}
|
|
14025
|
+
defaultValue='{"org":"Cedar & Pine Studio","theme":"light","compact":false}'
|
|
14026
|
+
className="w-80"
|
|
14027
|
+
/>
|
|
14028
|
+
</div>
|
|
14029
|
+
|
|
14030
|
+
<div className="space-y-2">
|
|
14031
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14032
|
+
Disabled — Format button suppressed, textarea non-interactive
|
|
14033
|
+
</p>
|
|
14034
|
+
<JsonInput
|
|
14035
|
+
disabled
|
|
14036
|
+
defaultValue={JSON.stringify(
|
|
14037
|
+
{ org: "Northwind Health", locale: "en-US" },
|
|
14038
|
+
null,
|
|
14039
|
+
2
|
|
14040
|
+
)}
|
|
14041
|
+
className="w-80"
|
|
14042
|
+
/>
|
|
14043
|
+
</div>
|
|
14044
|
+
|
|
14045
|
+
<div className="space-y-2">
|
|
14046
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14047
|
+
Sizes — sm / default / lg
|
|
14048
|
+
</p>
|
|
14049
|
+
<div className="flex flex-wrap gap-4">
|
|
14050
|
+
<JsonInput size="sm" placeholder='{"key": "value"}' className="w-64" />
|
|
14051
|
+
<JsonInput size="default" placeholder='{"key": "value"}' className="w-72" />
|
|
14052
|
+
<JsonInput size="lg" placeholder='{"key": "value"}' className="w-80" />
|
|
14053
|
+
</div>
|
|
14054
|
+
</div>
|
|
14055
|
+
|
|
14056
|
+
<div className="space-y-2">
|
|
14057
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14058
|
+
Realistic use — inside a Field wrapper, controlled state,{" "}
|
|
14059
|
+
<code className="font-mono">onValidChange</code> captures the parsed
|
|
14060
|
+
result
|
|
14061
|
+
</p>
|
|
14062
|
+
<div className="w-96 space-y-4">
|
|
14063
|
+
<div className="space-y-1.5">
|
|
14064
|
+
<Label htmlFor="json-webhook-showcase">Webhook filter rules</Label>
|
|
14065
|
+
<p className="text-xs text-muted-foreground">
|
|
14066
|
+
Enter a JSON object that defines which events trigger this webhook.
|
|
14067
|
+
</p>
|
|
14068
|
+
<JsonInput
|
|
14069
|
+
id="json-webhook-showcase"
|
|
14070
|
+
value={value}
|
|
14071
|
+
onChange={(e) => setValue(e.target.value)}
|
|
14072
|
+
onValidChange={setParsed}
|
|
14073
|
+
onError={setError}
|
|
14074
|
+
placeholder='{"events": ["user.created"], "org": "Harborline Logistics"}'
|
|
14075
|
+
className="w-full"
|
|
14076
|
+
/>
|
|
14077
|
+
</div>
|
|
14078
|
+
|
|
14079
|
+
{parsed !== null && (
|
|
14080
|
+
<div className="rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground">
|
|
14081
|
+
<p className="mb-1 font-medium text-foreground">Parsed result:</p>
|
|
14082
|
+
<pre className="whitespace-pre-wrap break-all font-mono text-xs">
|
|
14083
|
+
{JSON.stringify(parsed, null, 2)}
|
|
14084
|
+
</pre>
|
|
14085
|
+
</div>
|
|
14086
|
+
)}
|
|
14087
|
+
{error && (
|
|
14088
|
+
<p className="text-xs text-muted-foreground">
|
|
14089
|
+
Validation state: invalid
|
|
14090
|
+
</p>
|
|
14091
|
+
)}
|
|
14092
|
+
</div>
|
|
14093
|
+
</div>
|
|
14094
|
+
</div>
|
|
14095
|
+
);
|
|
14096
|
+
}
|
|
14097
|
+
|
|
14098
|
+
// ─── SortableList Showcase ────────────────────────────────────────────────────
|
|
14099
|
+
|
|
14100
|
+
const SORTABLE_PIPELINE = [
|
|
14101
|
+
{ id: "s1", label: "Qualification" },
|
|
14102
|
+
{ id: "s2", label: "Discovery" },
|
|
14103
|
+
{ id: "s3", label: "Proposal" },
|
|
14104
|
+
{ id: "s4", label: "Negotiation" },
|
|
14105
|
+
{ id: "s5", label: "Closed" },
|
|
14106
|
+
];
|
|
14107
|
+
|
|
14108
|
+
const SORTABLE_PRIORITIES = [
|
|
14109
|
+
{ id: "p1", label: "Northwind Health integration", priority: "high" as const },
|
|
14110
|
+
{ id: "p2", label: "Token refresh — Cedar & Pine Studio", priority: "medium" as const },
|
|
14111
|
+
{ id: "p3", label: "Harborline Logistics onboarding", priority: "medium" as const },
|
|
14112
|
+
{ id: "p4", label: "WCAG AAA audit — Meridian Payments", priority: "low" as const },
|
|
14113
|
+
];
|
|
14114
|
+
|
|
14115
|
+
const SORTABLE_TEAM = [
|
|
14116
|
+
{ id: "u1", name: "Jordan Reeves", role: "Design Lead" },
|
|
14117
|
+
{ id: "u2", name: "Seo-yun Park", role: "Senior Engineer" },
|
|
14118
|
+
{ id: "u3", name: "Marcus Lindqvist", role: "Product Manager" },
|
|
14119
|
+
{ id: "u4", name: "Anika Patel", role: "QA Engineer" },
|
|
14120
|
+
];
|
|
14121
|
+
|
|
14122
|
+
function SortableListShowcase() {
|
|
14123
|
+
const [pipeline, setPipeline] = React.useState(SORTABLE_PIPELINE);
|
|
14124
|
+
const [priorities, setPriorities] = React.useState(SORTABLE_PRIORITIES);
|
|
14125
|
+
const [team, setTeam] = React.useState(SORTABLE_TEAM);
|
|
14126
|
+
|
|
14127
|
+
return (
|
|
14128
|
+
<div className="flex flex-wrap gap-8">
|
|
14129
|
+
{/* Default */}
|
|
14130
|
+
<div className="space-y-2">
|
|
14131
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Default</p>
|
|
14132
|
+
<SortableList
|
|
14133
|
+
items={pipeline}
|
|
14134
|
+
onReorder={setPipeline}
|
|
14135
|
+
aria-label="Pipeline stages"
|
|
14136
|
+
className="w-56"
|
|
14137
|
+
renderItem={(item) => (
|
|
14138
|
+
<span className="text-sm text-foreground">{item.label}</span>
|
|
14139
|
+
)}
|
|
14140
|
+
/>
|
|
14141
|
+
</div>
|
|
14142
|
+
|
|
14143
|
+
{/* With badges */}
|
|
14144
|
+
<div className="space-y-2">
|
|
14145
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">With badges</p>
|
|
14146
|
+
<SortableList
|
|
14147
|
+
items={priorities}
|
|
14148
|
+
onReorder={setPriorities}
|
|
14149
|
+
aria-label="Project priorities"
|
|
14150
|
+
className="w-80"
|
|
14151
|
+
renderItem={(item) => (
|
|
14152
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
14153
|
+
<span className="min-w-0 flex-1 truncate text-sm text-foreground">{item.label}</span>
|
|
14154
|
+
<Badge
|
|
14155
|
+
variant={
|
|
14156
|
+
item.priority === "high" ? "destructive"
|
|
14157
|
+
: item.priority === "medium" ? "secondary"
|
|
14158
|
+
: "outline"
|
|
14159
|
+
}
|
|
14160
|
+
className="shrink-0 text-xs"
|
|
14161
|
+
>
|
|
14162
|
+
{item.priority}
|
|
14163
|
+
</Badge>
|
|
14164
|
+
</div>
|
|
14165
|
+
)}
|
|
14166
|
+
/>
|
|
14167
|
+
</div>
|
|
14168
|
+
|
|
14169
|
+
{/* Realistic — team review order */}
|
|
14170
|
+
<div className="space-y-2">
|
|
14171
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
|
|
14172
|
+
Realistic — Fieldnote Labs review order
|
|
14173
|
+
</p>
|
|
14174
|
+
<SortableList
|
|
14175
|
+
items={team}
|
|
14176
|
+
onReorder={setTeam}
|
|
14177
|
+
aria-label="Team review order"
|
|
14178
|
+
className="w-72"
|
|
14179
|
+
renderItem={(member) => (
|
|
14180
|
+
<div className="min-w-0">
|
|
14181
|
+
<p className="truncate text-sm font-medium text-foreground">{member.name}</p>
|
|
14182
|
+
<p className="truncate text-xs text-muted-foreground">{member.role}</p>
|
|
14183
|
+
</div>
|
|
14184
|
+
)}
|
|
14185
|
+
/>
|
|
14186
|
+
</div>
|
|
14187
|
+
|
|
14188
|
+
{/* Disabled */}
|
|
14189
|
+
<div className="space-y-2">
|
|
14190
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Disabled</p>
|
|
14191
|
+
<SortableList
|
|
14192
|
+
items={[
|
|
14193
|
+
{ id: "d1", label: "Qualification" },
|
|
14194
|
+
{ id: "d2", label: "Discovery" },
|
|
14195
|
+
{ id: "d3", label: "Proposal" },
|
|
14196
|
+
]}
|
|
14197
|
+
onReorder={() => {}}
|
|
14198
|
+
disabled
|
|
14199
|
+
className="w-56"
|
|
14200
|
+
aria-label="Disabled sortable list"
|
|
14201
|
+
renderItem={(item) => (
|
|
14202
|
+
<span className="text-sm text-muted-foreground">{item.label}</span>
|
|
14203
|
+
)}
|
|
14204
|
+
/>
|
|
14205
|
+
</div>
|
|
14206
|
+
</div>
|
|
14207
|
+
);
|
|
14208
|
+
}
|
|
14209
|
+
|
|
14210
|
+
// Deterministic matrix for the Heatmap showcase — seeded LCG, never
|
|
14211
|
+
// Math.random (SSR hydration + Chromatic determinism).
|
|
14212
|
+
function heatmapMatrix(rowCount: number, colCount: number, seed: number, max = 24) {
|
|
14213
|
+
let s = seed >>> 0;
|
|
14214
|
+
const next = () => {
|
|
14215
|
+
s = (s * 1664525 + 1013904223) >>> 0;
|
|
14216
|
+
return s / 0x100000000;
|
|
14217
|
+
};
|
|
14218
|
+
return Array.from({ length: rowCount }, (_, r) =>
|
|
14219
|
+
Array.from({ length: colCount }, (_, c) => {
|
|
14220
|
+
const weight = r >= 5 ? 0.35 : 1;
|
|
14221
|
+
const ramp = 0.4 + (c / Math.max(1, colCount - 1)) * 0.6;
|
|
14222
|
+
return Math.round(next() * max * weight * ramp);
|
|
14223
|
+
}),
|
|
14224
|
+
);
|
|
14225
|
+
}
|
|
14226
|
+
|
|
14227
|
+
const HEATMAP_WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
14228
|
+
const heatmapWeeks = (n: number) => Array.from({ length: n }, (_, i) => `W${i + 1}`);
|
|
14229
|
+
|
|
14230
|
+
function HeatmapShowcase() {
|
|
14231
|
+
const commits = (v: number) => `${v} commits`;
|
|
14232
|
+
return (
|
|
14233
|
+
<div className="space-y-8">
|
|
14234
|
+
<p className="text-sm text-muted-foreground">
|
|
14235
|
+
A matrix of cells whose color intensity encodes a value — the
|
|
14236
|
+
contribution-calendar / hour-by-weekday shape. Built on a native{" "}
|
|
14237
|
+
<code className="font-mono"><table></code>: row and column
|
|
14238
|
+
headers are the axes and every cell carries its formatted value as
|
|
14239
|
+
screen-reader text, so the chart is its own text alternative. One
|
|
14240
|
+
series color (<code className="font-mono">--chart-1</code> by default)
|
|
14241
|
+
with a five-level opacity ramp; the lowest bucket and “no
|
|
14242
|
+
data” are <code className="font-mono">--muted</code>. The root is
|
|
14243
|
+
a focusable scroll region for wide matrices.
|
|
14244
|
+
</p>
|
|
14245
|
+
<div className="space-y-2">
|
|
14246
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14247
|
+
Default — md cells, Less → More legend, per-cell tooltip
|
|
14248
|
+
</p>
|
|
14249
|
+
<Heatmap
|
|
14250
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14251
|
+
columns={heatmapWeeks(12)}
|
|
14252
|
+
data={heatmapMatrix(7, 12, 7)}
|
|
14253
|
+
label="Token commits by weekday, last 12 weeks"
|
|
14254
|
+
formatValue={commits}
|
|
14255
|
+
/>
|
|
14256
|
+
</div>
|
|
14257
|
+
<div className="space-y-2">
|
|
14258
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14259
|
+
Sizes — sm (12px) / md (16px) / lg (24px)
|
|
14260
|
+
</p>
|
|
14261
|
+
<div className="flex flex-wrap items-end gap-8">
|
|
14262
|
+
<Heatmap
|
|
14263
|
+
size="sm"
|
|
14264
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14265
|
+
columns={heatmapWeeks(6)}
|
|
14266
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14267
|
+
label="Token commits by weekday, 6 weeks, small cells"
|
|
14268
|
+
formatValue={commits}
|
|
14269
|
+
showLegend={false}
|
|
14270
|
+
/>
|
|
14271
|
+
<Heatmap
|
|
14272
|
+
size="md"
|
|
14273
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14274
|
+
columns={heatmapWeeks(6)}
|
|
14275
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14276
|
+
label="Token commits by weekday, 6 weeks, medium cells"
|
|
14277
|
+
formatValue={commits}
|
|
14278
|
+
showLegend={false}
|
|
14279
|
+
/>
|
|
14280
|
+
<Heatmap
|
|
14281
|
+
size="lg"
|
|
14282
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14283
|
+
columns={heatmapWeeks(6)}
|
|
14284
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14285
|
+
label="Token commits by weekday, 6 weeks, large cells"
|
|
14286
|
+
formatValue={commits}
|
|
14287
|
+
showLegend={false}
|
|
14288
|
+
/>
|
|
14289
|
+
</div>
|
|
14290
|
+
</div>
|
|
14291
|
+
<div className="space-y-2">
|
|
14292
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14293
|
+
Series color from the chart palette (--chart-2) and null cells as
|
|
14294
|
+
“no data”
|
|
14295
|
+
</p>
|
|
14296
|
+
<Heatmap
|
|
14297
|
+
color="var(--chart-2)"
|
|
14298
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14299
|
+
columns={heatmapWeeks(8)}
|
|
14300
|
+
data={heatmapMatrix(7, 8, 11).map((row, r) =>
|
|
14301
|
+
row.map((v, c) => (c > 5 && r > 3 ? null : v)),
|
|
14302
|
+
)}
|
|
14303
|
+
label="Review comments by weekday — weeks 7 and 8 not yet synced"
|
|
14304
|
+
formatValue={(v) => `${v} comments`}
|
|
14305
|
+
/>
|
|
14306
|
+
</div>
|
|
14307
|
+
<div className="space-y-2">
|
|
14308
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14309
|
+
Hour × weekday — Storybook sessions at Fieldnote Labs
|
|
14310
|
+
</p>
|
|
14311
|
+
<Heatmap
|
|
14312
|
+
size="sm"
|
|
14313
|
+
color="var(--chart-3)"
|
|
14314
|
+
rows={Array.from({ length: 12 }, (_, h) => `${h + 8}:00`)}
|
|
14315
|
+
columns={HEATMAP_WEEKDAYS.slice(0, 5)}
|
|
14316
|
+
data={heatmapMatrix(12, 5, 23, 60)}
|
|
14317
|
+
label="Storybook sessions by hour and weekday, Fieldnote Labs"
|
|
14318
|
+
formatValue={(v) => `${v} sessions`}
|
|
14319
|
+
/>
|
|
14320
|
+
</div>
|
|
14321
|
+
<div className="space-y-2">
|
|
14322
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14323
|
+
Wide matrix in a narrow card — the root scrolls and is keyboard
|
|
14324
|
+
focusable (52 weeks in 420px)
|
|
14325
|
+
</p>
|
|
14326
|
+
<div className="w-[420px] max-w-full rounded-lg border p-4">
|
|
14327
|
+
<Heatmap
|
|
14328
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14329
|
+
columns={heatmapWeeks(52)}
|
|
14330
|
+
data={heatmapMatrix(7, 52, 19)}
|
|
14331
|
+
label="Jordan Reeves token commits by weekday, 52 weeks"
|
|
14332
|
+
formatValue={commits}
|
|
14333
|
+
/>
|
|
14334
|
+
</div>
|
|
14335
|
+
</div>
|
|
14336
|
+
</div>
|
|
14337
|
+
);
|
|
14338
|
+
}
|
|
14339
|
+
|
|
14340
|
+
function NavigationProgressShowcase() {
|
|
14341
|
+
const { progress, active, start, set, increment, stop, complete, reset } =
|
|
14342
|
+
useNavigationProgress();
|
|
14343
|
+
const [size, setSize] = React.useState<"sm" | "md" | "lg">("md");
|
|
14344
|
+
return (
|
|
14345
|
+
<div className="space-y-8">
|
|
14346
|
+
{/* One bar per document: the Components tab is its own iframe, so the
|
|
14347
|
+
bar pins to the top edge of this tab, not the host shell. */}
|
|
14348
|
+
<NavigationProgress size={size} />
|
|
14349
|
+
<p className="text-sm text-muted-foreground">
|
|
14350
|
+
The thin bar at the top of the viewport that fills while a route
|
|
14351
|
+
change or a long request is in flight — the YouTube / GitHub /
|
|
14352
|
+
Next.js pattern. Driven from outside React by an imperative store
|
|
14353
|
+
(<code className="font-mono">navigationProgress.start()</code> …{" "}
|
|
14354
|
+
<code className="font-mono">.complete()</code>) so a router hook or a
|
|
14355
|
+
fetch wrapper can call it with no component in reach;{" "}
|
|
14356
|
+
<code className="font-mono">useNavigationProgress()</code> reads the
|
|
14357
|
+
state. Starts at 8%, trickles toward 90% on a deterministic ladder,
|
|
14358
|
+
fills to 100% on complete, settles for one{" "}
|
|
14359
|
+
<code className="font-mono">--duration-base</code>, fades, resets.
|
|
14360
|
+
Mount once per document — here it pins to the top edge of this tab.
|
|
14361
|
+
</p>
|
|
14362
|
+
<div className="space-y-2">
|
|
14363
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14364
|
+
Drive the store — watch the top edge of this tab
|
|
14365
|
+
</p>
|
|
14366
|
+
<p className="text-sm text-muted-foreground" aria-live="polite">
|
|
14367
|
+
{active ? `Loading — ${Math.round(progress)}%` : "Idle — the bar is hidden"}
|
|
14368
|
+
</p>
|
|
14369
|
+
<div className="flex flex-wrap gap-2">
|
|
14370
|
+
<Button size="xl" onClick={() => start()}>Start</Button>
|
|
14371
|
+
<Button size="xl" variant="outline" onClick={() => set(60)}>Set 60%</Button>
|
|
14372
|
+
<Button size="xl" variant="outline" onClick={() => increment(10)}>+10</Button>
|
|
14373
|
+
<Button size="xl" variant="outline" onClick={() => stop()}>Stop</Button>
|
|
14374
|
+
<Button size="xl" variant="secondary" onClick={() => complete()}>Complete</Button>
|
|
14375
|
+
<Button size="xl" variant="ghost" onClick={() => reset()}>Reset</Button>
|
|
14376
|
+
</div>
|
|
14377
|
+
</div>
|
|
14378
|
+
<div className="space-y-2">
|
|
14379
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14380
|
+
Sizes — sm (2px) / md (4px, default) / lg (6px)
|
|
14381
|
+
</p>
|
|
14382
|
+
<SegmentedControl
|
|
14383
|
+
value={size}
|
|
14384
|
+
onValueChange={(v) => setSize(v as "sm" | "md" | "lg")}
|
|
14385
|
+
label="Navigation progress size"
|
|
14386
|
+
className="w-fit"
|
|
14387
|
+
>
|
|
14388
|
+
<SegmentedControlItem value="sm">sm</SegmentedControlItem>
|
|
14389
|
+
<SegmentedControlItem value="md">md</SegmentedControlItem>
|
|
14390
|
+
<SegmentedControlItem value="lg">lg</SegmentedControlItem>
|
|
14391
|
+
</SegmentedControl>
|
|
14392
|
+
</div>
|
|
14393
|
+
</div>
|
|
14394
|
+
);
|
|
14395
|
+
}
|
|
14396
|
+
|
|
14397
|
+
// File names and byte counts from content/personas/bads.json → files[].
|
|
14398
|
+
const ATTACHMENT_FILES = [
|
|
14399
|
+
{ name: "roi-report-2026-06.pdf", bytes: 1_536_000, type: "application/pdf" },
|
|
14400
|
+
{ name: "styles.css", bytes: 42_700, type: "text/css" },
|
|
14401
|
+
{ name: "chromatic-snapshots-2026-06.zip", bytes: 1_073_741_824, type: "application/zip" },
|
|
14402
|
+
] as const;
|
|
14403
|
+
|
|
14404
|
+
function AttachmentShowcase() {
|
|
14405
|
+
const [attached, setAttached] = React.useState<
|
|
14406
|
+
Array<{ name: string; bytes: number; type: string }>
|
|
14407
|
+
>([...ATTACHMENT_FILES]);
|
|
14408
|
+
const [sending, setSending] = React.useState(false);
|
|
14409
|
+
// Removing a chip unmounts the focused button; send focus back to the
|
|
14410
|
+
// composer so a keyboard user is not dropped on <body>. The component
|
|
14411
|
+
// leaves this to the consumer on purpose — only the composer knows where
|
|
14412
|
+
// "back" is.
|
|
14413
|
+
const composerRef = React.useRef<HTMLTextAreaElement>(null);
|
|
14414
|
+
|
|
14415
|
+
return (
|
|
14416
|
+
<div className="space-y-8">
|
|
14417
|
+
<p className="text-sm text-muted-foreground">
|
|
14418
|
+
The pre-send file chip inside a chat composer — the review step
|
|
14419
|
+
between picking a file (FileButton) and sending the message
|
|
14420
|
+
(ChatInput). File-type icon from the MIME type with an extension
|
|
14421
|
+
fallback, truncated name with the full value on{" "}
|
|
14422
|
+
<code className="font-mono">title</code>, size via FormatByte, and
|
|
14423
|
+
a 44px CloseButton labeled{" "}
|
|
14424
|
+
<code className="font-mono">Remove <name></code>. The root is{" "}
|
|
14425
|
+
<code className="font-mono">role="group"</code> named{" "}
|
|
14426
|
+
<code className="font-mono">Attached file: <name></code>. Not a
|
|
14427
|
+
drop zone (that is FileUpload) and not a post-send card (FileCard).
|
|
14428
|
+
</p>
|
|
14429
|
+
<div className="space-y-2">
|
|
14430
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14431
|
+
Default — PDF, image, code, archive
|
|
14432
|
+
</p>
|
|
14433
|
+
<div className="flex flex-wrap gap-2">
|
|
14434
|
+
<Attachment
|
|
14435
|
+
fileName="roi-report-2026-06.pdf"
|
|
14436
|
+
fileSize={1_536_000}
|
|
14437
|
+
fileType="application/pdf"
|
|
14438
|
+
onRemove={() => {}}
|
|
14439
|
+
/>
|
|
14440
|
+
<Attachment
|
|
14441
|
+
fileName="favicon.svg"
|
|
14442
|
+
fileSize={500}
|
|
14443
|
+
fileType="image/svg+xml"
|
|
14444
|
+
onRemove={() => {}}
|
|
14445
|
+
/>
|
|
14446
|
+
<Attachment
|
|
14447
|
+
fileName="styles.css"
|
|
14448
|
+
fileSize={42_700}
|
|
14449
|
+
fileType="text/css"
|
|
14450
|
+
onRemove={() => {}}
|
|
14451
|
+
/>
|
|
14452
|
+
<Attachment
|
|
14453
|
+
fileName="chromatic-snapshots-2026-06.zip"
|
|
14454
|
+
fileSize={1_073_741_824}
|
|
14455
|
+
fileType="application/zip"
|
|
14456
|
+
onRemove={() => {}}
|
|
14457
|
+
/>
|
|
14458
|
+
</div>
|
|
14459
|
+
</div>
|
|
14460
|
+
<div className="space-y-2">
|
|
14461
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14462
|
+
Unknown MIME type (the browser reports "" for .fig) — extension
|
|
14463
|
+
fallback, generic icon
|
|
14464
|
+
</p>
|
|
14465
|
+
<Attachment
|
|
14466
|
+
fileName="tokens-v2-proposal.fig"
|
|
14467
|
+
fileSize={24_618_034}
|
|
14468
|
+
fileType=""
|
|
14469
|
+
onRemove={() => {}}
|
|
14470
|
+
/>
|
|
14471
|
+
</div>
|
|
14472
|
+
<div className="space-y-2">
|
|
14473
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14474
|
+
Read-only (no onRemove) and disabled (while sending)
|
|
14475
|
+
</p>
|
|
14476
|
+
<div className="flex flex-wrap gap-2">
|
|
14477
|
+
<Attachment
|
|
14478
|
+
fileName="brand-fonts.woff2"
|
|
14479
|
+
fileSize={84_512}
|
|
14480
|
+
fileType="font/woff2"
|
|
14481
|
+
/>
|
|
14482
|
+
<Attachment
|
|
14483
|
+
fileName="roi-report-2026-06.pdf"
|
|
14484
|
+
fileSize={1_536_000}
|
|
14485
|
+
fileType="application/pdf"
|
|
14486
|
+
onRemove={() => {}}
|
|
14487
|
+
disabled
|
|
14488
|
+
/>
|
|
14489
|
+
</div>
|
|
14490
|
+
</div>
|
|
14491
|
+
<div className="space-y-2">
|
|
14492
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14493
|
+
In a composer — remove a chip, re-attach with the paperclip, send to
|
|
14494
|
+
watch the disabled state
|
|
14495
|
+
</p>
|
|
14496
|
+
<Card className="w-[28rem] max-w-full gap-0 p-3">
|
|
14497
|
+
<Textarea
|
|
14498
|
+
ref={composerRef}
|
|
14499
|
+
aria-label="Message to Jordan Reeves"
|
|
14500
|
+
placeholder="Message Jordan Reeves"
|
|
14501
|
+
defaultValue="Here's the June ROI export, the generated stylesheet, and last quarter's Chromatic baseline."
|
|
14502
|
+
className="min-h-20 resize-none border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
|
|
14503
|
+
/>
|
|
14504
|
+
{attached.length > 0 && (
|
|
14505
|
+
<div className="mt-2 flex flex-wrap gap-2 px-1" aria-label="Attachments">
|
|
14506
|
+
{attached.map((f) => (
|
|
14507
|
+
<Attachment
|
|
14508
|
+
key={f.name}
|
|
14509
|
+
fileName={f.name}
|
|
14510
|
+
fileSize={f.bytes}
|
|
14511
|
+
fileType={f.type}
|
|
14512
|
+
disabled={sending}
|
|
14513
|
+
onRemove={() => {
|
|
14514
|
+
setAttached((prev) => prev.filter((p) => p.name !== f.name));
|
|
14515
|
+
composerRef.current?.focus();
|
|
14516
|
+
}}
|
|
14517
|
+
/>
|
|
14518
|
+
))}
|
|
14519
|
+
</div>
|
|
14520
|
+
)}
|
|
14521
|
+
<div className="mt-3 flex items-center justify-between gap-2">
|
|
14522
|
+
<Button
|
|
14523
|
+
type="button"
|
|
14524
|
+
variant="ghost"
|
|
14525
|
+
size="icon-xl"
|
|
14526
|
+
aria-label="Attach a file"
|
|
14527
|
+
disabled={sending}
|
|
14528
|
+
onClick={() =>
|
|
14529
|
+
setAttached((prev) =>
|
|
14530
|
+
prev.some((p) => p.name === "favicon.svg")
|
|
14531
|
+
? prev
|
|
14532
|
+
: [...prev, { name: "favicon.svg", bytes: 500, type: "image/svg+xml" }]
|
|
14533
|
+
)
|
|
14534
|
+
}
|
|
14535
|
+
>
|
|
14536
|
+
<AttachmentPaperclipIcon strokeWidth={1.5} aria-hidden="true" />
|
|
14537
|
+
</Button>
|
|
14538
|
+
<Button
|
|
14539
|
+
type="button"
|
|
14540
|
+
size="xl"
|
|
14541
|
+
disabled={sending}
|
|
14542
|
+
loading={sending}
|
|
14543
|
+
onClick={() => {
|
|
14544
|
+
setSending(true);
|
|
14545
|
+
window.setTimeout(() => {
|
|
14546
|
+
setSending(false);
|
|
14547
|
+
setAttached([]);
|
|
14548
|
+
}, 1200);
|
|
14549
|
+
}}
|
|
14550
|
+
>
|
|
14551
|
+
<AttachmentSendIcon strokeWidth={1.5} aria-hidden="true" />
|
|
14552
|
+
Send
|
|
14553
|
+
</Button>
|
|
14554
|
+
</div>
|
|
14555
|
+
</Card>
|
|
14556
|
+
</div>
|
|
14557
|
+
</div>
|
|
14558
|
+
);
|
|
14559
|
+
}
|