@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,58 +1,58 @@
1
- import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
-
3
- export type TextFieldSize = 'sm' | 'md' | 'lg'
4
-
5
- export type TextFieldSizeType = {
6
- input: string
7
- label: string
8
- }
9
-
10
- export const textFieldSizes = (size: TextFieldSize, leftIcon: boolean, rightIcon: boolean) => {
11
- const withIconMargin = Number(spacing.spacing8) + 20
12
- const withIconPadding = {
13
- sm: Number(spacing.spacing12) + Number(withIconMargin),
14
- md: Number(spacing.spacing16) + Number(withIconMargin),
15
- lg: Number(spacing.spacing16) + Number(withIconMargin)
16
- }
17
-
18
- const sizes = {
19
- sm: {
20
- input: `
21
- font-size: ${fontSize.fontSize14}px;
22
- line-height: ${lineHeight.lineHeight22}px;
23
- padding: ${spacing.spacing8}px ${spacing.spacing12}px;
24
- padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
25
- padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
26
- `,
27
- label: `font-size: ${fontSize.fontSize14}px;
28
- margin-left: ${leftIcon ? withIconMargin : 0}px;
29
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
30
- },
31
- md: {
32
- input: `
33
- font-size: ${fontSize.fontSize14}px;
34
- line-height: ${lineHeight.lineHeight20}px;
35
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
36
- padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
37
- padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
38
- `,
39
- label: `font-size: ${fontSize.fontSize14}px;
40
- margin-left: ${leftIcon ? withIconMargin : 0}px;
41
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
42
- },
43
- lg: {
44
- input: `
45
- font-size: ${fontSize.fontSize16}px;
46
- line-height: ${lineHeight.lineHeight24}px;
47
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
48
- padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
49
- padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
50
- `,
51
- label: `font-size: ${fontSize.fontSize16}px;
52
- margin-left: ${leftIcon ? withIconMargin : 0}px;
53
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
54
- }
55
- }
56
-
57
- return sizes[size]
58
- }
1
+ import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
+
3
+ export type TextFieldSize = 'sm' | 'md' | 'lg'
4
+
5
+ export type TextFieldSizeType = {
6
+ input: string
7
+ label: string
8
+ }
9
+
10
+ export const textFieldSizes = (size: TextFieldSize, leftIcon: boolean, rightIcon: boolean) => {
11
+ const withIconMargin = Number(spacing.spacing8) + 20
12
+ const withIconPadding = {
13
+ sm: Number(spacing.spacing12) + Number(withIconMargin),
14
+ md: Number(spacing.spacing16) + Number(withIconMargin),
15
+ lg: Number(spacing.spacing16) + Number(withIconMargin)
16
+ }
17
+
18
+ const sizes = {
19
+ sm: {
20
+ input: `
21
+ font-size: ${fontSize.fontSize14}px;
22
+ line-height: ${lineHeight.lineHeight22}px;
23
+ padding: ${spacing.spacing8}px ${spacing.spacing12}px;
24
+ padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
25
+ padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
26
+ `,
27
+ label: `font-size: ${fontSize.fontSize14}px;
28
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
29
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
30
+ },
31
+ md: {
32
+ input: `
33
+ font-size: ${fontSize.fontSize14}px;
34
+ line-height: ${lineHeight.lineHeight20}px;
35
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
36
+ padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
37
+ padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
38
+ `,
39
+ label: `font-size: ${fontSize.fontSize14}px;
40
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
41
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
42
+ },
43
+ lg: {
44
+ input: `
45
+ font-size: ${fontSize.fontSize16}px;
46
+ line-height: ${lineHeight.lineHeight24}px;
47
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
48
+ padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
49
+ padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
50
+ `,
51
+ label: `font-size: ${fontSize.fontSize16}px;
52
+ margin-left: ${leftIcon ? withIconMargin : 0}px;
53
+ margin-right: ${rightIcon ? withIconMargin : 0}px;`
54
+ }
55
+ }
56
+
57
+ return sizes[size]
58
+ }
@@ -1,76 +1,53 @@
1
- import {parseColor} from '../../utils'
2
- import {useTheme} from 'styled-components'
3
- import {fontWeight, fontSize} from '@liguelead/foundation'
4
-
5
- export interface StateInterface {
6
- input: string
7
- label: string
8
- helperText: string
9
- animation?: string
10
- }
11
-
12
- interface TextFieldStates {
13
- error: StateInterface
14
- default: StateInterface
15
- disabled: StateInterface
16
- }
17
-
18
- export const TextFieldStates = (state: keyof TextFieldStates) => {
19
- const theme = useTheme()
20
- const states: TextFieldStates = {
21
- error: {
22
- input: `
23
- border: 1px solid ${parseColor(theme.colors.danger100)};
24
- color: ${parseColor(theme.colors.neutral1000)};
25
- &:focus {
26
- border-color: ${parseColor(theme.colors.danger100)};
27
- }
28
- &:focus + label {
29
- color: ${parseColor(theme.colors.danger100)};
30
- }
31
- `,
32
- label: `color: ${parseColor(theme.colors.danger100)};`,
33
- helperText: `color: ${parseColor(theme.colors.danger100)};`,
34
- animation: `
35
- &:focus + label,
36
- &:not(:placeholder-shown) + label {
37
- top: 0px;
38
- left: 12px;
39
- font-size: ${fontSize.fontSize12}px;
40
- }`
41
- },
42
- default: {
43
- input: `
44
- border: 1px solid ${parseColor(theme.colors.neutral700)};
45
- color: ${parseColor(theme.colors.neutral1000)};
46
- &:focus {
47
- border-color: ${parseColor(theme.colors.primary)};
48
- }
49
- &:focus + label {
50
- color: ${parseColor(theme.colors.primary)};
51
- font-weight: ${fontWeight.fontWeight600};
52
- }
53
- `,
54
- label: `color: ${parseColor(theme.colors.neutral800)};`,
55
- helperText: `color: ${parseColor(theme.colors.neutral700)};`,
56
- animation: `
57
- &:focus + label,
58
- &:not(:placeholder-shown) + label {
59
- top: 0px;
60
- left: 12px;
61
- font-size: ${fontSize.fontSize12}px;
62
- }`
63
- },
64
- disabled: {
65
- input: `
66
- border: 1px solid ${parseColor(theme.colors.neutral500)};
67
- color: ${parseColor(theme.colors.neutral600)};
68
- `,
69
- label: `color: ${parseColor(theme.colors.neutral500)};
70
- background: transparent;`,
71
- helperText: `color: ${parseColor(theme.colors.neutral500)};`,
72
- animation: ``
73
- }
74
- }
75
- return states[state]
76
- }
1
+ import {parseColor} from '../../utils'
2
+ import {useTheme} from 'styled-components'
3
+
4
+ export interface StateInterface {
5
+ input: string
6
+ label?: string
7
+ helperText: string
8
+ }
9
+
10
+ interface TextFieldStates {
11
+ error: StateInterface
12
+ default: StateInterface
13
+ disabled: StateInterface
14
+ }
15
+
16
+ export const TextFieldStates = (state: keyof TextFieldStates) => {
17
+ const theme = useTheme()
18
+ const states: TextFieldStates = {
19
+ error: {
20
+ input: `
21
+ border: 1px solid ${parseColor(theme.colors.danger200)};
22
+ color: ${parseColor(theme.colors.neutral1000)};
23
+ &:focus {
24
+ border-color: ${parseColor(theme.colors.danger200)};
25
+ box-shadow: 0 0 0 3px #DC262633;
26
+ }
27
+ `,
28
+ label: `color: ${parseColor(theme.colors.danger100)};`,
29
+ helperText: `color: ${parseColor(theme.colors.danger100)};`,
30
+ },
31
+ default: {
32
+ input: `
33
+ border: 1px solid #CFCFD1;
34
+ color: ${parseColor(theme.colors.neutral1000)};
35
+ &:focus {
36
+ border-color: ${parseColor(theme.colors.neutral700)};
37
+ box-shadow: 0 0 0 3px #A3A3A380;
38
+ }
39
+ `,
40
+ label: `color: ${parseColor(theme.colors.neutral1100)};`,
41
+ helperText: `color: ${parseColor(theme.colors.neutral800)};`,
42
+ },
43
+ disabled: {
44
+ input: `
45
+ color: ${parseColor(theme.colors.neutral1100)};
46
+ box-shadow: 0 1px 2px 0 #0000000D;
47
+ opacity: 0.5;
48
+ `,
49
+ helperText: `color: ${parseColor(theme.colors.neutral500)};`,
50
+ }
51
+ }
52
+ return states[state]
53
+ }
@@ -1,98 +1,81 @@
1
- import styled from 'styled-components'
2
- import {TextFieldSizeType} from './TextField.sizes'
3
- import {fontSize, fontWeight, lineHeight, spacing} from '@liguelead/foundation'
4
- import {StateInterface} from './TextField.states'
5
- import {parseColor} from '../../utils'
6
-
7
- interface StyledInputProps {
8
- size: TextFieldSizeType
9
- $themefication: StateInterface
10
- }
11
-
12
- export const InputWrapper = styled.div`
13
- position: relative;
14
- width: 100%;
15
- `
16
-
17
- export const FloatingLabel = styled.label`
18
- position: absolute;
19
- top: 50%;
20
- left: 12px;
21
- transform: translateY(-50%);
22
- font-weight: ${fontWeight.fontWeight600};
23
- transition: all 0.2s ease;
24
- pointer-events: none;
25
- background-color: white;
26
- padding: 0 4px;
27
- `
28
-
29
- export const HelperText = styled.span<{error?: boolean}>`
30
- font-size: ${fontSize.fontSize12}px;
31
- line-height: ${lineHeight.lineHeight12}px;
32
- padding-left: ${spacing.spacing16}px;
33
- `
34
-
35
- export const IconWrapper = styled.div<{$right?: boolean}>`
36
- display: flex;
37
- align-items: center;
38
- justify-content: space-between;
39
- position: absolute;
40
- top: 0px;
41
- height: 100%;
42
- cursor: pointer;
43
- ${({$right}) => ($right ? 'right: 0px;' : 'left: 0px;')}
44
- padding: 0px ${spacing.spacing16}px;
45
-
46
- & svg {
47
- width: 20px;
48
- height: 20px;
49
- fill: ${({theme}) => parseColor(theme.colors.neutral700)};
50
- transition: fill 0.2s ease;
51
- }
52
- `
53
-
54
- export const StyledInput = styled.input.withConfig({
55
- shouldForwardProp: prop => !['control', 'errors', 'rules'].includes(prop)
56
- })`
57
- width: 100%;
58
- border-radius: 4px;
59
- outline: none;
60
- transition: border-color 0.2s ease;
61
- background: transparent;
62
- `
63
-
64
- export const BorderWrapper = styled.div`
65
- position: absolute;
66
- top: 0;
67
- left: 0;
68
- right: 0;
69
- bottom: 0;
70
- pointer-events: none;
71
- border: 2px solid #ccc;
72
- border-radius: 4px;
73
- background-color: transparent;
74
- z-index: -1;
75
-
76
- ${StyledInput}:focus ~ & {
77
- border-color: ${({theme}) => theme.colors.primary};
78
- }
79
- `
80
-
81
- export const Wrapper = styled.div<StyledInputProps>`
82
- position: relative;
83
- width: 100%;
84
- ${({$themefication, size}) => `
85
- ${StyledInput} {
86
- ${$themefication.animation}
87
- ${$themefication.input}
88
- ${size.input}
89
- }
90
- ${FloatingLabel} {
91
- ${$themefication.label}
92
- ${size.label}
93
- }
94
- ${HelperText} {
95
- ${$themefication.label}
96
- }
97
- `}
98
- `
1
+ import styled from 'styled-components'
2
+ import { TextFieldSizeType } from './TextField.sizes'
3
+ import {
4
+ fontSize,
5
+ fontWeight,
6
+ lineHeight,
7
+ spacing
8
+ } from '@liguelead/foundation'
9
+ import { StateInterface } from './TextField.states'
10
+ import { parseColor } from '../../utils'
11
+
12
+ interface StyledInputProps {
13
+ size: TextFieldSizeType
14
+ $themefication: StateInterface
15
+ }
16
+
17
+ export const InputWrapper = styled.div`
18
+ position: relative;
19
+ width: 100%;
20
+ `
21
+
22
+ export const Label = styled.label`
23
+ display: block;
24
+ font-weight: ${fontWeight.fontWeight600};
25
+ margin-bottom: ${spacing.spacing4}px;
26
+ font-size: ${fontSize.fontSize14}px;
27
+ `
28
+
29
+ export const HelperText = styled.span<{ error?: boolean }>`
30
+ font-size: ${fontSize.fontSize12}px;
31
+ line-height: ${lineHeight.lineHeight16}px;
32
+ `
33
+
34
+ export const IconWrapper = styled.div<{ $right?: boolean }>`
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ position: absolute;
39
+ top: 0px;
40
+ height: 100%;
41
+ cursor: pointer;
42
+ ${({ $right }) => ($right ? 'right: 0px;' : 'left: 0px;')}
43
+ padding: 0px ${spacing.spacing16}px;
44
+
45
+ & svg {
46
+ width: 20px;
47
+ height: 20px;
48
+ fill: ${({ theme }) => parseColor(theme.colors.neutral700)};
49
+ transition: fill 0.2s ease;
50
+ }
51
+ `
52
+
53
+ export const StyledInput = styled.input.withConfig({
54
+ shouldForwardProp: prop => !['control', 'errors', 'rules'].includes(prop)
55
+ })`
56
+ width: 100%;
57
+ border-radius: 4px;
58
+ outline: none;
59
+ border: 1px solid #CFCFD1;
60
+ transition: border-color 0.2s ease;
61
+ background: transparent;
62
+ `
63
+
64
+
65
+ export const Wrapper = styled.div<StyledInputProps>`
66
+ position: relative;
67
+ width: 100%;
68
+ ${({ $themefication, size }) => `
69
+ ${StyledInput} {
70
+ ${$themefication.input}
71
+ ${size.input}
72
+ }
73
+ ${Label} {
74
+ ${$themefication.label}
75
+ ${size.label}
76
+ }
77
+ ${HelperText} {
78
+ ${$themefication.label}
79
+ }
80
+ `}
81
+ `
@@ -1,108 +1,105 @@
1
- import React, { forwardRef, useState } from 'react'
2
- import { TextFieldProps } from './TextField.types'
3
- import { StateInterface, TextFieldStates } from './TextField.states'
4
- import {
5
- FloatingLabel,
6
- HelperText,
7
- IconWrapper,
8
- InputWrapper,
9
- StyledInput,
10
- Wrapper
11
- } from './TextField.styles'
12
- import { textFieldSizes } from './TextField.sizes'
13
- import { Eye, EyeClosed } from '@phosphor-icons/react'
14
-
15
- export const getState = (disabled: boolean, error: boolean) => {
16
- if (disabled) return 'disabled'
17
- if (error) return 'error'
18
- return 'default'
19
- }
20
-
21
- const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
22
- (
23
- {
24
- className,
25
- disabled = false,
26
- error,
27
- handleLeftIcon,
28
- handleRightIcon,
29
- helperText,
30
- label,
31
- leftIcon,
32
- onChange,
33
- rightIcon,
34
- size = 'md',
35
- type = 'text',
36
- value,
37
- register,
38
- ...props
39
- },
40
- ref // A ref passada pelo componente pai
41
- ) => {
42
- const [passwordVisible, setPasswordVisible] = useState(
43
- type !== 'password'
44
- )
45
- const state = getState(disabled, !!error)
46
- const textFieldState: StateInterface = TextFieldStates(state)
47
- const textFieldSize = textFieldSizes(size, !!leftIcon, !!rightIcon)
48
-
49
- const togglePasswordVisibility = () => {
50
- setPasswordVisible(!passwordVisible)
51
- }
52
-
53
- const transformRightIcon = (
54
- type: string,
55
- rightIcon: React.ReactNode
56
- ) => {
57
- if (type === 'password') {
58
- return (
59
- <IconWrapper onClick={togglePasswordVisibility} $right>
60
- {passwordVisible ? <Eye /> : <EyeClosed />}
61
- </IconWrapper>
62
- )
63
- }
64
- return (
65
- <IconWrapper onClick={handleRightIcon} $right>
66
- {rightIcon}
67
- </IconWrapper>
68
- )
69
- }
70
-
71
- return (
72
- <Wrapper
73
- className={className}
74
- size={textFieldSize}
75
- $themefication={textFieldState}>
76
- <InputWrapper>
77
- {leftIcon && (
78
- <IconWrapper onClick={handleLeftIcon}>
79
- {leftIcon}
80
- </IconWrapper>
81
- )}
82
- {transformRightIcon(type, rightIcon)}
83
- <StyledInput
84
- ref={ref}
85
- type={passwordVisible ? 'text' : 'password'}
86
- value={value}
87
- placeholder=" "
88
- disabled={disabled}
89
- {...props}
90
- {...register}
91
- onChange={e => {
92
- register?.onChange(e)
93
- onChange?.(e)
94
- }}
95
- />
96
- <FloatingLabel>{label}</FloatingLabel>
97
- </InputWrapper>
98
- {(helperText || error) && (
99
- <HelperText>{error?.message || helperText}</HelperText>
100
- )}
101
- </Wrapper>
102
- )
103
- }
104
- )
105
-
106
- TextField.displayName = 'TextField'
107
-
108
- export default TextField
1
+ import React, { forwardRef, useState } from 'react'
2
+ import { TextFieldProps } from './TextField.types'
3
+ import { StateInterface, TextFieldStates } from './TextField.states'
4
+ import {
5
+ Label,
6
+ HelperText,
7
+ IconWrapper,
8
+ InputWrapper,
9
+ StyledInput,
10
+ Wrapper
11
+ } from './TextField.styles'
12
+ import { textFieldSizes } from './TextField.sizes'
13
+ import { Eye, EyeClosed } from '@phosphor-icons/react'
14
+ import getState from './utils/getState'
15
+
16
+ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
17
+ (
18
+ {
19
+ className,
20
+ disabled = false,
21
+ error,
22
+ handleLeftIcon,
23
+ handleRightIcon,
24
+ helperText,
25
+ label,
26
+ leftIcon,
27
+ onChange,
28
+ rightIcon,
29
+ size = 'md',
30
+ type = 'text',
31
+ value,
32
+ register,
33
+ placeholder,
34
+ ...props
35
+ },
36
+ ref
37
+ ) => {
38
+ const [passwordVisible, setPasswordVisible] = useState(
39
+ type !== 'password'
40
+ )
41
+ const state = getState(disabled, !!error)
42
+ const textFieldState: StateInterface = TextFieldStates(state)
43
+ const textFieldSize = textFieldSizes(size, !!leftIcon, !!rightIcon)
44
+
45
+ const togglePasswordVisibility = () => {
46
+ setPasswordVisible(!passwordVisible)
47
+ }
48
+
49
+ const transformRightIcon = (
50
+ type: string,
51
+ rightIcon: React.ReactNode
52
+ ) => {
53
+ if (type === 'password') {
54
+ return (
55
+ <IconWrapper onClick={togglePasswordVisibility} $right>
56
+ {passwordVisible ? <Eye /> : <EyeClosed />}
57
+ </IconWrapper>
58
+ )
59
+ }
60
+ return (
61
+ <IconWrapper onClick={handleRightIcon} $right>
62
+ {rightIcon}
63
+ </IconWrapper>
64
+ )
65
+ }
66
+
67
+ return (
68
+ <Wrapper
69
+ className={className}
70
+ size={textFieldSize}
71
+ $themefication={textFieldState}
72
+ >
73
+ <Label>{label}</Label>
74
+ <InputWrapper>
75
+ {leftIcon && (
76
+ <IconWrapper onClick={handleLeftIcon}>
77
+ {leftIcon}
78
+ </IconWrapper>
79
+ )}
80
+ {transformRightIcon(type, rightIcon)}
81
+ <StyledInput
82
+ ref={ref}
83
+ type={passwordVisible ? 'text' : 'password'}
84
+ value={value}
85
+ disabled={disabled}
86
+ placeholder={placeholder}
87
+ {...props}
88
+ {...register}
89
+ onChange={e => {
90
+ register?.onChange(e)
91
+ onChange?.(e)
92
+ }}
93
+ />
94
+ </InputWrapper>
95
+ {(helperText || error) && (
96
+ <HelperText>{error?.message || helperText}</HelperText>
97
+ )}
98
+ </Wrapper>
99
+ )
100
+ }
101
+ )
102
+
103
+ TextField.displayName = 'TextField'
104
+
105
+ export default TextField