@granto-umbrella/umbrella-components 2.0.6 → 2.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/package.json
CHANGED
|
@@ -31,14 +31,14 @@ export const SupportingText = styled.span`
|
|
|
31
31
|
|
|
32
32
|
export const CustomSelect = styled(Select).attrs({
|
|
33
33
|
classNamePrefix: "react-select",
|
|
34
|
-
})
|
|
34
|
+
})<{ $size?: keyof typeof semanticSizes.global.padding }>`
|
|
35
35
|
.react-select__control {
|
|
36
36
|
background: ${semanticColors.base.background};
|
|
37
37
|
border: 1px solid ${semanticColors.neutral[300]};
|
|
38
38
|
border-radius: ${semanticRadius.global.radius.md};
|
|
39
39
|
box-shadow: ${semanticShadows.shadow};
|
|
40
40
|
transition: border-color 0.2s, box-shadow 0.2s;
|
|
41
|
-
min-height: ${primitiveSizes.size.
|
|
41
|
+
min-height: ${primitiveSizes.size.x4};
|
|
42
42
|
|
|
43
43
|
&:hover {
|
|
44
44
|
border-color: ${semanticColors.branding.border.hover};
|
|
@@ -51,14 +51,11 @@ export const CustomSelect = styled(Select).attrs({
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.react-select__value-container {
|
|
54
|
-
padding: ${semanticSizes.global.padding
|
|
54
|
+
padding: ${({ $size = "sm" }) => semanticSizes.global.padding[$size]};
|
|
55
55
|
font-size: ${typographyTokens.fontSizes.labelM};
|
|
56
56
|
color: ${semanticColors.base.text};
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.react-select__single-value {
|
|
60
|
-
}
|
|
61
|
-
|
|
62
59
|
.react-select__menu {
|
|
63
60
|
background: ${semanticColors.base.background};
|
|
64
61
|
border-radius: ${semanticRadius.global.radius.md};
|
|
@@ -66,7 +63,7 @@ export const CustomSelect = styled(Select).attrs({
|
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
.react-select__option {
|
|
69
|
-
padding: ${semanticSizes.global.padding
|
|
66
|
+
padding: ${({ $size = "sm" }) => semanticSizes.global.padding[$size]};
|
|
70
67
|
font-size: ${typographyTokens.fontSizes.labelM};
|
|
71
68
|
cursor: pointer;
|
|
72
69
|
transition: background 0.2s, color 0.2s;
|
|
@@ -87,4 +84,8 @@ export const CustomSelect = styled(Select).attrs({
|
|
|
87
84
|
color: ${semanticColors.base.background};
|
|
88
85
|
font-weight: bold;
|
|
89
86
|
}
|
|
87
|
+
|
|
88
|
+
.react-select__indicator-separator {
|
|
89
|
+
background-color: ${semanticColors.base.background};
|
|
90
|
+
}
|
|
90
91
|
`;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SupportingText,
|
|
6
6
|
CustomSelect,
|
|
7
7
|
} from "./Select.styles";
|
|
8
|
+
import { semanticSizes } from "../../../styles/tokens";
|
|
8
9
|
|
|
9
10
|
interface Option {
|
|
10
11
|
label: string;
|
|
@@ -16,7 +17,7 @@ interface SelectProps {
|
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
borderColor?: string;
|
|
18
19
|
borderRadius?: string;
|
|
19
|
-
size?:
|
|
20
|
+
size?: keyof typeof semanticSizes.global.padding;
|
|
20
21
|
options: { label: string; value: string }[];
|
|
21
22
|
onChange?: (newValue: Option | null, actionMeta: { action: string }) => void;
|
|
22
23
|
value?: Option | null;
|
|
@@ -31,11 +32,13 @@ const Select: React.FC<SelectProps> = ({
|
|
|
31
32
|
onChange,
|
|
32
33
|
value,
|
|
33
34
|
testId,
|
|
35
|
+
size = "md",
|
|
34
36
|
}) => {
|
|
35
37
|
return (
|
|
36
|
-
<Container>
|
|
38
|
+
<Container data-testid={testId}>
|
|
37
39
|
{label && <Label>{label}</Label>}
|
|
38
40
|
<CustomSelect
|
|
41
|
+
$size={size}
|
|
39
42
|
classNamePrefix="react-select"
|
|
40
43
|
options={options}
|
|
41
44
|
placeholder={placeholder || "Selecione"}
|
|
@@ -44,7 +47,6 @@ const Select: React.FC<SelectProps> = ({
|
|
|
44
47
|
}
|
|
45
48
|
value={value}
|
|
46
49
|
isSearchable
|
|
47
|
-
data-testid={testId}
|
|
48
50
|
/>
|
|
49
51
|
{supportingText && <SupportingText>{supportingText}</SupportingText>}
|
|
50
52
|
</Container>
|