@atlaskit/react-select 1.3.3 → 1.4.1
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/CHANGELOG.md +16 -0
- package/dist/cjs/components/containers.js +15 -15
- package/dist/cjs/components/control.js +63 -20
- package/dist/cjs/components/group.js +18 -21
- package/dist/cjs/components/indicators.js +48 -46
- package/dist/cjs/components/input.js +3 -3
- package/dist/cjs/components/menu.js +34 -43
- package/dist/cjs/components/multi-value.js +86 -32
- package/dist/cjs/components/option.js +37 -18
- package/dist/cjs/components/placeholder.js +9 -14
- package/dist/cjs/components/single-value.js +9 -14
- package/dist/cjs/select.js +59 -41
- package/dist/es2019/components/containers.js +9 -11
- package/dist/es2019/components/control.js +70 -25
- package/dist/es2019/components/group.js +13 -23
- package/dist/es2019/components/indicators.js +31 -40
- package/dist/es2019/components/input.js +5 -7
- package/dist/es2019/components/menu.js +13 -24
- package/dist/es2019/components/multi-value.js +89 -36
- package/dist/es2019/components/option.js +40 -20
- package/dist/es2019/components/placeholder.js +4 -10
- package/dist/es2019/components/single-value.js +4 -8
- package/dist/es2019/select.js +28 -15
- package/dist/esm/components/containers.js +13 -15
- package/dist/esm/components/control.js +61 -20
- package/dist/esm/components/group.js +17 -21
- package/dist/esm/components/indicators.js +48 -46
- package/dist/esm/components/input.js +3 -3
- package/dist/esm/components/menu.js +34 -43
- package/dist/esm/components/multi-value.js +86 -32
- package/dist/esm/components/option.js +35 -18
- package/dist/esm/components/placeholder.js +7 -14
- package/dist/esm/components/single-value.js +7 -14
- package/dist/esm/select.js +59 -41
- package/dist/types/components/containers.d.ts +5 -1
- package/dist/types/components/control.d.ts +10 -1
- package/dist/types/components/group.d.ts +2 -2
- package/dist/types/components/indicators.d.ts +16 -4
- package/dist/types/components/input.d.ts +1 -1
- package/dist/types/components/menu.d.ts +4 -4
- package/dist/types/components/multi-value.d.ts +3 -3
- package/dist/types/components/option.d.ts +1 -1
- package/dist/types/components/placeholder.d.ts +1 -1
- package/dist/types/components/single-value.d.ts +1 -1
- package/dist/types/select.d.ts +5 -6
- package/dist/types/styles.d.ts +1 -1
- package/dist/types-ts4.5/components/containers.d.ts +5 -1
- package/dist/types-ts4.5/components/control.d.ts +10 -1
- package/dist/types-ts4.5/components/group.d.ts +2 -2
- package/dist/types-ts4.5/components/indicators.d.ts +16 -4
- package/dist/types-ts4.5/components/input.d.ts +1 -1
- package/dist/types-ts4.5/components/menu.d.ts +4 -4
- package/dist/types-ts4.5/components/multi-value.d.ts +3 -3
- package/dist/types-ts4.5/components/option.d.ts +1 -1
- package/dist/types-ts4.5/components/placeholder.d.ts +1 -1
- package/dist/types-ts4.5/components/single-value.d.ts +1 -1
- package/dist/types-ts4.5/select.d.ts +5 -6
- package/dist/types-ts4.5/styles.d.ts +1 -1
- package/package.json +5 -1
|
@@ -6,14 +6,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
9
|
-
export const groupCSS = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, unstyled) => unstyled ? {} : {
|
|
14
|
-
paddingBottom: spacing.baseUnit * 2,
|
|
15
|
-
paddingTop: spacing.baseUnit * 2
|
|
16
|
-
};
|
|
9
|
+
export const groupCSS = ({}) => ({
|
|
10
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
11
|
+
paddingTop: "var(--ds-space-100, 8px)"
|
|
12
|
+
});
|
|
17
13
|
const Group = props => {
|
|
18
14
|
const {
|
|
19
15
|
children,
|
|
@@ -39,24 +35,18 @@ const Group = props => {
|
|
|
39
35
|
cx: cx
|
|
40
36
|
}), label), jsx("div", null, children));
|
|
41
37
|
};
|
|
42
|
-
export const groupHeadingCSS = ({
|
|
43
|
-
theme: {
|
|
44
|
-
colors,
|
|
45
|
-
spacing
|
|
46
|
-
}
|
|
47
|
-
}, unstyled) => ({
|
|
38
|
+
export const groupHeadingCSS = ({}) => ({
|
|
48
39
|
label: 'group',
|
|
49
40
|
cursor: 'default',
|
|
50
41
|
display: 'block',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
42
|
+
fontSize: '75%',
|
|
43
|
+
marginBottom: '0.25em',
|
|
44
|
+
paddingLeft: "var(--ds-space-150, 12px)",
|
|
45
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
46
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
47
|
+
color: "var(--ds-text-subtle, #44546F)",
|
|
48
|
+
fontWeight: `${"var(--ds-font-weight-bold, 700)"} !important`,
|
|
49
|
+
textTransform: 'none'
|
|
60
50
|
});
|
|
61
51
|
|
|
62
52
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -51,27 +51,19 @@ jsx(Svg, _extends({
|
|
|
51
51
|
// Dropdown & Clear Buttons
|
|
52
52
|
// ==============================
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
baseUnit
|
|
59
|
-
},
|
|
60
|
-
colors
|
|
61
|
-
}
|
|
62
|
-
}, unstyled) => ({
|
|
54
|
+
export const dropdownIndicatorCSS = ({
|
|
55
|
+
isCompact,
|
|
56
|
+
isDisabled
|
|
57
|
+
}) => ({
|
|
63
58
|
label: 'indicatorContainer',
|
|
64
59
|
display: 'flex',
|
|
65
60
|
transition: 'color 150ms',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
})
|
|
61
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtle, #44546F)",
|
|
62
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
63
|
+
':hover': {
|
|
64
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
65
|
+
}
|
|
73
66
|
});
|
|
74
|
-
export const dropdownIndicatorCSS = baseCSS;
|
|
75
67
|
|
|
76
68
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
77
69
|
export const DropdownIndicator = props => {
|
|
@@ -84,7 +76,18 @@ export const DropdownIndicator = props => {
|
|
|
84
76
|
'dropdown-indicator': true
|
|
85
77
|
}), innerProps), children || jsx(DownChevron, null));
|
|
86
78
|
};
|
|
87
|
-
export const clearIndicatorCSS =
|
|
79
|
+
export const clearIndicatorCSS = ({
|
|
80
|
+
isCompact
|
|
81
|
+
}) => ({
|
|
82
|
+
label: 'indicatorContainer',
|
|
83
|
+
display: 'flex',
|
|
84
|
+
transition: 'color 150ms',
|
|
85
|
+
color: "var(--ds-text-subtlest, #626F86)",
|
|
86
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
87
|
+
':hover': {
|
|
88
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
88
91
|
|
|
89
92
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
90
93
|
export const ClearIndicator = props => {
|
|
@@ -103,22 +106,14 @@ export const ClearIndicator = props => {
|
|
|
103
106
|
// ==============================
|
|
104
107
|
|
|
105
108
|
export const indicatorSeparatorCSS = ({
|
|
106
|
-
isDisabled
|
|
107
|
-
|
|
108
|
-
spacing: {
|
|
109
|
-
baseUnit
|
|
110
|
-
},
|
|
111
|
-
colors
|
|
112
|
-
}
|
|
113
|
-
}, unstyled) => ({
|
|
109
|
+
isDisabled
|
|
110
|
+
}) => ({
|
|
114
111
|
label: 'indicatorSeparator',
|
|
115
112
|
alignSelf: 'stretch',
|
|
116
113
|
width: 1,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
marginTop: baseUnit * 2
|
|
121
|
-
})
|
|
114
|
+
backgroundColor: isDisabled ? "var(--ds-border-disabled, #091E420F)" : "var(--ds-border, #091E4224)",
|
|
115
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
116
|
+
marginTop: "var(--ds-space-100, 8px)"
|
|
122
117
|
});
|
|
123
118
|
|
|
124
119
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -146,13 +141,11 @@ const loadingDotAnimations = keyframes({
|
|
|
146
141
|
export const loadingIndicatorCSS = ({
|
|
147
142
|
isFocused,
|
|
148
143
|
size,
|
|
144
|
+
isCompact,
|
|
149
145
|
theme: {
|
|
150
|
-
colors
|
|
151
|
-
spacing: {
|
|
152
|
-
baseUnit
|
|
153
|
-
}
|
|
146
|
+
colors
|
|
154
147
|
}
|
|
155
|
-
}
|
|
148
|
+
}) => ({
|
|
156
149
|
label: 'loadingIndicator',
|
|
157
150
|
display: 'flex',
|
|
158
151
|
transition: 'color 150ms',
|
|
@@ -162,10 +155,8 @@ export const loadingIndicatorCSS = ({
|
|
|
162
155
|
marginRight: size,
|
|
163
156
|
textAlign: 'center',
|
|
164
157
|
verticalAlign: 'middle',
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
padding: baseUnit * 2
|
|
168
|
-
})
|
|
158
|
+
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
159
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-100, 8px)"}`
|
|
169
160
|
});
|
|
170
161
|
const LoadingDot = ({
|
|
171
162
|
delay,
|
|
@@ -13,18 +13,16 @@ export const inputCSS = ({
|
|
|
13
13
|
spacing,
|
|
14
14
|
colors
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
}) => ({
|
|
17
17
|
visibility: isDisabled ? 'hidden' : 'visible',
|
|
18
18
|
// force css to recompute when value change due to @emotion bug.
|
|
19
19
|
// We can remove it whenever the bug is fixed.
|
|
20
20
|
transform: value ? 'translateZ(0)' : '',
|
|
21
21
|
...containerStyle,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
color: colors.neutral80
|
|
27
|
-
})
|
|
22
|
+
margin: spacing.baseUnit / 2,
|
|
23
|
+
paddingBottom: spacing.baseUnit / 2,
|
|
24
|
+
paddingTop: spacing.baseUnit / 2,
|
|
25
|
+
color: "var(--ds-text, hsl(0, 0%, 20%))"
|
|
28
26
|
});
|
|
29
27
|
const spacingStyle = {
|
|
30
28
|
gridArea: '1 / 2',
|
|
@@ -194,19 +194,17 @@ export const menuCSS = ({
|
|
|
194
194
|
spacing,
|
|
195
195
|
colors
|
|
196
196
|
}
|
|
197
|
-
}
|
|
197
|
+
}) => ({
|
|
198
198
|
label: 'menu',
|
|
199
199
|
[alignToControl(placement)]: '100%',
|
|
200
200
|
position: 'absolute',
|
|
201
201
|
width: '100%',
|
|
202
202
|
zIndex: 1,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
marginTop: spacing.menuGutter
|
|
209
|
-
})
|
|
203
|
+
borderRadius: borderRadius,
|
|
204
|
+
marginBottom: spacing.menuGutter,
|
|
205
|
+
marginTop: spacing.menuGutter,
|
|
206
|
+
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
207
|
+
boxShadow: "var(--ds-shadow-overlay, 0 0 0 1px hsl(0deg 0% 0% / 10%), 0 4px 11px hsl(0deg 0% 0% / 10%))"
|
|
210
208
|
});
|
|
211
209
|
const PortalPlacementContext = /*#__PURE__*/createContext(null);
|
|
212
210
|
|
|
@@ -283,22 +281,15 @@ export default Menu;
|
|
|
283
281
|
// ==============================
|
|
284
282
|
|
|
285
283
|
export const menuListCSS = ({
|
|
286
|
-
maxHeight
|
|
287
|
-
|
|
288
|
-
spacing: {
|
|
289
|
-
baseUnit
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}, unstyled) => ({
|
|
284
|
+
maxHeight
|
|
285
|
+
}) => ({
|
|
293
286
|
maxHeight,
|
|
294
287
|
overflowY: 'auto',
|
|
295
288
|
position: 'relative',
|
|
296
289
|
// required for offset[Height, Top] > keyboard scroll
|
|
297
290
|
WebkitOverflowScrolling: 'touch',
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
paddingTop: baseUnit
|
|
301
|
-
})
|
|
291
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
292
|
+
paddingBottom: "var(--ds-space-100, 8px)"
|
|
302
293
|
});
|
|
303
294
|
|
|
304
295
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -330,12 +321,10 @@ const noticeCSS = ({
|
|
|
330
321
|
},
|
|
331
322
|
colors
|
|
332
323
|
}
|
|
333
|
-
}
|
|
324
|
+
}) => ({
|
|
334
325
|
textAlign: 'center',
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
padding: `${baseUnit * 2}px ${baseUnit * 3}px`
|
|
338
|
-
})
|
|
326
|
+
color: colors.neutral40,
|
|
327
|
+
padding: `${baseUnit * 2}px ${baseUnit * 3}px`
|
|
339
328
|
});
|
|
340
329
|
export const noOptionsMessageCSS = noticeCSS;
|
|
341
330
|
export const loadingMessageCSS = noticeCSS;
|
|
@@ -5,61 +5,114 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { getStyleProps } from '../utils';
|
|
9
10
|
import { CrossIcon } from './indicators';
|
|
10
11
|
export const multiValueCSS = ({
|
|
12
|
+
isDisabled,
|
|
13
|
+
isFocused,
|
|
11
14
|
theme: {
|
|
12
15
|
spacing,
|
|
13
16
|
borderRadius,
|
|
14
17
|
colors
|
|
15
18
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
backgroundColor
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
}) => {
|
|
20
|
+
let backgroundColor;
|
|
21
|
+
let color;
|
|
22
|
+
if (isDisabled) {
|
|
23
|
+
// Use the basic neutral background so it is slightly separate from the
|
|
24
|
+
// field's background
|
|
25
|
+
backgroundColor = "var(--ds-background-neutral, #091E420F)";
|
|
26
|
+
color = "var(--ds-text-disabled, #091E424F)";
|
|
27
|
+
} else if (isFocused) {
|
|
28
|
+
backgroundColor = "var(--ds-background-selected, #E9F2FF)";
|
|
29
|
+
color = "var(--ds-text-selected, hsl(0, 0%, 20%))";
|
|
30
|
+
} else {
|
|
31
|
+
backgroundColor = fg('platform-component-visual-refresh') ? "var(--ds-background-neutral-subtle-hovered, #091E420F)" : "var(--ds-background-neutral, #091E420F)";
|
|
32
|
+
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
label: 'multiValue',
|
|
36
|
+
display: 'flex',
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
// resolves flex/text-overflow bug
|
|
39
|
+
margin: "var(--ds-space-025, 2px)",
|
|
40
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
41
|
+
backgroundColor,
|
|
42
|
+
boxShadow: isFocused ? `0 0 0 2px ${"var(--ds-surface, transparent)"}, 0 0 0 4px ${"var(--ds-border-focused, transparent)"}` : 'none',
|
|
43
|
+
maxWidth: '100%',
|
|
44
|
+
'@media screen and (-ms-high-contrast: active)': {
|
|
45
|
+
border: isFocused ? '1px solid transparent' : 'none'
|
|
46
|
+
},
|
|
47
|
+
color,
|
|
48
|
+
...(fg('platform-component-visual-refresh') && {
|
|
49
|
+
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
50
|
+
// Hardcode this color for visual refresh as there is no token color yet
|
|
51
|
+
borderColor: '#B7B9BE',
|
|
52
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
53
|
+
borderStyle: 'solid',
|
|
54
|
+
backgroundColor: "var(--ds-background-input, #FFFFFF)"
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
};
|
|
27
58
|
export const multiValueLabelCSS = ({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
cropWithEllipsis
|
|
33
|
-
}, unstyled) => ({
|
|
59
|
+
cropWithEllipsis,
|
|
60
|
+
isDisabled
|
|
61
|
+
}) => ({
|
|
34
62
|
overflow: 'hidden',
|
|
35
63
|
textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,
|
|
36
64
|
whiteSpace: 'nowrap',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
65
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
66
|
+
fontSize: '85%',
|
|
67
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
68
|
+
padding: "var(--ds-space-025, 2px)",
|
|
69
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : 'inherit',
|
|
70
|
+
paddingLeft: "var(--ds-space-075, 6px)",
|
|
71
|
+
...(fg('platform-component-visual-refresh') && {
|
|
72
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
73
|
+
paddingTop: 0,
|
|
74
|
+
paddingBottom: 0,
|
|
75
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
43
76
|
})
|
|
44
77
|
});
|
|
45
78
|
export const multiValueRemoveCSS = ({
|
|
46
|
-
theme: {
|
|
47
|
-
spacing,
|
|
48
|
-
borderRadius,
|
|
49
|
-
colors
|
|
50
|
-
},
|
|
51
79
|
isFocused
|
|
52
|
-
}
|
|
80
|
+
}) => ({
|
|
53
81
|
alignItems: 'center',
|
|
54
82
|
display: 'flex',
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
83
|
+
backgroundColor: isFocused ? "var(--ds-UNSAFE-transparent, transparent)" : undefined,
|
|
84
|
+
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
85
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
86
|
+
paddingRight: "var(--ds-space-025, 2px)",
|
|
87
|
+
borderRadius: '0px 2px 2px 0px',
|
|
88
|
+
// DSP-6470 we should style like Tag once we have the :has selector
|
|
89
|
+
':hover': {
|
|
90
|
+
backgroundColor: "var(--ds-background-danger-hovered, #FFD5D2)",
|
|
91
|
+
fill: "var(--ds-text-danger, #000)"
|
|
92
|
+
},
|
|
93
|
+
':active': {
|
|
94
|
+
backgroundColor: "var(--ds-background-danger-pressed, #FD9891)",
|
|
95
|
+
fill: "var(--ds-text-danger, #000)"
|
|
96
|
+
},
|
|
97
|
+
...(fg('platform-component-visual-refresh') && {
|
|
98
|
+
backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
|
|
99
|
+
border: 'none',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
alignSelf: 'center',
|
|
103
|
+
appearance: 'none',
|
|
104
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
105
|
+
color: "var(--ds-text, #172B4D)",
|
|
106
|
+
padding: "var(--ds-space-025, 2px)",
|
|
107
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
108
|
+
':focus-visible': {
|
|
109
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
110
|
+
},
|
|
60
111
|
':hover': {
|
|
61
|
-
backgroundColor:
|
|
62
|
-
|
|
112
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
113
|
+
},
|
|
114
|
+
':active': {
|
|
115
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
63
116
|
}
|
|
64
117
|
})
|
|
65
118
|
});
|
|
@@ -9,29 +9,49 @@ import { getStyleProps } from '../utils';
|
|
|
9
9
|
export const optionCSS = ({
|
|
10
10
|
isDisabled,
|
|
11
11
|
isFocused,
|
|
12
|
-
isSelected
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
isSelected
|
|
13
|
+
}) => {
|
|
14
|
+
let color = "var(--ds-text, #172B4D)";
|
|
15
|
+
if (isDisabled) {
|
|
16
|
+
color = "var(--ds-text-disabled, #091E424F)";
|
|
17
|
+
} else if (isSelected) {
|
|
18
|
+
color = "var(--ds-text-selected, #0C66E4)";
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
backgroundColor
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
let boxShadow;
|
|
21
|
+
let backgroundColor;
|
|
22
|
+
if (isDisabled) {
|
|
23
|
+
backgroundColor = undefined;
|
|
24
|
+
} else if (isSelected && isFocused) {
|
|
25
|
+
backgroundColor = "var(--ds-background-selected-hovered, #CCE0FF)";
|
|
26
|
+
} else if (isSelected) {
|
|
27
|
+
backgroundColor = "var(--ds-background-selected, #E9F2FF)";
|
|
28
|
+
} else if (isFocused) {
|
|
29
|
+
backgroundColor = "var(--ds-background-neutral-subtle-hovered, #091E420F)";
|
|
30
|
+
}
|
|
31
|
+
if (!isDisabled && (isFocused || isSelected)) {
|
|
32
|
+
boxShadow = `inset 2px 0px 0px ${"var(--ds-border-selected, #0C66E4)"}`;
|
|
33
|
+
}
|
|
34
|
+
const cursor = isDisabled ? 'not-allowed' : 'default';
|
|
35
|
+
return {
|
|
36
|
+
label: 'option',
|
|
37
|
+
display: 'block',
|
|
38
|
+
fontSize: 'inherit',
|
|
39
|
+
width: '100%',
|
|
40
|
+
userSelect: 'none',
|
|
41
|
+
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
42
|
+
padding: `${"var(--ds-space-075, 6px)"} ${"var(--ds-space-150, 12px)"}`,
|
|
43
|
+
backgroundColor,
|
|
44
|
+
color,
|
|
45
|
+
cursor,
|
|
46
|
+
boxShadow,
|
|
30
47
|
':active': {
|
|
31
|
-
backgroundColor: !isDisabled ? isSelected ?
|
|
48
|
+
backgroundColor: !isDisabled ? isSelected ? "var(--ds-background-selected-pressed, #85B8FF)" : "var(--ds-background-neutral-subtle-pressed, #091E4224)" : undefined
|
|
49
|
+
},
|
|
50
|
+
'@media screen and (-ms-high-contrast: active)': {
|
|
51
|
+
borderLeft: !isDisabled && (isFocused || isSelected) ? '2px solid transparent' : ''
|
|
32
52
|
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
35
55
|
const Option = props => {
|
|
36
56
|
const {
|
|
37
57
|
children,
|
|
@@ -7,18 +7,12 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { getStyleProps } from '../utils';
|
|
9
9
|
export const placeholderCSS = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
colors
|
|
13
|
-
}
|
|
14
|
-
}, unstyled) => ({
|
|
10
|
+
isDisabled
|
|
11
|
+
}) => ({
|
|
15
12
|
label: 'placeholder',
|
|
16
13
|
gridArea: '1 / 1 / 2 / 3',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
marginLeft: spacing.baseUnit / 2,
|
|
20
|
-
marginRight: spacing.baseUnit / 2
|
|
21
|
-
})
|
|
14
|
+
margin: `0 ${"var(--ds-space-025, 2px)"}`,
|
|
15
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtlest, #626F86)"
|
|
22
16
|
});
|
|
23
17
|
const Placeholder = props => {
|
|
24
18
|
const {
|
|
@@ -9,21 +9,17 @@ import { getStyleProps } from '../utils';
|
|
|
9
9
|
export const css = ({
|
|
10
10
|
isDisabled,
|
|
11
11
|
theme: {
|
|
12
|
-
spacing
|
|
13
|
-
colors
|
|
12
|
+
spacing
|
|
14
13
|
}
|
|
15
|
-
}
|
|
14
|
+
}) => ({
|
|
16
15
|
label: 'singleValue',
|
|
17
16
|
gridArea: '1 / 1 / 2 / 3',
|
|
18
17
|
maxWidth: '100%',
|
|
19
18
|
overflow: 'hidden',
|
|
20
19
|
textOverflow: 'ellipsis',
|
|
21
20
|
whiteSpace: 'nowrap',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
marginLeft: spacing.baseUnit / 2,
|
|
25
|
-
marginRight: spacing.baseUnit / 2
|
|
26
|
-
})
|
|
21
|
+
margin: `0 ${"var(--ds-space-025, 2px)"}`,
|
|
22
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text, #172B4D)"
|
|
27
23
|
});
|
|
28
24
|
const SingleValue = props => {
|
|
29
25
|
const {
|
package/dist/es2019/select.js
CHANGED
|
@@ -52,8 +52,7 @@ export const defaultProps = {
|
|
|
52
52
|
}) => `${count} result${count !== 1 ? 's' : ''} available`,
|
|
53
53
|
styles: {},
|
|
54
54
|
tabIndex: 0,
|
|
55
|
-
tabSelectsValue: true
|
|
56
|
-
unstyled: false
|
|
55
|
+
tabSelectsValue: true
|
|
57
56
|
};
|
|
58
57
|
function toCategorizedOption(props, option, selectValue, index) {
|
|
59
58
|
const isDisabled = isOptionDisabled(props, option, selectValue);
|
|
@@ -370,10 +369,7 @@ export default class Select extends Component {
|
|
|
370
369
|
return getOptionValue(this.props, data);
|
|
371
370
|
});
|
|
372
371
|
_defineProperty(this, "getStyles", (key, props) => {
|
|
373
|
-
const
|
|
374
|
-
unstyled
|
|
375
|
-
} = this.props;
|
|
376
|
-
const base = defaultStyles[key](props, unstyled);
|
|
372
|
+
const base = defaultStyles[key](props);
|
|
377
373
|
base.boxSizing = 'border-box';
|
|
378
374
|
const custom = this.props.styles[key];
|
|
379
375
|
return custom ? custom(base, props) : base;
|
|
@@ -1393,7 +1389,8 @@ export default class Select extends Component {
|
|
|
1393
1389
|
const {
|
|
1394
1390
|
clearControlLabel,
|
|
1395
1391
|
isDisabled,
|
|
1396
|
-
isLoading
|
|
1392
|
+
isLoading,
|
|
1393
|
+
spacing
|
|
1397
1394
|
} = this.props;
|
|
1398
1395
|
const {
|
|
1399
1396
|
isFocused
|
|
@@ -1406,11 +1403,13 @@ export default class Select extends Component {
|
|
|
1406
1403
|
onTouchEnd: this.onClearIndicatorTouchEnd,
|
|
1407
1404
|
'aria-hidden': 'true'
|
|
1408
1405
|
};
|
|
1406
|
+
const isCompact = spacing === 'compact';
|
|
1409
1407
|
return /*#__PURE__*/React.createElement(ClearIndicator, _extends({
|
|
1410
1408
|
clearControlLabel: clearControlLabel
|
|
1411
1409
|
}, commonProps, {
|
|
1412
1410
|
innerProps: innerProps,
|
|
1413
|
-
isFocused: isFocused
|
|
1411
|
+
isFocused: isFocused,
|
|
1412
|
+
isCompact: isCompact
|
|
1414
1413
|
}));
|
|
1415
1414
|
}
|
|
1416
1415
|
renderLoadingIndicator() {
|
|
@@ -1422,7 +1421,8 @@ export default class Select extends Component {
|
|
|
1422
1421
|
} = this;
|
|
1423
1422
|
const {
|
|
1424
1423
|
isDisabled,
|
|
1425
|
-
isLoading
|
|
1424
|
+
isLoading,
|
|
1425
|
+
spacing
|
|
1426
1426
|
} = this.props;
|
|
1427
1427
|
const {
|
|
1428
1428
|
isFocused
|
|
@@ -1430,13 +1430,15 @@ export default class Select extends Component {
|
|
|
1430
1430
|
if (!LoadingIndicator || !isLoading) {
|
|
1431
1431
|
return null;
|
|
1432
1432
|
}
|
|
1433
|
+
const isCompact = spacing === 'compact';
|
|
1433
1434
|
const innerProps = {
|
|
1434
1435
|
'aria-hidden': 'true'
|
|
1435
1436
|
};
|
|
1436
1437
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({}, commonProps, {
|
|
1437
1438
|
innerProps: innerProps,
|
|
1438
1439
|
isDisabled: isDisabled,
|
|
1439
|
-
isFocused: isFocused
|
|
1440
|
+
isFocused: isFocused,
|
|
1441
|
+
isCompact: isCompact
|
|
1440
1442
|
}));
|
|
1441
1443
|
}
|
|
1442
1444
|
renderIndicatorSeparator() {
|
|
@@ -1474,11 +1476,13 @@ export default class Select extends Component {
|
|
|
1474
1476
|
commonProps
|
|
1475
1477
|
} = this;
|
|
1476
1478
|
const {
|
|
1477
|
-
isDisabled
|
|
1479
|
+
isDisabled,
|
|
1480
|
+
spacing
|
|
1478
1481
|
} = this.props;
|
|
1479
1482
|
const {
|
|
1480
1483
|
isFocused
|
|
1481
1484
|
} = this.state;
|
|
1485
|
+
const isCompact = spacing === 'compact';
|
|
1482
1486
|
const innerProps = {
|
|
1483
1487
|
onMouseDown: this.onDropdownIndicatorMouseDown,
|
|
1484
1488
|
onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
|
@@ -1487,7 +1491,8 @@ export default class Select extends Component {
|
|
|
1487
1491
|
return /*#__PURE__*/React.createElement(DropdownIndicator, _extends({}, commonProps, {
|
|
1488
1492
|
innerProps: innerProps,
|
|
1489
1493
|
isDisabled: isDisabled,
|
|
1490
|
-
isFocused: isFocused
|
|
1494
|
+
isFocused: isFocused,
|
|
1495
|
+
isCompact: isCompact
|
|
1491
1496
|
}));
|
|
1492
1497
|
}
|
|
1493
1498
|
renderMenu() {
|
|
@@ -1752,12 +1757,16 @@ export default class Select extends Component {
|
|
|
1752
1757
|
className,
|
|
1753
1758
|
id,
|
|
1754
1759
|
isDisabled,
|
|
1755
|
-
menuIsOpen
|
|
1760
|
+
menuIsOpen,
|
|
1761
|
+
isInvalid,
|
|
1762
|
+
appearance = 'default',
|
|
1763
|
+
spacing = 'default'
|
|
1756
1764
|
} = this.props;
|
|
1757
1765
|
const {
|
|
1758
1766
|
isFocused
|
|
1759
1767
|
} = this.state;
|
|
1760
1768
|
const commonProps = this.commonProps = this.getCommonProps();
|
|
1769
|
+
const isCompact = spacing === 'compact';
|
|
1761
1770
|
return /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {
|
|
1762
1771
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
1763
1772
|
className: className,
|
|
@@ -1773,11 +1782,15 @@ export default class Select extends Component {
|
|
|
1773
1782
|
onMouseDown: this.onControlMouseDown,
|
|
1774
1783
|
onTouchEnd: this.onControlTouchEnd
|
|
1775
1784
|
},
|
|
1785
|
+
appearance: appearance,
|
|
1786
|
+
isInvalid: isInvalid,
|
|
1776
1787
|
isDisabled: isDisabled,
|
|
1777
1788
|
isFocused: isFocused,
|
|
1778
|
-
menuIsOpen: menuIsOpen
|
|
1789
|
+
menuIsOpen: menuIsOpen,
|
|
1790
|
+
isCompact: isCompact
|
|
1779
1791
|
}), /*#__PURE__*/React.createElement(ValueContainer, _extends({}, commonProps, {
|
|
1780
|
-
isDisabled: isDisabled
|
|
1792
|
+
isDisabled: isDisabled,
|
|
1793
|
+
isCompact: isCompact
|
|
1781
1794
|
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {
|
|
1782
1795
|
isDisabled: isDisabled
|
|
1783
1796
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|