@atlaskit/react-select 1.5.2 → 1.6.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 +14 -0
- package/dist/cjs/components/group.js +2 -7
- package/dist/cjs/components/index.js +0 -3
- package/dist/cjs/components/indicators.js +54 -133
- package/dist/cjs/components/input.js +5 -8
- package/dist/cjs/components/internal/dummy-input.js +1 -0
- package/dist/cjs/components/menu.js +16 -18
- package/dist/cjs/components/multi-value.js +48 -10
- package/dist/cjs/components/option.js +1 -0
- package/dist/cjs/components/single-value.js +1 -2
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/select.js +96 -135
- package/dist/cjs/styles.js +0 -1
- package/dist/cjs/utils.js +1 -2
- package/dist/es2019/components/group.js +2 -7
- package/dist/es2019/components/index.js +1 -4
- package/dist/es2019/components/indicators.js +39 -113
- package/dist/es2019/components/input.js +5 -9
- package/dist/es2019/components/internal/dummy-input.js +1 -0
- package/dist/es2019/components/menu.js +16 -26
- package/dist/es2019/components/multi-value.js +49 -12
- package/dist/es2019/components/option.js +1 -0
- package/dist/es2019/components/single-value.js +1 -4
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/select.js +15 -56
- package/dist/es2019/styles.js +1 -2
- package/dist/es2019/utils.js +0 -2
- package/dist/esm/components/group.js +2 -7
- package/dist/esm/components/index.js +1 -4
- package/dist/esm/components/indicators.js +54 -133
- package/dist/esm/components/input.js +5 -8
- package/dist/esm/components/internal/dummy-input.js +1 -0
- package/dist/esm/components/menu.js +16 -18
- package/dist/esm/components/multi-value.js +49 -11
- package/dist/esm/components/option.js +1 -0
- package/dist/esm/components/single-value.js +1 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/select.js +96 -135
- package/dist/esm/styles.js +1 -2
- package/dist/esm/utils.js +1 -2
- package/dist/types/components/group.d.ts +1 -2
- package/dist/types/components/index.d.ts +16 -22
- package/dist/types/components/indicators.d.ts +1 -16
- package/dist/types/components/input.d.ts +1 -1
- package/dist/types/components/menu.d.ts +3 -3
- package/dist/types/components/multi-value.d.ts +3 -2
- package/dist/types/components/single-value.d.ts +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/select.d.ts +15 -28
- package/dist/types/styles.d.ts +1 -3
- package/dist/types/theme.d.ts +0 -1
- package/dist/types/types.d.ts +0 -1
- package/dist/types-ts4.5/components/group.d.ts +1 -2
- package/dist/types-ts4.5/components/index.d.ts +16 -22
- package/dist/types-ts4.5/components/indicators.d.ts +1 -16
- package/dist/types-ts4.5/components/input.d.ts +1 -1
- package/dist/types-ts4.5/components/menu.d.ts +3 -3
- package/dist/types-ts4.5/components/multi-value.d.ts +3 -2
- package/dist/types-ts4.5/components/single-value.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -3
- package/dist/types-ts4.5/select.d.ts +15 -28
- package/dist/types-ts4.5/styles.d.ts +1 -3
- package/dist/types-ts4.5/theme.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -1
- package/package.json +9 -3
- package/types/package.json +17 -0
|
@@ -4,48 +4,28 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
8
|
+
import DownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
9
|
+
import CrossIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
|
|
10
|
+
import { Inline, Pressable, xcss } from '@atlaskit/primitives';
|
|
11
|
+
import Spinner from '@atlaskit/spinner';
|
|
8
12
|
import { getStyleProps } from '../utils';
|
|
9
13
|
|
|
10
14
|
// ==============================
|
|
11
15
|
// Dropdown & Clear Icons
|
|
12
16
|
// ==============================
|
|
13
17
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const iconContainerStyles = xcss({
|
|
19
|
+
all: 'unset',
|
|
20
|
+
outline: 'revert',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
padding: 'space.025'
|
|
25
|
+
});
|
|
26
|
+
const dropdownWrapperStyles = xcss({
|
|
27
|
+
padding: 'space.075'
|
|
20
28
|
});
|
|
21
|
-
const Svg = ({
|
|
22
|
-
size,
|
|
23
|
-
...props
|
|
24
|
-
}) => jsx("svg", _extends({
|
|
25
|
-
height: size,
|
|
26
|
-
width: size,
|
|
27
|
-
viewBox: "0 0 20 20",
|
|
28
|
-
"aria-hidden": "true",
|
|
29
|
-
focusable: "false",
|
|
30
|
-
css: styles
|
|
31
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
32
|
-
}, props));
|
|
33
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
34
|
-
export const CrossIcon = props =>
|
|
35
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
36
|
-
jsx(Svg, _extends({
|
|
37
|
-
size: 20
|
|
38
|
-
}, props), jsx("path", {
|
|
39
|
-
d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
|
|
40
|
-
}));
|
|
41
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
42
|
-
export const DownChevron = props =>
|
|
43
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
44
|
-
jsx(Svg, _extends({
|
|
45
|
-
size: 20
|
|
46
|
-
}, props), jsx("path", {
|
|
47
|
-
d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
|
48
|
-
}));
|
|
49
29
|
|
|
50
30
|
// ==============================
|
|
51
31
|
// Dropdown & Clear Buttons
|
|
@@ -68,13 +48,20 @@ export const dropdownIndicatorCSS = ({
|
|
|
68
48
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
69
49
|
export const DropdownIndicator = props => {
|
|
70
50
|
const {
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
innerProps,
|
|
52
|
+
children
|
|
73
53
|
} = props;
|
|
74
54
|
return jsx("div", _extends({}, getStyleProps(props, 'dropdownIndicator', {
|
|
75
55
|
indicator: true,
|
|
76
56
|
'dropdown-indicator': true
|
|
77
|
-
}), innerProps), children
|
|
57
|
+
}), innerProps), children ? children : jsx(Inline, {
|
|
58
|
+
as: "span",
|
|
59
|
+
xcss: dropdownWrapperStyles
|
|
60
|
+
}, jsx(DownIcon, {
|
|
61
|
+
color: "currentColor",
|
|
62
|
+
label: "open",
|
|
63
|
+
LEGACY_margin: "var(--ds-space-negative-075, -0.375rem)"
|
|
64
|
+
})));
|
|
78
65
|
};
|
|
79
66
|
export const clearIndicatorCSS = ({
|
|
80
67
|
isCompact
|
|
@@ -92,37 +79,21 @@ export const clearIndicatorCSS = ({
|
|
|
92
79
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
93
80
|
export const ClearIndicator = props => {
|
|
94
81
|
const {
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
innerProps,
|
|
83
|
+
clearControlLabel = 'clear'
|
|
97
84
|
} = props;
|
|
98
85
|
return jsx("div", _extends({}, getStyleProps(props, 'clearIndicator', {
|
|
99
86
|
indicator: true,
|
|
100
87
|
'clear-indicator': true
|
|
101
|
-
}), innerProps),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}) => ({
|
|
111
|
-
label: 'indicatorSeparator',
|
|
112
|
-
alignSelf: 'stretch',
|
|
113
|
-
width: 1,
|
|
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)"
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
120
|
-
export const IndicatorSeparator = props => {
|
|
121
|
-
const {
|
|
122
|
-
innerProps
|
|
123
|
-
} = props;
|
|
124
|
-
return jsx("span", _extends({}, innerProps, getStyleProps(props, 'indicatorSeparator', {
|
|
125
|
-
'indicator-separator': true
|
|
88
|
+
}), innerProps), jsx(Pressable, {
|
|
89
|
+
xcss: iconContainerStyles,
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
"aria-label": clearControlLabel
|
|
92
|
+
}, jsx(CrossIcon, {
|
|
93
|
+
label: "",
|
|
94
|
+
color: "currentColor",
|
|
95
|
+
LEGACY_size: "small",
|
|
96
|
+
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
126
97
|
})));
|
|
127
98
|
};
|
|
128
99
|
|
|
@@ -130,50 +101,12 @@ export const IndicatorSeparator = props => {
|
|
|
130
101
|
// Loading
|
|
131
102
|
// ==============================
|
|
132
103
|
|
|
133
|
-
const loadingDotAnimations = keyframes({
|
|
134
|
-
'0%, 80%, 100%': {
|
|
135
|
-
opacity: 0
|
|
136
|
-
},
|
|
137
|
-
'40%': {
|
|
138
|
-
opacity: 1
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
104
|
export const loadingIndicatorCSS = ({
|
|
142
|
-
|
|
143
|
-
size,
|
|
144
|
-
isCompact,
|
|
145
|
-
theme: {
|
|
146
|
-
colors
|
|
147
|
-
}
|
|
105
|
+
isCompact
|
|
148
106
|
}) => ({
|
|
149
107
|
label: 'loadingIndicator',
|
|
150
|
-
display: 'flex',
|
|
151
|
-
transition: 'color 150ms',
|
|
152
|
-
alignSelf: 'center',
|
|
153
|
-
fontSize: size,
|
|
154
|
-
lineHeight: 1,
|
|
155
|
-
marginRight: size,
|
|
156
|
-
textAlign: 'center',
|
|
157
|
-
verticalAlign: 'middle',
|
|
158
|
-
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
159
108
|
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-100, 8px)"}`
|
|
160
109
|
});
|
|
161
|
-
const LoadingDot = ({
|
|
162
|
-
delay,
|
|
163
|
-
offset
|
|
164
|
-
}) => jsx("span", {
|
|
165
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
166
|
-
css: {
|
|
167
|
-
animation: `${loadingDotAnimations} 1s ease-in-out ${delay}ms infinite;`,
|
|
168
|
-
backgroundColor: 'currentColor',
|
|
169
|
-
borderRadius: '1em',
|
|
170
|
-
display: 'inline-block',
|
|
171
|
-
marginLeft: offset ? '1em' : undefined,
|
|
172
|
-
height: '1em',
|
|
173
|
-
verticalAlign: 'top',
|
|
174
|
-
width: '1em'
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
110
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
178
111
|
export const LoadingIndicator = ({
|
|
179
112
|
innerProps,
|
|
@@ -189,14 +122,7 @@ export const LoadingIndicator = ({
|
|
|
189
122
|
}, 'loadingIndicator', {
|
|
190
123
|
indicator: true,
|
|
191
124
|
'loading-indicator': true
|
|
192
|
-
}), innerProps), jsx(
|
|
193
|
-
|
|
194
|
-
offset: isRtl
|
|
195
|
-
}), jsx(LoadingDot, {
|
|
196
|
-
delay: 160,
|
|
197
|
-
offset: true
|
|
198
|
-
}), jsx(LoadingDot, {
|
|
199
|
-
delay: 320,
|
|
200
|
-
offset: !isRtl
|
|
125
|
+
}), innerProps), jsx(Spinner, {
|
|
126
|
+
size: "small"
|
|
201
127
|
}));
|
|
202
128
|
};
|
|
@@ -8,21 +8,17 @@ import { jsx } from '@emotion/react';
|
|
|
8
8
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
9
9
|
export const inputCSS = ({
|
|
10
10
|
isDisabled,
|
|
11
|
-
value
|
|
12
|
-
theme: {
|
|
13
|
-
spacing,
|
|
14
|
-
colors
|
|
15
|
-
}
|
|
11
|
+
value
|
|
16
12
|
}) => ({
|
|
17
13
|
visibility: isDisabled ? 'hidden' : 'visible',
|
|
18
14
|
// force css to recompute when value change due to @emotion bug.
|
|
19
15
|
// We can remove it whenever the bug is fixed.
|
|
20
16
|
transform: value ? 'translateZ(0)' : '',
|
|
21
17
|
...containerStyle,
|
|
22
|
-
margin:
|
|
23
|
-
paddingBottom:
|
|
24
|
-
paddingTop:
|
|
25
|
-
color: "var(--ds-text,
|
|
18
|
+
margin: "var(--ds-space-025, 2px)",
|
|
19
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
20
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
21
|
+
color: "var(--ds-text, #172B4D)"
|
|
26
22
|
});
|
|
27
23
|
const spacingStyle = {
|
|
28
24
|
gridArea: '1 / 2',
|
|
@@ -9,6 +9,7 @@ import { autoUpdate } from '@floating-ui/dom';
|
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import useLayoutEffect from 'use-isomorphic-layout-effect';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { Text } from '@atlaskit/primitives';
|
|
12
13
|
import { animatedScrollTo, getBoundingClientObj, getScrollParent, getScrollTop, getStyleProps, normalizedHeight, scrollTo } from '../utils';
|
|
13
14
|
|
|
14
15
|
// ==============================
|
|
@@ -192,21 +193,16 @@ function alignToControl(placement) {
|
|
|
192
193
|
}
|
|
193
194
|
const coercePlacement = p => p === 'auto' ? 'bottom' : p;
|
|
194
195
|
export const menuCSS = ({
|
|
195
|
-
placement
|
|
196
|
-
theme: {
|
|
197
|
-
borderRadius,
|
|
198
|
-
spacing,
|
|
199
|
-
colors
|
|
200
|
-
}
|
|
196
|
+
placement
|
|
201
197
|
}) => ({
|
|
202
198
|
label: 'menu',
|
|
203
199
|
[alignToControl(placement)]: '100%',
|
|
204
200
|
position: 'absolute',
|
|
205
201
|
width: '100%',
|
|
206
202
|
zIndex: 1,
|
|
207
|
-
borderRadius:
|
|
208
|
-
marginBottom:
|
|
209
|
-
marginTop:
|
|
203
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
204
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
205
|
+
marginTop: "var(--ds-space-100, 8px)",
|
|
210
206
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
211
207
|
boxShadow: "var(--ds-shadow-overlay, 0 0 0 1px hsl(0deg 0% 0% / 10%), 0 4px 11px hsl(0deg 0% 0% / 10%))"
|
|
212
208
|
});
|
|
@@ -221,8 +217,7 @@ export const MenuPlacer = props => {
|
|
|
221
217
|
maxMenuHeight,
|
|
222
218
|
menuPlacement,
|
|
223
219
|
menuPosition,
|
|
224
|
-
menuShouldScrollIntoView
|
|
225
|
-
theme
|
|
220
|
+
menuShouldScrollIntoView
|
|
226
221
|
} = props;
|
|
227
222
|
const {
|
|
228
223
|
setPortalPlacement
|
|
@@ -230,9 +225,8 @@ export const MenuPlacer = props => {
|
|
|
230
225
|
const ref = useRef(null);
|
|
231
226
|
const [maxHeight, setMaxHeight] = useState(maxMenuHeight);
|
|
232
227
|
const [placement, setPlacement] = useState(null);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
} = theme.spacing;
|
|
228
|
+
// The minimum height of the control
|
|
229
|
+
const controlHeight = 38;
|
|
236
230
|
useLayoutEffect(() => {
|
|
237
231
|
const menuEl = ref.current;
|
|
238
232
|
if (!menuEl) {
|
|
@@ -318,17 +312,9 @@ export const MenuList = props => {
|
|
|
318
312
|
// Menu Notices
|
|
319
313
|
// ==============================
|
|
320
314
|
|
|
321
|
-
const noticeCSS = ({
|
|
322
|
-
theme: {
|
|
323
|
-
spacing: {
|
|
324
|
-
baseUnit
|
|
325
|
-
},
|
|
326
|
-
colors
|
|
327
|
-
}
|
|
328
|
-
}) => ({
|
|
315
|
+
const noticeCSS = ({}) => ({
|
|
329
316
|
textAlign: 'center',
|
|
330
|
-
|
|
331
|
-
padding: `${baseUnit * 2}px ${baseUnit * 3}px`
|
|
317
|
+
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-150, 12px)"}`
|
|
332
318
|
});
|
|
333
319
|
export const noOptionsMessageCSS = noticeCSS;
|
|
334
320
|
export const loadingMessageCSS = noticeCSS;
|
|
@@ -348,7 +334,9 @@ export const NoOptionsMessage = ({
|
|
|
348
334
|
}), {
|
|
349
335
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
350
336
|
role: "option"
|
|
351
|
-
}, innerProps),
|
|
337
|
+
}, innerProps), jsx(Text, {
|
|
338
|
+
color: "color.text.subtle"
|
|
339
|
+
}, children));
|
|
352
340
|
};
|
|
353
341
|
|
|
354
342
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -367,7 +355,9 @@ export const LoadingMessage = ({
|
|
|
367
355
|
}), innerProps, {
|
|
368
356
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
369
357
|
role: "option"
|
|
370
|
-
}),
|
|
358
|
+
}), jsx(Text, {
|
|
359
|
+
color: "color.text.subtle"
|
|
360
|
+
}, children));
|
|
371
361
|
};
|
|
372
362
|
|
|
373
363
|
// ==============================
|
|
@@ -4,18 +4,15 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import LegacySelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
9
|
+
import CrossIcon from '@atlaskit/icon/utility/cross';
|
|
8
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { Inline, xcss } from '@atlaskit/primitives';
|
|
9
12
|
import { getStyleProps } from '../utils';
|
|
10
|
-
import { CrossIcon } from './indicators';
|
|
11
13
|
export const multiValueCSS = ({
|
|
12
14
|
isDisabled,
|
|
13
|
-
isFocused
|
|
14
|
-
theme: {
|
|
15
|
-
spacing,
|
|
16
|
-
borderRadius,
|
|
17
|
-
colors
|
|
18
|
-
}
|
|
15
|
+
isFocused
|
|
19
16
|
}) => {
|
|
20
17
|
let backgroundColor;
|
|
21
18
|
let color;
|
|
@@ -63,6 +60,7 @@ export const multiValueLabelCSS = ({
|
|
|
63
60
|
textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,
|
|
64
61
|
whiteSpace: 'nowrap',
|
|
65
62
|
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
63
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
66
64
|
fontSize: '85%',
|
|
67
65
|
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
66
|
padding: "var(--ds-space-025, 2px)",
|
|
@@ -127,15 +125,53 @@ export const MultiValueContainer = MultiValueGeneric;
|
|
|
127
125
|
|
|
128
126
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
129
127
|
export const MultiValueLabel = MultiValueGeneric;
|
|
128
|
+
const disabledStyles = css({
|
|
129
|
+
display: 'none'
|
|
130
|
+
});
|
|
131
|
+
const enabledStyles = css({
|
|
132
|
+
display: 'inherit'
|
|
133
|
+
});
|
|
134
|
+
const iconWrapperStyles = xcss({
|
|
135
|
+
padding: 'space.025'
|
|
136
|
+
});
|
|
137
|
+
const renderIcon = () => {
|
|
138
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
139
|
+
if (fg('platform-component-visual-refresh')) {
|
|
140
|
+
return jsx(CrossIcon, {
|
|
141
|
+
label: "Clear",
|
|
142
|
+
color: "currentColor"
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
147
|
+
if (fg('platform-visual-refresh-icons-legacy-facade')) {
|
|
148
|
+
return jsx(Inline, {
|
|
149
|
+
xcss: iconWrapperStyles
|
|
150
|
+
}, jsx(CrossIcon, {
|
|
151
|
+
label: "Clear",
|
|
152
|
+
color: "currentColor"
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
return (
|
|
156
|
+
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
157
|
+
jsx(LegacySelectClearIcon, {
|
|
158
|
+
label: "Clear",
|
|
159
|
+
primaryColor: "transparent",
|
|
160
|
+
size: "small",
|
|
161
|
+
secondaryColor: "inherit"
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
};
|
|
130
165
|
export function MultiValueRemove({
|
|
131
|
-
|
|
166
|
+
isDisabled,
|
|
132
167
|
innerProps
|
|
133
168
|
}) {
|
|
134
169
|
return jsx("div", _extends({
|
|
135
170
|
role: "button"
|
|
136
|
-
}, innerProps),
|
|
137
|
-
|
|
138
|
-
|
|
171
|
+
}, innerProps), jsx("div", {
|
|
172
|
+
css: isDisabled ? disabledStyles : enabledStyles,
|
|
173
|
+
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
174
|
+
}, renderIcon()));
|
|
139
175
|
}
|
|
140
176
|
const MultiValue = props => {
|
|
141
177
|
const {
|
|
@@ -179,6 +215,7 @@ const MultiValue = props => {
|
|
|
179
215
|
'aria-label': `Remove ${children || 'option'}`,
|
|
180
216
|
...removeProps
|
|
181
217
|
},
|
|
218
|
+
isDisabled: isDisabled,
|
|
182
219
|
selectProps: selectProps
|
|
183
220
|
}));
|
|
184
221
|
};
|
|
@@ -7,10 +7,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { getStyleProps } from '../utils';
|
|
9
9
|
export const css = ({
|
|
10
|
-
isDisabled
|
|
11
|
-
theme: {
|
|
12
|
-
spacing
|
|
13
|
-
}
|
|
10
|
+
isDisabled
|
|
14
11
|
}) => ({
|
|
15
12
|
label: 'singleValue',
|
|
16
13
|
gridArea: '1 / 1 / 2 / 3',
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import useStateManager from './use-state-manager';
|
|
2
2
|
export { default } from './state-manager';
|
|
3
3
|
export { mergeStyles } from './styles';
|
|
4
|
-
export { defaultTheme } from './theme';
|
|
5
4
|
export { createFilter } from './filters';
|
|
6
5
|
export { components } from './components';
|
|
7
6
|
export { useStateManager };
|
package/dist/es2019/select.js
CHANGED
|
@@ -11,10 +11,10 @@ import LiveRegion from './components/live-region';
|
|
|
11
11
|
import { MenuPlacer } from './components/menu';
|
|
12
12
|
import { createFilter } from './filters';
|
|
13
13
|
import { defaultStyles } from './styles';
|
|
14
|
-
import { defaultTheme } from './theme';
|
|
15
14
|
import { classNames, cleanValue, isDocumentElement, isMobileDevice, isTouchCapable, multiValueAsValue, noop, notNullish, scrollIntoView, singleValueAsValue, valueTernary } from './utils';
|
|
16
15
|
export const defaultProps = {
|
|
17
16
|
// aria-live is by default with the live region so we don't need it
|
|
17
|
+
// eslint-disable-next-line @atlaskit/platform/no-module-level-eval
|
|
18
18
|
'aria-live': fg('design_system_select-a11y-improvement') ? undefined : 'polite',
|
|
19
19
|
backspaceRemovesValue: true,
|
|
20
20
|
blurInputOnSelect: isTouchCapable(),
|
|
@@ -356,6 +356,9 @@ export default class Select extends Component {
|
|
|
356
356
|
removedValue: lastSelectedValue
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
|
+
// ==============================
|
|
360
|
+
// Getters
|
|
361
|
+
// ==============================
|
|
359
362
|
_defineProperty(this, "getFocusedOptionId", focusedOption => {
|
|
360
363
|
return getFocusedOptionId(this.state.focusableOptionsWithIds, focusedOption);
|
|
361
364
|
});
|
|
@@ -1074,28 +1077,6 @@ export default class Select extends Component {
|
|
|
1074
1077
|
focusedOptionId: this.getFocusedOptionId(options[nextFocus])
|
|
1075
1078
|
});
|
|
1076
1079
|
}
|
|
1077
|
-
// ==============================
|
|
1078
|
-
// Getters
|
|
1079
|
-
// ==============================
|
|
1080
|
-
|
|
1081
|
-
getTheme() {
|
|
1082
|
-
// Use the default theme if there are no customisations.
|
|
1083
|
-
if (!this.props.theme) {
|
|
1084
|
-
return defaultTheme;
|
|
1085
|
-
}
|
|
1086
|
-
// If the theme prop is a function, assume the function
|
|
1087
|
-
// knows how to merge the passed-in default theme with
|
|
1088
|
-
// its own modifications.
|
|
1089
|
-
if (typeof this.props.theme === 'function') {
|
|
1090
|
-
return this.props.theme(defaultTheme);
|
|
1091
|
-
}
|
|
1092
|
-
// Otherwise, if a plain theme object was passed in,
|
|
1093
|
-
// overlay it with the default theme.
|
|
1094
|
-
return {
|
|
1095
|
-
...defaultTheme,
|
|
1096
|
-
...this.props.theme
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
1080
|
getCommonProps() {
|
|
1100
1081
|
const {
|
|
1101
1082
|
clearValue,
|
|
@@ -1125,8 +1106,7 @@ export default class Select extends Component {
|
|
|
1125
1106
|
options,
|
|
1126
1107
|
selectOption,
|
|
1127
1108
|
selectProps: props,
|
|
1128
|
-
setValue
|
|
1129
|
-
theme: this.getTheme()
|
|
1109
|
+
setValue
|
|
1130
1110
|
};
|
|
1131
1111
|
}
|
|
1132
1112
|
hasValue() {
|
|
@@ -1425,8 +1405,7 @@ export default class Select extends Component {
|
|
|
1425
1405
|
}
|
|
1426
1406
|
const innerProps = {
|
|
1427
1407
|
onMouseDown: this.onClearIndicatorMouseDown,
|
|
1428
|
-
onTouchEnd: this.onClearIndicatorTouchEnd
|
|
1429
|
-
'aria-hidden': 'true'
|
|
1408
|
+
onTouchEnd: this.onClearIndicatorTouchEnd
|
|
1430
1409
|
};
|
|
1431
1410
|
const isCompact = spacing === 'compact';
|
|
1432
1411
|
return /*#__PURE__*/React.createElement(ClearIndicator, _extends({
|
|
@@ -1466,30 +1445,6 @@ export default class Select extends Component {
|
|
|
1466
1445
|
isCompact: isCompact
|
|
1467
1446
|
}));
|
|
1468
1447
|
}
|
|
1469
|
-
renderIndicatorSeparator() {
|
|
1470
|
-
const {
|
|
1471
|
-
DropdownIndicator,
|
|
1472
|
-
IndicatorSeparator
|
|
1473
|
-
} = this.getComponents();
|
|
1474
|
-
|
|
1475
|
-
// separator doesn't make sense without the dropdown indicator
|
|
1476
|
-
if (!DropdownIndicator || !IndicatorSeparator) {
|
|
1477
|
-
return null;
|
|
1478
|
-
}
|
|
1479
|
-
const {
|
|
1480
|
-
commonProps
|
|
1481
|
-
} = this;
|
|
1482
|
-
const {
|
|
1483
|
-
isDisabled
|
|
1484
|
-
} = this.props;
|
|
1485
|
-
const {
|
|
1486
|
-
isFocused
|
|
1487
|
-
} = this.state;
|
|
1488
|
-
return /*#__PURE__*/React.createElement(IndicatorSeparator, _extends({}, commonProps, {
|
|
1489
|
-
isDisabled: isDisabled,
|
|
1490
|
-
isFocused: isFocused
|
|
1491
|
-
}));
|
|
1492
|
-
}
|
|
1493
1448
|
renderDropdownIndicator() {
|
|
1494
1449
|
const {
|
|
1495
1450
|
DropdownIndicator
|
|
@@ -1777,10 +1732,14 @@ export default class Select extends Component {
|
|
|
1777
1732
|
}));
|
|
1778
1733
|
}
|
|
1779
1734
|
renderMultiselectMessage() {
|
|
1780
|
-
return
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1735
|
+
return (
|
|
1736
|
+
/*#__PURE__*/
|
|
1737
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
1738
|
+
React.createElement("span", {
|
|
1739
|
+
id: this.getElementId('multi-message'),
|
|
1740
|
+
hidden: true
|
|
1741
|
+
}, ", multiple selections available,")
|
|
1742
|
+
);
|
|
1784
1743
|
}
|
|
1785
1744
|
render() {
|
|
1786
1745
|
const {
|
|
@@ -1829,7 +1788,7 @@ export default class Select extends Component {
|
|
|
1829
1788
|
isCompact: isCompact
|
|
1830
1789
|
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {
|
|
1831
1790
|
isDisabled: isDisabled
|
|
1832
|
-
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.
|
|
1791
|
+
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
|
1833
1792
|
}
|
|
1834
1793
|
}
|
|
1835
1794
|
_defineProperty(Select, "defaultProps", defaultProps);
|
package/dist/es2019/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { containerCSS, indicatorsContainerCSS, valueContainerCSS } from './components/containers';
|
|
2
2
|
import { css as controlCSS } from './components/control';
|
|
3
3
|
import { groupCSS, groupHeadingCSS } from './components/group';
|
|
4
|
-
import { clearIndicatorCSS, dropdownIndicatorCSS,
|
|
4
|
+
import { clearIndicatorCSS, dropdownIndicatorCSS, loadingIndicatorCSS } from './components/indicators';
|
|
5
5
|
import { inputCSS } from './components/input';
|
|
6
6
|
import { loadingMessageCSS, menuCSS, menuListCSS, menuPortalCSS, noOptionsMessageCSS } from './components/menu';
|
|
7
7
|
import { multiValueCSS, multiValueLabelCSS, multiValueRemoveCSS } from './components/multi-value';
|
|
@@ -16,7 +16,6 @@ export const defaultStyles = {
|
|
|
16
16
|
group: groupCSS,
|
|
17
17
|
groupHeading: groupHeadingCSS,
|
|
18
18
|
indicatorsContainer: indicatorsContainerCSS,
|
|
19
|
-
indicatorSeparator: indicatorSeparatorCSS,
|
|
20
19
|
input: inputCSS,
|
|
21
20
|
loadingIndicator: loadingIndicatorCSS,
|
|
22
21
|
loadingMessage: loadingMessageCSS,
|
package/dist/es2019/utils.js
CHANGED
|
@@ -25,15 +25,11 @@ var Group = function Group(props) {
|
|
|
25
25
|
headingProps = props.headingProps,
|
|
26
26
|
innerProps = props.innerProps,
|
|
27
27
|
label = props.label,
|
|
28
|
-
theme = props.theme,
|
|
29
28
|
selectProps = props.selectProps;
|
|
30
29
|
return jsx("div", _extends({}, getStyleProps(props, 'group', {
|
|
31
30
|
group: true
|
|
32
31
|
}), innerProps), jsx(Heading, _extends({}, headingProps, {
|
|
33
|
-
selectProps: selectProps
|
|
34
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
35
|
-
,
|
|
36
|
-
theme: theme,
|
|
32
|
+
selectProps: selectProps,
|
|
37
33
|
getStyles: getStyles,
|
|
38
34
|
getClassNames: getClassNames,
|
|
39
35
|
cx: cx
|
|
@@ -45,13 +41,12 @@ export var groupHeadingCSS = function groupHeadingCSS(_ref2) {
|
|
|
45
41
|
label: 'group',
|
|
46
42
|
cursor: 'default',
|
|
47
43
|
display: 'block',
|
|
48
|
-
fontSize: '75%',
|
|
49
44
|
marginBottom: '0.25em',
|
|
50
45
|
paddingLeft: "var(--ds-space-150, 12px)",
|
|
51
46
|
paddingRight: "var(--ds-space-150, 12px)",
|
|
52
47
|
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)",
|
|
53
48
|
color: "var(--ds-text-subtle, #44546F)",
|
|
54
|
-
fontWeight: "var(--ds-font-weight-bold, 700)"
|
|
49
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
55
50
|
textTransform: 'none'
|
|
56
51
|
};
|
|
57
52
|
};
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { IndicatorsContainer, SelectContainer, ValueContainer } from './containers';
|
|
5
5
|
import Control from './control';
|
|
6
6
|
import Group, { GroupHeading } from './group';
|
|
7
|
-
import { ClearIndicator,
|
|
7
|
+
import { ClearIndicator, DropdownIndicator, LoadingIndicator } from './indicators';
|
|
8
8
|
import Input from './input';
|
|
9
9
|
import Menu, { LoadingMessage, MenuList, MenuPortal, NoOptionsMessage } from './menu';
|
|
10
10
|
import MultiValue, { MultiValueContainer, MultiValueLabel, MultiValueRemove } from './multi-value';
|
|
@@ -15,12 +15,9 @@ export var components = {
|
|
|
15
15
|
ClearIndicator: ClearIndicator,
|
|
16
16
|
Control: Control,
|
|
17
17
|
DropdownIndicator: DropdownIndicator,
|
|
18
|
-
DownChevron: DownChevron,
|
|
19
|
-
CrossIcon: CrossIcon,
|
|
20
18
|
Group: Group,
|
|
21
19
|
GroupHeading: GroupHeading,
|
|
22
20
|
IndicatorsContainer: IndicatorsContainer,
|
|
23
|
-
IndicatorSeparator: IndicatorSeparator,
|
|
24
21
|
Input: Input,
|
|
25
22
|
LoadingIndicator: LoadingIndicator,
|
|
26
23
|
Menu: Menu,
|