@atlaskit/select 16.5.14 → 16.6.0
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 +6 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +13 -2
- package/dist/cjs/PopupSelect/components.js +4 -2
- package/dist/cjs/Select.js +1 -1
- package/dist/es2019/PopupSelect/PopupSelect.js +12 -1
- package/dist/es2019/PopupSelect/components.js +4 -2
- package/dist/es2019/Select.js +1 -1
- package/dist/esm/PopupSelect/PopupSelect.js +13 -2
- package/dist/esm/PopupSelect/components.js +4 -2
- package/dist/esm/Select.js +1 -1
- package/dist/types/PopupSelect/PopupSelect.d.ts +4 -1
- package/dist/types/PopupSelect/components.d.ts +1 -0
- package/dist/types/extract-react-types/react-select-props.d.ts +11 -33
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +4 -1
- package/dist/types-ts4.5/PopupSelect/components.d.ts +1 -0
- package/dist/types-ts4.5/extract-react-types/react-select-props.d.ts +11 -33
- package/package.json +2 -1
- package/report.api.md +5 -0
- package/tmp/api-report-tmp.d.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 16.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f03e630c03e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f03e630c03e) - [ux] Adds keydown handler to target spread props for better accessibility for keyboard users.
|
|
8
|
+
|
|
3
9
|
## 16.5.14
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -29,7 +29,7 @@ var _components = require("./components");
|
|
|
29
29
|
var _styles = _interopRequireDefault(require("../styles"));
|
|
30
30
|
var _bindEventListener = require("bind-event-listener");
|
|
31
31
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
32
|
-
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target"];
|
|
32
|
+
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target", "testId"];
|
|
33
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
34
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
35
|
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; }
|
|
@@ -109,6 +109,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
109
109
|
}), "-popup-select"));
|
|
110
110
|
// Event Handlers
|
|
111
111
|
// ==============================
|
|
112
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTargetKeyDown", function (event) {
|
|
113
|
+
switch (event.key) {
|
|
114
|
+
case 'ArrowDown':
|
|
115
|
+
_this.open();
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
}
|
|
119
|
+
});
|
|
112
120
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
|
|
113
121
|
switch (event.key) {
|
|
114
122
|
case 'Escape':
|
|
@@ -317,6 +325,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
317
325
|
maxMenuWidth = _this$props3.maxMenuWidth,
|
|
318
326
|
minMenuWidth = _this$props3.minMenuWidth,
|
|
319
327
|
target = _this$props3.target,
|
|
328
|
+
testId = _this$props3.testId,
|
|
320
329
|
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
321
330
|
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
322
331
|
var _this$state = _this.state,
|
|
@@ -360,7 +369,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
360
369
|
"data-placement": placement,
|
|
361
370
|
minWidth: minMenuWidth,
|
|
362
371
|
maxWidth: maxMenuWidth,
|
|
363
|
-
id: _this.popperWrapperId
|
|
372
|
+
id: _this.popperWrapperId,
|
|
373
|
+
testId: testId
|
|
364
374
|
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default
|
|
365
375
|
/*
|
|
366
376
|
* NOTE: We intentionally want the FocusLock to be disabled until the refs are populated in Popper.
|
|
@@ -443,6 +453,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
443
453
|
var ref = _ref3.ref;
|
|
444
454
|
return target && target({
|
|
445
455
|
isOpen: isOpen,
|
|
456
|
+
onKeyDown: _this3.handleTargetKeyDown,
|
|
446
457
|
ref: _this3.resolveTargetRef(ref),
|
|
447
458
|
'aria-haspopup': 'true',
|
|
448
459
|
'aria-expanded': isOpen,
|
|
@@ -30,7 +30,8 @@ var MenuDialog = function MenuDialog(_ref) {
|
|
|
30
30
|
minWidth = _ref.minWidth,
|
|
31
31
|
children = _ref.children,
|
|
32
32
|
id = _ref.id,
|
|
33
|
-
style = _ref.style
|
|
33
|
+
style = _ref.style,
|
|
34
|
+
testId = _ref.testId;
|
|
34
35
|
return (0, _react.jsx)("div", {
|
|
35
36
|
css: [menuDialogStyles,
|
|
36
37
|
// There is not a limited amount of values for the widths, so they need
|
|
@@ -41,7 +42,8 @@ var MenuDialog = function MenuDialog(_ref) {
|
|
|
41
42
|
minWidth: minWidth
|
|
42
43
|
}],
|
|
43
44
|
style: style,
|
|
44
|
-
id: id
|
|
45
|
+
id: id,
|
|
46
|
+
"data-testid": testId && "".concat(testId, "--menu")
|
|
45
47
|
}, children);
|
|
46
48
|
};
|
|
47
49
|
|
package/dist/cjs/Select.js
CHANGED
|
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
11
11
|
var packageName = "@atlaskit/select";
|
|
12
|
-
var packageVersion = "16.
|
|
12
|
+
var packageVersion = "16.6.0";
|
|
13
13
|
var SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
exports.SelectWithoutAnalytics = SelectWithoutAnalytics;
|
|
15
15
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
@@ -75,6 +75,14 @@ export default class PopupSelect extends PureComponent {
|
|
|
75
75
|
})}-popup-select`);
|
|
76
76
|
// Event Handlers
|
|
77
77
|
// ==============================
|
|
78
|
+
_defineProperty(this, "handleTargetKeyDown", event => {
|
|
79
|
+
switch (event.key) {
|
|
80
|
+
case 'ArrowDown':
|
|
81
|
+
this.open();
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
}
|
|
85
|
+
});
|
|
78
86
|
_defineProperty(this, "handleKeyDown", event => {
|
|
79
87
|
switch (event.key) {
|
|
80
88
|
case 'Escape':
|
|
@@ -293,6 +301,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
293
301
|
maxMenuWidth,
|
|
294
302
|
minMenuWidth,
|
|
295
303
|
target,
|
|
304
|
+
testId,
|
|
296
305
|
...props
|
|
297
306
|
} = this.props;
|
|
298
307
|
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
@@ -340,7 +349,8 @@ export default class PopupSelect extends PureComponent {
|
|
|
340
349
|
"data-placement": placement,
|
|
341
350
|
minWidth: minMenuWidth,
|
|
342
351
|
maxWidth: maxMenuWidth,
|
|
343
|
-
id: this.popperWrapperId
|
|
352
|
+
id: this.popperWrapperId,
|
|
353
|
+
testId: testId
|
|
344
354
|
}, /*#__PURE__*/React.createElement(FocusLock
|
|
345
355
|
/*
|
|
346
356
|
* NOTE: We intentionally want the FocusLock to be disabled until the refs are populated in Popper.
|
|
@@ -444,6 +454,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
444
454
|
ref
|
|
445
455
|
}) => target && target({
|
|
446
456
|
isOpen,
|
|
457
|
+
onKeyDown: this.handleTargetKeyDown,
|
|
447
458
|
ref: this.resolveTargetRef(ref),
|
|
448
459
|
'aria-haspopup': 'true',
|
|
449
460
|
'aria-expanded': isOpen,
|
|
@@ -22,7 +22,8 @@ export const MenuDialog = ({
|
|
|
22
22
|
minWidth,
|
|
23
23
|
children,
|
|
24
24
|
id,
|
|
25
|
-
style
|
|
25
|
+
style,
|
|
26
|
+
testId
|
|
26
27
|
}) => jsx("div", {
|
|
27
28
|
css: [menuDialogStyles,
|
|
28
29
|
// There is not a limited amount of values for the widths, so they need
|
|
@@ -33,7 +34,8 @@ export const MenuDialog = ({
|
|
|
33
34
|
minWidth
|
|
34
35
|
}],
|
|
35
36
|
style: style,
|
|
36
|
-
id: id
|
|
37
|
+
id: id,
|
|
38
|
+
"data-testid": testId && `${testId}--menu`
|
|
37
39
|
}, children);
|
|
38
40
|
|
|
39
41
|
// ==============================
|
package/dist/es2019/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import Select from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
const packageName = "@atlaskit/select";
|
|
5
|
-
const packageVersion = "16.
|
|
5
|
+
const packageVersion = "16.6.0";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target"];
|
|
10
|
+
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target", "testId"];
|
|
11
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; }
|
|
12
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) { _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; }
|
|
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); }; }
|
|
@@ -99,6 +99,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
99
99
|
}), "-popup-select"));
|
|
100
100
|
// Event Handlers
|
|
101
101
|
// ==============================
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "handleTargetKeyDown", function (event) {
|
|
103
|
+
switch (event.key) {
|
|
104
|
+
case 'ArrowDown':
|
|
105
|
+
_this.open();
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
}
|
|
109
|
+
});
|
|
102
110
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
103
111
|
switch (event.key) {
|
|
104
112
|
case 'Escape':
|
|
@@ -307,6 +315,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
307
315
|
maxMenuWidth = _this$props3.maxMenuWidth,
|
|
308
316
|
minMenuWidth = _this$props3.minMenuWidth,
|
|
309
317
|
target = _this$props3.target,
|
|
318
|
+
testId = _this$props3.testId,
|
|
310
319
|
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
311
320
|
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
312
321
|
var _this$state = _this.state,
|
|
@@ -350,7 +359,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
350
359
|
"data-placement": placement,
|
|
351
360
|
minWidth: minMenuWidth,
|
|
352
361
|
maxWidth: maxMenuWidth,
|
|
353
|
-
id: _this.popperWrapperId
|
|
362
|
+
id: _this.popperWrapperId,
|
|
363
|
+
testId: testId
|
|
354
364
|
}, /*#__PURE__*/React.createElement(FocusLock
|
|
355
365
|
/*
|
|
356
366
|
* NOTE: We intentionally want the FocusLock to be disabled until the refs are populated in Popper.
|
|
@@ -433,6 +443,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
433
443
|
var ref = _ref3.ref;
|
|
434
444
|
return target && target({
|
|
435
445
|
isOpen: isOpen,
|
|
446
|
+
onKeyDown: _this3.handleTargetKeyDown,
|
|
436
447
|
ref: _this3.resolveTargetRef(ref),
|
|
437
448
|
'aria-haspopup': 'true',
|
|
438
449
|
'aria-expanded': isOpen,
|
|
@@ -25,7 +25,8 @@ export var MenuDialog = function MenuDialog(_ref) {
|
|
|
25
25
|
minWidth = _ref.minWidth,
|
|
26
26
|
children = _ref.children,
|
|
27
27
|
id = _ref.id,
|
|
28
|
-
style = _ref.style
|
|
28
|
+
style = _ref.style,
|
|
29
|
+
testId = _ref.testId;
|
|
29
30
|
return jsx("div", {
|
|
30
31
|
css: [menuDialogStyles,
|
|
31
32
|
// There is not a limited amount of values for the widths, so they need
|
|
@@ -36,7 +37,8 @@ export var MenuDialog = function MenuDialog(_ref) {
|
|
|
36
37
|
minWidth: minWidth
|
|
37
38
|
}],
|
|
38
39
|
style: style,
|
|
39
|
-
id: id
|
|
40
|
+
id: id,
|
|
41
|
+
"data-testid": testId && "".concat(testId, "--menu")
|
|
40
42
|
}, children);
|
|
41
43
|
};
|
|
42
44
|
|
package/dist/esm/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import Select from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
var packageName = "@atlaskit/select";
|
|
5
|
-
var packageVersion = "16.
|
|
5
|
+
var packageVersion = "16.6.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PureComponent, ReactNode } from 'react';
|
|
1
|
+
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
2
|
import { GroupBase } from 'react-select';
|
|
3
3
|
import BaseSelect from 'react-select/base';
|
|
4
4
|
import { PopperProps } from 'react-popper';
|
|
@@ -9,6 +9,7 @@ type defaultModifiers = 'offset' | 'preventOverflow';
|
|
|
9
9
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
10
10
|
interface PopupSelectTriggerProps {
|
|
11
11
|
ref: any;
|
|
12
|
+
onKeyDown: KeyboardEventHandler<HTMLElement>;
|
|
12
13
|
'aria-haspopup': 'true';
|
|
13
14
|
'aria-expanded': boolean;
|
|
14
15
|
'aria-controls'?: string;
|
|
@@ -59,6 +60,7 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
59
60
|
- `isOpen`: The current state of the popup.
|
|
60
61
|
Use this to change the appearance of your target based on the state of your component
|
|
61
62
|
- `ref`: Pass this ref to the element the Popup should be attached to
|
|
63
|
+
- `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
62
64
|
- `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
63
65
|
ensure your experience is accessible
|
|
64
66
|
*/
|
|
@@ -131,6 +133,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
131
133
|
componentDidMount(): void;
|
|
132
134
|
componentWillUnmount(): void;
|
|
133
135
|
componentDidUpdate(prevProps: PopupSelectProps<Option, IsMulti, Modifiers>): void;
|
|
136
|
+
handleTargetKeyDown: (event: React.KeyboardEvent) => void;
|
|
134
137
|
handleKeyDown: (event: KeyboardEvent) => void;
|
|
135
138
|
handleClick: ({ target }: MouseEvent) => void;
|
|
136
139
|
handleSelectChange: (value: ValueType<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
|
|
@@ -32,13 +32,9 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
32
32
|
closeMenuOnSelect?: boolean;
|
|
33
33
|
closeMenuOnScroll?: boolean | EventListener;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
* If you only wish to restyle a component, we recommend using the `styles` prop
|
|
40
|
-
* instead. For a list of the components that can be passed in, and the shape
|
|
41
|
-
* that will be passed to them, see [the components docs](/components)
|
|
35
|
+
This complex object includes all the compositional components that are used in `react-select`. If you wish to overwrite a component, pass in an object with the appropriate namespace.
|
|
36
|
+
|
|
37
|
+
If you only wish to restyle a component, we recommend using the `styles` prop instead. For a list of the components that can be passed in, and the shape that will be passed to them, see [the components docs](/components).
|
|
42
38
|
*/
|
|
43
39
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
44
40
|
/** Whether the value of the select, e.g. SingleValue, should be displayed in the control. */
|
|
@@ -49,19 +45,14 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
49
45
|
escapeClearsValue?: boolean;
|
|
50
46
|
/** Custom method to filter whether an option should be displayed in the menu */
|
|
51
47
|
filterOption?: ((option?: FilterOptionOption<Option>, inputValue?: string) => boolean) | null;
|
|
52
|
-
/**
|
|
53
|
-
* Formats group labels in the menu as React components
|
|
54
|
-
*
|
|
55
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
56
|
-
*/
|
|
48
|
+
/** Formats group labels in the menu as React components. [Custom label example](/components/select/examples#customization). */
|
|
57
49
|
formatGroupLabel?: (group?: Group) => ReactNode;
|
|
58
50
|
/** Formats option labels in the menu and control as React components */
|
|
59
51
|
formatOptionLabel?: (data?: Option, formatOptionLabelMeta?: FormatOptionLabelMeta<Option>) => ReactNode;
|
|
60
52
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* screen reader support.
|
|
53
|
+
Resolves option data to a string to be displayed as the label by components.
|
|
54
|
+
|
|
55
|
+
Note?: Failure to resolve to a string type can interfere with filtering and screen reader support.
|
|
65
56
|
*/
|
|
66
57
|
getOptionLabel?: GetOptionLabel<Option>;
|
|
67
58
|
/** Resolves option data to a string to compare options and specify value attributes */
|
|
@@ -83,9 +74,7 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
83
74
|
/** Is the select in a state of loading (async) */
|
|
84
75
|
isLoading?: boolean;
|
|
85
76
|
/**
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
77
|
+
Override the built-in logic to detect whether an option is disabled.
|
|
89
78
|
*/
|
|
90
79
|
isOptionDisabled?: (option?: Option, selectValue?: Options<Option>) => boolean;
|
|
91
80
|
/** Override the built-in logic to detect whether an option is selected */
|
|
@@ -106,18 +95,11 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
106
95
|
maxMenuHeight?: number;
|
|
107
96
|
/** Whether the menu is open */
|
|
108
97
|
menuIsOpen?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Default placement of the menu in relation to the control. 'auto' will flip
|
|
111
|
-
* when there isn't enough space below the control.
|
|
112
|
-
*/
|
|
98
|
+
/** Default placement of the menu in relation to the control. 'auto' will flip when there isn't enough space below the control. */
|
|
113
99
|
menuPlacement?: MenuPlacement;
|
|
114
100
|
/** The CSS position value of the menu, when "fixed" extra layout management is required */
|
|
115
101
|
menuPosition?: MenuPosition;
|
|
116
|
-
/**
|
|
117
|
-
* Whether the menu should use a portal, and where it should attach
|
|
118
|
-
*
|
|
119
|
-
* An example can be found in the [Portaling](/advanced#portaling) documentation
|
|
120
|
-
*/
|
|
102
|
+
/** Whether the menu should use a portal, and where it should attach. */
|
|
121
103
|
menuPortalTarget?: HTMLElement | null;
|
|
122
104
|
/** Whether to block scroll events when the menu is open */
|
|
123
105
|
menuShouldBlockScroll?: boolean;
|
|
@@ -161,11 +143,7 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
161
143
|
screenReaderStatus?: (obj?: {
|
|
162
144
|
count?: number;
|
|
163
145
|
}) => string;
|
|
164
|
-
/**
|
|
165
|
-
* Style modifier methods
|
|
166
|
-
*
|
|
167
|
-
* A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
168
|
-
*/
|
|
146
|
+
/** Style modifier methods. */
|
|
169
147
|
styles?: StylesConfig;
|
|
170
148
|
/** Theme modifier method */
|
|
171
149
|
theme?: ThemeConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PureComponent, ReactNode } from 'react';
|
|
1
|
+
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
2
|
import { GroupBase } from 'react-select';
|
|
3
3
|
import BaseSelect from 'react-select/base';
|
|
4
4
|
import { PopperProps } from 'react-popper';
|
|
@@ -9,6 +9,7 @@ type defaultModifiers = 'offset' | 'preventOverflow';
|
|
|
9
9
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
10
10
|
interface PopupSelectTriggerProps {
|
|
11
11
|
ref: any;
|
|
12
|
+
onKeyDown: KeyboardEventHandler<HTMLElement>;
|
|
12
13
|
'aria-haspopup': 'true';
|
|
13
14
|
'aria-expanded': boolean;
|
|
14
15
|
'aria-controls'?: string;
|
|
@@ -59,6 +60,7 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
59
60
|
- `isOpen`: The current state of the popup.
|
|
60
61
|
Use this to change the appearance of your target based on the state of your component
|
|
61
62
|
- `ref`: Pass this ref to the element the Popup should be attached to
|
|
63
|
+
- `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
62
64
|
- `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
63
65
|
ensure your experience is accessible
|
|
64
66
|
*/
|
|
@@ -131,6 +133,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
131
133
|
componentDidMount(): void;
|
|
132
134
|
componentWillUnmount(): void;
|
|
133
135
|
componentDidUpdate(prevProps: PopupSelectProps<Option, IsMulti, Modifiers>): void;
|
|
136
|
+
handleTargetKeyDown: (event: React.KeyboardEvent) => void;
|
|
134
137
|
handleKeyDown: (event: KeyboardEvent) => void;
|
|
135
138
|
handleClick: ({ target }: MouseEvent) => void;
|
|
136
139
|
handleSelectChange: (value: ValueType<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
|
|
@@ -32,13 +32,9 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
32
32
|
closeMenuOnSelect?: boolean;
|
|
33
33
|
closeMenuOnScroll?: boolean | EventListener;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
* If you only wish to restyle a component, we recommend using the `styles` prop
|
|
40
|
-
* instead. For a list of the components that can be passed in, and the shape
|
|
41
|
-
* that will be passed to them, see [the components docs](/components)
|
|
35
|
+
This complex object includes all the compositional components that are used in `react-select`. If you wish to overwrite a component, pass in an object with the appropriate namespace.
|
|
36
|
+
|
|
37
|
+
If you only wish to restyle a component, we recommend using the `styles` prop instead. For a list of the components that can be passed in, and the shape that will be passed to them, see [the components docs](/components).
|
|
42
38
|
*/
|
|
43
39
|
components?: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
44
40
|
/** Whether the value of the select, e.g. SingleValue, should be displayed in the control. */
|
|
@@ -49,19 +45,14 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
49
45
|
escapeClearsValue?: boolean;
|
|
50
46
|
/** Custom method to filter whether an option should be displayed in the menu */
|
|
51
47
|
filterOption?: ((option?: FilterOptionOption<Option>, inputValue?: string) => boolean) | null;
|
|
52
|
-
/**
|
|
53
|
-
* Formats group labels in the menu as React components
|
|
54
|
-
*
|
|
55
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
56
|
-
*/
|
|
48
|
+
/** Formats group labels in the menu as React components. [Custom label example](/components/select/examples#customization). */
|
|
57
49
|
formatGroupLabel?: (group?: Group) => ReactNode;
|
|
58
50
|
/** Formats option labels in the menu and control as React components */
|
|
59
51
|
formatOptionLabel?: (data?: Option, formatOptionLabelMeta?: FormatOptionLabelMeta<Option>) => ReactNode;
|
|
60
52
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* screen reader support.
|
|
53
|
+
Resolves option data to a string to be displayed as the label by components.
|
|
54
|
+
|
|
55
|
+
Note?: Failure to resolve to a string type can interfere with filtering and screen reader support.
|
|
65
56
|
*/
|
|
66
57
|
getOptionLabel?: GetOptionLabel<Option>;
|
|
67
58
|
/** Resolves option data to a string to compare options and specify value attributes */
|
|
@@ -83,9 +74,7 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
83
74
|
/** Is the select in a state of loading (async) */
|
|
84
75
|
isLoading?: boolean;
|
|
85
76
|
/**
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
77
|
+
Override the built-in logic to detect whether an option is disabled.
|
|
89
78
|
*/
|
|
90
79
|
isOptionDisabled?: (option?: Option, selectValue?: Options<Option>) => boolean;
|
|
91
80
|
/** Override the built-in logic to detect whether an option is selected */
|
|
@@ -106,18 +95,11 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
106
95
|
maxMenuHeight?: number;
|
|
107
96
|
/** Whether the menu is open */
|
|
108
97
|
menuIsOpen?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Default placement of the menu in relation to the control. 'auto' will flip
|
|
111
|
-
* when there isn't enough space below the control.
|
|
112
|
-
*/
|
|
98
|
+
/** Default placement of the menu in relation to the control. 'auto' will flip when there isn't enough space below the control. */
|
|
113
99
|
menuPlacement?: MenuPlacement;
|
|
114
100
|
/** The CSS position value of the menu, when "fixed" extra layout management is required */
|
|
115
101
|
menuPosition?: MenuPosition;
|
|
116
|
-
/**
|
|
117
|
-
* Whether the menu should use a portal, and where it should attach
|
|
118
|
-
*
|
|
119
|
-
* An example can be found in the [Portaling](/advanced#portaling) documentation
|
|
120
|
-
*/
|
|
102
|
+
/** Whether the menu should use a portal, and where it should attach. */
|
|
121
103
|
menuPortalTarget?: HTMLElement | null;
|
|
122
104
|
/** Whether to block scroll events when the menu is open */
|
|
123
105
|
menuShouldBlockScroll?: boolean;
|
|
@@ -161,11 +143,7 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
161
143
|
screenReaderStatus?: (obj?: {
|
|
162
144
|
count?: number;
|
|
163
145
|
}) => string;
|
|
164
|
-
/**
|
|
165
|
-
* Style modifier methods
|
|
166
|
-
*
|
|
167
|
-
* A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
168
|
-
*/
|
|
146
|
+
/** Style modifier methods. */
|
|
169
147
|
styles?: StylesConfig;
|
|
170
148
|
/** Theme modifier method */
|
|
171
149
|
theme?: ThemeConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.6.0",
|
|
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/"
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@af/accessibility-testing": "*",
|
|
67
|
+
"@af/integration-testing": "*",
|
|
67
68
|
"@atlaskit/ssr": "*",
|
|
68
69
|
"@atlaskit/visual-regression": "*",
|
|
69
70
|
"@atlaskit/webdriver-runner": "*",
|
package/report.api.md
CHANGED
|
@@ -42,6 +42,7 @@ import { IndicatorSeparatorProps } from 'react-select';
|
|
|
42
42
|
import { InputActionMeta } from 'react-select';
|
|
43
43
|
import { InputProps } from 'react-select';
|
|
44
44
|
import { jsx } from '@emotion/react';
|
|
45
|
+
import { KeyboardEventHandler } from 'react';
|
|
45
46
|
import { LoadingIndicatorProps } from 'react-select';
|
|
46
47
|
import { MemoizedFn } from 'memoize-one';
|
|
47
48
|
import { MenuListProps } from 'react-select';
|
|
@@ -1081,6 +1082,8 @@ export class PopupSelect<
|
|
|
1081
1082
|
actionMeta: ActionMeta<Option>,
|
|
1082
1083
|
) => void;
|
|
1083
1084
|
// (undocumented)
|
|
1085
|
+
handleTargetKeyDown: (event: React_2.KeyboardEvent) => void;
|
|
1086
|
+
// (undocumented)
|
|
1084
1087
|
isOpenControlled: boolean;
|
|
1085
1088
|
// (undocumented)
|
|
1086
1089
|
menuRef: HTMLElement | null;
|
|
@@ -1180,6 +1183,8 @@ interface PopupSelectTriggerProps {
|
|
|
1180
1183
|
// (undocumented)
|
|
1181
1184
|
'aria-haspopup': 'true';
|
|
1182
1185
|
// (undocumented)
|
|
1186
|
+
onKeyDown: KeyboardEventHandler<HTMLElement>;
|
|
1187
|
+
// (undocumented)
|
|
1183
1188
|
ref: any;
|
|
1184
1189
|
}
|
|
1185
1190
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { IndicatorSeparatorProps } from 'react-select';
|
|
|
31
31
|
import { InputActionMeta } from 'react-select';
|
|
32
32
|
import { InputProps } from 'react-select';
|
|
33
33
|
import { jsx } from '@emotion/react';
|
|
34
|
+
import { KeyboardEventHandler } from 'react';
|
|
34
35
|
import { LoadingIndicatorProps } from 'react-select';
|
|
35
36
|
import { MemoizedFn } from 'memoize-one';
|
|
36
37
|
import { MenuListProps } from 'react-select';
|
|
@@ -514,6 +515,8 @@ export class PopupSelect<Option = OptionType, IsMulti extends boolean = false, M
|
|
|
514
515
|
// (undocumented)
|
|
515
516
|
handleSelectChange: (value: ValueType<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
|
|
516
517
|
// (undocumented)
|
|
518
|
+
handleTargetKeyDown: (event: React_2.KeyboardEvent) => void;
|
|
519
|
+
// (undocumented)
|
|
517
520
|
isOpenControlled: boolean;
|
|
518
521
|
// (undocumented)
|
|
519
522
|
menuRef: HTMLElement | null;
|
|
@@ -595,6 +598,8 @@ interface PopupSelectTriggerProps {
|
|
|
595
598
|
// (undocumented)
|
|
596
599
|
'aria-haspopup': 'true';
|
|
597
600
|
// (undocumented)
|
|
601
|
+
onKeyDown: KeyboardEventHandler<HTMLElement>;
|
|
602
|
+
// (undocumented)
|
|
598
603
|
ref: any;
|
|
599
604
|
}
|
|
600
605
|
|