@granto-umbrella/umbrella-components 3.0.59 → 3.0.61

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": "3.0.59",
3
+ "version": "3.0.61",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -61,7 +61,7 @@ export const StyledDatePicker = styled(
61
61
  ReactDatePicker as unknown as React.ComponentType<DatePickerProps>
62
62
  )`
63
63
  width: 100%;
64
- padding: 0.65rem ${semanticSizes.global.padding.md};
64
+ padding: 0.75rem ${semanticSizes.global.padding.md};
65
65
  border: 1px solid ${semanticColors.neutral[300]};
66
66
  border-radius: ${semanticRadius.global.radius.md};
67
67
  font-size: ${typographyTokens.fontSizes.bodyS};
@@ -4,6 +4,8 @@ import {
4
4
  semanticBorders,
5
5
  semanticColors,
6
6
  semanticRadius,
7
+ semanticShadows,
8
+ semanticSizes,
7
9
  typographyTokens,
8
10
  } from '../../../styles/tokens';
9
11
  import CreatableSelect from 'react-select/creatable';
@@ -29,56 +31,120 @@ export const SupportingText = styled.span<{ $error?: boolean }>`
29
31
  : semanticColors.global.text.subtitle.enabled};
30
32
  `;
31
33
 
32
- export const CustomSelect = styled(CreatableSelect)<{
34
+ export const CustomSelect = styled(CreatableSelect).attrs({
35
+ classNamePrefix: 'react-select',
36
+ })<{
37
+ $size?: keyof typeof semanticSizes.global.padding;
33
38
  $error?: boolean;
34
- $size?: 'sm' | 'md' | 'lg';
35
39
  }>`
36
- ${({ $size = 'md' }) => {
37
- const sizeMap = {
38
- sm: {
39
- minHeight: primitiveSizes.size.x10,
40
- paddingY: primitiveSizes.size.x1,
41
- paddingX: primitiveSizes.size.x2,
42
- fontSize: typographyTokens.fontSizes.bodyS,
43
- },
44
- md: {
45
- minHeight: primitiveSizes.size.x12,
46
- paddingY: primitiveSizes.size.x2,
47
- paddingX: primitiveSizes.size.x3,
48
- fontSize: typographyTokens.fontSizes.bodyM,
49
- },
50
- lg: {
51
- minHeight: primitiveSizes.size.x14,
52
- paddingY: primitiveSizes.size.x3,
53
- paddingX: primitiveSizes.size.x4,
54
- fontSize: typographyTokens.fontSizes.bodyL,
55
- },
56
- };
57
-
58
- const size = sizeMap[$size];
59
-
60
- return `
61
- .react-select__control {
62
- min-height: ${size.minHeight};
63
- border-radius: ${semanticRadius.global.radius.md};
64
- border: ${semanticBorders.global.sm} solid
65
- ${semanticColors.global.border.medium};
66
- }
67
-
68
- .react-select__value-container {
69
- padding: ${size.paddingY} ${size.paddingX};
70
- }
71
-
72
- .react-select__single-value,
73
- .react-select__placeholder,
74
- .react-select__input-container {
75
- font-size: ${size.fontSize};
76
- }
77
-
78
- .react-select__input {
79
- margin: 0;
80
- padding: 0;
81
- }
82
- `;
83
- }}
40
+ .react-select__control {
41
+ background: ${semanticColors.base.background};
42
+ border: ${semanticBorders.global.sm} solid
43
+ ${({ $error }) =>
44
+ $error
45
+ ? semanticColors.global.border.danger.enabled
46
+ : semanticColors.global.border.medium};
47
+ border-radius: ${semanticRadius.global.radius.md};
48
+ transition:
49
+ border-color 0.2s,
50
+ box-shadow 0.2s;
51
+ min-height: ${primitiveSizes.size.x12};
52
+
53
+ &:hover {
54
+ border-color: ${({ $error }) =>
55
+ $error
56
+ ? semanticColors.danger.border.hover
57
+ : semanticColors.branding.border.hover};
58
+ }
59
+
60
+ &:focus-within {
61
+ border-color: ${({ $error }) =>
62
+ $error
63
+ ? semanticColors.danger.border.enabled
64
+ : semanticColors.branding.border.enabled};
65
+ box-shadow: ${semanticShadows.shadow.md};
66
+ }
67
+
68
+ &.react-select__control--is-disabled {
69
+ background: ${semanticColors.global.surface.disabled};
70
+ border-color: ${semanticColors.global.border.strong};
71
+ color: ${semanticColors.global.text.onSurface.enabled};
72
+ cursor: not-allowed;
73
+ }
74
+ }
75
+
76
+ .react-select__value-container {
77
+ padding: ${({ $size = 'md' }) => semanticSizes.global.padding[$size]};
78
+ font-size: ${typographyTokens.fontSizes.labelM};
79
+ color: ${semanticColors.base.text};
80
+ }
81
+
82
+ .react-select__placeholder {
83
+ color: ${semanticColors.global.text.onSurface.subtitle};
84
+ font-size: ${typographyTokens.fontSizes.labelM};
85
+ }
86
+
87
+ .react-select__menu {
88
+ background: ${semanticColors.base.background};
89
+ border-radius: ${semanticRadius.global.radius.md};
90
+ box-shadow: ${semanticShadows.shadow.lg};
91
+ border: ${semanticBorders.global.sm} solid
92
+ ${semanticColors.global.border.default};
93
+ z-index: 1000;
94
+ }
95
+
96
+ .react-select__option {
97
+ padding: ${({ $size = 'md' }) => semanticSizes.global.padding[$size]};
98
+ font-size: ${typographyTokens.fontSizes.labelM};
99
+ cursor: pointer;
100
+ transition:
101
+ background 0.2s,
102
+ color 0.2s;
103
+ color: ${semanticColors.base.text};
104
+
105
+ &:hover {
106
+ background: ${semanticColors.branding.surface.hover};
107
+ color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
108
+ }
109
+
110
+ &:active {
111
+ background: ${semanticColors.branding.surface.pressed};
112
+ color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
113
+ }
114
+ }
115
+
116
+ .react-select__option--is-selected {
117
+ background: ${semanticColors.branding.surface.enabled};
118
+ color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
119
+ font-weight: ${typographyTokens.fontWeights.semibold};
120
+
121
+ &:hover {
122
+ background: ${semanticColors.branding.surface.hover};
123
+ }
124
+ }
125
+
126
+ .react-select__option--is-focused {
127
+ background: ${semanticColors.neutral[100]};
128
+ color: ${semanticColors.base.text};
129
+ }
130
+
131
+ .react-select__indicator-separator {
132
+ background-color: ${semanticColors.global.border.medium};
133
+ }
134
+
135
+ .react-select__dropdown-indicator {
136
+ color: ${semanticColors.global.text.onSurface.enabled};
137
+
138
+ &:hover {
139
+ color: ${semanticColors.branding.text.accent.enabled};
140
+ }
141
+ }
142
+
143
+ .react-select__clear-indicator {
144
+ color: ${semanticColors.global.text.onSurface.enabled};
145
+
146
+ &:hover {
147
+ color: ${semanticColors.danger.text.enabled};
148
+ }
149
+ }
84
150
  `;