@liguelead/design-system 0.0.9 → 0.0.11

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 (76) hide show
  1. package/components/Button/Button.appearance.ts +66 -62
  2. package/components/Button/Button.sizes.ts +42 -41
  3. package/components/Button/Button.styles.ts +46 -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 +115 -66
  8. package/components/Checkbox/Checkbox.tsx +97 -40
  9. package/components/Checkbox/Checkbox.types.ts +12 -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 +34 -41
  16. package/components/IconButton/IconButton.tsx +70 -70
  17. package/components/IconButton/index.ts +1 -1
  18. package/components/InputOpt/InputOpt.styles.ts +75 -0
  19. package/components/InputOpt/InputOpt.tsx +153 -0
  20. package/components/InputOpt/InputOpt.types.ts +14 -0
  21. package/components/InputOpt/index.ts +1 -0
  22. package/components/InputOpt/utils/focusManagement.ts +31 -0
  23. package/components/InputOpt/utils/index.ts +2 -0
  24. package/components/InputOpt/utils/inputValidation.ts +14 -0
  25. package/components/LinkButton/LinkButton.size.ts +39 -0
  26. package/components/LinkButton/LinkButton.style.ts +45 -0
  27. package/components/LinkButton/LinkButton.tsx +75 -0
  28. package/components/LinkButton/LinkButton.types.ts +11 -0
  29. package/components/LinkButton/index.ts +1 -0
  30. package/components/PageWrapper/PageWrapper.tsx +31 -31
  31. package/components/PageWrapper/index.ts +1 -1
  32. package/components/RadioButton/RadioButton.inputVariants.ts +133 -0
  33. package/components/RadioButton/RadioButton.styles.ts +78 -0
  34. package/components/RadioButton/RadioButton.tsx +88 -0
  35. package/components/RadioButton/RadioButton.types.ts +33 -0
  36. package/components/RadioButton/RadioButton.variants.ts +67 -0
  37. package/components/RadioButton/index.ts +1 -0
  38. package/components/SegmentedButton/SegmentedButton.styles.ts +29 -29
  39. package/components/SegmentedButton/SegmentedButton.tsx +43 -49
  40. package/components/SegmentedButton/SegmentedButton.types.ts +20 -20
  41. package/components/SegmentedButton/index.ts +1 -1
  42. package/components/Select/Select.sizes.ts +55 -56
  43. package/components/Select/Select.states.tsx +40 -69
  44. package/components/Select/Select.styles.ts +162 -148
  45. package/components/Select/Select.tsx +152 -144
  46. package/components/Select/Select.types.ts +35 -36
  47. package/components/Select/index.ts +1 -1
  48. package/components/Text/Text.styles.ts +46 -43
  49. package/components/Text/Text.tsx +27 -27
  50. package/components/Text/Text.types.ts +44 -42
  51. package/components/Text/index.ts +1 -1
  52. package/components/TextField/TextField.sizes.ts +52 -58
  53. package/components/TextField/TextField.states.tsx +53 -76
  54. package/components/TextField/TextField.styles.ts +85 -98
  55. package/components/TextField/TextField.tsx +108 -108
  56. package/components/TextField/TextField.types.ts +22 -21
  57. package/components/TextField/index.ts +2 -2
  58. package/components/TextField/utils/getState.ts +7 -0
  59. package/components/ThemeProvider/ThemeProvider.tsx +21 -21
  60. package/components/ThemeProvider/index.ts +1 -1
  61. package/components/ThemeProvider/style.ts +969 -969
  62. package/components/Wizard/StepContent.tsx +28 -28
  63. package/components/Wizard/StepMenuItem.tsx +33 -33
  64. package/components/Wizard/Wizard.context.tsx +76 -76
  65. package/components/Wizard/Wizard.styles.ts +126 -126
  66. package/components/Wizard/Wizard.tsx +55 -55
  67. package/components/Wizard/index.ts +1 -1
  68. package/components/index.ts +14 -11
  69. package/package.json +41 -41
  70. package/scripts/createTypes.js +70 -70
  71. package/utils/colorDarken.ts +10 -10
  72. package/utils/colorLighten.ts +10 -10
  73. package/utils/darkenOrLighen.ts +19 -19
  74. package/utils/getTextColor.ts +12 -12
  75. package/utils/index.ts +5 -5
  76. package/utils/parseColor.ts +7 -7
