@dafaz-ui/react 4.0.19 → 7.0.0
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +61 -0
- package/dist/index.d.mts +678 -42
- package/dist/index.d.ts +678 -42
- package/dist/index.js +782 -147
- package/dist/index.mjs +786 -149
- package/package.json +1 -1
- package/src/components/Box/styles.ts +64 -10
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Button/styles.ts +14 -7
- package/src/components/CheckBox/index.tsx +10 -26
- package/src/components/CheckBox/styles.ts +3 -1
- package/src/components/Heading/index.tsx +1 -1
- package/src/components/Heading/styles.ts +29 -15
- package/src/components/MultiSelect/index.tsx +234 -0
- package/src/components/MultiSelect/styles.ts +146 -0
- package/src/components/Radio/RadioItem/index.tsx +6 -4
- package/src/components/Radio/RadioItem/styles.ts +4 -1
- package/src/components/Radio/index.tsx +38 -23
- package/src/components/Radio/styles.ts +2 -1
- package/src/components/Select/index.tsx +49 -35
- package/src/components/Select/styles.ts +79 -12
- package/src/components/Separator/index.tsx +7 -0
- package/src/components/Separator/styles.ts +51 -0
- package/src/components/Text/index.tsx +3 -2
- package/src/components/Text/styles.ts +24 -3
- package/src/components/TextArea/index.tsx +17 -9
- package/src/components/TextArea/styles.ts +7 -2
- package/src/components/TextInput/index.tsx +38 -4
- package/src/components/TextInput/styles.ts +60 -3
- package/src/index.tsx +2 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ComponentProps } from 'react'
|
1
|
+
import type { ComponentProps, CSSProperties } from 'react'
|
2
2
|
import { styled } from '../../styles'
|
3
3
|
|
4
4
|
export const TextAreaUI = styled('textarea', {
|
@@ -8,6 +8,7 @@ export const TextAreaUI = styled('textarea', {
|
|
8
8
|
fontWeight: '$regular',
|
9
9
|
resize: 'vertical',
|
10
10
|
|
11
|
+
boxShadow: '0 3px 2px -2px $colors$gray400',
|
11
12
|
border: '0.7px solid $gray400',
|
12
13
|
|
13
14
|
margin: 0,
|
@@ -19,9 +20,11 @@ export const TextAreaUI = styled('textarea', {
|
|
19
20
|
alignItems: 'baseline',
|
20
21
|
width: '100%',
|
21
22
|
padding: '$1 $2',
|
23
|
+
transition: 'border 0.2s linear',
|
22
24
|
|
23
25
|
'&:focus': {
|
24
26
|
outline: 0,
|
27
|
+
borderBottom: '2px solid $dafaz400',
|
25
28
|
},
|
26
29
|
|
27
30
|
'&:disabled': {
|
@@ -37,4 +40,6 @@ export const TextAreaUI = styled('textarea', {
|
|
37
40
|
},
|
38
41
|
})
|
39
42
|
|
40
|
-
export interface TextAreaUIProps extends ComponentProps<typeof TextAreaUI> {
|
43
|
+
export interface TextAreaUIProps extends ComponentProps<typeof TextAreaUI> {
|
44
|
+
style?: CSSProperties
|
45
|
+
}
|
@@ -4,16 +4,20 @@ import {
|
|
4
4
|
ComponentProps,
|
5
5
|
ElementRef,
|
6
6
|
type ChangeEvent,
|
7
|
+
type CSSProperties,
|
7
8
|
} from 'react'
|
8
9
|
import { InputContainer, InputUI, Sufix } from './styles'
|
10
|
+
import { Eye, EyeSlash } from '@phosphor-icons/react'
|
9
11
|
|
10
12
|
export interface TextInputProps extends ComponentProps<typeof InputUI> {
|
13
|
+
size?: 'lg' | 'md' | 'sm'
|
11
14
|
required?: boolean
|
12
15
|
requiredText?: string
|
13
16
|
withShadow?: boolean
|
14
17
|
placeholder?: string
|
15
|
-
type?:
|
16
|
-
|
18
|
+
type?: React.HTMLInputTypeAttribute | undefined
|
19
|
+
style?: CSSProperties
|
20
|
+
id?: string
|
17
21
|
}
|
18
22
|
|
19
23
|
export const TextInput = forwardRef<ElementRef<typeof InputUI>, TextInputProps>(
|
@@ -23,11 +27,14 @@ export const TextInput = forwardRef<ElementRef<typeof InputUI>, TextInputProps>(
|
|
23
27
|
required = true,
|
24
28
|
requiredText = 'Opcional',
|
25
29
|
id,
|
30
|
+
type = 'text',
|
31
|
+
size,
|
26
32
|
...props
|
27
33
|
}: TextInputProps,
|
28
34
|
ref,
|
29
35
|
) => {
|
30
36
|
const [hiddenOptional, setHiddenOptional] = useState(required)
|
37
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false)
|
31
38
|
|
32
39
|
function handleOnChange(event: ChangeEvent<HTMLInputElement>) {
|
33
40
|
if (!required) {
|
@@ -40,13 +47,40 @@ export const TextInput = forwardRef<ElementRef<typeof InputUI>, TextInputProps>(
|
|
40
47
|
}
|
41
48
|
|
42
49
|
return (
|
43
|
-
<InputContainer withShadow={withShadow}>
|
44
|
-
<InputUI
|
50
|
+
<InputContainer size={size} withShadow={withShadow}>
|
51
|
+
<InputUI
|
52
|
+
id={id}
|
53
|
+
ref={ref}
|
54
|
+
size={size}
|
55
|
+
onChange={handleOnChange}
|
56
|
+
type={!isPasswordVisible ? type : 'text'}
|
57
|
+
{...props}
|
58
|
+
/>
|
45
59
|
{!hiddenOptional && (
|
46
60
|
<Sufix style={{ marginLeft: `-${requiredText.length / 2}rem` }}>
|
47
61
|
{requiredText}
|
48
62
|
</Sufix>
|
49
63
|
)}
|
64
|
+
{type === 'password' && isPasswordVisible && (
|
65
|
+
<button
|
66
|
+
type="button"
|
67
|
+
onClick={() => {
|
68
|
+
setIsPasswordVisible(false)
|
69
|
+
}}
|
70
|
+
>
|
71
|
+
<EyeSlash size={24} />
|
72
|
+
</button>
|
73
|
+
)}
|
74
|
+
{type === 'password' && !isPasswordVisible && (
|
75
|
+
<button
|
76
|
+
type="button"
|
77
|
+
onClick={() => {
|
78
|
+
setIsPasswordVisible(true)
|
79
|
+
}}
|
80
|
+
>
|
81
|
+
<Eye size={24} />
|
82
|
+
</button>
|
83
|
+
)}
|
50
84
|
</InputContainer>
|
51
85
|
)
|
52
86
|
},
|
@@ -7,9 +7,10 @@ export const InputContainer = styled('div', {
|
|
7
7
|
borderRadius: '$md',
|
8
8
|
boxSizing: 'border-box',
|
9
9
|
display: 'flex',
|
10
|
-
alignItems: 'baseline',
|
11
10
|
width: '100%',
|
12
11
|
|
12
|
+
boxShadow: '0 3px 2px -2px $colors$gray400',
|
13
|
+
|
13
14
|
transition: 'border 0.2s linear',
|
14
15
|
|
15
16
|
'&:has(input:focus)': {
|
@@ -21,7 +22,42 @@ export const InputContainer = styled('div', {
|
|
21
22
|
cursor: 'not-allowed',
|
22
23
|
},
|
23
24
|
|
25
|
+
button: {
|
26
|
+
border: 0,
|
27
|
+
background: 'none',
|
28
|
+
marginRight: '0.5rem',
|
29
|
+
cursor: 'pointer',
|
30
|
+
|
31
|
+
svg: {
|
32
|
+
opacity: 0.75,
|
33
|
+
color: '$white',
|
34
|
+
marginBottom: '-0.3rem',
|
35
|
+
},
|
36
|
+
},
|
24
37
|
variants: {
|
38
|
+
size: {
|
39
|
+
lg: {
|
40
|
+
fontSize: '$xl',
|
41
|
+
svg: {
|
42
|
+
width: '$5',
|
43
|
+
height: '$5',
|
44
|
+
},
|
45
|
+
},
|
46
|
+
md: {
|
47
|
+
fontSize: '$lg',
|
48
|
+
svg: {
|
49
|
+
width: '$5',
|
50
|
+
height: '$5',
|
51
|
+
},
|
52
|
+
},
|
53
|
+
sm: {
|
54
|
+
fontSize: '$md',
|
55
|
+
svg: {
|
56
|
+
width: '$4',
|
57
|
+
height: '$4',
|
58
|
+
},
|
59
|
+
},
|
60
|
+
},
|
25
61
|
withShadow: {
|
26
62
|
true: {
|
27
63
|
boxShadow: 'inset 0 3rem #444',
|
@@ -29,6 +65,7 @@ export const InputContainer = styled('div', {
|
|
29
65
|
},
|
30
66
|
},
|
31
67
|
defaultVariants: {
|
68
|
+
size: 'lg',
|
32
69
|
withShadow: false,
|
33
70
|
},
|
34
71
|
})
|
@@ -36,7 +73,6 @@ export const InputContainer = styled('div', {
|
|
36
73
|
export const InputUI = styled('input', {
|
37
74
|
margin: 0,
|
38
75
|
fontFamily: '$app',
|
39
|
-
fontSize: '$xl',
|
40
76
|
color: '$white',
|
41
77
|
backgroundColor: 'transparent',
|
42
78
|
border: 'none',
|
@@ -44,7 +80,11 @@ export const InputUI = styled('input', {
|
|
44
80
|
padding: '$1 $2',
|
45
81
|
|
46
82
|
'&::-ms-reveal': {
|
47
|
-
|
83
|
+
display: 'none',
|
84
|
+
},
|
85
|
+
|
86
|
+
'&::-ms-clear': {
|
87
|
+
display: 'none',
|
48
88
|
},
|
49
89
|
|
50
90
|
'&::placeholder': {
|
@@ -56,6 +96,23 @@ export const InputUI = styled('input', {
|
|
56
96
|
'&:focus': {
|
57
97
|
outline: 0,
|
58
98
|
},
|
99
|
+
|
100
|
+
variants: {
|
101
|
+
size: {
|
102
|
+
lg: {
|
103
|
+
fontSize: '$xl',
|
104
|
+
},
|
105
|
+
md: {
|
106
|
+
fontSize: '$lg',
|
107
|
+
},
|
108
|
+
sm: {
|
109
|
+
fontSize: '$md',
|
110
|
+
},
|
111
|
+
},
|
112
|
+
},
|
113
|
+
defaultVariants: {
|
114
|
+
size: 'lg',
|
115
|
+
},
|
59
116
|
})
|
60
117
|
|
61
118
|
export const Sufix = styled('span', {
|
package/src/index.tsx
CHANGED
@@ -4,8 +4,10 @@ export * from './components/CheckBox'
|
|
4
4
|
export * from './components/Heading'
|
5
5
|
export * from './components/Radio'
|
6
6
|
export * from './components/Select'
|
7
|
+
export * from './components/Separator'
|
7
8
|
export * from './components/Text'
|
8
9
|
export * from './components/TextArea'
|
9
10
|
export * from './components/TextInput'
|
11
|
+
export * from './components/MultiSelect'
|
10
12
|
|
11
13
|
export * from './styles'
|