@granto-umbrella/umbrella-components 2.0.5 → 2.0.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@granto-umbrella/umbrella-components",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -51,10 +51,10 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
51
51
  $disabled={disabled}
52
52
  $radius={radius}
53
53
  $shadow={shadow}
54
- data-testid={testId}
55
54
  >
56
55
  {icon && <Icon>{icon}</Icon>}
57
56
  <StyledInput
57
+ data-testid={testId}
58
58
  {...(register || {})}
59
59
  ref={mergeRefs(ref, register ? register.ref : null)}
60
60
  style={style}
@@ -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?: "sm" | "md" | "lg" }>`
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.x8};
41
+ min-height: ${primitiveSizes.size.x4};
42
42
 
43
43
  &:hover {
44
44
  border-color: ${semanticColors.branding.border.hover};
@@ -51,14 +51,21 @@ export const CustomSelect = styled(Select).attrs({
51
51
  }
52
52
 
53
53
  .react-select__value-container {
54
- padding: ${semanticSizes.global.padding.md};
54
+ padding: ${({ $size }) => {
55
+ switch ($size) {
56
+ case "md":
57
+ return semanticSizes.global.padding.md;
58
+ case "lg":
59
+ return semanticSizes.global.padding.lg;
60
+ case "sm":
61
+ default:
62
+ return semanticSizes.global.padding.sm;
63
+ }
64
+ }};
55
65
  font-size: ${typographyTokens.fontSizes.labelM};
56
66
  color: ${semanticColors.base.text};
57
67
  }
58
68
 
59
- .react-select__single-value {
60
- }
61
-
62
69
  .react-select__menu {
63
70
  background: ${semanticColors.base.background};
64
71
  border-radius: ${semanticRadius.global.radius.md};
@@ -66,7 +73,17 @@ export const CustomSelect = styled(Select).attrs({
66
73
  }
67
74
 
68
75
  .react-select__option {
69
- padding: ${semanticSizes.global.padding.sm};
76
+ padding: ${({ $size }) => {
77
+ switch ($size) {
78
+ case "md":
79
+ return semanticSizes.global.padding.md;
80
+ case "lg":
81
+ return semanticSizes.global.padding.lg;
82
+ case "sm":
83
+ default:
84
+ return semanticSizes.global.padding.sm;
85
+ }
86
+ }};
70
87
  font-size: ${typographyTokens.fontSizes.labelM};
71
88
  cursor: pointer;
72
89
  transition: background 0.2s, color 0.2s;
@@ -87,4 +104,8 @@ export const CustomSelect = styled(Select).attrs({
87
104
  color: ${semanticColors.base.background};
88
105
  font-weight: bold;
89
106
  }
107
+
108
+ .react-select__indicator-separator {
109
+ background-color: ${semanticColors.base.background};
110
+ }
90
111
  `;
@@ -31,11 +31,13 @@ const Select: React.FC<SelectProps> = ({
31
31
  onChange,
32
32
  value,
33
33
  testId,
34
+ size = "md",
34
35
  }) => {
35
36
  return (
36
- <Container>
37
+ <Container data-testid={testId}>
37
38
  {label && <Label>{label}</Label>}
38
39
  <CustomSelect
40
+ $size={size}
39
41
  classNamePrefix="react-select"
40
42
  options={options}
41
43
  placeholder={placeholder || "Selecione"}
@@ -44,7 +46,6 @@ const Select: React.FC<SelectProps> = ({
44
46
  }
45
47
  value={value}
46
48
  isSearchable
47
- data-testid={testId}
48
49
  />
49
50
  {supportingText && <SupportingText>{supportingText}</SupportingText>}
50
51
  </Container>