@liguelead/design-system 0.0.16 → 0.0.17
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.
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from '@liguelead/foundation'
|
|
8
8
|
import { parseColor } from '../../utils'
|
|
9
9
|
import styled, { css } from 'styled-components'
|
|
10
|
-
import Text from '../Text'
|
|
11
10
|
|
|
12
11
|
export const CheckboxWrapper = styled.label`
|
|
13
12
|
display: flex;
|
|
@@ -33,9 +32,9 @@ export const CheckboxWrapper = styled.label`
|
|
|
33
32
|
export const CustomCheckbox = styled.span<{
|
|
34
33
|
checked: boolean
|
|
35
34
|
disabled?: boolean
|
|
36
|
-
|
|
35
|
+
$hasError?: boolean
|
|
37
36
|
}>`
|
|
38
|
-
${({ checked, theme, disabled,
|
|
37
|
+
${({ checked, theme, disabled, $hasError }) => css`
|
|
39
38
|
width: ${spacing.spacing16}px;
|
|
40
39
|
height: ${spacing.spacing16}px;
|
|
41
40
|
border: 1px solid ${checked
|
|
@@ -60,7 +59,7 @@ export const CustomCheckbox = styled.span<{
|
|
|
60
59
|
cursor: not-allowed;
|
|
61
60
|
`}
|
|
62
61
|
|
|
63
|
-
${
|
|
62
|
+
${$hasError &&
|
|
64
63
|
css`
|
|
65
64
|
border-color: ${parseColor(theme.colors.danger200)};
|
|
66
65
|
box-shadow: ${shadow.errorShadow};
|
|
@@ -100,7 +99,7 @@ export const RippleContainer = styled.span`
|
|
|
100
99
|
}
|
|
101
100
|
`
|
|
102
101
|
|
|
103
|
-
export const Label = styled.
|
|
102
|
+
export const Label = styled.label<{ disabled?: boolean }>`
|
|
104
103
|
font-size: ${fontSize.fontSize14}px;
|
|
105
104
|
font-weight: ${fontWeight.fontWeight500};
|
|
106
105
|
|
|
@@ -110,15 +109,15 @@ export const Label = styled.span<{ disabled?: boolean }>`
|
|
|
110
109
|
: parseColor(theme.colors.textDark)};
|
|
111
110
|
`
|
|
112
111
|
|
|
113
|
-
export const CustomLabel = styled
|
|
112
|
+
export const CustomLabel = styled.p<{ disabled?: boolean; $hasError?: boolean }>`
|
|
114
113
|
font-size: ${fontSize.fontSize12}px;
|
|
115
114
|
font-weight: ${fontWeight.fontWeight400};
|
|
116
115
|
line-height: 8px;
|
|
117
116
|
|
|
118
|
-
color: ${({ theme, disabled,
|
|
117
|
+
color: ${({ theme, disabled, $hasError }) =>
|
|
119
118
|
disabled
|
|
120
119
|
? `${parseColor(theme.colors.textMedium)}70`
|
|
121
|
-
:
|
|
120
|
+
: $hasError
|
|
122
121
|
? parseColor(theme.colors.danger200)
|
|
123
122
|
: parseColor(theme.colors.textMedium)};
|
|
124
123
|
`
|
|
@@ -21,9 +21,9 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
21
21
|
disabled = false,
|
|
22
22
|
register,
|
|
23
23
|
className,
|
|
24
|
-
error,
|
|
25
24
|
children,
|
|
26
25
|
description,
|
|
26
|
+
$hasError,
|
|
27
27
|
...rest
|
|
28
28
|
}) => {
|
|
29
29
|
const [internalChecked, setInternalChecked] = useState<boolean>(
|
|
@@ -66,7 +66,7 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
66
66
|
<CustomCheckbox
|
|
67
67
|
checked={internalChecked}
|
|
68
68
|
disabled={disabled}
|
|
69
|
-
|
|
69
|
+
$hasError={$hasError}
|
|
70
70
|
onClick={handleRipple}>
|
|
71
71
|
{ripples.map(ripple => (
|
|
72
72
|
<RippleContainer
|
|
@@ -85,9 +85,9 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
85
85
|
</CustomCheckbox>
|
|
86
86
|
<div>
|
|
87
87
|
{label ? <Label disabled={disabled}>{label}</Label> : children}
|
|
88
|
-
{(description ||
|
|
89
|
-
<CustomLabel disabled={disabled}
|
|
90
|
-
{
|
|
88
|
+
{(description || $hasError) && (
|
|
89
|
+
<CustomLabel disabled={disabled} $hasError={$hasError}>
|
|
90
|
+
{description}
|
|
91
91
|
</CustomLabel>
|
|
92
92
|
)}
|
|
93
93
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UseFormRegisterReturn } from 'react-hook-form'
|
|
2
2
|
|
|
3
|
-
export interface CheckboxProps
|
|
3
|
+
export interface CheckboxProps {
|
|
4
4
|
label?: string
|
|
5
5
|
checked?: boolean
|
|
6
|
-
|
|
6
|
+
$hasError?: boolean
|
|
7
7
|
description?: string
|
|
8
8
|
children?: React.ReactNode
|
|
9
9
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components'
|
|
2
2
|
import { parseColor } from '../../utils'
|
|
3
3
|
import { ToastContainer } from 'react-toastify'
|
|
4
|
+
import { spacing, fontSize, radius, fontWeight } from "@liguelead/foundation"
|
|
4
5
|
|
|
5
6
|
export const ToasterStyledContainer = styled(ToastContainer)`
|
|
6
7
|
${({ theme }) => css`
|
|
7
8
|
|
|
9
|
+
.Toastify__toast {
|
|
10
|
+
border-radius: ${radius.radius4}px;
|
|
11
|
+
font-size: ${fontSize.fontSize14}px;
|
|
12
|
+
white-space: pre-line;
|
|
13
|
+
color: ${parseColor(theme.colors?.textDark)};
|
|
14
|
+
font-weight: ${fontWeight.fontWeight500};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.Toastify__toast-icon {
|
|
18
|
+
width: ${spacing.spacing20}px;
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
/* Colored Theme */
|
|
9
22
|
|
|
10
23
|
.Toastify__toast-theme--colored.Toastify__toast--success {
|