@atlaskit/select 17.5.0 → 17.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 +10 -0
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/createSelect.js +79 -113
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +71 -88
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +80 -114
- package/dist/types/AsyncCreatableSelect.d.ts +6 -43
- package/dist/types/AsyncSelect.d.ts +6 -43
- package/dist/types/CreatableSelect.d.ts +6 -43
- package/dist/types/Select.d.ts +12 -86
- package/dist/types/components/indicators.d.ts +5 -4
- package/dist/types/createSelect.d.ts +10 -46
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -1
- package/dist/types-ts4.5/AsyncCreatableSelect.d.ts +6 -43
- package/dist/types-ts4.5/AsyncSelect.d.ts +6 -43
- package/dist/types-ts4.5/CreatableSelect.d.ts +6 -43
- package/dist/types-ts4.5/Select.d.ts +12 -86
- package/dist/types-ts4.5/components/indicators.d.ts +5 -4
- package/dist/types-ts4.5/createSelect.d.ts +10 -46
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -1
- package/package.json +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#88021](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88021) [`2cf5300457e7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2cf5300457e7) - Convert AtlaskitSelect from react class component to function component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#73901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73901) [`2aefab5730ab`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2aefab5730ab) - ECA11Y-207 Added Tab navigation for video panel controls and handling key press on them
|
|
12
|
+
|
|
3
13
|
## 17.5.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/cjs/Select.js
CHANGED
|
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
11
11
|
var packageName = "@atlaskit/select";
|
|
12
|
-
var packageVersion = "17.
|
|
12
|
+
var packageVersion = "17.6.0";
|
|
13
13
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
15
15
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
package/dist/cjs/createSelect.js
CHANGED
|
@@ -7,132 +7,98 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = createSelect;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
13
|
var _reactSelect = require("react-select");
|
|
20
|
-
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
21
|
-
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
22
14
|
var _inputAriaDescribedby = require("./components/input-aria-describedby");
|
|
23
15
|
var _components = require("./components");
|
|
24
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
25
17
|
var _groupedOptionsAnnouncement = require("./utils/grouped-options-announcement");
|
|
26
|
-
var _excluded = ["
|
|
18
|
+
var _excluded = ["appearance", "ariaLiveMessages", "components", "isInvalid", "onClickPreventDefault", "spacing", "styles", "tabSelectsValue", "validationState"];
|
|
27
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
21
|
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; }
|
|
30
22
|
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; }
|
|
31
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
32
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
33
23
|
function createSelect(WrappedComponent) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "blur",
|
|
75
|
-
value: function blur() {
|
|
76
|
-
if (this.select) {
|
|
77
|
-
this.select.blur();
|
|
24
|
+
var AtlaskitSelect = /*#__PURE__*/(0, _react.forwardRef)(function AtlaskitSelect(props, forwardedRef) {
|
|
25
|
+
var appearance = props.appearance,
|
|
26
|
+
ariaLiveMessages = props.ariaLiveMessages,
|
|
27
|
+
componentsProp = props.components,
|
|
28
|
+
isInvalid = props.isInvalid,
|
|
29
|
+
_props$onClickPrevent = props.onClickPreventDefault,
|
|
30
|
+
onClickPreventDefault = _props$onClickPrevent === void 0 ? true : _props$onClickPrevent,
|
|
31
|
+
_props$spacing = props.spacing,
|
|
32
|
+
spacing = _props$spacing === void 0 ? 'default' : _props$spacing,
|
|
33
|
+
_props$styles = props.styles,
|
|
34
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
35
|
+
_props$tabSelectsValu = props.tabSelectsValue,
|
|
36
|
+
tabSelectsValue = _props$tabSelectsValu === void 0 ? false : _props$tabSelectsValu,
|
|
37
|
+
_props$validationStat = props.validationState,
|
|
38
|
+
validationState = _props$validationStat === void 0 ? 'default' : _props$validationStat,
|
|
39
|
+
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
40
|
+
var internalSelectRef = (0, _react.useRef)(null);
|
|
41
|
+
var components = (0, _react.useMemo)(function () {
|
|
42
|
+
return _objectSpread({
|
|
43
|
+
ClearIndicator: _components.ClearIndicator,
|
|
44
|
+
DropdownIndicator: _components.DropdownIndicator,
|
|
45
|
+
LoadingIndicator: _components.LoadingIndicator,
|
|
46
|
+
MultiValueRemove: _components.MultiValueRemove,
|
|
47
|
+
IndicatorSeparator: _components.IndicatorSeparator,
|
|
48
|
+
Input: _inputAriaDescribedby.Input
|
|
49
|
+
}, componentsProp);
|
|
50
|
+
}, [componentsProp]);
|
|
51
|
+
var descriptionId = props['aria-describedby'];
|
|
52
|
+
var isSearchable = props.isSearchable;
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
if (!isSearchable && descriptionId) {
|
|
55
|
+
var _internalSelectRef$cu;
|
|
56
|
+
// when isSearchable is false, react-select will create its own dummy input instead of using ours,
|
|
57
|
+
// so we need to manually add the additional aria-describedby using ref.
|
|
58
|
+
var input = (_internalSelectRef$cu = internalSelectRef.current) === null || _internalSelectRef$cu === void 0 ? void 0 : _internalSelectRef$cu.inputRef;
|
|
59
|
+
var ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
|
|
60
|
+
if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
|
|
61
|
+
input === null || input === void 0 || input.setAttribute('aria-describedby', "".concat(ariaDescribedby, " ").concat(descriptionId));
|
|
78
62
|
}
|
|
79
63
|
}
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
value: function componentDidMount() {
|
|
83
|
-
var descriptionId = this.props['aria-describedby'];
|
|
84
|
-
if (!this.props.isSearchable && descriptionId) {
|
|
85
|
-
var _this$select;
|
|
86
|
-
// when isSearchable is false, react-select will create its own dummy input instead of using ours,
|
|
87
|
-
// so we need to manually add the additional aria-describedby using ref.
|
|
88
|
-
var input = (_this$select = this.select) === null || _this$select === void 0 ? void 0 : _this$select.inputRef;
|
|
89
|
-
var ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
|
|
90
|
-
if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
|
|
91
|
-
input === null || input === void 0 || input.setAttribute('aria-describedby', "".concat(ariaDescribedby, " ").concat(descriptionId));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
key: "render",
|
|
97
|
-
value: function render() {
|
|
98
|
-
var _this$props = this.props,
|
|
99
|
-
styles = _this$props.styles,
|
|
100
|
-
validationState = _this$props.validationState,
|
|
101
|
-
isInvalid = _this$props.isInvalid,
|
|
102
|
-
spacing = _this$props.spacing,
|
|
103
|
-
isMulti = _this$props.isMulti,
|
|
104
|
-
appearance = _this$props.appearance,
|
|
105
|
-
ariaLiveMessages = _this$props.ariaLiveMessages,
|
|
106
|
-
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
107
|
-
var isCompact = spacing === 'compact';
|
|
64
|
+
}, [descriptionId, isSearchable]);
|
|
65
|
+
var isCompact = spacing === 'compact';
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The following `useImperativeHandle` hook exists for the sake of backwards compatibility.
|
|
69
|
+
* This component used to be a class component which set the value of the `ref` prop to object with the properties and value as below.
|
|
70
|
+
* This has lead to slightly odd usage of refs with this component, e.g. `myRef.current.select.select.controlRef` instead of just `myRef.current.select.controlRef`
|
|
71
|
+
* In the next major release, this should removed and the ref should be passed directly to the wrapped component (given users have updated usage)
|
|
72
|
+
* More info https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/88021/overview
|
|
73
|
+
*/
|
|
74
|
+
(0, _react.useImperativeHandle)(forwardedRef, function () {
|
|
75
|
+
return {
|
|
76
|
+
select: internalSelectRef.current,
|
|
77
|
+
focus: function focus() {
|
|
78
|
+
var _internalSelectRef$cu2;
|
|
79
|
+
return (_internalSelectRef$cu2 = internalSelectRef.current) === null || _internalSelectRef$cu2 === void 0 ? void 0 : _internalSelectRef$cu2.focus();
|
|
80
|
+
},
|
|
81
|
+
blur: function blur() {
|
|
82
|
+
var _internalSelectRef$cu3;
|
|
83
|
+
return (_internalSelectRef$cu3 = internalSelectRef.current) === null || _internalSelectRef$cu3 === void 0 ? void 0 : _internalSelectRef$cu3.blur();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}, []);
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(WrappedComponent, (0, _extends2.default)({
|
|
88
|
+
ref: internalSelectRef,
|
|
89
|
+
"aria-live": "assertive",
|
|
90
|
+
ariaLiveMessages: (0, _groupedOptionsAnnouncement.isOptionsGrouped)(props.options) ? _objectSpread({
|
|
91
|
+
onFocus: _groupedOptionsAnnouncement.onFocus
|
|
92
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages),
|
|
93
|
+
tabSelectsValue: tabSelectsValue,
|
|
94
|
+
onClickPreventDefault: onClickPreventDefault
|
|
95
|
+
}, restProps, {
|
|
96
|
+
components: components,
|
|
97
|
+
styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(
|
|
98
|
+
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
99
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, appearance || 'default'), styles)
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
AtlaskitSelect.displayName = 'AtlaskitSelect';
|
|
103
|
+
return AtlaskitSelect;
|
|
138
104
|
}
|
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.
|
|
5
|
+
const packageVersion = "17.6.0";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
|
@@ -1,104 +1,87 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import React, { Component } from 'react';
|
|
2
|
+
import React, { useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { mergeStyles } from 'react-select';
|
|
5
|
-
import memoizeOne from 'memoize-one';
|
|
6
|
-
import isEqual from 'react-fast-compare';
|
|
7
4
|
import { Input } from './components/input-aria-describedby';
|
|
8
5
|
import { ClearIndicator, DropdownIndicator, LoadingIndicator, MultiValueRemove, IndicatorSeparator } from './components';
|
|
9
6
|
import baseStyles from './styles';
|
|
10
7
|
import { onFocus, isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
11
8
|
export default function createSelect(WrappedComponent) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
blur() {
|
|
44
|
-
if (this.select) {
|
|
45
|
-
this.select.blur();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
componentDidMount() {
|
|
49
|
-
const descriptionId = this.props['aria-describedby'];
|
|
50
|
-
if (!this.props.isSearchable && descriptionId) {
|
|
51
|
-
var _this$select;
|
|
9
|
+
const AtlaskitSelect = /*#__PURE__*/forwardRef(function AtlaskitSelect(props, forwardedRef) {
|
|
10
|
+
const {
|
|
11
|
+
appearance,
|
|
12
|
+
ariaLiveMessages,
|
|
13
|
+
components: componentsProp,
|
|
14
|
+
isInvalid,
|
|
15
|
+
// TODO: set to true when cleaning up validationState prop so it has a default value
|
|
16
|
+
onClickPreventDefault = true,
|
|
17
|
+
spacing = 'default',
|
|
18
|
+
styles = {},
|
|
19
|
+
tabSelectsValue = false,
|
|
20
|
+
validationState = 'default',
|
|
21
|
+
...restProps
|
|
22
|
+
} = props;
|
|
23
|
+
const internalSelectRef = useRef(null);
|
|
24
|
+
const components = useMemo(() => ({
|
|
25
|
+
ClearIndicator,
|
|
26
|
+
DropdownIndicator,
|
|
27
|
+
LoadingIndicator,
|
|
28
|
+
MultiValueRemove,
|
|
29
|
+
IndicatorSeparator,
|
|
30
|
+
Input,
|
|
31
|
+
...componentsProp
|
|
32
|
+
}), [componentsProp]);
|
|
33
|
+
const descriptionId = props['aria-describedby'];
|
|
34
|
+
const isSearchable = props.isSearchable;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!isSearchable && descriptionId) {
|
|
37
|
+
var _internalSelectRef$cu;
|
|
52
38
|
// when isSearchable is false, react-select will create its own dummy input instead of using ours,
|
|
53
39
|
// so we need to manually add the additional aria-describedby using ref.
|
|
54
|
-
const input = (
|
|
40
|
+
const input = (_internalSelectRef$cu = internalSelectRef.current) === null || _internalSelectRef$cu === void 0 ? void 0 : _internalSelectRef$cu.inputRef;
|
|
55
41
|
const ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
|
|
56
42
|
if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
|
|
57
43
|
input === null || input === void 0 ? void 0 : input.setAttribute('aria-describedby', `${ariaDescribedby} ${descriptionId}`);
|
|
58
44
|
}
|
|
59
45
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const {
|
|
63
|
-
styles,
|
|
64
|
-
validationState,
|
|
65
|
-
isInvalid,
|
|
66
|
-
spacing,
|
|
67
|
-
isMulti,
|
|
68
|
-
appearance,
|
|
69
|
-
ariaLiveMessages,
|
|
70
|
-
...props
|
|
71
|
-
} = this.props;
|
|
72
|
-
const isCompact = spacing === 'compact';
|
|
46
|
+
}, [descriptionId, isSearchable]);
|
|
47
|
+
const isCompact = spacing === 'compact';
|
|
73
48
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The following `useImperativeHandle` hook exists for the sake of backwards compatibility.
|
|
51
|
+
* This component used to be a class component which set the value of the `ref` prop to object with the properties and value as below.
|
|
52
|
+
* This has lead to slightly odd usage of refs with this component, e.g. `myRef.current.select.select.controlRef` instead of just `myRef.current.select.controlRef`
|
|
53
|
+
* In the next major release, this should removed and the ref should be passed directly to the wrapped component (given users have updated usage)
|
|
54
|
+
* More info https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/88021/overview
|
|
55
|
+
*/
|
|
56
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
57
|
+
select: internalSelectRef.current,
|
|
58
|
+
focus: () => {
|
|
59
|
+
var _internalSelectRef$cu2;
|
|
60
|
+
return (_internalSelectRef$cu2 = internalSelectRef.current) === null || _internalSelectRef$cu2 === void 0 ? void 0 : _internalSelectRef$cu2.focus();
|
|
61
|
+
},
|
|
62
|
+
blur: () => {
|
|
63
|
+
var _internalSelectRef$cu3;
|
|
64
|
+
return (_internalSelectRef$cu3 = internalSelectRef.current) === null || _internalSelectRef$cu3 === void 0 ? void 0 : _internalSelectRef$cu3.blur();
|
|
65
|
+
}
|
|
66
|
+
}), []);
|
|
67
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
68
|
+
ref: internalSelectRef,
|
|
69
|
+
"aria-live": "assertive",
|
|
70
|
+
ariaLiveMessages: isOptionsGrouped(props.options) ? {
|
|
71
|
+
onFocus,
|
|
72
|
+
...ariaLiveMessages
|
|
73
|
+
} : {
|
|
74
|
+
...ariaLiveMessages
|
|
75
|
+
},
|
|
76
|
+
tabSelectsValue: tabSelectsValue,
|
|
77
|
+
onClickPreventDefault: onClickPreventDefault
|
|
78
|
+
}, restProps, {
|
|
79
|
+
components: components,
|
|
80
|
+
styles: mergeStyles(baseStyles(
|
|
81
|
+
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
82
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, appearance || 'default'), styles)
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
AtlaskitSelect.displayName = 'AtlaskitSelect';
|
|
86
|
+
return AtlaskitSelect;
|
|
104
87
|
}
|
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.
|
|
5
|
+
var packageVersion = "17.6.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|