@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,154 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Dialog } from '.';
|
|
3
|
-
import { Button } from '../Button';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Modal overlay for focused user interactions such as confirmations and
|
|
7
|
-
* forms. Compose Dialog.Trigger, Dialog.Content, Dialog.Header, Dialog.Body,
|
|
8
|
-
* Dialog.Footer, and Dialog.Close. Supports controlled open and modal mode.
|
|
9
|
-
*/
|
|
10
|
-
const meta = {
|
|
11
|
-
title: 'Feedback/Dialog',
|
|
12
|
-
component: Dialog,
|
|
13
|
-
tags: ['autodocs'],
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
component: 'Modal overlay for focused user interactions.',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
defaultOpen: { control: 'boolean', description: 'Default open state' },
|
|
23
|
-
modal: {
|
|
24
|
-
control: 'boolean',
|
|
25
|
-
description: 'Block interaction with the rest of the page',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
modal: true,
|
|
30
|
-
defaultOpen: false,
|
|
31
|
-
children: (
|
|
32
|
-
<>
|
|
33
|
-
<Dialog.Trigger asChild>
|
|
34
|
-
<Button>Open Dialog</Button>
|
|
35
|
-
</Dialog.Trigger>
|
|
36
|
-
<Dialog.Content>
|
|
37
|
-
<Dialog.Close />
|
|
38
|
-
<Dialog.Header>
|
|
39
|
-
<Dialog.Title>Dialog Title</Dialog.Title>
|
|
40
|
-
<Dialog.Description>
|
|
41
|
-
A brief description of what this dialog is for.
|
|
42
|
-
</Dialog.Description>
|
|
43
|
-
</Dialog.Header>
|
|
44
|
-
</Dialog.Content>
|
|
45
|
-
</>
|
|
46
|
-
),
|
|
47
|
-
},
|
|
48
|
-
} satisfies Meta<typeof Dialog>;
|
|
49
|
-
|
|
50
|
-
export default meta;
|
|
51
|
-
|
|
52
|
-
type Story = StoryObj<typeof meta>;
|
|
53
|
-
|
|
54
|
-
export const Default: Story = {
|
|
55
|
-
render: (args) => (
|
|
56
|
-
<Dialog {...args}>
|
|
57
|
-
<Dialog.Trigger asChild>
|
|
58
|
-
<Button>Open Dialog</Button>
|
|
59
|
-
</Dialog.Trigger>
|
|
60
|
-
<Dialog.Content>
|
|
61
|
-
<Dialog.Close />
|
|
62
|
-
<Dialog.Header>
|
|
63
|
-
<Dialog.Title>Dialog Title</Dialog.Title>
|
|
64
|
-
<Dialog.Description>
|
|
65
|
-
A brief description of what this dialog is for.
|
|
66
|
-
</Dialog.Description>
|
|
67
|
-
</Dialog.Header>
|
|
68
|
-
<Dialog.Body>
|
|
69
|
-
<p>Dialog content goes here.</p>
|
|
70
|
-
</Dialog.Body>
|
|
71
|
-
<Dialog.Footer>
|
|
72
|
-
<Dialog.Close asChild>
|
|
73
|
-
<Button variant="secondary">Cancel</Button>
|
|
74
|
-
</Dialog.Close>
|
|
75
|
-
<Button variant="primary">Confirm</Button>
|
|
76
|
-
</Dialog.Footer>
|
|
77
|
-
</Dialog.Content>
|
|
78
|
-
</Dialog>
|
|
79
|
-
),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const Confirmation: Story = {
|
|
83
|
-
render: (args) => (
|
|
84
|
-
<Dialog {...args}>
|
|
85
|
-
<Dialog.Trigger asChild>
|
|
86
|
-
<Button variant="danger">Delete Item</Button>
|
|
87
|
-
</Dialog.Trigger>
|
|
88
|
-
<Dialog.Content size="sm">
|
|
89
|
-
<Dialog.Header>
|
|
90
|
-
<Dialog.Title>Delete item?</Dialog.Title>
|
|
91
|
-
<Dialog.Description>
|
|
92
|
-
This action cannot be undone. The item will be permanently removed.
|
|
93
|
-
</Dialog.Description>
|
|
94
|
-
</Dialog.Header>
|
|
95
|
-
<Dialog.Footer>
|
|
96
|
-
<Dialog.Close asChild>
|
|
97
|
-
<Button variant="secondary">Cancel</Button>
|
|
98
|
-
</Dialog.Close>
|
|
99
|
-
<Button variant="danger">Delete</Button>
|
|
100
|
-
</Dialog.Footer>
|
|
101
|
-
</Dialog.Content>
|
|
102
|
-
</Dialog>
|
|
103
|
-
),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const Large: Story = {
|
|
107
|
-
render: (args) => (
|
|
108
|
-
<Dialog {...args}>
|
|
109
|
-
<Dialog.Trigger asChild>
|
|
110
|
-
<Button>Open Large Dialog</Button>
|
|
111
|
-
</Dialog.Trigger>
|
|
112
|
-
<Dialog.Content size="lg">
|
|
113
|
-
<Dialog.Close />
|
|
114
|
-
<Dialog.Header>
|
|
115
|
-
<Dialog.Title>Settings</Dialog.Title>
|
|
116
|
-
<Dialog.Description>
|
|
117
|
-
Configure your application preferences.
|
|
118
|
-
</Dialog.Description>
|
|
119
|
-
</Dialog.Header>
|
|
120
|
-
<Dialog.Body>
|
|
121
|
-
<p>This dialog has more space for complex forms or layouts.</p>
|
|
122
|
-
</Dialog.Body>
|
|
123
|
-
<Dialog.Footer>
|
|
124
|
-
<Dialog.Close asChild>
|
|
125
|
-
<Button variant="secondary">Cancel</Button>
|
|
126
|
-
</Dialog.Close>
|
|
127
|
-
<Button variant="primary">Save Changes</Button>
|
|
128
|
-
</Dialog.Footer>
|
|
129
|
-
</Dialog.Content>
|
|
130
|
-
</Dialog>
|
|
131
|
-
),
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const OpenByDefault: Story = {
|
|
135
|
-
args: { defaultOpen: true },
|
|
136
|
-
render: (args) => (
|
|
137
|
-
<Dialog {...args}>
|
|
138
|
-
<Dialog.Content size="sm">
|
|
139
|
-
<Dialog.Close />
|
|
140
|
-
<Dialog.Header>
|
|
141
|
-
<Dialog.Title>Welcome</Dialog.Title>
|
|
142
|
-
<Dialog.Description>
|
|
143
|
-
This dialog is open when the story first renders.
|
|
144
|
-
</Dialog.Description>
|
|
145
|
-
</Dialog.Header>
|
|
146
|
-
<Dialog.Footer>
|
|
147
|
-
<Dialog.Close asChild>
|
|
148
|
-
<Button variant="secondary">Close</Button>
|
|
149
|
-
</Dialog.Close>
|
|
150
|
-
</Dialog.Footer>
|
|
151
|
-
</Dialog.Content>
|
|
152
|
-
</Dialog>
|
|
153
|
-
),
|
|
154
|
-
};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Drawer } from '.';
|
|
3
|
-
import { Button } from '../Button';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Drawer is a panel that slides in from a screen edge, extending the Dialog
|
|
7
|
-
* pattern with slide animations and edge positioning. It is a compound
|
|
8
|
-
* component: compose Drawer.Trigger, Drawer.Content, Drawer.Header,
|
|
9
|
-
* Drawer.Body, and Drawer.Footer inside the root.
|
|
10
|
-
*/
|
|
11
|
-
const meta = {
|
|
12
|
-
title: 'Feedback/Drawer',
|
|
13
|
-
component: Drawer,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'Slide-in panel for navigation, forms, or supplementary content.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
open: { control: 'boolean', description: 'Controlled open state' },
|
|
25
|
-
defaultOpen: {
|
|
26
|
-
control: 'boolean',
|
|
27
|
-
description: 'Default open state (uncontrolled)',
|
|
28
|
-
},
|
|
29
|
-
modal: {
|
|
30
|
-
control: 'boolean',
|
|
31
|
-
description: 'Whether the drawer blocks interaction with the page',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
modal: true,
|
|
36
|
-
children: (
|
|
37
|
-
<>
|
|
38
|
-
<Drawer.Trigger asChild>
|
|
39
|
-
<Button>Open Drawer</Button>
|
|
40
|
-
</Drawer.Trigger>
|
|
41
|
-
<Drawer.Content>
|
|
42
|
-
<Drawer.Close />
|
|
43
|
-
<Drawer.Header>
|
|
44
|
-
<Drawer.Title>Drawer Title</Drawer.Title>
|
|
45
|
-
<Drawer.Description>
|
|
46
|
-
A panel sliding in from the right.
|
|
47
|
-
</Drawer.Description>
|
|
48
|
-
</Drawer.Header>
|
|
49
|
-
<Drawer.Body>
|
|
50
|
-
<p>Drawer content goes here.</p>
|
|
51
|
-
</Drawer.Body>
|
|
52
|
-
</Drawer.Content>
|
|
53
|
-
</>
|
|
54
|
-
),
|
|
55
|
-
},
|
|
56
|
-
} satisfies Meta<typeof Drawer>;
|
|
57
|
-
|
|
58
|
-
export default meta;
|
|
59
|
-
|
|
60
|
-
type Story = StoryObj<typeof meta>;
|
|
61
|
-
|
|
62
|
-
export const Default: Story = {
|
|
63
|
-
render: () => (
|
|
64
|
-
<Drawer>
|
|
65
|
-
<Drawer.Trigger asChild>
|
|
66
|
-
<Button>Open Drawer</Button>
|
|
67
|
-
</Drawer.Trigger>
|
|
68
|
-
<Drawer.Content>
|
|
69
|
-
<Drawer.Close />
|
|
70
|
-
<Drawer.Header>
|
|
71
|
-
<Drawer.Title>Drawer Title</Drawer.Title>
|
|
72
|
-
<Drawer.Description>
|
|
73
|
-
A panel sliding in from the right.
|
|
74
|
-
</Drawer.Description>
|
|
75
|
-
</Drawer.Header>
|
|
76
|
-
<Drawer.Body>
|
|
77
|
-
<p>Drawer content goes here.</p>
|
|
78
|
-
</Drawer.Body>
|
|
79
|
-
<Drawer.Footer>
|
|
80
|
-
<Drawer.Close asChild>
|
|
81
|
-
<Button variant="secondary">Cancel</Button>
|
|
82
|
-
</Drawer.Close>
|
|
83
|
-
<Button variant="primary">Save</Button>
|
|
84
|
-
</Drawer.Footer>
|
|
85
|
-
</Drawer.Content>
|
|
86
|
-
</Drawer>
|
|
87
|
-
),
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const LeftSide: Story = {
|
|
91
|
-
render: () => (
|
|
92
|
-
<Drawer>
|
|
93
|
-
<Drawer.Trigger asChild>
|
|
94
|
-
<Button variant="secondary">Open Left</Button>
|
|
95
|
-
</Drawer.Trigger>
|
|
96
|
-
<Drawer.Content side="left">
|
|
97
|
-
<Drawer.Close />
|
|
98
|
-
<Drawer.Header>
|
|
99
|
-
<Drawer.Title>Navigation</Drawer.Title>
|
|
100
|
-
</Drawer.Header>
|
|
101
|
-
<Drawer.Body>
|
|
102
|
-
<p>Left-side drawer for navigation or filters.</p>
|
|
103
|
-
</Drawer.Body>
|
|
104
|
-
</Drawer.Content>
|
|
105
|
-
</Drawer>
|
|
106
|
-
),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const BottomSheet: Story = {
|
|
110
|
-
render: () => (
|
|
111
|
-
<Drawer>
|
|
112
|
-
<Drawer.Trigger asChild>
|
|
113
|
-
<Button variant="secondary">Open Bottom Sheet</Button>
|
|
114
|
-
</Drawer.Trigger>
|
|
115
|
-
<Drawer.Content side="bottom" size="sm">
|
|
116
|
-
<Drawer.Header>
|
|
117
|
-
<Drawer.Title>Actions</Drawer.Title>
|
|
118
|
-
</Drawer.Header>
|
|
119
|
-
<Drawer.Body>
|
|
120
|
-
<p>Bottom sheet for mobile-style actions.</p>
|
|
121
|
-
</Drawer.Body>
|
|
122
|
-
</Drawer.Content>
|
|
123
|
-
</Drawer>
|
|
124
|
-
),
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const NonModal: Story = {
|
|
128
|
-
render: () => (
|
|
129
|
-
<Drawer modal={false}>
|
|
130
|
-
<Drawer.Trigger asChild>
|
|
131
|
-
<Button>Open Non-Modal</Button>
|
|
132
|
-
</Drawer.Trigger>
|
|
133
|
-
<Drawer.Content side="right" size="md">
|
|
134
|
-
<Drawer.Close />
|
|
135
|
-
<Drawer.Header>
|
|
136
|
-
<Drawer.Title>Details</Drawer.Title>
|
|
137
|
-
</Drawer.Header>
|
|
138
|
-
<Drawer.Body>
|
|
139
|
-
<p>The rest of the page stays interactive.</p>
|
|
140
|
-
</Drawer.Body>
|
|
141
|
-
</Drawer.Content>
|
|
142
|
-
</Drawer>
|
|
143
|
-
),
|
|
144
|
-
};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Editor } from '.';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Editor is a rich-text editor with a formatting toolbar, auto-save, and word
|
|
6
|
-
* count. It falls back to a markdown-aware textarea when TipTap is not
|
|
7
|
-
* installed. It is a compound component: compose Editor.Toolbar,
|
|
8
|
-
* Editor.ToolbarGroup, Editor.ToolbarButton, Editor.Content, and
|
|
9
|
-
* Editor.StatusBar for custom layouts.
|
|
10
|
-
*/
|
|
11
|
-
const meta = {
|
|
12
|
-
title: 'Forms/Editor',
|
|
13
|
-
component: Editor,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'Rich text editor with formatting toolbar, auto-save, and word count.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
size: {
|
|
25
|
-
control: 'select',
|
|
26
|
-
options: ['sm', 'md', 'lg'],
|
|
27
|
-
description: 'Editor height preset',
|
|
28
|
-
},
|
|
29
|
-
disabled: { control: 'boolean', description: 'Disable the editor' },
|
|
30
|
-
readOnly: { control: 'boolean', description: 'Make the editor read-only' },
|
|
31
|
-
toolbar: { control: 'boolean', description: 'Show default toolbar' },
|
|
32
|
-
statusBar: {
|
|
33
|
-
control: 'boolean',
|
|
34
|
-
description: 'Show word/character counts',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
args: {
|
|
38
|
-
placeholder: 'Start typing your masterpiece here...',
|
|
39
|
-
size: 'md',
|
|
40
|
-
toolbar: true,
|
|
41
|
-
statusBar: true,
|
|
42
|
-
},
|
|
43
|
-
} satisfies Meta<typeof Editor>;
|
|
44
|
-
|
|
45
|
-
export default meta;
|
|
46
|
-
|
|
47
|
-
type Story = StoryObj<typeof meta>;
|
|
48
|
-
|
|
49
|
-
export const Default: Story = {
|
|
50
|
-
args: { placeholder: 'Start typing your masterpiece here...' },
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const Minimal: Story = {
|
|
54
|
-
args: {
|
|
55
|
-
placeholder: 'Quick note...',
|
|
56
|
-
formats: ['bold', 'italic', 'code'],
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ReadOnly: Story = {
|
|
61
|
-
args: {
|
|
62
|
-
readOnly: true,
|
|
63
|
-
defaultValue:
|
|
64
|
-
'This content is read-only. You can select and copy text but cannot modify it.',
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const WithCharacterLimit: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
placeholder: 'Write a tweet-sized message...',
|
|
71
|
-
maxLength: 280,
|
|
72
|
-
size: 'sm',
|
|
73
|
-
formats: ['bold', 'italic', 'link'],
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const CustomToolbar: Story = {
|
|
78
|
-
render: () => (
|
|
79
|
-
<Editor placeholder="Write your blog post...">
|
|
80
|
-
<Editor.Toolbar>
|
|
81
|
-
<Editor.ToolbarGroup aria-label="Basic formatting">
|
|
82
|
-
<Editor.ToolbarButton format="bold" />
|
|
83
|
-
<Editor.ToolbarButton format="italic" />
|
|
84
|
-
</Editor.ToolbarGroup>
|
|
85
|
-
<Editor.Separator />
|
|
86
|
-
<Editor.ToolbarGroup aria-label="Advanced formatting">
|
|
87
|
-
<Editor.ToolbarButton format="link" />
|
|
88
|
-
<Editor.ToolbarButton format="code" />
|
|
89
|
-
<Editor.ToolbarButton format="bulletList" />
|
|
90
|
-
</Editor.ToolbarGroup>
|
|
91
|
-
<Editor.ToolbarGroup aria-label="Status">
|
|
92
|
-
<Editor.StatusIndicator status="saving" />
|
|
93
|
-
</Editor.ToolbarGroup>
|
|
94
|
-
</Editor.Toolbar>
|
|
95
|
-
<Editor.Content />
|
|
96
|
-
<Editor.StatusBar showWordCount showCharCount />
|
|
97
|
-
</Editor>
|
|
98
|
-
),
|
|
99
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { EmptyState } from '.';
|
|
3
|
-
import { Button } from '../Button';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* EmptyState is a placeholder for empty content areas, providing context,
|
|
7
|
-
* guidance, and actions when no data is available. It is a compound component:
|
|
8
|
-
* compose EmptyState.Icon, EmptyState.Title, EmptyState.Description, and
|
|
9
|
-
* EmptyState.Actions inside the root.
|
|
10
|
-
*/
|
|
11
|
-
const meta = {
|
|
12
|
-
title: 'Feedback/EmptyState',
|
|
13
|
-
component: EmptyState,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'Placeholder for empty content areas with context, guidance, and actions.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
size: {
|
|
25
|
-
control: 'select',
|
|
26
|
-
options: ['sm', 'md', 'lg'],
|
|
27
|
-
description: 'Size variant',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
args: {
|
|
31
|
-
size: 'md',
|
|
32
|
-
children: (
|
|
33
|
-
<>
|
|
34
|
-
<EmptyState.Title>No projects yet</EmptyState.Title>
|
|
35
|
-
<EmptyState.Description>
|
|
36
|
-
Get started by creating your first project.
|
|
37
|
-
</EmptyState.Description>
|
|
38
|
-
</>
|
|
39
|
-
),
|
|
40
|
-
},
|
|
41
|
-
} satisfies Meta<typeof EmptyState>;
|
|
42
|
-
|
|
43
|
-
export default meta;
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const Default: Story = {
|
|
48
|
-
render: () => (
|
|
49
|
-
<EmptyState>
|
|
50
|
-
<EmptyState.Title>No projects yet</EmptyState.Title>
|
|
51
|
-
<EmptyState.Description>
|
|
52
|
-
Get started by creating your first project.
|
|
53
|
-
</EmptyState.Description>
|
|
54
|
-
<EmptyState.Actions>
|
|
55
|
-
<Button>Create Project</Button>
|
|
56
|
-
</EmptyState.Actions>
|
|
57
|
-
</EmptyState>
|
|
58
|
-
),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const NoResults: Story = {
|
|
62
|
-
render: () => (
|
|
63
|
-
<EmptyState>
|
|
64
|
-
<EmptyState.Title>No results found</EmptyState.Title>
|
|
65
|
-
<EmptyState.Description>
|
|
66
|
-
Try adjusting your search terms or filters.
|
|
67
|
-
</EmptyState.Description>
|
|
68
|
-
<EmptyState.Actions>
|
|
69
|
-
<Button variant="secondary">Clear Filters</Button>
|
|
70
|
-
</EmptyState.Actions>
|
|
71
|
-
</EmptyState>
|
|
72
|
-
),
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const Small: Story = {
|
|
76
|
-
render: () => (
|
|
77
|
-
<EmptyState size="sm">
|
|
78
|
-
<EmptyState.Title>No items</EmptyState.Title>
|
|
79
|
-
<EmptyState.Description>Add items to see them here.</EmptyState.Description>
|
|
80
|
-
</EmptyState>
|
|
81
|
-
),
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const Large: Story = {
|
|
85
|
-
render: () => (
|
|
86
|
-
<EmptyState size="lg">
|
|
87
|
-
<EmptyState.Title>Welcome to your workspace</EmptyState.Title>
|
|
88
|
-
<EmptyState.Description>
|
|
89
|
-
This is where your projects will appear. Create your first project to get
|
|
90
|
-
started.
|
|
91
|
-
</EmptyState.Description>
|
|
92
|
-
<EmptyState.Actions>
|
|
93
|
-
<Button>Create Your First Project</Button>
|
|
94
|
-
</EmptyState.Actions>
|
|
95
|
-
</EmptyState>
|
|
96
|
-
),
|
|
97
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Field } from '.';
|
|
3
|
-
import { Input } from '../Input';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Field is a compositional form-field wrapper providing validation, labels,
|
|
7
|
-
* descriptions, and error messages. It is a compound component: compose
|
|
8
|
-
* Field.Label, Field.Control, Field.Description, and Field.Error inside the
|
|
9
|
-
* root. Field.Control connects any form control to the field context.
|
|
10
|
-
*/
|
|
11
|
-
const meta = {
|
|
12
|
-
title: 'Forms/Field',
|
|
13
|
-
component: Field,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'Form field wrapper providing labels, descriptions, validation, and error messages.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
disabled: {
|
|
25
|
-
control: 'boolean',
|
|
26
|
-
description: 'Disables the field and its control',
|
|
27
|
-
},
|
|
28
|
-
invalid: { control: 'boolean', description: 'Marks the field as invalid' },
|
|
29
|
-
validationMode: {
|
|
30
|
-
control: 'select',
|
|
31
|
-
options: ['onSubmit', 'onBlur', 'onChange'],
|
|
32
|
-
description: 'When to trigger validation',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
args: {
|
|
36
|
-
name: 'email',
|
|
37
|
-
children: (
|
|
38
|
-
<>
|
|
39
|
-
<Field.Label>Email address</Field.Label>
|
|
40
|
-
<Field.Control>
|
|
41
|
-
<Input type="email" placeholder="jane@example.com" />
|
|
42
|
-
</Field.Control>
|
|
43
|
-
<Field.Description>We will never share your email.</Field.Description>
|
|
44
|
-
</>
|
|
45
|
-
),
|
|
46
|
-
},
|
|
47
|
-
} satisfies Meta<typeof Field>;
|
|
48
|
-
|
|
49
|
-
export default meta;
|
|
50
|
-
|
|
51
|
-
type Story = StoryObj<typeof meta>;
|
|
52
|
-
|
|
53
|
-
export const Default: Story = {
|
|
54
|
-
render: () => (
|
|
55
|
-
<Field name="email">
|
|
56
|
-
<Field.Label>Email address</Field.Label>
|
|
57
|
-
<Field.Control>
|
|
58
|
-
<Input type="email" placeholder="jane@example.com" />
|
|
59
|
-
</Field.Control>
|
|
60
|
-
<Field.Description>We will never share your email.</Field.Description>
|
|
61
|
-
</Field>
|
|
62
|
-
),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const WithError: Story = {
|
|
66
|
-
render: () => (
|
|
67
|
-
<Field name="email" invalid>
|
|
68
|
-
<Field.Label>Email</Field.Label>
|
|
69
|
-
<Field.Control>
|
|
70
|
-
<Input type="email" defaultValue="not-an-email" />
|
|
71
|
-
</Field.Control>
|
|
72
|
-
<Field.Error match="typeMismatch">Enter a valid email address</Field.Error>
|
|
73
|
-
</Field>
|
|
74
|
-
),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const CustomValidation: Story = {
|
|
78
|
-
render: () => (
|
|
79
|
-
<Field
|
|
80
|
-
name="age"
|
|
81
|
-
validate={(value) => {
|
|
82
|
-
const num = Number(value);
|
|
83
|
-
if (isNaN(num) || num < 18) return 'Must be 18 or older';
|
|
84
|
-
return null;
|
|
85
|
-
}}
|
|
86
|
-
validationMode="onChange"
|
|
87
|
-
validationDebounceTime={500}
|
|
88
|
-
>
|
|
89
|
-
<Field.Label>Age</Field.Label>
|
|
90
|
-
<Field.Control>
|
|
91
|
-
<Input type="number" placeholder="18" />
|
|
92
|
-
</Field.Control>
|
|
93
|
-
<Field.Description>You must be at least 18 years old.</Field.Description>
|
|
94
|
-
<Field.Error match="customError" />
|
|
95
|
-
</Field>
|
|
96
|
-
),
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const Disabled: Story = {
|
|
100
|
-
render: () => (
|
|
101
|
-
<Field name="username" disabled>
|
|
102
|
-
<Field.Label>Username</Field.Label>
|
|
103
|
-
<Field.Control>
|
|
104
|
-
<Input defaultValue="janedoe" />
|
|
105
|
-
</Field.Control>
|
|
106
|
-
<Field.Description>This field cannot be edited.</Field.Description>
|
|
107
|
-
</Field>
|
|
108
|
-
),
|
|
109
|
-
};
|