@atlaskit/select 17.11.7 → 17.11.9
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/CountrySelect.js +1 -1
- package/dist/cjs/PopupSelect/PopupSelect.js +64 -17
- package/dist/cjs/PopupSelect/components.js +1 -1
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/indicators.js +2 -1
- package/dist/cjs/components/input-options.js +2 -1
- package/dist/cjs/createSelect.js +1 -1
- package/dist/cjs/utils/grouped-options-announcement.js +12 -1
- package/dist/es2019/CountrySelect.js +1 -1
- package/dist/es2019/PopupSelect/PopupSelect.js +68 -17
- package/dist/es2019/PopupSelect/components.js +1 -1
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/index.js +1 -1
- package/dist/es2019/components/indicators.js +1 -1
- package/dist/es2019/components/input-options.js +1 -1
- package/dist/es2019/createSelect.js +3 -3
- package/dist/es2019/utils/grouped-options-announcement.js +11 -0
- package/dist/esm/CountrySelect.js +1 -1
- package/dist/esm/PopupSelect/PopupSelect.js +64 -17
- package/dist/esm/PopupSelect/components.js +1 -1
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/indicators.js +1 -1
- package/dist/esm/components/input-options.js +1 -1
- package/dist/esm/createSelect.js +3 -3
- package/dist/esm/utils/grouped-options-announcement.js +11 -0
- package/dist/types/PopupSelect/PopupSelect.d.ts +34 -25
- package/dist/types/PopupSelect/components.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/indicators.d.ts +1 -1
- package/dist/types/components/input-options.d.ts +1 -1
- package/dist/types/createSelect.d.ts +1 -1
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -0
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +34 -25
- package/dist/types-ts4.5/PopupSelect/components.d.ts +1 -1
- package/dist/types-ts4.5/components/index.d.ts +1 -1
- package/dist/types-ts4.5/components/indicators.d.ts +1 -1
- package/dist/types-ts4.5/components/input-options.d.ts +1 -1
- package/dist/types-ts4.5/createSelect.d.ts +1 -1
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -0
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.11.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#124328](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124328)
|
|
8
|
+
[`69cea8c513faa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/69cea8c513faa) -
|
|
9
|
+
Add announcement of focused option for the first open of Popup select
|
|
10
|
+
|
|
11
|
+
## 17.11.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#123484](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/123484)
|
|
16
|
+
[`e241c04ab92d5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e241c04ab92d5) -
|
|
17
|
+
Remove abandoned feature flag usage
|
|
18
|
+
|
|
3
19
|
## 17.11.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,8 +11,8 @@ var _countries = require("./data/countries");
|
|
|
11
11
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
12
12
|
/**
|
|
13
13
|
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
14
15
|
*/
|
|
15
|
-
/** @jsx jsx */
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
18
|
|
|
@@ -16,19 +16,20 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
16
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _bindEventListener = require("bind-event-listener");
|
|
19
20
|
var _reactDom = require("react-dom");
|
|
20
21
|
var _reactFocusLock = _interopRequireDefault(require("react-focus-lock"));
|
|
22
|
+
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
23
|
+
var _reactPopper = require("react-popper");
|
|
21
24
|
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
22
25
|
var _reactUid = require("react-uid");
|
|
23
|
-
var _reactPopper = require("react-popper");
|
|
24
|
-
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
25
26
|
var _shallowEqual = require("shallow-equal");
|
|
26
|
-
var _Select = _interopRequireDefault(require("../Select"));
|
|
27
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
28
27
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
|
-
var
|
|
28
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
29
|
+
var _Select = _interopRequireDefault(require("../Select"));
|
|
30
30
|
var _styles = _interopRequireDefault(require("../styles"));
|
|
31
|
-
var
|
|
31
|
+
var _groupedOptionsAnnouncement = require("../utils/grouped-options-announcement");
|
|
32
|
+
var _components = require("./components");
|
|
32
33
|
var _excluded = ["footer", "label", "maxMenuWidth", "minMenuWidth", "placeholder", "target", "testId"];
|
|
33
34
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
35
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -36,7 +37,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
36
37
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
38
39
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
39
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Are we rendering on the client or server?
|
|
42
|
+
*/
|
|
40
43
|
var canUseDOM = function canUseDOM() {
|
|
41
44
|
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
42
45
|
};
|
|
@@ -188,7 +191,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
188
191
|
});
|
|
189
192
|
if (_this.selectRef) {
|
|
190
193
|
var _this$selectRef$selec;
|
|
191
|
-
(0, _platformFeatureFlags.
|
|
194
|
+
(0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : _this.selectRef.openMenu('first');
|
|
192
195
|
}
|
|
193
196
|
if (typeof window === 'undefined') {
|
|
194
197
|
return;
|
|
@@ -286,7 +289,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
286
289
|
|
|
287
290
|
// subtract the control height to maintain consistency
|
|
288
291
|
var showSearchControl = _this.showSearchControl();
|
|
289
|
-
var controlRef = (0, _platformFeatureFlags.
|
|
292
|
+
var controlRef = (0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : _this.selectRef.controlRef;
|
|
290
293
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
291
294
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
292
295
|
return maxHeight;
|
|
@@ -330,7 +333,52 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
330
333
|
return placeholder;
|
|
331
334
|
}
|
|
332
335
|
};
|
|
333
|
-
var InternalSelect = (0, _platformFeatureFlags.
|
|
336
|
+
var InternalSelect = (0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? _Select.default : _reactSelect.default;
|
|
337
|
+
var providedAriaLabel = getLabel();
|
|
338
|
+
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
339
|
+
var _this$selectRef, _this$selectRef2;
|
|
340
|
+
// 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 || (_this$selectRef2 = _this.selectRef) !== null && _this$selectRef2 !== void 0 && _this$selectRef2.inputRef) {
|
|
342
|
+
var _this$selectRef3, _this$selectRef4;
|
|
343
|
+
if (providedAriaLabel) {
|
|
344
|
+
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
345
|
+
}
|
|
346
|
+
(0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef3 = _this.selectRef) === null || _this$selectRef3 === void 0 || (_this$selectRef3 = _this$selectRef3.select.inputRef) === null || _this$selectRef3 === void 0 ? void 0 : _this$selectRef3.setAttribute('aria-label', ariaLabelText) : (_this$selectRef4 = _this.selectRef) === null || _this$selectRef4 === void 0 || (_this$selectRef4 = _this$selectRef4.inputRef) === null || _this$selectRef4 === void 0 ? void 0 : _this$selectRef4.setAttribute('aria-label', ariaLabelText);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
350
|
+
var _options$findIndex;
|
|
351
|
+
var focused = onFocusProps.focused;
|
|
352
|
+
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
353
|
+
var totalLength = (options === null || options === void 0 ? void 0 : options.length) + 1;
|
|
354
|
+
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
355
|
+
return option === focused;
|
|
356
|
+
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
357
|
+
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");
|
|
359
|
+
// Option LABEL focused, 1 of 8. 8 results available.
|
|
360
|
+
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
361
|
+
// press Escape to exit the menu.
|
|
362
|
+
return ariaLabelText;
|
|
363
|
+
};
|
|
364
|
+
var onReactSelectFocus = function onReactSelectFocus(onFocusProps) {
|
|
365
|
+
var _props$options;
|
|
366
|
+
var ariaLabelSuffix = ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
|
|
367
|
+
var ariaLabelText = '';
|
|
368
|
+
var ariaLiveMessage = '';
|
|
369
|
+
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
370
|
+
if ((0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options)) {
|
|
371
|
+
var totalLength = (0, _groupedOptionsAnnouncement.countAllOptions)(props.options);
|
|
372
|
+
ariaLiveMessage = (0, _groupedOptionsAnnouncement.onFocus)(onFocusProps);
|
|
373
|
+
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
374
|
+
} else {
|
|
375
|
+
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
376
|
+
ariaLiveMessage = ariaLabelText;
|
|
377
|
+
}
|
|
378
|
+
updateInputAriaLabel(ariaLabelText);
|
|
379
|
+
return ariaLiveMessage;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
334
382
|
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, {
|
|
335
383
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
336
384
|
var _mergedPopperProps$on;
|
|
@@ -356,7 +404,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
356
404
|
disabled: !focusLockEnabled,
|
|
357
405
|
returnFocus: true
|
|
358
406
|
}, /*#__PURE__*/_react.default.createElement(InternalSelect, (0, _extends2.default)({
|
|
359
|
-
"aria-label":
|
|
407
|
+
"aria-label": providedAriaLabel,
|
|
360
408
|
backspaceRemovesValue: false,
|
|
361
409
|
controlShouldRenderValue: false,
|
|
362
410
|
isClearable: false,
|
|
@@ -365,18 +413,17 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
365
413
|
placeholder: placeholder,
|
|
366
414
|
ref: _this.getSelectRef
|
|
367
415
|
}, props, {
|
|
368
|
-
onMenuClose: function onMenuClose() {
|
|
369
|
-
var _props$onMenuClose;
|
|
370
|
-
(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-close_8h15h') && _this.close();
|
|
371
|
-
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 || _props$onMenuClose.call(props);
|
|
372
|
-
},
|
|
373
416
|
isSearchable: showSearchControl
|
|
374
417
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
375
418
|
,
|
|
376
419
|
styles: (0, _reactSelect.mergeStyles)(_this.defaultStyles, props.styles || {}),
|
|
377
420
|
maxMenuHeight: _this.getMaxHeight(),
|
|
378
421
|
components: selectComponents,
|
|
379
|
-
onChange: _this.handleSelectChange
|
|
422
|
+
onChange: _this.handleSelectChange,
|
|
423
|
+
ariaLiveMessages: !showSearchControl ? _objectSpread({
|
|
424
|
+
// Overwriting ariaLiveMessages builtin onFocus method to announce selected option when popup has been opened
|
|
425
|
+
onFocus: onReactSelectFocus
|
|
426
|
+
}, props.ariaLiveMessages) : props.ariaLiveMessages
|
|
380
427
|
})), footer)));
|
|
381
428
|
});
|
|
382
429
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/(0, _reactDom.createPortal)(popper, portalDestination);
|
|
@@ -16,8 +16,8 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
16
16
|
var _excluded = ["innerRef", "innerProps"];
|
|
17
17
|
/**
|
|
18
18
|
* @jsxRuntime classic
|
|
19
|
+
* @jsx jsx
|
|
19
20
|
*/
|
|
20
|
-
/** @jsx jsx */
|
|
21
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
22
|
// ==============================
|
|
23
23
|
// Styled Components
|
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.9";
|
|
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)({
|
|
@@ -30,8 +30,8 @@ var _reactSelect = require("react-select");
|
|
|
30
30
|
var _indicators = require("./indicators");
|
|
31
31
|
/**
|
|
32
32
|
* @jsxRuntime classic
|
|
33
|
+
* @jsx jsx
|
|
33
34
|
*/
|
|
34
|
-
/** @jsx jsx */
|
|
35
35
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
36
36
|
|
|
37
37
|
var disabledStyles = (0, _react.css)({
|
|
@@ -16,7 +16,8 @@ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-
|
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
18
18
|
* @jsxRuntime classic
|
|
19
|
-
|
|
19
|
+
* @jsx jsx
|
|
20
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
21
|
var iconContainerStyles = (0, _primitives.xcss)({
|
|
21
22
|
all: 'unset',
|
|
22
23
|
outline: 'revert',
|
|
@@ -26,7 +26,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
26
26
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
28
28
|
* @jsxRuntime classic
|
|
29
|
-
|
|
29
|
+
* @jsx jsx
|
|
30
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
30
31
|
var getPrimitiveStyles = function getPrimitiveStyles(props) {
|
|
31
32
|
var cx = props.cx,
|
|
32
33
|
className = props.className,
|
package/dist/cjs/createSelect.js
CHANGED
|
@@ -11,9 +11,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _reactSelect = require("react-select");
|
|
14
|
+
var _components = require("./components");
|
|
14
15
|
var _inputAriaDescribedby = require("./components/input-aria-describedby");
|
|
15
16
|
var _noOptions = require("./components/no-options");
|
|
16
|
-
var _components = require("./components");
|
|
17
17
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
18
18
|
var _groupedOptionsAnnouncement = require("./utils/grouped-options-announcement");
|
|
19
19
|
var _excluded = ["appearance", "ariaLiveMessages", "components", "isInvalid", "onClickPreventDefault", "spacing", "styles", "tabSelectsValue", "validationState"];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isOptionsGrouped = void 0;
|
|
6
|
+
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.
|
|
@@ -27,4 +27,15 @@ var isOptionsGrouped = exports.isOptionsGrouped = function isOptionsGrouped(arr)
|
|
|
27
27
|
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
28
28
|
return obj.hasOwnProperty('options');
|
|
29
29
|
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Helper function which calculates how many options are in total in all groups.
|
|
33
|
+
var countAllOptions = exports.countAllOptions = function countAllOptions(groupsArray) {
|
|
34
|
+
var totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce(function (acc, currentGroup) {
|
|
35
|
+
var _group$options;
|
|
36
|
+
var group = currentGroup;
|
|
37
|
+
acc += group === null || group === void 0 || (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
38
|
+
return acc;
|
|
39
|
+
}, 0);
|
|
40
|
+
return totalLength;
|
|
30
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React, { PureComponent } from 'react';
|
|
4
|
+
import { bind } from 'bind-event-listener';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
5
6
|
import FocusLock from 'react-focus-lock';
|
|
7
|
+
import NodeResolver from 'react-node-resolver';
|
|
8
|
+
import { Manager, Popper, Reference } from 'react-popper';
|
|
6
9
|
import Select, { mergeStyles } from 'react-select';
|
|
7
10
|
import { uid } from 'react-uid';
|
|
8
|
-
import { Manager, Reference, Popper } from 'react-popper';
|
|
9
|
-
import NodeResolver from 'react-node-resolver';
|
|
10
11
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
11
|
-
import
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { N80 } from '@atlaskit/theme/colors';
|
|
13
|
-
import
|
|
14
|
-
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
14
|
+
import DefaultSelect from '../Select';
|
|
15
15
|
import baseStyles from '../styles';
|
|
16
|
-
import {
|
|
17
|
-
|
|
16
|
+
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
17
|
+
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
18
|
+
/**
|
|
19
|
+
* Are we rendering on the client or server?
|
|
20
|
+
*/
|
|
18
21
|
const canUseDOM = () => Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
19
22
|
|
|
20
23
|
// ==============================
|
|
@@ -160,7 +163,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
160
163
|
});
|
|
161
164
|
if (this.selectRef) {
|
|
162
165
|
var _this$selectRef$selec;
|
|
163
|
-
|
|
166
|
+
fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : this.selectRef.openMenu('first');
|
|
164
167
|
}
|
|
165
168
|
if (typeof window === 'undefined') {
|
|
166
169
|
return;
|
|
@@ -258,7 +261,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
258
261
|
|
|
259
262
|
// subtract the control height to maintain consistency
|
|
260
263
|
const showSearchControl = this.showSearchControl();
|
|
261
|
-
let controlRef =
|
|
264
|
+
let controlRef = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : this.selectRef.controlRef;
|
|
262
265
|
const offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
263
266
|
const maxHeight = maxMenuHeight - offsetHeight;
|
|
264
267
|
return maxHeight;
|
|
@@ -306,7 +309,55 @@ export default class PopupSelect extends PureComponent {
|
|
|
306
309
|
return placeholder;
|
|
307
310
|
}
|
|
308
311
|
};
|
|
309
|
-
const InternalSelect =
|
|
312
|
+
const InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
313
|
+
const providedAriaLabel = getLabel();
|
|
314
|
+
const updateInputAriaLabel = ariaLabelText => {
|
|
315
|
+
var _this$selectRef, _this$selectRef$selec3, _this$selectRef2;
|
|
316
|
+
// 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 || (_this$selectRef2 = this.selectRef) !== null && _this$selectRef2 !== void 0 && _this$selectRef2.inputRef) {
|
|
318
|
+
var _this$selectRef3, _this$selectRef3$sele, _this$selectRef4, _this$selectRef4$inpu;
|
|
319
|
+
if (providedAriaLabel) {
|
|
320
|
+
ariaLabelText = `${providedAriaLabel}. ${ariaLabelText}`;
|
|
321
|
+
}
|
|
322
|
+
fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef3 = this.selectRef) === null || _this$selectRef3 === void 0 ? void 0 : (_this$selectRef3$sele = _this$selectRef3.select.inputRef) === null || _this$selectRef3$sele === void 0 ? void 0 : _this$selectRef3$sele.setAttribute('aria-label', ariaLabelText) : (_this$selectRef4 = this.selectRef) === null || _this$selectRef4 === void 0 ? void 0 : (_this$selectRef4$inpu = _this$selectRef4.inputRef) === null || _this$selectRef4$inpu === void 0 ? void 0 : _this$selectRef4$inpu.setAttribute('aria-label', ariaLabelText);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const generateNoGroupsAriaText = (onFocusProps, ariaLabelSuffix) => {
|
|
326
|
+
var _options$findIndex;
|
|
327
|
+
const {
|
|
328
|
+
focused
|
|
329
|
+
} = onFocusProps;
|
|
330
|
+
const options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
331
|
+
const totalLength = (options === null || options === void 0 ? void 0 : options.length) + 1;
|
|
332
|
+
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
|
+
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}.
|
|
335
|
+
${totalLength} results available.
|
|
336
|
+
${ariaLabelSuffix}
|
|
337
|
+
`;
|
|
338
|
+
// Option LABEL focused, 1 of 8. 8 results available.
|
|
339
|
+
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
340
|
+
// press Escape to exit the menu.
|
|
341
|
+
return ariaLabelText;
|
|
342
|
+
};
|
|
343
|
+
const onReactSelectFocus = onFocusProps => {
|
|
344
|
+
var _props$options;
|
|
345
|
+
const ariaLabelSuffix = ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
|
|
346
|
+
let ariaLabelText = '';
|
|
347
|
+
let ariaLiveMessage = '';
|
|
348
|
+
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
349
|
+
if (isOptionsGrouped(props.options)) {
|
|
350
|
+
const totalLength = countAllOptions(props.options);
|
|
351
|
+
ariaLiveMessage = onFocus(onFocusProps);
|
|
352
|
+
ariaLabelText = `${ariaLiveMessage} ${totalLength} results available. ${ariaLabelSuffix}`;
|
|
353
|
+
} else {
|
|
354
|
+
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
355
|
+
ariaLiveMessage = ariaLabelText;
|
|
356
|
+
}
|
|
357
|
+
updateInputAriaLabel(ariaLabelText);
|
|
358
|
+
return ariaLiveMessage;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
310
361
|
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
311
362
|
onFirstUpdate: state => {
|
|
312
363
|
var _mergedPopperProps$on;
|
|
@@ -332,7 +383,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
332
383
|
disabled: !focusLockEnabled,
|
|
333
384
|
returnFocus: true
|
|
334
385
|
}, /*#__PURE__*/React.createElement(InternalSelect, _extends({
|
|
335
|
-
"aria-label":
|
|
386
|
+
"aria-label": providedAriaLabel,
|
|
336
387
|
backspaceRemovesValue: false,
|
|
337
388
|
controlShouldRenderValue: false,
|
|
338
389
|
isClearable: false,
|
|
@@ -341,18 +392,18 @@ export default class PopupSelect extends PureComponent {
|
|
|
341
392
|
placeholder: placeholder,
|
|
342
393
|
ref: this.getSelectRef
|
|
343
394
|
}, props, {
|
|
344
|
-
onMenuClose: () => {
|
|
345
|
-
var _props$onMenuClose;
|
|
346
|
-
getBooleanFF('platform.design-system-team.popup-select-close_8h15h') && this.close();
|
|
347
|
-
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 ? void 0 : _props$onMenuClose.call(props);
|
|
348
|
-
},
|
|
349
395
|
isSearchable: showSearchControl
|
|
350
396
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
351
397
|
,
|
|
352
398
|
styles: mergeStyles(this.defaultStyles, props.styles || {}),
|
|
353
399
|
maxMenuHeight: this.getMaxHeight(),
|
|
354
400
|
components: selectComponents,
|
|
355
|
-
onChange: this.handleSelectChange
|
|
401
|
+
onChange: this.handleSelectChange,
|
|
402
|
+
ariaLiveMessages: !showSearchControl ? {
|
|
403
|
+
// Overwriting ariaLiveMessages builtin onFocus method to announce selected option when popup has been opened
|
|
404
|
+
onFocus: onReactSelectFocus,
|
|
405
|
+
...props.ariaLiveMessages // priority to use user handlers if provided
|
|
406
|
+
} : props.ariaLiveMessages
|
|
356
407
|
})), footer))));
|
|
357
408
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
358
409
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
|
|
7
7
|
import { components } from 'react-select';
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
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.9";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
3
4
|
*/
|
|
4
|
-
/** @jsx jsx */
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx, css } from '@emotion/react';
|
|
7
7
|
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx, css } from '@emotion/react';
|
|
8
8
|
import { components } from 'react-select';
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
/**
|
|
4
4
|
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
5
6
|
*/
|
|
6
|
-
/** @jsx jsx */
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { Component } from 'react';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
3
3
|
import { mergeStyles } from 'react-select';
|
|
4
|
+
import { ClearIndicator, DropdownIndicator, IndicatorSeparator, LoadingIndicator, MultiValueRemove } from './components';
|
|
4
5
|
import { Input } from './components/input-aria-describedby';
|
|
5
6
|
import { NoOptionsMessage } from './components/no-options';
|
|
6
|
-
import { ClearIndicator, DropdownIndicator, LoadingIndicator, MultiValueRemove, IndicatorSeparator } from './components';
|
|
7
7
|
import baseStyles from './styles';
|
|
8
|
-
import {
|
|
8
|
+
import { isOptionsGrouped, onFocus } from './utils/grouped-options-announcement';
|
|
9
9
|
export default function createSelect(WrappedComponent) {
|
|
10
10
|
const AtlaskitSelect = /*#__PURE__*/forwardRef(function AtlaskitSelect(props, forwardedRef) {
|
|
11
11
|
const {
|
|
@@ -20,4 +20,15 @@ export function onFocus(props) {
|
|
|
20
20
|
// Helper function which identifies if options are grouped.
|
|
21
21
|
export const isOptionsGrouped = arr => {
|
|
22
22
|
return arr === null || arr === void 0 ? void 0 : arr.every(obj => obj.hasOwnProperty('options'));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Helper function which calculates how many options are in total in all groups.
|
|
26
|
+
export const countAllOptions = groupsArray => {
|
|
27
|
+
const totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce((acc, currentGroup) => {
|
|
28
|
+
var _group$options;
|
|
29
|
+
const group = currentGroup;
|
|
30
|
+
acc += group === null || group === void 0 ? void 0 : (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
31
|
+
return acc;
|
|
32
|
+
}, 0);
|
|
33
|
+
return totalLength;
|
|
23
34
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
@@ -13,20 +13,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
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); }; }
|
|
14
14
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
15
|
import React, { PureComponent } from 'react';
|
|
16
|
+
import { bind } from 'bind-event-listener';
|
|
16
17
|
import { createPortal } from 'react-dom';
|
|
17
18
|
import FocusLock from 'react-focus-lock';
|
|
19
|
+
import NodeResolver from 'react-node-resolver';
|
|
20
|
+
import { Manager, Popper, Reference } from 'react-popper';
|
|
18
21
|
import Select, { mergeStyles } from 'react-select';
|
|
19
22
|
import { uid } from 'react-uid';
|
|
20
|
-
import { Manager, Reference, Popper } from 'react-popper';
|
|
21
|
-
import NodeResolver from 'react-node-resolver';
|
|
22
23
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
23
|
-
import
|
|
24
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
25
|
import { N80 } from '@atlaskit/theme/colors';
|
|
25
|
-
import
|
|
26
|
-
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
26
|
+
import DefaultSelect from '../Select';
|
|
27
27
|
import baseStyles from '../styles';
|
|
28
|
-
import {
|
|
29
|
-
|
|
28
|
+
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
29
|
+
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
30
|
+
/**
|
|
31
|
+
* Are we rendering on the client or server?
|
|
32
|
+
*/
|
|
30
33
|
var canUseDOM = function canUseDOM() {
|
|
31
34
|
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
32
35
|
};
|
|
@@ -178,7 +181,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
178
181
|
});
|
|
179
182
|
if (_this.selectRef) {
|
|
180
183
|
var _this$selectRef$selec;
|
|
181
|
-
|
|
184
|
+
fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : _this.selectRef.openMenu('first');
|
|
182
185
|
}
|
|
183
186
|
if (typeof window === 'undefined') {
|
|
184
187
|
return;
|
|
@@ -276,7 +279,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
276
279
|
|
|
277
280
|
// subtract the control height to maintain consistency
|
|
278
281
|
var showSearchControl = _this.showSearchControl();
|
|
279
|
-
var controlRef =
|
|
282
|
+
var controlRef = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : _this.selectRef.controlRef;
|
|
280
283
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
281
284
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
282
285
|
return maxHeight;
|
|
@@ -320,7 +323,52 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
320
323
|
return placeholder;
|
|
321
324
|
}
|
|
322
325
|
};
|
|
323
|
-
var InternalSelect =
|
|
326
|
+
var InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
327
|
+
var providedAriaLabel = getLabel();
|
|
328
|
+
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
329
|
+
var _this$selectRef, _this$selectRef2;
|
|
330
|
+
// 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 || (_this$selectRef2 = _this.selectRef) !== null && _this$selectRef2 !== void 0 && _this$selectRef2.inputRef) {
|
|
332
|
+
var _this$selectRef3, _this$selectRef4;
|
|
333
|
+
if (providedAriaLabel) {
|
|
334
|
+
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
335
|
+
}
|
|
336
|
+
fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef3 = _this.selectRef) === null || _this$selectRef3 === void 0 || (_this$selectRef3 = _this$selectRef3.select.inputRef) === null || _this$selectRef3 === void 0 ? void 0 : _this$selectRef3.setAttribute('aria-label', ariaLabelText) : (_this$selectRef4 = _this.selectRef) === null || _this$selectRef4 === void 0 || (_this$selectRef4 = _this$selectRef4.inputRef) === null || _this$selectRef4 === void 0 ? void 0 : _this$selectRef4.setAttribute('aria-label', ariaLabelText);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
340
|
+
var _options$findIndex;
|
|
341
|
+
var focused = onFocusProps.focused;
|
|
342
|
+
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
343
|
+
var totalLength = (options === null || options === void 0 ? void 0 : options.length) + 1;
|
|
344
|
+
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
345
|
+
return option === focused;
|
|
346
|
+
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
347
|
+
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");
|
|
349
|
+
// Option LABEL focused, 1 of 8. 8 results available.
|
|
350
|
+
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
351
|
+
// press Escape to exit the menu.
|
|
352
|
+
return ariaLabelText;
|
|
353
|
+
};
|
|
354
|
+
var onReactSelectFocus = function onReactSelectFocus(onFocusProps) {
|
|
355
|
+
var _props$options;
|
|
356
|
+
var ariaLabelSuffix = ' Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu.';
|
|
357
|
+
var ariaLabelText = '';
|
|
358
|
+
var ariaLiveMessage = '';
|
|
359
|
+
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
360
|
+
if (isOptionsGrouped(props.options)) {
|
|
361
|
+
var totalLength = countAllOptions(props.options);
|
|
362
|
+
ariaLiveMessage = onFocus(onFocusProps);
|
|
363
|
+
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
364
|
+
} else {
|
|
365
|
+
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
366
|
+
ariaLiveMessage = ariaLabelText;
|
|
367
|
+
}
|
|
368
|
+
updateInputAriaLabel(ariaLabelText);
|
|
369
|
+
return ariaLiveMessage;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
324
372
|
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
325
373
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
326
374
|
var _mergedPopperProps$on;
|
|
@@ -346,7 +394,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
346
394
|
disabled: !focusLockEnabled,
|
|
347
395
|
returnFocus: true
|
|
348
396
|
}, /*#__PURE__*/React.createElement(InternalSelect, _extends({
|
|
349
|
-
"aria-label":
|
|
397
|
+
"aria-label": providedAriaLabel,
|
|
350
398
|
backspaceRemovesValue: false,
|
|
351
399
|
controlShouldRenderValue: false,
|
|
352
400
|
isClearable: false,
|
|
@@ -355,18 +403,17 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
355
403
|
placeholder: placeholder,
|
|
356
404
|
ref: _this.getSelectRef
|
|
357
405
|
}, props, {
|
|
358
|
-
onMenuClose: function onMenuClose() {
|
|
359
|
-
var _props$onMenuClose;
|
|
360
|
-
getBooleanFF('platform.design-system-team.popup-select-close_8h15h') && _this.close();
|
|
361
|
-
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 || _props$onMenuClose.call(props);
|
|
362
|
-
},
|
|
363
406
|
isSearchable: showSearchControl
|
|
364
407
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
365
408
|
,
|
|
366
409
|
styles: mergeStyles(_this.defaultStyles, props.styles || {}),
|
|
367
410
|
maxMenuHeight: _this.getMaxHeight(),
|
|
368
411
|
components: selectComponents,
|
|
369
|
-
onChange: _this.handleSelectChange
|
|
412
|
+
onChange: _this.handleSelectChange,
|
|
413
|
+
ariaLiveMessages: !showSearchControl ? _objectSpread({
|
|
414
|
+
// Overwriting ariaLiveMessages builtin onFocus method to announce selected option when popup has been opened
|
|
415
|
+
onFocus: onReactSelectFocus
|
|
416
|
+
}, props.ariaLiveMessages) : props.ariaLiveMessages
|
|
370
417
|
})), footer)));
|
|
371
418
|
});
|
|
372
419
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
@@ -3,8 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["innerRef", "innerProps"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
|
+
* @jsx jsx
|
|
6
7
|
*/
|
|
7
|
-
/** @jsx jsx */
|
|
8
8
|
|
|
9
9
|
import { components } from 'react-select';
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
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.9";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
3
4
|
*/
|
|
4
|
-
/** @jsx jsx */
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx, css } from '@emotion/react';
|
|
7
7
|
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
@@ -4,8 +4,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
/**
|
|
6
6
|
* @jsxRuntime classic
|
|
7
|
+
* @jsx jsx
|
|
7
8
|
*/
|
|
8
|
-
/** @jsx jsx */
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { jsx, css } from '@emotion/react';
|
|
11
11
|
import { components } from 'react-select';
|
|
@@ -15,8 +15,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
/**
|
|
17
17
|
* @jsxRuntime classic
|
|
18
|
+
* @jsx jsx
|
|
18
19
|
*/
|
|
19
|
-
/** @jsx jsx */
|
|
20
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
21
|
import { css, jsx } from '@emotion/react';
|
|
22
22
|
import { Component } from 'react';
|
package/dist/esm/createSelect.js
CHANGED
|
@@ -4,13 +4,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
var _excluded = ["appearance", "ariaLiveMessages", "components", "isInvalid", "onClickPreventDefault", "spacing", "styles", "tabSelectsValue", "validationState"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
import React, {
|
|
7
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
8
|
import { mergeStyles } from 'react-select';
|
|
9
|
+
import { ClearIndicator, DropdownIndicator, IndicatorSeparator, LoadingIndicator, MultiValueRemove } from './components';
|
|
9
10
|
import { Input } from './components/input-aria-describedby';
|
|
10
11
|
import { NoOptionsMessage } from './components/no-options';
|
|
11
|
-
import { ClearIndicator, DropdownIndicator, LoadingIndicator, MultiValueRemove, IndicatorSeparator } from './components';
|
|
12
12
|
import baseStyles from './styles';
|
|
13
|
-
import {
|
|
13
|
+
import { isOptionsGrouped, 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,
|
|
@@ -20,4 +20,15 @@ export var isOptionsGrouped = function isOptionsGrouped(arr) {
|
|
|
20
20
|
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
21
21
|
return obj.hasOwnProperty('options');
|
|
22
22
|
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Helper function which calculates how many options are in total in all groups.
|
|
26
|
+
export var countAllOptions = function countAllOptions(groupsArray) {
|
|
27
|
+
var totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce(function (acc, currentGroup) {
|
|
28
|
+
var _group$options;
|
|
29
|
+
var group = currentGroup;
|
|
30
|
+
acc += group === null || group === void 0 || (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
31
|
+
return acc;
|
|
32
|
+
}, 0);
|
|
33
|
+
return totalLength;
|
|
23
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type KeyboardEventHandler, PureComponent, type ReactNode } from 'react';
|
|
2
|
-
import { type PopperProps } from 'react-popper';
|
|
3
|
-
import { type OptionType, type ActionMeta, type ReactSelectProps, type StylesConfig, type ValueType, type ValidationState, type AtlaskitSelectRefType } from '../types';
|
|
4
2
|
import { type UnbindFn } from 'bind-event-listener';
|
|
3
|
+
import { type PopperProps } from 'react-popper';
|
|
4
|
+
import { type ActionMeta, type AtlaskitSelectRefType, type OptionType, type ReactSelectProps, type StylesConfig, type ValidationState, type ValueType } from '../types';
|
|
5
5
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
6
6
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
7
7
|
interface PopupSelectTriggerProps {
|
|
@@ -22,12 +22,11 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
22
22
|
*/
|
|
23
23
|
footer?: ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
25
|
+
* The props passed down to React Popper.
|
|
26
|
+
*
|
|
27
|
+
* Use these to override the default positioning strategy, behaviour and placement used by this library.
|
|
28
|
+
* For more information, see the Popper Props section below, or [React Popper documentation](https://popper.js.org/react-popper/v2/render-props).
|
|
29
|
+
*/
|
|
31
30
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
32
31
|
/**
|
|
33
32
|
* The maximum number of options the select can contain without rendering the search field. The default is `5`.
|
|
@@ -49,32 +48,42 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
49
48
|
*/
|
|
50
49
|
minMenuWidth?: number | string;
|
|
51
50
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
* Render props used to anchor the popup to your content.
|
|
52
|
+
*
|
|
53
|
+
* Make this an interactive element, such as an @atlaskit/button component.
|
|
54
|
+
*
|
|
55
|
+
* The provided render props in `options` are detailed below:
|
|
56
|
+
* - `isOpen`: The current state of the popup.
|
|
57
|
+
* Use this to change the appearance of your target based on the state of your component
|
|
58
|
+
* - `ref`: Pass this ref to the element the Popup should be attached to
|
|
59
|
+
* - `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
60
|
+
* - `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
61
|
+
* ensure your experience is accessible
|
|
62
|
+
*/
|
|
64
63
|
target?: (options: PopupSelectTriggerProps & {
|
|
65
64
|
isOpen: boolean;
|
|
66
65
|
}) => ReactNode;
|
|
67
66
|
isOpen?: boolean;
|
|
68
67
|
defaultIsOpen?: boolean;
|
|
69
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Use this to set whether the component uses compact or standard spacing.
|
|
70
|
+
*/
|
|
70
71
|
spacing?: 'default' | 'compact';
|
|
71
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use isInvalid instead. The state of validation if used in a form
|
|
74
|
+
*/
|
|
72
75
|
validationState?: ValidationState;
|
|
73
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* This prop indicates if the component is in an error state.
|
|
78
|
+
*/
|
|
74
79
|
isInvalid?: boolean;
|
|
75
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* This gives an accessible name to the input for people who use assistive technology.
|
|
82
|
+
*/
|
|
76
83
|
label?: string;
|
|
77
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The `testId` prop appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests. It will be set on the menu element when defined: `{testId}--menu`
|
|
86
|
+
*/
|
|
78
87
|
testId?: string;
|
|
79
88
|
}
|
|
80
89
|
interface State<Modifiers = string> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
3
4
|
*/
|
|
4
|
-
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type ClearIndicatorProps, type DropdownIndicatorProps, type LoadingIndicatorProps } from '../types';
|
|
7
7
|
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type OptionProps, type OptionType } from '../types';
|
|
8
8
|
export declare const CheckboxOption: <OptionT extends OptionType>(props: OptionProps<OptionT, true>) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type Ref } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AsyncSelectProps, type AtlaskitSelectRefType, type CreatableSelectProps, type OptionType, type SelectProps } from './types';
|
|
3
3
|
type AtlaskitSelectProps<Option extends unknown, IsMulti extends boolean> = SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>;
|
|
4
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): <Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & {
|
|
5
5
|
ref?: Ref<AtlaskitSelectRefType>;
|
|
@@ -2,3 +2,4 @@ import { type AriaOnFocusProps, type GroupBase, type OptionsOrGroups } from 'rea
|
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
3
|
export declare function onFocus(props: AriaOnFocusProps<OptionType, GroupBase<OptionType>>): string;
|
|
4
4
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
5
|
+
export declare const countAllOptions: (groupsArray: readonly GroupType<OptionType>[]) => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type KeyboardEventHandler, PureComponent, type ReactNode } from 'react';
|
|
2
|
-
import { type PopperProps } from 'react-popper';
|
|
3
|
-
import { type OptionType, type ActionMeta, type ReactSelectProps, type StylesConfig, type ValueType, type ValidationState, type AtlaskitSelectRefType } from '../types';
|
|
4
2
|
import { type UnbindFn } from 'bind-event-listener';
|
|
3
|
+
import { type PopperProps } from 'react-popper';
|
|
4
|
+
import { type ActionMeta, type AtlaskitSelectRefType, type OptionType, type ReactSelectProps, type StylesConfig, type ValidationState, type ValueType } from '../types';
|
|
5
5
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
6
6
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
7
7
|
interface PopupSelectTriggerProps {
|
|
@@ -22,12 +22,11 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
22
22
|
*/
|
|
23
23
|
footer?: ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
25
|
+
* The props passed down to React Popper.
|
|
26
|
+
*
|
|
27
|
+
* Use these to override the default positioning strategy, behaviour and placement used by this library.
|
|
28
|
+
* For more information, see the Popper Props section below, or [React Popper documentation](https://popper.js.org/react-popper/v2/render-props).
|
|
29
|
+
*/
|
|
31
30
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
32
31
|
/**
|
|
33
32
|
* The maximum number of options the select can contain without rendering the search field. The default is `5`.
|
|
@@ -49,32 +48,42 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
49
48
|
*/
|
|
50
49
|
minMenuWidth?: number | string;
|
|
51
50
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
* Render props used to anchor the popup to your content.
|
|
52
|
+
*
|
|
53
|
+
* Make this an interactive element, such as an @atlaskit/button component.
|
|
54
|
+
*
|
|
55
|
+
* The provided render props in `options` are detailed below:
|
|
56
|
+
* - `isOpen`: The current state of the popup.
|
|
57
|
+
* Use this to change the appearance of your target based on the state of your component
|
|
58
|
+
* - `ref`: Pass this ref to the element the Popup should be attached to
|
|
59
|
+
* - `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
60
|
+
* - `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
61
|
+
* ensure your experience is accessible
|
|
62
|
+
*/
|
|
64
63
|
target?: (options: PopupSelectTriggerProps & {
|
|
65
64
|
isOpen: boolean;
|
|
66
65
|
}) => ReactNode;
|
|
67
66
|
isOpen?: boolean;
|
|
68
67
|
defaultIsOpen?: boolean;
|
|
69
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Use this to set whether the component uses compact or standard spacing.
|
|
70
|
+
*/
|
|
70
71
|
spacing?: 'default' | 'compact';
|
|
71
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use isInvalid instead. The state of validation if used in a form
|
|
74
|
+
*/
|
|
72
75
|
validationState?: ValidationState;
|
|
73
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* This prop indicates if the component is in an error state.
|
|
78
|
+
*/
|
|
74
79
|
isInvalid?: boolean;
|
|
75
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* This gives an accessible name to the input for people who use assistive technology.
|
|
82
|
+
*/
|
|
76
83
|
label?: string;
|
|
77
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The `testId` prop appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests. It will be set on the menu element when defined: `{testId}--menu`
|
|
86
|
+
*/
|
|
78
87
|
testId?: string;
|
|
79
88
|
}
|
|
80
89
|
interface State<Modifiers = string> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
3
4
|
*/
|
|
4
|
-
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type ClearIndicatorProps, type DropdownIndicatorProps, type LoadingIndicatorProps } from '../types';
|
|
7
7
|
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { type OptionProps, type OptionType } from '../types';
|
|
8
8
|
export declare const CheckboxOption: <OptionT extends OptionType>(props: OptionProps<OptionT, true>) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type Ref } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AsyncSelectProps, type AtlaskitSelectRefType, type CreatableSelectProps, type OptionType, type SelectProps } from './types';
|
|
3
3
|
type AtlaskitSelectProps<Option extends unknown, IsMulti extends boolean> = SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>;
|
|
4
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): <Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & {
|
|
5
5
|
ref?: Ref<AtlaskitSelectRefType>;
|
|
@@ -2,3 +2,4 @@ import { type AriaOnFocusProps, type GroupBase, type OptionsOrGroups } from 'rea
|
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
3
|
export declare function onFocus(props: AriaOnFocusProps<OptionType, GroupBase<OptionType>>): string;
|
|
4
4
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
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.9",
|
|
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.7.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
48
|
-
"@atlaskit/primitives": "^11.
|
|
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.56.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^1.4.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
@@ -104,9 +104,6 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"platform-feature-flags": {
|
|
107
|
-
"platform.design-system-team.popup-select-close_8h15h": {
|
|
108
|
-
"type": "boolean"
|
|
109
|
-
},
|
|
110
107
|
"platform.design-system-team.use-default-select-in-popup-select_46rmj": {
|
|
111
108
|
"type": "boolean"
|
|
112
109
|
},
|