@liguelead/design-system 0.0.28 → 0.0.29
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/components/Alert/Alert.stories.tsx +60 -0
- package/components/Button/Button.appearance.ts +2 -2
- package/components/Button/Button.stories.tsx +75 -0
- package/components/Checkbox/Checkbox.stories.tsx +42 -0
- package/components/Combobox/Combobox.stories.tsx +112 -0
- package/components/Combobox/Combobox.styles.ts +7 -3
- package/components/Combobox/Combobox.tsx +3 -10
- package/components/DatePicker/DatePicker.stories.tsx +43 -0
- package/components/Dialog/Dialog.stories.tsx +63 -0
- package/components/IconButton/IconButton.stories.tsx +49 -0
- package/components/InputOpt/InputOpt.stories.tsx +61 -0
- package/components/LinkButton/LinkButton.stories.tsx +86 -0
- package/components/PageWrapper/PageWrapper.stories.tsx +153 -0
- package/components/RadioButton/RadioButton.stories.tsx +70 -0
- package/components/RequiredAsterisk/RequiredAsterisk.stories.tsx +44 -0
- package/components/SegmentedButton/SegmentedButton.stories.tsx +182 -0
- package/components/Select/Select.stories.tsx +63 -0
- package/components/Text/Text.stories.tsx +61 -0
- package/components/Text/Text.types.ts +1 -0
- package/components/TextField/TextField.stories.tsx +84 -0
- package/components/Toaster/Toaster.stories.tsx +129 -0
- package/components/Toaster/Toaster.ts +19 -0
- package/components/Toaster/ToasterProvider.tsx +9 -1
- package/components/Wizard/Wizard.stories.tsx +186 -0
- package/package.json +15 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import Alert from './Alert'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Alert> = {
|
|
5
|
+
title: 'Feedback/Alert',
|
|
6
|
+
component: Alert,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['default', 'danger', 'warning', 'info', 'success'],
|
|
15
|
+
description: 'Visual style variant of the alert'
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Alert title'
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Alert description'
|
|
24
|
+
},
|
|
25
|
+
hasButton: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Whether to show action button'
|
|
28
|
+
},
|
|
29
|
+
buttonLabel: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Action button label'
|
|
32
|
+
},
|
|
33
|
+
href: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Action button link'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default meta
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
|
|
43
|
+
export const Variants: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
46
|
+
<Alert variant="default" title="Default Alert" description="This is a default alert message." />
|
|
47
|
+
<Alert variant="info" title="Info Alert" description="This is an informational alert message." />
|
|
48
|
+
<Alert variant="success" title="Success Alert" description="This is a success alert message." />
|
|
49
|
+
<Alert variant="warning" title="Warning Alert" description="This is a warning alert message." />
|
|
50
|
+
<Alert variant="danger" title="Danger Alert" description="This is a danger alert message." />
|
|
51
|
+
</div>
|
|
52
|
+
),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
title: 'Alert Title',
|
|
58
|
+
description: 'This is an alert description.',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
@@ -47,7 +47,7 @@ export const ButtonVariant = (
|
|
|
47
47
|
color: ${parsedColor};
|
|
48
48
|
border: 1px solid ${parsedColor};
|
|
49
49
|
&:hover {
|
|
50
|
-
background-color: ${
|
|
50
|
+
background-color: ${parsedColor};
|
|
51
51
|
border-color: transparent;
|
|
52
52
|
color: ${parseColor(theme.colors.white)};
|
|
53
53
|
}
|
|
@@ -63,7 +63,7 @@ export const ButtonVariant = (
|
|
|
63
63
|
color: ${parsedColor};
|
|
64
64
|
border: 1px solid transparent;
|
|
65
65
|
&:hover {
|
|
66
|
-
background-color: ${
|
|
66
|
+
background-color: ${parsedColor};
|
|
67
67
|
color: ${parseColor(theme.colors.white)};
|
|
68
68
|
}
|
|
69
69
|
&:disabled {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { themes } from '@liguelead/foundation'
|
|
3
|
+
import Button from './Button'
|
|
4
|
+
import type { ButtonVariantTypes } from './Button.types'
|
|
5
|
+
|
|
6
|
+
const themeColors = Object.keys(themes.spa.colors)
|
|
7
|
+
const buttonVariantOptions: ButtonVariantTypes[] = [
|
|
8
|
+
'solid',
|
|
9
|
+
'outline',
|
|
10
|
+
'ghost',
|
|
11
|
+
'neutralOutline',
|
|
12
|
+
'neutralGhost'
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Button> = {
|
|
16
|
+
title: 'Form/Button',
|
|
17
|
+
component: Button,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'centered',
|
|
20
|
+
},
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
argTypes: {
|
|
23
|
+
variant: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: buttonVariantOptions,
|
|
26
|
+
description: 'Visual style variant of the button',
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: ['sm', 'md', 'lg'],
|
|
31
|
+
description: 'Size of the button',
|
|
32
|
+
},
|
|
33
|
+
color: {
|
|
34
|
+
control: 'select',
|
|
35
|
+
options: themeColors,
|
|
36
|
+
description: 'Color theme of the button',
|
|
37
|
+
},
|
|
38
|
+
disabled: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether the button is disabled',
|
|
41
|
+
},
|
|
42
|
+
fullWidth: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description: 'Whether the button takes full width',
|
|
45
|
+
},
|
|
46
|
+
children: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'Button content',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default meta
|
|
54
|
+
type Story = StoryObj<typeof meta>
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
children: 'Button',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Variants: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
children: 'Button',
|
|
65
|
+
},
|
|
66
|
+
render: (args) => (
|
|
67
|
+
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
|
68
|
+
<Button {...args} variant="solid">Solid</Button>
|
|
69
|
+
<Button {...args} variant="outline">Outline</Button>
|
|
70
|
+
<Button {...args} variant="ghost">Ghost</Button>
|
|
71
|
+
<Button {...args} variant="neutralOutline">Neutral Outline</Button>
|
|
72
|
+
<Button {...args} variant="neutralGhost">Neutral Ghost</Button>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import Checkbox from './Checkbox'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Checkbox> = {
|
|
5
|
+
title: 'Form/Checkbox',
|
|
6
|
+
component: Checkbox,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
label: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Checkbox label'
|
|
15
|
+
},
|
|
16
|
+
description: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Checkbox description'
|
|
19
|
+
},
|
|
20
|
+
checked: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Whether checkbox is checked'
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
control: 'boolean',
|
|
26
|
+
description: 'Whether checkbox is disabled'
|
|
27
|
+
},
|
|
28
|
+
$hasError: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether checkbox has error state'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default meta
|
|
36
|
+
type Story = StoryObj<typeof meta>
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
label: 'Checkbox Label',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import Combobox from './Combobox'
|
|
4
|
+
import { iconMap, iconOptions } from '../../../stories/utils/icons'
|
|
5
|
+
|
|
6
|
+
const mockItems = [
|
|
7
|
+
{ value: 'option1', label: 'Option 1' },
|
|
8
|
+
{ value: 'option2', label: 'Option 2' },
|
|
9
|
+
{ value: 'option3', label: 'Option 3' },
|
|
10
|
+
{ value: 'option4', label: 'Option 4', disabled: true },
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'Form/Combobox',
|
|
15
|
+
component: Combobox,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: 'centered',
|
|
18
|
+
},
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
argTypes: {
|
|
21
|
+
variant: {
|
|
22
|
+
control: 'select',
|
|
23
|
+
options: ['single', 'multi'],
|
|
24
|
+
description: 'Combobox variant',
|
|
25
|
+
},
|
|
26
|
+
label: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Combobox label',
|
|
29
|
+
},
|
|
30
|
+
placeholder: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'Placeholder text',
|
|
33
|
+
},
|
|
34
|
+
searchPlaceholder: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Search placeholder text',
|
|
37
|
+
},
|
|
38
|
+
emptyText: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Text shown when no options available',
|
|
41
|
+
},
|
|
42
|
+
helperText: {
|
|
43
|
+
control: 'text',
|
|
44
|
+
description: 'Helper text below the combobox',
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
control: 'boolean',
|
|
48
|
+
description: 'Whether the combobox is disabled',
|
|
49
|
+
},
|
|
50
|
+
requiredSymbol: {
|
|
51
|
+
control: 'boolean',
|
|
52
|
+
description: 'Show required symbol',
|
|
53
|
+
},
|
|
54
|
+
size: {
|
|
55
|
+
control: 'select',
|
|
56
|
+
options: ['sm', 'md', 'lg'],
|
|
57
|
+
description: 'Size of the combobox',
|
|
58
|
+
},
|
|
59
|
+
width: {
|
|
60
|
+
control: 'number',
|
|
61
|
+
description: 'Width of the combobox',
|
|
62
|
+
},
|
|
63
|
+
createLabel: {
|
|
64
|
+
control: 'text',
|
|
65
|
+
description: 'Label for create option',
|
|
66
|
+
},
|
|
67
|
+
leftIcon: {
|
|
68
|
+
control: 'select',
|
|
69
|
+
options: iconOptions,
|
|
70
|
+
description: 'Left icon',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
} satisfies Meta<typeof Combobox>
|
|
74
|
+
|
|
75
|
+
export default meta
|
|
76
|
+
type Story = StoryObj<typeof meta>
|
|
77
|
+
|
|
78
|
+
export const Default: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
label: 'Select an option',
|
|
81
|
+
placeholder: 'Choose...',
|
|
82
|
+
items: mockItems,
|
|
83
|
+
leftIcon: 'none',
|
|
84
|
+
},
|
|
85
|
+
render: (args) => {
|
|
86
|
+
const [value, setValue] = useState<string>('')
|
|
87
|
+
const [values, setValues] = useState<string[]>([])
|
|
88
|
+
|
|
89
|
+
const selectedIcon = args.leftIcon === 'none' ? undefined : iconMap[args.leftIcon as keyof typeof iconMap]
|
|
90
|
+
|
|
91
|
+
if (args.variant === 'multi') {
|
|
92
|
+
return (
|
|
93
|
+
<Combobox
|
|
94
|
+
{...args}
|
|
95
|
+
variant="multi"
|
|
96
|
+
leftIcon={selectedIcon}
|
|
97
|
+
values={values}
|
|
98
|
+
onChange={setValues}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Combobox
|
|
105
|
+
{...args}
|
|
106
|
+
leftIcon={selectedIcon}
|
|
107
|
+
value={value}
|
|
108
|
+
onChange={setValue}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
}
|
|
@@ -14,7 +14,7 @@ import { TextFieldSizeType } from '../TextField/TextField.sizes'
|
|
|
14
14
|
import { StateInterface } from '../TextField/TextField.states'
|
|
15
15
|
import Text from '../Text'
|
|
16
16
|
|
|
17
|
-
type TStyledInputProps =
|
|
17
|
+
type TStyledInputProps = {
|
|
18
18
|
size: TextFieldSizeType
|
|
19
19
|
$themefication: StateInterface
|
|
20
20
|
}
|
|
@@ -185,14 +185,18 @@ export const ItemRow = styled(Command.Item)`
|
|
|
185
185
|
color: ${({ theme }) => parseColor(theme.colors.white)};
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
&:hover:not([data-disabled='true'])
|
|
188
|
+
&:hover:not([data-disabled='true']) {
|
|
189
189
|
background: ${({ theme }) => parseColor(theme.colors.primaryLight)};
|
|
190
190
|
}
|
|
191
|
+
|
|
192
|
+
&[data-variant='single'][data-is-selected='true']:hover {
|
|
193
|
+
background: ${({ theme }) => parseColor(theme.colors.primary)};
|
|
194
|
+
}
|
|
191
195
|
`
|
|
192
196
|
|
|
193
197
|
export const ItemLabel = styled(Text)`
|
|
194
198
|
padding-left: 4px;
|
|
195
|
-
|
|
199
|
+
`
|
|
196
200
|
|
|
197
201
|
|
|
198
202
|
export const RightIcon = styled.span`
|
|
@@ -16,7 +16,7 @@ import { TextFieldStates } from '../TextField/TextField.states'
|
|
|
16
16
|
import { textFieldSizes } from '../TextField/TextField.sizes'
|
|
17
17
|
|
|
18
18
|
import * as Popover from '@radix-ui/react-popover'
|
|
19
|
-
import * as s
|
|
19
|
+
import * as s from './Combobox.styles'
|
|
20
20
|
import { isMultiProps, normalizeData } from './utils'
|
|
21
21
|
|
|
22
22
|
const Combobox = (props: ComboboxProps) => {
|
|
@@ -29,7 +29,6 @@ const Combobox = (props: ComboboxProps) => {
|
|
|
29
29
|
leftIcon,
|
|
30
30
|
items,
|
|
31
31
|
groups,
|
|
32
|
-
onChange,
|
|
33
32
|
placeholder = 'Selecionar',
|
|
34
33
|
searchPlaceholder = 'Pesquisar',
|
|
35
34
|
emptyText = 'Sem resultados.',
|
|
@@ -69,7 +68,7 @@ const Combobox = (props: ComboboxProps) => {
|
|
|
69
68
|
const next = selectedValues.includes(value)
|
|
70
69
|
? selectedValues.filter(x => x !== value)
|
|
71
70
|
: [...selectedValues, value]
|
|
72
|
-
|
|
71
|
+
props.onChange?.(next)
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
return (
|
|
@@ -169,13 +168,7 @@ const Combobox = (props: ComboboxProps) => {
|
|
|
169
168
|
toggle(item.value)
|
|
170
169
|
return
|
|
171
170
|
}
|
|
172
|
-
|
|
173
|
-
onChange as
|
|
174
|
-
| ((
|
|
175
|
-
value: string
|
|
176
|
-
) => void)
|
|
177
|
-
| undefined
|
|
178
|
-
)?.(item.value)
|
|
171
|
+
props.onChange?.(item.value)
|
|
179
172
|
setOpen(false)
|
|
180
173
|
}}
|
|
181
174
|
data-selected={
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import DatePicker from './DatePicker'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof DatePicker> = {
|
|
5
|
+
title: 'Form/DatePicker',
|
|
6
|
+
component: DatePicker,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
label: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'DatePicker label'
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['sm', 'md', 'lg'],
|
|
19
|
+
description: 'DatePicker size'
|
|
20
|
+
},
|
|
21
|
+
startYear: {
|
|
22
|
+
control: 'number',
|
|
23
|
+
description: 'Start year for year selection'
|
|
24
|
+
},
|
|
25
|
+
endYear: {
|
|
26
|
+
control: 'number',
|
|
27
|
+
description: 'End year for year selection'
|
|
28
|
+
},
|
|
29
|
+
icon: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Show calendar icon'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default meta
|
|
37
|
+
type Story = StoryObj<typeof meta>
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
label: 'Select Date',
|
|
42
|
+
},
|
|
43
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import Dialog from './Dialog'
|
|
3
|
+
import Button from '../Button/Button'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Dialog> = {
|
|
6
|
+
title: 'Feedback/Dialog',
|
|
7
|
+
component: Dialog,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered'
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
title: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'Dialog title'
|
|
16
|
+
},
|
|
17
|
+
description: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Dialog description'
|
|
20
|
+
},
|
|
21
|
+
variant: {
|
|
22
|
+
control: 'select',
|
|
23
|
+
options: ['default', 'danger'],
|
|
24
|
+
description: 'Dialog variant'
|
|
25
|
+
},
|
|
26
|
+
confirmButton: {
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
description: 'Show confirm button'
|
|
29
|
+
},
|
|
30
|
+
cancelButton: {
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
description: 'Show cancel button'
|
|
33
|
+
},
|
|
34
|
+
confirmLabel: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Confirm button label'
|
|
37
|
+
},
|
|
38
|
+
cancelLabel: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Cancel button label'
|
|
41
|
+
},
|
|
42
|
+
confirmButtonColor: {
|
|
43
|
+
control: 'select',
|
|
44
|
+
options: ['primary', 'secondary'],
|
|
45
|
+
description: 'Confirm button color'
|
|
46
|
+
},
|
|
47
|
+
centerContent: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Center dialog content'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default meta
|
|
55
|
+
type Story = StoryObj<typeof meta>
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
title: 'Dialog Title',
|
|
60
|
+
description: 'This is a dialog description.',
|
|
61
|
+
trigger: <Button>Open Dialog</Button>
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import IconButton from './IconButton'
|
|
3
|
+
import { themes } from '@liguelead/foundation'
|
|
4
|
+
import { iconMap } from '../../../stories/utils/icons'
|
|
5
|
+
|
|
6
|
+
const themeColors = Object.keys(themes.spa.colors)
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Form/IconButton',
|
|
10
|
+
component: IconButton,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
variant: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['solid', 'outline', 'ghost', 'neutralOutline', 'neutralGhost'],
|
|
19
|
+
description: 'Visual style variant of the icon button'
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
control: 'select',
|
|
23
|
+
options: ['sm', 'md', 'lg'],
|
|
24
|
+
description: 'Size of the icon button'
|
|
25
|
+
},
|
|
26
|
+
color: {
|
|
27
|
+
control: 'select',
|
|
28
|
+
options: themeColors,
|
|
29
|
+
description: 'Color theme of the icon button'
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Whether the icon button is disabled'
|
|
34
|
+
},
|
|
35
|
+
children: {
|
|
36
|
+
control: false,
|
|
37
|
+
description: 'Icon content'
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
} satisfies Meta<typeof IconButton>
|
|
41
|
+
|
|
42
|
+
export default meta
|
|
43
|
+
type Story = StoryObj<typeof meta>
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
children: iconMap.HeartIcon,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import InputOpt from './InputOpt'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof InputOpt> = {
|
|
5
|
+
title: 'Form/InputOpt',
|
|
6
|
+
component: InputOpt,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
length: {
|
|
13
|
+
control: 'number',
|
|
14
|
+
description: 'Number of input fields'
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Input label'
|
|
19
|
+
},
|
|
20
|
+
helperText: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Helper text below input'
|
|
23
|
+
},
|
|
24
|
+
placeholderChar: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Placeholder character for empty fields'
|
|
27
|
+
},
|
|
28
|
+
inputMode: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: ['numeric', 'text'],
|
|
31
|
+
description: 'Input mode for mobile keyboards'
|
|
32
|
+
},
|
|
33
|
+
autoFocus: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Auto focus first input on mount'
|
|
36
|
+
},
|
|
37
|
+
disabled: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether inputs are disabled'
|
|
40
|
+
},
|
|
41
|
+
requiredSymbol: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Show required asterisk'
|
|
44
|
+
},
|
|
45
|
+
error: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Whether inputs have error state'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default meta
|
|
53
|
+
type Story = StoryObj<typeof meta>
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
label: 'Verification Code',
|
|
58
|
+
length: 6,
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import LinkButton from './LinkButton'
|
|
3
|
+
import { themes } from '@liguelead/foundation'
|
|
4
|
+
import { iconMap, iconOptions } from '../../../stories/utils/icons'
|
|
5
|
+
|
|
6
|
+
const themeColors = Object.keys(themes.spa.colors)
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof LinkButton> = {
|
|
9
|
+
title: 'Navigation/LinkButton',
|
|
10
|
+
component: LinkButton,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
href: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Link URL'
|
|
19
|
+
},
|
|
20
|
+
children: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Link content'
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['sm', 'md', 'lg'],
|
|
27
|
+
description: 'Size of the link button'
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
control: 'select',
|
|
31
|
+
options: themeColors,
|
|
32
|
+
description: 'Color theme of the link button'
|
|
33
|
+
},
|
|
34
|
+
disabled: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
description: 'Whether the link button is disabled'
|
|
37
|
+
},
|
|
38
|
+
fullWidth: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether the link button takes full width'
|
|
41
|
+
},
|
|
42
|
+
leftIcon: {
|
|
43
|
+
control: 'select',
|
|
44
|
+
options: iconOptions,
|
|
45
|
+
description: 'Left icon',
|
|
46
|
+
},
|
|
47
|
+
rightIcon: {
|
|
48
|
+
control: 'select',
|
|
49
|
+
options: iconOptions,
|
|
50
|
+
description: 'Right icon',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default meta
|
|
56
|
+
type Story = StoryObj<typeof meta>
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
href: '#',
|
|
60
|
+
children: 'Link Button',
|
|
61
|
+
size: 'md',
|
|
62
|
+
color: themeColors[0],
|
|
63
|
+
disabled: false,
|
|
64
|
+
fullWidth: false,
|
|
65
|
+
leftIcon: 'none',
|
|
66
|
+
rightIcon: 'none',
|
|
67
|
+
},
|
|
68
|
+
render: (args) => {
|
|
69
|
+
const leftIcon = args.leftIcon === 'none' ? undefined : iconMap[args.leftIcon as keyof typeof iconMap]
|
|
70
|
+
const rightIcon = args.rightIcon === 'none' ? undefined : iconMap[args.rightIcon as keyof typeof iconMap]
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<LinkButton
|
|
74
|
+
href={args.href}
|
|
75
|
+
leftIcon={leftIcon}
|
|
76
|
+
rightIcon={rightIcon}
|
|
77
|
+
size={args.size}
|
|
78
|
+
color={args.color}
|
|
79
|
+
disabled={args.disabled}
|
|
80
|
+
fullWidth={args.fullWidth}
|
|
81
|
+
>
|
|
82
|
+
{args.children}
|
|
83
|
+
</LinkButton>
|
|
84
|
+
)
|
|
85
|
+
},
|
|
86
|
+
}
|