@usefragments/ui 1.0.2 → 1.2.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 +16 -16
- package/dist/assets/fragments-wordmark.cjs +30 -0
- package/dist/assets/fragments-wordmark.d.ts +13 -0
- package/dist/assets/fragments-wordmark.d.ts.map +1 -0
- package/dist/assets/fragments-wordmark.js +30 -0
- package/dist/assets/ui.css +3234 -3116
- package/dist/components/Accordion/Accordion.module.scss.cjs +8 -8
- package/dist/components/Accordion/Accordion.module.scss.js +8 -8
- package/dist/components/Accordion/index.cjs +22 -10
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +22 -10
- package/dist/components/Alert/Alert.module.scss.cjs +13 -13
- package/dist/components/Alert/Alert.module.scss.js +13 -13
- package/dist/components/AppShell/AppShell.module.scss.cjs +22 -10
- package/dist/components/AppShell/AppShell.module.scss.js +22 -10
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/Avatar.module.scss.cjs +13 -13
- package/dist/components/Avatar/Avatar.module.scss.js +13 -13
- package/dist/components/Badge/Badge.module.scss.cjs +16 -16
- package/dist/components/Badge/Badge.module.scss.js +16 -16
- package/dist/components/BentoGrid/BentoGrid.module.scss.cjs +14 -14
- package/dist/components/BentoGrid/BentoGrid.module.scss.js +14 -14
- package/dist/components/Box/Box.module.scss.cjs +152 -152
- package/dist/components/Box/Box.module.scss.js +152 -152
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.cjs +8 -8
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.js +8 -8
- package/dist/components/Button/Button.module.scss.cjs +13 -13
- package/dist/components/Button/Button.module.scss.js +13 -13
- package/dist/components/Card/Card.module.scss.cjs +17 -17
- package/dist/components/Card/Card.module.scss.js +17 -17
- package/dist/components/Card/index.d.ts +3 -3
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Chart/Chart.module.scss.cjs +15 -15
- package/dist/components/Chart/Chart.module.scss.js +15 -15
- package/dist/components/Checkbox/Checkbox.module.scss.cjs +11 -11
- package/dist/components/Checkbox/Checkbox.module.scss.js +11 -11
- package/dist/components/Chip/Chip.module.scss.cjs +15 -15
- package/dist/components/Chip/Chip.module.scss.js +15 -15
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
- package/dist/components/Collapsible/Collapsible.module.scss.cjs +10 -10
- package/dist/components/Collapsible/Collapsible.module.scss.js +10 -10
- package/dist/components/ColorPicker/ColorPicker.module.scss.cjs +14 -14
- package/dist/components/ColorPicker/ColorPicker.module.scss.js +14 -14
- package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
- package/dist/components/Combobox/Combobox.module.scss.js +23 -23
- package/dist/components/Combobox/index.cjs +106 -9
- package/dist/components/Combobox/index.d.ts.map +1 -1
- package/dist/components/Combobox/index.js +106 -9
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +10 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +10 -10
- package/dist/components/DataTable/DataTable.module.scss.cjs +37 -34
- package/dist/components/DataTable/DataTable.module.scss.js +37 -34
- package/dist/components/DataTable/index.d.ts +3 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.module.scss.cjs +33 -33
- package/dist/components/DatePicker/DatePicker.module.scss.js +33 -33
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.module.scss.cjs +14 -14
- package/dist/components/Dialog/Dialog.module.scss.js +14 -14
- package/dist/components/Drawer/Drawer.module.scss.cjs +28 -28
- package/dist/components/Drawer/Drawer.module.scss.js +28 -28
- package/dist/components/Drawer/index.cjs +20 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +20 -3
- package/dist/components/Editor/Editor.module.scss.cjs +17 -17
- package/dist/components/Editor/Editor.module.scss.js +17 -17
- package/dist/components/EmptyState/EmptyState.module.scss.cjs +8 -8
- package/dist/components/EmptyState/EmptyState.module.scss.js +8 -8
- package/dist/components/Field/Field.module.scss.cjs +4 -4
- package/dist/components/Field/Field.module.scss.js +4 -4
- package/dist/components/Field/index.cjs +10 -9
- package/dist/components/Field/index.d.ts +7 -7
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +10 -9
- package/dist/components/Fieldset/Fieldset.module.scss.cjs +3 -3
- package/dist/components/Fieldset/Fieldset.module.scss.js +3 -3
- package/dist/components/Header/Header.module.scss.cjs +44 -29
- package/dist/components/Header/Header.module.scss.js +44 -29
- package/dist/components/Header/index.cjs +56 -3
- package/dist/components/Header/index.d.ts +25 -3
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +56 -3
- package/dist/components/Icon/Icon.module.scss.cjs +8 -8
- package/dist/components/Icon/Icon.module.scss.js +8 -8
- package/dist/components/IconButton/IconButton.module.scss.cjs +8 -8
- package/dist/components/IconButton/IconButton.module.scss.js +8 -8
- package/dist/components/Image/Image.module.scss.cjs +27 -27
- package/dist/components/Image/Image.module.scss.js +27 -27
- package/dist/components/Input/Input.module.scss.cjs +19 -19
- package/dist/components/Input/Input.module.scss.js +19 -19
- package/dist/components/Link/Link.module.scss.cjs +10 -10
- package/dist/components/Link/Link.module.scss.js +10 -10
- package/dist/components/List/List.module.scss.cjs +19 -19
- package/dist/components/List/List.module.scss.js +19 -19
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Loading/Loading.module.scss.cjs +30 -30
- package/dist/components/Loading/Loading.module.scss.js +30 -30
- package/dist/components/Main/Main.module.scss.cjs +26 -0
- package/dist/components/Main/Main.module.scss.js +26 -0
- package/dist/components/Main/index.cjs +128 -0
- package/dist/components/Main/index.d.ts +22 -0
- package/dist/components/Main/index.d.ts.map +1 -0
- package/dist/components/Main/index.js +111 -0
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +14 -14
- package/dist/components/Menu/Menu.module.scss.js +14 -14
- package/dist/components/Message/Message.module.scss.cjs +18 -18
- package/dist/components/Message/Message.module.scss.js +18 -18
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
- package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
- package/dist/components/Pagination/Pagination.module.scss.js +7 -7
- package/dist/components/Popover/Popover.module.scss.cjs +10 -10
- package/dist/components/Popover/Popover.module.scss.js +10 -10
- package/dist/components/Popover/index.cjs +27 -2
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +27 -2
- package/dist/components/Progress/Progress.module.scss.cjs +25 -25
- package/dist/components/Progress/Progress.module.scss.js +25 -25
- package/dist/components/Prompt/Prompt.module.scss.cjs +18 -18
- package/dist/components/Prompt/Prompt.module.scss.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.module.scss.cjs +17 -17
- package/dist/components/RadioGroup/RadioGroup.module.scss.js +17 -17
- package/dist/components/RadioGroup/index.cjs +2 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/ScrollArea/ScrollArea.module.scss.cjs +10 -10
- package/dist/components/ScrollArea/ScrollArea.module.scss.js +10 -10
- package/dist/components/Select/Select.module.scss.cjs +17 -17
- package/dist/components/Select/Select.module.scss.js +17 -17
- package/dist/components/Separator/Separator.module.scss.cjs +10 -10
- package/dist/components/Separator/Separator.module.scss.js +10 -10
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +42 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +42 -42
- package/dist/components/Skeleton/Skeleton.module.scss.cjs +38 -38
- package/dist/components/Skeleton/Skeleton.module.scss.js +38 -38
- package/dist/components/Slider/Slider.module.scss.cjs +12 -12
- package/dist/components/Slider/Slider.module.scss.js +12 -12
- package/dist/components/Table/Table.module.scss.cjs +19 -19
- package/dist/components/Table/Table.module.scss.js +19 -19
- package/dist/components/TableOfContents/TableOfContents.module.scss.cjs +15 -15
- package/dist/components/TableOfContents/TableOfContents.module.scss.js +15 -15
- package/dist/components/TableOfContents/index.cjs +22 -42
- package/dist/components/TableOfContents/index.d.ts +3 -3
- package/dist/components/TableOfContents/index.d.ts.map +1 -1
- package/dist/components/TableOfContents/index.js +22 -42
- package/dist/components/Tabs/Tabs.module.scss.cjs +12 -12
- package/dist/components/Tabs/Tabs.module.scss.js +12 -12
- package/dist/components/Text/Text.module.scss.cjs +51 -51
- package/dist/components/Text/Text.module.scss.js +51 -51
- package/dist/components/Textarea/Textarea.module.scss.cjs +23 -23
- package/dist/components/Textarea/Textarea.module.scss.js +23 -23
- package/dist/components/Theme/ThemeToggle.module.scss.cjs +6 -6
- package/dist/components/Theme/ThemeToggle.module.scss.js +6 -6
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.cjs +13 -13
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.js +13 -13
- package/dist/components/Toast/Toast.module.scss.cjs +21 -21
- package/dist/components/Toast/Toast.module.scss.js +21 -21
- package/dist/components/Toggle/Toggle.module.scss.cjs +13 -13
- package/dist/components/Toggle/Toggle.module.scss.js +13 -13
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.cjs +17 -17
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.js +17 -17
- package/dist/components/Tooltip/Tooltip.module.scss.cjs +3 -3
- package/dist/components/Tooltip/Tooltip.module.scss.js +3 -3
- package/dist/data-table.cjs +58 -41
- package/dist/data-table.js +59 -41
- package/dist/datepicker.cjs +32 -72
- package/dist/datepicker.js +32 -72
- package/dist/index.cjs +89 -85
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/fragments.json +1 -1
- package/package.json +9 -8
- package/src/assets/fragments-wordmark.tsx +47 -0
- package/src/components/Accordion/index.tsx +13 -3
- package/src/components/Alert/Alert.module.scss +15 -2
- package/src/components/AppShell/AppShell.module.scss +73 -15
- package/src/components/AppShell/index.tsx +1 -1
- package/src/components/Button/Button.module.scss +19 -20
- package/src/components/Card/Card.module.scss +3 -3
- package/src/components/Card/index.tsx +3 -3
- package/src/components/Checkbox/Checkbox.contract.json +5 -24
- package/src/components/Checkbox/Checkbox.module.scss +4 -2
- package/src/components/Chip/Chip.contract.json +11 -28
- package/src/components/Chip/Chip.module.scss +21 -45
- package/src/components/CodeBlock/CodeBlock.module.scss +2 -7
- package/src/components/Combobox/Combobox.contract.json +6 -24
- package/src/components/Combobox/Combobox.module.scss +3 -2
- package/src/components/Combobox/index.tsx +132 -6
- package/src/components/DataTable/DataTable.contract.json +16 -23
- package/src/components/DataTable/DataTable.module.scss +31 -8
- package/src/components/DataTable/index.tsx +25 -4
- package/src/components/DatePicker/index.tsx +32 -84
- package/src/components/Drawer/index.tsx +38 -12
- package/src/components/Field/index.tsx +35 -35
- package/src/components/Header/Header.contract.json +41 -1
- package/src/components/Header/Header.module.scss +40 -0
- package/src/components/Header/index.tsx +88 -2
- package/src/components/IconButton/IconButton.contract.json +120 -0
- package/src/components/Listbox/Listbox.module.scss +5 -4
- package/src/components/Main/Main.contract.json +79 -0
- package/src/components/Main/Main.module.scss +31 -0
- package/src/components/Main/index.tsx +124 -0
- package/src/components/Menu/Menu.module.scss +8 -10
- package/src/components/Popover/index.tsx +34 -2
- package/src/components/RadioGroup/RadioGroup.contract.json +13 -27
- package/src/components/RadioGroup/index.tsx +4 -0
- package/src/components/Select/Select.module.scss +13 -12
- package/src/components/Table/Table.module.scss +22 -5
- package/src/components/TableOfContents/TableOfContents.contract.json +6 -16
- package/src/components/TableOfContents/TableOfContents.module.scss +20 -14
- package/src/components/TableOfContents/index.tsx +27 -38
- package/src/components/Toast/Toast.module.scss +15 -2
- package/src/components/ToggleGroup/ToggleGroup.module.scss +4 -1
- package/src/index.ts +4 -0
- package/src/styles/globals.scss +13 -10
- package/src/tokens/_component-properties.scss +26 -0
- package/src/tokens/_computed.scss +22 -4
- package/src/tokens/_derive.scss +55 -6
- package/src/tokens/_palettes.scss +24 -0
- package/src/tokens/_seeds.scss +20 -12
- package/src/tokens/_variables.scss +110 -63
- package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts +0 -33
- package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts.map +0 -1
- package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts +0 -11
- package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts +0 -5
- package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts +0 -4
- package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts +0 -3
- package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts +0 -86
- package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts +0 -2
- package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts.map +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +0 -106
- package/src/components/Alert/Alert.stories.tsx +0 -119
- package/src/components/AppShell/AppShell.stories.tsx +0 -156
- package/src/components/Avatar/Avatar.stories.tsx +0 -74
- package/src/components/Badge/Badge.stories.tsx +0 -92
- package/src/components/BentoGrid/BentoGrid.stories.tsx +0 -98
- package/src/components/Box/Box.stories.tsx +0 -150
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -87
- package/src/components/Button/Button.stories.tsx +0 -103
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -97
- package/src/components/Card/Card.stories.tsx +0 -144
- package/src/components/Chart/Chart.stories.tsx +0 -119
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -68
- package/src/components/Chip/Chip.stories.tsx +0 -70
- package/src/components/Cloud/CloudGovernanceShell.module.scss +0 -88
- package/src/components/Cloud/CloudGovernanceShell.stories.tsx +0 -446
- package/src/components/Cloud/ControlSizing.module.scss +0 -49
- package/src/components/Cloud/ControlSizing.stories.tsx +0 -238
- package/src/components/Cloud/DashboardLayoutPrototypes.module.scss +0 -462
- package/src/components/Cloud/DashboardLayoutPrototypes.shared.tsx +0 -375
- package/src/components/Cloud/DashboardLayoutPrototypes.shell.tsx +0 -147
- package/src/components/Cloud/DashboardLayoutPrototypes.stories.tsx +0 -328
- package/src/components/Cloud/PullRequestsPrototypes.content.tsx +0 -283
- package/src/components/Cloud/PullRequestsPrototypes.detail-panels.tsx +0 -381
- package/src/components/Cloud/PullRequestsPrototypes.detail.tsx +0 -204
- package/src/components/Cloud/PullRequestsPrototypes.id-data.ts +0 -395
- package/src/components/Cloud/PullRequestsPrototypes.id-page.tsx +0 -349
- package/src/components/Cloud/PullRequestsPrototypes.stories.tsx +0 -81
- package/src/components/CodeBlock/CodeBlock.stories.tsx +0 -147
- package/src/components/Collapsible/Collapsible.stories.tsx +0 -94
- package/src/components/ColorPicker/ColorPicker.stories.tsx +0 -74
- package/src/components/Combobox/Combobox.stories.tsx +0 -133
- package/src/components/Command/Command.stories.tsx +0 -102
- package/src/components/ConversationList/ConversationList.stories.tsx +0 -93
- package/src/components/DataTable/DataTable.stories.tsx +0 -129
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -129
- package/src/components/Dialog/Dialog.stories.tsx +0 -154
- package/src/components/Drawer/Drawer.stories.tsx +0 -144
- package/src/components/Editor/Editor.stories.tsx +0 -99
- package/src/components/EmptyState/EmptyState.stories.tsx +0 -97
- package/src/components/Field/Field.stories.tsx +0 -109
- package/src/components/Fieldset/Fieldset.stories.tsx +0 -116
- package/src/components/Form/Form.stories.tsx +0 -142
- package/src/components/Grid/Grid.stories.tsx +0 -125
- package/src/components/Header/Header.stories.tsx +0 -133
- package/src/components/Icon/Icon.stories.tsx +0 -80
- package/src/components/IconButton/IconButton.stories.tsx +0 -78
- package/src/components/Image/Image.stories.tsx +0 -109
- package/src/components/Input/Input.stories.tsx +0 -104
- package/src/components/Link/Link.stories.tsx +0 -67
- package/src/components/List/List.stories.tsx +0 -95
- package/src/components/Listbox/Listbox.stories.tsx +0 -81
- package/src/components/Loading/Loading.stories.tsx +0 -69
- package/src/components/Markdown/Markdown.stories.tsx +0 -75
- package/src/components/Menu/Menu.stories.tsx +0 -113
- package/src/components/Message/Message.stories.tsx +0 -85
- package/src/components/NavigationMenu/NavigationMenu.stories.tsx +0 -161
- package/src/components/Pagination/Pagination.stories.tsx +0 -81
- package/src/components/Popover/Popover.stories.tsx +0 -152
- package/src/components/Progress/Progress.stories.tsx +0 -64
- package/src/components/Prompt/Prompt.stories.tsx +0 -93
- package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -107
- package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -97
- package/src/components/Select/Select.stories.tsx +0 -127
- package/src/components/Separator/Separator.stories.tsx +0 -84
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -122
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -80
- package/src/components/Slider/Slider.stories.tsx +0 -73
- package/src/components/Stack/Stack.stories.tsx +0 -73
- package/src/components/Switch/Switch.stories.tsx +0 -59
- package/src/components/Table/Table.stories.tsx +0 -219
- package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -120
- package/src/components/Tabs/Tabs.stories.tsx +0 -136
- package/src/components/Text/Text.stories.tsx +0 -133
- package/src/components/Textarea/Textarea.stories.tsx +0 -107
- package/src/components/Theme/Theme.stories.tsx +0 -95
- package/src/components/ThinkingIndicator/ThinkingIndicator.stories.tsx +0 -85
- package/src/components/Toast/Toast.stories.tsx +0 -91
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +0 -114
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -95
- package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +0 -78
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { ColorPicker } from '.';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Color selection control with a swatch, hex input, and visual picker.
|
|
6
|
-
* Accepts controlled `value` or uncontrolled `defaultValue` hex strings,
|
|
7
|
-
* sizes sm/md/lg, an optional hex input, and an error state.
|
|
8
|
-
*/
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Forms/ColorPicker',
|
|
11
|
-
component: ColorPicker,
|
|
12
|
-
tags: ['autodocs'],
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component: 'Color selection control with hex input and visual picker.',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
size: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['sm', 'md', 'lg'],
|
|
24
|
-
description: 'Size variant',
|
|
25
|
-
},
|
|
26
|
-
showInput: { control: 'boolean', description: 'Show the hex input field' },
|
|
27
|
-
error: { control: 'boolean', description: 'Show error styling' },
|
|
28
|
-
disabled: { control: 'boolean' },
|
|
29
|
-
},
|
|
30
|
-
args: {
|
|
31
|
-
label: 'Brand Color',
|
|
32
|
-
defaultValue: '#3b82f6',
|
|
33
|
-
size: 'md',
|
|
34
|
-
showInput: true,
|
|
35
|
-
},
|
|
36
|
-
} satisfies Meta<typeof ColorPicker>;
|
|
37
|
-
|
|
38
|
-
export default meta;
|
|
39
|
-
|
|
40
|
-
type Story = StoryObj<typeof meta>;
|
|
41
|
-
|
|
42
|
-
export const Default: Story = {
|
|
43
|
-
args: { label: 'Brand Color', defaultValue: '#3b82f6' },
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithHelperText: Story = {
|
|
47
|
-
args: {
|
|
48
|
-
label: 'Primary Color',
|
|
49
|
-
defaultValue: '#10b981',
|
|
50
|
-
helperText: 'This color will be used for buttons and links',
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const SwatchOnly: Story = {
|
|
55
|
-
args: { defaultValue: '#ef4444', size: 'sm', showInput: false },
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const ErrorState: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
label: 'Brand Color',
|
|
61
|
-
defaultValue: '#000000',
|
|
62
|
-
error: true,
|
|
63
|
-
helperText: 'Please select a valid brand color',
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const Disabled: Story = {
|
|
68
|
-
args: {
|
|
69
|
-
label: 'Locked Color',
|
|
70
|
-
defaultValue: '#64748b',
|
|
71
|
-
helperText: 'This color cannot be changed',
|
|
72
|
-
disabled: true,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Combobox } from '.';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Searchable select that filters a dropdown of options as you type.
|
|
6
|
-
* Compose Combobox.Input and Combobox.Content with Combobox.Item children.
|
|
7
|
-
* Supports single and multiple selection, groups, and an empty state.
|
|
8
|
-
*/
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Forms/Combobox',
|
|
11
|
-
component: Combobox,
|
|
12
|
-
tags: ['autodocs'],
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component: 'Searchable select that filters options as you type.',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
size: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['sm', 'md', 'lg'],
|
|
24
|
-
description: 'Size variant',
|
|
25
|
-
},
|
|
26
|
-
multiple: { control: 'boolean', description: 'Allow multiple selections' },
|
|
27
|
-
autoHighlight: {
|
|
28
|
-
control: 'boolean',
|
|
29
|
-
description: 'Auto-highlight first match while filtering',
|
|
30
|
-
},
|
|
31
|
-
disabled: { control: 'boolean' },
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
size: 'md',
|
|
35
|
-
placeholder: 'Select a fruit',
|
|
36
|
-
children: (
|
|
37
|
-
<>
|
|
38
|
-
<Combobox.Input />
|
|
39
|
-
<Combobox.Content>
|
|
40
|
-
<Combobox.Empty>No matches</Combobox.Empty>
|
|
41
|
-
<Combobox.Item value="apple">Apple</Combobox.Item>
|
|
42
|
-
</Combobox.Content>
|
|
43
|
-
</>
|
|
44
|
-
),
|
|
45
|
-
},
|
|
46
|
-
} satisfies Meta<typeof Combobox>;
|
|
47
|
-
|
|
48
|
-
export default meta;
|
|
49
|
-
|
|
50
|
-
type Story = StoryObj<typeof meta>;
|
|
51
|
-
|
|
52
|
-
export const Default: Story = {
|
|
53
|
-
render: (args) => (
|
|
54
|
-
<Combobox {...args}>
|
|
55
|
-
<Combobox.Input />
|
|
56
|
-
<Combobox.Content>
|
|
57
|
-
<Combobox.Empty>No matches</Combobox.Empty>
|
|
58
|
-
<Combobox.Item value="apple">Apple</Combobox.Item>
|
|
59
|
-
<Combobox.Item value="banana">Banana</Combobox.Item>
|
|
60
|
-
<Combobox.Item value="orange">Orange</Combobox.Item>
|
|
61
|
-
<Combobox.Item value="grape">Grape</Combobox.Item>
|
|
62
|
-
</Combobox.Content>
|
|
63
|
-
</Combobox>
|
|
64
|
-
),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const Multiple: Story = {
|
|
68
|
-
args: { multiple: true, placeholder: 'Select fruits...' },
|
|
69
|
-
render: (args) => (
|
|
70
|
-
<Combobox {...args}>
|
|
71
|
-
<Combobox.Input />
|
|
72
|
-
<Combobox.Content>
|
|
73
|
-
<Combobox.Item value="apple">Apple</Combobox.Item>
|
|
74
|
-
<Combobox.Item value="banana">Banana</Combobox.Item>
|
|
75
|
-
<Combobox.Item value="orange">Orange</Combobox.Item>
|
|
76
|
-
<Combobox.Item value="mango">Mango</Combobox.Item>
|
|
77
|
-
</Combobox.Content>
|
|
78
|
-
</Combobox>
|
|
79
|
-
),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const WithLabel: Story = {
|
|
83
|
-
args: {
|
|
84
|
-
label: 'Assignee',
|
|
85
|
-
placeholder: 'Search assignees...',
|
|
86
|
-
helperText: 'Type to filter the list of available assignees.',
|
|
87
|
-
},
|
|
88
|
-
render: (args) => (
|
|
89
|
-
<Combobox {...args}>
|
|
90
|
-
<Combobox.Input />
|
|
91
|
-
<Combobox.Content>
|
|
92
|
-
<Combobox.Empty>No matches</Combobox.Empty>
|
|
93
|
-
<Combobox.Item value="alice">Alice Johnson</Combobox.Item>
|
|
94
|
-
<Combobox.Item value="bob">Bob Chen</Combobox.Item>
|
|
95
|
-
<Combobox.Item value="carol">Carol Smith</Combobox.Item>
|
|
96
|
-
</Combobox.Content>
|
|
97
|
-
</Combobox>
|
|
98
|
-
),
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const WithGroups: Story = {
|
|
102
|
-
args: { placeholder: 'Search countries...' },
|
|
103
|
-
render: (args) => (
|
|
104
|
-
<Combobox {...args}>
|
|
105
|
-
<Combobox.Input />
|
|
106
|
-
<Combobox.Content>
|
|
107
|
-
<Combobox.Group>
|
|
108
|
-
<Combobox.GroupLabel>North America</Combobox.GroupLabel>
|
|
109
|
-
<Combobox.Item value="us">United States</Combobox.Item>
|
|
110
|
-
<Combobox.Item value="ca">Canada</Combobox.Item>
|
|
111
|
-
</Combobox.Group>
|
|
112
|
-
<Combobox.Group>
|
|
113
|
-
<Combobox.GroupLabel>Europe</Combobox.GroupLabel>
|
|
114
|
-
<Combobox.Item value="uk">United Kingdom</Combobox.Item>
|
|
115
|
-
<Combobox.Item value="de">Germany</Combobox.Item>
|
|
116
|
-
</Combobox.Group>
|
|
117
|
-
</Combobox.Content>
|
|
118
|
-
</Combobox>
|
|
119
|
-
),
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export const ErrorState: Story = {
|
|
123
|
-
args: { label: 'Reviewer', placeholder: 'Search reviewers...' },
|
|
124
|
-
render: (args) => (
|
|
125
|
-
<Combobox {...args} error="Please select a reviewer">
|
|
126
|
-
<Combobox.Input />
|
|
127
|
-
<Combobox.Content>
|
|
128
|
-
<Combobox.Item value="alice">Alice</Combobox.Item>
|
|
129
|
-
<Combobox.Item value="bob">Bob</Combobox.Item>
|
|
130
|
-
</Combobox.Content>
|
|
131
|
-
</Combobox>
|
|
132
|
-
),
|
|
133
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Command } from '.';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Searchable command palette combining an input with a filterable,
|
|
6
|
-
* keyboard-navigable list of actions. Compose Command.Input and Command.List
|
|
7
|
-
* with Command.Item children; group with Command.Group and Command.Separator.
|
|
8
|
-
*/
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Navigation/Command',
|
|
11
|
-
component: Command,
|
|
12
|
-
tags: ['autodocs'],
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component: 'Searchable command palette for quick actions.',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
loop: { control: 'boolean', description: 'Loop keyboard navigation' },
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
loop: true,
|
|
25
|
-
children: (
|
|
26
|
-
<>
|
|
27
|
-
<Command.Input placeholder="Type a command..." />
|
|
28
|
-
<Command.List>
|
|
29
|
-
<Command.Item onItemSelect={() => {}}>Open File</Command.Item>
|
|
30
|
-
<Command.Empty>No results found.</Command.Empty>
|
|
31
|
-
</Command.List>
|
|
32
|
-
</>
|
|
33
|
-
),
|
|
34
|
-
},
|
|
35
|
-
} satisfies Meta<typeof Command>;
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
|
|
39
|
-
type Story = StoryObj<typeof meta>;
|
|
40
|
-
|
|
41
|
-
export const Default: Story = {
|
|
42
|
-
render: (args) => (
|
|
43
|
-
<div style={{ maxWidth: '400px', width: '100%' }}>
|
|
44
|
-
<Command {...args}>
|
|
45
|
-
<Command.Input placeholder="Type a command..." />
|
|
46
|
-
<Command.List>
|
|
47
|
-
<Command.Item onItemSelect={() => {}}>Open File</Command.Item>
|
|
48
|
-
<Command.Item onItemSelect={() => {}}>Save Document</Command.Item>
|
|
49
|
-
<Command.Item onItemSelect={() => {}}>Print</Command.Item>
|
|
50
|
-
<Command.Empty>No results found.</Command.Empty>
|
|
51
|
-
</Command.List>
|
|
52
|
-
</Command>
|
|
53
|
-
</div>
|
|
54
|
-
),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const WithGroups: Story = {
|
|
58
|
-
render: (args) => (
|
|
59
|
-
<div style={{ maxWidth: '400px', width: '100%' }}>
|
|
60
|
-
<Command {...args}>
|
|
61
|
-
<Command.Input placeholder="Search..." />
|
|
62
|
-
<Command.List>
|
|
63
|
-
<Command.Group heading="Suggestions">
|
|
64
|
-
<Command.Item onItemSelect={() => {}}>Calendar</Command.Item>
|
|
65
|
-
<Command.Item onItemSelect={() => {}}>Calculator</Command.Item>
|
|
66
|
-
</Command.Group>
|
|
67
|
-
<Command.Separator />
|
|
68
|
-
<Command.Group heading="Settings">
|
|
69
|
-
<Command.Item onItemSelect={() => {}}>Profile</Command.Item>
|
|
70
|
-
<Command.Item onItemSelect={() => {}}>Billing</Command.Item>
|
|
71
|
-
<Command.Item disabled onItemSelect={() => {}}>
|
|
72
|
-
Team (coming soon)
|
|
73
|
-
</Command.Item>
|
|
74
|
-
</Command.Group>
|
|
75
|
-
<Command.Empty>No results found.</Command.Empty>
|
|
76
|
-
</Command.List>
|
|
77
|
-
</Command>
|
|
78
|
-
</div>
|
|
79
|
-
),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const WithKeywords: Story = {
|
|
83
|
-
render: (args) => (
|
|
84
|
-
<div style={{ maxWidth: '400px', width: '100%' }}>
|
|
85
|
-
<Command {...args}>
|
|
86
|
-
<Command.Input placeholder="What do you need?" />
|
|
87
|
-
<Command.List>
|
|
88
|
-
<Command.Item keywords={['create', 'add']} onItemSelect={() => {}}>
|
|
89
|
-
New Document
|
|
90
|
-
</Command.Item>
|
|
91
|
-
<Command.Item keywords={['browse']} onItemSelect={() => {}}>
|
|
92
|
-
Open Folder
|
|
93
|
-
</Command.Item>
|
|
94
|
-
<Command.Item keywords={['find']} onItemSelect={() => {}}>
|
|
95
|
-
Search
|
|
96
|
-
</Command.Item>
|
|
97
|
-
<Command.Empty>No results found.</Command.Empty>
|
|
98
|
-
</Command.List>
|
|
99
|
-
</Command>
|
|
100
|
-
</div>
|
|
101
|
-
),
|
|
102
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { ConversationList } from '.';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Scrollable message container with auto-scroll and history loading.
|
|
6
|
-
* Holds message children, with autoScroll behavior (true/false/"smart"),
|
|
7
|
-
* an optional empty state, and ConversationList.DateSeparator /
|
|
8
|
-
* ConversationList.TypingIndicator subcomponents.
|
|
9
|
-
*/
|
|
10
|
-
const meta = {
|
|
11
|
-
title: 'Ai/ConversationList',
|
|
12
|
-
component: ConversationList,
|
|
13
|
-
tags: ['autodocs'],
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
component:
|
|
18
|
-
'Scrollable message container with auto-scroll and history loading.',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
loadingHistory: {
|
|
24
|
-
control: 'boolean',
|
|
25
|
-
description: 'Show loading spinner at top while loading history',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
autoScroll: 'smart',
|
|
30
|
-
loadingHistory: false,
|
|
31
|
-
children: (
|
|
32
|
-
<>
|
|
33
|
-
<div>Hello!</div>
|
|
34
|
-
<div>Hi there! How can I help you today?</div>
|
|
35
|
-
</>
|
|
36
|
-
),
|
|
37
|
-
},
|
|
38
|
-
} satisfies Meta<typeof ConversationList>;
|
|
39
|
-
|
|
40
|
-
export default meta;
|
|
41
|
-
|
|
42
|
-
type Story = StoryObj<typeof meta>;
|
|
43
|
-
|
|
44
|
-
export const Basic: Story = {
|
|
45
|
-
render: (args) => (
|
|
46
|
-
<ConversationList {...args} style={{ height: 280 }}>
|
|
47
|
-
<div>Hello!</div>
|
|
48
|
-
<div>Hi there! How can I help you today?</div>
|
|
49
|
-
<div>Can you explain React hooks?</div>
|
|
50
|
-
</ConversationList>
|
|
51
|
-
),
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const WithDateSeparators: Story = {
|
|
55
|
-
render: (args) => (
|
|
56
|
-
<ConversationList {...args} style={{ height: 280 }}>
|
|
57
|
-
<ConversationList.DateSeparator date={new Date(Date.now() - 86400000)} />
|
|
58
|
-
<div>A message from yesterday</div>
|
|
59
|
-
<ConversationList.DateSeparator date={new Date()} />
|
|
60
|
-
<div>And a message from today!</div>
|
|
61
|
-
</ConversationList>
|
|
62
|
-
),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const WithTypingIndicator: Story = {
|
|
66
|
-
render: (args) => (
|
|
67
|
-
<ConversationList {...args} style={{ height: 280 }}>
|
|
68
|
-
<div>What is TypeScript?</div>
|
|
69
|
-
<ConversationList.TypingIndicator name="Assistant" />
|
|
70
|
-
</ConversationList>
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const LoadingHistory: Story = {
|
|
75
|
-
args: { loadingHistory: true },
|
|
76
|
-
render: (args) => (
|
|
77
|
-
<ConversationList {...args} style={{ height: 280 }}>
|
|
78
|
-
<div>This is the latest message</div>
|
|
79
|
-
</ConversationList>
|
|
80
|
-
),
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Empty: Story = {
|
|
84
|
-
render: (args) => (
|
|
85
|
-
<ConversationList
|
|
86
|
-
{...args}
|
|
87
|
-
style={{ height: 280 }}
|
|
88
|
-
emptyState={<div>Start the conversation</div>}
|
|
89
|
-
>
|
|
90
|
-
{null}
|
|
91
|
-
</ConversationList>
|
|
92
|
-
),
|
|
93
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { DataTable } from '.';
|
|
3
|
-
import type { ColumnDef, DataTableProps } from '.';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Data table with sorting, selection, and column management, powered by
|
|
7
|
-
* TanStack Table. Requires `columns` and `data`; supports sortable headers,
|
|
8
|
-
* checkbox selection, clickable rows, striped/bordered styling, and sizes.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
type User = {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
email: string;
|
|
15
|
-
role: string;
|
|
16
|
-
status: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const columns: ColumnDef<User>[] = [
|
|
20
|
-
{ accessorKey: 'name', header: 'Name' },
|
|
21
|
-
{ accessorKey: 'email', header: 'Email' },
|
|
22
|
-
{ accessorKey: 'role', header: 'Role' },
|
|
23
|
-
{ accessorKey: 'status', header: 'Status' },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
const data: User[] = [
|
|
27
|
-
{
|
|
28
|
-
id: '1',
|
|
29
|
-
name: 'Alice Johnson',
|
|
30
|
-
email: 'alice@example.com',
|
|
31
|
-
role: 'Admin',
|
|
32
|
-
status: 'active',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: '2',
|
|
36
|
-
name: 'Bob Chen',
|
|
37
|
-
email: 'bob@example.com',
|
|
38
|
-
role: 'Member',
|
|
39
|
-
status: 'pending',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: '3',
|
|
43
|
-
name: 'Carol Smith',
|
|
44
|
-
email: 'carol@example.com',
|
|
45
|
-
role: 'Member',
|
|
46
|
-
status: 'active',
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const meta = {
|
|
51
|
-
title: 'Display/DataTable',
|
|
52
|
-
component: DataTable,
|
|
53
|
-
tags: ['autodocs'],
|
|
54
|
-
parameters: {
|
|
55
|
-
docs: {
|
|
56
|
-
description: {
|
|
57
|
-
component: 'Data table with sorting, selection, and column management.',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
argTypes: {
|
|
62
|
-
size: {
|
|
63
|
-
control: 'select',
|
|
64
|
-
options: ['sm', 'md'],
|
|
65
|
-
description: 'Table density',
|
|
66
|
-
},
|
|
67
|
-
sortable: { control: 'boolean', description: 'Enable column sorting' },
|
|
68
|
-
selectable: { control: 'boolean', description: 'Enable row selection' },
|
|
69
|
-
showCheckbox: {
|
|
70
|
-
control: 'boolean',
|
|
71
|
-
description: 'Show checkbox column (requires selectable)',
|
|
72
|
-
},
|
|
73
|
-
striped: { control: 'boolean', description: 'Alternating row backgrounds' },
|
|
74
|
-
bordered: { control: 'boolean', description: 'Bordered container' },
|
|
75
|
-
captionHidden: { control: 'boolean' },
|
|
76
|
-
},
|
|
77
|
-
args: { columns, data, size: 'md' },
|
|
78
|
-
} satisfies Meta<DataTableProps<User>>;
|
|
79
|
-
|
|
80
|
-
export default meta;
|
|
81
|
-
|
|
82
|
-
type Story = StoryObj<DataTableProps<User>>;
|
|
83
|
-
|
|
84
|
-
export const Default: Story = {
|
|
85
|
-
args: { columns, data },
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const Sortable: Story = {
|
|
89
|
-
args: {
|
|
90
|
-
columns,
|
|
91
|
-
data,
|
|
92
|
-
sortable: true,
|
|
93
|
-
bordered: true,
|
|
94
|
-
caption: 'Team members',
|
|
95
|
-
captionHidden: true,
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const CheckboxSelection: Story = {
|
|
100
|
-
args: {
|
|
101
|
-
columns,
|
|
102
|
-
data,
|
|
103
|
-
selectable: true,
|
|
104
|
-
showCheckbox: true,
|
|
105
|
-
bordered: true,
|
|
106
|
-
getRowId: (row: User) => row.id,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const Striped: Story = {
|
|
111
|
-
args: { columns, data, striped: true, size: 'sm' },
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const ClickableRows: Story = {
|
|
115
|
-
args: {
|
|
116
|
-
columns,
|
|
117
|
-
data,
|
|
118
|
-
onRowClick: (row: User) => alert(row.name),
|
|
119
|
-
size: 'sm',
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const Empty: Story = {
|
|
124
|
-
args: {
|
|
125
|
-
columns,
|
|
126
|
-
data: [],
|
|
127
|
-
emptyMessage: 'No users match your search criteria',
|
|
128
|
-
},
|
|
129
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { DatePicker } from ".";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Date picker with a calendar dropdown for single dates or date ranges,
|
|
6
|
-
* built on react-day-picker. Compose DatePicker.Trigger, DatePicker.Content,
|
|
7
|
-
* and DatePicker.Calendar. Supports modes single/range and disabled dates.
|
|
8
|
-
*/
|
|
9
|
-
const meta = {
|
|
10
|
-
title: "Forms/DatePicker",
|
|
11
|
-
component: DatePicker,
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component: "Date picker with calendar dropdown for dates or ranges.",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
mode: {
|
|
22
|
-
control: "select",
|
|
23
|
-
options: ["single", "range"],
|
|
24
|
-
description: "Selection mode",
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
control: "select",
|
|
28
|
-
options: ["sm", "md", "lg"],
|
|
29
|
-
description: "Trigger size variant",
|
|
30
|
-
},
|
|
31
|
-
disabled: { control: "boolean" },
|
|
32
|
-
fixedWeeks: { control: "boolean", description: "Always show 6 rows" },
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
mode: "single",
|
|
36
|
-
size: "md",
|
|
37
|
-
placeholder: "Pick a date",
|
|
38
|
-
children: (
|
|
39
|
-
<>
|
|
40
|
-
<DatePicker.Trigger />
|
|
41
|
-
<DatePicker.Content>
|
|
42
|
-
<DatePicker.Calendar />
|
|
43
|
-
</DatePicker.Content>
|
|
44
|
-
</>
|
|
45
|
-
),
|
|
46
|
-
},
|
|
47
|
-
} satisfies Meta<typeof DatePicker>;
|
|
48
|
-
|
|
49
|
-
export default meta;
|
|
50
|
-
|
|
51
|
-
type Story = StoryObj<typeof meta>;
|
|
52
|
-
|
|
53
|
-
export const Default: Story = {
|
|
54
|
-
render: (args) => (
|
|
55
|
-
<DatePicker {...args}>
|
|
56
|
-
<DatePicker.Trigger />
|
|
57
|
-
<DatePicker.Content>
|
|
58
|
-
<DatePicker.Calendar />
|
|
59
|
-
</DatePicker.Content>
|
|
60
|
-
</DatePicker>
|
|
61
|
-
),
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const Range: Story = {
|
|
65
|
-
args: { mode: "range", placeholder: "Select date range", numberOfMonths: 2 },
|
|
66
|
-
render: (args) => (
|
|
67
|
-
<DatePicker {...args}>
|
|
68
|
-
<DatePicker.Trigger />
|
|
69
|
-
<DatePicker.Content>
|
|
70
|
-
<DatePicker.Calendar />
|
|
71
|
-
</DatePicker.Content>
|
|
72
|
-
</DatePicker>
|
|
73
|
-
),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const DisabledDates: Story = {
|
|
77
|
-
args: {
|
|
78
|
-
placeholder: "Select a future date",
|
|
79
|
-
disabledDates: (date: Date) => date < new Date(),
|
|
80
|
-
},
|
|
81
|
-
render: (args) => (
|
|
82
|
-
<DatePicker {...args}>
|
|
83
|
-
<DatePicker.Trigger />
|
|
84
|
-
<DatePicker.Content>
|
|
85
|
-
<DatePicker.Calendar />
|
|
86
|
-
</DatePicker.Content>
|
|
87
|
-
</DatePicker>
|
|
88
|
-
),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const WithLabel: Story = {
|
|
92
|
-
args: {
|
|
93
|
-
label: "Start Date",
|
|
94
|
-
placeholder: "Pick a date",
|
|
95
|
-
helperText: "Choose when the project begins.",
|
|
96
|
-
},
|
|
97
|
-
render: (args) => (
|
|
98
|
-
<DatePicker {...args}>
|
|
99
|
-
<DatePicker.Trigger />
|
|
100
|
-
<DatePicker.Content>
|
|
101
|
-
<DatePicker.Calendar />
|
|
102
|
-
</DatePicker.Content>
|
|
103
|
-
</DatePicker>
|
|
104
|
-
),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const ErrorState: Story = {
|
|
108
|
-
args: { label: "Start Date", placeholder: "Pick a date" },
|
|
109
|
-
render: (args) => (
|
|
110
|
-
<DatePicker {...args} error="Please select a start date">
|
|
111
|
-
<DatePicker.Trigger />
|
|
112
|
-
<DatePicker.Content>
|
|
113
|
-
<DatePicker.Calendar />
|
|
114
|
-
</DatePicker.Content>
|
|
115
|
-
</DatePicker>
|
|
116
|
-
),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const Disabled: Story = {
|
|
120
|
-
args: { placeholder: "Pick a date", disabled: true },
|
|
121
|
-
render: (args) => (
|
|
122
|
-
<DatePicker {...args}>
|
|
123
|
-
<DatePicker.Trigger />
|
|
124
|
-
<DatePicker.Content>
|
|
125
|
-
<DatePicker.Calendar />
|
|
126
|
-
</DatePicker.Content>
|
|
127
|
-
</DatePicker>
|
|
128
|
-
),
|
|
129
|
-
};
|