@atlaskit/react-select 3.4.2 → 3.4.3

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 3.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#200709](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200709)
8
+ [`4e4c55892eecf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4e4c55892eecf) -
9
+ [ux] Prevent input from being cleared from selecting an option with multi-select enabled and fix
10
+ cursor in search field
11
+ - Updated dependencies
12
+
3
13
  ## 3.4.2
4
14
 
5
15
  ### Patch Changes
@@ -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 inputStyles = {
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 nativeInnputStyles = null;
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)([inputStyles.root, isDisabled && inputStyles.disabled, (0, _react2.cx)(className, xcss, '-Input')]),
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)({
@@ -293,10 +293,18 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
293
293
  closeMenuOnSelect = _this$props2.closeMenuOnSelect,
294
294
  isMulti = _this$props2.isMulti,
295
295
  inputValue = _this$props2.inputValue;
296
- _this.onInputChange('', {
297
- action: 'set-value',
298
- prevInputValue: inputValue
299
- });
296
+ // for multiple selection options, do not clear the search input value
297
+ if (isMulti && (0, _platformFeatureFlags.fg)('platform_do_not_clear_input_for_multiselect')) {
298
+ _this.onInputChange(inputValue, {
299
+ action: 'set-value',
300
+ prevInputValue: inputValue
301
+ });
302
+ } else {
303
+ _this.onInputChange('', {
304
+ action: 'set-value',
305
+ prevInputValue: inputValue
306
+ });
307
+ }
300
308
  if (closeMenuOnSelect) {
301
309
  _this.setState({
302
310
  inputIsHiddenAfterUpdate: !isMulti
@@ -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 inputStyles = {
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 nativeInnputStyles = null;
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([inputStyles.root, isDisabled && inputStyles.disabled, cx(className, xcss, '-Input')]),
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({
@@ -264,10 +264,18 @@ export default class Select extends Component {
264
264
  isMulti,
265
265
  inputValue
266
266
  } = this.props;
267
- this.onInputChange('', {
268
- action: 'set-value',
269
- prevInputValue: inputValue
270
- });
267
+ // for multiple selection options, do not clear the search input value
268
+ if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
269
+ this.onInputChange(inputValue, {
270
+ action: 'set-value',
271
+ prevInputValue: inputValue
272
+ });
273
+ } else {
274
+ this.onInputChange('', {
275
+ action: 'set-value',
276
+ prevInputValue: inputValue
277
+ });
278
+ }
271
279
  if (closeMenuOnSelect) {
272
280
  this.setState({
273
281
  inputIsHiddenAfterUpdate: !isMulti
@@ -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 inputStyles = {
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 nativeInnputStyles = null;
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([inputStyles.root, isDisabled && inputStyles.disabled, cx(className, xcss, '-Input')]),
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({
@@ -284,10 +284,18 @@ var Select = /*#__PURE__*/function (_Component) {
284
284
  closeMenuOnSelect = _this$props2.closeMenuOnSelect,
285
285
  isMulti = _this$props2.isMulti,
286
286
  inputValue = _this$props2.inputValue;
287
- _this.onInputChange('', {
288
- action: 'set-value',
289
- prevInputValue: inputValue
290
- });
287
+ // for multiple selection options, do not clear the search input value
288
+ if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
289
+ _this.onInputChange(inputValue, {
290
+ action: 'set-value',
291
+ prevInputValue: inputValue
292
+ });
293
+ } else {
294
+ _this.onInputChange('', {
295
+ action: 'set-value',
296
+ prevInputValue: inputValue
297
+ });
298
+ }
291
299
  if (closeMenuOnSelect) {
292
300
  _this.setState({
293
301
  inputIsHiddenAfterUpdate: !isMulti
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
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.11.0",
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": {