@atlaskit/select 17.11.11 → 17.11.12
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 +9 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +13 -13
- package/dist/cjs/PopupSelect/components.js +31 -8
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/createSelect.js +3 -1
- package/dist/cjs/utils/grouped-options-announcement.js +4 -5
- package/dist/es2019/PopupSelect/PopupSelect.js +14 -14
- package/dist/es2019/PopupSelect/components.js +25 -8
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +1 -1
- package/dist/es2019/utils/grouped-options-announcement.js +5 -6
- package/dist/esm/PopupSelect/PopupSelect.js +14 -14
- package/dist/esm/PopupSelect/components.js +31 -8
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +4 -2
- package/dist/esm/utils/grouped-options-announcement.js +4 -5
- package/dist/types/PopupSelect/PopupSelect.d.ts +5 -1
- package/dist/types/PopupSelect/components.d.ts +14 -2
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -1
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +5 -1
- package/dist/types-ts4.5/PopupSelect/components.d.ts +14 -2
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.11.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`941edf62401ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/941edf62401ae) -
|
|
8
|
+
This version removes `platform.design-system-team.use-default-select-in-popup-select_46rmj`
|
|
9
|
+
feature flag. The `PopupSelect` component now uses the internal `Select` component ensure the
|
|
10
|
+
accessibility of options with group labels for assistive technologies.
|
|
11
|
+
|
|
3
12
|
## 17.11.11
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -21,10 +21,9 @@ var _reactDom = require("react-dom");
|
|
|
21
21
|
var _reactFocusLock = _interopRequireDefault(require("react-focus-lock"));
|
|
22
22
|
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
23
23
|
var _reactPopper = require("react-popper");
|
|
24
|
-
var _reactSelect =
|
|
24
|
+
var _reactSelect = require("react-select");
|
|
25
25
|
var _reactUid = require("react-uid");
|
|
26
26
|
var _shallowEqual = require("shallow-equal");
|
|
27
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
27
|
var _colors = require("@atlaskit/theme/colors");
|
|
29
28
|
var _Select = _interopRequireDefault(require("../Select"));
|
|
30
29
|
var _styles = _interopRequireDefault(require("../styles"));
|
|
@@ -86,6 +85,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
86
85
|
}
|
|
87
86
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
88
87
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
|
|
88
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
|
|
89
89
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
|
|
90
90
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
|
|
91
91
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
|
|
@@ -191,7 +191,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
191
|
});
|
|
192
192
|
if (_this.selectRef) {
|
|
193
193
|
var _this$selectRef$selec;
|
|
194
|
-
(
|
|
194
|
+
(_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 || _this$selectRef$selec.openMenu('first');
|
|
195
195
|
}
|
|
196
196
|
if (typeof window === 'undefined') {
|
|
197
197
|
return;
|
|
@@ -289,7 +289,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
289
289
|
|
|
290
290
|
// subtract the control height to maintain consistency
|
|
291
291
|
var showSearchControl = _this.showSearchControl();
|
|
292
|
-
var controlRef = (
|
|
292
|
+
var controlRef = (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
293
293
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
294
294
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
295
295
|
return maxHeight;
|
|
@@ -333,29 +333,28 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
333
333
|
return placeholder;
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
|
-
var InternalSelect = (0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? _Select.default : _reactSelect.default;
|
|
337
336
|
var providedAriaLabel = getLabel();
|
|
338
337
|
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
339
|
-
var _this$selectRef
|
|
338
|
+
var _this$selectRef;
|
|
340
339
|
// Update aria-label to get first announcement when popup opened.
|
|
341
|
-
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef
|
|
342
|
-
var _this$
|
|
340
|
+
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef) {
|
|
341
|
+
var _this$selectRef2;
|
|
343
342
|
if (providedAriaLabel) {
|
|
344
343
|
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
345
344
|
}
|
|
346
|
-
(
|
|
345
|
+
(_this$selectRef2 = _this.selectRef) === null || _this$selectRef2 === void 0 || (_this$selectRef2 = _this$selectRef2.select.inputRef) === null || _this$selectRef2 === void 0 || _this$selectRef2.setAttribute('aria-label', ariaLabelText);
|
|
347
346
|
}
|
|
348
347
|
};
|
|
349
348
|
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
350
349
|
var _options$findIndex;
|
|
351
350
|
var focused = onFocusProps.focused;
|
|
352
351
|
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
353
|
-
var totalLength =
|
|
352
|
+
var totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
354
353
|
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
355
354
|
return option === focused;
|
|
356
355
|
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
357
356
|
var optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
358
|
-
var ariaLabelText = "Option ".concat(optionName, " focused, ").concat(optionIndex, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
|
|
357
|
+
var ariaLabelText = "Option ".concat(optionName, " focused, ").concat(optionIndex + 1, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
|
|
359
358
|
// Option LABEL focused, 1 of 8. 8 results available.
|
|
360
359
|
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
361
360
|
// press Escape to exit the menu.
|
|
@@ -369,7 +368,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
369
368
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
370
369
|
if ((0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options)) {
|
|
371
370
|
var totalLength = (0, _groupedOptionsAnnouncement.countAllOptions)(props.options);
|
|
372
|
-
ariaLiveMessage = (0, _groupedOptionsAnnouncement.onFocus)(onFocusProps);
|
|
371
|
+
ariaLiveMessage = (0, _groupedOptionsAnnouncement.onFocus)(onFocusProps, props.options);
|
|
373
372
|
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
374
373
|
} else {
|
|
375
374
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -378,6 +377,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
378
377
|
updateInputAriaLabel(ariaLabelText);
|
|
379
378
|
return ariaLiveMessage;
|
|
380
379
|
}
|
|
380
|
+
return ariaLiveMessage;
|
|
381
381
|
};
|
|
382
382
|
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, {
|
|
383
383
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
@@ -403,7 +403,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
403
403
|
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
|
|
404
404
|
disabled: !focusLockEnabled,
|
|
405
405
|
returnFocus: true
|
|
406
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
406
|
+
}, /*#__PURE__*/_react.default.createElement(_Select.default, (0, _extends2.default)({
|
|
407
407
|
"aria-label": providedAriaLabel,
|
|
408
408
|
backspaceRemovesValue: false,
|
|
409
409
|
controlShouldRenderValue: false,
|
|
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.defaultComponents = exports.MenuDialog = exports.DummyControl = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _reactSelect = require("react-select");
|
|
11
10
|
var _react = require("@emotion/react");
|
|
12
|
-
var
|
|
11
|
+
var _reactSelect = require("react-select");
|
|
13
12
|
var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
|
|
14
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
15
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
15
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
16
16
|
var _excluded = ["innerRef", "innerProps"];
|
|
17
17
|
/**
|
|
18
18
|
* @jsxRuntime classic
|
|
@@ -24,11 +24,17 @@ var _excluded = ["innerRef", "innerProps"];
|
|
|
24
24
|
// ==============================
|
|
25
25
|
|
|
26
26
|
var menuDialogStyles = (0, _react.css)({
|
|
27
|
+
zIndex: _constants.layers.modal(),
|
|
27
28
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
28
29
|
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
29
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(_colors.N40A, ", 0 4px 11px ").concat(_colors.N40A), ")")
|
|
30
|
-
zIndex: _constants.layers.modal()
|
|
30
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(_colors.N40A, ", 0 4px 11px ").concat(_colors.N40A), ")")
|
|
31
31
|
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* __Menu dialog__
|
|
35
|
+
* Wrapper for PopupSelect component.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
32
38
|
var MenuDialog = exports.MenuDialog = function MenuDialog(_ref) {
|
|
33
39
|
var maxWidth = _ref.maxWidth,
|
|
34
40
|
minWidth = _ref.minWidth,
|
|
@@ -58,9 +64,9 @@ var MenuDialog = exports.MenuDialog = function MenuDialog(_ref) {
|
|
|
58
64
|
// ==============================
|
|
59
65
|
|
|
60
66
|
var dropdownStyles = (0, _react.css)({
|
|
67
|
+
width: 32,
|
|
61
68
|
marginInlineEnd: "var(--ds-space-025, 2px)",
|
|
62
|
-
textAlign: 'center'
|
|
63
|
-
width: 32
|
|
69
|
+
textAlign: 'center'
|
|
64
70
|
});
|
|
65
71
|
var DropdownIndicator = function DropdownIndicator() {
|
|
66
72
|
return (0, _react.jsx)("div", {
|
|
@@ -83,6 +89,11 @@ var Control = function Control(_ref2) {
|
|
|
83
89
|
innerProps: innerProps
|
|
84
90
|
})));
|
|
85
91
|
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* __Dummy control__
|
|
95
|
+
* Overrides the default DummyControl component in Select.
|
|
96
|
+
*/
|
|
86
97
|
var DummyControl = exports.DummyControl = function DummyControl(props) {
|
|
87
98
|
return (0, _react.jsx)(_visuallyHidden.default, null, (0, _react.jsx)(_reactSelect.components.Control, props));
|
|
88
99
|
};
|
|
@@ -93,8 +104,20 @@ var Menu = function Menu(_ref3) {
|
|
|
93
104
|
innerProps = _ref3.innerProps;
|
|
94
105
|
return (0, _react.jsx)("div", innerProps, children);
|
|
95
106
|
};
|
|
107
|
+
var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
108
|
+
return (0, _react.jsx)(_reactSelect.components.IndicatorSeparator, props);
|
|
109
|
+
};
|
|
110
|
+
var ClearIndicator = function ClearIndicator(props) {
|
|
111
|
+
return (0, _react.jsx)(_reactSelect.components.ClearIndicator, props);
|
|
112
|
+
};
|
|
113
|
+
var MultiValueRemove = function MultiValueRemove(props) {
|
|
114
|
+
return (0, _react.jsx)(_reactSelect.components.MultiValueRemove, props);
|
|
115
|
+
};
|
|
96
116
|
var defaultComponents = exports.defaultComponents = {
|
|
97
117
|
Control: Control,
|
|
98
118
|
DropdownIndicator: DropdownIndicator,
|
|
99
|
-
Menu: Menu
|
|
119
|
+
Menu: Menu,
|
|
120
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
121
|
+
ClearIndicator: ClearIndicator,
|
|
122
|
+
MultiValueRemove: MultiValueRemove
|
|
100
123
|
};
|
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 = "17.11.
|
|
12
|
+
var packageVersion = "17.11.12";
|
|
13
13
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
15
15
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
package/dist/cjs/createSelect.js
CHANGED
|
@@ -90,7 +90,9 @@ function createSelect(WrappedComponent) {
|
|
|
90
90
|
ref: internalSelectRef,
|
|
91
91
|
"aria-live": "assertive",
|
|
92
92
|
ariaLiveMessages: (0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options) ? _objectSpread({
|
|
93
|
-
onFocus:
|
|
93
|
+
onFocus: function onFocus(data) {
|
|
94
|
+
return (0, _groupedOptionsAnnouncement.onFocus)(data, props.options);
|
|
95
|
+
}
|
|
94
96
|
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages),
|
|
95
97
|
tabSelectsValue: tabSelectsValue,
|
|
96
98
|
onClickPreventDefault: onClickPreventDefault
|
|
@@ -7,14 +7,13 @@ exports.isOptionsGrouped = exports.countAllOptions = void 0;
|
|
|
7
7
|
exports.onFocus = onFocus;
|
|
8
8
|
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
9
9
|
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
10
|
-
function onFocus(
|
|
10
|
+
function onFocus(onFocusProps, defaultOptions) {
|
|
11
11
|
var _groupData$options$fi;
|
|
12
|
-
var focused =
|
|
13
|
-
options = props.options;
|
|
12
|
+
var focused = onFocusProps.focused;
|
|
14
13
|
var isOptionFocused = function isOptionFocused(option) {
|
|
15
|
-
return option === focused;
|
|
14
|
+
return option.label === focused.label;
|
|
16
15
|
};
|
|
17
|
-
var groupData =
|
|
16
|
+
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
18
17
|
var _option$options;
|
|
19
18
|
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
20
19
|
});
|
|
@@ -6,12 +6,11 @@ import { createPortal } from 'react-dom';
|
|
|
6
6
|
import FocusLock from 'react-focus-lock';
|
|
7
7
|
import NodeResolver from 'react-node-resolver';
|
|
8
8
|
import { Manager, Popper, Reference } from 'react-popper';
|
|
9
|
-
import
|
|
9
|
+
import { mergeStyles } from 'react-select';
|
|
10
10
|
import { uid } from 'react-uid';
|
|
11
11
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { N80 } from '@atlaskit/theme/colors';
|
|
14
|
-
import
|
|
13
|
+
import Select from '../Select';
|
|
15
14
|
import baseStyles from '../styles';
|
|
16
15
|
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
17
16
|
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
@@ -53,6 +52,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
53
52
|
var _this$defaultOpenStat;
|
|
54
53
|
super(...args);
|
|
55
54
|
_defineProperty(this, "menuRef", null);
|
|
55
|
+
_defineProperty(this, "selectRef", null);
|
|
56
56
|
_defineProperty(this, "targetRef", null);
|
|
57
57
|
_defineProperty(this, "unbindWindowClick", null);
|
|
58
58
|
_defineProperty(this, "unbindWindowKeydown", null);
|
|
@@ -163,7 +163,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
163
163
|
});
|
|
164
164
|
if (this.selectRef) {
|
|
165
165
|
var _this$selectRef$selec;
|
|
166
|
-
|
|
166
|
+
(_this$selectRef$selec = this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first');
|
|
167
167
|
}
|
|
168
168
|
if (typeof window === 'undefined') {
|
|
169
169
|
return;
|
|
@@ -261,7 +261,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
261
261
|
|
|
262
262
|
// subtract the control height to maintain consistency
|
|
263
263
|
const showSearchControl = this.showSearchControl();
|
|
264
|
-
|
|
264
|
+
const controlRef = (_this$selectRef$selec2 = this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
265
265
|
const offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
266
266
|
const maxHeight = maxMenuHeight - offsetHeight;
|
|
267
267
|
return maxHeight;
|
|
@@ -309,17 +309,16 @@ export default class PopupSelect extends PureComponent {
|
|
|
309
309
|
return placeholder;
|
|
310
310
|
}
|
|
311
311
|
};
|
|
312
|
-
const InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
313
312
|
const providedAriaLabel = getLabel();
|
|
314
313
|
const updateInputAriaLabel = ariaLabelText => {
|
|
315
|
-
var _this$selectRef, _this$selectRef$selec3
|
|
314
|
+
var _this$selectRef, _this$selectRef$selec3;
|
|
316
315
|
// Update aria-label to get first announcement when popup opened.
|
|
317
|
-
if ((_this$selectRef = this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef$selec3 = _this$selectRef.select) !== null && _this$selectRef$selec3 !== void 0 && _this$selectRef$selec3.inputRef
|
|
318
|
-
var _this$
|
|
316
|
+
if ((_this$selectRef = this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef$selec3 = _this$selectRef.select) !== null && _this$selectRef$selec3 !== void 0 && _this$selectRef$selec3.inputRef) {
|
|
317
|
+
var _this$selectRef2, _this$selectRef2$sele;
|
|
319
318
|
if (providedAriaLabel) {
|
|
320
319
|
ariaLabelText = `${providedAriaLabel}. ${ariaLabelText}`;
|
|
321
320
|
}
|
|
322
|
-
|
|
321
|
+
(_this$selectRef2 = this.selectRef) === null || _this$selectRef2 === void 0 ? void 0 : (_this$selectRef2$sele = _this$selectRef2.select.inputRef) === null || _this$selectRef2$sele === void 0 ? void 0 : _this$selectRef2$sele.setAttribute('aria-label', ariaLabelText);
|
|
323
322
|
}
|
|
324
323
|
};
|
|
325
324
|
const generateNoGroupsAriaText = (onFocusProps, ariaLabelSuffix) => {
|
|
@@ -328,10 +327,10 @@ export default class PopupSelect extends PureComponent {
|
|
|
328
327
|
focused
|
|
329
328
|
} = onFocusProps;
|
|
330
329
|
const options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
331
|
-
const totalLength =
|
|
330
|
+
const totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
332
331
|
const optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => option === focused)) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
333
332
|
const optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
334
|
-
const ariaLabelText = `Option ${optionName} focused, ${optionIndex} of ${totalLength}.
|
|
333
|
+
const ariaLabelText = `Option ${optionName} focused, ${optionIndex + 1} of ${totalLength}.
|
|
335
334
|
${totalLength} results available.
|
|
336
335
|
${ariaLabelSuffix}
|
|
337
336
|
`;
|
|
@@ -348,7 +347,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
348
347
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
349
348
|
if (isOptionsGrouped(props.options)) {
|
|
350
349
|
const totalLength = countAllOptions(props.options);
|
|
351
|
-
ariaLiveMessage = onFocus(onFocusProps);
|
|
350
|
+
ariaLiveMessage = onFocus(onFocusProps, props.options);
|
|
352
351
|
ariaLabelText = `${ariaLiveMessage} ${totalLength} results available. ${ariaLabelSuffix}`;
|
|
353
352
|
} else {
|
|
354
353
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -357,6 +356,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
357
356
|
updateInputAriaLabel(ariaLabelText);
|
|
358
357
|
return ariaLiveMessage;
|
|
359
358
|
}
|
|
359
|
+
return ariaLiveMessage;
|
|
360
360
|
};
|
|
361
361
|
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
362
362
|
onFirstUpdate: state => {
|
|
@@ -382,7 +382,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
382
382
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
383
383
|
disabled: !focusLockEnabled,
|
|
384
384
|
returnFocus: true
|
|
385
|
-
}, /*#__PURE__*/React.createElement(
|
|
385
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
386
386
|
"aria-label": providedAriaLabel,
|
|
387
387
|
backspaceRemovesValue: false,
|
|
388
388
|
controlShouldRenderValue: false,
|
|
@@ -4,24 +4,30 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { components } from 'react-select';
|
|
8
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
8
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import
|
|
9
|
+
import { components } from 'react-select';
|
|
11
10
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
12
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
13
11
|
import { N40A } from '@atlaskit/theme/colors';
|
|
12
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
13
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
14
14
|
|
|
15
15
|
// ==============================
|
|
16
16
|
// Styled Components
|
|
17
17
|
// ==============================
|
|
18
18
|
|
|
19
19
|
const menuDialogStyles = css({
|
|
20
|
+
zIndex: layers.modal(),
|
|
20
21
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
21
22
|
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
22
|
-
boxShadow: `var(--ds-shadow-overlay, ${`0 0 0 1px ${N40A}, 0 4px 11px ${N40A}`})
|
|
23
|
-
zIndex: layers.modal()
|
|
23
|
+
boxShadow: `var(--ds-shadow-overlay, ${`0 0 0 1px ${N40A}, 0 4px 11px ${N40A}`})`
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* __Menu dialog__
|
|
28
|
+
* Wrapper for PopupSelect component.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
25
31
|
export const MenuDialog = ({
|
|
26
32
|
maxWidth,
|
|
27
33
|
minWidth,
|
|
@@ -50,9 +56,9 @@ export const MenuDialog = ({
|
|
|
50
56
|
// ==============================
|
|
51
57
|
|
|
52
58
|
const dropdownStyles = css({
|
|
59
|
+
width: 32,
|
|
53
60
|
marginInlineEnd: "var(--ds-space-025, 2px)",
|
|
54
|
-
textAlign: 'center'
|
|
55
|
-
width: 32
|
|
61
|
+
textAlign: 'center'
|
|
56
62
|
});
|
|
57
63
|
const DropdownIndicator = () => jsx("div", {
|
|
58
64
|
css: dropdownStyles
|
|
@@ -72,6 +78,11 @@ const Control = ({
|
|
|
72
78
|
}, jsx(components.Control, _extends({}, props, {
|
|
73
79
|
innerProps: innerProps
|
|
74
80
|
})));
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* __Dummy control__
|
|
84
|
+
* Overrides the default DummyControl component in Select.
|
|
85
|
+
*/
|
|
75
86
|
export const DummyControl = props => jsx(VisuallyHidden, null, jsx(components.Control, props));
|
|
76
87
|
|
|
77
88
|
// NOTE `props` intentionally omitted from `Fragment`
|
|
@@ -79,8 +90,14 @@ const Menu = ({
|
|
|
79
90
|
children,
|
|
80
91
|
innerProps
|
|
81
92
|
}) => jsx("div", innerProps, children);
|
|
93
|
+
const IndicatorSeparator = props => jsx(components.IndicatorSeparator, props);
|
|
94
|
+
const ClearIndicator = props => jsx(components.ClearIndicator, props);
|
|
95
|
+
const MultiValueRemove = props => jsx(components.MultiValueRemove, props);
|
|
82
96
|
export const defaultComponents = {
|
|
83
97
|
Control,
|
|
84
98
|
DropdownIndicator,
|
|
85
|
-
Menu
|
|
99
|
+
Menu,
|
|
100
|
+
IndicatorSeparator,
|
|
101
|
+
ClearIndicator,
|
|
102
|
+
MultiValueRemove
|
|
86
103
|
};
|
package/dist/es2019/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect 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 = "17.11.
|
|
5
|
+
const packageVersion = "17.11.12";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
|
@@ -70,7 +70,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
70
70
|
ref: internalSelectRef,
|
|
71
71
|
"aria-live": "assertive",
|
|
72
72
|
ariaLiveMessages: isOptionsGrouped(props.options) ? {
|
|
73
|
-
onFocus,
|
|
73
|
+
onFocus: data => onFocus(data, props.options),
|
|
74
74
|
...ariaLiveMessages
|
|
75
75
|
} : {
|
|
76
76
|
...ariaLiveMessages
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
2
|
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
-
export function onFocus(
|
|
3
|
+
export function onFocus(onFocusProps, defaultOptions) {
|
|
4
4
|
var _groupData$options$fi;
|
|
5
5
|
const {
|
|
6
|
-
focused
|
|
7
|
-
|
|
8
|
-
} = props;
|
|
6
|
+
focused
|
|
7
|
+
} = onFocusProps;
|
|
9
8
|
const isOptionFocused = option => {
|
|
10
|
-
return option === focused;
|
|
9
|
+
return option.label === focused.label;
|
|
11
10
|
};
|
|
12
|
-
const groupData =
|
|
11
|
+
const groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(option => {
|
|
13
12
|
var _option$options;
|
|
14
13
|
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
15
14
|
});
|
|
@@ -18,12 +18,11 @@ import { createPortal } from 'react-dom';
|
|
|
18
18
|
import FocusLock from 'react-focus-lock';
|
|
19
19
|
import NodeResolver from 'react-node-resolver';
|
|
20
20
|
import { Manager, Popper, Reference } from 'react-popper';
|
|
21
|
-
import
|
|
21
|
+
import { mergeStyles } from 'react-select';
|
|
22
22
|
import { uid } from 'react-uid';
|
|
23
23
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
24
|
import { N80 } from '@atlaskit/theme/colors';
|
|
26
|
-
import
|
|
25
|
+
import Select from '../Select';
|
|
27
26
|
import baseStyles from '../styles';
|
|
28
27
|
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
29
28
|
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
@@ -76,6 +75,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
75
|
}
|
|
77
76
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
78
77
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
79
79
|
_defineProperty(_assertThisInitialized(_this), "targetRef", null);
|
|
80
80
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowClick", null);
|
|
81
81
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
@@ -181,7 +181,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
181
181
|
});
|
|
182
182
|
if (_this.selectRef) {
|
|
183
183
|
var _this$selectRef$selec;
|
|
184
|
-
|
|
184
|
+
(_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 || _this$selectRef$selec.openMenu('first');
|
|
185
185
|
}
|
|
186
186
|
if (typeof window === 'undefined') {
|
|
187
187
|
return;
|
|
@@ -279,7 +279,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
279
279
|
|
|
280
280
|
// subtract the control height to maintain consistency
|
|
281
281
|
var showSearchControl = _this.showSearchControl();
|
|
282
|
-
var controlRef =
|
|
282
|
+
var controlRef = (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
283
283
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
284
284
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
285
285
|
return maxHeight;
|
|
@@ -323,29 +323,28 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
323
323
|
return placeholder;
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
|
-
var InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
327
326
|
var providedAriaLabel = getLabel();
|
|
328
327
|
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
329
|
-
var _this$selectRef
|
|
328
|
+
var _this$selectRef;
|
|
330
329
|
// Update aria-label to get first announcement when popup opened.
|
|
331
|
-
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef
|
|
332
|
-
var _this$
|
|
330
|
+
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef) {
|
|
331
|
+
var _this$selectRef2;
|
|
333
332
|
if (providedAriaLabel) {
|
|
334
333
|
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
335
334
|
}
|
|
336
|
-
|
|
335
|
+
(_this$selectRef2 = _this.selectRef) === null || _this$selectRef2 === void 0 || (_this$selectRef2 = _this$selectRef2.select.inputRef) === null || _this$selectRef2 === void 0 || _this$selectRef2.setAttribute('aria-label', ariaLabelText);
|
|
337
336
|
}
|
|
338
337
|
};
|
|
339
338
|
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
340
339
|
var _options$findIndex;
|
|
341
340
|
var focused = onFocusProps.focused;
|
|
342
341
|
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
343
|
-
var totalLength =
|
|
342
|
+
var totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
344
343
|
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
345
344
|
return option === focused;
|
|
346
345
|
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
347
346
|
var optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
348
|
-
var ariaLabelText = "Option ".concat(optionName, " focused, ").concat(optionIndex, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
|
|
347
|
+
var ariaLabelText = "Option ".concat(optionName, " focused, ").concat(optionIndex + 1, " of ").concat(totalLength, ".\n\t\t\t").concat(totalLength, " results available.\n\t\t\t").concat(ariaLabelSuffix, "\n\t\t\t");
|
|
349
348
|
// Option LABEL focused, 1 of 8. 8 results available.
|
|
350
349
|
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
351
350
|
// press Escape to exit the menu.
|
|
@@ -359,7 +358,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
359
358
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
360
359
|
if (isOptionsGrouped(props.options)) {
|
|
361
360
|
var totalLength = countAllOptions(props.options);
|
|
362
|
-
ariaLiveMessage = onFocus(onFocusProps);
|
|
361
|
+
ariaLiveMessage = onFocus(onFocusProps, props.options);
|
|
363
362
|
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
364
363
|
} else {
|
|
365
364
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -368,6 +367,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
368
367
|
updateInputAriaLabel(ariaLabelText);
|
|
369
368
|
return ariaLiveMessage;
|
|
370
369
|
}
|
|
370
|
+
return ariaLiveMessage;
|
|
371
371
|
};
|
|
372
372
|
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
373
373
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
@@ -393,7 +393,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
393
393
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
394
394
|
disabled: !focusLockEnabled,
|
|
395
395
|
returnFocus: true
|
|
396
|
-
}, /*#__PURE__*/React.createElement(
|
|
396
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
397
397
|
"aria-label": providedAriaLabel,
|
|
398
398
|
backspaceRemovesValue: false,
|
|
399
399
|
controlShouldRenderValue: false,
|
|
@@ -6,24 +6,30 @@ var _excluded = ["innerRef", "innerProps"];
|
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { components } from 'react-select';
|
|
10
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
10
|
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import
|
|
11
|
+
import { components } from 'react-select';
|
|
13
12
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
14
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
15
13
|
import { N40A } from '@atlaskit/theme/colors';
|
|
14
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
15
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
16
16
|
|
|
17
17
|
// ==============================
|
|
18
18
|
// Styled Components
|
|
19
19
|
// ==============================
|
|
20
20
|
|
|
21
21
|
var menuDialogStyles = css({
|
|
22
|
+
zIndex: layers.modal(),
|
|
22
23
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
23
24
|
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
24
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(N40A, ", 0 4px 11px ").concat(N40A), ")")
|
|
25
|
-
zIndex: layers.modal()
|
|
25
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(N40A, ", 0 4px 11px ").concat(N40A), ")")
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* __Menu dialog__
|
|
30
|
+
* Wrapper for PopupSelect component.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
27
33
|
export var MenuDialog = function MenuDialog(_ref) {
|
|
28
34
|
var maxWidth = _ref.maxWidth,
|
|
29
35
|
minWidth = _ref.minWidth,
|
|
@@ -53,9 +59,9 @@ export var MenuDialog = function MenuDialog(_ref) {
|
|
|
53
59
|
// ==============================
|
|
54
60
|
|
|
55
61
|
var dropdownStyles = css({
|
|
62
|
+
width: 32,
|
|
56
63
|
marginInlineEnd: "var(--ds-space-025, 2px)",
|
|
57
|
-
textAlign: 'center'
|
|
58
|
-
width: 32
|
|
64
|
+
textAlign: 'center'
|
|
59
65
|
});
|
|
60
66
|
var DropdownIndicator = function DropdownIndicator() {
|
|
61
67
|
return jsx("div", {
|
|
@@ -78,6 +84,11 @@ var Control = function Control(_ref2) {
|
|
|
78
84
|
innerProps: innerProps
|
|
79
85
|
})));
|
|
80
86
|
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* __Dummy control__
|
|
90
|
+
* Overrides the default DummyControl component in Select.
|
|
91
|
+
*/
|
|
81
92
|
export var DummyControl = function DummyControl(props) {
|
|
82
93
|
return jsx(VisuallyHidden, null, jsx(components.Control, props));
|
|
83
94
|
};
|
|
@@ -88,8 +99,20 @@ var Menu = function Menu(_ref3) {
|
|
|
88
99
|
innerProps = _ref3.innerProps;
|
|
89
100
|
return jsx("div", innerProps, children);
|
|
90
101
|
};
|
|
102
|
+
var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
103
|
+
return jsx(components.IndicatorSeparator, props);
|
|
104
|
+
};
|
|
105
|
+
var ClearIndicator = function ClearIndicator(props) {
|
|
106
|
+
return jsx(components.ClearIndicator, props);
|
|
107
|
+
};
|
|
108
|
+
var MultiValueRemove = function MultiValueRemove(props) {
|
|
109
|
+
return jsx(components.MultiValueRemove, props);
|
|
110
|
+
};
|
|
91
111
|
export var defaultComponents = {
|
|
92
112
|
Control: Control,
|
|
93
113
|
DropdownIndicator: DropdownIndicator,
|
|
94
|
-
Menu: Menu
|
|
114
|
+
Menu: Menu,
|
|
115
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
116
|
+
ClearIndicator: ClearIndicator,
|
|
117
|
+
MultiValueRemove: MultiValueRemove
|
|
95
118
|
};
|
package/dist/esm/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect 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 = "17.11.
|
|
5
|
+
var packageVersion = "17.11.12";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|
package/dist/esm/createSelect.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ClearIndicator, DropdownIndicator, IndicatorSeparator, LoadingIndicator
|
|
|
10
10
|
import { Input } from './components/input-aria-describedby';
|
|
11
11
|
import { NoOptionsMessage } from './components/no-options';
|
|
12
12
|
import baseStyles from './styles';
|
|
13
|
-
import { isOptionsGrouped, onFocus } from './utils/grouped-options-announcement';
|
|
13
|
+
import { isOptionsGrouped, onFocus as _onFocus } from './utils/grouped-options-announcement';
|
|
14
14
|
export default function createSelect(WrappedComponent) {
|
|
15
15
|
var AtlaskitSelect = /*#__PURE__*/forwardRef(function AtlaskitSelect(props, forwardedRef) {
|
|
16
16
|
var appearance = props.appearance,
|
|
@@ -80,7 +80,9 @@ export default function createSelect(WrappedComponent) {
|
|
|
80
80
|
ref: internalSelectRef,
|
|
81
81
|
"aria-live": "assertive",
|
|
82
82
|
ariaLiveMessages: isOptionsGrouped(props.options) ? _objectSpread({
|
|
83
|
-
onFocus: onFocus
|
|
83
|
+
onFocus: function onFocus(data) {
|
|
84
|
+
return _onFocus(data, props.options);
|
|
85
|
+
}
|
|
84
86
|
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages),
|
|
85
87
|
tabSelectsValue: tabSelectsValue,
|
|
86
88
|
onClickPreventDefault: onClickPreventDefault
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
2
|
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
-
export function onFocus(
|
|
3
|
+
export function onFocus(onFocusProps, defaultOptions) {
|
|
4
4
|
var _groupData$options$fi;
|
|
5
|
-
var focused =
|
|
6
|
-
options = props.options;
|
|
5
|
+
var focused = onFocusProps.focused;
|
|
7
6
|
var isOptionFocused = function isOptionFocused(option) {
|
|
8
|
-
return option === focused;
|
|
7
|
+
return option.label === focused.label;
|
|
9
8
|
};
|
|
10
|
-
var groupData =
|
|
9
|
+
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
11
10
|
var _option$options;
|
|
12
11
|
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
13
12
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { type KeyboardEventHandler, PureComponent, type ReactNode } from 'react';
|
|
2
2
|
import { type UnbindFn } from 'bind-event-listener';
|
|
3
3
|
import { type PopperProps } from 'react-popper';
|
|
4
|
+
import { type GroupBase } from 'react-select';
|
|
4
5
|
import { type ActionMeta, type AtlaskitSelectRefType, type OptionType, type ReactSelectProps, type StylesConfig, type ValidationState, type ValueType } from '../types';
|
|
5
6
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
6
7
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
@@ -94,7 +95,7 @@ interface State<Modifiers = string> {
|
|
|
94
95
|
}
|
|
95
96
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
96
97
|
menuRef: HTMLElement | null;
|
|
97
|
-
selectRef:
|
|
98
|
+
selectRef: AtlaskitSelectRefType | null;
|
|
98
99
|
targetRef: HTMLElement | null;
|
|
99
100
|
unbindWindowClick: UnbindFn | null;
|
|
100
101
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -108,6 +109,9 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
108
109
|
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
109
110
|
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
110
111
|
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
112
|
+
IndicatorSeparator: (props: import("react-select").IndicatorSeparatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
113
|
+
ClearIndicator: (props: import("react-select").ClearIndicatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
114
|
+
MultiValueRemove: (props: import("react-select").MultiValueRemoveProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
111
115
|
};
|
|
112
116
|
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
113
117
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type CSSProperties, type FC, type ReactNode } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
-
import { type ControlProps, type MenuProps, type OptionType } from '../types';
|
|
7
|
+
import { type ClearIndicatorProps, type ControlProps, type IndicatorSeparatorProps, type MenuProps, type MultiValueRemoveProps, type OptionType } from '../types';
|
|
8
8
|
interface MenuDialogProps {
|
|
9
9
|
maxWidth?: number | string;
|
|
10
10
|
minWidth?: number | string;
|
|
@@ -13,11 +13,23 @@ interface MenuDialogProps {
|
|
|
13
13
|
id: string;
|
|
14
14
|
testId?: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* __Menu dialog__
|
|
18
|
+
* Wrapper for PopupSelect component.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
16
21
|
export declare const MenuDialog: FC<MenuDialogProps>;
|
|
22
|
+
/**
|
|
23
|
+
* __Dummy control__
|
|
24
|
+
* Overrides the default DummyControl component in Select.
|
|
25
|
+
*/
|
|
17
26
|
export declare const DummyControl: FC<ControlProps<OptionType, boolean>>;
|
|
18
27
|
export declare const defaultComponents: {
|
|
19
28
|
Control: FC<ControlProps<OptionType, boolean>>;
|
|
20
29
|
DropdownIndicator: () => jsx.JSX.Element;
|
|
21
30
|
Menu: ({ children, innerProps }: MenuProps<OptionType, boolean>) => jsx.JSX.Element;
|
|
31
|
+
IndicatorSeparator: (props: IndicatorSeparatorProps) => jsx.JSX.Element;
|
|
32
|
+
ClearIndicator: (props: ClearIndicatorProps) => jsx.JSX.Element;
|
|
33
|
+
MultiValueRemove: (props: MultiValueRemoveProps) => jsx.JSX.Element;
|
|
22
34
|
};
|
|
23
35
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaOnFocusProps, type GroupBase, type OptionsOrGroups } from 'react-select';
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
|
-
export declare function onFocus(
|
|
3
|
+
export declare function onFocus(onFocusProps: AriaOnFocusProps<OptionType, GroupBase<OptionType>>, defaultOptions?: OptionsOrGroups<OptionType, GroupType<OptionType>>): string;
|
|
4
4
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
5
5
|
export declare const countAllOptions: (groupsArray: readonly GroupType<OptionType>[]) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { type KeyboardEventHandler, PureComponent, type ReactNode } from 'react';
|
|
2
2
|
import { type UnbindFn } from 'bind-event-listener';
|
|
3
3
|
import { type PopperProps } from 'react-popper';
|
|
4
|
+
import { type GroupBase } from 'react-select';
|
|
4
5
|
import { type ActionMeta, type AtlaskitSelectRefType, type OptionType, type ReactSelectProps, type StylesConfig, type ValidationState, type ValueType } from '../types';
|
|
5
6
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
6
7
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
@@ -94,7 +95,7 @@ interface State<Modifiers = string> {
|
|
|
94
95
|
}
|
|
95
96
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
96
97
|
menuRef: HTMLElement | null;
|
|
97
|
-
selectRef:
|
|
98
|
+
selectRef: AtlaskitSelectRefType | null;
|
|
98
99
|
targetRef: HTMLElement | null;
|
|
99
100
|
unbindWindowClick: UnbindFn | null;
|
|
100
101
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -108,6 +109,9 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
108
109
|
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
109
110
|
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
110
111
|
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
112
|
+
IndicatorSeparator: (props: import("react-select").IndicatorSeparatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
113
|
+
ClearIndicator: (props: import("react-select").ClearIndicatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
114
|
+
MultiValueRemove: (props: import("react-select").MultiValueRemoveProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
111
115
|
};
|
|
112
116
|
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
113
117
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type CSSProperties, type FC, type ReactNode } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
-
import { type ControlProps, type MenuProps, type OptionType } from '../types';
|
|
7
|
+
import { type ClearIndicatorProps, type ControlProps, type IndicatorSeparatorProps, type MenuProps, type MultiValueRemoveProps, type OptionType } from '../types';
|
|
8
8
|
interface MenuDialogProps {
|
|
9
9
|
maxWidth?: number | string;
|
|
10
10
|
minWidth?: number | string;
|
|
@@ -13,11 +13,23 @@ interface MenuDialogProps {
|
|
|
13
13
|
id: string;
|
|
14
14
|
testId?: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* __Menu dialog__
|
|
18
|
+
* Wrapper for PopupSelect component.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
16
21
|
export declare const MenuDialog: FC<MenuDialogProps>;
|
|
22
|
+
/**
|
|
23
|
+
* __Dummy control__
|
|
24
|
+
* Overrides the default DummyControl component in Select.
|
|
25
|
+
*/
|
|
17
26
|
export declare const DummyControl: FC<ControlProps<OptionType, boolean>>;
|
|
18
27
|
export declare const defaultComponents: {
|
|
19
28
|
Control: FC<ControlProps<OptionType, boolean>>;
|
|
20
29
|
DropdownIndicator: () => jsx.JSX.Element;
|
|
21
30
|
Menu: ({ children, innerProps }: MenuProps<OptionType, boolean>) => jsx.JSX.Element;
|
|
31
|
+
IndicatorSeparator: (props: IndicatorSeparatorProps) => jsx.JSX.Element;
|
|
32
|
+
ClearIndicator: (props: ClearIndicatorProps) => jsx.JSX.Element;
|
|
33
|
+
MultiValueRemove: (props: MultiValueRemoveProps) => jsx.JSX.Element;
|
|
22
34
|
};
|
|
23
35
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaOnFocusProps, type GroupBase, type OptionsOrGroups } from 'react-select';
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
|
-
export declare function onFocus(
|
|
3
|
+
export declare function onFocus(onFocusProps: AriaOnFocusProps<OptionType, GroupBase<OptionType>>, defaultOptions?: OptionsOrGroups<OptionType, GroupType<OptionType>>): string;
|
|
4
4
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
5
5
|
export declare const countAllOptions: (groupsArray: readonly GroupType<OptionType>[]) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "17.11.
|
|
3
|
+
"version": "17.11.12",
|
|
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/"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
46
|
+
"@atlaskit/icon": "^22.10.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
48
48
|
"@atlaskit/primitives": "^11.1.0",
|
|
49
49
|
"@atlaskit/spinner": "^16.2.0",
|
|
50
50
|
"@atlaskit/theme": "^12.11.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.57.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^1.4.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@af/accessibility-testing": "*",
|
|
70
70
|
"@af/integration-testing": "*",
|
|
71
71
|
"@af/visual-regression": "*",
|
|
72
|
-
"@atlaskit/checkbox": "^13.
|
|
72
|
+
"@atlaskit/checkbox": "^13.6.0",
|
|
73
73
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
74
74
|
"@atlaskit/modal-dialog": "^12.14.0",
|
|
75
75
|
"@atlaskit/radio": "^6.4.0",
|
|
@@ -104,9 +104,6 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"platform-feature-flags": {
|
|
107
|
-
"platform.design-system-team.use-default-select-in-popup-select_46rmj": {
|
|
108
|
-
"type": "boolean"
|
|
109
|
-
},
|
|
110
107
|
"platform.design-system-team.select-new-typography_7m89c": {
|
|
111
108
|
"type": "boolean"
|
|
112
109
|
}
|