@liguelead/design-system 0.0.28 → 0.0.30

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.
Files changed (37) hide show
  1. package/components/Alert/Alert.stories.tsx +60 -0
  2. package/components/Button/Button.appearance.ts +2 -2
  3. package/components/Button/Button.stories.tsx +75 -0
  4. package/components/Checkbox/Checkbox.stories.tsx +42 -0
  5. package/components/Combobox/Combobox.stories.tsx +112 -0
  6. package/components/Combobox/Combobox.styles.ts +7 -3
  7. package/components/Combobox/Combobox.tsx +3 -10
  8. package/components/DatePicker/DatePicker.stories.tsx +108 -0
  9. package/components/DatePicker/DatePicker.styles.ts +394 -50
  10. package/components/DatePicker/DatePicker.tsx +353 -118
  11. package/components/DatePicker/DatePicker.types.ts +40 -24
  12. package/components/Dialog/Dialog.stories.tsx +63 -0
  13. package/components/IconButton/IconButton.stories.tsx +49 -0
  14. package/components/InputOpt/InputOpt.stories.tsx +61 -0
  15. package/components/LinkButton/LinkButton.stories.tsx +88 -0
  16. package/components/PageWrapper/PageWrapper.stories.tsx +153 -0
  17. package/components/RadioButton/RadioButton.stories.tsx +70 -0
  18. package/components/RequiredAsterisk/RequiredAsterisk.stories.tsx +44 -0
  19. package/components/SegmentedButton/SegmentedButton.stories.tsx +182 -0
  20. package/components/Select/Select.stories.tsx +63 -0
  21. package/components/Table/Table.stories.tsx +53 -0
  22. package/components/Table/Table.styles.ts +76 -0
  23. package/components/Table/Table.tsx +157 -0
  24. package/components/Table/Table.types.ts +16 -0
  25. package/components/Table/index.ts +1 -0
  26. package/components/Table/utils/getPageNumbers.ts +35 -0
  27. package/components/Table/utils/index.ts +1 -0
  28. package/components/Table/utils/types.ts +4 -0
  29. package/components/Text/Text.stories.tsx +61 -0
  30. package/components/Text/Text.types.ts +1 -0
  31. package/components/TextField/TextField.stories.tsx +84 -0
  32. package/components/Toaster/Toaster.stories.tsx +129 -0
  33. package/components/Toaster/Toaster.ts +19 -0
  34. package/components/Toaster/ToasterProvider.tsx +9 -1
  35. package/components/Wizard/Wizard.stories.tsx +186 -0
  36. package/components/index.ts +1 -0
  37. package/package.json +16 -3
@@ -0,0 +1,60 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
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: ${parseColor(theme.colors.primaryDarker)};
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: ${parseColor(theme.colors.primaryDarker)};
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-vite'
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-vite'
2
+ import Checkbox from './Checkbox'
3
+
4
+ const meta: Meta<typeof Checkbox> = {
5
+ title: 'Form/Checkbox',
6
+ component: Checkbox,
7
+ parameters: {
8
+ layout: 'centered',
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-vite'
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']):not([data-is-selected='true']:not([data-variant='multi'])) {
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 from './Combobox.styles'
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
- ;(onChange as ((values: string[]) => void) | undefined)?.(next)
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,108 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import type { DateRange } from 'react-day-picker'
3
+ import { useState } from 'react'
4
+ import DatePicker from './DatePicker'
5
+
6
+ const meta = {
7
+ title: 'Form/DatePicker',
8
+ component: DatePicker,
9
+ parameters: {
10
+ layout: 'centered'
11
+ },
12
+ tags: ['autodocs'],
13
+ argTypes: {
14
+ size: {
15
+ control: 'select',
16
+ options: ['sm', 'md', 'lg'],
17
+ description: 'Size of the DatePicker'
18
+ },
19
+ mode: {
20
+ control: 'select',
21
+ options: ['single', 'range'],
22
+ description: 'Selection mode of the DatePicker'
23
+ },
24
+ label: {
25
+ control: 'text',
26
+ description: 'Label for the DatePicker'
27
+ },
28
+ placeholder: {
29
+ control: 'text',
30
+ description: 'Placeholder text when no date is selected'
31
+ },
32
+ disabled: {
33
+ control: 'boolean',
34
+ description: 'Whether the DatePicker is disabled'
35
+ },
36
+ inline: {
37
+ control: 'boolean',
38
+ description: 'Whether to display the DatePicker inline'
39
+ },
40
+ onChange: {
41
+ action: 'changed',
42
+ description: 'Callback fired when a date is selected (single mode)'
43
+ },
44
+ onRangeChange: {
45
+ action: 'range changed',
46
+ description: 'Callback fired when a date range is selected (range mode)'
47
+ }
48
+ }
49
+ } satisfies Meta<typeof DatePicker>
50
+
51
+ export default meta
52
+ type Story = StoryObj<typeof meta>
53
+
54
+ export const SingleMode: Story = {
55
+ args: {
56
+ size: 'md',
57
+ mode: 'single',
58
+ label: 'Select a date',
59
+ placeholder: 'DD/MM/YYYY',
60
+ disabled: false,
61
+ inline: false,
62
+ value: undefined,
63
+ onChange: () => {}
64
+ },
65
+ render: (args) => {
66
+ const [value, setValue] = useState<Date | undefined>(args.value ?? undefined)
67
+
68
+ return (
69
+ <DatePicker
70
+ mode='single'
71
+ value={value}
72
+ onChange={(next) => {
73
+ setValue(next)
74
+ args.onChange?.(next)
75
+ }}
76
+ />
77
+ )
78
+ }
79
+ }
80
+
81
+ export const RangeMode: Story = {
82
+ args: {
83
+ size: 'md',
84
+ mode: 'range',
85
+ label: 'Select a date range',
86
+ placeholder: 'DD/MM/YYYY - DD/MM/YYYY',
87
+ disabled: false,
88
+ inline: false,
89
+ rangeValue: { from: undefined, to: undefined },
90
+ onRangeChange: () => {}
91
+ },
92
+ render: (args) => {
93
+ const [rangeValue, setRangeValue] = useState<DateRange | undefined>(
94
+ args.rangeValue ?? { from: undefined, to: undefined }
95
+ )
96
+ return (
97
+ <DatePicker
98
+ mode='range'
99
+ rangeValue={rangeValue}
100
+ onRangeChange={(next) => {
101
+ setRangeValue(next)
102
+ args.onRangeChange?.(next)
103
+ }}
104
+ />
105
+ )
106
+ }
107
+ }
108
+