@liguelead/design-system 0.0.7 → 0.0.8
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/components/Button/Button.styles.ts +3 -3
- package/components/Button/Button.tsx +62 -56
- package/components/Button/Button.types.ts +2 -1
- package/components/Checkbox/Checkbox.styles.ts +66 -0
- package/components/Checkbox/Checkbox.tsx +40 -0
- package/components/Checkbox/Checkbox.types.ts +11 -0
- package/components/Checkbox/index.tsx +2 -0
- package/components/DatePicker/DatePicker.styles.ts +66 -0
- package/components/DatePicker/DatePicker.tsx +135 -0
- package/components/DatePicker/DatePicker.types.ts +29 -0
- package/components/DatePicker/index.ts +1 -0
- package/components/IconButton/IconButton.tsx +53 -50
- package/components/SegmentedButton/SegmentedButton.styles.ts +29 -0
- package/components/SegmentedButton/SegmentedButton.tsx +49 -0
- package/components/SegmentedButton/SegmentedButton.types.ts +20 -0
- package/components/SegmentedButton/index.ts +1 -0
- package/components/Select/Select.sizes.ts +56 -0
- package/components/Select/Select.states.tsx +69 -0
- package/components/Select/Select.styles.ts +148 -0
- package/components/Select/Select.tsx +144 -0
- package/components/Select/Select.types.ts +36 -0
- package/components/Select/index.ts +1 -0
- package/components/Text/Text.styles.ts +5 -5
- package/components/Text/Text.tsx +4 -42
- package/components/Text/Text.types.ts +42 -0
- package/components/TextField/TextField.tsx +7 -2
- package/components/TextField/TextField.types.ts +2 -1
- package/components/ThemeProvider/ThemeProvider.tsx +11 -20
- package/components/ThemeProvider/style.ts +781 -12
- package/components/index.ts +4 -0
- package/package.json +4 -2
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { textFieldSizes } from './TextField.sizes'
|
|
13
13
|
import { Eye, EyeClosed } from '@phosphor-icons/react'
|
|
14
14
|
|
|
15
|
-
const getState = (disabled: boolean, error: boolean) => {
|
|
15
|
+
export const getState = (disabled: boolean, error: boolean) => {
|
|
16
16
|
if (disabled) return 'disabled'
|
|
17
17
|
if (error) return 'error'
|
|
18
18
|
return 'default'
|
|
@@ -34,6 +34,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
34
34
|
size = 'md',
|
|
35
35
|
type = 'text',
|
|
36
36
|
value,
|
|
37
|
+
register,
|
|
37
38
|
...props
|
|
38
39
|
},
|
|
39
40
|
ref // A ref passada pelo componente pai
|
|
@@ -83,10 +84,14 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
83
84
|
ref={ref}
|
|
84
85
|
type={passwordVisible ? 'text' : 'password'}
|
|
85
86
|
value={value}
|
|
86
|
-
onChange={onChange}
|
|
87
87
|
placeholder=" "
|
|
88
88
|
disabled={disabled}
|
|
89
89
|
{...props}
|
|
90
|
+
{...register}
|
|
91
|
+
onChange={e => {
|
|
92
|
+
register?.onChange(e)
|
|
93
|
+
onChange?.(e)
|
|
94
|
+
}}
|
|
90
95
|
/>
|
|
91
96
|
<FloatingLabel>{label}</FloatingLabel>
|
|
92
97
|
</InputWrapper>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldValues } from 'react-hook-form'
|
|
1
|
+
import { FieldValues, UseFormRegisterReturn } from 'react-hook-form'
|
|
2
2
|
import { TextFieldSize } from './TextField.sizes'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
@@ -17,4 +17,5 @@ export interface TextFieldProps<TFieldValues extends FieldValues = FieldValues>
|
|
|
17
17
|
rightIcon?: React.ReactNode
|
|
18
18
|
error?: TFieldValues
|
|
19
19
|
type?: 'text' | 'password' | 'email' | 'number'
|
|
20
|
+
register?: UseFormRegisterReturn<string>
|
|
20
21
|
}
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { ThemeProvider as StyledTheme } from 'styled-components'
|
|
2
|
-
import { themes} from '@liguelead/foundation'
|
|
3
|
-
import { SpaThemeTypes } from '@liguelead/foundation/src/themes/spa'
|
|
2
|
+
import { themes } from '@liguelead/foundation'
|
|
4
3
|
import { globalStyle as Reset } from './style'
|
|
5
4
|
|
|
6
|
-
|
|
7
5
|
interface ThemeProviderProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type SpaTheme = SpaThemeTypes
|
|
13
|
-
|
|
14
|
-
declare module 'styled-components' {
|
|
15
|
-
export interface DefaultTheme extends SpaTheme{}
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
theme?: 'spa'
|
|
16
8
|
}
|
|
17
9
|
|
|
18
10
|
const ThemeProvider = ({ children, theme }: ThemeProviderProps) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
11
|
+
const appliedTheme = theme ? themes[theme] : themes['spa']
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<StyledTheme theme={appliedTheme}>
|
|
15
|
+
<Reset />
|
|
16
|
+
{children}
|
|
17
|
+
</StyledTheme>
|
|
18
|
+
)
|
|
28
19
|
}
|
|
29
20
|
|
|
30
21
|
export default ThemeProvider
|