@atlaskit/react-select 3.4.2 → 3.4.4
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 +17 -0
- package/async/package.json +1 -1
- package/async-creatable/package.json +1 -1
- package/base/package.json +1 -1
- package/creatable/package.json +1 -1
- package/dist/cjs/components/input.compiled.css +4 -0
- package/dist/cjs/components/input.js +28 -3
- package/dist/cjs/select.js +18 -21
- package/dist/es2019/components/input.compiled.css +4 -0
- package/dist/es2019/components/input.js +28 -3
- package/dist/es2019/select.js +18 -21
- package/dist/esm/components/input.compiled.css +4 -0
- package/dist/esm/components/input.js +28 -3
- package/dist/esm/select.js +18 -21
- package/dist/types/select.d.ts +0 -7
- package/dist/types-ts4.5/select.d.ts +0 -7
- package/package.json +5 -2
- package/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/react-select
|
|
2
2
|
|
|
3
|
+
## 3.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4129d4df5bb4d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4129d4df5bb4d) -
|
|
8
|
+
Revert the changes done to add prop hasOtherFocusableElements flag
|
|
9
|
+
|
|
10
|
+
## 3.4.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#200709](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200709)
|
|
15
|
+
[`4e4c55892eecf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4e4c55892eecf) -
|
|
16
|
+
[ux] Prevent input from being cleared from selecting an option with multi-select enabled and fix
|
|
17
|
+
cursor in search field
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.4.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/async/package.json
CHANGED
package/base/package.json
CHANGED
package/creatable/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
._11q7idpf{background:0}
|
|
3
3
|
._19itidpf{border:0}
|
|
4
4
|
._1h9u1kw7:after{font:inherit}
|
|
5
|
+
._1r04idpf{inset:0}
|
|
5
6
|
._ckog1yjy:after{grid-area:1/2}
|
|
6
7
|
._eq43idpf:after{border:0}
|
|
7
8
|
._nd5l1sux{grid-area:1/1/2/3}
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
._1bsb1osq{width:100%}
|
|
20
21
|
._1doyidpf:after{margin-bottom:0}
|
|
21
22
|
._1e0c1n7u{display:inline-grid}
|
|
23
|
+
._1e0c1txw{display:flex}
|
|
22
24
|
._1k96idpf:after{padding-left:0}
|
|
23
25
|
._1nn4glyw:after{outline-style:none}
|
|
24
26
|
._1o9zkb7n{flex-shrink:1}
|
|
@@ -36,6 +38,8 @@
|
|
|
36
38
|
._ca0qidpf{padding-top:0}
|
|
37
39
|
._i0dl1wug{flex-basis:auto}
|
|
38
40
|
._j8d6idpf:after{margin-top:0}
|
|
41
|
+
._kqswh2mm{position:relative}
|
|
42
|
+
._kqswstnw{position:absolute}
|
|
39
43
|
._n3tdidpf{padding-bottom:0}
|
|
40
44
|
._otyridpf{margin-bottom:0}
|
|
41
45
|
._pfztidpf:after{margin-left:0}
|
|
@@ -13,17 +13,23 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
var _react2 = require("@compiled/react");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _utils = require("../utils");
|
|
17
18
|
var _excluded = ["innerRef", "isDisabled", "isHidden", "inputClassName", "testId"];
|
|
18
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
20
|
var inputCSS = exports.inputCSS = function inputCSS() {
|
|
20
21
|
return {};
|
|
21
22
|
};
|
|
22
|
-
var
|
|
23
|
+
var inputStylesOld = {
|
|
23
24
|
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _1e0c1n7u _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
24
25
|
disabled: "_3um015vq"
|
|
25
26
|
};
|
|
26
|
-
var
|
|
27
|
+
var inputStyles = {
|
|
28
|
+
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _kqswh2mm _1e0c1txw _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
29
|
+
disabled: "_3um015vq"
|
|
30
|
+
};
|
|
31
|
+
var nativeInputStylesOld = null;
|
|
32
|
+
var nativeInputStyles = null;
|
|
27
33
|
var hidden = null;
|
|
28
34
|
var Input = function Input(props) {
|
|
29
35
|
var builtinCX = props.cx,
|
|
@@ -42,12 +48,31 @@ var Input = function Input(props) {
|
|
|
42
48
|
}),
|
|
43
49
|
css = _getStyleProps.css,
|
|
44
50
|
className = _getStyleProps.className;
|
|
51
|
+
if ((0, _platformFeatureFlags.fg)('platform_do_not_clear_input_for_multiselect')) {
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
54
|
+
style: css
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
56
|
+
,
|
|
57
|
+
className: (0, _runtime.ax)([inputStyles.root, isDisabled && inputStyles.disabled, (0, _react2.cx)(className, xcss, '-Input')]),
|
|
58
|
+
"data-value": value || '',
|
|
59
|
+
"data-testid": dataId && "".concat(dataId, "-container")
|
|
60
|
+
}, /*#__PURE__*/React.createElement("input", (0, _extends2.default)({
|
|
61
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
62
|
+
className: (0, _runtime.ax)(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1r04idpf _11q7idpf _19itidpf _11c81kw7 _nd5l1yjy _12ji1r31 _1qu2glyw _12y3idpf _1bsb1osq _1ul9yh40 _kqswstnw _syaz1kw7 _tzy4kb7n", isHidden && "_tzy4idpf", builtinCX({
|
|
63
|
+
input: true
|
|
64
|
+
}, inputClassName, '-input')]),
|
|
65
|
+
ref: innerRef,
|
|
66
|
+
disabled: isDisabled,
|
|
67
|
+
"data-testid": dataId
|
|
68
|
+
}, innerProps)));
|
|
69
|
+
}
|
|
45
70
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
47
72
|
style: css
|
|
48
73
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
49
74
|
,
|
|
50
|
-
className: (0, _runtime.ax)([
|
|
75
|
+
className: (0, _runtime.ax)([inputStylesOld.root, isDisabled && inputStylesOld.disabled, (0, _react2.cx)(className, xcss, '-Input')]),
|
|
51
76
|
"data-value": value || '',
|
|
52
77
|
"data-testid": dataId && "".concat(dataId, "-container")
|
|
53
78
|
}, /*#__PURE__*/React.createElement("input", (0, _extends2.default)({
|
package/dist/cjs/select.js
CHANGED
|
@@ -52,7 +52,6 @@ var defaultProps = exports.defaultProps = {
|
|
|
52
52
|
isMulti: false,
|
|
53
53
|
isRtl: false,
|
|
54
54
|
isSearchable: true,
|
|
55
|
-
hasOtherFocusableElements: false,
|
|
56
55
|
isOptionDisabled: _builtins.isOptionDisabled,
|
|
57
56
|
loadingMessage: function loadingMessage() {
|
|
58
57
|
return 'Loading...';
|
|
@@ -258,7 +257,6 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
258
257
|
(0, _defineProperty2.default)(_this, "initialTouchY", 0);
|
|
259
258
|
(0, _defineProperty2.default)(_this, "openAfterFocus", false);
|
|
260
259
|
(0, _defineProperty2.default)(_this, "scrollToFocusedOptionOnUpdate", false);
|
|
261
|
-
(0, _defineProperty2.default)(_this, "lastPressedKey", '');
|
|
262
260
|
// Refs
|
|
263
261
|
// ------------------------------
|
|
264
262
|
(0, _defineProperty2.default)(_this, "controlRef", null);
|
|
@@ -293,10 +291,18 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
293
291
|
closeMenuOnSelect = _this$props2.closeMenuOnSelect,
|
|
294
292
|
isMulti = _this$props2.isMulti,
|
|
295
293
|
inputValue = _this$props2.inputValue;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
294
|
+
// for multiple selection options, do not clear the search input value
|
|
295
|
+
if (isMulti && (0, _platformFeatureFlags.fg)('platform_do_not_clear_input_for_multiselect')) {
|
|
296
|
+
_this.onInputChange(inputValue, {
|
|
297
|
+
action: 'set-value',
|
|
298
|
+
prevInputValue: inputValue
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
_this.onInputChange('', {
|
|
302
|
+
action: 'set-value',
|
|
303
|
+
prevInputValue: inputValue
|
|
304
|
+
});
|
|
305
|
+
}
|
|
300
306
|
if (closeMenuOnSelect) {
|
|
301
307
|
_this.setState({
|
|
302
308
|
inputIsHiddenAfterUpdate: !isMulti
|
|
@@ -632,9 +638,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
632
638
|
return;
|
|
633
639
|
}
|
|
634
640
|
if (_this.props.onBlur) {
|
|
635
|
-
|
|
636
|
-
_this.props.onBlur(event);
|
|
637
|
-
}
|
|
641
|
+
_this.props.onBlur(event);
|
|
638
642
|
}
|
|
639
643
|
_this.onInputChange('', {
|
|
640
644
|
action: 'input-blur',
|
|
@@ -700,9 +704,6 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
700
704
|
return;
|
|
701
705
|
}
|
|
702
706
|
}
|
|
703
|
-
if (_this.props.hasOtherFocusableElements) {
|
|
704
|
-
_this.lastPressedKey = event.key;
|
|
705
|
-
}
|
|
706
707
|
|
|
707
708
|
// Block option hover events when the user has just pressed a key
|
|
708
709
|
_this.blockOptionHover = true;
|
|
@@ -928,15 +929,11 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
928
929
|
}, {
|
|
929
930
|
key: "onMenuClose",
|
|
930
931
|
value: function onMenuClose() {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
this.props.onMenuClose();
|
|
937
|
-
} else {
|
|
938
|
-
this.lastPressedKey = '';
|
|
939
|
-
}
|
|
932
|
+
this.onInputChange('', {
|
|
933
|
+
action: 'menu-close',
|
|
934
|
+
prevInputValue: this.props.inputValue
|
|
935
|
+
});
|
|
936
|
+
this.props.onMenuClose();
|
|
940
937
|
}
|
|
941
938
|
}, {
|
|
942
939
|
key: "onInputChange",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
._11q7idpf{background:0}
|
|
3
3
|
._19itidpf{border:0}
|
|
4
4
|
._1h9u1kw7:after{font:inherit}
|
|
5
|
+
._1r04idpf{inset:0}
|
|
5
6
|
._ckog1yjy:after{grid-area:1/2}
|
|
6
7
|
._eq43idpf:after{border:0}
|
|
7
8
|
._nd5l1sux{grid-area:1/1/2/3}
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
._1bsb1osq{width:100%}
|
|
20
21
|
._1doyidpf:after{margin-bottom:0}
|
|
21
22
|
._1e0c1n7u{display:inline-grid}
|
|
23
|
+
._1e0c1txw{display:flex}
|
|
22
24
|
._1k96idpf:after{padding-left:0}
|
|
23
25
|
._1nn4glyw:after{outline-style:none}
|
|
24
26
|
._1o9zkb7n{flex-shrink:1}
|
|
@@ -36,6 +38,8 @@
|
|
|
36
38
|
._ca0qidpf{padding-top:0}
|
|
37
39
|
._i0dl1wug{flex-basis:auto}
|
|
38
40
|
._j8d6idpf:after{margin-top:0}
|
|
41
|
+
._kqswh2mm{position:relative}
|
|
42
|
+
._kqswstnw{position:absolute}
|
|
39
43
|
._n3tdidpf{padding-bottom:0}
|
|
40
44
|
._otyridpf{margin-bottom:0}
|
|
41
45
|
._pfztidpf:after{margin-left:0}
|
|
@@ -4,13 +4,19 @@ import "./input.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { cx } from '@compiled/react';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
8
9
|
export const inputCSS = () => ({});
|
|
9
|
-
const
|
|
10
|
+
const inputStylesOld = {
|
|
10
11
|
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _1e0c1n7u _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
11
12
|
disabled: "_3um015vq"
|
|
12
13
|
};
|
|
13
|
-
const
|
|
14
|
+
const inputStyles = {
|
|
15
|
+
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _kqswh2mm _1e0c1txw _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
16
|
+
disabled: "_3um015vq"
|
|
17
|
+
};
|
|
18
|
+
const nativeInputStylesOld = null;
|
|
19
|
+
const nativeInputStyles = null;
|
|
14
20
|
const hidden = null;
|
|
15
21
|
const Input = props => {
|
|
16
22
|
const {
|
|
@@ -33,12 +39,31 @@ const Input = props => {
|
|
|
33
39
|
} = getStyleProps(props, 'input', {
|
|
34
40
|
'input-container': true
|
|
35
41
|
});
|
|
42
|
+
if (fg('platform_do_not_clear_input_for_multiselect')) {
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
+
style: css
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
47
|
+
,
|
|
48
|
+
className: ax([inputStyles.root, isDisabled && inputStyles.disabled, cx(className, xcss, '-Input')]),
|
|
49
|
+
"data-value": value || '',
|
|
50
|
+
"data-testid": dataId && `${dataId}-container`
|
|
51
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
53
|
+
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1r04idpf _11q7idpf _19itidpf _11c81kw7 _nd5l1yjy _12ji1r31 _1qu2glyw _12y3idpf _1bsb1osq _1ul9yh40 _kqswstnw _syaz1kw7 _tzy4kb7n", isHidden && "_tzy4idpf", builtinCX({
|
|
54
|
+
input: true
|
|
55
|
+
}, inputClassName, '-input')]),
|
|
56
|
+
ref: innerRef,
|
|
57
|
+
disabled: isDisabled,
|
|
58
|
+
"data-testid": dataId
|
|
59
|
+
}, innerProps)));
|
|
60
|
+
}
|
|
36
61
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
62
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
38
63
|
style: css
|
|
39
64
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
40
65
|
,
|
|
41
|
-
className: ax([
|
|
66
|
+
className: ax([inputStylesOld.root, isDisabled && inputStylesOld.disabled, cx(className, xcss, '-Input')]),
|
|
42
67
|
"data-value": value || '',
|
|
43
68
|
"data-testid": dataId && `${dataId}-container`
|
|
44
69
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
package/dist/es2019/select.js
CHANGED
|
@@ -31,7 +31,6 @@ export const defaultProps = {
|
|
|
31
31
|
isMulti: false,
|
|
32
32
|
isRtl: false,
|
|
33
33
|
isSearchable: true,
|
|
34
|
-
hasOtherFocusableElements: false,
|
|
35
34
|
isOptionDisabled: isOptionDisabledBuiltin,
|
|
36
35
|
loadingMessage: () => 'Loading...',
|
|
37
36
|
maxMenuHeight: 300,
|
|
@@ -227,7 +226,6 @@ export default class Select extends Component {
|
|
|
227
226
|
_defineProperty(this, "initialTouchY", 0);
|
|
228
227
|
_defineProperty(this, "openAfterFocus", false);
|
|
229
228
|
_defineProperty(this, "scrollToFocusedOptionOnUpdate", false);
|
|
230
|
-
_defineProperty(this, "lastPressedKey", '');
|
|
231
229
|
// Refs
|
|
232
230
|
// ------------------------------
|
|
233
231
|
_defineProperty(this, "controlRef", null);
|
|
@@ -264,10 +262,18 @@ export default class Select extends Component {
|
|
|
264
262
|
isMulti,
|
|
265
263
|
inputValue
|
|
266
264
|
} = this.props;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
// for multiple selection options, do not clear the search input value
|
|
266
|
+
if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
|
|
267
|
+
this.onInputChange(inputValue, {
|
|
268
|
+
action: 'set-value',
|
|
269
|
+
prevInputValue: inputValue
|
|
270
|
+
});
|
|
271
|
+
} else {
|
|
272
|
+
this.onInputChange('', {
|
|
273
|
+
action: 'set-value',
|
|
274
|
+
prevInputValue: inputValue
|
|
275
|
+
});
|
|
276
|
+
}
|
|
271
277
|
if (closeMenuOnSelect) {
|
|
272
278
|
this.setState({
|
|
273
279
|
inputIsHiddenAfterUpdate: !isMulti
|
|
@@ -605,9 +611,7 @@ export default class Select extends Component {
|
|
|
605
611
|
return;
|
|
606
612
|
}
|
|
607
613
|
if (this.props.onBlur) {
|
|
608
|
-
|
|
609
|
-
this.props.onBlur(event);
|
|
610
|
-
}
|
|
614
|
+
this.props.onBlur(event);
|
|
611
615
|
}
|
|
612
616
|
this.onInputChange('', {
|
|
613
617
|
action: 'input-blur',
|
|
@@ -675,9 +679,6 @@ export default class Select extends Component {
|
|
|
675
679
|
return;
|
|
676
680
|
}
|
|
677
681
|
}
|
|
678
|
-
if (this.props.hasOtherFocusableElements) {
|
|
679
|
-
this.lastPressedKey = event.key;
|
|
680
|
-
}
|
|
681
682
|
|
|
682
683
|
// Block option hover events when the user has just pressed a key
|
|
683
684
|
this.blockOptionHover = true;
|
|
@@ -960,15 +961,11 @@ export default class Select extends Component {
|
|
|
960
961
|
this.props.onMenuOpen();
|
|
961
962
|
}
|
|
962
963
|
onMenuClose() {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
this.props.onMenuClose();
|
|
969
|
-
} else {
|
|
970
|
-
this.lastPressedKey = '';
|
|
971
|
-
}
|
|
964
|
+
this.onInputChange('', {
|
|
965
|
+
action: 'menu-close',
|
|
966
|
+
prevInputValue: this.props.inputValue
|
|
967
|
+
});
|
|
968
|
+
this.props.onMenuClose();
|
|
972
969
|
}
|
|
973
970
|
onInputChange(newValue, actionMeta) {
|
|
974
971
|
this.props.onInputChange(newValue, actionMeta);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
._11q7idpf{background:0}
|
|
3
3
|
._19itidpf{border:0}
|
|
4
4
|
._1h9u1kw7:after{font:inherit}
|
|
5
|
+
._1r04idpf{inset:0}
|
|
5
6
|
._ckog1yjy:after{grid-area:1/2}
|
|
6
7
|
._eq43idpf:after{border:0}
|
|
7
8
|
._nd5l1sux{grid-area:1/1/2/3}
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
._1bsb1osq{width:100%}
|
|
20
21
|
._1doyidpf:after{margin-bottom:0}
|
|
21
22
|
._1e0c1n7u{display:inline-grid}
|
|
23
|
+
._1e0c1txw{display:flex}
|
|
22
24
|
._1k96idpf:after{padding-left:0}
|
|
23
25
|
._1nn4glyw:after{outline-style:none}
|
|
24
26
|
._1o9zkb7n{flex-shrink:1}
|
|
@@ -36,6 +38,8 @@
|
|
|
36
38
|
._ca0qidpf{padding-top:0}
|
|
37
39
|
._i0dl1wug{flex-basis:auto}
|
|
38
40
|
._j8d6idpf:after{margin-top:0}
|
|
41
|
+
._kqswh2mm{position:relative}
|
|
42
|
+
._kqswstnw{position:absolute}
|
|
39
43
|
._n3tdidpf{padding-bottom:0}
|
|
40
44
|
._otyridpf{margin-bottom:0}
|
|
41
45
|
._pfztidpf:after{margin-left:0}
|
|
@@ -6,15 +6,21 @@ import "./input.compiled.css";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { cx } from '@compiled/react';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
10
11
|
export var inputCSS = function inputCSS() {
|
|
11
12
|
return {};
|
|
12
13
|
};
|
|
13
|
-
var
|
|
14
|
+
var inputStylesOld = {
|
|
14
15
|
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _1e0c1n7u _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
15
16
|
disabled: "_3um015vq"
|
|
16
17
|
};
|
|
17
|
-
var
|
|
18
|
+
var inputStyles = {
|
|
19
|
+
root: "_16jlkb7n _1o9zkb7n _i0dl1wug _nd5l1sux _1mouv77o _195gv77o _1rjcv77o _kqswh2mm _1e0c1txw _yv0e12qd _syaz1fxt _j8d6idpf _1av2idpf _1doyidpf _pfztidpf _uoe3idpf _1recidpf _70xridpf _1k96idpf _eq43idpf _1h9u1kw7 _ckog1yjy _1x651r31 _1nn4glyw _1rzeidpf _1yd8yh40 _aetr11ps _uy7x15vq _1qjlqvpr",
|
|
20
|
+
disabled: "_3um015vq"
|
|
21
|
+
};
|
|
22
|
+
var nativeInputStylesOld = null;
|
|
23
|
+
var nativeInputStyles = null;
|
|
18
24
|
var hidden = null;
|
|
19
25
|
var Input = function Input(props) {
|
|
20
26
|
var builtinCX = props.cx,
|
|
@@ -33,12 +39,31 @@ var Input = function Input(props) {
|
|
|
33
39
|
}),
|
|
34
40
|
css = _getStyleProps.css,
|
|
35
41
|
className = _getStyleProps.className;
|
|
42
|
+
if (fg('platform_do_not_clear_input_for_multiselect')) {
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
+
style: css
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
47
|
+
,
|
|
48
|
+
className: ax([inputStyles.root, isDisabled && inputStyles.disabled, cx(className, xcss, '-Input')]),
|
|
49
|
+
"data-value": value || '',
|
|
50
|
+
"data-testid": dataId && "".concat(dataId, "-container")
|
|
51
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
53
|
+
className: ax(["_19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1r04idpf _11q7idpf _19itidpf _11c81kw7 _nd5l1yjy _12ji1r31 _1qu2glyw _12y3idpf _1bsb1osq _1ul9yh40 _kqswstnw _syaz1kw7 _tzy4kb7n", isHidden && "_tzy4idpf", builtinCX({
|
|
54
|
+
input: true
|
|
55
|
+
}, inputClassName, '-input')]),
|
|
56
|
+
ref: innerRef,
|
|
57
|
+
disabled: isDisabled,
|
|
58
|
+
"data-testid": dataId
|
|
59
|
+
}, innerProps)));
|
|
60
|
+
}
|
|
36
61
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
62
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
38
63
|
style: css
|
|
39
64
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
40
65
|
,
|
|
41
|
-
className: ax([
|
|
66
|
+
className: ax([inputStylesOld.root, isDisabled && inputStylesOld.disabled, cx(className, xcss, '-Input')]),
|
|
42
67
|
"data-value": value || '',
|
|
43
68
|
"data-testid": dataId && "".concat(dataId, "-container")
|
|
44
69
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
package/dist/esm/select.js
CHANGED
|
@@ -43,7 +43,6 @@ export var defaultProps = {
|
|
|
43
43
|
isMulti: false,
|
|
44
44
|
isRtl: false,
|
|
45
45
|
isSearchable: true,
|
|
46
|
-
hasOtherFocusableElements: false,
|
|
47
46
|
isOptionDisabled: isOptionDisabledBuiltin,
|
|
48
47
|
loadingMessage: function loadingMessage() {
|
|
49
48
|
return 'Loading...';
|
|
@@ -249,7 +248,6 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
249
248
|
_defineProperty(_this, "initialTouchY", 0);
|
|
250
249
|
_defineProperty(_this, "openAfterFocus", false);
|
|
251
250
|
_defineProperty(_this, "scrollToFocusedOptionOnUpdate", false);
|
|
252
|
-
_defineProperty(_this, "lastPressedKey", '');
|
|
253
251
|
// Refs
|
|
254
252
|
// ------------------------------
|
|
255
253
|
_defineProperty(_this, "controlRef", null);
|
|
@@ -284,10 +282,18 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
284
282
|
closeMenuOnSelect = _this$props2.closeMenuOnSelect,
|
|
285
283
|
isMulti = _this$props2.isMulti,
|
|
286
284
|
inputValue = _this$props2.inputValue;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
// for multiple selection options, do not clear the search input value
|
|
286
|
+
if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
|
|
287
|
+
_this.onInputChange(inputValue, {
|
|
288
|
+
action: 'set-value',
|
|
289
|
+
prevInputValue: inputValue
|
|
290
|
+
});
|
|
291
|
+
} else {
|
|
292
|
+
_this.onInputChange('', {
|
|
293
|
+
action: 'set-value',
|
|
294
|
+
prevInputValue: inputValue
|
|
295
|
+
});
|
|
296
|
+
}
|
|
291
297
|
if (closeMenuOnSelect) {
|
|
292
298
|
_this.setState({
|
|
293
299
|
inputIsHiddenAfterUpdate: !isMulti
|
|
@@ -623,9 +629,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
623
629
|
return;
|
|
624
630
|
}
|
|
625
631
|
if (_this.props.onBlur) {
|
|
626
|
-
|
|
627
|
-
_this.props.onBlur(event);
|
|
628
|
-
}
|
|
632
|
+
_this.props.onBlur(event);
|
|
629
633
|
}
|
|
630
634
|
_this.onInputChange('', {
|
|
631
635
|
action: 'input-blur',
|
|
@@ -691,9 +695,6 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
691
695
|
return;
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
|
-
if (_this.props.hasOtherFocusableElements) {
|
|
695
|
-
_this.lastPressedKey = event.key;
|
|
696
|
-
}
|
|
697
698
|
|
|
698
699
|
// Block option hover events when the user has just pressed a key
|
|
699
700
|
_this.blockOptionHover = true;
|
|
@@ -919,15 +920,11 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
919
920
|
}, {
|
|
920
921
|
key: "onMenuClose",
|
|
921
922
|
value: function onMenuClose() {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
this.props.onMenuClose();
|
|
928
|
-
} else {
|
|
929
|
-
this.lastPressedKey = '';
|
|
930
|
-
}
|
|
923
|
+
this.onInputChange('', {
|
|
924
|
+
action: 'menu-close',
|
|
925
|
+
prevInputValue: this.props.inputValue
|
|
926
|
+
});
|
|
927
|
+
this.props.onMenuClose();
|
|
931
928
|
}
|
|
932
929
|
}, {
|
|
933
930
|
key: "onInputChange",
|
package/dist/types/select.d.ts
CHANGED
|
@@ -240,10 +240,6 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
240
240
|
* Whether to enable search functionality
|
|
241
241
|
*/
|
|
242
242
|
isSearchable: boolean;
|
|
243
|
-
/**
|
|
244
|
-
* Indicate whether menu contains other focusable elements, like footer or header
|
|
245
|
-
*/
|
|
246
|
-
hasOtherFocusableElements?: boolean;
|
|
247
243
|
/**
|
|
248
244
|
* This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
249
245
|
*/
|
|
@@ -453,7 +449,6 @@ export declare const defaultProps: {
|
|
|
453
449
|
isMulti: boolean;
|
|
454
450
|
isRtl: boolean;
|
|
455
451
|
isSearchable: boolean;
|
|
456
|
-
hasOtherFocusableElements: boolean;
|
|
457
452
|
isOptionDisabled: <Option>(option: Option) => boolean;
|
|
458
453
|
loadingMessage: () => string;
|
|
459
454
|
maxMenuHeight: number;
|
|
@@ -533,7 +528,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
533
528
|
isMulti: boolean;
|
|
534
529
|
isRtl: boolean;
|
|
535
530
|
isSearchable: boolean;
|
|
536
|
-
hasOtherFocusableElements: boolean;
|
|
537
531
|
isOptionDisabled: <Option_1>(option: Option_1) => boolean;
|
|
538
532
|
loadingMessage: () => string;
|
|
539
533
|
maxMenuHeight: number;
|
|
@@ -566,7 +560,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
566
560
|
openAfterFocus: boolean;
|
|
567
561
|
scrollToFocusedOptionOnUpdate: boolean;
|
|
568
562
|
userIsDragging?: boolean;
|
|
569
|
-
lastPressedKey?: string;
|
|
570
563
|
controlRef: HTMLDivElement | null;
|
|
571
564
|
getControlRef: RefCallback<HTMLDivElement>;
|
|
572
565
|
focusedOptionRef: HTMLDivElement | null;
|
|
@@ -240,10 +240,6 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
240
240
|
* Whether to enable search functionality
|
|
241
241
|
*/
|
|
242
242
|
isSearchable: boolean;
|
|
243
|
-
/**
|
|
244
|
-
* Indicate whether menu contains other focusable elements, like footer or header
|
|
245
|
-
*/
|
|
246
|
-
hasOtherFocusableElements?: boolean;
|
|
247
243
|
/**
|
|
248
244
|
* This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
249
245
|
*/
|
|
@@ -453,7 +449,6 @@ export declare const defaultProps: {
|
|
|
453
449
|
isMulti: boolean;
|
|
454
450
|
isRtl: boolean;
|
|
455
451
|
isSearchable: boolean;
|
|
456
|
-
hasOtherFocusableElements: boolean;
|
|
457
452
|
isOptionDisabled: <Option>(option: Option) => boolean;
|
|
458
453
|
loadingMessage: () => string;
|
|
459
454
|
maxMenuHeight: number;
|
|
@@ -533,7 +528,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
533
528
|
isMulti: boolean;
|
|
534
529
|
isRtl: boolean;
|
|
535
530
|
isSearchable: boolean;
|
|
536
|
-
hasOtherFocusableElements: boolean;
|
|
537
531
|
isOptionDisabled: <Option_1>(option: Option_1) => boolean;
|
|
538
532
|
loadingMessage: () => string;
|
|
539
533
|
maxMenuHeight: number;
|
|
@@ -566,7 +560,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
566
560
|
openAfterFocus: boolean;
|
|
567
561
|
scrollToFocusedOptionOnUpdate: boolean;
|
|
568
562
|
userIsDragging?: boolean;
|
|
569
|
-
lastPressedKey?: string;
|
|
570
563
|
controlRef: HTMLDivElement | null;
|
|
571
564
|
getControlRef: RefCallback<HTMLDivElement>;
|
|
572
565
|
focusedOptionRef: HTMLDivElement | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-select",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"description": "A forked version of react-select to only be used in atlaskit/select",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/ds-lib": "^5.0.0",
|
|
32
|
-
"@atlaskit/icon": "^27.
|
|
32
|
+
"@atlaskit/icon": "^27.12.0",
|
|
33
33
|
"@atlaskit/layering": "^3.0.0",
|
|
34
34
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
35
|
"@atlaskit/primitives": "^14.11.0",
|
|
@@ -65,6 +65,9 @@
|
|
|
65
65
|
},
|
|
66
66
|
"platform_dst_select_menu_close_on_blur": {
|
|
67
67
|
"type": "boolean"
|
|
68
|
+
},
|
|
69
|
+
"platform_do_not_clear_input_for_multiselect": {
|
|
70
|
+
"type": "boolean"
|
|
68
71
|
}
|
|
69
72
|
},
|
|
70
73
|
"techstack": {
|