@atlaskit/select 16.5.3 → 16.5.5
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/Select.js +1 -1
- package/dist/cjs/createSelect.js +8 -11
- package/dist/cjs/styles.js +6 -6
- package/dist/cjs/utils/grouped-options-announcement.js +31 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +10 -10
- package/dist/es2019/styles.js +6 -6
- package/dist/es2019/utils/grouped-options-announcement.js +23 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +8 -11
- package/dist/esm/styles.js +6 -6
- package/dist/esm/utils/grouped-options-announcement.js +23 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/createSelect.d.ts +3 -3
- package/dist/types/utils/grouped-options-announcement.d.ts +4 -0
- package/dist/types-ts4.5/createSelect.d.ts +3 -3
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +4 -0
- package/package.json +5 -5
- package/report.api.md +352 -38
- package/tmp/api-report-tmp.d.ts +697 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 16.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`96ac277d0d7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/96ac277d0d7) - [ux] - created custom onFocus function, which overwrites built in onFocus method for ariaLiveMessages;
|
|
8
|
+
|
|
9
|
+
- function is conditionally invoked only for grouped select options to enable group label announcement with it's group options;
|
|
10
|
+
|
|
11
|
+
## 16.5.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`8f436f0c301`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8f436f0c301) - extend border contrast feature flag to support confluence
|
|
16
|
+
|
|
3
17
|
## 16.5.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/Select.js
CHANGED
|
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
11
11
|
var packageName = "@atlaskit/select";
|
|
12
|
-
var packageVersion = "16.5.
|
|
12
|
+
var packageVersion = "16.5.5";
|
|
13
13
|
var SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
exports.SelectWithoutAnalytics = SelectWithoutAnalytics;
|
|
15
15
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
package/dist/cjs/createSelect.js
CHANGED
|
@@ -19,10 +19,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
var _reactSelect = require("react-select");
|
|
20
20
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
21
21
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
22
|
-
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
23
22
|
var defaultComponents = _interopRequireWildcard(require("./components"));
|
|
24
23
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
25
|
-
var
|
|
24
|
+
var _groupedOptionsAnnouncement = require("./utils/grouped-options-announcement");
|
|
25
|
+
var _excluded = ["styles", "validationState", "isInvalid", "spacing", "isMulti", "appearance", "ariaLiveMessages"];
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -79,6 +79,7 @@ function createSelect(WrappedComponent) {
|
|
|
79
79
|
spacing = _this$props.spacing,
|
|
80
80
|
isMulti = _this$props.isMulti,
|
|
81
81
|
appearance = _this$props.appearance,
|
|
82
|
+
ariaLiveMessages = _this$props.ariaLiveMessages,
|
|
82
83
|
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
83
84
|
var isCompact = spacing === 'compact';
|
|
84
85
|
|
|
@@ -86,19 +87,15 @@ function createSelect(WrappedComponent) {
|
|
|
86
87
|
return /*#__PURE__*/_react.default.createElement(WrappedComponent, (0, _extends2.default)({
|
|
87
88
|
ref: this.onSelectRef,
|
|
88
89
|
isMulti: isMulti,
|
|
89
|
-
"aria-live": "assertive"
|
|
90
|
+
"aria-live": "assertive",
|
|
91
|
+
ariaLiveMessages: (0, _groupedOptionsAnnouncement.isOptionsGrouped)(this.props.options) ? _objectSpread({
|
|
92
|
+
onFocus: _groupedOptionsAnnouncement.onFocus
|
|
93
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages)
|
|
90
94
|
}, props, {
|
|
91
95
|
components: this.components,
|
|
92
96
|
styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(
|
|
93
97
|
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
94
|
-
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
95
|
-
placeholder: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isMulti &&
|
|
96
|
-
/*#__PURE__*/
|
|
97
|
-
// NOTE: This has been added because react-select does not announce to screen readers that multiple options can be selected.
|
|
98
|
-
// Here we hijack the placeholder to include more info.
|
|
99
|
-
// The placeholder is used as the `aria-describedby` for the input, and gets rendered in a div rather than a native input placeholder.
|
|
100
|
-
// Ideally react-select should make use of the aria-multiselectable attribute.
|
|
101
|
-
_react.default.createElement(_visuallyHidden.default, null, "Multiple options can be selected."), props.placeholder !== undefined ? props.placeholder : 'Select...')
|
|
98
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
102
99
|
}));
|
|
103
100
|
}
|
|
104
101
|
}]);
|
package/dist/cjs/styles.js
CHANGED
|
@@ -36,7 +36,7 @@ function baseStyles(validationState) {
|
|
|
36
36
|
control: function control(css, _ref2) {
|
|
37
37
|
var isFocused = _ref2.isFocused,
|
|
38
38
|
isDisabled = _ref2.isDisabled;
|
|
39
|
-
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.
|
|
39
|
+
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? _colors.N100 : _colors.N20, ")");
|
|
40
40
|
var backgroundColor = isFocused ? "var(--ds-background-input-pressed, ".concat(_colors.N0, ")") : "var(--ds-background-input, ".concat(_colors.N20, ")");
|
|
41
41
|
var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, ".concat(_colors.N0, ")") : "var(--ds-background-input-hovered, ".concat(_colors.N30, ")");
|
|
42
42
|
if (isDisabled) {
|
|
@@ -49,7 +49,7 @@ function baseStyles(validationState) {
|
|
|
49
49
|
if (validationState === 'success') {
|
|
50
50
|
borderColor = "var(--ds-border-success, ".concat(_colors.G400, ")");
|
|
51
51
|
}
|
|
52
|
-
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.
|
|
52
|
+
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? _colors.N100 : _colors.N30, ")");
|
|
53
53
|
if (validationState === 'error') {
|
|
54
54
|
borderColorHover = "var(--ds-border-danger, ".concat(_colors.R400, ")");
|
|
55
55
|
}
|
|
@@ -74,10 +74,10 @@ function baseStyles(validationState) {
|
|
|
74
74
|
backgroundColor: backgroundColor,
|
|
75
75
|
borderColor: borderColor,
|
|
76
76
|
borderStyle: 'solid',
|
|
77
|
-
borderRadius: "var(--ds-radius-100, 3px)",
|
|
78
|
-
borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.
|
|
77
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
78
|
+
borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "var(--ds-border-width-050, 1px)" : "var(--ds-border-width-100, 2px)",
|
|
79
79
|
boxShadow: 'none'
|
|
80
|
-
}, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.
|
|
80
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') && {
|
|
81
81
|
'&:focus-within': {
|
|
82
82
|
boxShadow: "inset 0 0 0 1px ".concat(borderColor)
|
|
83
83
|
}
|
|
@@ -239,7 +239,7 @@ function baseStyles(validationState) {
|
|
|
239
239
|
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
240
240
|
}
|
|
241
241
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
242
|
-
borderRadius: "var(--ds-radius-050, 2px)",
|
|
242
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
243
243
|
backgroundColor: backgroundColor,
|
|
244
244
|
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
|
|
245
245
|
maxWidth: '100%',
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isOptionsGrouped = void 0;
|
|
7
|
+
exports.onFocus = onFocus;
|
|
8
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
9
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
10
|
+
function onFocus(props) {
|
|
11
|
+
var _groupData$options$fi;
|
|
12
|
+
var focused = props.focused,
|
|
13
|
+
options = props.options;
|
|
14
|
+
var isOptionFocused = function isOptionFocused(option) {
|
|
15
|
+
return option === focused;
|
|
16
|
+
};
|
|
17
|
+
var groupData = options === null || options === void 0 ? void 0 : options.find(function (option) {
|
|
18
|
+
var _option$options;
|
|
19
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
20
|
+
});
|
|
21
|
+
var groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
22
|
+
return "Option ".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " group, item ").concat(groupOptionIndex + 1, " out of ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.options.length, ". All in all ");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Helper function which identifies if options are grouped.
|
|
26
|
+
var isOptionsGrouped = function isOptionsGrouped(arr) {
|
|
27
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
28
|
+
return obj.hasOwnProperty('options');
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.isOptionsGrouped = isOptionsGrouped;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import Select from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
const packageName = "@atlaskit/select";
|
|
5
|
-
const packageVersion = "16.5.
|
|
5
|
+
const packageVersion = "16.5.5";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -4,9 +4,9 @@ import React, { Component } from 'react';
|
|
|
4
4
|
import { mergeStyles } from 'react-select';
|
|
5
5
|
import memoizeOne from 'memoize-one';
|
|
6
6
|
import isEqual from 'react-fast-compare';
|
|
7
|
-
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
8
7
|
import * as defaultComponents from './components';
|
|
9
8
|
import baseStyles from './styles';
|
|
9
|
+
import { onFocus, isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
10
10
|
export default function createSelect(WrappedComponent) {
|
|
11
11
|
var _class;
|
|
12
12
|
return _class = class AtlaskitSelect extends Component {
|
|
@@ -47,6 +47,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
47
47
|
spacing,
|
|
48
48
|
isMulti,
|
|
49
49
|
appearance,
|
|
50
|
+
ariaLiveMessages,
|
|
50
51
|
...props
|
|
51
52
|
} = this.props;
|
|
52
53
|
const isCompact = spacing === 'compact';
|
|
@@ -55,19 +56,18 @@ export default function createSelect(WrappedComponent) {
|
|
|
55
56
|
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
56
57
|
ref: this.onSelectRef,
|
|
57
58
|
isMulti: isMulti,
|
|
58
|
-
"aria-live": "assertive"
|
|
59
|
+
"aria-live": "assertive",
|
|
60
|
+
ariaLiveMessages: isOptionsGrouped(this.props.options) ? {
|
|
61
|
+
onFocus,
|
|
62
|
+
...ariaLiveMessages
|
|
63
|
+
} : {
|
|
64
|
+
...ariaLiveMessages
|
|
65
|
+
}
|
|
59
66
|
}, props, {
|
|
60
67
|
components: this.components,
|
|
61
68
|
styles: mergeStyles(baseStyles(
|
|
62
69
|
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
63
|
-
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
64
|
-
placeholder: /*#__PURE__*/React.createElement(React.Fragment, null, isMulti &&
|
|
65
|
-
/*#__PURE__*/
|
|
66
|
-
// NOTE: This has been added because react-select does not announce to screen readers that multiple options can be selected.
|
|
67
|
-
// Here we hijack the placeholder to include more info.
|
|
68
|
-
// The placeholder is used as the `aria-describedby` for the input, and gets rendered in a div rather than a native input placeholder.
|
|
69
|
-
// Ideally react-select should make use of the aria-multiselectable attribute.
|
|
70
|
-
React.createElement(VisuallyHidden, null, "Multiple options can be selected."), props.placeholder !== undefined ? props.placeholder : 'Select...')
|
|
70
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
71
71
|
}));
|
|
72
72
|
}
|
|
73
73
|
}, _defineProperty(_class, "defaultProps", {
|
package/dist/es2019/styles.js
CHANGED
|
@@ -25,7 +25,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
25
25
|
isFocused,
|
|
26
26
|
isDisabled
|
|
27
27
|
}) => {
|
|
28
|
-
let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.
|
|
28
|
+
let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N20})`;
|
|
29
29
|
let backgroundColor = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input, ${N20})`;
|
|
30
30
|
let backgroundColorHover = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input-hovered, ${N30})`;
|
|
31
31
|
if (isDisabled) {
|
|
@@ -38,7 +38,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
38
38
|
if (validationState === 'success') {
|
|
39
39
|
borderColor = `var(--ds-border-success, ${G400})`;
|
|
40
40
|
}
|
|
41
|
-
let borderColorHover = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.
|
|
41
|
+
let borderColorHover = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N30})`;
|
|
42
42
|
if (validationState === 'error') {
|
|
43
43
|
borderColorHover = `var(--ds-border-danger, ${R400})`;
|
|
44
44
|
}
|
|
@@ -64,10 +64,10 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
64
64
|
backgroundColor,
|
|
65
65
|
borderColor,
|
|
66
66
|
borderStyle: 'solid',
|
|
67
|
-
borderRadius: "var(--ds-radius-100, 3px)",
|
|
68
|
-
borderWidth: getBooleanFF('platform.design-system-team.
|
|
67
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
68
|
+
borderWidth: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? "var(--ds-border-width-050, 1px)" : "var(--ds-border-width-100, 2px)",
|
|
69
69
|
boxShadow: 'none',
|
|
70
|
-
...(getBooleanFF('platform.design-system-team.
|
|
70
|
+
...(getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') && {
|
|
71
71
|
'&:focus-within': {
|
|
72
72
|
boxShadow: `inset 0 0 0 1px ${borderColor}`
|
|
73
73
|
}
|
|
@@ -230,7 +230,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
230
230
|
}
|
|
231
231
|
return {
|
|
232
232
|
...css,
|
|
233
|
-
borderRadius: "var(--ds-radius-050, 2px)",
|
|
233
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
234
234
|
backgroundColor,
|
|
235
235
|
boxShadow: isFocused ? `0 0 0 2px ${"var(--ds-surface, transparent)"}, 0 0 0 4px ${"var(--ds-border-focused, transparent)"}` : 'none',
|
|
236
236
|
maxWidth: '100%',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
+
export function onFocus(props) {
|
|
4
|
+
var _groupData$options$fi;
|
|
5
|
+
const {
|
|
6
|
+
focused,
|
|
7
|
+
options
|
|
8
|
+
} = props;
|
|
9
|
+
const isOptionFocused = option => {
|
|
10
|
+
return option === focused;
|
|
11
|
+
};
|
|
12
|
+
const groupData = options === null || options === void 0 ? void 0 : options.find(option => {
|
|
13
|
+
var _option$options;
|
|
14
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
15
|
+
});
|
|
16
|
+
const groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
17
|
+
return `Option ${focused.label}, ${groupData === null || groupData === void 0 ? void 0 : groupData.label} group, item ${groupOptionIndex + 1} out of ${groupData === null || groupData === void 0 ? void 0 : groupData.options.length}. All in all `;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Helper function which identifies if options are grouped.
|
|
21
|
+
export const isOptionsGrouped = arr => {
|
|
22
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(obj => obj.hasOwnProperty('options'));
|
|
23
|
+
};
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import Select from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
var packageName = "@atlaskit/select";
|
|
5
|
-
var packageVersion = "16.5.
|
|
5
|
+
var packageVersion = "16.5.5";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/esm/createSelect.js
CHANGED
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["styles", "validationState", "isInvalid", "spacing", "isMulti", "appearance"];
|
|
10
|
+
var _excluded = ["styles", "validationState", "isInvalid", "spacing", "isMulti", "appearance", "ariaLiveMessages"];
|
|
11
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -16,9 +16,9 @@ import React, { Component } from 'react';
|
|
|
16
16
|
import { mergeStyles } from 'react-select';
|
|
17
17
|
import memoizeOne from 'memoize-one';
|
|
18
18
|
import isEqual from 'react-fast-compare';
|
|
19
|
-
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
20
19
|
import * as defaultComponents from './components';
|
|
21
20
|
import baseStyles from './styles';
|
|
21
|
+
import { onFocus, isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
22
22
|
export default function createSelect(WrappedComponent) {
|
|
23
23
|
var _class;
|
|
24
24
|
return _class = /*#__PURE__*/function (_Component) {
|
|
@@ -69,6 +69,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
69
69
|
spacing = _this$props.spacing,
|
|
70
70
|
isMulti = _this$props.isMulti,
|
|
71
71
|
appearance = _this$props.appearance,
|
|
72
|
+
ariaLiveMessages = _this$props.ariaLiveMessages,
|
|
72
73
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
73
74
|
var isCompact = spacing === 'compact';
|
|
74
75
|
|
|
@@ -76,19 +77,15 @@ export default function createSelect(WrappedComponent) {
|
|
|
76
77
|
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
77
78
|
ref: this.onSelectRef,
|
|
78
79
|
isMulti: isMulti,
|
|
79
|
-
"aria-live": "assertive"
|
|
80
|
+
"aria-live": "assertive",
|
|
81
|
+
ariaLiveMessages: isOptionsGrouped(this.props.options) ? _objectSpread({
|
|
82
|
+
onFocus: onFocus
|
|
83
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages)
|
|
80
84
|
}, props, {
|
|
81
85
|
components: this.components,
|
|
82
86
|
styles: mergeStyles(baseStyles(
|
|
83
87
|
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
84
|
-
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
85
|
-
placeholder: /*#__PURE__*/React.createElement(React.Fragment, null, isMulti &&
|
|
86
|
-
/*#__PURE__*/
|
|
87
|
-
// NOTE: This has been added because react-select does not announce to screen readers that multiple options can be selected.
|
|
88
|
-
// Here we hijack the placeholder to include more info.
|
|
89
|
-
// The placeholder is used as the `aria-describedby` for the input, and gets rendered in a div rather than a native input placeholder.
|
|
90
|
-
// Ideally react-select should make use of the aria-multiselectable attribute.
|
|
91
|
-
React.createElement(VisuallyHidden, null, "Multiple options can be selected."), props.placeholder !== undefined ? props.placeholder : 'Select...')
|
|
88
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
92
89
|
}));
|
|
93
90
|
}
|
|
94
91
|
}]);
|
package/dist/esm/styles.js
CHANGED
|
@@ -30,7 +30,7 @@ export default function baseStyles(validationState) {
|
|
|
30
30
|
control: function control(css, _ref2) {
|
|
31
31
|
var isFocused = _ref2.isFocused,
|
|
32
32
|
isDisabled = _ref2.isDisabled;
|
|
33
|
-
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(getBooleanFF('platform.design-system-team.
|
|
33
|
+
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N20, ")");
|
|
34
34
|
var backgroundColor = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input, ".concat(N20, ")");
|
|
35
35
|
var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input-hovered, ".concat(N30, ")");
|
|
36
36
|
if (isDisabled) {
|
|
@@ -43,7 +43,7 @@ export default function baseStyles(validationState) {
|
|
|
43
43
|
if (validationState === 'success') {
|
|
44
44
|
borderColor = "var(--ds-border-success, ".concat(G400, ")");
|
|
45
45
|
}
|
|
46
|
-
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(getBooleanFF('platform.design-system-team.
|
|
46
|
+
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N30, ")");
|
|
47
47
|
if (validationState === 'error') {
|
|
48
48
|
borderColorHover = "var(--ds-border-danger, ".concat(R400, ")");
|
|
49
49
|
}
|
|
@@ -68,10 +68,10 @@ export default function baseStyles(validationState) {
|
|
|
68
68
|
backgroundColor: backgroundColor,
|
|
69
69
|
borderColor: borderColor,
|
|
70
70
|
borderStyle: 'solid',
|
|
71
|
-
borderRadius: "var(--ds-radius-100, 3px)",
|
|
72
|
-
borderWidth: getBooleanFF('platform.design-system-team.
|
|
71
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
72
|
+
borderWidth: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? "var(--ds-border-width-050, 1px)" : "var(--ds-border-width-100, 2px)",
|
|
73
73
|
boxShadow: 'none'
|
|
74
|
-
}, getBooleanFF('platform.design-system-team.
|
|
74
|
+
}, getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') && {
|
|
75
75
|
'&:focus-within': {
|
|
76
76
|
boxShadow: "inset 0 0 0 1px ".concat(borderColor)
|
|
77
77
|
}
|
|
@@ -233,7 +233,7 @@ export default function baseStyles(validationState) {
|
|
|
233
233
|
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
234
234
|
}
|
|
235
235
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
236
|
-
borderRadius: "var(--ds-radius-050, 2px)",
|
|
236
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
237
237
|
backgroundColor: backgroundColor,
|
|
238
238
|
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
|
|
239
239
|
maxWidth: '100%',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
+
export function onFocus(props) {
|
|
4
|
+
var _groupData$options$fi;
|
|
5
|
+
var focused = props.focused,
|
|
6
|
+
options = props.options;
|
|
7
|
+
var isOptionFocused = function isOptionFocused(option) {
|
|
8
|
+
return option === focused;
|
|
9
|
+
};
|
|
10
|
+
var groupData = options === null || options === void 0 ? void 0 : options.find(function (option) {
|
|
11
|
+
var _option$options;
|
|
12
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
13
|
+
});
|
|
14
|
+
var groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
15
|
+
return "Option ".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " group, item ").concat(groupOptionIndex + 1, " out of ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.options.length, ". All in all ");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Helper function which identifies if options are grouped.
|
|
19
|
+
export var isOptionsGrouped = function isOptionsGrouped(arr) {
|
|
20
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
21
|
+
return obj.hasOwnProperty('options');
|
|
22
|
+
});
|
|
23
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import BaseSelect from 'react-select/base';
|
|
3
|
-
import { SelectProps, SelectComponentsConfig, OptionType, AsyncSelectProps, CreatableSelectProps } from './types';
|
|
3
|
+
import { SelectProps, SelectComponentsConfig, OptionType, AsyncSelectProps, CreatableSelectProps, GroupType } from './types';
|
|
4
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): {
|
|
5
5
|
new <Option = OptionType, IsMulti extends boolean = false>(props: SelectProps<Option, IsMulti>): {
|
|
6
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti,
|
|
6
|
+
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, GroupType<Option>>>;
|
|
7
7
|
select: BaseSelect | null;
|
|
8
8
|
UNSAFE_componentWillReceiveProps(nextProps: SelectProps<Option, IsMulti>): void;
|
|
9
|
-
cacheComponents: (components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti,
|
|
9
|
+
cacheComponents: (components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, GroupType<Option>>>) => void;
|
|
10
10
|
focus(): void;
|
|
11
11
|
blur(): void;
|
|
12
12
|
onSelectRef: (ref: BaseSelect) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AriaOnFocusProps, GroupBase, OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { GroupType, OptionType } from '../types';
|
|
3
|
+
export declare function onFocus(props: AriaOnFocusProps<OptionType, GroupBase<OptionType>>): string;
|
|
4
|
+
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>>) => boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import BaseSelect from 'react-select/base';
|
|
3
|
-
import { SelectProps, SelectComponentsConfig, OptionType, AsyncSelectProps, CreatableSelectProps } from './types';
|
|
3
|
+
import { SelectProps, SelectComponentsConfig, OptionType, AsyncSelectProps, CreatableSelectProps, GroupType } from './types';
|
|
4
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): {
|
|
5
5
|
new <Option = OptionType, IsMulti extends boolean = false>(props: SelectProps<Option, IsMulti>): {
|
|
6
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti,
|
|
6
|
+
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, GroupType<Option>>>;
|
|
7
7
|
select: BaseSelect | null;
|
|
8
8
|
UNSAFE_componentWillReceiveProps(nextProps: SelectProps<Option, IsMulti>): void;
|
|
9
|
-
cacheComponents: (components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti,
|
|
9
|
+
cacheComponents: (components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, GroupType<Option>>>) => void;
|
|
10
10
|
focus(): void;
|
|
11
11
|
blur(): void;
|
|
12
12
|
onSelectRef: (ref: BaseSelect) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AriaOnFocusProps, GroupBase, OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { GroupType, OptionType } from '../types';
|
|
3
|
+
export declare function onFocus(props: AriaOnFocusProps<OptionType, GroupBase<OptionType>>): string;
|
|
4
|
+
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>>) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "16.5.
|
|
3
|
+
"version": "16.5.5",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.tsx",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Design System Team",
|
|
27
|
-
"releaseModel": "
|
|
27
|
+
"releaseModel": "continuous",
|
|
28
28
|
"website": {
|
|
29
29
|
"name": "Select",
|
|
30
30
|
"category": "Components"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
44
44
|
"@atlaskit/spinner": "^15.5.0",
|
|
45
45
|
"@atlaskit/theme": "^12.5.0",
|
|
46
|
-
"@atlaskit/tokens": "^1.
|
|
46
|
+
"@atlaskit/tokens": "^1.9.0",
|
|
47
47
|
"@atlaskit/visually-hidden": "^1.2.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-dom": "^16.8.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@atlaskit/button": "^16.
|
|
66
|
+
"@atlaskit/button": "^16.8.0",
|
|
67
67
|
"@atlaskit/checkbox": "^12.6.0",
|
|
68
68
|
"@atlaskit/docs": "*",
|
|
69
69
|
"@atlaskit/drawer": "^7.5.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
"platform-feature-flags": {
|
|
104
|
-
"platform.design-system-team.
|
|
104
|
+
"platform.design-system-team.border-checkbox_nyoiu": {
|
|
105
105
|
"type": "boolean"
|
|
106
106
|
},
|
|
107
107
|
"platform.design-system-team.popup-select-render-perf_i0s6m": {
|