@behavioral-agentic-design-system/core 0.42.0 → 0.45.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/LICENSE +21 -0
- package/package.json +25 -9
- package/scripts/a11y-lint.cjs +25 -1
- package/scripts/check-spec.mjs +73 -0
- package/scripts/deal-directions.mjs +186 -0
- package/scripts/health-report.mjs +20 -14
- package/scripts/lib/counted-lint.mjs +100 -0
- package/scripts/lib/marketing-library.mjs +129 -0
- package/scripts/lib/on-system.mjs +249 -0
- package/scripts/lib/random.mjs +22 -0
- package/scripts/lib/spec-parse.d.mts +25 -0
- package/scripts/lib/spec-parse.mjs +188 -0
- package/scripts/lib/tells.mjs +128 -0
- package/scripts/lint-css-vars.mjs +175 -0
- package/scripts/lint-html-nesting.mjs +116 -0
- package/scripts/lint-live-ctas.mjs +138 -0
- package/scripts/on-system-score.mjs +95 -0
- package/scripts/slop-rules.mjs +1 -1
- package/scripts/source-images.mjs +180 -0
- package/scripts/ux-tells.mjs +78 -0
- package/src/api/brand-colors.ts +3 -0
- package/src/api/brand-fonts.ts +3 -0
- package/src/api/brand-mark.ts +6 -1
- package/src/api/dev-write-guard.ts +53 -0
- package/src/api/layers/file.ts +7 -4
- package/src/api/onboarding-extract.ts +85 -30
- package/src/api/onboarding.ts +3 -0
- package/src/api/save-tokens.ts +3 -0
- package/src/app/layout.tsx +6 -0
- package/src/app/preview/canvas/page.tsx +12 -0
- package/src/app/preview/components/page.tsx +734 -0
- package/src/app/preview/studio/blank-screen.tsx +143 -0
- package/src/app/preview/studio/page.tsx +7 -0
- package/src/app/shell.tsx +160 -44
- package/src/components/canvas/canvas.tsx +458 -0
- package/src/components/canvas/layout.ts +72 -0
- package/src/components/canvas/parse-canvas.ts +32 -0
- package/src/components/canvas/sample.ts +90 -0
- package/src/components/canvas/spec-frame.tsx +43 -0
- package/src/components/canvas/types.ts +33 -0
- package/src/components/docs-tab.tsx +7 -7
- package/src/components/home-recent.tsx +73 -0
- package/src/components/home-tab.tsx +13 -13
- package/src/components/layers-tab.tsx +2 -2
- package/src/components/markdown-preview.tsx +60 -12
- package/src/components/studio/control-panel.tsx +299 -0
- package/src/components/studio/control-row.tsx +77 -0
- package/src/components/studio/preview-frame.tsx +165 -0
- package/src/components/studio/preview-pane.tsx +247 -0
- package/src/components/studio/studio.tsx +133 -128
- package/src/components/studio/types.ts +218 -0
- package/src/components/studio/use-studio-tweaks.ts +128 -0
- package/src/components/studio/use-studio-view-state.ts +72 -0
- package/src/components/ui/autocomplete.tsx +1 -1
- package/src/components/ui/color-picker.tsx +20 -4
- package/src/components/ui/data-table.tsx +64 -3
- package/src/components/ui/date-field.tsx +1 -1
- package/src/components/ui/editable.tsx +1 -0
- package/src/components/ui/faceted-filter.tsx +187 -0
- package/src/components/ui/gauge-chart.tsx +18 -4
- package/src/components/ui/inline-edit.tsx +175 -0
- package/src/components/ui/month-picker.tsx +1 -1
- package/src/components/ui/number-input.tsx +28 -5
- package/src/components/ui/otp-input.tsx +208 -0
- package/src/components/ui/phone-input.tsx +274 -0
- package/src/components/ui/search-input.tsx +1 -1
- package/src/components/ui/tags-input.tsx +1 -1
- package/src/components/ui/timer.tsx +1 -0
- package/src/components/ui/transfer-list.tsx +13 -26
- package/src/components/ui/week-picker.tsx +1 -1
- package/src/components/ui/year-picker.tsx +1 -1
- package/src/data/component-added.json +958 -0
- package/src/data/docs-index.ts +13 -1
- package/src/hooks/use-global-mono-font.ts +1 -0
- package/src/hooks/use-global-primary-color.ts +1 -0
- package/src/hooks/use-global-sans-font.ts +1 -0
- package/src/hooks/use-global-serif-font.ts +1 -0
- package/src/hooks/use-global-type-scale.ts +17 -2
- package/src/hooks/use-mobile.ts +2 -0
- package/src/hooks/use-sync-type-scale.ts +7 -11
- package/src/lib/spec-parse.ts +4 -0
- package/src/lib/svg-sanitize.ts +19 -9
- package/src/stories/Autocomplete.stories.tsx +2 -0
- package/src/stories/Canvas.stories.tsx +45 -0
- package/src/stories/ColorPicker.stories.tsx +40 -0
- package/src/stories/DataTable.stories.tsx +30 -0
- package/src/stories/DateField.stories.tsx +21 -0
- package/src/stories/Editable.stories.tsx +2 -0
- package/src/stories/FacetedFilter.stories.tsx +197 -0
- package/src/stories/GaugeChart.stories.tsx +9 -3
- package/src/stories/InlineEdit.stories.tsx +106 -0
- package/src/stories/MarkdownPreview.stories.tsx +53 -0
- package/src/stories/MonthPicker.stories.tsx +21 -0
- package/src/stories/NumberInput.stories.tsx +25 -0
- package/src/stories/OtpInput.stories.tsx +110 -0
- package/src/stories/PhoneInput.stories.tsx +127 -0
- package/src/stories/SearchInput.stories.tsx +2 -0
- package/src/stories/TagsInput.stories.tsx +2 -0
- package/src/stories/Timer.stories.tsx +26 -0
- package/src/stories/TransferList.stories.tsx +4 -0
- package/src/stories/WeekPicker.stories.tsx +21 -0
- package/src/stories/YearPicker.stories.tsx +21 -0
- package/src/stories/story-groups.json +22 -16
- package/src/tokens.json +82 -54
|
@@ -122,6 +122,8 @@ import { PasswordInput } from "@behavioral-agentic-design-system/core/components
|
|
|
122
122
|
import { Notification } from "@behavioral-agentic-design-system/core/components/ui/notification";
|
|
123
123
|
import { FloatingPanel } from "@behavioral-agentic-design-system/core/components/ui/floating-panel";
|
|
124
124
|
import { NumberInput } from "@behavioral-agentic-design-system/core/components/ui/number-input";
|
|
125
|
+
import { InlineEdit } from "@behavioral-agentic-design-system/core/components/ui/inline-edit";
|
|
126
|
+
import { OTPInput } from "@behavioral-agentic-design-system/core/components/ui/otp-input";
|
|
125
127
|
import { FileUpload } from "@behavioral-agentic-design-system/core/components/ui/file-upload";
|
|
126
128
|
import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/spinner";
|
|
127
129
|
import { CircularProgress } from "@behavioral-agentic-design-system/core/components/ui/circular-progress";
|
|
@@ -451,11 +453,22 @@ import {
|
|
|
451
453
|
NavigationProgress,
|
|
452
454
|
useNavigationProgress,
|
|
453
455
|
} from "@behavioral-agentic-design-system/core/components/ui/navigation-progress";
|
|
456
|
+
import {
|
|
457
|
+
FacetedFilter,
|
|
458
|
+
type FacetedFilterOption,
|
|
459
|
+
} from "@behavioral-agentic-design-system/core/components/ui/faceted-filter";
|
|
454
460
|
import { Attachment } from "@behavioral-agentic-design-system/core/components/ui/attachment";
|
|
455
461
|
import {
|
|
456
462
|
Paperclip as AttachmentPaperclipIcon,
|
|
457
463
|
SendHorizontal as AttachmentSendIcon,
|
|
458
464
|
} from "lucide-react";
|
|
465
|
+
import { PhoneInput } from "@behavioral-agentic-design-system/core/components/ui/phone-input";
|
|
466
|
+
import { PaymentMethodCard } from "@/components/payment-method-card";
|
|
467
|
+
import { TwoFactorCard } from "@/components/two-factor-card";
|
|
468
|
+
import { TeamMembersCard } from "@/components/team-members-card";
|
|
469
|
+
import { ActiveSessionsCard } from "@/components/active-sessions-card";
|
|
470
|
+
import { DomainVerificationCard } from "@/components/domain-verification-card";
|
|
471
|
+
import { NotificationPreferencesCard } from "@/components/notification-preferences-card";
|
|
459
472
|
|
|
460
473
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
461
474
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -6401,9 +6414,39 @@ export default function ComponentsPreview() {
|
|
|
6401
6414
|
<Section title="NavigationProgress">
|
|
6402
6415
|
<NavigationProgressShowcase />
|
|
6403
6416
|
</Section>
|
|
6417
|
+
<Section title="Faceted Filter">
|
|
6418
|
+
<FacetedFilterShowcase />
|
|
6419
|
+
</Section>
|
|
6404
6420
|
<Section title="Attachment">
|
|
6405
6421
|
<AttachmentShowcase />
|
|
6406
6422
|
</Section>
|
|
6423
|
+
<Section title="Phone Input">
|
|
6424
|
+
<PhoneInputShowcase />
|
|
6425
|
+
</Section>
|
|
6426
|
+
<Section title="TwoFactorCard">
|
|
6427
|
+
<TwoFactorCardShowcase />
|
|
6428
|
+
</Section>
|
|
6429
|
+
<Section title="PaymentMethodCard">
|
|
6430
|
+
<PaymentMethodCardShowcase />
|
|
6431
|
+
</Section>
|
|
6432
|
+
<Section title="TeamMembersCard">
|
|
6433
|
+
<TeamMembersCardShowcase />
|
|
6434
|
+
</Section>
|
|
6435
|
+
<Section title="ActiveSessionsCard">
|
|
6436
|
+
<ActiveSessionsCardShowcase />
|
|
6437
|
+
</Section>
|
|
6438
|
+
<Section title="DomainVerificationCard">
|
|
6439
|
+
<DomainVerificationCardShowcase />
|
|
6440
|
+
</Section>
|
|
6441
|
+
<Section title="NotificationPreferencesCard">
|
|
6442
|
+
<NotificationPreferencesCardShowcase />
|
|
6443
|
+
</Section>
|
|
6444
|
+
<Section title="InlineEdit">
|
|
6445
|
+
<InlineEditShowcase />
|
|
6446
|
+
</Section>
|
|
6447
|
+
<Section title="OTPInput">
|
|
6448
|
+
<OTPInputShowcase />
|
|
6449
|
+
</Section>
|
|
6407
6450
|
</div>
|
|
6408
6451
|
</div>
|
|
6409
6452
|
);
|
|
@@ -14394,6 +14437,72 @@ function NavigationProgressShowcase() {
|
|
|
14394
14437
|
);
|
|
14395
14438
|
}
|
|
14396
14439
|
|
|
14440
|
+
// ---------------------------------------------------------------------------
|
|
14441
|
+
// FacetedFilter showcase
|
|
14442
|
+
// ---------------------------------------------------------------------------
|
|
14443
|
+
|
|
14444
|
+
const FACET_STATUS_OPTIONS: FacetedFilterOption[] = [
|
|
14445
|
+
{ label: "Active", value: "active", count: 124 },
|
|
14446
|
+
{ label: "Inactive", value: "inactive", count: 38 },
|
|
14447
|
+
{ label: "Pending", value: "pending", count: 17 },
|
|
14448
|
+
{ label: "Archived", value: "archived", count: 6 },
|
|
14449
|
+
];
|
|
14450
|
+
|
|
14451
|
+
const FACET_ROLE_OPTIONS: FacetedFilterOption[] = [
|
|
14452
|
+
{ label: "Admin", value: "admin", count: 8 },
|
|
14453
|
+
{ label: "Member", value: "member", count: 93 },
|
|
14454
|
+
{ label: "Viewer", value: "viewer", count: 64 },
|
|
14455
|
+
];
|
|
14456
|
+
|
|
14457
|
+
function FacetedFilterShowcase() {
|
|
14458
|
+
const [statusSelected, setStatusSelected] = React.useState<Set<string>>(
|
|
14459
|
+
new Set()
|
|
14460
|
+
);
|
|
14461
|
+
const [roleSelected, setRoleSelected] = React.useState<Set<string>>(
|
|
14462
|
+
new Set(["admin"])
|
|
14463
|
+
);
|
|
14464
|
+
return (
|
|
14465
|
+
<div className="flex flex-col gap-6">
|
|
14466
|
+
{/* Filter toolbar demo */}
|
|
14467
|
+
{/* lint-disable: card-bypass — inline demo wrapper, not a Card bypass */}
|
|
14468
|
+
<div className="flex flex-wrap items-center gap-2 rounded-lg border bg-card p-4">
|
|
14469
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
14470
|
+
Filters:
|
|
14471
|
+
</span>
|
|
14472
|
+
<FacetedFilter
|
|
14473
|
+
title="Status"
|
|
14474
|
+
options={FACET_STATUS_OPTIONS}
|
|
14475
|
+
selectedValues={statusSelected}
|
|
14476
|
+
onSelectionChange={setStatusSelected}
|
|
14477
|
+
/>
|
|
14478
|
+
<FacetedFilter
|
|
14479
|
+
title="Role"
|
|
14480
|
+
options={FACET_ROLE_OPTIONS}
|
|
14481
|
+
selectedValues={roleSelected}
|
|
14482
|
+
onSelectionChange={setRoleSelected}
|
|
14483
|
+
/>
|
|
14484
|
+
</div>
|
|
14485
|
+
{/* Badge count threshold demo — 2 vs 3+ */}
|
|
14486
|
+
<div className="flex flex-wrap gap-3">
|
|
14487
|
+
<FacetedFilter
|
|
14488
|
+
title="2 selected"
|
|
14489
|
+
options={FACET_STATUS_OPTIONS}
|
|
14490
|
+
selectedValues={new Set(["active", "pending"])}
|
|
14491
|
+
/>
|
|
14492
|
+
<FacetedFilter
|
|
14493
|
+
title="3+ selected"
|
|
14494
|
+
options={FACET_STATUS_OPTIONS}
|
|
14495
|
+
selectedValues={new Set(["active", "inactive", "pending", "archived"])}
|
|
14496
|
+
/>
|
|
14497
|
+
</div>
|
|
14498
|
+
</div>
|
|
14499
|
+
);
|
|
14500
|
+
}
|
|
14501
|
+
|
|
14502
|
+
// ---------------------------------------------------------------------------
|
|
14503
|
+
// Attachment showcase
|
|
14504
|
+
// ---------------------------------------------------------------------------
|
|
14505
|
+
|
|
14397
14506
|
// File names and byte counts from content/personas/bads.json → files[].
|
|
14398
14507
|
const ATTACHMENT_FILES = [
|
|
14399
14508
|
{ name: "roi-report-2026-06.pdf", bytes: 1_536_000, type: "application/pdf" },
|
|
@@ -14557,3 +14666,628 @@ function AttachmentShowcase() {
|
|
|
14557
14666
|
</div>
|
|
14558
14667
|
);
|
|
14559
14668
|
}
|
|
14669
|
+
|
|
14670
|
+
function PhoneInputShowcase() {
|
|
14671
|
+
const [value, setValue] = React.useState("+14155550182");
|
|
14672
|
+
const [gbValue, setGbValue] = React.useState("+447911123456");
|
|
14673
|
+
const [emptyValue, setEmptyValue] = React.useState("");
|
|
14674
|
+
return (
|
|
14675
|
+
<div className="space-y-8">
|
|
14676
|
+
<p className="text-sm text-muted-foreground">
|
|
14677
|
+
Composites a country dial-code select with a tel input. Outputs E.164
|
|
14678
|
+
format (+CC localNumber). Stateless — controlled via value + onChange.
|
|
14679
|
+
No libphonenumber validation; wire your own form-layer validation.
|
|
14680
|
+
</p>
|
|
14681
|
+
<div className="space-y-4">
|
|
14682
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14683
|
+
Default — US, controlled
|
|
14684
|
+
</p>
|
|
14685
|
+
<div className="grid w-full max-w-xs gap-2">
|
|
14686
|
+
<label htmlFor="phone-demo-us" className="text-sm font-medium">
|
|
14687
|
+
Phone number
|
|
14688
|
+
</label>
|
|
14689
|
+
<PhoneInput
|
|
14690
|
+
id="phone-demo-us"
|
|
14691
|
+
aria-labelledby="phone-demo-us"
|
|
14692
|
+
value={value}
|
|
14693
|
+
onChange={setValue}
|
|
14694
|
+
/>
|
|
14695
|
+
<p className="text-xs text-muted-foreground">Value: {value || "(empty)"}</p>
|
|
14696
|
+
</div>
|
|
14697
|
+
</div>
|
|
14698
|
+
<div className="space-y-4">
|
|
14699
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14700
|
+
UK default country
|
|
14701
|
+
</p>
|
|
14702
|
+
<div className="grid w-full max-w-xs gap-2">
|
|
14703
|
+
<label htmlFor="phone-demo-gb" className="text-sm font-medium">
|
|
14704
|
+
Mobile number
|
|
14705
|
+
</label>
|
|
14706
|
+
<PhoneInput
|
|
14707
|
+
id="phone-demo-gb"
|
|
14708
|
+
aria-labelledby="phone-demo-gb"
|
|
14709
|
+
value={gbValue}
|
|
14710
|
+
onChange={setGbValue}
|
|
14711
|
+
defaultCountry="GB"
|
|
14712
|
+
/>
|
|
14713
|
+
</div>
|
|
14714
|
+
</div>
|
|
14715
|
+
<div className="space-y-4">
|
|
14716
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14717
|
+
Error state
|
|
14718
|
+
</p>
|
|
14719
|
+
<div className="grid w-full max-w-xs gap-2">
|
|
14720
|
+
<label htmlFor="phone-demo-error" className="text-sm font-medium">
|
|
14721
|
+
Phone number
|
|
14722
|
+
</label>
|
|
14723
|
+
<PhoneInput
|
|
14724
|
+
id="phone-demo-error"
|
|
14725
|
+
aria-labelledby="phone-demo-error"
|
|
14726
|
+
value={emptyValue}
|
|
14727
|
+
onChange={setEmptyValue}
|
|
14728
|
+
error
|
|
14729
|
+
aria-describedby="phone-demo-error-msg"
|
|
14730
|
+
/>
|
|
14731
|
+
<p id="phone-demo-error-msg" className="text-xs text-destructive">
|
|
14732
|
+
A valid phone number is required.
|
|
14733
|
+
</p>
|
|
14734
|
+
</div>
|
|
14735
|
+
</div>
|
|
14736
|
+
<div className="space-y-4">
|
|
14737
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14738
|
+
Disabled
|
|
14739
|
+
</p>
|
|
14740
|
+
<div className="grid w-full max-w-xs gap-2">
|
|
14741
|
+
<label htmlFor="phone-demo-disabled" className="text-sm font-medium text-muted-foreground">
|
|
14742
|
+
Phone number
|
|
14743
|
+
</label>
|
|
14744
|
+
<PhoneInput
|
|
14745
|
+
id="phone-demo-disabled"
|
|
14746
|
+
aria-labelledby="phone-demo-disabled"
|
|
14747
|
+
value="+14155550182"
|
|
14748
|
+
onChange={() => {}}
|
|
14749
|
+
disabled
|
|
14750
|
+
/>
|
|
14751
|
+
</div>
|
|
14752
|
+
</div>
|
|
14753
|
+
</div>
|
|
14754
|
+
);
|
|
14755
|
+
}
|
|
14756
|
+
|
|
14757
|
+
function TwoFactorCardShowcase() {
|
|
14758
|
+
return (
|
|
14759
|
+
<div className="space-y-8">
|
|
14760
|
+
<p className="text-sm text-muted-foreground">
|
|
14761
|
+
Dedicated two-factor authentication management card. Shows method-by-method
|
|
14762
|
+
status (authenticator app, SMS, hardware key), backup code count with a
|
|
14763
|
+
low-code warning, and a primary manage CTA. Distinct from SecurityCard which
|
|
14764
|
+
is a full security overview.
|
|
14765
|
+
</p>
|
|
14766
|
+
|
|
14767
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
14768
|
+
<div className="space-y-2">
|
|
14769
|
+
<p className="text-xs font-medium text-muted-foreground">Enabled — authenticator only</p>
|
|
14770
|
+
<TwoFactorCard
|
|
14771
|
+
enabled
|
|
14772
|
+
methods={[
|
|
14773
|
+
{ method: "authenticator", enabled: true, label: "Google Authenticator" },
|
|
14774
|
+
{ method: "sms", enabled: false, label: "" },
|
|
14775
|
+
{ method: "hardware-key", enabled: false, label: "" },
|
|
14776
|
+
]}
|
|
14777
|
+
backupCodesRemaining={7}
|
|
14778
|
+
onManage={() => {}}
|
|
14779
|
+
/>
|
|
14780
|
+
</div>
|
|
14781
|
+
|
|
14782
|
+
<div className="space-y-2">
|
|
14783
|
+
<p className="text-xs font-medium text-muted-foreground">Disabled — not set up</p>
|
|
14784
|
+
<TwoFactorCard
|
|
14785
|
+
enabled={false}
|
|
14786
|
+
methods={[
|
|
14787
|
+
{ method: "authenticator", enabled: false, label: "" },
|
|
14788
|
+
{ method: "sms", enabled: false, label: "" },
|
|
14789
|
+
{ method: "hardware-key", enabled: false, label: "" },
|
|
14790
|
+
]}
|
|
14791
|
+
backupCodesRemaining={0}
|
|
14792
|
+
onManage={() => {}}
|
|
14793
|
+
/>
|
|
14794
|
+
</div>
|
|
14795
|
+
|
|
14796
|
+
<div className="space-y-2">
|
|
14797
|
+
<p className="text-xs font-medium text-muted-foreground">Multiple methods + low backup codes</p>
|
|
14798
|
+
<TwoFactorCard
|
|
14799
|
+
enabled
|
|
14800
|
+
methods={[
|
|
14801
|
+
{ method: "authenticator", enabled: true, label: "1Password TOTP" },
|
|
14802
|
+
{ method: "sms", enabled: true, label: "+1 •••• 5182" },
|
|
14803
|
+
{ method: "hardware-key", enabled: false, label: "" },
|
|
14804
|
+
]}
|
|
14805
|
+
backupCodesRemaining={1}
|
|
14806
|
+
onManage={() => {}}
|
|
14807
|
+
onRegenerateBackupCodes={() => {}}
|
|
14808
|
+
/>
|
|
14809
|
+
</div>
|
|
14810
|
+
|
|
14811
|
+
<div className="space-y-2">
|
|
14812
|
+
<p className="text-xs font-medium text-muted-foreground">All methods — no manage CTA</p>
|
|
14813
|
+
<TwoFactorCard
|
|
14814
|
+
enabled
|
|
14815
|
+
methods={[
|
|
14816
|
+
{ method: "authenticator", enabled: true, label: "1Password TOTP" },
|
|
14817
|
+
{ method: "sms", enabled: true, label: "+1 •••• 3847" },
|
|
14818
|
+
{ method: "hardware-key", enabled: true, label: "YubiKey 5C" },
|
|
14819
|
+
]}
|
|
14820
|
+
backupCodesRemaining={9}
|
|
14821
|
+
/>
|
|
14822
|
+
</div>
|
|
14823
|
+
</div>
|
|
14824
|
+
</div>
|
|
14825
|
+
);
|
|
14826
|
+
}
|
|
14827
|
+
|
|
14828
|
+
function PaymentMethodCardShowcase() {
|
|
14829
|
+
return (
|
|
14830
|
+
<div className="flex flex-col gap-6 w-full max-w-md">
|
|
14831
|
+
<div className="space-y-1">
|
|
14832
|
+
<p className="text-xs font-medium text-muted-foreground">Default — one card, add + actions</p>
|
|
14833
|
+
<PaymentMethodCard
|
|
14834
|
+
methods={[
|
|
14835
|
+
{ id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Priya Raghavan", isDefault: true },
|
|
14836
|
+
]}
|
|
14837
|
+
onAddMethod={() => {}}
|
|
14838
|
+
onSetDefault={() => {}}
|
|
14839
|
+
onRemove={() => {}}
|
|
14840
|
+
/>
|
|
14841
|
+
</div>
|
|
14842
|
+
<div className="space-y-1">
|
|
14843
|
+
<p className="text-xs font-medium text-muted-foreground">Multiple cards with expired</p>
|
|
14844
|
+
<PaymentMethodCard
|
|
14845
|
+
methods={[
|
|
14846
|
+
{ id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Priya Raghavan", isDefault: true },
|
|
14847
|
+
{ id: "pm_2", brand: "mastercard", last4: "5555", expiry: "03/26", name: "Priya Raghavan", isDefault: false },
|
|
14848
|
+
{ id: "pm_3", brand: "amex", last4: "3782", expiry: "11/24", name: "Priya Raghavan", isDefault: false, isExpired: true },
|
|
14849
|
+
]}
|
|
14850
|
+
onAddMethod={() => {}}
|
|
14851
|
+
onSetDefault={() => {}}
|
|
14852
|
+
onRemove={() => {}}
|
|
14853
|
+
/>
|
|
14854
|
+
</div>
|
|
14855
|
+
<div className="space-y-1">
|
|
14856
|
+
<p className="text-xs font-medium text-muted-foreground">Empty state</p>
|
|
14857
|
+
<PaymentMethodCard methods={[]} onAddMethod={() => {}} />
|
|
14858
|
+
</div>
|
|
14859
|
+
<div className="space-y-1">
|
|
14860
|
+
<p className="text-xs font-medium text-muted-foreground">Read-only (no actions)</p>
|
|
14861
|
+
<PaymentMethodCard
|
|
14862
|
+
methods={[
|
|
14863
|
+
{ id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Soo-Jin Park", isDefault: true },
|
|
14864
|
+
]}
|
|
14865
|
+
/>
|
|
14866
|
+
</div>
|
|
14867
|
+
</div>
|
|
14868
|
+
);
|
|
14869
|
+
}
|
|
14870
|
+
|
|
14871
|
+
function TeamMembersCardShowcase() {
|
|
14872
|
+
return (
|
|
14873
|
+
<div className="space-y-8">
|
|
14874
|
+
<p className="text-sm text-muted-foreground">
|
|
14875
|
+
Team member list card: avatar, name, email, and role badge per member,
|
|
14876
|
+
with an optional invite action and overflow count. Sources: GitHub repo
|
|
14877
|
+
collaborators/settings, Vercel team page, Linear team settings, Figma
|
|
14878
|
+
team page, Notion workspace members (5 cross-system sources).
|
|
14879
|
+
</p>
|
|
14880
|
+
|
|
14881
|
+
<div className="space-y-4">
|
|
14882
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14883
|
+
Default — 5 members, invite action
|
|
14884
|
+
</p>
|
|
14885
|
+
<div className="w-80">
|
|
14886
|
+
<TeamMembersCard
|
|
14887
|
+
members={[
|
|
14888
|
+
{ id: "1", name: "Jordan Reeves", email: "jordan@reeves.design", role: "owner" },
|
|
14889
|
+
{ id: "2", name: "Seo-yun Park", email: "seoyun.park@figma.com", role: "admin" },
|
|
14890
|
+
{ id: "3", name: "Marcus Lindqvist", email: "marcus@lindqvist.dev", role: "member" },
|
|
14891
|
+
{ id: "4", name: "Anika Patel", email: "anika.patel@stripe.com", role: "member" },
|
|
14892
|
+
{ id: "5", name: "Tomás Herrera", email: "tomas.herrera@vercel.com", role: "viewer" },
|
|
14893
|
+
]}
|
|
14894
|
+
description="Northwind Health workspace"
|
|
14895
|
+
onInvite={() => {}}
|
|
14896
|
+
/>
|
|
14897
|
+
</div>
|
|
14898
|
+
</div>
|
|
14899
|
+
|
|
14900
|
+
<div className="space-y-4">
|
|
14901
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14902
|
+
With overflow count — 3 shown of 12
|
|
14903
|
+
</p>
|
|
14904
|
+
<div className="w-80">
|
|
14905
|
+
<TeamMembersCard
|
|
14906
|
+
members={[
|
|
14907
|
+
{ id: "1", name: "Jordan Reeves", email: "jordan@reeves.design", role: "owner" },
|
|
14908
|
+
{ id: "2", name: "Kofi Asante", email: "kofi@northwindhealth.com", role: "admin" },
|
|
14909
|
+
{ id: "3", name: "Seo-yun Park", email: "seoyun.park@figma.com", role: "member" },
|
|
14910
|
+
]}
|
|
14911
|
+
totalCount={12}
|
|
14912
|
+
description="Meridian Payments · Design Systems"
|
|
14913
|
+
onInvite={() => {}}
|
|
14914
|
+
/>
|
|
14915
|
+
</div>
|
|
14916
|
+
</div>
|
|
14917
|
+
|
|
14918
|
+
<div className="space-y-4">
|
|
14919
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14920
|
+
Read-only — no invite action (viewer context)
|
|
14921
|
+
</p>
|
|
14922
|
+
<div className="w-80">
|
|
14923
|
+
<TeamMembersCard
|
|
14924
|
+
members={[
|
|
14925
|
+
{ id: "1", name: "Yuki Tanaka", email: "yuki@fieldnotelabs.io", role: "owner" },
|
|
14926
|
+
{ id: "2", name: "Chloé Dubois-Martin", email: "chloe@harborline.com", role: "admin" },
|
|
14927
|
+
{ id: "3", name: "Marcus Lindqvist", email: "marcus@lindqvist.dev", role: "member" },
|
|
14928
|
+
]}
|
|
14929
|
+
description="Fieldnote Labs workspace"
|
|
14930
|
+
/>
|
|
14931
|
+
</div>
|
|
14932
|
+
</div>
|
|
14933
|
+
</div>
|
|
14934
|
+
);
|
|
14935
|
+
}
|
|
14936
|
+
|
|
14937
|
+
function ActiveSessionsCardShowcase() {
|
|
14938
|
+
return (
|
|
14939
|
+
<div className="space-y-8">
|
|
14940
|
+
<p className="text-sm text-muted-foreground">
|
|
14941
|
+
Active login sessions management card — device/browser info, last-seen
|
|
14942
|
+
time, geographic location, and a per-session revoke action. The current
|
|
14943
|
+
session is highlighted with a badge and protected from revoke. An
|
|
14944
|
+
optional footer CTA lets users revoke all other sessions at once. Sources:
|
|
14945
|
+
GitHub Security settings, Vercel account security, Linear security
|
|
14946
|
+
settings, Stripe dashboard, Auth0 (5 cross-system sources).
|
|
14947
|
+
</p>
|
|
14948
|
+
|
|
14949
|
+
<div className="space-y-4">
|
|
14950
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14951
|
+
Default — multiple sessions, current highlighted
|
|
14952
|
+
</p>
|
|
14953
|
+
<div className="w-96">
|
|
14954
|
+
<ActiveSessionsCard
|
|
14955
|
+
sessions={[
|
|
14956
|
+
{
|
|
14957
|
+
id: "sess_current",
|
|
14958
|
+
browser: "Chrome 129 on macOS",
|
|
14959
|
+
location: "San Francisco, CA",
|
|
14960
|
+
lastSeen: new Date().toISOString(),
|
|
14961
|
+
isCurrent: true,
|
|
14962
|
+
device: "desktop",
|
|
14963
|
+
},
|
|
14964
|
+
{
|
|
14965
|
+
id: "sess_2",
|
|
14966
|
+
browser: "Firefox 130 on Ubuntu",
|
|
14967
|
+
location: "Austin, TX",
|
|
14968
|
+
lastSeen: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(),
|
|
14969
|
+
device: "desktop",
|
|
14970
|
+
},
|
|
14971
|
+
{
|
|
14972
|
+
id: "sess_3",
|
|
14973
|
+
browser: "Safari 18 on iOS",
|
|
14974
|
+
location: "New York, NY",
|
|
14975
|
+
lastSeen: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString(),
|
|
14976
|
+
device: "mobile",
|
|
14977
|
+
},
|
|
14978
|
+
]}
|
|
14979
|
+
onRevoke={(id) => console.log("Revoke:", id)}
|
|
14980
|
+
onRevokeAll={() => console.log("Revoke all")}
|
|
14981
|
+
/>
|
|
14982
|
+
</div>
|
|
14983
|
+
</div>
|
|
14984
|
+
|
|
14985
|
+
<div className="space-y-4">
|
|
14986
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14987
|
+
Single session — no revoke actions rendered
|
|
14988
|
+
</p>
|
|
14989
|
+
<div className="w-96">
|
|
14990
|
+
<ActiveSessionsCard
|
|
14991
|
+
sessions={[
|
|
14992
|
+
{
|
|
14993
|
+
id: "sess_current",
|
|
14994
|
+
browser: "Arc 1.62 on macOS",
|
|
14995
|
+
location: "San Francisco, CA",
|
|
14996
|
+
lastSeen: new Date().toISOString(),
|
|
14997
|
+
isCurrent: true,
|
|
14998
|
+
device: "desktop",
|
|
14999
|
+
},
|
|
15000
|
+
]}
|
|
15001
|
+
onRevoke={(id) => console.log("Revoke:", id)}
|
|
15002
|
+
/>
|
|
15003
|
+
</div>
|
|
15004
|
+
</div>
|
|
15005
|
+
|
|
15006
|
+
<div className="space-y-4">
|
|
15007
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
15008
|
+
Many devices — desktop, mobile, tablet, with revoke all
|
|
15009
|
+
</p>
|
|
15010
|
+
<div className="w-96">
|
|
15011
|
+
<ActiveSessionsCard
|
|
15012
|
+
sessions={[
|
|
15013
|
+
{
|
|
15014
|
+
id: "sess_current",
|
|
15015
|
+
browser: "Chrome 129 on macOS",
|
|
15016
|
+
location: "San Francisco, CA",
|
|
15017
|
+
lastSeen: new Date().toISOString(),
|
|
15018
|
+
isCurrent: true,
|
|
15019
|
+
device: "desktop",
|
|
15020
|
+
},
|
|
15021
|
+
{
|
|
15022
|
+
id: "sess_2",
|
|
15023
|
+
browser: "Safari 18 on iOS",
|
|
15024
|
+
location: "Chicago, IL",
|
|
15025
|
+
lastSeen: new Date(Date.now() - 30 * 60 * 1000).toISOString(),
|
|
15026
|
+
device: "mobile",
|
|
15027
|
+
},
|
|
15028
|
+
{
|
|
15029
|
+
id: "sess_3",
|
|
15030
|
+
browser: "Safari 18 on iPadOS",
|
|
15031
|
+
location: "New York, NY",
|
|
15032
|
+
lastSeen: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(),
|
|
15033
|
+
device: "tablet",
|
|
15034
|
+
},
|
|
15035
|
+
{
|
|
15036
|
+
id: "sess_4",
|
|
15037
|
+
browser: "Firefox 130 on Ubuntu",
|
|
15038
|
+
location: "Austin, TX",
|
|
15039
|
+
lastSeen: new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString(),
|
|
15040
|
+
device: "desktop",
|
|
15041
|
+
},
|
|
15042
|
+
]}
|
|
15043
|
+
onRevoke={(id) => console.log("Revoke:", id)}
|
|
15044
|
+
onRevokeAll={() => console.log("Revoke all")}
|
|
15045
|
+
/>
|
|
15046
|
+
</div>
|
|
15047
|
+
</div>
|
|
15048
|
+
</div>
|
|
15049
|
+
);
|
|
15050
|
+
}
|
|
15051
|
+
|
|
15052
|
+
function DomainVerificationCardShowcase() {
|
|
15053
|
+
return (
|
|
15054
|
+
<div className="space-y-8">
|
|
15055
|
+
<p className="text-sm text-muted-foreground">
|
|
15056
|
+
Custom domain setup and verification card — DNS record display (CNAME/TXT/A/MX)
|
|
15057
|
+
with copy-to-clipboard, status badge (pending/verifying/verified/failed), and
|
|
15058
|
+
verify/remove actions. Status is never conveyed by color alone. Sources: Vercel
|
|
15059
|
+
custom domains, GitHub Pages, Linear workspace domain, Stripe custom email domain,
|
|
15060
|
+
Resend domain verification (5 cross-system sources).
|
|
15061
|
+
</p>
|
|
15062
|
+
|
|
15063
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
15064
|
+
<div className="space-y-2">
|
|
15065
|
+
<p className="text-xs font-medium text-muted-foreground">Pending — CNAME record</p>
|
|
15066
|
+
<DomainVerificationCard
|
|
15067
|
+
domain="mail.northwindhealth.io"
|
|
15068
|
+
status="pending"
|
|
15069
|
+
records={[
|
|
15070
|
+
{ type: "CNAME", name: "_bads", value: "verify.bads.io", ttl: "86400" },
|
|
15071
|
+
]}
|
|
15072
|
+
onVerify={() => {}}
|
|
15073
|
+
onRemove={() => {}}
|
|
15074
|
+
/>
|
|
15075
|
+
</div>
|
|
15076
|
+
|
|
15077
|
+
<div className="space-y-2">
|
|
15078
|
+
<p className="text-xs font-medium text-muted-foreground">Verified — domain confirmed</p>
|
|
15079
|
+
<DomainVerificationCard
|
|
15080
|
+
domain="app.meridianpayments.com"
|
|
15081
|
+
status="verified"
|
|
15082
|
+
records={[
|
|
15083
|
+
{ type: "CNAME", name: "_bads", value: "verify.bads.io", ttl: "86400" },
|
|
15084
|
+
]}
|
|
15085
|
+
onVerify={() => {}}
|
|
15086
|
+
onRemove={() => {}}
|
|
15087
|
+
/>
|
|
15088
|
+
</div>
|
|
15089
|
+
|
|
15090
|
+
<div className="space-y-2">
|
|
15091
|
+
<p className="text-xs font-medium text-muted-foreground">Failed — DNS mismatch</p>
|
|
15092
|
+
<DomainVerificationCard
|
|
15093
|
+
domain="fieldnotelabs.io"
|
|
15094
|
+
status="failed"
|
|
15095
|
+
records={[
|
|
15096
|
+
{ type: "TXT", name: "@", value: "v=spf1 include:_spf.bads.io ~all", ttl: "86400" },
|
|
15097
|
+
]}
|
|
15098
|
+
onVerify={() => {}}
|
|
15099
|
+
onRemove={() => {}}
|
|
15100
|
+
/>
|
|
15101
|
+
</div>
|
|
15102
|
+
|
|
15103
|
+
<div className="space-y-2">
|
|
15104
|
+
<p className="text-xs font-medium text-muted-foreground">Multiple records — SPF, DKIM, DMARC, MX</p>
|
|
15105
|
+
<DomainVerificationCard
|
|
15106
|
+
domain="mail.northwindhealth.io"
|
|
15107
|
+
status="pending"
|
|
15108
|
+
records={[
|
|
15109
|
+
{ type: "TXT", name: "@", value: "v=spf1 include:_spf.bads.io ~all", ttl: "86400" },
|
|
15110
|
+
{ type: "TXT", name: "bads._domainkey", value: "bads-verification=a1b2c3d4e5f6", ttl: "86400" },
|
|
15111
|
+
{ type: "TXT", name: "_dmarc", value: "v=DMARC1; p=quarantine; rua=mailto:dmarc@northwindhealth.io", ttl: "3600" },
|
|
15112
|
+
{ type: "MX", name: "@", value: "inbound-smtp.bads.io", ttl: "300" },
|
|
15113
|
+
]}
|
|
15114
|
+
onVerify={() => {}}
|
|
15115
|
+
onRemove={() => {}}
|
|
15116
|
+
/>
|
|
15117
|
+
</div>
|
|
15118
|
+
</div>
|
|
15119
|
+
</div>
|
|
15120
|
+
);
|
|
15121
|
+
}
|
|
15122
|
+
|
|
15123
|
+
function NotificationPreferencesCardShowcase() {
|
|
15124
|
+
return (
|
|
15125
|
+
<div className="space-y-8">
|
|
15126
|
+
<p className="text-sm text-muted-foreground">
|
|
15127
|
+
Notification preference matrix card — rows are notification types
|
|
15128
|
+
(mentions, comments, deploys, billing, security alerts), columns are
|
|
15129
|
+
delivery channels (email, push, Slack, SMS). Each intersection is a
|
|
15130
|
+
Switch toggle. Column headers use sr-only text. Sources: GitHub, Vercel,
|
|
15131
|
+
Linear, Stripe, Notion notification settings (5 cross-system sources).
|
|
15132
|
+
</p>
|
|
15133
|
+
|
|
15134
|
+
<div className="space-y-4">
|
|
15135
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
15136
|
+
Default — email + push (2 channels)
|
|
15137
|
+
</p>
|
|
15138
|
+
<div className="w-96">
|
|
15139
|
+
<NotificationPreferencesCard
|
|
15140
|
+
preferences={[
|
|
15141
|
+
{ key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: ["email", "push"] },
|
|
15142
|
+
{ key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: ["email"] },
|
|
15143
|
+
{ key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: [] },
|
|
15144
|
+
{ key: "billing", label: "Billing", description: "Invoices and payment alerts", enabledChannels: ["email"] },
|
|
15145
|
+
]}
|
|
15146
|
+
channels={["email", "push"]}
|
|
15147
|
+
/>
|
|
15148
|
+
</div>
|
|
15149
|
+
</div>
|
|
15150
|
+
|
|
15151
|
+
<div className="space-y-4">
|
|
15152
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
15153
|
+
Three channels — email + push + Slack, with save action
|
|
15154
|
+
</p>
|
|
15155
|
+
<div className="w-[28rem]">
|
|
15156
|
+
<NotificationPreferencesCard
|
|
15157
|
+
preferences={[
|
|
15158
|
+
{ key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: ["email", "push", "slack"] },
|
|
15159
|
+
{ key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: ["email", "push"] },
|
|
15160
|
+
{ key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: ["slack"] },
|
|
15161
|
+
{ key: "billing", label: "Billing", description: "Invoices, receipts, and payment alerts", enabledChannels: ["email"] },
|
|
15162
|
+
{ key: "security-alerts", label: "Security alerts", description: "New sign-ins and suspicious activity", enabledChannels: ["email", "push", "slack"] },
|
|
15163
|
+
]}
|
|
15164
|
+
channels={["email", "push", "slack"]}
|
|
15165
|
+
onSave={() => {}}
|
|
15166
|
+
/>
|
|
15167
|
+
</div>
|
|
15168
|
+
</div>
|
|
15169
|
+
|
|
15170
|
+
<div className="space-y-4">
|
|
15171
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
15172
|
+
All off — zero enabled channels (fresh account / reset state)
|
|
15173
|
+
</p>
|
|
15174
|
+
<div className="w-96">
|
|
15175
|
+
<NotificationPreferencesCard
|
|
15176
|
+
preferences={[
|
|
15177
|
+
{ key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: [] },
|
|
15178
|
+
{ key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: [] },
|
|
15179
|
+
{ key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: [] },
|
|
15180
|
+
{ key: "billing", label: "Billing", description: "Invoices and payment alerts", enabledChannels: [] },
|
|
15181
|
+
]}
|
|
15182
|
+
channels={["email", "push", "slack"]}
|
|
15183
|
+
/>
|
|
15184
|
+
</div>
|
|
15185
|
+
</div>
|
|
15186
|
+
</div>
|
|
15187
|
+
);
|
|
15188
|
+
}
|
|
15189
|
+
|
|
15190
|
+
function InlineEditShowcase() {
|
|
15191
|
+
const [name, setName] = React.useState("Evelyn Nakamura")
|
|
15192
|
+
const [title, setTitle] = React.useState("Senior Product Designer")
|
|
15193
|
+
return (
|
|
15194
|
+
<div className="space-y-8">
|
|
15195
|
+
<p className="text-sm text-muted-foreground">
|
|
15196
|
+
Ghost variant — blends with ambient text; edit affordance revealed on
|
|
15197
|
+
hover. Confirm with Enter or blur; cancel with Escape.
|
|
15198
|
+
</p>
|
|
15199
|
+
<div className="flex w-80 flex-col gap-2">
|
|
15200
|
+
<p className="text-xs font-medium text-muted-foreground">Ghost (default)</p>
|
|
15201
|
+
<InlineEdit defaultValue="Click to rename this project" />
|
|
15202
|
+
</div>
|
|
15203
|
+
<div className="flex w-80 flex-col gap-2">
|
|
15204
|
+
<p className="text-xs font-medium text-muted-foreground">Outline</p>
|
|
15205
|
+
<InlineEdit variant="outline" defaultValue="Outline variant" />
|
|
15206
|
+
</div>
|
|
15207
|
+
<div className="flex w-80 flex-col gap-2">
|
|
15208
|
+
<p className="text-xs font-medium text-muted-foreground">Sizes — sm / default / lg</p>
|
|
15209
|
+
<InlineEdit size="sm" defaultValue="Small (h-8)" />
|
|
15210
|
+
<InlineEdit size="default" defaultValue="Default (h-9)" />
|
|
15211
|
+
<InlineEdit size="lg" defaultValue="Large (h-10)" />
|
|
15212
|
+
</div>
|
|
15213
|
+
<div className="flex w-80 flex-col gap-2">
|
|
15214
|
+
<p className="text-xs font-medium text-muted-foreground">Disabled</p>
|
|
15215
|
+
<InlineEdit disabled defaultValue="Cannot be edited" />
|
|
15216
|
+
</div>
|
|
15217
|
+
<div className="flex w-80 flex-col gap-2">
|
|
15218
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
15219
|
+
Realistic use — user profile editor
|
|
15220
|
+
</p>
|
|
15221
|
+
<div className="rounded-lg border p-4">
|
|
15222
|
+
<div className="flex flex-col gap-1">
|
|
15223
|
+
<span className="text-xs text-muted-foreground">Name</span>
|
|
15224
|
+
<InlineEdit value={name} onConfirm={setName} variant="outline" />
|
|
15225
|
+
</div>
|
|
15226
|
+
<div className="mt-3 flex flex-col gap-1">
|
|
15227
|
+
<span className="text-xs text-muted-foreground">Title</span>
|
|
15228
|
+
<InlineEdit value={title} onConfirm={setTitle} variant="outline" />
|
|
15229
|
+
</div>
|
|
15230
|
+
</div>
|
|
15231
|
+
</div>
|
|
15232
|
+
</div>
|
|
15233
|
+
)
|
|
15234
|
+
}
|
|
15235
|
+
|
|
15236
|
+
function OTPInputShowcase() {
|
|
15237
|
+
const [value, setValue] = React.useState("")
|
|
15238
|
+
const [status, setStatus] = React.useState<"idle" | "verifying" | "success" | "error">("idle")
|
|
15239
|
+
|
|
15240
|
+
function handleComplete(v: string) {
|
|
15241
|
+
setStatus("verifying")
|
|
15242
|
+
setTimeout(() => {
|
|
15243
|
+
setStatus(v === "000000" ? "error" : "success")
|
|
15244
|
+
}, 800)
|
|
15245
|
+
}
|
|
15246
|
+
|
|
15247
|
+
return (
|
|
15248
|
+
<div className="space-y-8">
|
|
15249
|
+
<p className="text-sm text-muted-foreground">
|
|
15250
|
+
Individual character slots with auto-advance, backspace-retreat, and
|
|
15251
|
+
paste support. Use for 2FA codes, email confirmation, and invite codes.
|
|
15252
|
+
</p>
|
|
15253
|
+
<div className="flex flex-col gap-3">
|
|
15254
|
+
<p className="text-xs font-medium text-muted-foreground">Sizes — sm / default / lg</p>
|
|
15255
|
+
<OTPInput length={6} size="sm" aria-label="Small OTP" />
|
|
15256
|
+
<OTPInput length={6} size="default" aria-label="Default OTP" />
|
|
15257
|
+
<OTPInput length={6} size="lg" aria-label="Large OTP" />
|
|
15258
|
+
</div>
|
|
15259
|
+
<div className="flex flex-col gap-3">
|
|
15260
|
+
<p className="text-xs font-medium text-muted-foreground">With separator (groups of 3)</p>
|
|
15261
|
+
<OTPInput length={6} separatorAfter={2} aria-label="OTP with separator" />
|
|
15262
|
+
</div>
|
|
15263
|
+
<div className="flex flex-col gap-3">
|
|
15264
|
+
<p className="text-xs font-medium text-muted-foreground">States — disabled / invalid</p>
|
|
15265
|
+
<OTPInput length={6} value="123456" disabled aria-label="Disabled OTP" />
|
|
15266
|
+
<OTPInput length={6} value="12345" invalid aria-label="Invalid OTP" />
|
|
15267
|
+
</div>
|
|
15268
|
+
<div className="flex flex-col items-start gap-3">
|
|
15269
|
+
<p className="text-xs font-medium text-muted-foreground">Realistic use — 2FA verification</p>
|
|
15270
|
+
<div className="rounded-lg border p-6">
|
|
15271
|
+
<div className="flex flex-col items-center gap-4 text-center">
|
|
15272
|
+
<div className="space-y-1">
|
|
15273
|
+
<p className="text-sm font-medium">Enter verification code</p>
|
|
15274
|
+
<p className="text-sm text-muted-foreground">Sent to elara.voss@designcraft.co</p>
|
|
15275
|
+
</div>
|
|
15276
|
+
<OTPInput
|
|
15277
|
+
value={value}
|
|
15278
|
+
onChange={(v) => { setValue(v); if (status !== "idle") setStatus("idle") }}
|
|
15279
|
+
onComplete={handleComplete}
|
|
15280
|
+
separatorAfter={2}
|
|
15281
|
+
invalid={status === "error"}
|
|
15282
|
+
disabled={status === "verifying" || status === "success"}
|
|
15283
|
+
aria-label="Email verification code"
|
|
15284
|
+
/>
|
|
15285
|
+
{status === "verifying" && <p className="text-sm text-muted-foreground">Verifying…</p>}
|
|
15286
|
+
{status === "success" && <p className="text-sm text-green-600 dark:text-green-400">Verified successfully</p>}
|
|
15287
|
+
{status === "error" && <p className="text-sm text-destructive">Incorrect code. Try again.</p>}
|
|
15288
|
+
</div>
|
|
15289
|
+
</div>
|
|
15290
|
+
</div>
|
|
15291
|
+
</div>
|
|
15292
|
+
)
|
|
15293
|
+
}
|