@liguelead/design-system 0.0.8 → 0.0.10

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 (58) hide show
  1. package/components/Button/Button.appearance.ts +62 -62
  2. package/components/Button/Button.sizes.ts +41 -41
  3. package/components/Button/Button.styles.ts +50 -50
  4. package/components/Button/Button.tsx +76 -76
  5. package/components/Button/Button.types.ts +23 -23
  6. package/components/Button/index.ts +1 -1
  7. package/components/Checkbox/Checkbox.styles.ts +66 -66
  8. package/components/Checkbox/Checkbox.tsx +40 -40
  9. package/components/Checkbox/Checkbox.types.ts +11 -11
  10. package/components/Checkbox/index.tsx +2 -2
  11. package/components/DatePicker/DatePicker.styles.ts +66 -66
  12. package/components/DatePicker/DatePicker.tsx +135 -135
  13. package/components/DatePicker/DatePicker.types.ts +29 -29
  14. package/components/DatePicker/index.ts +1 -1
  15. package/components/IconButton/IconButton.sizes.ts +41 -41
  16. package/components/IconButton/IconButton.tsx +70 -70
  17. package/components/IconButton/index.ts +1 -1
  18. package/components/PageWrapper/PageWrapper.tsx +31 -31
  19. package/components/PageWrapper/index.ts +1 -1
  20. package/components/SegmentedButton/SegmentedButton.styles.ts +29 -29
  21. package/components/SegmentedButton/SegmentedButton.tsx +49 -49
  22. package/components/SegmentedButton/SegmentedButton.types.ts +20 -20
  23. package/components/SegmentedButton/index.ts +1 -1
  24. package/components/Select/Select.sizes.ts +56 -56
  25. package/components/Select/Select.states.tsx +69 -69
  26. package/components/Select/Select.styles.ts +148 -148
  27. package/components/Select/Select.tsx +145 -144
  28. package/components/Select/Select.types.ts +36 -36
  29. package/components/Select/index.ts +1 -1
  30. package/components/Text/Text.styles.ts +43 -43
  31. package/components/Text/Text.tsx +27 -27
  32. package/components/Text/Text.types.ts +42 -42
  33. package/components/Text/index.ts +1 -1
  34. package/components/TextField/TextField.sizes.ts +58 -58
  35. package/components/TextField/TextField.states.tsx +53 -76
  36. package/components/TextField/TextField.styles.ts +81 -98
  37. package/components/TextField/TextField.tsx +105 -108
  38. package/components/TextField/TextField.types.ts +22 -21
  39. package/components/TextField/index.ts +2 -2
  40. package/components/TextField/utils/getState.ts +7 -0
  41. package/components/ThemeProvider/ThemeProvider.tsx +21 -21
  42. package/components/ThemeProvider/index.ts +1 -1
  43. package/components/ThemeProvider/style.ts +969 -969
  44. package/components/Wizard/StepContent.tsx +28 -28
  45. package/components/Wizard/StepMenuItem.tsx +33 -33
  46. package/components/Wizard/Wizard.context.tsx +76 -76
  47. package/components/Wizard/Wizard.styles.ts +126 -126
  48. package/components/Wizard/Wizard.tsx +55 -55
  49. package/components/Wizard/index.ts +1 -1
  50. package/components/index.ts +11 -11
  51. package/package.json +41 -39
  52. package/scripts/createTypes.js +70 -70
  53. package/utils/colorDarken.ts +10 -10
  54. package/utils/colorLighten.ts +10 -10
  55. package/utils/darkenOrLighen.ts +19 -19
  56. package/utils/getTextColor.ts +12 -12
  57. package/utils/index.ts +5 -5
  58. package/utils/parseColor.ts +7 -7
