@behavioral-agentic-design-system/core 0.42.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +38 -8
- package/scripts/a11y-lint.cjs +101 -14
- package/scripts/bads-sync.mjs +1 -1
- package/scripts/build-tokens.cjs +122 -7
- package/scripts/check-dark-contrast.mjs +204 -0
- package/scripts/check-flush-edges.mjs +245 -0
- package/scripts/check-spec.mjs +73 -0
- package/scripts/deal-directions.mjs +186 -0
- package/scripts/design-system-advisory/README.md +239 -0
- package/scripts/design-system-advisory/check-copy-punctuation.mjs +44 -0
- package/scripts/design-system-advisory/check-even-padding.mjs +35 -0
- package/scripts/design-system-advisory/check-hand-built-button.mjs +46 -0
- package/scripts/design-system-advisory/check-html-nesting.mjs +51 -0
- package/scripts/design-system-advisory/check-icon-sizing.mjs +79 -0
- package/scripts/design-system-advisory/check-label-case.mjs +92 -0
- package/scripts/design-system-advisory/check-native-form-controls.mjs +53 -0
- package/scripts/design-system-advisory/check-radius.mjs +56 -0
- package/scripts/design-system-advisory/check-raw-values.mjs +61 -0
- package/scripts/design-system-advisory/check-small-text.mjs +72 -0
- package/scripts/design-system-advisory/check-tap-target.mjs +70 -0
- package/scripts/design-system-advisory/defaults.mjs +90 -0
- package/scripts/design-system-advisory/fixtures/clean.tsx.fixture +12 -0
- package/scripts/design-system-advisory/fixtures/violations.tsx.fixture +19 -0
- package/scripts/design-system-advisory/lib.mjs +255 -0
- package/scripts/design-system-advisory/run.mjs +189 -0
- package/scripts/design-system-advisory/workflow.yml +82 -0
- package/scripts/health-report.mjs +20 -14
- package/scripts/lib/copy-strings.mjs +146 -0
- package/scripts/lib/counted-lint.mjs +100 -0
- package/scripts/lib/dark-contrast.mjs +120 -0
- package/scripts/lib/flush-edges.mjs +294 -0
- package/scripts/lib/lab-lint.mjs +62 -0
- package/scripts/lib/marketing-library.mjs +129 -0
- package/scripts/lib/mount-page.mjs +25 -0
- package/scripts/lib/on-system.mjs +249 -0
- package/scripts/lib/random.mjs +22 -0
- package/scripts/lib/source-scan.mjs +173 -0
- package/scripts/lib/spec-parse.d.mts +25 -0
- package/scripts/lib/spec-parse.mjs +188 -0
- package/scripts/lib/tells.mjs +366 -0
- package/scripts/lint-arbitrary-tokens.mjs +47 -0
- package/scripts/lint-component-token-refs.mjs +63 -0
- package/scripts/lint-content-hierarchy.mjs +114 -0
- package/scripts/lint-control-baseline.mjs +72 -0
- package/scripts/lint-copy-punctuation.mjs +60 -0
- package/scripts/lint-css-vars.mjs +175 -0
- package/scripts/lint-even-padding.mjs +58 -0
- package/scripts/lint-html-nesting.mjs +116 -0
- package/scripts/lint-label-case.mjs +219 -0
- package/scripts/lint-live-ctas.mjs +138 -0
- package/scripts/lint-microanimation.mjs +2 -2
- package/scripts/lint-proximity.mjs +181 -0
- package/scripts/lint-slop.mjs +1 -1
- package/scripts/lint-spacing-scale.mjs +78 -0
- package/scripts/lint-target-size.cjs +132 -0
- package/scripts/lint-token-primitives.mjs +307 -0
- package/scripts/on-system-score.mjs +95 -0
- package/scripts/size-audit.cjs +2 -2
- package/scripts/slop-rules.mjs +1 -1
- package/scripts/source-images.mjs +180 -0
- package/scripts/ux-tells.mjs +80 -0
- package/scripts/wcag-audit.cjs +25 -4
- 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 +9 -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/api/site-auth.ts +14 -2
- package/src/app/layout.tsx +6 -0
- package/src/app/preview/canvas/page.tsx +12 -0
- package/src/app/preview/components/page.tsx +828 -14
- package/src/app/preview/sticker-sheet/page.tsx +329 -0
- package/src/app/preview/sticker-sheet/specimens.tsx +296 -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 +164 -47
- package/src/components/Foundations/Colors.stories.tsx +119 -8
- 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 +19 -14
- package/src/components/layers-tab.tsx +2 -2
- package/src/components/markdown-preview.tsx +60 -12
- package/src/components/onboarding-wizard.tsx +1 -1
- 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/avatar.tsx +4 -0
- package/src/components/ui/chart.tsx +134 -42
- package/src/components/ui/checkbox-group.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/color-picker.tsx +20 -4
- package/src/components/ui/combobox.tsx +1 -0
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/data-table.tsx +64 -3
- package/src/components/ui/date-field.tsx +1 -1
- package/src/components/ui/date-picker.tsx +2 -0
- package/src/components/ui/date-range-picker.tsx +4 -0
- package/src/components/ui/editable.tsx +1 -0
- package/src/components/ui/faceted-filter.tsx +187 -0
- package/src/components/ui/file-upload.tsx +21 -2
- package/src/components/ui/gauge-chart.tsx +18 -4
- package/src/components/ui/heatmap.tsx +3 -1
- package/src/components/ui/inline-edit.tsx +175 -0
- package/src/components/ui/input-group.tsx +5 -2
- package/src/components/ui/month-picker.tsx +1 -1
- package/src/components/ui/multi-select.tsx +1 -0
- 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/radio-group.tsx +2 -2
- package/src/components/ui/search-input.tsx +1 -1
- package/src/components/ui/sparkline.tsx +33 -4
- package/src/components/ui/spinner.tsx +23 -4
- package/src/components/ui/table.tsx +9 -0
- 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 -13
- package/src/components/ui/year-picker.tsx +1 -1
- package/src/data/component-added.json +966 -0
- package/src/data/docs-index.ts +35 -2
- package/src/data/history.json +161 -161
- package/src/data/sticker-sheet.json +9244 -0
- package/src/docs-trace-globs.json +1 -0
- 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/chart-motion.ts +41 -0
- package/src/lib/get-icon-color.ts +1 -1
- package/src/lib/spec-parse.ts +4 -0
- package/src/lib/svg-sanitize.ts +19 -9
- package/src/stories/Accordion.stories.tsx +7 -0
- package/src/stories/ActionBar.stories.tsx +5 -0
- package/src/stories/Affix.stories.tsx +4 -0
- package/src/stories/AiBadge.stories.tsx +9 -7
- package/src/stories/Alert.stories.tsx +13 -0
- package/src/stories/AlertDialog.stories.tsx +4 -0
- package/src/stories/Anchor.stories.tsx +5 -0
- package/src/stories/AngleSlider.stories.tsx +6 -3
- package/src/stories/AspectRatio.stories.tsx +4 -0
- package/src/stories/Autocomplete.stories.tsx +8 -0
- package/src/stories/Avatar.stories.tsx +10 -0
- package/src/stories/Badge.stories.tsx +14 -6
- package/src/stories/Blockquote.stories.tsx +6 -0
- package/src/stories/BottomNavigation.stories.tsx +4 -0
- package/src/stories/Breadcrumb.stories.tsx +3 -0
- package/src/stories/Burger.stories.tsx +1 -0
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ButtonGroup.stories.tsx +9 -0
- package/src/stories/Calendar.stories.tsx +3 -0
- package/src/stories/Canvas.stories.tsx +45 -0
- package/src/stories/Card.stories.tsx +4 -0
- package/src/stories/Carousel.stories.tsx +6 -0
- package/src/stories/Cascader.stories.tsx +4 -0
- package/src/stories/Chart.stories.tsx +46 -1
- package/src/stories/ChatBubble.stories.tsx +8 -2
- package/src/stories/ChatMarker.stories.tsx +1 -0
- package/src/stories/Checkbox.stories.tsx +40 -0
- package/src/stories/CheckboxCard.stories.tsx +8 -0
- package/src/stories/CheckboxGroup.stories.tsx +19 -0
- package/src/stories/Chip.stories.tsx +10 -19
- package/src/stories/CircularProgress.stories.tsx +13 -27
- package/src/stories/Clipboard.stories.tsx +6 -0
- package/src/stories/CloseButton.stories.tsx +6 -4
- package/src/stories/Code.stories.tsx +8 -1
- package/src/stories/Collapsible.stories.tsx +2 -0
- package/src/stories/ColorPicker.stories.tsx +46 -0
- package/src/stories/ColorSwatch.stories.tsx +1 -0
- package/src/stories/Combobox.stories.tsx +9 -0
- package/src/stories/Command.stories.tsx +2 -0
- package/src/stories/Container.stories.tsx +8 -0
- package/src/stories/ContextMenu.stories.tsx +9 -0
- package/src/stories/CopyButton.stories.tsx +12 -36
- package/src/stories/DataList.stories.tsx +8 -0
- package/src/stories/DataTable.stories.tsx +39 -0
- package/src/stories/DateField.stories.tsx +28 -0
- package/src/stories/DatePicker.stories.tsx +34 -0
- package/src/stories/DateRangePicker.stories.tsx +32 -0
- package/src/stories/Dialog.stories.tsx +8 -0
- package/src/stories/Drawer.stories.tsx +6 -0
- package/src/stories/DropdownMenu.stories.tsx +2 -0
- package/src/stories/Editable.stories.tsx +12 -0
- package/src/stories/EmptyState.stories.tsx +9 -0
- package/src/stories/FacetedFilter.stories.tsx +197 -0
- package/src/stories/Field.stories.tsx +7 -0
- package/src/stories/Fieldset.stories.tsx +8 -0
- package/src/stories/FileButton.stories.tsx +4 -0
- package/src/stories/FileUpload.stories.tsx +16 -17
- package/src/stories/FloatLabel.stories.tsx +3 -8
- package/src/stories/FloatingActionButton.stories.tsx +10 -0
- package/src/stories/FloatingIndicator.stories.tsx +4 -0
- package/src/stories/FloatingPanel.stories.tsx +6 -0
- package/src/stories/FocusTrap.stories.tsx +5 -0
- package/src/stories/FormatByte.stories.tsx +6 -0
- package/src/stories/FormatDate.stories.tsx +8 -0
- package/src/stories/FormatNumber.stories.tsx +9 -0
- package/src/stories/GaugeChart.stories.tsx +9 -3
- package/src/stories/Heatmap.stories.tsx +11 -0
- package/src/stories/Highlight.stories.tsx +6 -0
- package/src/stories/HoverCard.stories.tsx +4 -0
- package/src/stories/Image.stories.tsx +9 -0
- package/src/stories/Indicator.stories.tsx +19 -0
- package/src/stories/InlineEdit.stories.tsx +106 -0
- package/src/stories/Input.stories.tsx +7 -0
- package/src/stories/InputClearButton.stories.tsx +3 -0
- package/src/stories/InputGroup.stories.tsx +40 -0
- package/src/stories/Kbd.stories.tsx +7 -1
- package/src/stories/KeyboardShortcut.stories.tsx +2 -0
- package/src/stories/Label.stories.tsx +2 -0
- package/src/stories/Link.stories.tsx +9 -0
- package/src/stories/List.stories.tsx +8 -0
- package/src/stories/Listbox.stories.tsx +1 -0
- package/src/stories/LoadingDots.stories.tsx +5 -3
- package/src/stories/LoadingOverlay.stories.tsx +5 -1
- package/src/stories/Mark.stories.tsx +5 -0
- package/src/stories/MarkdownPreview.stories.tsx +53 -0
- package/src/stories/Marquee.stories.tsx +4 -0
- package/src/stories/Masonry.stories.tsx +5 -0
- package/src/stories/Menubar.stories.tsx +3 -0
- package/src/stories/Meter.stories.tsx +11 -17
- package/src/stories/MonthPicker.stories.tsx +26 -1
- package/src/stories/MotionToggle.stories.tsx +1 -0
- package/src/stories/MultiSelect.stories.tsx +9 -0
- package/src/stories/NativeSelect.stories.tsx +1 -0
- package/src/stories/NavLink.stories.tsx +7 -0
- package/src/stories/NavigationMenu.stories.tsx +5 -0
- package/src/stories/NavigationRail.stories.tsx +10 -0
- package/src/stories/Notification.stories.tsx +13 -34
- package/src/stories/NumberInput.stories.tsx +33 -1
- package/src/stories/OtpInput.stories.tsx +110 -0
- package/src/stories/Overlay.stories.tsx +5 -1
- package/src/stories/Pagination.stories.tsx +8 -0
- package/src/stories/PasswordInput.stories.tsx +2 -0
- package/src/stories/PhoneInput.stories.tsx +127 -0
- package/src/stories/PinInput.stories.tsx +9 -2
- package/src/stories/Popover.stories.tsx +2 -0
- package/src/stories/Progress.stories.tsx +6 -1
- package/src/stories/Prose.stories.tsx +8 -0
- package/src/stories/QrCode.stories.tsx +2 -0
- package/src/stories/Questionnaire.stories.tsx +7 -0
- package/src/stories/RadioGroup.stories.tsx +40 -0
- package/src/stories/RatingGroup.stories.tsx +8 -4
- package/src/stories/Resizable.stories.tsx +4 -2
- package/src/stories/Result.stories.tsx +3 -0
- package/src/stories/Reveal.stories.tsx +2 -0
- package/src/stories/RollingNumber.stories.tsx +5 -0
- package/src/stories/ScrollArea.stories.tsx +3 -1
- package/src/stories/SearchInput.stories.tsx +10 -6
- package/src/stories/SegmentedControl.stories.tsx +11 -0
- package/src/stories/Select.stories.tsx +7 -0
- package/src/stories/Separator.stories.tsx +6 -0
- package/src/stories/Sheet.stories.tsx +5 -0
- package/src/stories/Sidebar.stories.tsx +40 -1
- package/src/stories/SimpleGrid.stories.tsx +5 -0
- package/src/stories/Skeleton.stories.tsx +8 -0
- package/src/stories/SkeletonTable.stories.tsx +6 -5
- package/src/stories/SkipLink.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +2 -1
- package/src/stories/Sonner.stories.tsx +7 -0
- package/src/stories/Sparkline.stories.tsx +14 -1
- package/src/stories/Spinner.stories.tsx +20 -10
- package/src/stories/Spoiler.stories.tsx +5 -0
- package/src/stories/Squircle.stories.tsx +7 -0
- package/src/stories/Stack.stories.tsx +7 -0
- package/src/stories/StatusBadge.stories.tsx +12 -6
- package/src/stories/Stepper.stories.tsx +5 -0
- package/src/stories/Switch.stories.tsx +4 -0
- package/src/stories/Table.stories.tsx +10 -1
- package/src/stories/Tabs.stories.tsx +8 -0
- package/src/stories/Tag.stories.tsx +13 -5
- package/src/stories/TagsInput.stories.tsx +15 -0
- package/src/stories/Text.stories.tsx +12 -0
- package/src/stories/Textarea.stories.tsx +9 -0
- package/src/stories/ThemeIcon.stories.tsx +6 -3
- package/src/stories/TimePicker.stories.tsx +2 -0
- package/src/stories/Timeline.stories.tsx +12 -0
- package/src/stories/Timer.stories.tsx +30 -0
- package/src/stories/Toggle.stories.tsx +7 -5
- package/src/stories/ToggleGroup.stories.tsx +5 -0
- package/src/stories/ToggleTip.stories.tsx +4 -0
- package/src/stories/Toolbar.stories.tsx +6 -0
- package/src/stories/Tooltip.stories.tsx +3 -0
- package/src/stories/Tour.stories.tsx +3 -0
- package/src/stories/TransferList.stories.tsx +7 -0
- package/src/stories/TreeSelect.stories.tsx +4 -0
- package/src/stories/TreeView.stories.tsx +5 -0
- package/src/stories/TypingIndicator.stories.tsx +4 -0
- package/src/stories/VisuallyHidden.stories.tsx +3 -0
- package/src/stories/Watermark.stories.tsx +6 -0
- package/src/stories/WeekPicker.stories.tsx +25 -1
- package/src/stories/WordRotate.stories.tsx +5 -0
- package/src/stories/YearPicker.stories.tsx +26 -11
- package/src/stories/story-groups.json +22 -16
- package/src/styles.css +50 -2
- package/src/tokens.json +86 -58
|
@@ -17,10 +17,11 @@ export default meta
|
|
|
17
17
|
type Story = StoryObj<typeof meta>
|
|
18
18
|
|
|
19
19
|
export const Default: Story = {
|
|
20
|
-
|
|
20
|
+
args: { children: "pnpm build:tokens" },
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const Variant_Inline: Story = {
|
|
24
|
+
parameters: { controls: { disable: true } },
|
|
24
25
|
render: () => (
|
|
25
26
|
<p className="text-sm text-foreground leading-relaxed max-w-sm">
|
|
26
27
|
Set the primary brand color via{" "}
|
|
@@ -32,6 +33,7 @@ export const Variant_Inline: Story = {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export const Variant_Block: Story = {
|
|
36
|
+
parameters: { controls: { disable: true } },
|
|
35
37
|
render: () => (
|
|
36
38
|
<div className="w-[480px]">
|
|
37
39
|
<Code variant="block">
|
|
@@ -54,6 +56,7 @@ export const Variant_Block: Story = {
|
|
|
54
56
|
// and it shows the system focus-visible ring when focused (a11y: SC 2.1.1 / 2.4.7).
|
|
55
57
|
// Scrollbar styled via native CSS: [scrollbar-width:thin] [scrollbar-color:...]
|
|
56
58
|
export const Variant_Block_Scroll: Story = {
|
|
59
|
+
parameters: { controls: { disable: true } },
|
|
57
60
|
render: () => (
|
|
58
61
|
<div className="w-[360px]">
|
|
59
62
|
<Code variant="block">
|
|
@@ -65,6 +68,7 @@ pnpm --filter @behavioral-agentic-design-system/core build:tokens && pnpm a11y`}
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export const Size_Sm: Story = {
|
|
71
|
+
parameters: { controls: { disable: true } },
|
|
68
72
|
render: () => (
|
|
69
73
|
<div className="flex flex-col gap-3">
|
|
70
74
|
<Code size="sm">pnpm a11y</Code>
|
|
@@ -78,6 +82,7 @@ export const Size_Sm: Story = {
|
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
export const Size_Default: Story = {
|
|
85
|
+
parameters: { controls: { disable: true } },
|
|
81
86
|
render: () => (
|
|
82
87
|
<div className="flex flex-col gap-3">
|
|
83
88
|
<Code size="default">pnpm wcag:audit</Code>
|
|
@@ -91,6 +96,7 @@ export const Size_Default: Story = {
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
export const Size_Lg: Story = {
|
|
99
|
+
parameters: { controls: { disable: true } },
|
|
94
100
|
render: () => (
|
|
95
101
|
<div className="flex flex-col gap-3">
|
|
96
102
|
<Code size="lg">design-tokens</Code>
|
|
@@ -104,6 +110,7 @@ export const Size_Lg: Story = {
|
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
export const RealisticUse: Story = {
|
|
113
|
+
parameters: { controls: { disable: true } },
|
|
107
114
|
render: () => (
|
|
108
115
|
<div className="max-w-md space-y-4 text-sm text-foreground leading-relaxed">
|
|
109
116
|
<div className="space-y-1">
|
|
@@ -13,6 +13,7 @@ export default meta;
|
|
|
13
13
|
type Story = StoryObj<typeof meta>;
|
|
14
14
|
|
|
15
15
|
export const Default: Story = {
|
|
16
|
+
parameters: { controls: { disable: true } },
|
|
16
17
|
render: () => (<Collapsible className="w-[320px] space-y-2">
|
|
17
18
|
<CollapsibleTrigger asChild><Button variant="outline" size="sm">Toggle details</Button></CollapsibleTrigger>
|
|
18
19
|
<CollapsibleContent className="rounded-md border p-3 text-sm">Hidden detail content.</CollapsibleContent>
|
|
@@ -20,6 +21,7 @@ export const Default: Story = {
|
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const RealisticUse: Story = {
|
|
24
|
+
parameters: { controls: { disable: true } },
|
|
23
25
|
render: () => (<Collapsible className="w-[320px] space-y-2">
|
|
24
26
|
<CollapsibleTrigger asChild><Button variant="outline" size="sm">Toggle details</Button></CollapsibleTrigger>
|
|
25
27
|
<CollapsibleContent className="rounded-md border p-3 text-sm">Hidden detail content.</CollapsibleContent>
|
|
@@ -27,6 +27,7 @@ export default meta;
|
|
|
27
27
|
type Story = StoryObj<typeof ColorPicker>;
|
|
28
28
|
|
|
29
29
|
export const Default: Story = {
|
|
30
|
+
parameters: { controls: { disable: true } },
|
|
30
31
|
render: () => (
|
|
31
32
|
<ColorPicker
|
|
32
33
|
swatches={BRAND_SWATCHES}
|
|
@@ -36,6 +37,7 @@ export const Default: Story = {
|
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const WithCustomInput: Story = {
|
|
40
|
+
parameters: { controls: { disable: true } },
|
|
39
41
|
render: () => (
|
|
40
42
|
<div className="space-y-3">
|
|
41
43
|
<ColorPicker
|
|
@@ -50,6 +52,7 @@ export const WithCustomInput: Story = {
|
|
|
50
52
|
// Selection is shown by an offset ring (radio convention), not a checkmark —
|
|
51
53
|
// a check reads as a multi-select checkbox, but swatches are single-select.
|
|
52
54
|
export const Selected: Story = {
|
|
55
|
+
parameters: { controls: { disable: true } },
|
|
53
56
|
render: () => (
|
|
54
57
|
<ColorPicker
|
|
55
58
|
swatches={BRAND_SWATCHES}
|
|
@@ -122,6 +125,7 @@ export const AddOnlyWheel: Story = {
|
|
|
122
125
|
};
|
|
123
126
|
|
|
124
127
|
export const PastelPalette: Story = {
|
|
128
|
+
parameters: { controls: { disable: true } },
|
|
125
129
|
render: () => (
|
|
126
130
|
<ColorPicker
|
|
127
131
|
swatches={PASTEL_SWATCHES}
|
|
@@ -131,6 +135,7 @@ export const PastelPalette: Story = {
|
|
|
131
135
|
};
|
|
132
136
|
|
|
133
137
|
export const CustomInputOnly: Story = {
|
|
138
|
+
parameters: { controls: { disable: true } },
|
|
134
139
|
render: () => (
|
|
135
140
|
<ColorPicker
|
|
136
141
|
swatches={[]}
|
|
@@ -142,6 +147,7 @@ export const CustomInputOnly: Story = {
|
|
|
142
147
|
};
|
|
143
148
|
|
|
144
149
|
export const Disabled: Story = {
|
|
150
|
+
parameters: { controls: { disable: true } },
|
|
145
151
|
render: () => (
|
|
146
152
|
<ColorPicker
|
|
147
153
|
swatches={BRAND_SWATCHES}
|
|
@@ -177,6 +183,46 @@ export const Controlled: Story = {
|
|
|
177
183
|
},
|
|
178
184
|
};
|
|
179
185
|
|
|
186
|
+
/**
|
|
187
|
+
* A controlled parent that stores the added color in uppercase, the way the
|
|
188
|
+
* Studio's palette hook does. The wheel drafts "#3b82f6" in lowercase, so a
|
|
189
|
+
* case-sensitive dedup listed the same color twice (one local, one from props).
|
|
190
|
+
*/
|
|
191
|
+
export const ControlledEchoesAddedColor: Story = {
|
|
192
|
+
render: function EchoPicker() {
|
|
193
|
+
const [color, setColor] = React.useState("#ef4444");
|
|
194
|
+
const [swatches, setSwatches] = React.useState(["#ef4444", "#22c55e"]);
|
|
195
|
+
return (
|
|
196
|
+
<ColorPicker
|
|
197
|
+
value={color}
|
|
198
|
+
swatches={swatches}
|
|
199
|
+
wheel
|
|
200
|
+
onValueChange={(hex) => {
|
|
201
|
+
setColor(hex.toUpperCase());
|
|
202
|
+
setSwatches((prev) =>
|
|
203
|
+
prev.some((c) => c.toLowerCase() === hex.toLowerCase()) ? prev : [...prev, hex.toUpperCase()]
|
|
204
|
+
);
|
|
205
|
+
}}
|
|
206
|
+
aria-label="Brand color"
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
play: async ({ canvasElement }) => {
|
|
211
|
+
const canvas = within(canvasElement);
|
|
212
|
+
await userEvent.click(canvas.getByRole("button", { name: /add a custom color/i }));
|
|
213
|
+
// The wheel's draft starts at the current color, so type a new one: the lowercase
|
|
214
|
+
// hex the wheel keeps is what the uppercasing parent has to be matched against.
|
|
215
|
+
const hex = await within(document.body).findByLabelText(/hex color/i);
|
|
216
|
+
await userEvent.clear(hex);
|
|
217
|
+
await userEvent.type(hex, "#3b82f6");
|
|
218
|
+
await userEvent.click(await within(document.body).findByRole("button", { name: /^add color$/i }));
|
|
219
|
+
// The click commits through React state in the parent, so wait for the
|
|
220
|
+
// swatch instead of reading the DOM the instant the click returns.
|
|
221
|
+
const added = await canvas.findAllByRole("radio", { name: /^#3b82f6$/i });
|
|
222
|
+
await expect(added).toHaveLength(1);
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
|
|
180
226
|
function tagTextColor(hex: string): string {
|
|
181
227
|
const h = hex.replace("#", "");
|
|
182
228
|
const parts = h.length === 3
|
|
@@ -55,6 +55,7 @@ export const Size_Lg: Story = {
|
|
|
55
55
|
* contrast against the dark selected swatch.
|
|
56
56
|
*/
|
|
57
57
|
export const RealisticUse: Story = {
|
|
58
|
+
parameters: { controls: { disable: true } },
|
|
58
59
|
render: () => (
|
|
59
60
|
<div className="flex flex-col gap-6">
|
|
60
61
|
<div className="flex items-center gap-2">
|
|
@@ -34,6 +34,7 @@ const frameworks = [
|
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
export const Default: Story = {
|
|
37
|
+
parameters: { controls: { disable: true } },
|
|
37
38
|
render: () => {
|
|
38
39
|
const [value, setValue] = React.useState("");
|
|
39
40
|
return (
|
|
@@ -49,6 +50,7 @@ export const Default: Story = {
|
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export const WithValue: Story = {
|
|
53
|
+
parameters: { controls: { disable: true } },
|
|
52
54
|
render: () => {
|
|
53
55
|
const [value, setValue] = React.useState("next");
|
|
54
56
|
return (
|
|
@@ -64,6 +66,7 @@ export const WithValue: Story = {
|
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
export const Disabled: Story = {
|
|
69
|
+
parameters: { controls: { disable: true } },
|
|
67
70
|
render: () => (
|
|
68
71
|
<Combobox
|
|
69
72
|
options={frameworks}
|
|
@@ -75,6 +78,7 @@ export const Disabled: Story = {
|
|
|
75
78
|
};
|
|
76
79
|
|
|
77
80
|
export const WithDisabledOptions: Story = {
|
|
81
|
+
parameters: { controls: { disable: true } },
|
|
78
82
|
render: () => {
|
|
79
83
|
const [value, setValue] = React.useState("");
|
|
80
84
|
const options = [
|
|
@@ -98,6 +102,7 @@ export const WithDisabledOptions: Story = {
|
|
|
98
102
|
|
|
99
103
|
export const Variant_Creatable: Story = {
|
|
100
104
|
name: "Variant — Creatable",
|
|
105
|
+
parameters: { controls: { disable: true } },
|
|
101
106
|
render: () => {
|
|
102
107
|
const [value, setValue] = React.useState("");
|
|
103
108
|
const [options, setOptions] = React.useState([
|
|
@@ -140,6 +145,7 @@ export const Variant_Creatable: Story = {
|
|
|
140
145
|
|
|
141
146
|
export const Size_Sm: Story = {
|
|
142
147
|
name: "Size — sm",
|
|
148
|
+
parameters: { controls: { disable: true } },
|
|
143
149
|
render: () => {
|
|
144
150
|
const [value, setValue] = React.useState("");
|
|
145
151
|
return (
|
|
@@ -156,6 +162,7 @@ export const Size_Sm: Story = {
|
|
|
156
162
|
|
|
157
163
|
export const Size_Lg: Story = {
|
|
158
164
|
name: "Size — lg",
|
|
165
|
+
parameters: { controls: { disable: true } },
|
|
159
166
|
render: () => {
|
|
160
167
|
const [value, setValue] = React.useState("");
|
|
161
168
|
return (
|
|
@@ -172,6 +179,7 @@ export const Size_Lg: Story = {
|
|
|
172
179
|
|
|
173
180
|
export const Size_Xl: Story = {
|
|
174
181
|
name: "Size — xl (CTA floor, 44px)",
|
|
182
|
+
parameters: { controls: { disable: true } },
|
|
175
183
|
render: () => {
|
|
176
184
|
const [value, setValue] = React.useState("");
|
|
177
185
|
return (
|
|
@@ -196,6 +204,7 @@ export const RealisticUse: Story = {
|
|
|
196
204
|
</div>
|
|
197
205
|
),
|
|
198
206
|
],
|
|
207
|
+
parameters: { controls: { disable: true } },
|
|
199
208
|
render: () => {
|
|
200
209
|
const [country, setCountry] = React.useState("");
|
|
201
210
|
const [timezone, setTimezone] = React.useState("");
|
|
@@ -12,6 +12,7 @@ export default meta;
|
|
|
12
12
|
type Story = StoryObj<typeof meta>;
|
|
13
13
|
|
|
14
14
|
export const Default: Story = {
|
|
15
|
+
parameters: { controls: { disable: true } },
|
|
15
16
|
render: () => (<Command className="rounded-lg border w-[320px]">
|
|
16
17
|
<CommandInput placeholder="Search..." />
|
|
17
18
|
<CommandList>
|
|
@@ -26,6 +27,7 @@ export const Default: Story = {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export const RealisticUse: Story = {
|
|
30
|
+
parameters: { controls: { disable: true } },
|
|
29
31
|
render: () => (<Command className="rounded-lg border w-[320px]">
|
|
30
32
|
<CommandInput placeholder="Search..." />
|
|
31
33
|
<CommandList>
|
|
@@ -29,6 +29,7 @@ function Bounds({ label }: { label: string }) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const Default: StoryObj = {
|
|
32
|
+
parameters: { controls: { disable: true } },
|
|
32
33
|
render: () => (
|
|
33
34
|
<div className="bg-muted/40 py-6">
|
|
34
35
|
<Container>
|
|
@@ -39,6 +40,7 @@ export const Default: StoryObj = {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
export const Size_Sm: StoryObj = {
|
|
43
|
+
parameters: { controls: { disable: true } },
|
|
42
44
|
render: () => (
|
|
43
45
|
<div className="bg-muted/40 py-6">
|
|
44
46
|
<Container size="sm">
|
|
@@ -49,6 +51,7 @@ export const Size_Sm: StoryObj = {
|
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
export const Size_Md: StoryObj = {
|
|
54
|
+
parameters: { controls: { disable: true } },
|
|
52
55
|
render: () => (
|
|
53
56
|
<div className="bg-muted/40 py-6">
|
|
54
57
|
<Container size="md">
|
|
@@ -59,6 +62,7 @@ export const Size_Md: StoryObj = {
|
|
|
59
62
|
};
|
|
60
63
|
|
|
61
64
|
export const Size_Lg: StoryObj = {
|
|
65
|
+
parameters: { controls: { disable: true } },
|
|
62
66
|
render: () => (
|
|
63
67
|
<div className="bg-muted/40 py-6">
|
|
64
68
|
<Container size="lg">
|
|
@@ -69,6 +73,7 @@ export const Size_Lg: StoryObj = {
|
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
export const Size_Xl: StoryObj = {
|
|
76
|
+
parameters: { controls: { disable: true } },
|
|
72
77
|
render: () => (
|
|
73
78
|
<div className="bg-muted/40 py-6">
|
|
74
79
|
<Container size="xl">
|
|
@@ -79,6 +84,7 @@ export const Size_Xl: StoryObj = {
|
|
|
79
84
|
};
|
|
80
85
|
|
|
81
86
|
export const Size_Full: StoryObj = {
|
|
87
|
+
parameters: { controls: { disable: true } },
|
|
82
88
|
render: () => (
|
|
83
89
|
<div className="bg-muted/40 py-6">
|
|
84
90
|
<Container size="full">
|
|
@@ -89,6 +95,7 @@ export const Size_Full: StoryObj = {
|
|
|
89
95
|
};
|
|
90
96
|
|
|
91
97
|
export const NoGutters: StoryObj = {
|
|
98
|
+
parameters: { controls: { disable: true } },
|
|
92
99
|
render: () => (
|
|
93
100
|
<div className="bg-muted/40 py-6">
|
|
94
101
|
<Container size="md" gutters={false}>
|
|
@@ -99,6 +106,7 @@ export const NoGutters: StoryObj = {
|
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
export const RealisticUse: StoryObj = {
|
|
109
|
+
parameters: { controls: { disable: true } },
|
|
102
110
|
render: () => (
|
|
103
111
|
<div className="bg-muted/40 py-8">
|
|
104
112
|
<Container size="md">
|
|
@@ -34,6 +34,7 @@ const TriggerZone = ({ label = "Right-click here" }: { label?: string }) => (
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
export const Default: Story = {
|
|
37
|
+
parameters: { controls: { disable: true } },
|
|
37
38
|
render: () => (
|
|
38
39
|
<ContextMenu>
|
|
39
40
|
<ContextMenuTrigger>
|
|
@@ -52,6 +53,7 @@ export const Default: Story = {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export const WithShortcuts: Story = {
|
|
56
|
+
parameters: { controls: { disable: true } },
|
|
55
57
|
render: () => (
|
|
56
58
|
<ContextMenu>
|
|
57
59
|
<ContextMenuTrigger>
|
|
@@ -77,6 +79,7 @@ export const WithShortcuts: Story = {
|
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
export const WithLabel: Story = {
|
|
82
|
+
parameters: { controls: { disable: true } },
|
|
80
83
|
render: () => (
|
|
81
84
|
<ContextMenu>
|
|
82
85
|
<ContextMenuTrigger>
|
|
@@ -98,6 +101,7 @@ export const WithLabel: Story = {
|
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
export const WithDestructive: Story = {
|
|
104
|
+
parameters: { controls: { disable: true } },
|
|
101
105
|
render: () => (
|
|
102
106
|
<ContextMenu>
|
|
103
107
|
<ContextMenuTrigger>
|
|
@@ -114,6 +118,7 @@ export const WithDestructive: Story = {
|
|
|
114
118
|
};
|
|
115
119
|
|
|
116
120
|
export const WithCheckboxItems: Story = {
|
|
121
|
+
parameters: { controls: { disable: true } },
|
|
117
122
|
render: () => {
|
|
118
123
|
const [showGrid, setShowGrid] = useState(true);
|
|
119
124
|
const [showRulers, setShowRulers] = useState(false);
|
|
@@ -152,6 +157,7 @@ export const WithCheckboxItems: Story = {
|
|
|
152
157
|
};
|
|
153
158
|
|
|
154
159
|
export const WithRadioItems: Story = {
|
|
160
|
+
parameters: { controls: { disable: true } },
|
|
155
161
|
render: () => {
|
|
156
162
|
const [theme, setTheme] = useState("system");
|
|
157
163
|
return (
|
|
@@ -174,6 +180,7 @@ export const WithRadioItems: Story = {
|
|
|
174
180
|
};
|
|
175
181
|
|
|
176
182
|
export const WithSubMenu: Story = {
|
|
183
|
+
parameters: { controls: { disable: true } },
|
|
177
184
|
render: () => (
|
|
178
185
|
<ContextMenu>
|
|
179
186
|
<ContextMenuTrigger>
|
|
@@ -205,6 +212,7 @@ export const WithSubMenu: Story = {
|
|
|
205
212
|
};
|
|
206
213
|
|
|
207
214
|
export const WithDisabledItems: Story = {
|
|
215
|
+
parameters: { controls: { disable: true } },
|
|
208
216
|
render: () => (
|
|
209
217
|
<ContextMenu>
|
|
210
218
|
<ContextMenuTrigger>
|
|
@@ -224,6 +232,7 @@ export const WithDisabledItems: Story = {
|
|
|
224
232
|
};
|
|
225
233
|
|
|
226
234
|
export const RealisticUse: Story = {
|
|
235
|
+
parameters: { controls: { disable: true } },
|
|
227
236
|
render: () => {
|
|
228
237
|
const [starred, setStarred] = useState(false);
|
|
229
238
|
const [view, setView] = useState("grid");
|
|
@@ -22,72 +22,47 @@ export default meta
|
|
|
22
22
|
type Story = StoryObj<typeof CopyButton>
|
|
23
23
|
|
|
24
24
|
export const Default: Story = {
|
|
25
|
-
|
|
26
|
-
<CopyButton value="jordan@reeves.design">Copy email</CopyButton>
|
|
27
|
-
),
|
|
25
|
+
args: { value: "jordan@reeves.design", children: "Copy email" },
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
export const Variant_Outline: Story = {
|
|
31
|
-
|
|
32
|
-
<CopyButton value="npm install @behavioral-agentic-design-system/core" variant="outline">
|
|
33
|
-
Copy install command
|
|
34
|
-
</CopyButton>
|
|
35
|
-
),
|
|
29
|
+
args: { value: "npm install @behavioral-agentic-design-system/core", variant: "outline", children: "Copy install command" },
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
export const Variant_Ghost: Story = {
|
|
39
|
-
|
|
40
|
-
<CopyButton value="sk-proj-abc123xyz" variant="ghost">
|
|
41
|
-
Copy API key
|
|
42
|
-
</CopyButton>
|
|
43
|
-
),
|
|
33
|
+
args: { value: "sk-proj-abc123xyz", variant: "ghost", children: "Copy API key" },
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
export const Variant_Secondary: Story = {
|
|
47
|
-
|
|
48
|
-
<CopyButton value="https://design.bads.com/share/tokens-v2-proposal" variant="secondary">
|
|
49
|
-
Copy link
|
|
50
|
-
</CopyButton>
|
|
51
|
-
),
|
|
37
|
+
args: { value: "https://design.bads.com/share/tokens-v2-proposal", variant: "secondary", children: "Copy link" },
|
|
52
38
|
}
|
|
53
39
|
|
|
54
40
|
export const Size_Sm: Story = {
|
|
55
|
-
|
|
56
|
-
<CopyButton value="small value" size="sm">Copy</CopyButton>
|
|
57
|
-
),
|
|
41
|
+
args: { value: "small value", size: "sm", children: "Copy" },
|
|
58
42
|
}
|
|
59
43
|
|
|
60
44
|
export const Size_Default: Story = {
|
|
61
|
-
|
|
62
|
-
<CopyButton value="default value" size="default">Copy</CopyButton>
|
|
63
|
-
),
|
|
45
|
+
args: { value: "default value", size: "default", children: "Copy" },
|
|
64
46
|
}
|
|
65
47
|
|
|
66
48
|
export const Size_Lg: Story = {
|
|
67
|
-
|
|
68
|
-
<CopyButton value="large value" size="lg">Copy</CopyButton>
|
|
69
|
-
),
|
|
49
|
+
args: { value: "large value", size: "lg", children: "Copy" },
|
|
70
50
|
}
|
|
71
51
|
|
|
72
52
|
export const IconOnly: Story = {
|
|
73
|
-
|
|
74
|
-
<CopyButton value="sk-proj-abc123xyz" size="icon" aria-label="Copy API key" />
|
|
75
|
-
),
|
|
53
|
+
args: { value: "sk-proj-abc123xyz", size: "icon", "aria-label": "Copy API key" },
|
|
76
54
|
}
|
|
77
55
|
|
|
78
56
|
export const IconOnly_Sm: Story = {
|
|
79
|
-
|
|
80
|
-
<CopyButton value="abc123" size="icon-sm" aria-label="Copy token" />
|
|
81
|
-
),
|
|
57
|
+
args: { value: "abc123", size: "icon-sm", "aria-label": "Copy token" },
|
|
82
58
|
}
|
|
83
59
|
|
|
84
60
|
export const Disabled: Story = {
|
|
85
|
-
|
|
86
|
-
<CopyButton value="disabled" disabled>Copy</CopyButton>
|
|
87
|
-
),
|
|
61
|
+
args: { value: "disabled", disabled: true, children: "Copy" },
|
|
88
62
|
}
|
|
89
63
|
|
|
90
64
|
export const RealisticUse: Story = {
|
|
65
|
+
parameters: { controls: { disable: true } },
|
|
91
66
|
render: () => {
|
|
92
67
|
const apiKey = "sk-proj-Xk9mNpQ2vR7tLwYjAb4cDeFgHiJkLmNo" // gitleaks:allow
|
|
93
68
|
return (
|
|
@@ -110,6 +85,7 @@ export const RealisticUse: Story = {
|
|
|
110
85
|
*/
|
|
111
86
|
export const AllVariants: Story = {
|
|
112
87
|
tags: ["!manifest"],
|
|
88
|
+
parameters: { controls: { disable: true } },
|
|
113
89
|
render: () => (
|
|
114
90
|
<div className="flex flex-wrap items-center gap-3">
|
|
115
91
|
<CopyButton value="default" variant="default">Default</CopyButton>
|
|
@@ -38,6 +38,7 @@ const pair = (label: string, value: React.ReactNode) => (
|
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
export const Default: Story = {
|
|
41
|
+
parameters: { controls: { disable: true } },
|
|
41
42
|
render: () => (
|
|
42
43
|
<DataList className="w-80">
|
|
43
44
|
{pair("Name", "Jordan Reeves")}
|
|
@@ -50,6 +51,7 @@ export const Default: Story = {
|
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
export const Orientation_Vertical: Story = {
|
|
54
|
+
parameters: { controls: { disable: true } },
|
|
53
55
|
render: () => (
|
|
54
56
|
<DataList orientation="vertical" className="w-80">
|
|
55
57
|
{pair("Component", "Button · v2.4.0")}
|
|
@@ -61,6 +63,7 @@ export const Orientation_Vertical: Story = {
|
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
export const Orientation_Horizontal: Story = {
|
|
66
|
+
parameters: { controls: { disable: true } },
|
|
64
67
|
render: () => (
|
|
65
68
|
<DataList orientation="horizontal" className="w-96">
|
|
66
69
|
{pair("Invoice", "INV-2026-0187")}
|
|
@@ -79,6 +82,7 @@ export const Orientation_Horizontal: Story = {
|
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
export const Size_Sm: Story = {
|
|
85
|
+
parameters: { controls: { disable: true } },
|
|
82
86
|
render: () => (
|
|
83
87
|
<DataList size="sm" orientation="horizontal" className="w-80">
|
|
84
88
|
{pair("Owner", "Marcus Lindqvist")}
|
|
@@ -89,6 +93,7 @@ export const Size_Sm: Story = {
|
|
|
89
93
|
};
|
|
90
94
|
|
|
91
95
|
export const Size_Default: Story = {
|
|
96
|
+
parameters: { controls: { disable: true } },
|
|
92
97
|
render: () => (
|
|
93
98
|
<DataList size="default" orientation="horizontal" className="w-80">
|
|
94
99
|
{pair("Owner", "Marcus Lindqvist")}
|
|
@@ -99,6 +104,7 @@ export const Size_Default: Story = {
|
|
|
99
104
|
};
|
|
100
105
|
|
|
101
106
|
export const Size_Lg: Story = {
|
|
107
|
+
parameters: { controls: { disable: true } },
|
|
102
108
|
render: () => (
|
|
103
109
|
<DataList size="lg" orientation="horizontal" className="w-96">
|
|
104
110
|
{pair("Owner", "Marcus Lindqvist")}
|
|
@@ -109,6 +115,7 @@ export const Size_Lg: Story = {
|
|
|
109
115
|
};
|
|
110
116
|
|
|
111
117
|
export const LongValues: Story = {
|
|
118
|
+
parameters: { controls: { disable: true } },
|
|
112
119
|
render: () => (
|
|
113
120
|
<DataList orientation="horizontal" className="w-80">
|
|
114
121
|
{pair("Full name", "Wilhelmina-Constance Featherstonehaugh-Vance")}
|
|
@@ -122,6 +129,7 @@ export const LongValues: Story = {
|
|
|
122
129
|
};
|
|
123
130
|
|
|
124
131
|
export const RealisticUse: Story = {
|
|
132
|
+
parameters: { controls: { disable: true } },
|
|
125
133
|
render: () => (
|
|
126
134
|
<div className="w-[26rem] rounded-lg border bg-card p-5 shadow-sm">
|
|
127
135
|
<div className="space-y-1">
|
|
@@ -84,6 +84,7 @@ const TEAM_COLUMNS: ColumnDef<TeamMember>[] = [
|
|
|
84
84
|
// ---------------------------------------------------------------------------
|
|
85
85
|
|
|
86
86
|
export const Default: Story = {
|
|
87
|
+
parameters: { controls: { disable: true } },
|
|
87
88
|
render: () => (
|
|
88
89
|
<DataTable columns={TEAM_COLUMNS} data={TEAM_MEMBERS} />
|
|
89
90
|
),
|
|
@@ -94,6 +95,7 @@ export const Default: Story = {
|
|
|
94
95
|
// ---------------------------------------------------------------------------
|
|
95
96
|
|
|
96
97
|
export const Sortable: Story = {
|
|
98
|
+
parameters: { controls: { disable: true } },
|
|
97
99
|
render: () => (
|
|
98
100
|
<DataTable columns={TEAM_COLUMNS} data={TEAM_MEMBERS} sorting={true} />
|
|
99
101
|
),
|
|
@@ -140,6 +142,7 @@ const ADOPTION_COLUMNS: ColumnDef<ComponentAdoption>[] = [
|
|
|
140
142
|
];
|
|
141
143
|
|
|
142
144
|
export const WithPagination: Story = {
|
|
145
|
+
parameters: { controls: { disable: true } },
|
|
143
146
|
render: () => (
|
|
144
147
|
<DataTable
|
|
145
148
|
columns={ADOPTION_COLUMNS}
|
|
@@ -154,6 +157,7 @@ export const WithPagination: Story = {
|
|
|
154
157
|
// ---------------------------------------------------------------------------
|
|
155
158
|
|
|
156
159
|
export const WithRowSelection: Story = {
|
|
160
|
+
parameters: { controls: { disable: true } },
|
|
157
161
|
render: () => (
|
|
158
162
|
<DataTable
|
|
159
163
|
columns={TEAM_COLUMNS}
|
|
@@ -163,11 +167,40 @@ export const WithRowSelection: Story = {
|
|
|
163
167
|
),
|
|
164
168
|
};
|
|
165
169
|
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
// SelectionWithRowClick: ticking a checkbox selects; it does not open the row.
|
|
172
|
+
// onRowSelectionChange reports the selected data; getRowId keys rows by email.
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
export const SelectionWithRowClick: Story = {
|
|
176
|
+
parameters: { controls: { disable: true } },
|
|
177
|
+
render: () => {
|
|
178
|
+
const [selected, setSelected] = React.useState<TeamMember[]>([]);
|
|
179
|
+
const [opened, setOpened] = React.useState<string>("nobody");
|
|
180
|
+
return (
|
|
181
|
+
<div className="flex flex-col gap-3">
|
|
182
|
+
<DataTable
|
|
183
|
+
columns={TEAM_COLUMNS}
|
|
184
|
+
data={TEAM_MEMBERS}
|
|
185
|
+
rowSelection={true}
|
|
186
|
+
getRowId={(row) => row.email}
|
|
187
|
+
onRowSelectionChange={(rows) => setSelected(rows as TeamMember[])}
|
|
188
|
+
onRowClick={(row) => setOpened((row as TeamMember).name)}
|
|
189
|
+
/>
|
|
190
|
+
<p className="text-sm text-muted-foreground">
|
|
191
|
+
{selected.length} selected. Last opened: {opened}.
|
|
192
|
+
</p>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
166
198
|
// ---------------------------------------------------------------------------
|
|
167
199
|
// Dense
|
|
168
200
|
// ---------------------------------------------------------------------------
|
|
169
201
|
|
|
170
202
|
export const Dense: Story = {
|
|
203
|
+
parameters: { controls: { disable: true } },
|
|
171
204
|
render: () => (
|
|
172
205
|
<DataTable
|
|
173
206
|
columns={TEAM_COLUMNS}
|
|
@@ -182,6 +215,7 @@ export const Dense: Story = {
|
|
|
182
215
|
// ---------------------------------------------------------------------------
|
|
183
216
|
|
|
184
217
|
export const EmptyState: Story = {
|
|
218
|
+
parameters: { controls: { disable: true } },
|
|
185
219
|
render: () => (
|
|
186
220
|
<DataTable
|
|
187
221
|
columns={TEAM_COLUMNS}
|
|
@@ -258,6 +292,7 @@ const REALISTIC_COLUMNS: ColumnDef<ComponentRow>[] = [
|
|
|
258
292
|
// ---------------------------------------------------------------------------
|
|
259
293
|
|
|
260
294
|
export const StickyHeader: Story = {
|
|
295
|
+
parameters: { controls: { disable: true } },
|
|
261
296
|
render: () => (
|
|
262
297
|
<DataTable
|
|
263
298
|
columns={ADOPTION_COLUMNS}
|
|
@@ -273,9 +308,11 @@ export const StickyHeader: Story = {
|
|
|
273
308
|
// ---------------------------------------------------------------------------
|
|
274
309
|
|
|
275
310
|
export const WideOverflowing: Story = {
|
|
311
|
+
parameters: { controls: { disable: true } },
|
|
276
312
|
render: () => (
|
|
277
313
|
<div className="w-[380px]">
|
|
278
314
|
<DataTable
|
|
315
|
+
caption="Component adoption metrics"
|
|
279
316
|
columns={[
|
|
280
317
|
{ accessorKey: "component", header: "Component", size: 200 },
|
|
281
318
|
{ accessorKey: "status", header: "Status", size: 120 },
|
|
@@ -292,12 +329,14 @@ export const WideOverflowing: Story = {
|
|
|
292
329
|
};
|
|
293
330
|
|
|
294
331
|
export const RealisticUse: Story = {
|
|
332
|
+
parameters: { controls: { disable: true } },
|
|
295
333
|
render: () => (
|
|
296
334
|
<div className="space-y-2">
|
|
297
335
|
<p className="text-sm text-muted-foreground">
|
|
298
336
|
Component adoption tracker — Jordan Reeves' team across 14 product surfaces.
|
|
299
337
|
</p>
|
|
300
338
|
<DataTable
|
|
339
|
+
caption="Component adoption tracker"
|
|
301
340
|
columns={REALISTIC_COLUMNS}
|
|
302
341
|
data={REALISTIC_DATA}
|
|
303
342
|
sorting={true}
|