@atlaskit/react-select 1.4.0 → 1.4.2
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/accessibility/index.js +9 -7
- package/dist/cjs/components/containers.js +9 -7
- package/dist/cjs/components/control.js +58 -13
- package/dist/cjs/components/group.js +11 -11
- package/dist/cjs/components/indicators.js +39 -34
- package/dist/cjs/components/input.js +1 -1
- package/dist/cjs/components/internal/a11y-text.js +2 -0
- package/dist/cjs/components/live-region.js +6 -3
- package/dist/cjs/components/menu.js +4 -5
- package/dist/cjs/components/multi-value.js +86 -30
- package/dist/cjs/components/option.js +38 -13
- package/dist/cjs/components/placeholder.js +3 -6
- package/dist/cjs/components/single-value.js +3 -6
- package/dist/cjs/select.js +105 -54
- package/dist/es2019/accessibility/index.js +9 -7
- package/dist/es2019/components/containers.js +8 -8
- package/dist/es2019/components/control.js +71 -24
- package/dist/es2019/components/group.js +10 -18
- package/dist/es2019/components/indicators.js +25 -28
- package/dist/es2019/components/input.js +1 -1
- package/dist/es2019/components/internal/a11y-text.js +2 -0
- package/dist/es2019/components/live-region.js +6 -2
- package/dist/es2019/components/menu.js +6 -11
- package/dist/es2019/components/multi-value.js +89 -30
- package/dist/es2019/components/option.js +48 -22
- package/dist/es2019/components/placeholder.js +3 -7
- package/dist/es2019/components/single-value.js +3 -5
- package/dist/es2019/select.js +74 -24
- package/dist/esm/accessibility/index.js +9 -7
- package/dist/esm/components/containers.js +9 -7
- package/dist/esm/components/control.js +58 -13
- package/dist/esm/components/group.js +11 -11
- package/dist/esm/components/indicators.js +39 -34
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/internal/a11y-text.js +2 -0
- package/dist/esm/components/live-region.js +6 -2
- package/dist/esm/components/menu.js +4 -5
- package/dist/esm/components/multi-value.js +86 -30
- package/dist/esm/components/option.js +38 -13
- package/dist/esm/components/placeholder.js +3 -6
- package/dist/esm/components/single-value.js +3 -6
- package/dist/esm/select.js +105 -53
- 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/menu.d.ts +1 -1
- 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 +13 -4
- 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/menu.d.ts +1 -1
- 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 +13 -4
- package/package.json +6 -2
|
@@ -6,13 +6,9 @@ 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
|
-
}) => ({
|
|
14
|
-
paddingBottom: spacing.baseUnit * 2,
|
|
15
|
-
paddingTop: spacing.baseUnit * 2
|
|
9
|
+
export const groupCSS = ({}) => ({
|
|
10
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
11
|
+
paddingTop: "var(--ds-space-100, 8px)"
|
|
16
12
|
});
|
|
17
13
|
const Group = props => {
|
|
18
14
|
const {
|
|
@@ -39,22 +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
|
-
}) => ({
|
|
38
|
+
export const groupHeadingCSS = ({}) => ({
|
|
48
39
|
label: 'group',
|
|
49
40
|
cursor: 'default',
|
|
50
41
|
display: 'block',
|
|
51
|
-
color: colors.neutral40,
|
|
52
42
|
fontSize: '75%',
|
|
53
|
-
fontWeight: 500,
|
|
54
43
|
marginBottom: '0.25em',
|
|
55
|
-
paddingLeft:
|
|
56
|
-
paddingRight:
|
|
57
|
-
|
|
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'
|
|
58
50
|
});
|
|
59
51
|
|
|
60
52
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -51,25 +51,19 @@ jsx(Svg, _extends({
|
|
|
51
51
|
// Dropdown & Clear Buttons
|
|
52
52
|
// ==============================
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
spacing: {
|
|
58
|
-
baseUnit
|
|
59
|
-
},
|
|
60
|
-
colors
|
|
61
|
-
}
|
|
54
|
+
export const dropdownIndicatorCSS = ({
|
|
55
|
+
isCompact,
|
|
56
|
+
isDisabled
|
|
62
57
|
}) => ({
|
|
63
58
|
label: 'indicatorContainer',
|
|
64
59
|
display: 'flex',
|
|
65
60
|
transition: 'color 150ms',
|
|
66
|
-
color:
|
|
67
|
-
padding:
|
|
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)"}`,
|
|
68
63
|
':hover': {
|
|
69
|
-
color:
|
|
64
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
70
65
|
}
|
|
71
66
|
});
|
|
72
|
-
export const dropdownIndicatorCSS = baseCSS;
|
|
73
67
|
|
|
74
68
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
75
69
|
export const DropdownIndicator = props => {
|
|
@@ -82,7 +76,18 @@ export const DropdownIndicator = props => {
|
|
|
82
76
|
'dropdown-indicator': true
|
|
83
77
|
}), innerProps), children || jsx(DownChevron, null));
|
|
84
78
|
};
|
|
85
|
-
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
|
+
});
|
|
86
91
|
|
|
87
92
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
88
93
|
export const ClearIndicator = props => {
|
|
@@ -101,20 +106,14 @@ export const ClearIndicator = props => {
|
|
|
101
106
|
// ==============================
|
|
102
107
|
|
|
103
108
|
export const indicatorSeparatorCSS = ({
|
|
104
|
-
isDisabled
|
|
105
|
-
theme: {
|
|
106
|
-
spacing: {
|
|
107
|
-
baseUnit
|
|
108
|
-
},
|
|
109
|
-
colors
|
|
110
|
-
}
|
|
109
|
+
isDisabled
|
|
111
110
|
}) => ({
|
|
112
111
|
label: 'indicatorSeparator',
|
|
113
112
|
alignSelf: 'stretch',
|
|
114
113
|
width: 1,
|
|
115
|
-
backgroundColor: isDisabled ?
|
|
116
|
-
marginBottom:
|
|
117
|
-
marginTop:
|
|
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)"
|
|
118
117
|
});
|
|
119
118
|
|
|
120
119
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -142,11 +141,9 @@ const loadingDotAnimations = keyframes({
|
|
|
142
141
|
export const loadingIndicatorCSS = ({
|
|
143
142
|
isFocused,
|
|
144
143
|
size,
|
|
144
|
+
isCompact,
|
|
145
145
|
theme: {
|
|
146
|
-
colors
|
|
147
|
-
spacing: {
|
|
148
|
-
baseUnit
|
|
149
|
-
}
|
|
146
|
+
colors
|
|
150
147
|
}
|
|
151
148
|
}) => ({
|
|
152
149
|
label: 'loadingIndicator',
|
|
@@ -159,7 +156,7 @@ export const loadingIndicatorCSS = ({
|
|
|
159
156
|
textAlign: 'center',
|
|
160
157
|
verticalAlign: 'middle',
|
|
161
158
|
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
162
|
-
padding:
|
|
159
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-100, 8px)"}`
|
|
163
160
|
});
|
|
164
161
|
const LoadingDot = ({
|
|
165
162
|
delay,
|
|
@@ -22,7 +22,7 @@ export const inputCSS = ({
|
|
|
22
22
|
margin: spacing.baseUnit / 2,
|
|
23
23
|
paddingBottom: spacing.baseUnit / 2,
|
|
24
24
|
paddingTop: spacing.baseUnit / 2,
|
|
25
|
-
color:
|
|
25
|
+
color: "var(--ds-text, hsl(0, 0%, 20%))"
|
|
26
26
|
});
|
|
27
27
|
const spacingStyle = {
|
|
28
28
|
gridArea: '1 / 2',
|
|
@@ -16,6 +16,8 @@ const styles = css({
|
|
|
16
16
|
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
17
17
|
label: 'a11yText',
|
|
18
18
|
overflow: 'hidden',
|
|
19
|
+
userSelect: 'none',
|
|
20
|
+
// while hidden text is sitting in the DOM, it should not be selectable
|
|
19
21
|
whiteSpace: 'nowrap'
|
|
20
22
|
});
|
|
21
23
|
const A11yText = props => jsx("span", _extends({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
1
2
|
/**
|
|
2
3
|
* @jsxRuntime classic
|
|
3
4
|
* @jsx jsx
|
|
@@ -168,8 +169,11 @@ const LiveRegion = props => {
|
|
|
168
169
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
169
170
|
id: id
|
|
170
171
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
171
|
-
"aria-live":
|
|
172
|
-
|
|
172
|
+
"aria-live": ariaLive // Should be undefined by default unless a specific use case requires it
|
|
173
|
+
,
|
|
174
|
+
"aria-atomic": fg('design_system_select-a11y-improvement') ? undefined : 'false',
|
|
175
|
+
"aria-relevant": fg('design_system_select-a11y-improvement') ? undefined : 'additions text',
|
|
176
|
+
role: fg('design_system_select-a11y-improvement') ? 'status' : 'log'
|
|
173
177
|
}, isFocused && !isInitialFocus && ScreenReaderText));
|
|
174
178
|
};
|
|
175
179
|
|
|
@@ -200,11 +200,11 @@ export const menuCSS = ({
|
|
|
200
200
|
position: 'absolute',
|
|
201
201
|
width: '100%',
|
|
202
202
|
zIndex: 1,
|
|
203
|
-
backgroundColor: colors.neutral0,
|
|
204
203
|
borderRadius: borderRadius,
|
|
205
|
-
boxShadow: '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)',
|
|
206
204
|
marginBottom: spacing.menuGutter,
|
|
207
|
-
marginTop: 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%))"
|
|
208
208
|
});
|
|
209
209
|
const PortalPlacementContext = /*#__PURE__*/createContext(null);
|
|
210
210
|
|
|
@@ -281,20 +281,15 @@ export default Menu;
|
|
|
281
281
|
// ==============================
|
|
282
282
|
|
|
283
283
|
export const menuListCSS = ({
|
|
284
|
-
maxHeight
|
|
285
|
-
theme: {
|
|
286
|
-
spacing: {
|
|
287
|
-
baseUnit
|
|
288
|
-
}
|
|
289
|
-
}
|
|
284
|
+
maxHeight
|
|
290
285
|
}) => ({
|
|
291
286
|
maxHeight,
|
|
292
287
|
overflowY: 'auto',
|
|
293
288
|
position: 'relative',
|
|
294
289
|
// required for offset[Height, Top] > keyboard scroll
|
|
295
290
|
WebkitOverflowScrolling: 'touch',
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
292
|
+
paddingBottom: "var(--ds-space-100, 8px)"
|
|
298
293
|
});
|
|
299
294
|
|
|
300
295
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -5,57 +5,116 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
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
|
+
};
|
|
25
58
|
export const multiValueLabelCSS = ({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
colors
|
|
29
|
-
},
|
|
30
|
-
cropWithEllipsis
|
|
59
|
+
cropWithEllipsis,
|
|
60
|
+
isDisabled
|
|
31
61
|
}) => ({
|
|
32
62
|
overflow: 'hidden',
|
|
33
63
|
textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,
|
|
34
64
|
whiteSpace: 'nowrap',
|
|
35
|
-
borderRadius:
|
|
36
|
-
color: colors.neutral80,
|
|
65
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
37
66
|
fontSize: '85%',
|
|
38
|
-
|
|
39
|
-
|
|
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)"
|
|
76
|
+
})
|
|
40
77
|
});
|
|
41
78
|
export const multiValueRemoveCSS = ({
|
|
42
|
-
theme: {
|
|
43
|
-
spacing,
|
|
44
|
-
borderRadius,
|
|
45
|
-
colors
|
|
46
|
-
},
|
|
47
79
|
isFocused
|
|
48
80
|
}) => ({
|
|
49
81
|
alignItems: 'center',
|
|
50
82
|
display: 'flex',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
paddingLeft:
|
|
54
|
-
paddingRight:
|
|
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
|
|
55
89
|
':hover': {
|
|
56
|
-
backgroundColor:
|
|
57
|
-
|
|
58
|
-
}
|
|
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
|
+
},
|
|
111
|
+
':hover': {
|
|
112
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
113
|
+
},
|
|
114
|
+
':active': {
|
|
115
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
116
|
+
}
|
|
117
|
+
})
|
|
59
118
|
});
|
|
60
119
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
61
120
|
export const MultiValueGeneric = ({
|
|
@@ -5,31 +5,56 @@ 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';
|
|
9
|
+
import { isAppleDevice } from '../accessibility/helpers';
|
|
8
10
|
import { getStyleProps } from '../utils';
|
|
11
|
+
import A11yText from './internal/a11y-text';
|
|
9
12
|
export const optionCSS = ({
|
|
10
13
|
isDisabled,
|
|
11
14
|
isFocused,
|
|
12
|
-
isSelected
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
isSelected
|
|
16
|
+
}) => {
|
|
17
|
+
let color = "var(--ds-text, #172B4D)";
|
|
18
|
+
if (isDisabled) {
|
|
19
|
+
color = "var(--ds-text-disabled, #091E424F)";
|
|
20
|
+
} else if (isSelected) {
|
|
21
|
+
color = "var(--ds-text-selected, #0C66E4)";
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
padding: `${spacing.baseUnit * 2}px ${spacing.baseUnit * 3}px`,
|
|
28
|
-
// provide some affordance on touch devices
|
|
29
|
-
':active': {
|
|
30
|
-
backgroundColor: !isDisabled ? isSelected ? colors.primary : colors.primary50 : undefined
|
|
23
|
+
let boxShadow;
|
|
24
|
+
let backgroundColor;
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
backgroundColor = undefined;
|
|
27
|
+
} else if (isSelected && isFocused) {
|
|
28
|
+
backgroundColor = "var(--ds-background-selected-hovered, #CCE0FF)";
|
|
29
|
+
} else if (isSelected) {
|
|
30
|
+
backgroundColor = "var(--ds-background-selected, #E9F2FF)";
|
|
31
|
+
} else if (isFocused) {
|
|
32
|
+
backgroundColor = "var(--ds-background-neutral-subtle-hovered, #091E420F)";
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
if (!isDisabled && (isFocused || isSelected)) {
|
|
35
|
+
boxShadow = `inset 2px 0px 0px ${"var(--ds-border-selected, #0C66E4)"}`;
|
|
36
|
+
}
|
|
37
|
+
const cursor = isDisabled ? 'not-allowed' : 'default';
|
|
38
|
+
return {
|
|
39
|
+
label: 'option',
|
|
40
|
+
display: 'block',
|
|
41
|
+
fontSize: 'inherit',
|
|
42
|
+
width: '100%',
|
|
43
|
+
userSelect: 'none',
|
|
44
|
+
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
45
|
+
padding: `${"var(--ds-space-075, 6px)"} ${"var(--ds-space-150, 12px)"}`,
|
|
46
|
+
backgroundColor,
|
|
47
|
+
color,
|
|
48
|
+
cursor,
|
|
49
|
+
boxShadow,
|
|
50
|
+
':active': {
|
|
51
|
+
backgroundColor: !isDisabled ? isSelected ? "var(--ds-background-selected-pressed, #85B8FF)" : "var(--ds-background-neutral-subtle-pressed, #091E4224)" : undefined
|
|
52
|
+
},
|
|
53
|
+
'@media screen and (-ms-high-contrast: active)': {
|
|
54
|
+
borderLeft: !isDisabled && (isFocused || isSelected) ? '2px solid transparent' : ''
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
33
58
|
const Option = props => {
|
|
34
59
|
const {
|
|
35
60
|
children,
|
|
@@ -39,17 +64,18 @@ const Option = props => {
|
|
|
39
64
|
innerRef,
|
|
40
65
|
innerProps
|
|
41
66
|
} = props;
|
|
67
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
68
|
+
const isVoiceOver = isAppleDevice() && fg('design_system_select-a11y-improvement');
|
|
42
69
|
return jsx("div", _extends({}, getStyleProps(props, 'option', {
|
|
43
70
|
option: true,
|
|
44
71
|
'option--is-disabled': isDisabled,
|
|
45
72
|
'option--is-focused': isFocused,
|
|
46
73
|
'option--is-selected': isSelected
|
|
47
74
|
}), {
|
|
48
|
-
ref: innerRef
|
|
49
|
-
"aria-disabled": isDisabled
|
|
75
|
+
ref: innerRef
|
|
50
76
|
}, innerProps, {
|
|
51
77
|
tabIndex: -1
|
|
52
|
-
}), children);
|
|
78
|
+
}), children, isVoiceOver && (isSelected || isDisabled) && jsx(A11yText, null, `${isSelected ? ',selected' : ''}${isDisabled ? ',dimmed' : ''}`));
|
|
53
79
|
};
|
|
54
80
|
|
|
55
81
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -7,16 +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
|
-
spacing,
|
|
12
|
-
colors
|
|
13
|
-
}
|
|
10
|
+
isDisabled
|
|
14
11
|
}) => ({
|
|
15
12
|
label: 'placeholder',
|
|
16
13
|
gridArea: '1 / 1 / 2 / 3',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
marginRight: spacing.baseUnit / 2
|
|
14
|
+
margin: `0 ${"var(--ds-space-025, 2px)"}`,
|
|
15
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtlest, #626F86)"
|
|
20
16
|
});
|
|
21
17
|
const Placeholder = props => {
|
|
22
18
|
const {
|
|
@@ -9,8 +9,7 @@ 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',
|
|
@@ -19,9 +18,8 @@ export const css = ({
|
|
|
19
18
|
overflow: 'hidden',
|
|
20
19
|
textOverflow: 'ellipsis',
|
|
21
20
|
whiteSpace: 'nowrap',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
marginRight: spacing.baseUnit / 2
|
|
21
|
+
margin: `0 ${"var(--ds-space-025, 2px)"}`,
|
|
22
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text, #172B4D)"
|
|
25
23
|
});
|
|
26
24
|
const SingleValue = props => {
|
|
27
25
|
const {
|