@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.
- package/components/Button/Button.appearance.ts +66 -62
- package/components/Button/Button.sizes.ts +42 -41
- package/components/Button/Button.styles.ts +46 -50
- package/components/Button/Button.tsx +76 -76
- package/components/Button/Button.types.ts +23 -23
- package/components/Button/index.ts +1 -1
- package/components/Checkbox/Checkbox.styles.ts +115 -66
- package/components/Checkbox/Checkbox.tsx +97 -40
- package/components/Checkbox/Checkbox.types.ts +12 -11
- package/components/Checkbox/index.tsx +2 -2
- package/components/DatePicker/DatePicker.styles.ts +66 -66
- package/components/DatePicker/DatePicker.tsx +135 -135
- package/components/DatePicker/DatePicker.types.ts +29 -29
- package/components/DatePicker/index.ts +1 -1
- package/components/IconButton/IconButton.sizes.ts +34 -41
- package/components/IconButton/IconButton.tsx +70 -70
- package/components/IconButton/index.ts +1 -1
- package/components/InputOpt/InputOpt.styles.ts +75 -0
- package/components/InputOpt/InputOpt.tsx +153 -0
- package/components/InputOpt/InputOpt.types.ts +14 -0
- package/components/InputOpt/index.ts +1 -0
- package/components/InputOpt/utils/focusManagement.ts +31 -0
- package/components/InputOpt/utils/index.ts +2 -0
- package/components/InputOpt/utils/inputValidation.ts +14 -0
- package/components/LinkButton/LinkButton.size.ts +39 -0
- package/components/LinkButton/LinkButton.style.ts +45 -0
- package/components/LinkButton/LinkButton.tsx +75 -0
- package/components/LinkButton/LinkButton.types.ts +11 -0
- package/components/LinkButton/index.ts +1 -0
- package/components/PageWrapper/PageWrapper.tsx +31 -31
- package/components/PageWrapper/index.ts +1 -1
- package/components/RadioButton/RadioButton.inputVariants.ts +133 -0
- package/components/RadioButton/RadioButton.styles.ts +78 -0
- package/components/RadioButton/RadioButton.tsx +88 -0
- package/components/RadioButton/RadioButton.types.ts +33 -0
- package/components/RadioButton/RadioButton.variants.ts +67 -0
- package/components/RadioButton/index.ts +1 -0
- package/components/SegmentedButton/SegmentedButton.styles.ts +29 -29
- package/components/SegmentedButton/SegmentedButton.tsx +43 -49
- package/components/SegmentedButton/SegmentedButton.types.ts +20 -20
- package/components/SegmentedButton/index.ts +1 -1
- package/components/Select/Select.sizes.ts +55 -56
- package/components/Select/Select.states.tsx +40 -69
- package/components/Select/Select.styles.ts +162 -148
- package/components/Select/Select.tsx +152 -144
- package/components/Select/Select.types.ts +35 -36
- package/components/Select/index.ts +1 -1
- package/components/Text/Text.styles.ts +46 -43
- package/components/Text/Text.tsx +27 -27
- package/components/Text/Text.types.ts +44 -42
- package/components/Text/index.ts +1 -1
- package/components/TextField/TextField.sizes.ts +52 -58
- package/components/TextField/TextField.states.tsx +53 -76
- package/components/TextField/TextField.styles.ts +85 -98
- package/components/TextField/TextField.tsx +108 -108
- package/components/TextField/TextField.types.ts +22 -21
- package/components/TextField/index.ts +2 -2
- package/components/TextField/utils/getState.ts +7 -0
- package/components/ThemeProvider/ThemeProvider.tsx +21 -21
- package/components/ThemeProvider/index.ts +1 -1
- package/components/ThemeProvider/style.ts +969 -969
- package/components/Wizard/StepContent.tsx +28 -28
- package/components/Wizard/StepMenuItem.tsx +33 -33
- package/components/Wizard/Wizard.context.tsx +76 -76
- package/components/Wizard/Wizard.styles.ts +126 -126
- package/components/Wizard/Wizard.tsx +55 -55
- package/components/Wizard/index.ts +1 -1
- package/components/index.ts +14 -11
- package/package.json +41 -41
- package/scripts/createTypes.js +70 -70
- package/utils/colorDarken.ts +10 -10
- package/utils/colorLighten.ts +10 -10
- package/utils/darkenOrLighen.ts +19 -19
- package/utils/getTextColor.ts +12 -12
- package/utils/index.ts +5 -5
- package/utils/parseColor.ts +7 -7
|
@@ -1,98 +1,85 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import {TextFieldSizeType} from './TextField.sizes'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const
|
|
18
|
-
position:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`
|
|
28
|
-
|
|
29
|
-
export const HelperText = styled.span<{error?: boolean}>`
|
|
30
|
-
font-size: ${fontSize.fontSize12}px;
|
|
31
|
-
line-height: ${lineHeight.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
transition: border-color 0.2s ease;
|
|
61
|
-
background: transparent;
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
${({
|
|
85
|
-
|
|
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
|
+
`
|
|
82
|
+
|
|
83
|
+
export const RequiredAsterisk = styled.span`
|
|
84
|
+
color: ${({ theme }) => parseColor(theme.colors.primary)};
|
|
85
|
+
`
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import React, { forwardRef, useState } from 'react'
|
|
2
|
-
import { TextFieldProps } from './TextField.types'
|
|
3
|
-
import { StateInterface, TextFieldStates } from './TextField.states'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
HelperText,
|
|
7
|
-
IconWrapper,
|
|
8
|
-
InputWrapper,
|
|
9
|
-
StyledInput,
|
|
10
|
-
Wrapper
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
disabled={disabled}
|
|
89
|
-
{
|
|
90
|
-
{...
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
onChange
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
+
RequiredAsterisk
|
|
12
|
+
} from './TextField.styles'
|
|
13
|
+
import { textFieldSizes } from './TextField.sizes'
|
|
14
|
+
import { Eye, EyeClosed } from '@phosphor-icons/react'
|
|
15
|
+
import getState from './utils/getState'
|
|
16
|
+
|
|
17
|
+
const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
className,
|
|
21
|
+
disabled = false,
|
|
22
|
+
error,
|
|
23
|
+
handleLeftIcon,
|
|
24
|
+
handleRightIcon,
|
|
25
|
+
helperText,
|
|
26
|
+
label,
|
|
27
|
+
leftIcon,
|
|
28
|
+
onChange,
|
|
29
|
+
rightIcon,
|
|
30
|
+
size = 'md',
|
|
31
|
+
type = 'text',
|
|
32
|
+
value,
|
|
33
|
+
register,
|
|
34
|
+
placeholder,
|
|
35
|
+
...props
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const [passwordVisible, setPasswordVisible] = useState(
|
|
40
|
+
type !== 'password'
|
|
41
|
+
)
|
|
42
|
+
const state = getState(disabled, !!error)
|
|
43
|
+
const textFieldState: StateInterface = TextFieldStates(state)
|
|
44
|
+
const textFieldSize = textFieldSizes(size, !!leftIcon, !!rightIcon)
|
|
45
|
+
|
|
46
|
+
const togglePasswordVisibility = () => {
|
|
47
|
+
setPasswordVisible(!passwordVisible)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const transformRightIcon = (
|
|
51
|
+
type: string,
|
|
52
|
+
rightIcon: React.ReactNode
|
|
53
|
+
) => {
|
|
54
|
+
if (type === 'password') {
|
|
55
|
+
return (
|
|
56
|
+
<IconWrapper onClick={togglePasswordVisibility} $right>
|
|
57
|
+
{passwordVisible ? <Eye /> : <EyeClosed />}
|
|
58
|
+
</IconWrapper>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<IconWrapper onClick={handleRightIcon} $right>
|
|
63
|
+
{rightIcon}
|
|
64
|
+
</IconWrapper>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<Wrapper
|
|
70
|
+
className={className}
|
|
71
|
+
size={textFieldSize}
|
|
72
|
+
$themefication={textFieldState}
|
|
73
|
+
>
|
|
74
|
+
<Label>
|
|
75
|
+
{label} {props.required && <RequiredAsterisk>*</RequiredAsterisk>}
|
|
76
|
+
</Label>
|
|
77
|
+
<InputWrapper>
|
|
78
|
+
{leftIcon && (
|
|
79
|
+
<IconWrapper onClick={handleLeftIcon}>
|
|
80
|
+
{leftIcon}
|
|
81
|
+
</IconWrapper>
|
|
82
|
+
)}
|
|
83
|
+
{transformRightIcon(type, rightIcon)}
|
|
84
|
+
<StyledInput
|
|
85
|
+
ref={ref}
|
|
86
|
+
type={passwordVisible ? 'text' : 'password'}
|
|
87
|
+
value={value}
|
|
88
|
+
disabled={disabled}
|
|
89
|
+
placeholder={placeholder}
|
|
90
|
+
{...props}
|
|
91
|
+
{...register}
|
|
92
|
+
onChange={e => {
|
|
93
|
+
register?.onChange(e)
|
|
94
|
+
onChange?.(e)
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
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,21 +1,22 @@
|
|
|
1
|
-
import { FieldValues, UseFormRegisterReturn } from 'react-hook-form'
|
|
2
|
-
import { TextFieldSize } from './TextField.sizes'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface TextFieldProps<TFieldValues extends FieldValues = FieldValues>
|
|
6
|
-
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
7
|
-
label: string
|
|
8
|
-
value?: string
|
|
9
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
10
|
-
handleLeftIcon?: () => void
|
|
11
|
-
handleRightIcon?: () => void
|
|
12
|
-
helperText?: string
|
|
13
|
-
size?: TextFieldSize
|
|
14
|
-
className?: string
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { FieldValues, UseFormRegisterReturn } from 'react-hook-form'
|
|
2
|
+
import { TextFieldSize } from './TextField.sizes'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
export interface TextFieldProps<TFieldValues extends FieldValues = FieldValues>
|
|
6
|
+
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
7
|
+
label: string
|
|
8
|
+
value?: string
|
|
9
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
10
|
+
handleLeftIcon?: () => void
|
|
11
|
+
handleRightIcon?: () => void
|
|
12
|
+
helperText?: string
|
|
13
|
+
size?: TextFieldSize
|
|
14
|
+
className?: string
|
|
15
|
+
placeholder?: string
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
leftIcon?: React.ReactNode
|
|
18
|
+
rightIcon?: React.ReactNode
|
|
19
|
+
error?: TFieldValues
|
|
20
|
+
type?: 'text' | 'password' | 'email' | 'number'
|
|
21
|
+
register?: UseFormRegisterReturn<string>
|
|
22
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './TextField'
|
|
2
|
-
export type { TextFieldProps } from './TextField.types'
|
|
1
|
+
export { default } from './TextField'
|
|
2
|
+
export type { TextFieldProps } from './TextField.types'
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ThemeProvider as StyledTheme } from 'styled-components'
|
|
2
|
-
import { themes } from '@liguelead/foundation'
|
|
3
|
-
import { globalStyle as Reset } from './style'
|
|
4
|
-
|
|
5
|
-
interface ThemeProviderProps {
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
theme?: 'spa'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const ThemeProvider = ({ children, theme }: ThemeProviderProps) => {
|
|
11
|
-
const appliedTheme = theme ? themes[theme] : themes['spa']
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<StyledTheme theme={appliedTheme}>
|
|
15
|
-
<Reset />
|
|
16
|
-
{children}
|
|
17
|
-
</StyledTheme>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default ThemeProvider
|
|
1
|
+
import { ThemeProvider as StyledTheme } from 'styled-components'
|
|
2
|
+
import { themes } from '@liguelead/foundation'
|
|
3
|
+
import { globalStyle as Reset } from './style'
|
|
4
|
+
|
|
5
|
+
interface ThemeProviderProps {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
theme?: 'spa'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ThemeProvider = ({ children, theme }: ThemeProviderProps) => {
|
|
11
|
+
const appliedTheme = theme ? themes[theme] : themes['spa']
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<StyledTheme theme={appliedTheme}>
|
|
15
|
+
<Reset />
|
|
16
|
+
{children}
|
|
17
|
+
</StyledTheme>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default ThemeProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './ThemeProvider'
|
|
1
|
+
export { default } from './ThemeProvider'
|