@@ -1,62 +1,66 @@
1
- import {ButtonAppearanceTypes} from './Button.types'
2
- import {colorType} from 'types'
3
- import {useTheme} from 'styled-components'
4
- import {darkenOrLighten, getTextColor, parseColor} from '../../utils'
5
-
6
- export const ButtonAppearance = (
7
- color: colorType,
8
- appearance: ButtonAppearanceTypes
9
- ) => {
10
- const theme = useTheme()
11
- const parsedColor = parseColor(theme.colors[color])
12
-
13
- const solidtextColor = parseColor(theme.colors[getTextColor(parsedColor)])
14
-
15
- const colorHover = darkenOrLighten(0.2, parsedColor)
16
-
17
- const appearances = {
18
- solid: `
19
- background-color: ${parsedColor};
20
- color: ${solidtextColor};
21
- border: 1px solid ${parsedColor};
22
- &:hover {
23
- background-color: ${colorHover};
24
- border-color: ${colorHover};
25
- }
26
- &:disabled {
27
- background-color: ${parseColor(theme.colors.neutral200)};
28
- color: ${parseColor(theme.colors.neutral500)};
29
- border-color: ${parseColor(theme.colors.neutral200)};
30
- }
31
- `,
32
- outline: `
33
- background-color: transparent;
34
- color: ${parsedColor};
35
- border: 1px solid ${parsedColor};
36
- &:hover {
37
- background-color: ${parsedColor};
38
- border-color: ${parsedColor};
39
- color: white;
40
- }
41
- &:disabled {
42
- background-color: transparent;
43
- color: ${parseColor(theme.colors.neutral500)};
44
- border-color: ${parseColor(theme.colors.neutral500)};
45
- }
46
- `,
47
- ghost: `
48
- background-color: transparent;
49
- color: ${parsedColor};
50
- border: 1px solid transparent;
51
- &:hover {
52
- background-color: rgba(0,0,0,0.05)
53
- }
54
- &:disabled {
55
- background-color: transparent;
56
- color: ${parseColor(theme.colors.neutral500)};
57
- }
58
- `
59
- }
60
-
61
- return appearances[appearance]
62
- }
1
+ import { ButtonVariantTypes} from './Button.types'
2
+ import {colorType} from 'types'
3
+ import {useTheme} from 'styled-components'
4
+ import {darkenOrLighten, getTextColor, parseColor} from '../../utils'
5
+
6
+ export const ButtonVariant = (
7
+ color: colorType,
8
+ variant: ButtonVariantTypes
9
+ ) => {
10
+ const theme = useTheme()
11
+ const parsedColor = parseColor(theme.colors[color])
12
+
13
+ const solidtextColor = parseColor(theme.colors[getTextColor(parsedColor)])
14
+
15
+ const colorHover = darkenOrLighten(0.2, parsedColor)
16
+
17
+ const variants = {
18
+ solid: `
19
+ background-color: ${parsedColor};
20
+ color: ${solidtextColor};
21
+ border: 1px solid ${parsedColor};
22
+ &:hover {
23
+ background-color: ${colorHover};
24
+ border-color: ${colorHover};
25
+ }
26
+ &:disabled {
27
+ background-color: ${parsedColor}80;
28
+ color: ${solidtextColor}cc;
29
+ cursor: not-allowed;
30
+ border: none;
31
+ }
32
+ `,
33
+ outline: `
34
+ background-color: transparent;
35
+ color: ${parsedColor};
36
+ border: 1px solid ${parsedColor};
37
+ &:hover {
38
+ background-color: ${parseColor(theme.colors.primaryDarker)};
39
+ border-color: transparent;
40
+ color: ${parseColor(theme.colors.white)};
41
+ }
42
+ &:disabled {
43
+ background-color: transparent;
44
+ color: ${parseColor(theme.colors.neutral1100)}80;
45
+ border-color: ${parseColor(theme.colors.neutral400)};
46
+ cursor: not-allowed;
47
+ }
48
+ `,
49
+ ghost: `
50
+ background-color: transparent;
51
+ color: ${parsedColor};
52
+ border: 1px solid transparent;
53
+ &:hover {
54
+ background-color: ${parseColor(theme.colors.primaryDarker)};
55
+ color: ${parseColor(theme.colors.white)};
56
+ }
57
+ &:disabled {
58
+ background-color: transparent;
59
+ color: ${parseColor(theme.colors.neutral1100)}80;
60
+ cursor: not-allowed;
61
+ }
62
+ `
63
+ }
64
+
65
+ return variants[variant]
66
+ }
@@ -1,41 +1,42 @@
1
- import { fontSize, fontWeight, lineHeight, spacing } from '@liguelead/foundation'
2
- import { ButtonSizeTypes } from './Button.types'
3
-
4
- export const ButtonSizes = (size: ButtonSizeTypes) => {
5
- const sizes = {
6
- xs: `
7
- padding: ${spacing.spacing4}px ${spacing.spacing8}px;
8
- font-size: ${fontSize.fontSize10}px;
9
- font-weight: ${fontWeight.fontWeight600};
10
- line-height: ${lineHeight.lineHeight14}px;
11
- gap: ${spacing.spacing8}px;
12
- border-radius: ${spacing.spacing4}px;
13
- `,
14
- sm: `
15
- padding: ${spacing.spacing8}px ${spacing.spacing12}px;
16
- font-size: ${fontSize.fontSize14}px;
17
- font-weight: ${fontWeight.fontWeight600};
18
- line-height: ${lineHeight.lineHeight22}px;
19
- gap: ${spacing.spacing8}px;
20
- border-radius: ${spacing.spacing4}px;
21
- `,
22
- md: `
23
- padding: ${spacing.spacing12}px ${spacing.spacing20}px;
24
- font-size: ${fontSize.fontSize14}px;
25
- font-weight: ${fontWeight.fontWeight600};
26
- line-height: ${lineHeight.lineHeight22}px;
27
- gap: ${spacing.spacing8}px;
28
- border-radius: ${spacing.spacing4}px;
29
- `,
30
- lg: `
31
- padding: ${spacing.spacing16}px ${spacing.spacing24}px;
32
- font-size: ${fontSize.fontSize16}px;
33
- font-weight: ${fontWeight.fontWeight600};
34
- line-height: ${lineHeight.lineHeight24}px;
35
- gap: ${spacing.spacing8}px;
36
- border-radius: ${spacing.spacing4}px;
37
- `
38
- }
39
-
40
- return sizes[size]
41
- }
1
+ import {
2
+ fontSize,
3
+ fontWeight,
4
+ lineHeight,
5
+ spacing,
6
+ radius
7
+ } from '@liguelead/foundation'
8
+ import { ButtonSizeTypes } from './Button.types'
9
+
10
+ export const ButtonSizes = (size: ButtonSizeTypes) => {
11
+ const sizes = {
12
+ sm: `
13
+ padding: ${spacing.spacing8}px ${spacing.spacing12}px;
14
+ font-size: ${fontSize.fontSize14}px;
15
+ font-weight: ${fontWeight.fontWeight500};
16
+ line-height: ${lineHeight.lineHeight22}px;
17
+ gap: ${spacing.spacing8}px;
18
+ min-width: ${spacing.spacing64}px;
19
+ border-radius: ${radius.radius4}px;
20
+ `,
21
+ md: `
22
+ padding: ${spacing.spacing8}px ${spacing.spacing16}px;
23
+ font-size: ${fontSize.fontSize14}px;
24
+ font-weight: ${fontWeight.fontWeight500};
25
+ line-height: ${lineHeight.lineHeight22}px;
26
+ gap: ${spacing.spacing8}px;
27
+ min-width: ${spacing.spacing76}px;
28
+ border-radius: ${radius.radius4}px;
29
+ `,
30
+ lg: `
31
+ padding: ${spacing.spacing8}px ${spacing.spacing32}px;
32
+ font-size: ${fontSize.fontSize16}px;
33
+ font-weight: ${fontWeight.fontWeight500};
34
+ line-height: ${lineHeight.lineHeight24}px;
35
+ gap: ${spacing.spacing8}px;
36
+ min-width: ${spacing.spacing108}px;
37
+ border-radius: ${radius.radius4}px;
38
+ `
39
+ }
40
+
41
+ return sizes[size]
42
+ }
@@ -1,50 +1,46 @@
1
- import styled from 'styled-components'
2
- import { ButtonProps } from './Button.types'
3
-
4
- interface StyledButtonProps extends ButtonProps {
5
- $appearance: string
6
- $buttonSize: string
7
- $fluid: boolean
8
- }
9
-
10
- export const StyledButton = styled.button<StyledButtonProps>`
11
- position: relative;
12
- display: flex;
13
- outline: none !important;
14
- justify-content: center;
15
- align-items: center;
16
- width: ${({ $fluid }) => ($fluid ? '100%' : 'auto')};
17
- ${({ $buttonSize }) => $buttonSize}
18
- overflow: hidden;
19
- cursor: pointer;
20
- outline: none;
21
- transition: background-color 0.3s, box-shadow 0.3s;
22
- ${({ $appearance }) => $appearance}
23
-
24
- &:focus {
25
- outline: none;
26
- box-shadow: 0px 0px 0px var(--2, 2px) rgba(255, 255, 255, 0.1),
27
- 0px 0px 0px var(--4, 4px) rgba(255, 255, 255, 0.1);
28
- }
29
- `
30
-
31
- export const RippleContainer = styled.span<{
32
- $appearance: string
33
- }>`
34
- position: absolute;
35
- border-radius: 50%;
36
- transform: scale(0);
37
- animation: ripple 0.4s linear;
38
- background-color: ${({ $appearance }) =>
39
- $appearance === 'solid'
40
- ? 'rgba(255, 255, 255, 0.5)'
41
- : 'rgba(0, 0, 0, 0.2)'};
42
- pointer-events: none;
43
-
44
- @keyframes ripple {
45
- to {
46
- transform: scale(9);
47
- opacity: 0;
48
- }
49
- }
50
- `
1
+ import styled from 'styled-components'
2
+ import { ButtonProps } from './Button.types'
3
+ import { shadow } from '@liguelead/foundation'
4
+
5
+ export interface StyledButtonProps extends ButtonProps {
6
+ $variant: string
7
+ $buttonSize: string
8
+ $fluid: boolean
9
+ }
10
+
11
+ export const StyledButton = styled.button<StyledButtonProps>`
12
+ position: relative;
13
+ display: flex;
14
+ outline: none !important;
15
+ justify-content: center;
16
+ align-items: center;
17
+ width: ${({ $fluid }) => ($fluid ? '100%' : 'auto')};
18
+ ${({ $buttonSize }) => $buttonSize}
19
+ overflow: hidden;
20
+ cursor: pointer;
21
+ outline: none;
22
+ transition: background-color 0.3s, box-shadow 0.3s;
23
+ ${({ $variant }) => $variant}
24
+
25
+ &:focus {
26
+ box-shadow: ${shadow.focusShadow};
27
+ }
28
+ `
29
+
30
+ export const RippleContainer = styled.span<{
31
+ $variant: string
32
+ }>`
33
+ position: absolute;
34
+ border-radius: 50%;
35
+ transform: scale(0);
36
+ animation: ripple 0.4s linear;
37
+ background-color:rgba(255, 255, 255, 0.5);
38
+ pointer-events: none;
39
+
40
+ @keyframes ripple {
41
+ to {
42
+ transform: scale(9);
43
+ opacity: 0;
44
+ }
45
+ }
46
+ `
@@ -1,76 +1,76 @@
1
- import { useState } from 'react'
2
- import { StyledButton, RippleContainer } from './Button.styles'
3
- import { RippleInterface, ButtonProps } from './Button.types'
4
- import { ButtonSizes } from './Button.sizes'
5
- import { ButtonAppearance } from './Button.appearance'
6
-
7
- const Button: React.FC<ButtonProps> = ({
8
- appearance = 'solid',
9
- children,
10
- className,
11
- color = 'primary',
12
- disabled,
13
- fluid = false,
14
- size = 'md',
15
- onClick,
16
- type = 'button',
17
- ...rest
18
- }) => {
19
- const [ripples, setRipples] = useState<RippleInterface[]>([])
20
-
21
- const buttonSize = ButtonSizes(size)
22
- const buttonAppearance = ButtonAppearance(color, appearance)
23
-
24
- const removeRipple = (ripples: RippleInterface[], rippleId: string) => {
25
- return ripples.filter(r => r.id !== rippleId)
26
- }
27
-
28
- const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
29
- const rect = e.currentTarget.getBoundingClientRect()
30
- const x = e.clientX - rect.left
31
- const y = e.clientY - rect.top
32
-
33
- const newRipple: RippleInterface = {
34
- id: `${Date.now()}-${Math.random()}`,
35
- x,
36
- y
37
- }
38
- setRipples(prev => [...prev, newRipple])
39
-
40
- // Chama o onClick fornecido
41
- if (onClick) {
42
- onClick(e)
43
- }
44
- }
45
-
46
- return (
47
- <StyledButton
48
- disabled={disabled}
49
- className={className}
50
- $fluid={fluid}
51
- $appearance={buttonAppearance}
52
- onClick={handleClick}
53
- $buttonSize={buttonSize}
54
- type={type}
55
- {...rest}>
56
- {children}
57
- {ripples.map(ripple => (
58
- <RippleContainer
59
- $appearance={appearance}
60
- key={ripple.id}
61
- style={{
62
- top: ripple.y - 10,
63
- left: ripple.x - 10,
64
- width: 20,
65
- height: 20
66
- }}
67
- onAnimationEnd={() =>
68
- setRipples(prev => removeRipple(prev, ripple.id))
69
- }
70
- />
71
- ))}
72
- </StyledButton>
73
- )
74
- }
75
-
76
- export default Button
1
+ import { useState } from 'react'
2
+ import { StyledButton, RippleContainer } from './Button.styles'
3
+ import { RippleInterface, ButtonProps } from './Button.types'
4
+ import { ButtonSizes } from './Button.sizes'
5
+ import { ButtonVariant } from './Button.appearance'
6
+
7
+ const Button: React.FC<ButtonProps> = ({
8
+ variant = 'solid',
9
+ children,
10
+ className,
11
+ color = 'primary',
12
+ disabled,
13
+ fluid = false,
14
+ size = 'md',
15
+ onClick,
16
+ type = 'button',
17
+ ...rest
18
+ }) => {
19
+ const [ripples, setRipples] = useState<RippleInterface[]>([])
20
+
21
+ const buttonSize = ButtonSizes(size)
22
+ const buttonVariant = ButtonVariant(color, variant)
23
+
24
+ const removeRipple = (ripples: RippleInterface[], rippleId: string) => {
25
+ return ripples.filter(r => r.id !== rippleId)
26
+ }
27
+
28
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
29
+ const rect = e.currentTarget.getBoundingClientRect()
30
+ const x = e.clientX - rect.left
31
+ const y = e.clientY - rect.top
32
+
33
+ const newRipple: RippleInterface = {
34
+ id: `${Date.now()}-${Math.random()}`,
35
+ x,
36
+ y
37
+ }
38
+ setRipples(prev => [...prev, newRipple])
39
+
40
+ // Chama o onClick fornecido
41
+ if (onClick) {
42
+ onClick(e)
43
+ }
44
+ }
45
+
46
+ return (
47
+ <StyledButton
48
+ disabled={disabled}
49
+ className={className}
50
+ $fluid={fluid}
51
+ $variant={buttonVariant}
52
+ onClick={handleClick}
53
+ $buttonSize={buttonSize}
54
+ type={type}
55
+ {...rest}>
56
+ {children}
57
+ {ripples.map(ripple => (
58
+ <RippleContainer
59
+ $variant={variant}
60
+ key={ripple.id}
61
+ style={{
62
+ top: ripple.y - 10,
63
+ left: ripple.x - 10,
64
+ width: 20,
65
+ height: 20
66
+ }}
67
+ onAnimationEnd={() =>
68
+ setRipples(prev => removeRipple(prev, ripple.id))
69
+ }
70
+ />
71
+ ))}
72
+ </StyledButton>
73
+ )
74
+ }
75
+
76
+ export default Button
@@ -1,23 +1,23 @@
1
- import { colorType } from 'types'
2
-
3
- export type ButtonSizeTypes = 'xs' | 'sm' | 'md' | 'lg'
4
- export type ButtonAppearanceTypes = 'solid' | 'outline' | 'ghost'
5
-
6
- export interface ButtonProps {
7
- appearance?: ButtonAppearanceTypes
8
- children: React.ReactNode
9
- className?: string
10
- disabled?: boolean
11
- fluid?: boolean
12
- size?: ButtonSizeTypes
13
- color?: colorType
14
- onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
15
- type?: 'button' | 'submit' | 'reset'
16
- style?: React.CSSProperties
17
- }
18
-
19
- export interface RippleInterface {
20
- id: string
21
- x: number
22
- y: number
23
- }
1
+ import { colorType } from 'types'
2
+
3
+ export type ButtonSizeTypes = 'sm' | 'md' | 'lg'
4
+ export type ButtonVariantTypes = 'solid' | 'outline' | 'ghost'
5
+
6
+ export interface ButtonProps {
7
+ variant?: ButtonVariantTypes
8
+ children: React.ReactNode
9
+ className?: string
10
+ disabled?: boolean
11
+ fluid?: boolean
12
+ size?: ButtonSizeTypes
13
+ color?: colorType
14
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
15
+ type?: 'button' | 'submit' | 'reset'
16
+ style?: React.CSSProperties
17
+ }
18
+
19
+ export interface RippleInterface {
20
+ id: string
21
+ x: number
22
+ y: number
23
+ }
@@ -1 +1 @@
1
- export { default } from './Button'
1
+ export { default } from './Button'