tharaday 0.1.1
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/.gitignore +30 -0
- package/.prettierrc.json +10 -0
- package/.storybook/main.ts +8 -0
- package/.storybook/preview.ts +50 -0
- package/.versionrc.json +6 -0
- package/README.md +73 -0
- package/dist/components/Accordion/Accordion.d.ts +2 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +14 -0
- package/dist/components/Accordion/Accordion.types.d.ts +18 -0
- package/dist/components/Avatar/Avatar.d.ts +2 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +14 -0
- package/dist/components/Avatar/Avatar.types.d.ts +10 -0
- package/dist/components/Badge/Badge.d.ts +2 -0
- package/dist/components/Badge/Badge.stories.d.ts +33 -0
- package/dist/components/Badge/Badge.types.d.ts +9 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.stories.d.ts +38 -0
- package/dist/components/Box/Box.types.d.ts +49 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +3 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +13 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -0
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.stories.d.ts +22 -0
- package/dist/components/Button/Button.types.d.ts +12 -0
- package/dist/components/Card/Card.d.ts +5 -0
- package/dist/components/Card/Card.stories.d.ts +27 -0
- package/dist/components/Card/Card.types.d.ts +15 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +17 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +6 -0
- package/dist/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/components/Dropdown/Dropdown.stories.d.ts +12 -0
- package/dist/components/Dropdown/Dropdown.types.d.ts +24 -0
- package/dist/components/Header/Header.d.ts +2 -0
- package/dist/components/Header/Header.stories.d.ts +18 -0
- package/dist/components/Header/Header.types.d.ts +14 -0
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.stories.d.ts +29 -0
- package/dist/components/Input/Input.types.d.ts +8 -0
- package/dist/components/Loader/Loader.d.ts +2 -0
- package/dist/components/Loader/Loader.stories.d.ts +25 -0
- package/dist/components/Loader/Loader.types.d.ts +8 -0
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/Modal.stories.d.ts +22 -0
- package/dist/components/Modal/Modal.types.d.ts +12 -0
- package/dist/components/NavBar/NavBar.d.ts +6 -0
- package/dist/components/NavBar/NavBar.stories.d.ts +8 -0
- package/dist/components/NavBar/NavBar.types.d.ts +34 -0
- package/dist/components/Notification/Notification.d.ts +2 -0
- package/dist/components/Notification/Notification.stories.d.ts +26 -0
- package/dist/components/Notification/Notification.types.d.ts +8 -0
- package/dist/components/Pagination/Pagination.d.ts +2 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +21 -0
- package/dist/components/Pagination/Pagination.types.d.ts +34 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +32 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +12 -0
- package/dist/components/RadioButton/RadioButton.d.ts +2 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +30 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +8 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.stories.d.ts +29 -0
- package/dist/components/Select/Select.types.d.ts +15 -0
- package/dist/components/Skeleton/Skeleton.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +15 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +8 -0
- package/dist/components/Stepper/Step.d.ts +2 -0
- package/dist/components/Stepper/Step.types.d.ts +17 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -0
- package/dist/components/Stepper/Stepper.stories.d.ts +15 -0
- package/dist/components/Stepper/Stepper.types.d.ts +13 -0
- package/dist/components/Stepper/stepper.utils.d.ts +3 -0
- package/dist/components/Switch/Switch.d.ts +2 -0
- package/dist/components/Switch/Switch.stories.d.ts +16 -0
- package/dist/components/Switch/Switch.types.d.ts +5 -0
- package/dist/components/Table/Table.d.ts +8 -0
- package/dist/components/Table/Table.stories.d.ts +27 -0
- package/dist/components/Table/Table.types.d.ts +17 -0
- package/dist/components/Tabs/Tabs.d.ts +2 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
- package/dist/components/Tabs/Tabs.types.d.ts +16 -0
- package/dist/components/Text/Text.d.ts +2 -0
- package/dist/components/Text/Text.stories.d.ts +35 -0
- package/dist/components/Text/Text.types.d.ts +21 -0
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +29 -0
- package/dist/components/Textarea/Textarea.types.d.ts +9 -0
- package/dist/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +12 -0
- package/dist/ds.css +1 -0
- package/dist/ds.js +1930 -0
- package/dist/ds.umd.cjs +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/layouts/AppLayout/AppLayout.d.ts +8 -0
- package/dist/layouts/AppLayout/AppLayout.stories.d.ts +19 -0
- package/dist/layouts/AppLayout/AppLayout.types.d.ts +50 -0
- package/dist/layouts/AuthLayout/AuthLayout.d.ts +2 -0
- package/dist/layouts/AuthLayout/AuthLayout.stories.d.ts +12 -0
- package/dist/layouts/AuthLayout/AuthLayout.types.d.ts +7 -0
- package/dist/layouts/DashboardLayout/DashboardLayout.d.ts +2 -0
- package/dist/layouts/DashboardLayout/DashboardLayout.stories.d.ts +17 -0
- package/dist/layouts/DashboardLayout/DashboardLayout.types.d.ts +15 -0
- package/dist/layouts/SettingsLayout/SettingsLayout.d.ts +2 -0
- package/dist/layouts/SettingsLayout/SettingsLayout.stories.d.ts +17 -0
- package/dist/layouts/SettingsLayout/SettingsLayout.types.d.ts +14 -0
- package/eslint.config.js +45 -0
- package/package.json +100 -0
- package/src/components/Accordion/Accordion.module.css +158 -0
- package/src/components/Accordion/Accordion.stories.tsx +133 -0
- package/src/components/Accordion/Accordion.tsx +68 -0
- package/src/components/Accordion/Accordion.types.ts +21 -0
- package/src/components/Avatar/Avatar.module.css +58 -0
- package/src/components/Avatar/Avatar.stories.tsx +41 -0
- package/src/components/Avatar/Avatar.tsx +64 -0
- package/src/components/Avatar/Avatar.types.ts +12 -0
- package/src/components/Badge/Badge.module.css +98 -0
- package/src/components/Badge/Badge.stories.tsx +108 -0
- package/src/components/Badge/Badge.tsx +22 -0
- package/src/components/Badge/Badge.types.ts +11 -0
- package/src/components/Box/Box.module.css +638 -0
- package/src/components/Box/Box.stories.tsx +109 -0
- package/src/components/Box/Box.tsx +95 -0
- package/src/components/Box/Box.types.ts +65 -0
- package/src/components/Breadcrumbs/Breadcrumbs.module.css +41 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +40 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +54 -0
- package/src/components/Breadcrumbs/Breadcrumbs.types.ts +13 -0
- package/src/components/Button/Button.module.css +247 -0
- package/src/components/Button/Button.stories.tsx +93 -0
- package/src/components/Button/Button.tsx +31 -0
- package/src/components/Button/Button.types.ts +14 -0
- package/src/components/Card/Card.module.css +112 -0
- package/src/components/Card/Card.stories.tsx +86 -0
- package/src/components/Card/Card.tsx +70 -0
- package/src/components/Card/Card.types.ts +20 -0
- package/src/components/Checkbox/Checkbox.module.css +88 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +65 -0
- package/src/components/Checkbox/Checkbox.tsx +57 -0
- package/src/components/Checkbox/Checkbox.types.ts +7 -0
- package/src/components/Dropdown/Dropdown.module.css +140 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +86 -0
- package/src/components/Dropdown/Dropdown.tsx +251 -0
- package/src/components/Dropdown/Dropdown.types.ts +27 -0
- package/src/components/Header/Header.module.css +38 -0
- package/src/components/Header/Header.stories.tsx +53 -0
- package/src/components/Header/Header.tsx +49 -0
- package/src/components/Header/Header.types.ts +15 -0
- package/src/components/Input/Input.module.css +87 -0
- package/src/components/Input/Input.stories.tsx +101 -0
- package/src/components/Input/Input.tsx +41 -0
- package/src/components/Input/Input.types.ts +10 -0
- package/src/components/Loader/Loader.module.css +49 -0
- package/src/components/Loader/Loader.stories.tsx +75 -0
- package/src/components/Loader/Loader.tsx +15 -0
- package/src/components/Loader/Loader.types.ts +9 -0
- package/src/components/Modal/Modal.module.css +88 -0
- package/src/components/Modal/Modal.stories.tsx +94 -0
- package/src/components/Modal/Modal.tsx +115 -0
- package/src/components/Modal/Modal.types.ts +13 -0
- package/src/components/NavBar/NavBar.module.css +77 -0
- package/src/components/NavBar/NavBar.stories.tsx +55 -0
- package/src/components/NavBar/NavBar.tsx +50 -0
- package/src/components/NavBar/NavBar.types.ts +36 -0
- package/src/components/Notification/Notification.module.css +72 -0
- package/src/components/Notification/Notification.stories.tsx +81 -0
- package/src/components/Notification/Notification.tsx +34 -0
- package/src/components/Notification/Notification.types.ts +10 -0
- package/src/components/Pagination/Pagination.module.css +31 -0
- package/src/components/Pagination/Pagination.stories.tsx +128 -0
- package/src/components/Pagination/Pagination.tsx +245 -0
- package/src/components/Pagination/Pagination.types.ts +37 -0
- package/src/components/ProgressBar/ProgressBar.module.css +67 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +91 -0
- package/src/components/ProgressBar/ProgressBar.tsx +49 -0
- package/src/components/ProgressBar/ProgressBar.types.ts +13 -0
- package/src/components/RadioButton/RadioButton.module.css +162 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +114 -0
- package/src/components/RadioButton/RadioButton.tsx +43 -0
- package/src/components/RadioButton/RadioButton.types.ts +10 -0
- package/src/components/Select/Select.module.css +88 -0
- package/src/components/Select/Select.stories.tsx +99 -0
- package/src/components/Select/Select.tsx +51 -0
- package/src/components/Select/Select.types.ts +18 -0
- package/src/components/Skeleton/Skeleton.module.css +71 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +54 -0
- package/src/components/Skeleton/Skeleton.tsx +32 -0
- package/src/components/Skeleton/Skeleton.types.ts +10 -0
- package/src/components/Stepper/Step.module.css +162 -0
- package/src/components/Stepper/Step.tsx +62 -0
- package/src/components/Stepper/Step.types.ts +19 -0
- package/src/components/Stepper/Stepper.module.css +39 -0
- package/src/components/Stepper/Stepper.stories.tsx +88 -0
- package/src/components/Stepper/Stepper.tsx +47 -0
- package/src/components/Stepper/Stepper.types.ts +16 -0
- package/src/components/Stepper/stepper.utils.ts +41 -0
- package/src/components/Switch/Switch.module.css +74 -0
- package/src/components/Switch/Switch.stories.tsx +56 -0
- package/src/components/Switch/Switch.tsx +36 -0
- package/src/components/Switch/Switch.types.ts +6 -0
- package/src/components/Table/Table.module.css +78 -0
- package/src/components/Table/Table.stories.tsx +124 -0
- package/src/components/Table/Table.tsx +75 -0
- package/src/components/Table/Table.types.ts +29 -0
- package/src/components/Tabs/Tabs.module.css +74 -0
- package/src/components/Tabs/Tabs.stories.tsx +48 -0
- package/src/components/Tabs/Tabs.tsx +113 -0
- package/src/components/Tabs/Tabs.types.ts +18 -0
- package/src/components/Text/Text.module.css +126 -0
- package/src/components/Text/Text.stories.tsx +128 -0
- package/src/components/Text/Text.tsx +50 -0
- package/src/components/Text/Text.types.ts +43 -0
- package/src/components/Textarea/Textarea.module.css +82 -0
- package/src/components/Textarea/Textarea.stories.tsx +99 -0
- package/src/components/Textarea/Textarea.tsx +43 -0
- package/src/components/Textarea/Textarea.types.ts +11 -0
- package/src/components/Tooltip/Tooltip.module.css +125 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +68 -0
- package/src/components/Tooltip/Tooltip.tsx +87 -0
- package/src/components/Tooltip/Tooltip.types.ts +14 -0
- package/src/index.ts +132 -0
- package/src/layouts/AppLayout/AppLayout.module.css +17 -0
- package/src/layouts/AppLayout/AppLayout.stories.tsx +124 -0
- package/src/layouts/AppLayout/AppLayout.tsx +46 -0
- package/src/layouts/AppLayout/AppLayout.types.ts +50 -0
- package/src/layouts/AuthLayout/AuthLayout.module.css +49 -0
- package/src/layouts/AuthLayout/AuthLayout.stories.tsx +109 -0
- package/src/layouts/AuthLayout/AuthLayout.tsx +27 -0
- package/src/layouts/AuthLayout/AuthLayout.types.tsx +8 -0
- package/src/layouts/DashboardLayout/DashboardLayout.module.css +37 -0
- package/src/layouts/DashboardLayout/DashboardLayout.stories.tsx +144 -0
- package/src/layouts/DashboardLayout/DashboardLayout.tsx +41 -0
- package/src/layouts/DashboardLayout/DashboardLayout.types.tsx +14 -0
- package/src/layouts/SettingsLayout/SettingsLayout.module.css +39 -0
- package/src/layouts/SettingsLayout/SettingsLayout.stories.tsx +103 -0
- package/src/layouts/SettingsLayout/SettingsLayout.tsx +37 -0
- package/src/layouts/SettingsLayout/SettingsLayout.types.tsx +13 -0
- package/src/styles/ds.css +12 -0
- package/src/styles/semantic.css +56 -0
- package/src/styles/themes/dark.css +58 -0
- package/src/styles/themes/light.css +58 -0
- package/src/styles/themes/retro.css +58 -0
- package/src/styles/tokens.css +138 -0
- package/tsconfig.app.json +28 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background-color: var(--ds-surface-0);
|
|
3
|
+
border-radius: var(--ds-radius-lg);
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bordered {
|
|
10
|
+
border: 1px solid var(--ds-border-1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Shadows */
|
|
14
|
+
.shadowNone {
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
}
|
|
17
|
+
.shadowSm {
|
|
18
|
+
box-shadow: var(--ds-shadow-sm);
|
|
19
|
+
}
|
|
20
|
+
.shadowMd {
|
|
21
|
+
box-shadow: var(--ds-shadow-md);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Border Colors */
|
|
25
|
+
.borderColor-main {
|
|
26
|
+
border-color: var(--ds-border-1);
|
|
27
|
+
}
|
|
28
|
+
.borderColor-subtle {
|
|
29
|
+
border-color: var(--ds-border-2);
|
|
30
|
+
}
|
|
31
|
+
.borderColor-danger {
|
|
32
|
+
border-color: var(--ds-danger);
|
|
33
|
+
}
|
|
34
|
+
.borderColor-success {
|
|
35
|
+
border-color: var(--ds-success);
|
|
36
|
+
}
|
|
37
|
+
.borderColor-info {
|
|
38
|
+
border-color: var(--ds-info);
|
|
39
|
+
}
|
|
40
|
+
.borderColor-warning {
|
|
41
|
+
border-color: var(--ds-warning);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Background Color */
|
|
45
|
+
.backgroundColor-none {
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
}
|
|
48
|
+
.backgroundColor-subtle {
|
|
49
|
+
background-color: var(--ds-surface-1);
|
|
50
|
+
}
|
|
51
|
+
.backgroundColor-danger-subtle {
|
|
52
|
+
background-color: var(--ds-danger-subtle);
|
|
53
|
+
}
|
|
54
|
+
.backgroundColor-success-subtle {
|
|
55
|
+
background-color: var(--ds-success-subtle);
|
|
56
|
+
}
|
|
57
|
+
.backgroundColor-warning-subtle {
|
|
58
|
+
background-color: var(--ds-warning-subtle);
|
|
59
|
+
}
|
|
60
|
+
.backgroundColor-info-subtle {
|
|
61
|
+
background-color: var(--ds-info-subtle);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Paddings */
|
|
65
|
+
.pNone {
|
|
66
|
+
padding: 0;
|
|
67
|
+
}
|
|
68
|
+
.pSm {
|
|
69
|
+
padding: var(--ds-space-4);
|
|
70
|
+
}
|
|
71
|
+
.pMd {
|
|
72
|
+
padding: var(--ds-space-6);
|
|
73
|
+
}
|
|
74
|
+
.pLg {
|
|
75
|
+
padding: var(--ds-space-8);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Subcomponents */
|
|
79
|
+
.header {
|
|
80
|
+
padding-bottom: var(--ds-space-4);
|
|
81
|
+
border-bottom: 1px solid var(--ds-border-2);
|
|
82
|
+
margin-bottom: var(--ds-space-4);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.title {
|
|
86
|
+
font-family: var(--ds-font-family-base);
|
|
87
|
+
font-size: var(--ds-font-size-lg);
|
|
88
|
+
font-weight: var(--ds-font-weight-bold);
|
|
89
|
+
color: var(--ds-text-1);
|
|
90
|
+
margin: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.subtitle {
|
|
94
|
+
font-family: var(--ds-font-family-base);
|
|
95
|
+
font-size: var(--ds-font-size-sm);
|
|
96
|
+
color: var(--ds-text-2);
|
|
97
|
+
margin: var(--ds-space-1) 0 0 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.content {
|
|
101
|
+
flex: 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.footer {
|
|
105
|
+
padding-top: var(--ds-space-4);
|
|
106
|
+
border-top: 1px solid var(--ds-border-2);
|
|
107
|
+
margin-top: var(--ds-space-4);
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: flex-end;
|
|
111
|
+
gap: var(--ds-space-3);
|
|
112
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Card, CardHeader, CardContent, CardFooter } from './Card.tsx';
|
|
4
|
+
import { Button } from '../Button/Button.tsx';
|
|
5
|
+
import { Text } from '../Text/Text.tsx';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Card',
|
|
9
|
+
component: Card,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
padding: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: ['none', 'sm', 'md', 'lg'],
|
|
18
|
+
},
|
|
19
|
+
shadow: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['none', 'sm', 'md'],
|
|
22
|
+
},
|
|
23
|
+
bordered: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<typeof Card>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
render: (args) => (
|
|
34
|
+
<Card {...args} className="w-[400px]">
|
|
35
|
+
<CardHeader title="Card Title" subtitle="This is a card subtitle providing more context." />
|
|
36
|
+
<CardContent>
|
|
37
|
+
<Text>
|
|
38
|
+
This is the main content area of the card. You can put any components or text here.
|
|
39
|
+
</Text>
|
|
40
|
+
</CardContent>
|
|
41
|
+
<CardFooter>
|
|
42
|
+
<Button variant="outline" size="sm">
|
|
43
|
+
Cancel
|
|
44
|
+
</Button>
|
|
45
|
+
<Button variant="solid" size="sm" intent="info">
|
|
46
|
+
Confirm
|
|
47
|
+
</Button>
|
|
48
|
+
</CardFooter>
|
|
49
|
+
</Card>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Simple: Story = {
|
|
54
|
+
render: (args) => (
|
|
55
|
+
<Card {...args} className="w-[300px]">
|
|
56
|
+
<CardContent>
|
|
57
|
+
<Text>A simple card with only content and no border.</Text>
|
|
58
|
+
</CardContent>
|
|
59
|
+
</Card>
|
|
60
|
+
),
|
|
61
|
+
args: {
|
|
62
|
+
bordered: false,
|
|
63
|
+
shadow: 'md',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const BackgroundColor: Story = {
|
|
68
|
+
render: (args) => (
|
|
69
|
+
<Card {...args} className="w-[400px]" backgroundColor="subtle">
|
|
70
|
+
<CardHeader title="Card Title" subtitle="This is a card subtitle providing more context." />
|
|
71
|
+
<CardContent>
|
|
72
|
+
<Text>
|
|
73
|
+
This is the main content area of the card. You can put any components or text here.
|
|
74
|
+
</Text>
|
|
75
|
+
</CardContent>
|
|
76
|
+
<CardFooter>
|
|
77
|
+
<Button variant="outline" size="sm">
|
|
78
|
+
Cancel
|
|
79
|
+
</Button>
|
|
80
|
+
<Button variant="solid" size="sm" intent="info">
|
|
81
|
+
Confirm
|
|
82
|
+
</Button>
|
|
83
|
+
</CardFooter>
|
|
84
|
+
</Card>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
|
|
3
|
+
import styles from './Card.module.css';
|
|
4
|
+
import type {
|
|
5
|
+
CardProps,
|
|
6
|
+
CardHeaderProps,
|
|
7
|
+
CardContentProps,
|
|
8
|
+
CardFooterProps,
|
|
9
|
+
} from './Card.types.ts';
|
|
10
|
+
|
|
11
|
+
export const Card = ({
|
|
12
|
+
padding = 'md',
|
|
13
|
+
shadow = 'sm',
|
|
14
|
+
bordered = true,
|
|
15
|
+
borderColor,
|
|
16
|
+
backgroundColor,
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: CardProps) => {
|
|
21
|
+
const paddingClass = {
|
|
22
|
+
none: styles.pNone,
|
|
23
|
+
sm: styles.pSm,
|
|
24
|
+
md: styles.pMd,
|
|
25
|
+
lg: styles.pLg,
|
|
26
|
+
}[padding];
|
|
27
|
+
|
|
28
|
+
const shadowClass = {
|
|
29
|
+
none: styles.shadowNone,
|
|
30
|
+
sm: styles.shadowSm,
|
|
31
|
+
md: styles.shadowMd,
|
|
32
|
+
}[shadow];
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
className={clsx(
|
|
37
|
+
styles.root,
|
|
38
|
+
paddingClass,
|
|
39
|
+
shadowClass,
|
|
40
|
+
bordered && styles.bordered,
|
|
41
|
+
borderColor && styles[`borderColor-${borderColor}`],
|
|
42
|
+
backgroundColor && styles[`backgroundColor-${backgroundColor}`],
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const CardHeader = ({ title, subtitle, className, children, ...props }: CardHeaderProps) => (
|
|
53
|
+
<div className={clsx(styles.header, className)} {...props}>
|
|
54
|
+
{title && <h3 className={styles.title}>{title}</h3>}
|
|
55
|
+
{subtitle && <p className={styles.subtitle}>{subtitle}</p>}
|
|
56
|
+
{children}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const CardContent = ({ className, children, ...props }: CardContentProps) => (
|
|
61
|
+
<div className={clsx(styles.content, className)} {...props}>
|
|
62
|
+
{children}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export const CardFooter = ({ className, children, ...props }: CardFooterProps) => (
|
|
67
|
+
<div className={clsx(styles.footer, className)} {...props}>
|
|
68
|
+
{children}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { BoxBackgroundColor, BoxBorderColor } from '../Box/Box.types.ts';
|
|
4
|
+
|
|
5
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
7
|
+
shadow?: 'none' | 'sm' | 'md';
|
|
8
|
+
bordered?: boolean;
|
|
9
|
+
borderColor?: BoxBorderColor;
|
|
10
|
+
backgroundColor?: BoxBackgroundColor;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
subtitle?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type CardContentProps = HTMLAttributes<HTMLDivElement>;
|
|
19
|
+
|
|
20
|
+
export type CardFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--ds-space-1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.container {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
gap: var(--ds-space-2);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
user-select: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.container.disabled {
|
|
16
|
+
cursor: not-allowed;
|
|
17
|
+
opacity: 0.5;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.input {
|
|
21
|
+
position: absolute;
|
|
22
|
+
opacity: 0;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
height: 0;
|
|
25
|
+
width: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.control {
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
height: 1.125rem;
|
|
31
|
+
width: 1.125rem;
|
|
32
|
+
background-color: var(--ds-surface-0);
|
|
33
|
+
border: 0.125rem solid var(--ds-border-1);
|
|
34
|
+
border-radius: var(--ds-radius-sm);
|
|
35
|
+
transition: all var(--ds-transition-fast);
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
margin-top: 0.125rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.input:checked ~ .control {
|
|
43
|
+
background-color: var(--ds-info);
|
|
44
|
+
border-color: var(--ds-info);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input:focus-visible ~ .control {
|
|
48
|
+
box-shadow:
|
|
49
|
+
0 0 0 2px var(--ds-ring-offset),
|
|
50
|
+
0 0 0 4px var(--ds-ring);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.container:hover .input:not(:checked):not(:disabled) ~ .control {
|
|
54
|
+
border-color: var(--ds-neutral-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.checkmark {
|
|
58
|
+
color: var(--ds-text-on-brand);
|
|
59
|
+
width: 0.75rem;
|
|
60
|
+
height: 0.75rem;
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.input:checked ~ .control .checkmark {
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.label {
|
|
69
|
+
font-family: var(--ds-font-family-base);
|
|
70
|
+
font-size: var(--ds-font-size-sm);
|
|
71
|
+
color: var(--ds-text-1);
|
|
72
|
+
line-height: var(--ds-line-height-base);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.error .control {
|
|
76
|
+
border-color: var(--ds-danger);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.helperText {
|
|
80
|
+
font-family: var(--ds-font-family-base);
|
|
81
|
+
font-size: var(--ds-font-size-xs);
|
|
82
|
+
color: var(--ds-text-2);
|
|
83
|
+
margin-left: calc(1.125rem + var(--ds-space-2));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.errorText {
|
|
87
|
+
color: var(--ds-danger);
|
|
88
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from './Checkbox.tsx';
|
|
4
|
+
import { Box } from '../Box/Box.tsx';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Checkbox',
|
|
8
|
+
component: Checkbox,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Checkbox>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
label: 'I agree to the terms and conditions',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Checked: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
label: 'Remember me',
|
|
27
|
+
defaultChecked: true,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const WithHelperText: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
label: 'Notifications',
|
|
34
|
+
helperText: 'Receive email notifications about your account activity.',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Error: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
label: 'Required agreement',
|
|
41
|
+
error: true,
|
|
42
|
+
helperText: 'You must agree to continue.',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Disabled: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
label: 'Disabled option',
|
|
49
|
+
disabled: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const All: Story = {
|
|
54
|
+
name: 'Gallery',
|
|
55
|
+
render: () => (
|
|
56
|
+
<Box display="flex" flexDirection="column" gap={6}>
|
|
57
|
+
<Checkbox label="Default" />
|
|
58
|
+
<Checkbox label="Checked" defaultChecked />
|
|
59
|
+
<Checkbox label="With Helper Text" helperText="Additional information here" />
|
|
60
|
+
<Checkbox label="Error State" error helperText="This field is required" />
|
|
61
|
+
<Checkbox label="Disabled" disabled />
|
|
62
|
+
<Checkbox label="Disabled Checked" disabled defaultChecked />
|
|
63
|
+
</Box>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
|
|
4
|
+
import styles from './Checkbox.module.css';
|
|
5
|
+
import type { CheckboxProps } from './Checkbox.types.ts';
|
|
6
|
+
|
|
7
|
+
export const Checkbox = ({
|
|
8
|
+
label,
|
|
9
|
+
error,
|
|
10
|
+
helperText,
|
|
11
|
+
className,
|
|
12
|
+
disabled,
|
|
13
|
+
id,
|
|
14
|
+
...props
|
|
15
|
+
}: CheckboxProps) => {
|
|
16
|
+
const baseId = useId();
|
|
17
|
+
const componentId = id ?? `ds-checkbox-${baseId}`;
|
|
18
|
+
const helperId = helperText ? `${componentId}-help` : undefined;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={clsx(styles.wrapper, className)}>
|
|
22
|
+
<label
|
|
23
|
+
htmlFor={componentId}
|
|
24
|
+
className={clsx(styles.container, disabled && styles.disabled, error && styles.error)}
|
|
25
|
+
>
|
|
26
|
+
<input
|
|
27
|
+
type="checkbox"
|
|
28
|
+
id={componentId}
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
className={styles.input}
|
|
31
|
+
aria-describedby={helperId}
|
|
32
|
+
aria-invalid={error || undefined}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
<span className={styles.control}>
|
|
36
|
+
<svg
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
fill="none"
|
|
39
|
+
stroke="currentColor"
|
|
40
|
+
strokeWidth="4"
|
|
41
|
+
strokeLinecap="round"
|
|
42
|
+
strokeLinejoin="round"
|
|
43
|
+
className={styles.checkmark}
|
|
44
|
+
>
|
|
45
|
+
<polyline points="20 6 9 17 4 12" />
|
|
46
|
+
</svg>
|
|
47
|
+
</span>
|
|
48
|
+
{label && <span className={styles.label}>{label}</span>}
|
|
49
|
+
</label>
|
|
50
|
+
{helperText && (
|
|
51
|
+
<span id={helperId} className={clsx(styles.helperText, error && styles.errorText)}>
|
|
52
|
+
{helperText}
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
.wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--ds-space-1);
|
|
5
|
+
font-family: var(--ds-font-family-base);
|
|
6
|
+
width: fit-content;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.fullWidth {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.label {
|
|
14
|
+
font-size: var(--ds-font-size-sm);
|
|
15
|
+
font-weight: var(--ds-font-weight-medium);
|
|
16
|
+
color: var(--ds-text-1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.container {
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.trigger {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: var(--ds-space-2) var(--ds-space-3);
|
|
29
|
+
background-color: var(--ds-surface-0);
|
|
30
|
+
border: 1px solid var(--ds-border-1);
|
|
31
|
+
border-radius: var(--ds-radius-md);
|
|
32
|
+
font-size: var(--ds-font-size-base);
|
|
33
|
+
color: var(--ds-text-1);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
transition: all 0.2s ease;
|
|
36
|
+
text-align: left;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.trigger:focus-visible {
|
|
40
|
+
outline: none;
|
|
41
|
+
border-color: var(--ds-info);
|
|
42
|
+
box-shadow:
|
|
43
|
+
0 0 0 2px var(--ds-ring-offset),
|
|
44
|
+
0 0 0 4px var(--ds-ring);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.trigger:disabled {
|
|
48
|
+
background-color: var(--ds-surface-disabled);
|
|
49
|
+
color: var(--ds-text-disabled);
|
|
50
|
+
border-color: var(--ds-border-disabled);
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.error .trigger {
|
|
55
|
+
border-color: var(--ds-danger);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.sm .trigger {
|
|
59
|
+
padding: var(--ds-space-1) var(--ds-space-2);
|
|
60
|
+
font-size: var(--ds-font-size-xs);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.lg .trigger {
|
|
64
|
+
padding: var(--ds-space-3) var(--ds-space-4);
|
|
65
|
+
font-size: var(--ds-font-size-lg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.icon {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
transition: transform 0.2s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.isOpen .icon {
|
|
75
|
+
transform: rotate(180deg);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.menu {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 100%;
|
|
81
|
+
left: 0;
|
|
82
|
+
right: 0;
|
|
83
|
+
z-index: 10;
|
|
84
|
+
margin-top: var(--ds-space-1);
|
|
85
|
+
background-color: var(--ds-surface-0);
|
|
86
|
+
border: 1px solid var(--ds-border-1);
|
|
87
|
+
border-radius: var(--ds-radius-md);
|
|
88
|
+
box-shadow: var(--ds-shadow-lg);
|
|
89
|
+
max-height: 300px;
|
|
90
|
+
overflow-y: auto;
|
|
91
|
+
padding: var(--ds-space-1) 0;
|
|
92
|
+
list-style: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.option {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
padding: var(--ds-space-2) var(--ds-space-3);
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
transition: background-color 0.2s ease;
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.optionFocused {
|
|
105
|
+
background-color: var(--ds-neutral-subtle);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.optionSelected {
|
|
109
|
+
background-color: var(--ds-info-subtle);
|
|
110
|
+
color: var(--ds-info);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.optionSelected.optionFocused {
|
|
114
|
+
background-color: var(--ds-info-subtle);
|
|
115
|
+
box-shadow: inset 0 0 0 1px var(--ds-info);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.optionDisabled {
|
|
119
|
+
opacity: 0.5;
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.optionLabel {
|
|
125
|
+
font-weight: var(--ds-font-weight-medium);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.optionDescription {
|
|
129
|
+
font-size: var(--ds-font-size-xs);
|
|
130
|
+
color: var(--ds-text-2);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.helperText {
|
|
134
|
+
font-size: var(--ds-font-size-xs);
|
|
135
|
+
color: var(--ds-text-2);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.errorText {
|
|
139
|
+
color: var(--ds-danger);
|
|
140
|
+
}
|