@atlaskit/select 17.15.0 → 17.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +21 -12
- package/dist/cjs/PopupSelect/components.js +14 -9
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/index.js +8 -2
- package/dist/cjs/createSelect.js +3 -1
- package/dist/cjs/styles.js +34 -1
- package/dist/cjs/utils/grouped-options-announcement.js +4 -5
- package/dist/es2019/PopupSelect/PopupSelect.js +22 -13
- package/dist/es2019/PopupSelect/components.js +8 -9
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/index.js +9 -3
- package/dist/es2019/createSelect.js +1 -1
- package/dist/es2019/styles.js +40 -4
- package/dist/es2019/utils/grouped-options-announcement.js +5 -6
- package/dist/esm/PopupSelect/PopupSelect.js +22 -13
- package/dist/esm/PopupSelect/components.js +14 -9
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/index.js +9 -3
- package/dist/esm/createSelect.js +4 -2
- package/dist/esm/styles.js +34 -1
- package/dist/esm/utils/grouped-options-announcement.js +4 -5
- package/dist/types/PopupSelect/PopupSelect.d.ts +10 -1
- package/dist/types/PopupSelect/components.d.ts +5 -7
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -1
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +10 -1
- package/dist/types-ts4.5/PopupSelect/components.d.ts +5 -7
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -1
- package/package.json +10 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.15.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#137619](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137619)
|
|
8
|
+
[`a91489985e535`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a91489985e535) -
|
|
9
|
+
[ux] Tab and Shift+Tab now dismisses the list of opened popup select options and allows users to
|
|
10
|
+
navigate to next or previous elements accordingly.
|
|
11
|
+
|
|
12
|
+
## 17.15.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#131911](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131911)
|
|
17
|
+
[`2f9601a8a634b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2f9601a8a634b) -
|
|
18
|
+
This version removes `platform.design-system-team.use-default-select-in-popup-select_46rmj`
|
|
19
|
+
feature flag. The `PopupSelect` component now uses the internal `Select` component ensure the
|
|
20
|
+
accessibility of options with group labels for assistive technologies.
|
|
21
|
+
|
|
3
22
|
## 17.15.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -21,7 +21,7 @@ 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
27
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -86,6 +86,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
86
86
|
}
|
|
87
87
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
88
88
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
|
|
89
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
|
|
89
90
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
|
|
90
91
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
|
|
91
92
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
|
|
@@ -118,6 +119,13 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
|
|
122
|
+
//We shouldn't close PopupSelect on tab event if there are custom interactive element.
|
|
123
|
+
if ((0, _platformFeatureFlags.fg)('tab-event-should-close-popupSelect')) {
|
|
124
|
+
var tabEvent = event.key === 'Tab' && event.shiftKey || event.key === 'Tab';
|
|
125
|
+
if (_this.props.shouldCloseMenuOnTab && tabEvent) {
|
|
126
|
+
_this.close();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
121
129
|
switch (event.key) {
|
|
122
130
|
case 'Escape':
|
|
123
131
|
case 'Esc':
|
|
@@ -196,7 +204,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
196
204
|
});
|
|
197
205
|
if (_this.selectRef) {
|
|
198
206
|
var _this$selectRef$selec;
|
|
199
|
-
(
|
|
207
|
+
(_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 || _this$selectRef$selec.openMenu('first');
|
|
200
208
|
}
|
|
201
209
|
if (typeof window === 'undefined') {
|
|
202
210
|
return;
|
|
@@ -299,7 +307,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
299
307
|
|
|
300
308
|
// subtract the control height to maintain consistency
|
|
301
309
|
var showSearchControl = _this.showSearchControl();
|
|
302
|
-
var controlRef = (
|
|
310
|
+
var controlRef = (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
303
311
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
304
312
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
305
313
|
return maxHeight;
|
|
@@ -349,29 +357,28 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
349
357
|
return placeholder;
|
|
350
358
|
}
|
|
351
359
|
};
|
|
352
|
-
var InternalSelect = (0, _platformFeatureFlags.fg)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? _Select.default : _reactSelect.default;
|
|
353
360
|
var providedAriaLabel = getLabel();
|
|
354
361
|
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
355
|
-
var _this$selectRef
|
|
362
|
+
var _this$selectRef;
|
|
356
363
|
// Update aria-label to get first announcement when popup opened.
|
|
357
|
-
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef
|
|
358
|
-
var _this$
|
|
364
|
+
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef) {
|
|
365
|
+
var _this$selectRef2;
|
|
359
366
|
if (providedAriaLabel) {
|
|
360
367
|
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
361
368
|
}
|
|
362
|
-
(
|
|
369
|
+
(_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);
|
|
363
370
|
}
|
|
364
371
|
};
|
|
365
372
|
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
366
373
|
var _options$findIndex;
|
|
367
374
|
var focused = onFocusProps.focused;
|
|
368
375
|
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
369
|
-
var totalLength =
|
|
376
|
+
var totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
370
377
|
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
371
378
|
return option === focused;
|
|
372
379
|
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
373
380
|
var optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
374
|
-
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");
|
|
381
|
+
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");
|
|
375
382
|
// Option LABEL focused, 1 of 8. 8 results available.
|
|
376
383
|
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
377
384
|
// press Escape to exit the menu.
|
|
@@ -385,7 +392,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
385
392
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
386
393
|
if ((0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options)) {
|
|
387
394
|
var totalLength = (0, _groupedOptionsAnnouncement.countAllOptions)(props.options);
|
|
388
|
-
ariaLiveMessage = (0, _groupedOptionsAnnouncement.onFocus)(onFocusProps);
|
|
395
|
+
ariaLiveMessage = (0, _groupedOptionsAnnouncement.onFocus)(onFocusProps, props.options);
|
|
389
396
|
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
390
397
|
} else {
|
|
391
398
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -394,6 +401,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
394
401
|
updateInputAriaLabel(ariaLabelText);
|
|
395
402
|
return ariaLiveMessage;
|
|
396
403
|
}
|
|
404
|
+
return ariaLiveMessage;
|
|
397
405
|
};
|
|
398
406
|
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, {
|
|
399
407
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
@@ -425,7 +433,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
425
433
|
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
|
|
426
434
|
disabled: !focusLockEnabled,
|
|
427
435
|
returnFocus: true
|
|
428
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
436
|
+
}, /*#__PURE__*/_react.default.createElement(_Select.default, (0, _extends2.default)({
|
|
429
437
|
"aria-label": providedAriaLabel,
|
|
430
438
|
backspaceRemovesValue: false,
|
|
431
439
|
controlShouldRenderValue: false,
|
|
@@ -539,6 +547,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
539
547
|
}(_react.PureComponent);
|
|
540
548
|
(0, _defineProperty2.default)(PopupSelect, "defaultProps", {
|
|
541
549
|
closeMenuOnSelect: true,
|
|
550
|
+
shouldCloseMenuOnTab: true,
|
|
542
551
|
components: {},
|
|
543
552
|
maxMenuHeight: 300,
|
|
544
553
|
maxMenuWidth: 440,
|
|
@@ -92,16 +92,9 @@ var Control = function Control(_ref2) {
|
|
|
92
92
|
})));
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
96
|
-
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
97
95
|
/**
|
|
98
96
|
* __Dummy control__
|
|
99
|
-
*
|
|
100
|
-
* A dummy control {description}.
|
|
101
|
-
*
|
|
102
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
103
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
104
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
97
|
+
* Overrides the default DummyControl component in Select.
|
|
105
98
|
*/
|
|
106
99
|
var DummyControl = exports.DummyControl = function DummyControl(props) {
|
|
107
100
|
return (0, _react2.jsx)(_visuallyHidden.default, null, (0, _react2.jsx)(_reactSelect.components.Control, props));
|
|
@@ -113,8 +106,20 @@ var Menu = function Menu(_ref3) {
|
|
|
113
106
|
innerProps = _ref3.innerProps;
|
|
114
107
|
return (0, _react2.jsx)("div", innerProps, children);
|
|
115
108
|
};
|
|
109
|
+
var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
110
|
+
return (0, _react2.jsx)(_reactSelect.components.IndicatorSeparator, props);
|
|
111
|
+
};
|
|
112
|
+
var ClearIndicator = function ClearIndicator(props) {
|
|
113
|
+
return (0, _react2.jsx)(_reactSelect.components.ClearIndicator, props);
|
|
114
|
+
};
|
|
115
|
+
var MultiValueRemove = function MultiValueRemove(props) {
|
|
116
|
+
return (0, _react2.jsx)(_reactSelect.components.MultiValueRemove, props);
|
|
117
|
+
};
|
|
116
118
|
var defaultComponents = exports.defaultComponents = {
|
|
117
119
|
Control: Control,
|
|
118
120
|
DropdownIndicator: DropdownIndicator,
|
|
119
|
-
Menu: Menu
|
|
121
|
+
Menu: Menu,
|
|
122
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
123
|
+
ClearIndicator: ClearIndicator,
|
|
124
|
+
MultiValueRemove: MultiValueRemove
|
|
120
125
|
};
|
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.15.
|
|
12
|
+
var packageVersion = "17.15.2";
|
|
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)({
|
|
@@ -25,8 +25,10 @@ Object.defineProperty(exports, "LoadingIndicator", {
|
|
|
25
25
|
});
|
|
26
26
|
exports.MultiValueRemove = void 0;
|
|
27
27
|
var _react = require("@emotion/react");
|
|
28
|
-
var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
|
|
29
28
|
var _reactSelect = require("react-select");
|
|
29
|
+
var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
|
|
30
|
+
var _cross = _interopRequireDefault(require("@atlaskit/icon/utility/cross"));
|
|
31
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
30
32
|
var _indicators = require("./indicators");
|
|
31
33
|
/**
|
|
32
34
|
* @jsxRuntime classic
|
|
@@ -45,7 +47,11 @@ var MultiValueRemove = exports.MultiValueRemove = function MultiValueRemove(prop
|
|
|
45
47
|
return (0, _react.jsx)(_reactSelect.components.MultiValueRemove, props, (0, _react.jsx)("div", {
|
|
46
48
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
47
49
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
48
|
-
}, (0,
|
|
50
|
+
}, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ?
|
|
51
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-icon-color
|
|
52
|
+
(0, _react.jsx)(_cross.default, {
|
|
53
|
+
label: "Clear"
|
|
54
|
+
}) : (0, _react.jsx)(_selectClear.default, {
|
|
49
55
|
label: "Clear",
|
|
50
56
|
size: "small",
|
|
51
57
|
primaryColor: "transparent",
|
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
|
package/dist/cjs/styles.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = baseStyles;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
10
11
|
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; }
|
|
11
12
|
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; }
|
|
@@ -224,7 +225,7 @@ function baseStyles(validationState) {
|
|
|
224
225
|
backgroundColor = "var(--ds-background-selected, ".concat(_colors.N40, ")");
|
|
225
226
|
color = "var(--ds-text-selected, hsl(0, 0%, 20%))";
|
|
226
227
|
} else {
|
|
227
|
-
backgroundColor = "var(--ds-background-neutral, ".concat(_colors.N40, ")");
|
|
228
|
+
backgroundColor = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? "var(--ds-background-neutral-subtle-hovered, #091E420F)" : "var(--ds-background-neutral, ".concat(_colors.N40, ")");
|
|
228
229
|
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
229
230
|
}
|
|
230
231
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
@@ -236,6 +237,13 @@ function baseStyles(validationState) {
|
|
|
236
237
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
237
238
|
},
|
|
238
239
|
color: color
|
|
240
|
+
}, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && {
|
|
241
|
+
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
242
|
+
// Hardcode this color for visual refresh as there is no token color yet
|
|
243
|
+
borderColor: '#B7B9BE',
|
|
244
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
245
|
+
borderStyle: 'solid',
|
|
246
|
+
backgroundColor: "var(--ds-background-input, #FFFFFF)"
|
|
239
247
|
});
|
|
240
248
|
},
|
|
241
249
|
multiValueLabel: function multiValueLabel(css, _ref8) {
|
|
@@ -245,6 +253,11 @@ function baseStyles(validationState) {
|
|
|
245
253
|
padding: "var(--ds-space-025, 2px)",
|
|
246
254
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(_colors.N70, ")") : 'inherit',
|
|
247
255
|
paddingRight: "var(--ds-space-025, 2px)"
|
|
256
|
+
}, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && {
|
|
257
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
258
|
+
paddingTop: 0,
|
|
259
|
+
paddingBottom: 0,
|
|
260
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
248
261
|
});
|
|
249
262
|
},
|
|
250
263
|
multiValueRemove: function multiValueRemove(css, _ref9) {
|
|
@@ -264,6 +277,26 @@ function baseStyles(validationState) {
|
|
|
264
277
|
backgroundColor: "var(--ds-background-danger-pressed, ".concat(_colors.R75, ")"),
|
|
265
278
|
fill: "var(--ds-text-danger, #000)"
|
|
266
279
|
}
|
|
280
|
+
}, (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && {
|
|
281
|
+
backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
|
|
282
|
+
border: 'none',
|
|
283
|
+
alignItems: 'center',
|
|
284
|
+
justifyContent: 'center',
|
|
285
|
+
alignSelf: 'center',
|
|
286
|
+
appearance: 'none',
|
|
287
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
288
|
+
color: "var(--ds-text, #172B4D)",
|
|
289
|
+
padding: "var(--ds-space-025, 2px)",
|
|
290
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
291
|
+
':focus-visible': {
|
|
292
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
293
|
+
},
|
|
294
|
+
':hover': {
|
|
295
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
296
|
+
},
|
|
297
|
+
':active': {
|
|
298
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
299
|
+
}
|
|
267
300
|
});
|
|
268
301
|
},
|
|
269
302
|
groupHeading: function groupHeading(css) {
|
|
@@ -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,12 @@ 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
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { N80 } from '@atlaskit/theme/colors';
|
|
14
|
-
import
|
|
14
|
+
import Select from '../Select';
|
|
15
15
|
import baseStyles from '../styles';
|
|
16
16
|
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
17
17
|
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
@@ -53,6 +53,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
53
53
|
var _this$defaultOpenStat;
|
|
54
54
|
super(...args);
|
|
55
55
|
_defineProperty(this, "menuRef", null);
|
|
56
|
+
_defineProperty(this, "selectRef", null);
|
|
56
57
|
_defineProperty(this, "targetRef", null);
|
|
57
58
|
_defineProperty(this, "unbindWindowClick", null);
|
|
58
59
|
_defineProperty(this, "unbindWindowKeydown", null);
|
|
@@ -84,6 +85,13 @@ export default class PopupSelect extends PureComponent {
|
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
87
|
_defineProperty(this, "handleKeyDown", event => {
|
|
88
|
+
//We shouldn't close PopupSelect on tab event if there are custom interactive element.
|
|
89
|
+
if (fg('tab-event-should-close-popupSelect')) {
|
|
90
|
+
const tabEvent = event.key === 'Tab' && event.shiftKey || event.key === 'Tab';
|
|
91
|
+
if (this.props.shouldCloseMenuOnTab && tabEvent) {
|
|
92
|
+
this.close();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
87
95
|
switch (event.key) {
|
|
88
96
|
case 'Escape':
|
|
89
97
|
case 'Esc':
|
|
@@ -167,7 +175,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
167
175
|
});
|
|
168
176
|
if (this.selectRef) {
|
|
169
177
|
var _this$selectRef$selec;
|
|
170
|
-
|
|
178
|
+
(_this$selectRef$selec = this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first');
|
|
171
179
|
}
|
|
172
180
|
if (typeof window === 'undefined') {
|
|
173
181
|
return;
|
|
@@ -269,7 +277,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
269
277
|
|
|
270
278
|
// subtract the control height to maintain consistency
|
|
271
279
|
const showSearchControl = this.showSearchControl();
|
|
272
|
-
|
|
280
|
+
const controlRef = (_this$selectRef$selec2 = this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
273
281
|
const offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
274
282
|
const maxHeight = maxMenuHeight - offsetHeight;
|
|
275
283
|
return maxHeight;
|
|
@@ -323,17 +331,16 @@ export default class PopupSelect extends PureComponent {
|
|
|
323
331
|
return placeholder;
|
|
324
332
|
}
|
|
325
333
|
};
|
|
326
|
-
const InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
327
334
|
const providedAriaLabel = getLabel();
|
|
328
335
|
const updateInputAriaLabel = ariaLabelText => {
|
|
329
|
-
var _this$selectRef, _this$selectRef$selec3
|
|
336
|
+
var _this$selectRef, _this$selectRef$selec3;
|
|
330
337
|
// Update aria-label to get first announcement when popup opened.
|
|
331
|
-
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
|
|
332
|
-
var _this$
|
|
338
|
+
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) {
|
|
339
|
+
var _this$selectRef2, _this$selectRef2$sele;
|
|
333
340
|
if (providedAriaLabel) {
|
|
334
341
|
ariaLabelText = `${providedAriaLabel}. ${ariaLabelText}`;
|
|
335
342
|
}
|
|
336
|
-
|
|
343
|
+
(_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);
|
|
337
344
|
}
|
|
338
345
|
};
|
|
339
346
|
const generateNoGroupsAriaText = (onFocusProps, ariaLabelSuffix) => {
|
|
@@ -342,10 +349,10 @@ export default class PopupSelect extends PureComponent {
|
|
|
342
349
|
focused
|
|
343
350
|
} = onFocusProps;
|
|
344
351
|
const options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
345
|
-
const totalLength =
|
|
352
|
+
const totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
346
353
|
const optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => option === focused)) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
347
354
|
const optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
348
|
-
const ariaLabelText = `Option ${optionName} focused, ${optionIndex} of ${totalLength}.
|
|
355
|
+
const ariaLabelText = `Option ${optionName} focused, ${optionIndex + 1} of ${totalLength}.
|
|
349
356
|
${totalLength} results available.
|
|
350
357
|
${ariaLabelSuffix}
|
|
351
358
|
`;
|
|
@@ -362,7 +369,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
362
369
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
363
370
|
if (isOptionsGrouped(props.options)) {
|
|
364
371
|
const totalLength = countAllOptions(props.options);
|
|
365
|
-
ariaLiveMessage = onFocus(onFocusProps);
|
|
372
|
+
ariaLiveMessage = onFocus(onFocusProps, props.options);
|
|
366
373
|
ariaLabelText = `${ariaLiveMessage} ${totalLength} results available. ${ariaLabelSuffix}`;
|
|
367
374
|
} else {
|
|
368
375
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -371,6 +378,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
371
378
|
updateInputAriaLabel(ariaLabelText);
|
|
372
379
|
return ariaLiveMessage;
|
|
373
380
|
}
|
|
381
|
+
return ariaLiveMessage;
|
|
374
382
|
};
|
|
375
383
|
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
376
384
|
onFirstUpdate: state => {
|
|
@@ -402,7 +410,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
402
410
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
403
411
|
disabled: !focusLockEnabled,
|
|
404
412
|
returnFocus: true
|
|
405
|
-
}, /*#__PURE__*/React.createElement(
|
|
413
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
406
414
|
"aria-label": providedAriaLabel,
|
|
407
415
|
backspaceRemovesValue: false,
|
|
408
416
|
controlShouldRenderValue: false,
|
|
@@ -512,6 +520,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
512
520
|
}
|
|
513
521
|
_defineProperty(PopupSelect, "defaultProps", {
|
|
514
522
|
closeMenuOnSelect: true,
|
|
523
|
+
shouldCloseMenuOnTab: true,
|
|
515
524
|
components: {},
|
|
516
525
|
maxMenuHeight: 300,
|
|
517
526
|
maxMenuWidth: 440,
|
|
@@ -81,16 +81,9 @@ const Control = ({
|
|
|
81
81
|
innerProps: innerProps
|
|
82
82
|
})));
|
|
83
83
|
|
|
84
|
-
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
85
|
-
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
86
84
|
/**
|
|
87
85
|
* __Dummy control__
|
|
88
|
-
*
|
|
89
|
-
* A dummy control {description}.
|
|
90
|
-
*
|
|
91
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
92
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
93
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
86
|
+
* Overrides the default DummyControl component in Select.
|
|
94
87
|
*/
|
|
95
88
|
export const DummyControl = props => jsx(VisuallyHidden, null, jsx(components.Control, props));
|
|
96
89
|
|
|
@@ -99,8 +92,14 @@ const Menu = ({
|
|
|
99
92
|
children,
|
|
100
93
|
innerProps
|
|
101
94
|
}) => jsx("div", innerProps, children);
|
|
95
|
+
const IndicatorSeparator = props => jsx(components.IndicatorSeparator, props);
|
|
96
|
+
const ClearIndicator = props => jsx(components.ClearIndicator, props);
|
|
97
|
+
const MultiValueRemove = props => jsx(components.MultiValueRemove, props);
|
|
102
98
|
export const defaultComponents = {
|
|
103
99
|
Control,
|
|
104
100
|
DropdownIndicator,
|
|
105
|
-
Menu
|
|
101
|
+
Menu,
|
|
102
|
+
IndicatorSeparator,
|
|
103
|
+
ClearIndicator,
|
|
104
|
+
MultiValueRemove
|
|
106
105
|
};
|
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.15.
|
|
5
|
+
const packageVersion = "17.15.2";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import {
|
|
7
|
-
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
8
7
|
import { components } from 'react-select';
|
|
8
|
+
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
9
|
+
import CrossIcon from '@atlaskit/icon/utility/cross';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
11
|
export { ClearIndicator, DropdownIndicator, LoadingIndicator } from './indicators';
|
|
10
12
|
const disabledStyles = css({
|
|
11
13
|
display: 'none'
|
|
@@ -20,7 +22,11 @@ export const MultiValueRemove = props => {
|
|
|
20
22
|
return jsx(components.MultiValueRemove, props, jsx("div", {
|
|
21
23
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
22
24
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
23
|
-
},
|
|
25
|
+
}, fg('platform-component-visual-refresh') ?
|
|
26
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-icon-color
|
|
27
|
+
jsx(CrossIcon, {
|
|
28
|
+
label: "Clear"
|
|
29
|
+
}) : jsx(SelectClearIcon, {
|
|
24
30
|
label: "Clear",
|
|
25
31
|
size: "small",
|
|
26
32
|
primaryColor: "transparent",
|
|
@@ -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
|
package/dist/es2019/styles.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { B100, B400, B50, G400, N0, N100, N20, N200, N30, N300, N40, N500, N70, N800, R400, R75 } from '@atlaskit/theme/colors';
|
|
2
3
|
export default function baseStyles(validationState, isCompact = false, appearance) {
|
|
3
4
|
return {
|
|
@@ -213,7 +214,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
213
214
|
backgroundColor = `var(--ds-background-selected, ${N40})`;
|
|
214
215
|
color = "var(--ds-text-selected, hsl(0, 0%, 20%))";
|
|
215
216
|
} else {
|
|
216
|
-
backgroundColor = `var(--ds-background-neutral, ${N40})`;
|
|
217
|
+
backgroundColor = fg('platform-component-visual-refresh') ? "var(--ds-background-neutral-subtle-hovered, #091E420F)" : `var(--ds-background-neutral, ${N40})`;
|
|
217
218
|
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
218
219
|
}
|
|
219
220
|
return {
|
|
@@ -225,7 +226,15 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
225
226
|
'@media screen and (-ms-high-contrast: active)': {
|
|
226
227
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
227
228
|
},
|
|
228
|
-
color
|
|
229
|
+
color,
|
|
230
|
+
...(fg('platform-component-visual-refresh') && {
|
|
231
|
+
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
232
|
+
// Hardcode this color for visual refresh as there is no token color yet
|
|
233
|
+
borderColor: '#B7B9BE',
|
|
234
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
235
|
+
borderStyle: 'solid',
|
|
236
|
+
backgroundColor: "var(--ds-background-input, #FFFFFF)"
|
|
237
|
+
})
|
|
229
238
|
};
|
|
230
239
|
},
|
|
231
240
|
multiValueLabel: (css, {
|
|
@@ -235,7 +244,13 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
235
244
|
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
236
245
|
padding: "var(--ds-space-025, 2px)",
|
|
237
246
|
color: isDisabled ? `var(--ds-text-disabled, ${N70})` : 'inherit',
|
|
238
|
-
paddingRight: "var(--ds-space-025, 2px)"
|
|
247
|
+
paddingRight: "var(--ds-space-025, 2px)",
|
|
248
|
+
...(fg('platform-component-visual-refresh') && {
|
|
249
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
250
|
+
paddingTop: 0,
|
|
251
|
+
paddingBottom: 0,
|
|
252
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
253
|
+
})
|
|
239
254
|
}),
|
|
240
255
|
multiValueRemove: (css, {
|
|
241
256
|
isFocused
|
|
@@ -254,7 +269,28 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
254
269
|
':active': {
|
|
255
270
|
backgroundColor: `var(--ds-background-danger-pressed, ${R75})`,
|
|
256
271
|
fill: "var(--ds-text-danger, #000)"
|
|
257
|
-
}
|
|
272
|
+
},
|
|
273
|
+
...(fg('platform-component-visual-refresh') && {
|
|
274
|
+
backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
|
|
275
|
+
border: 'none',
|
|
276
|
+
alignItems: 'center',
|
|
277
|
+
justifyContent: 'center',
|
|
278
|
+
alignSelf: 'center',
|
|
279
|
+
appearance: 'none',
|
|
280
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
281
|
+
color: "var(--ds-text, #172B4D)",
|
|
282
|
+
padding: "var(--ds-space-025, 2px)",
|
|
283
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
284
|
+
':focus-visible': {
|
|
285
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
286
|
+
},
|
|
287
|
+
':hover': {
|
|
288
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
289
|
+
},
|
|
290
|
+
':active': {
|
|
291
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
292
|
+
}
|
|
293
|
+
})
|
|
258
294
|
}),
|
|
259
295
|
groupHeading: css => ({
|
|
260
296
|
...css,
|
|
@@ -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,12 @@ 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
24
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
import { N80 } from '@atlaskit/theme/colors';
|
|
26
|
-
import
|
|
26
|
+
import Select from '../Select';
|
|
27
27
|
import baseStyles from '../styles';
|
|
28
28
|
import { countAllOptions, isOptionsGrouped, onFocus } from '../utils/grouped-options-announcement';
|
|
29
29
|
import { defaultComponents, DummyControl, MenuDialog } from './components';
|
|
@@ -76,6 +76,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
76
|
}
|
|
77
77
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
78
78
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
79
80
|
_defineProperty(_assertThisInitialized(_this), "targetRef", null);
|
|
80
81
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowClick", null);
|
|
81
82
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
@@ -108,6 +109,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
112
|
+
//We shouldn't close PopupSelect on tab event if there are custom interactive element.
|
|
113
|
+
if (fg('tab-event-should-close-popupSelect')) {
|
|
114
|
+
var tabEvent = event.key === 'Tab' && event.shiftKey || event.key === 'Tab';
|
|
115
|
+
if (_this.props.shouldCloseMenuOnTab && tabEvent) {
|
|
116
|
+
_this.close();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
111
119
|
switch (event.key) {
|
|
112
120
|
case 'Escape':
|
|
113
121
|
case 'Esc':
|
|
@@ -186,7 +194,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
186
194
|
});
|
|
187
195
|
if (_this.selectRef) {
|
|
188
196
|
var _this$selectRef$selec;
|
|
189
|
-
|
|
197
|
+
(_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 || _this$selectRef$selec.openMenu('first');
|
|
190
198
|
}
|
|
191
199
|
if (typeof window === 'undefined') {
|
|
192
200
|
return;
|
|
@@ -289,7 +297,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
289
297
|
|
|
290
298
|
// subtract the control height to maintain consistency
|
|
291
299
|
var showSearchControl = _this.showSearchControl();
|
|
292
|
-
var controlRef =
|
|
300
|
+
var controlRef = (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef;
|
|
293
301
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
294
302
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
295
303
|
return maxHeight;
|
|
@@ -339,29 +347,28 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
339
347
|
return placeholder;
|
|
340
348
|
}
|
|
341
349
|
};
|
|
342
|
-
var InternalSelect = fg('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
343
350
|
var providedAriaLabel = getLabel();
|
|
344
351
|
var updateInputAriaLabel = function updateInputAriaLabel(ariaLabelText) {
|
|
345
|
-
var _this$selectRef
|
|
352
|
+
var _this$selectRef;
|
|
346
353
|
// Update aria-label to get first announcement when popup opened.
|
|
347
|
-
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef
|
|
348
|
-
var _this$
|
|
354
|
+
if ((_this$selectRef = _this.selectRef) !== null && _this$selectRef !== void 0 && (_this$selectRef = _this$selectRef.select) !== null && _this$selectRef !== void 0 && _this$selectRef.inputRef) {
|
|
355
|
+
var _this$selectRef2;
|
|
349
356
|
if (providedAriaLabel) {
|
|
350
357
|
ariaLabelText = "".concat(providedAriaLabel, ". ").concat(ariaLabelText);
|
|
351
358
|
}
|
|
352
|
-
|
|
359
|
+
(_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);
|
|
353
360
|
}
|
|
354
361
|
};
|
|
355
362
|
var generateNoGroupsAriaText = function generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix) {
|
|
356
363
|
var _options$findIndex;
|
|
357
364
|
var focused = onFocusProps.focused;
|
|
358
365
|
var options = (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
359
|
-
var totalLength =
|
|
366
|
+
var totalLength = options === null || options === void 0 ? void 0 : options.length;
|
|
360
367
|
var optionIndex = (_options$findIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
361
368
|
return option === focused;
|
|
362
369
|
})) !== null && _options$findIndex !== void 0 ? _options$findIndex : 0;
|
|
363
370
|
var optionName = typeof (props === null || props === void 0 ? void 0 : props.getOptionLabel) === 'function' ? props.getOptionLabel(focused) : focused.label;
|
|
364
|
-
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");
|
|
371
|
+
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");
|
|
365
372
|
// Option LABEL focused, 1 of 8. 8 results available.
|
|
366
373
|
// Use Up and Down to choose options, press Enter to select the currently focused option,
|
|
367
374
|
// press Escape to exit the menu.
|
|
@@ -375,7 +382,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
375
382
|
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
376
383
|
if (isOptionsGrouped(props.options)) {
|
|
377
384
|
var totalLength = countAllOptions(props.options);
|
|
378
|
-
ariaLiveMessage = onFocus(onFocusProps);
|
|
385
|
+
ariaLiveMessage = onFocus(onFocusProps, props.options);
|
|
379
386
|
ariaLabelText = "".concat(ariaLiveMessage, " ").concat(totalLength, " results available. ").concat(ariaLabelSuffix);
|
|
380
387
|
} else {
|
|
381
388
|
ariaLabelText = generateNoGroupsAriaText(onFocusProps, ariaLabelSuffix);
|
|
@@ -384,6 +391,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
384
391
|
updateInputAriaLabel(ariaLabelText);
|
|
385
392
|
return ariaLiveMessage;
|
|
386
393
|
}
|
|
394
|
+
return ariaLiveMessage;
|
|
387
395
|
};
|
|
388
396
|
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
389
397
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
@@ -415,7 +423,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
415
423
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
416
424
|
disabled: !focusLockEnabled,
|
|
417
425
|
returnFocus: true
|
|
418
|
-
}, /*#__PURE__*/React.createElement(
|
|
426
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
419
427
|
"aria-label": providedAriaLabel,
|
|
420
428
|
backspaceRemovesValue: false,
|
|
421
429
|
controlShouldRenderValue: false,
|
|
@@ -529,6 +537,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
529
537
|
}(PureComponent);
|
|
530
538
|
_defineProperty(PopupSelect, "defaultProps", {
|
|
531
539
|
closeMenuOnSelect: true,
|
|
540
|
+
shouldCloseMenuOnTab: true,
|
|
532
541
|
components: {},
|
|
533
542
|
maxMenuHeight: 300,
|
|
534
543
|
maxMenuWidth: 440,
|
|
@@ -87,16 +87,9 @@ var Control = function Control(_ref2) {
|
|
|
87
87
|
})));
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
91
|
-
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
92
90
|
/**
|
|
93
91
|
* __Dummy control__
|
|
94
|
-
*
|
|
95
|
-
* A dummy control {description}.
|
|
96
|
-
*
|
|
97
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
98
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
99
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
92
|
+
* Overrides the default DummyControl component in Select.
|
|
100
93
|
*/
|
|
101
94
|
export var DummyControl = function DummyControl(props) {
|
|
102
95
|
return jsx(VisuallyHidden, null, jsx(components.Control, props));
|
|
@@ -108,8 +101,20 @@ var Menu = function Menu(_ref3) {
|
|
|
108
101
|
innerProps = _ref3.innerProps;
|
|
109
102
|
return jsx("div", innerProps, children);
|
|
110
103
|
};
|
|
104
|
+
var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
105
|
+
return jsx(components.IndicatorSeparator, props);
|
|
106
|
+
};
|
|
107
|
+
var ClearIndicator = function ClearIndicator(props) {
|
|
108
|
+
return jsx(components.ClearIndicator, props);
|
|
109
|
+
};
|
|
110
|
+
var MultiValueRemove = function MultiValueRemove(props) {
|
|
111
|
+
return jsx(components.MultiValueRemove, props);
|
|
112
|
+
};
|
|
111
113
|
export var defaultComponents = {
|
|
112
114
|
Control: Control,
|
|
113
115
|
DropdownIndicator: DropdownIndicator,
|
|
114
|
-
Menu: Menu
|
|
116
|
+
Menu: Menu,
|
|
117
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
118
|
+
ClearIndicator: ClearIndicator,
|
|
119
|
+
MultiValueRemove: MultiValueRemove
|
|
115
120
|
};
|
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.15.
|
|
5
|
+
var packageVersion = "17.15.2";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import {
|
|
7
|
-
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
8
7
|
import { components } from 'react-select';
|
|
8
|
+
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
9
|
+
import CrossIcon from '@atlaskit/icon/utility/cross';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
11
|
export { ClearIndicator, DropdownIndicator, LoadingIndicator } from './indicators';
|
|
10
12
|
var disabledStyles = css({
|
|
11
13
|
display: 'none'
|
|
@@ -18,7 +20,11 @@ export var MultiValueRemove = function MultiValueRemove(props) {
|
|
|
18
20
|
return jsx(components.MultiValueRemove, props, jsx("div", {
|
|
19
21
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
20
22
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
21
|
-
},
|
|
23
|
+
}, fg('platform-component-visual-refresh') ?
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-icon-color
|
|
25
|
+
jsx(CrossIcon, {
|
|
26
|
+
label: "Clear"
|
|
27
|
+
}) : jsx(SelectClearIcon, {
|
|
22
28
|
label: "Clear",
|
|
23
29
|
size: "small",
|
|
24
30
|
primaryColor: "transparent",
|
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
|
package/dist/esm/styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { B100, B400, B50, G400, N0, N100, N20, N200, N30, N300, N40, N500, N70, N800, R400, R75 } from '@atlaskit/theme/colors';
|
|
5
6
|
export default function baseStyles(validationState) {
|
|
6
7
|
var isCompact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -217,7 +218,7 @@ export default function baseStyles(validationState) {
|
|
|
217
218
|
backgroundColor = "var(--ds-background-selected, ".concat(N40, ")");
|
|
218
219
|
color = "var(--ds-text-selected, hsl(0, 0%, 20%))";
|
|
219
220
|
} else {
|
|
220
|
-
backgroundColor = "var(--ds-background-neutral, ".concat(N40, ")");
|
|
221
|
+
backgroundColor = fg('platform-component-visual-refresh') ? "var(--ds-background-neutral-subtle-hovered, #091E420F)" : "var(--ds-background-neutral, ".concat(N40, ")");
|
|
221
222
|
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
222
223
|
}
|
|
223
224
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
@@ -229,6 +230,13 @@ export default function baseStyles(validationState) {
|
|
|
229
230
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
230
231
|
},
|
|
231
232
|
color: color
|
|
233
|
+
}, fg('platform-component-visual-refresh') && {
|
|
234
|
+
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
235
|
+
// Hardcode this color for visual refresh as there is no token color yet
|
|
236
|
+
borderColor: '#B7B9BE',
|
|
237
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
238
|
+
borderStyle: 'solid',
|
|
239
|
+
backgroundColor: "var(--ds-background-input, #FFFFFF)"
|
|
232
240
|
});
|
|
233
241
|
},
|
|
234
242
|
multiValueLabel: function multiValueLabel(css, _ref8) {
|
|
@@ -238,6 +246,11 @@ export default function baseStyles(validationState) {
|
|
|
238
246
|
padding: "var(--ds-space-025, 2px)",
|
|
239
247
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(N70, ")") : 'inherit',
|
|
240
248
|
paddingRight: "var(--ds-space-025, 2px)"
|
|
249
|
+
}, fg('platform-component-visual-refresh') && {
|
|
250
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
251
|
+
paddingTop: 0,
|
|
252
|
+
paddingBottom: 0,
|
|
253
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
241
254
|
});
|
|
242
255
|
},
|
|
243
256
|
multiValueRemove: function multiValueRemove(css, _ref9) {
|
|
@@ -257,6 +270,26 @@ export default function baseStyles(validationState) {
|
|
|
257
270
|
backgroundColor: "var(--ds-background-danger-pressed, ".concat(R75, ")"),
|
|
258
271
|
fill: "var(--ds-text-danger, #000)"
|
|
259
272
|
}
|
|
273
|
+
}, fg('platform-component-visual-refresh') && {
|
|
274
|
+
backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
|
|
275
|
+
border: 'none',
|
|
276
|
+
alignItems: 'center',
|
|
277
|
+
justifyContent: 'center',
|
|
278
|
+
alignSelf: 'center',
|
|
279
|
+
appearance: 'none',
|
|
280
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
281
|
+
color: "var(--ds-text, #172B4D)",
|
|
282
|
+
padding: "var(--ds-space-025, 2px)",
|
|
283
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
284
|
+
':focus-visible': {
|
|
285
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
286
|
+
},
|
|
287
|
+
':hover': {
|
|
288
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
289
|
+
},
|
|
290
|
+
':active': {
|
|
291
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
292
|
+
}
|
|
260
293
|
});
|
|
261
294
|
},
|
|
262
295
|
groupHeading: function groupHeading(css) {
|
|
@@ -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'>;
|
|
@@ -17,6 +18,10 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
17
18
|
* Defines whether the menu should close when selected. The default is `true`.
|
|
18
19
|
*/
|
|
19
20
|
closeMenuOnSelect?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Defines whether the menu should be closed by pressing the Tab key. The default is `true`.
|
|
23
|
+
*/
|
|
24
|
+
shouldCloseMenuOnTab?: boolean;
|
|
20
25
|
/**
|
|
21
26
|
* The footer content shown at the bottom of the popup, underneath the select options.
|
|
22
27
|
*/
|
|
@@ -94,7 +99,7 @@ interface State<Modifiers = string> {
|
|
|
94
99
|
}
|
|
95
100
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
96
101
|
menuRef: HTMLElement | null;
|
|
97
|
-
selectRef:
|
|
102
|
+
selectRef: AtlaskitSelectRefType | null;
|
|
98
103
|
targetRef: HTMLElement | null;
|
|
99
104
|
unbindWindowClick: UnbindFn | null;
|
|
100
105
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -108,12 +113,16 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
108
113
|
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
109
114
|
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
110
115
|
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
116
|
+
IndicatorSeparator: (props: import("react-select").IndicatorSeparatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
117
|
+
ClearIndicator: (props: import("react-select").ClearIndicatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
118
|
+
MultiValueRemove: (props: import("react-select").MultiValueRemoveProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
111
119
|
};
|
|
112
120
|
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
113
121
|
};
|
|
114
122
|
popperWrapperId: string;
|
|
115
123
|
static defaultProps: {
|
|
116
124
|
closeMenuOnSelect: boolean;
|
|
125
|
+
shouldCloseMenuOnTab: boolean;
|
|
117
126
|
components: {};
|
|
118
127
|
maxMenuHeight: number;
|
|
119
128
|
maxMenuWidth: number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
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;
|
|
@@ -21,17 +21,15 @@ interface MenuDialogProps {
|
|
|
21
21
|
export declare const MenuDialog: import("react").ForwardRefExoticComponent<MenuDialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
22
|
/**
|
|
23
23
|
* __Dummy control__
|
|
24
|
-
*
|
|
25
|
-
* A dummy control {description}.
|
|
26
|
-
*
|
|
27
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
28
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
29
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
24
|
+
* Overrides the default DummyControl component in Select.
|
|
30
25
|
*/
|
|
31
26
|
export declare const DummyControl: FC<ControlProps<OptionType, boolean>>;
|
|
32
27
|
export declare const defaultComponents: {
|
|
33
28
|
Control: FC<ControlProps<OptionType, boolean>>;
|
|
34
29
|
DropdownIndicator: () => jsx.JSX.Element;
|
|
35
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;
|
|
36
34
|
};
|
|
37
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'>;
|
|
@@ -17,6 +18,10 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
17
18
|
* Defines whether the menu should close when selected. The default is `true`.
|
|
18
19
|
*/
|
|
19
20
|
closeMenuOnSelect?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Defines whether the menu should be closed by pressing the Tab key. The default is `true`.
|
|
23
|
+
*/
|
|
24
|
+
shouldCloseMenuOnTab?: boolean;
|
|
20
25
|
/**
|
|
21
26
|
* The footer content shown at the bottom of the popup, underneath the select options.
|
|
22
27
|
*/
|
|
@@ -94,7 +99,7 @@ interface State<Modifiers = string> {
|
|
|
94
99
|
}
|
|
95
100
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
96
101
|
menuRef: HTMLElement | null;
|
|
97
|
-
selectRef:
|
|
102
|
+
selectRef: AtlaskitSelectRefType | null;
|
|
98
103
|
targetRef: HTMLElement | null;
|
|
99
104
|
unbindWindowClick: UnbindFn | null;
|
|
100
105
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -108,12 +113,16 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
108
113
|
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
109
114
|
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
110
115
|
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
116
|
+
IndicatorSeparator: (props: import("react-select").IndicatorSeparatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
117
|
+
ClearIndicator: (props: import("react-select").ClearIndicatorProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
118
|
+
MultiValueRemove: (props: import("react-select").MultiValueRemoveProps<unknown, boolean, GroupBase<unknown>>) => import("@emotion/react").jsx.JSX.Element;
|
|
111
119
|
};
|
|
112
120
|
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
113
121
|
};
|
|
114
122
|
popperWrapperId: string;
|
|
115
123
|
static defaultProps: {
|
|
116
124
|
closeMenuOnSelect: boolean;
|
|
125
|
+
shouldCloseMenuOnTab: boolean;
|
|
117
126
|
components: {};
|
|
118
127
|
maxMenuHeight: number;
|
|
119
128
|
maxMenuWidth: number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
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;
|
|
@@ -21,17 +21,15 @@ interface MenuDialogProps {
|
|
|
21
21
|
export declare const MenuDialog: import("react").ForwardRefExoticComponent<MenuDialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
22
|
/**
|
|
23
23
|
* __Dummy control__
|
|
24
|
-
*
|
|
25
|
-
* A dummy control {description}.
|
|
26
|
-
*
|
|
27
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
28
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
29
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
24
|
+
* Overrides the default DummyControl component in Select.
|
|
30
25
|
*/
|
|
31
26
|
export declare const DummyControl: FC<ControlProps<OptionType, boolean>>;
|
|
32
27
|
export declare const defaultComponents: {
|
|
33
28
|
Control: FC<ControlProps<OptionType, boolean>>;
|
|
34
29
|
DropdownIndicator: () => jsx.JSX.Element;
|
|
35
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;
|
|
36
34
|
};
|
|
37
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.15.
|
|
3
|
+
"version": "17.15.2",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.tsx",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Design System Team",
|
|
27
|
-
"releaseModel": "continuous",
|
|
28
|
-
"productPushConsumption": [
|
|
29
|
-
"jira"
|
|
30
|
-
],
|
|
31
27
|
"website": {
|
|
32
28
|
"name": "Select",
|
|
33
29
|
"category": "Components"
|
|
@@ -43,12 +39,12 @@
|
|
|
43
39
|
},
|
|
44
40
|
"dependencies": {
|
|
45
41
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
42
|
+
"@atlaskit/icon": "^22.15.0",
|
|
47
43
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
48
|
-
"@atlaskit/primitives": "^12.
|
|
44
|
+
"@atlaskit/primitives": "^12.1.0",
|
|
49
45
|
"@atlaskit/spinner": "^16.3.0",
|
|
50
46
|
"@atlaskit/theme": "^13.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
52
48
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
53
49
|
"@babel/runtime": "^7.0.0",
|
|
54
50
|
"@emotion/react": "^11.7.1",
|
|
@@ -70,7 +66,7 @@
|
|
|
70
66
|
"@af/integration-testing": "*",
|
|
71
67
|
"@af/visual-regression": "*",
|
|
72
68
|
"@atlaskit/checkbox": "^13.7.0",
|
|
73
|
-
"@atlaskit/ds-lib": "^2.
|
|
69
|
+
"@atlaskit/ds-lib": "^2.5.0",
|
|
74
70
|
"@atlaskit/modal-dialog": "^12.15.0",
|
|
75
71
|
"@atlaskit/radio": "^6.5.0",
|
|
76
72
|
"@atlaskit/ssr": "*",
|
|
@@ -84,7 +80,6 @@
|
|
|
84
80
|
"jscodeshift": "^0.13.0",
|
|
85
81
|
"react-dom": "^16.8.0",
|
|
86
82
|
"react-select-event": "^5.5.0",
|
|
87
|
-
"react-test-renderer": "^16.8.0",
|
|
88
83
|
"react-value": "^0.2.0",
|
|
89
84
|
"typescript": "~5.4.2",
|
|
90
85
|
"wait-for-expect": "^1.2.0"
|
|
@@ -104,10 +99,13 @@
|
|
|
104
99
|
}
|
|
105
100
|
},
|
|
106
101
|
"platform-feature-flags": {
|
|
107
|
-
"platform
|
|
102
|
+
"platform-design-system-dsp-19701-no-node-resolver": {
|
|
108
103
|
"type": "boolean"
|
|
109
104
|
},
|
|
110
|
-
"platform-
|
|
105
|
+
"platform-component-visual-refresh": {
|
|
106
|
+
"type": "boolean"
|
|
107
|
+
},
|
|
108
|
+
"tab-event-should-close-popupSelect": {
|
|
111
109
|
"type": "boolean"
|
|
112
110
|
}
|
|
113
111
|
},
|