agroptima-design-system 0.29.1 → 0.29.2-beta.0
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 +1 -1
- package/src/atoms/Button/Button.scss +2 -13
- package/src/atoms/Select.scss +20 -23
- package/src/atoms/Select.tsx +9 -1
package/package.json
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
@use '../../settings/color_alias';
|
|
2
2
|
@use '../../settings/typography/content' as typography;
|
|
3
3
|
@use '../../settings/config';
|
|
4
|
+
@use '../../settings/mixins';
|
|
4
5
|
|
|
5
6
|
@mixin button-style($main-color, $secondary-color, $hover-color) {
|
|
7
|
+
@include mixins.icon-color($secondary-color);
|
|
6
8
|
background: $main-color;
|
|
7
9
|
color: $secondary-color;
|
|
8
10
|
|
|
9
|
-
> .icon {
|
|
10
|
-
> svg {
|
|
11
|
-
fill: $secondary-color;
|
|
12
|
-
path {
|
|
13
|
-
fill: $secondary-color;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
&:not(:disabled):hover,
|
|
19
12
|
&:not(:disabled):active {
|
|
20
13
|
background: $hover-color;
|
|
@@ -39,10 +32,6 @@
|
|
|
39
32
|
margin-top: 2px;
|
|
40
33
|
width: config.$icon-size-3x;
|
|
41
34
|
height: config.$icon-size-3x;
|
|
42
|
-
> svg {
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
}
|
|
46
35
|
}
|
|
47
36
|
|
|
48
37
|
&.primary {
|
package/src/atoms/Select.scss
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
@use '../settings/typography/form' as typography;
|
|
3
3
|
@use '../settings/config';
|
|
4
4
|
@use '../settings/depth';
|
|
5
|
+
@use '../settings/mixins';
|
|
6
|
+
|
|
7
|
+
$selected-option-padding: config.$space-2x config.$space-3x;
|
|
8
|
+
$selected-option-height: config.$space-10x;
|
|
5
9
|
|
|
6
10
|
.select-group {
|
|
7
11
|
display: flex;
|
|
@@ -34,15 +38,7 @@
|
|
|
34
38
|
border: 1px solid color_alias.$neutral-color-600;
|
|
35
39
|
background: color_alias.$neutral-white;
|
|
36
40
|
@include typography.select-text;
|
|
37
|
-
|
|
38
|
-
> .icon {
|
|
39
|
-
> svg {
|
|
40
|
-
fill: color_alias.$primary-color-600;
|
|
41
|
-
path {
|
|
42
|
-
fill: color_alias.$primary-color-600;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
41
|
+
@include mixins.icon-color(color_alias.$primary-color-600);
|
|
46
42
|
|
|
47
43
|
&.filled {
|
|
48
44
|
@include typography.select-option-text;
|
|
@@ -61,15 +57,7 @@
|
|
|
61
57
|
border: 1px solid color_alias.$neutral-color-400;
|
|
62
58
|
background: color_alias.$neutral-color-50;
|
|
63
59
|
color: color_alias.$neutral-color-400;
|
|
64
|
-
|
|
65
|
-
> .icon {
|
|
66
|
-
> svg {
|
|
67
|
-
fill: color_alias.$neutral-color-400;
|
|
68
|
-
path {
|
|
69
|
-
fill: color_alias.$neutral-color-400;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
60
|
+
@include mixins.icon-color(color_alias.$neutral-color-400);
|
|
73
61
|
}
|
|
74
62
|
}
|
|
75
63
|
|
|
@@ -117,6 +105,7 @@
|
|
|
117
105
|
}
|
|
118
106
|
|
|
119
107
|
.selected-option {
|
|
108
|
+
min-height: $selected-option-height;
|
|
120
109
|
display: flex;
|
|
121
110
|
justify-content: space-between;
|
|
122
111
|
align-items: center;
|
|
@@ -128,7 +117,7 @@
|
|
|
128
117
|
height: config.$icon-size-3x;
|
|
129
118
|
}
|
|
130
119
|
}
|
|
131
|
-
|
|
120
|
+
|
|
132
121
|
.select-options {
|
|
133
122
|
max-height: 256px;
|
|
134
123
|
overflow-y: auto;
|
|
@@ -141,7 +130,7 @@
|
|
|
141
130
|
width: 100%;
|
|
142
131
|
|
|
143
132
|
.search {
|
|
144
|
-
margin:
|
|
133
|
+
margin: $selected-option-padding;
|
|
145
134
|
}
|
|
146
135
|
|
|
147
136
|
ul {
|
|
@@ -149,13 +138,13 @@
|
|
|
149
138
|
margin: 0;
|
|
150
139
|
padding: 0;
|
|
151
140
|
}
|
|
152
|
-
|
|
141
|
+
|
|
153
142
|
.option {
|
|
154
143
|
display: flex;
|
|
155
144
|
align-items: center;
|
|
156
145
|
cursor: default;
|
|
157
146
|
list-style-type: none;
|
|
158
|
-
padding:
|
|
147
|
+
padding: $selected-option-padding;
|
|
159
148
|
|
|
160
149
|
> .icon {
|
|
161
150
|
width: config.$icon-size-4x;
|
|
@@ -163,5 +152,13 @@
|
|
|
163
152
|
margin-right: config.$space-1x;
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
|
-
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.select-loader {
|
|
159
|
+
position: absolute;
|
|
160
|
+
padding: $selected-option-padding;
|
|
161
|
+
min-height: $selected-option-height;
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
167
164
|
}
|
package/src/atoms/Select.tsx
CHANGED
|
@@ -31,6 +31,7 @@ export interface SelectProps extends InputPropsWithoutOnChange {
|
|
|
31
31
|
required?: boolean
|
|
32
32
|
isSearchable?: boolean
|
|
33
33
|
searchLabel?: string
|
|
34
|
+
loading?: boolean
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const EMPTY_OPTION = { id: '', label: '' }
|
|
@@ -51,6 +52,7 @@ export function Select({
|
|
|
51
52
|
defaultValue,
|
|
52
53
|
required = false,
|
|
53
54
|
isSearchable = false,
|
|
55
|
+
loading = false,
|
|
54
56
|
searchLabel = 'Search',
|
|
55
57
|
...props
|
|
56
58
|
}: SelectProps): React.JSX.Element {
|
|
@@ -62,6 +64,7 @@ export function Select({
|
|
|
62
64
|
const isEmpty = selectedOption.id === EMPTY_OPTION.id
|
|
63
65
|
const selectRef = useRef(null)
|
|
64
66
|
useOutsideClick(selectRef, close)
|
|
67
|
+
const displayedValue = loading ? '' : selectedOption.label || placeholder
|
|
65
68
|
|
|
66
69
|
const cssClasses = classNames('selected-option', {
|
|
67
70
|
open: isOpen,
|
|
@@ -98,6 +101,11 @@ export function Select({
|
|
|
98
101
|
)}
|
|
99
102
|
|
|
100
103
|
<div className="select-container" ref={selectRef}>
|
|
104
|
+
{loading && (
|
|
105
|
+
<div className="select-loader">
|
|
106
|
+
<Icon name="Loading" />
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
101
109
|
<div
|
|
102
110
|
className={cssClasses}
|
|
103
111
|
tabIndex={0}
|
|
@@ -106,7 +114,7 @@ export function Select({
|
|
|
106
114
|
aria-live="assertive"
|
|
107
115
|
role="alert"
|
|
108
116
|
>
|
|
109
|
-
<span>{
|
|
117
|
+
<span>{displayedValue}</span>
|
|
110
118
|
<Icon name={isOpen ? 'AngleUp' : 'AngleDown'} visible={isEmpty} />
|
|
111
119
|
<IconButton
|
|
112
120
|
icon="Close"
|