@atlaskit/react-select 2.0.0 → 2.0.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/components/option.js +1 -6
- package/dist/cjs/select.js +9 -12
- package/dist/es2019/components/option.js +1 -6
- package/dist/es2019/select.js +9 -12
- package/dist/esm/components/option.js +1 -6
- package/dist/esm/select.js +10 -13
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/react-select
|
|
2
2
|
|
|
3
|
+
## 2.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#119038](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119038)
|
|
8
|
+
[`5c68906e5ab22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c68906e5ab22) -
|
|
9
|
+
[ux] Update accessible description for when multiple selections are available
|
|
10
|
+
|
|
11
|
+
## 2.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#119843](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119843)
|
|
16
|
+
[`7bd0d851d1c39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7bd0d851d1c39) -
|
|
17
|
+
[ux] Clean up ARIA props that are no longer needed
|
|
18
|
+
|
|
3
19
|
## 2.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
|
@@ -7,10 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.optionCSS = exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _deviceCheck = require("@atlaskit/ds-lib/device-check");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
10
|
var _utils = require("../utils");
|
|
13
|
-
var _a11yText = _interopRequireDefault(require("./internal/a11y-text"));
|
|
14
11
|
/**
|
|
15
12
|
* @jsxRuntime classic
|
|
16
13
|
* @jsx jsx
|
|
@@ -69,8 +66,6 @@ var Option = function Option(props) {
|
|
|
69
66
|
isSelected = props.isSelected,
|
|
70
67
|
innerRef = props.innerRef,
|
|
71
68
|
innerProps = props.innerProps;
|
|
72
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
73
|
-
var isVoiceOver = (0, _deviceCheck.isAppleDevice)() && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement');
|
|
74
69
|
return (0, _react.jsx)("div", (0, _extends2.default)({}, (0, _utils.getStyleProps)(props, 'option', {
|
|
75
70
|
option: true,
|
|
76
71
|
'option--is-disabled': isDisabled,
|
|
@@ -80,7 +75,7 @@ var Option = function Option(props) {
|
|
|
80
75
|
ref: innerRef
|
|
81
76
|
}, innerProps, {
|
|
82
77
|
tabIndex: -1
|
|
83
|
-
}), children
|
|
78
|
+
}), children);
|
|
84
79
|
};
|
|
85
80
|
|
|
86
81
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
package/dist/cjs/select.js
CHANGED
|
@@ -1149,13 +1149,13 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1149
1149
|
var isMulti = this.props.isMulti;
|
|
1150
1150
|
var selectValue = this.state.selectValue;
|
|
1151
1151
|
var defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
|
|
1152
|
-
if (selectValue.length && action !== 'initial-input-focus') {
|
|
1152
|
+
if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
|
|
1153
1153
|
return;
|
|
1154
1154
|
}
|
|
1155
|
-
if (isMulti
|
|
1156
|
-
|
|
1155
|
+
if (isMulti) {
|
|
1156
|
+
var multiMessage = this.getElementId('multi-message');
|
|
1157
1157
|
return {
|
|
1158
|
-
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription,
|
|
1158
|
+
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
|
|
1159
1159
|
};
|
|
1160
1160
|
} else {
|
|
1161
1161
|
return {
|
|
@@ -1261,9 +1261,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1261
1261
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1262
1262
|
'aria-required': required || isRequired,
|
|
1263
1263
|
role: 'combobox',
|
|
1264
|
-
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1265
|
-
// Safari needs aria-owns in order for aria-activedescendant to work properly
|
|
1266
|
-
'aria-owns': (0, _deviceCheck.isSafari)() && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? this.getElementId('listbox') : undefined
|
|
1264
|
+
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1267
1265
|
}, menuIsOpen && {
|
|
1268
1266
|
'aria-controls': this.getElementId('listbox')
|
|
1269
1267
|
}), !isSearchable && {
|
|
@@ -1528,10 +1526,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1528
1526
|
onMouseMove: onHover,
|
|
1529
1527
|
onMouseOver: onHover,
|
|
1530
1528
|
role: 'option',
|
|
1531
|
-
|
|
1532
|
-
'aria-
|
|
1533
|
-
|
|
1534
|
-
'aria-disabled': ((0, _deviceCheck.isAppleDevice)() || !isDisabled) && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1529
|
+
'aria-selected': isSelected,
|
|
1530
|
+
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1531
|
+
'aria-disabled': !isDisabled && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1535
1532
|
'aria-describedby': (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? headingId : undefined
|
|
1536
1533
|
}, testId && {
|
|
1537
1534
|
'data-testid': "".concat(testId, "-select--option-").concat(id)
|
|
@@ -1642,7 +1639,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1642
1639
|
'data-testid': "".concat(testId, "-select--listbox")
|
|
1643
1640
|
}), (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') && {
|
|
1644
1641
|
'aria-label': label,
|
|
1645
|
-
'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input')
|
|
1642
|
+
'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'))
|
|
1646
1643
|
}),
|
|
1647
1644
|
isLoading: isLoading,
|
|
1648
1645
|
maxHeight: maxHeight,
|
|
@@ -5,10 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
-
import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
8
|
import { getStyleProps } from '../utils';
|
|
11
|
-
import A11yText from './internal/a11y-text';
|
|
12
9
|
export const optionCSS = ({
|
|
13
10
|
isDisabled,
|
|
14
11
|
isFocused,
|
|
@@ -65,8 +62,6 @@ const Option = props => {
|
|
|
65
62
|
innerRef,
|
|
66
63
|
innerProps
|
|
67
64
|
} = props;
|
|
68
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
69
|
-
const isVoiceOver = isAppleDevice() && fg('design_system_select-a11y-improvement');
|
|
70
65
|
return jsx("div", _extends({}, getStyleProps(props, 'option', {
|
|
71
66
|
option: true,
|
|
72
67
|
'option--is-disabled': isDisabled,
|
|
@@ -76,7 +71,7 @@ const Option = props => {
|
|
|
76
71
|
ref: innerRef
|
|
77
72
|
}, innerProps, {
|
|
78
73
|
tabIndex: -1
|
|
79
|
-
}), children
|
|
74
|
+
}), children);
|
|
80
75
|
};
|
|
81
76
|
|
|
82
77
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
package/dist/es2019/select.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
|
-
import { isAppleDevice
|
|
5
|
+
import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
|
|
8
8
|
import { defaultComponents } from './components';
|
|
@@ -1168,13 +1168,13 @@ export default class Select extends Component {
|
|
|
1168
1168
|
selectValue
|
|
1169
1169
|
} = this.state;
|
|
1170
1170
|
const defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
|
|
1171
|
-
if (selectValue.length && action !== 'initial-input-focus') {
|
|
1171
|
+
if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
|
|
1172
1172
|
return;
|
|
1173
1173
|
}
|
|
1174
|
-
if (isMulti
|
|
1175
|
-
|
|
1174
|
+
if (isMulti) {
|
|
1175
|
+
const multiMessage = this.getElementId('multi-message');
|
|
1176
1176
|
return {
|
|
1177
|
-
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription,
|
|
1177
|
+
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
|
|
1178
1178
|
};
|
|
1179
1179
|
} else {
|
|
1180
1180
|
return {
|
|
@@ -1272,8 +1272,6 @@ export default class Select extends Component {
|
|
|
1272
1272
|
'aria-required': required || isRequired,
|
|
1273
1273
|
role: 'combobox',
|
|
1274
1274
|
'aria-activedescendant': this.state.focusedOptionId || undefined,
|
|
1275
|
-
// Safari needs aria-owns in order for aria-activedescendant to work properly
|
|
1276
|
-
'aria-owns': isSafari() && fg('design_system_select-a11y-improvement') ? this.getElementId('listbox') : undefined,
|
|
1277
1275
|
...(menuIsOpen && {
|
|
1278
1276
|
'aria-controls': this.getElementId('listbox')
|
|
1279
1277
|
}),
|
|
@@ -1558,10 +1556,9 @@ export default class Select extends Component {
|
|
|
1558
1556
|
onMouseMove: onHover,
|
|
1559
1557
|
onMouseOver: onHover,
|
|
1560
1558
|
role: 'option',
|
|
1561
|
-
|
|
1562
|
-
'aria-
|
|
1563
|
-
|
|
1564
|
-
'aria-disabled': (isAppleDevice() || !isDisabled) && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1559
|
+
'aria-selected': isSelected,
|
|
1560
|
+
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1561
|
+
'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1565
1562
|
'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined,
|
|
1566
1563
|
...(testId && {
|
|
1567
1564
|
'data-testid': `${testId}-select--option-${id}`
|
|
@@ -1680,7 +1677,7 @@ export default class Select extends Component {
|
|
|
1680
1677
|
// add aditional label on listbox when ff is on
|
|
1681
1678
|
...(fg('design_system_select-a11y-improvement') && {
|
|
1682
1679
|
'aria-label': label,
|
|
1683
|
-
'aria-labelledby': `${labelId || ((_this$inputRef = this.inputRef) === null || _this$inputRef === void 0 ? void 0 : _this$inputRef.id) || this.getElementId('input')}
|
|
1680
|
+
'aria-labelledby': `${labelId || ((_this$inputRef = this.inputRef) === null || _this$inputRef === void 0 ? void 0 : _this$inputRef.id) || this.getElementId('input')}`
|
|
1684
1681
|
})
|
|
1685
1682
|
},
|
|
1686
1683
|
isLoading: isLoading,
|
|
@@ -5,10 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
-
import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
8
|
import { getStyleProps } from '../utils';
|
|
11
|
-
import A11yText from './internal/a11y-text';
|
|
12
9
|
export var optionCSS = function optionCSS(_ref) {
|
|
13
10
|
var isDisabled = _ref.isDisabled,
|
|
14
11
|
isFocused = _ref.isFocused,
|
|
@@ -62,8 +59,6 @@ var Option = function Option(props) {
|
|
|
62
59
|
isSelected = props.isSelected,
|
|
63
60
|
innerRef = props.innerRef,
|
|
64
61
|
innerProps = props.innerProps;
|
|
65
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
66
|
-
var isVoiceOver = isAppleDevice() && fg('design_system_select-a11y-improvement');
|
|
67
62
|
return jsx("div", _extends({}, getStyleProps(props, 'option', {
|
|
68
63
|
option: true,
|
|
69
64
|
'option--is-disabled': isDisabled,
|
|
@@ -73,7 +68,7 @@ var Option = function Option(props) {
|
|
|
73
68
|
ref: innerRef
|
|
74
69
|
}, innerProps, {
|
|
75
70
|
tabIndex: -1
|
|
76
|
-
}), children
|
|
71
|
+
}), children);
|
|
77
72
|
};
|
|
78
73
|
|
|
79
74
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
package/dist/esm/select.js
CHANGED
|
@@ -13,7 +13,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
15
15
|
import React, { Component } from 'react';
|
|
16
|
-
import { isAppleDevice
|
|
16
|
+
import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
|
|
19
19
|
import { defaultComponents } from './components';
|
|
@@ -1140,13 +1140,13 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1140
1140
|
var isMulti = this.props.isMulti;
|
|
1141
1141
|
var selectValue = this.state.selectValue;
|
|
1142
1142
|
var defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
|
|
1143
|
-
if (selectValue.length && action !== 'initial-input-focus') {
|
|
1143
|
+
if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
|
|
1144
1144
|
return;
|
|
1145
1145
|
}
|
|
1146
|
-
if (isMulti
|
|
1147
|
-
|
|
1146
|
+
if (isMulti) {
|
|
1147
|
+
var multiMessage = this.getElementId('multi-message');
|
|
1148
1148
|
return {
|
|
1149
|
-
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription,
|
|
1149
|
+
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
|
|
1150
1150
|
};
|
|
1151
1151
|
} else {
|
|
1152
1152
|
return {
|
|
@@ -1252,9 +1252,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1252
1252
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1253
1253
|
'aria-required': required || isRequired,
|
|
1254
1254
|
role: 'combobox',
|
|
1255
|
-
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1256
|
-
// Safari needs aria-owns in order for aria-activedescendant to work properly
|
|
1257
|
-
'aria-owns': isSafari() && fg('design_system_select-a11y-improvement') ? this.getElementId('listbox') : undefined
|
|
1255
|
+
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1258
1256
|
}, menuIsOpen && {
|
|
1259
1257
|
'aria-controls': this.getElementId('listbox')
|
|
1260
1258
|
}), !isSearchable && {
|
|
@@ -1519,10 +1517,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1519
1517
|
onMouseMove: onHover,
|
|
1520
1518
|
onMouseOver: onHover,
|
|
1521
1519
|
role: 'option',
|
|
1522
|
-
|
|
1523
|
-
'aria-
|
|
1524
|
-
|
|
1525
|
-
'aria-disabled': (isAppleDevice() || !isDisabled) && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1520
|
+
'aria-selected': isSelected,
|
|
1521
|
+
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1522
|
+
'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1526
1523
|
'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined
|
|
1527
1524
|
}, testId && {
|
|
1528
1525
|
'data-testid': "".concat(testId, "-select--option-").concat(id)
|
|
@@ -1633,7 +1630,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1633
1630
|
'data-testid': "".concat(testId, "-select--listbox")
|
|
1634
1631
|
}), fg('design_system_select-a11y-improvement') && {
|
|
1635
1632
|
'aria-label': label,
|
|
1636
|
-
'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input')
|
|
1633
|
+
'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'))
|
|
1637
1634
|
}),
|
|
1638
1635
|
isLoading: isLoading,
|
|
1639
1636
|
maxHeight: maxHeight,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-select",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A forked version of react-select to only be used in atlaskit/select",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
33
|
-
"@atlaskit/icon": "^24.
|
|
33
|
+
"@atlaskit/icon": "^24.1.0",
|
|
34
34
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
|
-
"@atlaskit/primitives": "^14.
|
|
35
|
+
"@atlaskit/primitives": "^14.1.0",
|
|
36
36
|
"@atlaskit/spinner": "^18.0.0",
|
|
37
|
-
"@atlaskit/tokens": "^4.
|
|
37
|
+
"@atlaskit/tokens": "^4.2.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"@emotion/react": "^11.7.1",
|
|
40
40
|
"@floating-ui/dom": "^1.0.1",
|