@@ -1,70 +1,70 @@
1
- import { useState } from 'react'
2
- import { ButtonProps, RippleInterface } from '../Button/Button.types'
3
- import { ButtonAppearance } from '../Button/Button.appearance'
4
- import { IconButtonSizes } from './IconButton.sizes'
5
- import { RippleContainer, StyledButton } from '../Button/Button.styles'
6
-
7
- const IconButton: React.FC<ButtonProps> = ({
8
- appearance = 'solid',
9
- children,
10
- className,
11
- color = 'primary',
12
- disabled,
13
- fluid = false,
14
- size = 'md',
15
- onClick,
16
- ...rest
17
- }) => {
18
- const [ripples, setRipples] = useState<RippleInterface[]>([])
19
-
20
- const buttonSize = IconButtonSizes(size)
21
- const buttonAppearance = ButtonAppearance(color, appearance)
22
-
23
- const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
24
- const rect = e.currentTarget.getBoundingClientRect()
25
- const x = e.clientX - rect.left
26
- const y = e.clientY - rect.top
27
-
28
- const newRipple: RippleInterface = {
29
- id: `${Date.now()}-${Math.random()}`,
30
- x,
31
- y
32
- }
33
- setRipples(prev => [...prev, newRipple])
34
-
35
- // Chama o onClick fornecido
36
- if (onClick) {
37
- onClick(e)
38
- }
39
- }
40
-
41
- return (
42
- <StyledButton
43
- disabled={disabled}
44
- className={className}
45
- $fluid={fluid}
46
- $appearance={buttonAppearance}
47
- onClick={handleClick}
48
- $buttonSize={buttonSize}
49
- {...rest}>
50
- {children}
51
- {ripples.map(ripple => (
52
- <RippleContainer
53
- $appearance={appearance}
54
- key={ripple.id}
55
- style={{
56
- top: ripple.y - 10,
57
- left: ripple.x - 10,
58
- width: 20,
59
- height: 20
60
- }}
61
- onAnimationEnd={() =>
62
- setRipples(prev => prev.filter(r => r.id !== ripple.id))
63
- }
64
- />
65
- ))}
66
- </StyledButton>
67
- )
68
- }
69
-
70
- export default IconButton
1
+ import { useState } from 'react'
2
+ import { ButtonProps, RippleInterface } from '../Button/Button.types'
3
+ import { ButtonAppearance } from '../Button/Button.appearance'
4
+ import { IconButtonSizes } from './IconButton.sizes'
5
+ import { RippleContainer, StyledButton } from '../Button/Button.styles'
6
+
7
+ const IconButton: React.FC<ButtonProps> = ({
8
+ appearance = 'solid',
9
+ children,
10
+ className,
11
+ color = 'primary',
12
+ disabled,
13
+ fluid = false,
14
+ size = 'md',
15
+ onClick,
16
+ ...rest
17
+ }) => {
18
+ const [ripples, setRipples] = useState<RippleInterface[]>([])
19
+
20
+ const buttonSize = IconButtonSizes(size)
21
+ const buttonAppearance = ButtonAppearance(color, appearance)
22
+
23
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
24
+ const rect = e.currentTarget.getBoundingClientRect()
25
+ const x = e.clientX - rect.left
26
+ const y = e.clientY - rect.top
27
+
28
+ const newRipple: RippleInterface = {
29
+ id: `${Date.now()}-${Math.random()}`,
30
+ x,
31
+ y
32
+ }
33
+ setRipples(prev => [...prev, newRipple])
34
+
35
+ // Chama o onClick fornecido
36
+ if (onClick) {
37
+ onClick(e)
38
+ }
39
+ }
40
+
41
+ return (
42
+ <StyledButton
43
+ disabled={disabled}
44
+ className={className}
45
+ $fluid={fluid}
46
+ $appearance={buttonAppearance}
47
+ onClick={handleClick}
48
+ $buttonSize={buttonSize}
49
+ {...rest}>
50
+ {children}
51
+ {ripples.map(ripple => (
52
+ <RippleContainer
53
+ $appearance={appearance}
54
+ key={ripple.id}
55
+ style={{
56
+ top: ripple.y - 10,
57
+ left: ripple.x - 10,
58
+ width: 20,
59
+ height: 20
60
+ }}
61
+ onAnimationEnd={() =>
62
+ setRipples(prev => prev.filter(r => r.id !== ripple.id))
63
+ }
64
+ />
65
+ ))}
66
+ </StyledButton>
67
+ )
68
+ }
69
+
70
+ export default IconButton
@@ -1 +1 @@
1
- export { default } from './IconButton'
1
+ export { default } from './IconButton'
@@ -1,31 +1,31 @@
1
- import {parseColor} from '../../utils'
2
- import styled from 'styled-components'
3
- import {colorType} from 'types'
4
- import {spacing, SpacingInterface} from '@liguelead/foundation'
5
-
6
- type SpacingType = keyof SpacingInterface
7
-
8
- interface WrapperProps {
9
- width?: string
10
- bgColor?: colorType
11
- padding?: SpacingType
12
- }
13
-
14
- const PageWrapper = styled.div.withConfig({
15
- shouldForwardProp: prop => !['bgColor', 'width', 'padding'].includes(prop)
16
- })<WrapperProps>`
17
- width: 100%;
18
- height: 100%;
19
- max-width: ${({width}) => width + 'px' || '100%'};
20
- margin: 0 auto;
21
- padding: ${({padding}) =>
22
- padding ? spacing[padding] + 'px' : spacing.spacing16 + 'px'};
23
- border-radius: 4px;
24
- background: ${({bgColor, theme}) =>
25
- bgColor
26
- ? parseColor(theme.colors[bgColor])
27
- : parseColor(theme.colors.white)};
28
- border: 1px solid ${({theme}) => parseColor(theme.colors.neutral300)};
29
- `
30
-
31
- export default PageWrapper
1
+ import {parseColor} from '../../utils'
2
+ import styled from 'styled-components'
3
+ import {colorType} from 'types'
4
+ import {spacing, SpacingInterface} from '@liguelead/foundation'
5
+
6
+ type SpacingType = keyof SpacingInterface
7
+
8
+ interface WrapperProps {
9
+ width?: string
10
+ bgColor?: colorType
11
+ padding?: SpacingType
12
+ }
13
+
14
+ const PageWrapper = styled.div.withConfig({
15
+ shouldForwardProp: prop => !['bgColor', 'width', 'padding'].includes(prop)
16
+ })<WrapperProps>`
17
+ width: 100%;
18
+ height: 100%;
19
+ max-width: ${({width}) => width + 'px' || '100%'};
20
+ margin: 0 auto;
21
+ padding: ${({padding}) =>
22
+ padding ? spacing[padding] + 'px' : spacing.spacing16 + 'px'};
23
+ border-radius: 4px;
24
+ background: ${({bgColor, theme}) =>
25
+ bgColor
26
+ ? parseColor(theme.colors[bgColor])
27
+ : parseColor(theme.colors.white)};
28
+ border: 1px solid ${({theme}) => parseColor(theme.colors.neutral300)};
29
+ `
30
+
31
+ export default PageWrapper
@@ -1 +1 @@
1
- export { default } from './PageWrapper'
1
+ export { default } from './PageWrapper'
@@ -1,29 +1,29 @@
1
- import styled from 'styled-components'
2
- import Button from '../Button'
3
- import { parseColor } from '../../utils'
4
-
5
- export const WrapperSegmentedButton = styled.div`
6
- display: flex;
7
- justify-content: center;
8
- align-items: center;
9
- border-radius: 8px;
10
- width: fit-content;
11
- `
12
-
13
- export const LeftButton = styled(Button)`
14
- border-radius: 4px 0 0 4px;
15
- box-shadow: none;
16
- border-right: none;
17
-
18
- &:disabled {
19
- border-color: ${({ theme }) => parseColor(theme.colors.neutral500)};
20
- }
21
- `
22
-
23
- export const RightButton = styled(Button)`
24
- border-radius: 0 4px 4px 0;
25
- border-left: none;
26
- &:focus {
27
- box-shadow: none;
28
- }
29
- `
1
+ import styled from 'styled-components'
2
+ import Button from '../Button'
3
+ import { parseColor } from '../../utils'
4
+
5
+ export const WrapperSegmentedButton = styled.div`
6
+ display: flex;
7
+ justify-content: center;
8
+ align-items: center;
9
+ border-radius: 8px;
10
+ width: fit-content;
11
+ `
12
+
13
+ export const LeftButton = styled(Button)`
14
+ border-radius: 4px 0 0 4px;
15
+ box-shadow: none;
16
+ border-right: none;
17
+
18
+ &:disabled {
19
+ border-color: ${({ theme }) => parseColor(theme.colors.neutral500)};
20
+ }
21
+ `
22
+
23
+ export const RightButton = styled(Button)`
24
+ border-radius: 0 4px 4px 0;
25
+ border-left: none;
26
+ &:focus {
27
+ box-shadow: none;
28
+ }
29
+ `
@@ -1,49 +1,49 @@
1
- import { SegmentedButtonProps } from './SegmentedButton.types'
2
- import {
3
- LeftButton,
4
- RightButton,
5
- WrapperSegmentedButton
6
- } from './SegmentedButton.styles'
7
- import { useState } from 'react'
8
-
9
- const SegmentedButton: React.FC<SegmentedButtonProps> = ({
10
- options,
11
- disabled = false,
12
- color = 'primary',
13
- size = 'md',
14
- ...rest
15
- }) => {
16
- const { leftButton, rightButton } = options
17
- const [selected, setSelected] = useState<string>('left')
18
-
19
- return (
20
- <WrapperSegmentedButton {...rest}>
21
- <LeftButton
22
- color={color}
23
- disabled={disabled}
24
- appearance={selected === 'left' ? 'solid' : 'outline'}
25
- size={size}
26
- onClick={() => {
27
- setSelected('left')
28
- leftButton.action?.()
29
- }}
30
- type="button">
31
- {leftButton.label}
32
- </LeftButton>
33
- <RightButton
34
- color={color}
35
- appearance={selected === 'right' ? 'solid' : 'outline'}
36
- disabled={disabled}
37
- onClick={() => {
38
- setSelected('right')
39
- rightButton.action?.()
40
- }}
41
- size={size}
42
- type="button">
43
- {rightButton.label}
44
- </RightButton>
45
- </WrapperSegmentedButton>
46
- )
47
- }
48
-
49
- export default SegmentedButton
1
+ import { SegmentedButtonProps } from './SegmentedButton.types'
2
+ import {
3
+ LeftButton,
4
+ RightButton,
5
+ WrapperSegmentedButton
6
+ } from './SegmentedButton.styles'
7
+ import { useState } from 'react'
8
+
9
+ const SegmentedButton: React.FC<SegmentedButtonProps> = ({
10
+ options,
11
+ disabled = false,
12
+ color = 'primary',
13
+ size = 'md',
14
+ ...rest
15
+ }) => {
16
+ const { leftButton, rightButton } = options
17
+ const [selected, setSelected] = useState<string>('left')
18
+
19
+ return (
20
+ <WrapperSegmentedButton {...rest}>
21
+ <LeftButton
22
+ color={color}
23
+ disabled={disabled}
24
+ appearance={selected === 'left' ? 'solid' : 'outline'}
25
+ size={size}
26
+ onClick={() => {
27
+ setSelected('left')
28
+ leftButton.action?.()
29
+ }}
30
+ type="button">
31
+ {leftButton.label}
32
+ </LeftButton>
33
+ <RightButton
34
+ color={color}
35
+ appearance={selected === 'right' ? 'solid' : 'outline'}
36
+ disabled={disabled}
37
+ onClick={() => {
38
+ setSelected('right')
39
+ rightButton.action?.()
40
+ }}
41
+ size={size}
42
+ type="button">
43
+ {rightButton.label}
44
+ </RightButton>
45
+ </WrapperSegmentedButton>
46
+ )
47
+ }
48
+
49
+ export default SegmentedButton
@@ -1,20 +1,20 @@
1
- import { colorType } from 'types'
2
- type SegmentedButtonType = {
3
- label: string
4
- action?: () => void
5
- }
6
-
7
- interface SegmentedButtons {
8
- leftButton: SegmentedButtonType
9
- rightButton: SegmentedButtonType
10
- }
11
-
12
- export interface SegmentedButtonProps {
13
- className?: string
14
- options: SegmentedButtons
15
- disabled?: boolean
16
- color?: colorType
17
- size?: SegmentedButtonSizeTypes
18
- }
19
-
20
- export type SegmentedButtonSizeTypes = 'sm' | 'md' | 'lg'
1
+ import { colorType } from 'types'
2
+ type SegmentedButtonType = {
3
+ label: string
4
+ action?: () => void
5
+ }
6
+
7
+ interface SegmentedButtons {
8
+ leftButton: SegmentedButtonType
9
+ rightButton: SegmentedButtonType
10
+ }
11
+
12
+ export interface SegmentedButtonProps {
13
+ className?: string
14
+ options: SegmentedButtons
15
+ disabled?: boolean
16
+ color?: colorType
17
+ size?: SegmentedButtonSizeTypes
18
+ }
19
+
20
+ export type SegmentedButtonSizeTypes = 'sm' | 'md' | 'lg'
@@ -1 +1 @@
1
- export { default } from './SegmentedButton'
1
+ export { default } from './SegmentedButton'
@@ -1,56 +1,56 @@
1
- import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
- import { TextFieldSize } from './Select.types'
3
-
4
- export const textFieldSizes = (
5
- size: TextFieldSize,
6
- leftIcon: boolean,
7
- rightIcon: boolean
8
- ) => {
9
- const withIconMargin = Number(spacing.spacing8) + 20
10
- const withIconPadding = {
11
- sm: Number(spacing.spacing12) + Number(withIconMargin),
12
- md: Number(spacing.spacing16) + Number(withIconMargin),
13
- lg: Number(spacing.spacing16) + Number(withIconMargin)
14
- }
15
-
16
- const sizes = {
17
- sm: {
18
- input: `
19
- font-size: ${fontSize.fontSize14}px;
20
- line-height: ${lineHeight.lineHeight22}px;
21
- padding: ${spacing.spacing8}px ${spacing.spacing12}px;
22
- padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
23
- padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
24
- `,
25
- label: `font-size: ${fontSize.fontSize14}px;
26
- margin-left: ${leftIcon ? withIconMargin : 0}px;
27
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
28
- },
29
- md: {
30
- input: `
31
- font-size: ${fontSize.fontSize14}px;
32
- line-height: ${lineHeight.lineHeight20}px;
33
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
34
- padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
35
- padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
36
- `,
37
- label: `font-size: ${fontSize.fontSize14}px;
38
- margin-left: ${leftIcon ? withIconMargin : 0}px;
39
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
40
- },
41
- lg: {
42
- input: `
43
- font-size: ${fontSize.fontSize16}px;
44
- line-height: ${lineHeight.lineHeight24}px;
45
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
46
- padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
47
- padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
48
- `,
49
- label: `font-size: ${fontSize.fontSize16}px;
50
- margin-left: ${leftIcon ? withIconMargin : 0}px;
51
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
52
- }
53
- }
54
-
55
- return sizes[size]
56
- }
1
+ import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
+ import { TextFieldSize } from './Select.types'
3
+
4
+ export const textFieldSizes = (
5
+ size: TextFieldSize,
6
+ leftIcon: boolean,
7
+ rightIcon: boolean
8
+ ) => {
9
+ const withIconMargin = Number(spacing.spacing8) + 20
10
+ const withIconPadding = {
11
+ sm: Number(spacing.spacing12) + Number(withIconMargin),
12
+ md: Number(spacing.spacing16) + Number(withIconMargin),
13
+ lg: Number(spacing.spacing16) + Number(withIconMargin)
14
+ }
15
+
16
+ const sizes = {
17
+ sm: {
18
+ input: `
19
+ font-size: ${fontSize.fontSize14}px;
20
+ line-height: ${lineHeight.lineHeight22}px;
21
+ padding: ${spacing.spacing8}px ${spacing.spacing12}px;
22
+ padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
23
+ padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
24
+ `,
25
+ label: `font-size: ${fontSize.fontSize14}px;
26
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
27
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
28
+ },
29
+ md: {
30
+ input: `
31
+ font-size: ${fontSize.fontSize14}px;
32
+ line-height: ${lineHeight.lineHeight20}px;
33
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
34
+ padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
35
+ padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
36
+ `,
37
+ label: `font-size: ${fontSize.fontSize14}px;
38
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
39
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
40
+ },
41
+ lg: {
42
+ input: `
43
+ font-size: ${fontSize.fontSize16}px;
44
+ line-height: ${lineHeight.lineHeight24}px;
45
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
46
+ padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
47
+ padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
48
+ `,
49
+ label: `font-size: ${fontSize.fontSize16}px;
50
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
51
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
52
+ }
53
+ }
54
+
55
+ return sizes[size]
56
+ }