@granto-umbrella/umbrella-components 3.0.57 → 3.0.58
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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
2
|
import {
|
|
3
3
|
primitiveSizes,
|
|
4
4
|
semanticBorders,
|
|
@@ -9,6 +9,37 @@ import {
|
|
|
9
9
|
} from '../../../styles/tokens';
|
|
10
10
|
import CreatableSelect from 'react-select/creatable';
|
|
11
11
|
|
|
12
|
+
type SelectSize = 'sm' | 'md' | 'lg';
|
|
13
|
+
|
|
14
|
+
const sizeStyles: Record<
|
|
15
|
+
SelectSize,
|
|
16
|
+
{
|
|
17
|
+
minHeight: string;
|
|
18
|
+
paddingY: string;
|
|
19
|
+
paddingX: string;
|
|
20
|
+
fontSize: string;
|
|
21
|
+
}
|
|
22
|
+
> = {
|
|
23
|
+
sm: {
|
|
24
|
+
minHeight: primitiveSizes.size.x10, // ex: 40px
|
|
25
|
+
paddingY: primitiveSizes.size.x1, // ex: 4px
|
|
26
|
+
paddingX: primitiveSizes.size.x2, // ex: 8px
|
|
27
|
+
fontSize: typographyTokens.fontSizes.bodyS,
|
|
28
|
+
},
|
|
29
|
+
md: {
|
|
30
|
+
minHeight: primitiveSizes.size.x12, // ex: 48px
|
|
31
|
+
paddingY: primitiveSizes.size.x2, // ex: 8px
|
|
32
|
+
paddingX: primitiveSizes.size.x3, // ex: 12px
|
|
33
|
+
fontSize: typographyTokens.fontSizes.bodyM,
|
|
34
|
+
},
|
|
35
|
+
lg: {
|
|
36
|
+
minHeight: primitiveSizes.size.x14, // ex: 56px
|
|
37
|
+
paddingY: primitiveSizes.size.x3, // ex: 12px
|
|
38
|
+
paddingX: primitiveSizes.size.x4, // ex: 16px
|
|
39
|
+
fontSize: typographyTokens.fontSizes.bodyL,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
12
43
|
export const Container = styled.div`
|
|
13
44
|
display: flex;
|
|
14
45
|
flex-direction: column;
|
|
@@ -32,19 +63,39 @@ export const SupportingText = styled.span<{ $error?: boolean }>`
|
|
|
32
63
|
|
|
33
64
|
export const CustomSelect = styled(CreatableSelect)<{
|
|
34
65
|
$error?: boolean;
|
|
35
|
-
$size?:
|
|
66
|
+
$size?: SelectSize;
|
|
36
67
|
}>`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
$
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
${({ $size = 'md', $error }) => {
|
|
69
|
+
const size = sizeStyles[$size];
|
|
70
|
+
|
|
71
|
+
return css`
|
|
72
|
+
.react-select__control {
|
|
73
|
+
min-height: ${size.minHeight};
|
|
74
|
+
border-radius: ${semanticRadius.global.radius.md};
|
|
75
|
+
border: ${semanticBorders.global.sm} solid
|
|
76
|
+
${$error
|
|
77
|
+
? semanticColors.global.border.danger.enabled
|
|
78
|
+
: semanticColors.global.border.medium};
|
|
79
|
+
|
|
80
|
+
&:focus-within {
|
|
81
|
+
box-shadow: ${semanticShadows.shadow.md};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.react-select__value-container {
|
|
86
|
+
padding: ${size.paddingY} ${size.paddingX};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.react-select__single-value,
|
|
90
|
+
.react-select__placeholder,
|
|
91
|
+
.react-select__input-container {
|
|
92
|
+
font-size: ${size.fontSize};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.react-select__input {
|
|
96
|
+
margin: 0;
|
|
97
|
+
padding: 0;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
}}
|
|
50
101
|
`;
|
|
@@ -64,6 +64,7 @@ export default function EditableDurationSelect({
|
|
|
64
64
|
size = 'md',
|
|
65
65
|
testId,
|
|
66
66
|
baseLimit = BASE_LIMIT,
|
|
67
|
+
placeholder = 'Selecione ou insira a duração',
|
|
67
68
|
}: EditableDurationSelectProps) {
|
|
68
69
|
const [inputValue, setInputValue] = useState('');
|
|
69
70
|
|
|
@@ -120,7 +121,7 @@ export default function EditableDurationSelect({
|
|
|
120
121
|
$error={error}
|
|
121
122
|
options={mergedOptions}
|
|
122
123
|
value={value}
|
|
123
|
-
placeholder=
|
|
124
|
+
placeholder={placeholder}
|
|
124
125
|
onInputChange={handleInputChange}
|
|
125
126
|
onChange={(opt) => handleChange(opt as DurationOption | null)}
|
|
126
127
|
formatCreateLabel={() => null}
|