@byline/ui 6.8.0 → 6.9.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 +43 -5
- package/package.json +11 -2
- package/src/components/accordion/accordion.stories.tsx +121 -0
- package/src/components/animation/fade-in-lift.stories.tsx +80 -0
- package/src/components/avatar/avatar.stories.tsx +39 -0
- package/src/components/badge/badge.stories.tsx +41 -0
- package/src/components/button/button-group.stories.tsx +44 -0
- package/src/components/button/button-intents.stories.tsx +97 -0
- package/src/components/button/button-overrides.stories.tsx +59 -0
- package/src/components/button/button-test.stories.tsx +59 -0
- package/src/components/button/button-variants.stories.tsx +57 -0
- package/src/components/button/combo-buttons.stories.tsx +82 -0
- package/src/components/button/control-buttons.stories.tsx +60 -0
- package/src/components/button/copy-button.stories.tsx +50 -0
- package/src/components/button/icon-button.stories.tsx +140 -0
- package/src/components/card/card.stories.tsx +60 -0
- package/src/components/chips/chip.stories.tsx +120 -0
- package/src/components/container/container.stories.tsx +35 -0
- package/src/components/dropdown/dropdown.stories.tsx +108 -0
- package/src/components/hamburger/hamburger.stories.tsx +33 -0
- package/src/components/inputs/autocomplete.stories.tsx +189 -0
- package/src/components/inputs/calendar.stories.tsx +141 -0
- package/src/components/inputs/checkbox-group.stories.tsx +43 -0
- package/src/components/inputs/checkbox.stories.tsx +284 -0
- package/src/components/inputs/input.stories.tsx +189 -0
- package/src/components/inputs/radio-group.stories.tsx +73 -0
- package/src/components/inputs/select.stories.tsx +70 -0
- package/src/components/inputs/text-area.stories.tsx +45 -0
- package/src/components/notifications/alert.stories.tsx +75 -0
- package/src/components/notifications/toast.stories.tsx +40 -0
- package/src/components/pager/pagination.stories.tsx +189 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
- package/src/components/shimmer/shimmer.stories.tsx +24 -0
- package/src/components/table/table.stories.tsx +94 -0
- package/src/components/tabs/tabs.stories.tsx +47 -0
- package/src/components/tooltip/tooltip.stories.tsx +56 -0
- package/src/icons/icons.stories.tsx +67 -0
- package/src/icons/index.stories.tsx +24 -0
- package/src/loaders/loaders.stories.tsx +188 -0
- package/src/styles/base/colors.stories.tsx +671 -0
- package/src/styles/theme/theme.stories.tsx +40 -0
- package/src/styles/typography/article.stories.tsx +39 -0
- package/src/styles/typography/code.stories.tsx +73 -0
- package/src/styles/typography/default.stories.tsx +49 -0
- package/src/styles/typography/lists.stories.tsx +48 -0
- package/src/styles/typography/quote.stories.tsx +38 -0
- package/src/widgets/datepicker/datepicker.stories.tsx +42 -0
- package/src/widgets/drawer/drawer.stories.tsx +281 -0
- package/src/widgets/modal/modal.stories.tsx +63 -0
- package/src/widgets/search/search.stories.tsx +18 -0
- package/src/widgets/timeline/timeline.stories.tsx +50 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import { capitalize } from '../../utils/capitalize.js'
|
|
6
|
+
import { size } from '../@types/shared.js'
|
|
7
|
+
import { variant } from './@types/button.js'
|
|
8
|
+
import { Button } from './button.js'
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof Button>
|
|
11
|
+
|
|
12
|
+
const AllVariants = (): React.JSX.Element => {
|
|
13
|
+
return (
|
|
14
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
15
|
+
{variant.map((variant: any) => {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
key={variant}
|
|
19
|
+
style={{
|
|
20
|
+
display: 'grid',
|
|
21
|
+
gridTemplateColumns: 'repeat(4, minmax(0, 1fr)',
|
|
22
|
+
gap: '32px',
|
|
23
|
+
marginBottom: '32px',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{size.map((size: any) => {
|
|
28
|
+
return (
|
|
29
|
+
<Button key={`${variant}=${size}`} size={size} variant={variant}>
|
|
30
|
+
{`${capitalize(variant)} ${size.toUpperCase()}`}
|
|
31
|
+
</Button>
|
|
32
|
+
)
|
|
33
|
+
})}
|
|
34
|
+
<Button key={`${variant}=${size}`} disabled variant={variant}>
|
|
35
|
+
{`${capitalize(variant)} Disabled`}
|
|
36
|
+
</Button>
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const ButtonVariants: Story = {
|
|
45
|
+
render: () => <AllVariants />,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const meta: Meta<typeof Button> = {
|
|
49
|
+
/* 👇 The title prop is optional.
|
|
50
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
51
|
+
* to learn how to generate automatic titles
|
|
52
|
+
*/
|
|
53
|
+
title: 'Components/Button',
|
|
54
|
+
component: Button,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default meta
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
import { ComboButton } from './combo-button.js'
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof ComboButton>
|
|
6
|
+
|
|
7
|
+
const options = [
|
|
8
|
+
{ label: 'Item 1', value: 'item1' },
|
|
9
|
+
{ label: 'Item 2', value: 'item2' },
|
|
10
|
+
{ label: 'Item 3', value: 'item3' },
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
const handleButtonClick = () => {
|
|
14
|
+
alert('Button clicked!')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const handleOptionSelect = (value: string) => {
|
|
18
|
+
alert(`Selected option: ${value}`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const ComboButtonDemo = (): React.JSX.Element => {
|
|
22
|
+
return (
|
|
23
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
24
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
25
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>Combo Button</h2>
|
|
26
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
27
|
+
<ComboButton
|
|
28
|
+
size="sm"
|
|
29
|
+
options={options}
|
|
30
|
+
onButtonClick={handleButtonClick}
|
|
31
|
+
onOptionSelect={handleOptionSelect}
|
|
32
|
+
>
|
|
33
|
+
Combo Button
|
|
34
|
+
</ComboButton>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
38
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>No Options Combo Button</h2>
|
|
39
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
40
|
+
<ComboButton
|
|
41
|
+
size="sm"
|
|
42
|
+
options={[]}
|
|
43
|
+
onButtonClick={handleButtonClick}
|
|
44
|
+
onOptionSelect={handleOptionSelect}
|
|
45
|
+
>
|
|
46
|
+
Combo Button
|
|
47
|
+
</ComboButton>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
52
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>Disabled Combo Button</h2>
|
|
53
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
54
|
+
<ComboButton
|
|
55
|
+
size="sm"
|
|
56
|
+
options={options}
|
|
57
|
+
onButtonClick={handleButtonClick}
|
|
58
|
+
onOptionSelect={handleOptionSelect}
|
|
59
|
+
disabled={true}
|
|
60
|
+
>
|
|
61
|
+
Combo Button
|
|
62
|
+
</ComboButton>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const ComboButtons: Story = {
|
|
70
|
+
render: () => <ComboButtonDemo />,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const meta: Meta<typeof ComboButton> = {
|
|
74
|
+
/* 👇 The title prop is optional.
|
|
75
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
76
|
+
* to learn how to generate automatic titles
|
|
77
|
+
*/
|
|
78
|
+
title: 'Components/Button',
|
|
79
|
+
component: ComboButtonDemo,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default meta
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
import { DirectionalButton, PlayButton, StopButton } from './control-buttons.js'
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof DirectionalButton>
|
|
6
|
+
|
|
7
|
+
const ControlsDemo = (): React.JSX.Element => {
|
|
8
|
+
return (
|
|
9
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
10
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
11
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>Small</h2>
|
|
12
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
13
|
+
<DirectionalButton direction="left" size="sm" />
|
|
14
|
+
<StopButton size="sm" />
|
|
15
|
+
<PlayButton size="sm" />
|
|
16
|
+
<DirectionalButton direction="right" size="sm" />
|
|
17
|
+
<DirectionalButton direction="up" size="sm" />
|
|
18
|
+
<DirectionalButton direction="down" size="sm" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
22
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>Medium</h2>
|
|
23
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
24
|
+
<DirectionalButton direction="left" size="md" />
|
|
25
|
+
<StopButton size="md" />
|
|
26
|
+
<PlayButton size="md" />
|
|
27
|
+
<DirectionalButton direction="right" size="md" />
|
|
28
|
+
<DirectionalButton direction="up" size="md" />
|
|
29
|
+
<DirectionalButton direction="down" size="md" />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div style={{ marginLeft: '3rem', marginBottom: '1.5rem' }}>
|
|
33
|
+
<h2 style={{ fontSize: '1.2rem', margin: '1rem 0' }}>Large</h2>
|
|
34
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>
|
|
35
|
+
<DirectionalButton direction="left" size="lg" />
|
|
36
|
+
<StopButton size="lg" />
|
|
37
|
+
<PlayButton size="lg" />
|
|
38
|
+
<DirectionalButton direction="right" size="lg" />
|
|
39
|
+
<DirectionalButton direction="up" size="lg" />
|
|
40
|
+
<DirectionalButton direction="down" size="lg" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ControlButtons: Story = {
|
|
48
|
+
render: () => <ControlsDemo />,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const meta: Meta<typeof DirectionalButton> = {
|
|
52
|
+
/* 👇 The title prop is optional.
|
|
53
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
54
|
+
* to learn how to generate automatic titles
|
|
55
|
+
*/
|
|
56
|
+
title: 'Components/Button',
|
|
57
|
+
component: ControlsDemo,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default meta
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import { intent } from '../@types/shared.js'
|
|
6
|
+
import { variant } from './@types/button.js'
|
|
7
|
+
import { CopyButton as CopyButtonComponent } from './copy-button.js'
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof CopyButtonComponent>
|
|
10
|
+
|
|
11
|
+
const CopyDemo = (): React.JSX.Element => {
|
|
12
|
+
return (
|
|
13
|
+
<div style={{ marginLeft: '12rem', marginTop: '4rem' }}>
|
|
14
|
+
{intent.map((i) => {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
key={i}
|
|
18
|
+
style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}
|
|
19
|
+
>
|
|
20
|
+
{variant.map((v) => {
|
|
21
|
+
return (
|
|
22
|
+
<CopyButtonComponent
|
|
23
|
+
text="I should be in your clipboard."
|
|
24
|
+
key={`${i}-${v}`}
|
|
25
|
+
intent={i}
|
|
26
|
+
variant={v}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
})}
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
})}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const CopyButtons: Story = {
|
|
38
|
+
render: () => <CopyDemo />,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const meta: Meta<typeof CopyButtonComponent> = {
|
|
42
|
+
/* 👇 The title prop is optional.
|
|
43
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
44
|
+
* to learn how to generate automatic titles
|
|
45
|
+
*/
|
|
46
|
+
title: 'Components/Button',
|
|
47
|
+
component: CopyButtonComponent,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default meta
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { Meta } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import { UserIcon } from '../../icons/user-icon.js'
|
|
6
|
+
import { size } from '../@types/shared.js'
|
|
7
|
+
import { variant } from './@types/button.js'
|
|
8
|
+
import { IconButton } from './icon-button.js'
|
|
9
|
+
|
|
10
|
+
const getUserIconSize = (size: string) => {
|
|
11
|
+
switch (size) {
|
|
12
|
+
case 'xs':
|
|
13
|
+
return { width: '16px', height: '16px' }
|
|
14
|
+
case 'sm':
|
|
15
|
+
return { width: '18px', height: '18px' }
|
|
16
|
+
case 'md':
|
|
17
|
+
return { width: '22px', height: '22px' }
|
|
18
|
+
case 'lg':
|
|
19
|
+
return { width: '26px', height: '26px' }
|
|
20
|
+
case 'xl':
|
|
21
|
+
return { width: '30px', height: '30px' }
|
|
22
|
+
default:
|
|
23
|
+
return { width: '28px', height: '28px' }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const IconButtonsRound = (): React.JSX.Element => {
|
|
28
|
+
return (
|
|
29
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
30
|
+
{variant.map((variant: any) => {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
key={variant}
|
|
34
|
+
style={{
|
|
35
|
+
display: 'grid',
|
|
36
|
+
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',
|
|
37
|
+
gap: '32px',
|
|
38
|
+
marginBottom: '32px',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{size.map((size: any) => {
|
|
44
|
+
const iconSize = getUserIconSize(size)
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
key={`${variant}=${size}`}
|
|
48
|
+
style={{
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<IconButton size={size} variant={variant}>
|
|
55
|
+
<UserIcon width={iconSize.width} height={iconSize.height} />
|
|
56
|
+
</IconButton>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
})}
|
|
60
|
+
<div
|
|
61
|
+
key={`${variant}=${size}`}
|
|
62
|
+
style={{
|
|
63
|
+
display: 'flex',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center',
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<IconButton disabled variant={variant}>
|
|
69
|
+
<UserIcon width="22px" height="22px" />
|
|
70
|
+
</IconButton>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
})}
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const IconButtonsSquare = (): React.JSX.Element => {
|
|
80
|
+
return (
|
|
81
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
82
|
+
{variant.map((variant: any) => {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
key={variant}
|
|
86
|
+
style={{
|
|
87
|
+
display: 'grid',
|
|
88
|
+
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',
|
|
89
|
+
gap: '32px',
|
|
90
|
+
marginBottom: '32px',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{size.map((size: any) => {
|
|
96
|
+
const iconSize = getUserIconSize(size)
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
key={`${variant}=${size}`}
|
|
100
|
+
style={{
|
|
101
|
+
display: 'flex',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<IconButton size={size} square={true} variant={variant}>
|
|
107
|
+
<UserIcon width={iconSize.width} height={iconSize.height} />
|
|
108
|
+
</IconButton>
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
})}
|
|
112
|
+
<div
|
|
113
|
+
key={`${variant}=${size}`}
|
|
114
|
+
style={{
|
|
115
|
+
display: 'flex',
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
justifyContent: 'center',
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<IconButton disabled square={true} variant={variant}>
|
|
121
|
+
<UserIcon width="22px" height="22px" />
|
|
122
|
+
</IconButton>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
)
|
|
126
|
+
})}
|
|
127
|
+
</div>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const meta: Meta<typeof IconButton> = {
|
|
132
|
+
/* 👇 The title prop is optional.
|
|
133
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
134
|
+
* to learn how to generate automatic titles
|
|
135
|
+
*/
|
|
136
|
+
title: 'Components/Button',
|
|
137
|
+
component: IconButton,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default meta
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
import { Button } from '../button/button.js'
|
|
4
|
+
import { Card as CardComponent } from './card.js'
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
/* 👇 The title prop is optional.
|
|
8
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
9
|
+
* to learn how to generate automatic titles
|
|
10
|
+
*/
|
|
11
|
+
title: 'Components',
|
|
12
|
+
component: CardComponent,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
|
|
17
|
+
export const Card = (): React.JSX.Element => {
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
20
|
+
<div style={{ marginBottom: '48px' }}>
|
|
21
|
+
<div style={{ maxWidth: '400px', marginBottom: '24px' }}>
|
|
22
|
+
<CardComponent>
|
|
23
|
+
<CardComponent.Header>
|
|
24
|
+
<CardComponent.Title>
|
|
25
|
+
<h2>Normal Card</h2>
|
|
26
|
+
</CardComponent.Title>
|
|
27
|
+
<CardComponent.Description>
|
|
28
|
+
<p>Card description here.</p>
|
|
29
|
+
</CardComponent.Description>
|
|
30
|
+
</CardComponent.Header>
|
|
31
|
+
<CardComponent.Content>
|
|
32
|
+
<p>Card body with some text here.</p>
|
|
33
|
+
</CardComponent.Content>
|
|
34
|
+
<CardComponent.Footer>
|
|
35
|
+
<Button size="sm">A Button</Button>
|
|
36
|
+
</CardComponent.Footer>
|
|
37
|
+
</CardComponent>
|
|
38
|
+
</div>
|
|
39
|
+
<div style={{ maxWidth: '400px', marginBottom: '24px' }}>
|
|
40
|
+
<CardComponent hover={true}>
|
|
41
|
+
<CardComponent.Header>
|
|
42
|
+
<CardComponent.Title>
|
|
43
|
+
<h2>Card Hover</h2>
|
|
44
|
+
</CardComponent.Title>
|
|
45
|
+
<CardComponent.Description>
|
|
46
|
+
<p>Card description here.</p>
|
|
47
|
+
</CardComponent.Description>
|
|
48
|
+
</CardComponent.Header>
|
|
49
|
+
<CardComponent.Content>
|
|
50
|
+
<p>Card body with some text here.</p>
|
|
51
|
+
</CardComponent.Content>
|
|
52
|
+
<CardComponent.Footer>
|
|
53
|
+
<Button size="sm">A Button</Button>
|
|
54
|
+
</CardComponent.Footer>
|
|
55
|
+
</CardComponent>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import { CalendarIcon } from '../../icons/calendar-icon.js'
|
|
6
|
+
import { capitalize } from '../../utils/capitalize.js'
|
|
7
|
+
import { intent, size } from '../@types/shared.js'
|
|
8
|
+
import { chipVariant } from './@types/chip.js'
|
|
9
|
+
import { Chip } from './chip.js'
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof Chip>
|
|
12
|
+
|
|
13
|
+
const Row = ({ children }: { children: React.ReactNode }) => (
|
|
14
|
+
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export const Intents: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
22
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
23
|
+
{intent.map((i) => (
|
|
24
|
+
<Row key={i}>
|
|
25
|
+
<Chip intent={i}>{capitalize(i)} chip</Chip>
|
|
26
|
+
<Chip intent={i} variant="selectable" selected>
|
|
27
|
+
{capitalize(i)} selectable
|
|
28
|
+
</Chip>
|
|
29
|
+
</Row>
|
|
30
|
+
))}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Sizes: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
39
|
+
<Row>
|
|
40
|
+
{size.map((s) => (
|
|
41
|
+
<Chip
|
|
42
|
+
variant={'selectable-removable'}
|
|
43
|
+
selected={true}
|
|
44
|
+
key={s}
|
|
45
|
+
size={s}
|
|
46
|
+
>{`Size ${s}`}</Chip>
|
|
47
|
+
))}
|
|
48
|
+
</Row>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Variants: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
56
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
57
|
+
{chipVariant.map((variant) => (
|
|
58
|
+
<Row key={variant}>
|
|
59
|
+
<Chip variant={variant}>{capitalize(variant)} chip</Chip>
|
|
60
|
+
<Chip
|
|
61
|
+
variant={variant}
|
|
62
|
+
startIcon={<CalendarIcon height="16px" width="16px" />}
|
|
63
|
+
selected={true}
|
|
64
|
+
>{`${capitalize(variant)} with icon`}</Chip>
|
|
65
|
+
{(variant === 'removable' || variant === 'selectable-removable') && (
|
|
66
|
+
<Chip variant={variant} onRemove={() => {}}>
|
|
67
|
+
{`${capitalize(variant)} with remove`}
|
|
68
|
+
</Chip>
|
|
69
|
+
)}
|
|
70
|
+
</Row>
|
|
71
|
+
))}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Selectable: Story = {
|
|
78
|
+
render: () => {
|
|
79
|
+
const [selected, setSelected] = useState(false)
|
|
80
|
+
return (
|
|
81
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
82
|
+
<Row>
|
|
83
|
+
<Chip
|
|
84
|
+
variant="selectable"
|
|
85
|
+
intent="primary"
|
|
86
|
+
size="sm"
|
|
87
|
+
selected={selected}
|
|
88
|
+
onToggle={(next: boolean) => setSelected(next)}
|
|
89
|
+
>
|
|
90
|
+
Toggle me
|
|
91
|
+
</Chip>
|
|
92
|
+
</Row>
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const Removable: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto' }}>
|
|
101
|
+
<Row>
|
|
102
|
+
<Chip
|
|
103
|
+
variant="removable"
|
|
104
|
+
intent="primary"
|
|
105
|
+
onRemove={() => {}}
|
|
106
|
+
startIcon={<CalendarIcon height="16px" width="16px" />}
|
|
107
|
+
>
|
|
108
|
+
Removable chip
|
|
109
|
+
</Chip>
|
|
110
|
+
</Row>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const meta: Meta<typeof Chip> = {
|
|
116
|
+
title: 'Components/Chip',
|
|
117
|
+
component: Chip,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default meta
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { Meta } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import { Section } from '../section/section.js'
|
|
6
|
+
import { Container as ContainerComponent } from './container.js'
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof ContainerComponent> = {
|
|
9
|
+
/* 👇 The title prop is optional.
|
|
10
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
11
|
+
* to learn how to generate automatic titles
|
|
12
|
+
*/
|
|
13
|
+
title: 'Components/Container',
|
|
14
|
+
component: ContainerComponent,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
|
|
19
|
+
export const Container = (): React.JSX.Element => {
|
|
20
|
+
return (
|
|
21
|
+
<Section style={{ height: '100vh', margin: '2rem auto' }}>
|
|
22
|
+
<ContainerComponent
|
|
23
|
+
className="primary-strong"
|
|
24
|
+
style={{
|
|
25
|
+
height: '400px',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<p>I'm in a container with shy edges.</p>
|
|
32
|
+
</ContainerComponent>
|
|
33
|
+
</Section>
|
|
34
|
+
)
|
|
35
|
+
}
|