@granto-umbrella/umbrella-components 3.0.58 → 3.0.60

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.58",
3
+ "version": "3.0.60",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,45 +1,15 @@
1
- import styled, { css } from 'styled-components';
1
+ import styled from 'styled-components';
2
2
  import {
3
3
  primitiveSizes,
4
4
  semanticBorders,
5
5
  semanticColors,
6
6
  semanticRadius,
7
7
  semanticShadows,
8
+ semanticSizes,
8
9
  typographyTokens,
9
10
  } from '../../../styles/tokens';
10
11
  import CreatableSelect from 'react-select/creatable';
11
12
 
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
-
43
13
  export const Container = styled.div`
44
14
  display: flex;
45
15
  flex-direction: column;
@@ -61,41 +31,120 @@ export const SupportingText = styled.span<{ $error?: boolean }>`
61
31
  : semanticColors.global.text.subtitle.enabled};
62
32
  `;
63
33
 
64
- export const CustomSelect = styled(CreatableSelect)<{
34
+ export const CustomSelect = styled(CreatableSelect).attrs({
35
+ classNamePrefix: 'react-select',
36
+ })<{
37
+ $size?: keyof typeof semanticSizes.global.padding;
65
38
  $error?: boolean;
66
- $size?: SelectSize;
67
39
  }>`
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
- }}
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
+ }
101
150
  `;
@@ -115,6 +115,7 @@ export default function EditableDurationSelect({
115
115
  {label && <Label>{label}</Label>}
116
116
 
117
117
  <CustomSelect
118
+ classNamePrefix="react-select"
118
119
  isSearchable
119
120
  isDisabled={disabled}
120
121
  $size={size}