@atlaskit/react-select 3.5.4 → 3.6.1

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,21 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 3.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`248faa32d4835`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/248faa32d4835) -
8
+ Internal changes to how borders are applied.
9
+ - Updated dependencies
10
+
11
+ ## 3.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`153fad932190f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/153fad932190f) -
16
+ [ux] Added a new prop shouldKeepInputOnSelect to the select component to prevent clearing the
17
+ input when isMulti is true
18
+
3
19
  ## 3.5.4
4
20
 
5
21
  ### Patch Changes
@@ -19,4 +19,4 @@
19
19
  ._1di619ru:active{background-color:var(--ds-background-selected-pressed,#85b8ff)}
20
20
  ._1di61dty:active{background-color:var(--ds-background-neutral-subtle-pressed,#091e4224)}
21
21
  ._1di61j28:active{background-color:transparent}
22
- @media screen and (-ms-high-contrast:active){._1pkn1vrj{border-left:2px solid transparent}._1pknglyw{border-left:none}}
22
+ @media screen and (-ms-high-contrast:active){._112e5u6v{border-inline-start:var(--ds-border-width-selected,2px) solid transparent}._112eglyw{border-inline-start:none}}
@@ -19,9 +19,9 @@ var optionCSS = exports.optionCSS = function optionCSS() {
19
19
  };
20
20
  var optionStyles = {
21
21
  root: "_1rjc12x7 _18zrutpp _syaz1fxt _80om73ad _1e0c1ule _1wyb1kw7 _1bsb1osq _uiztglyw _18ql1j7p _1di61dty",
22
- disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _1pknglyw",
23
- focused: "_bfhk166n _16qsu4to _1pkn1vrj",
24
- selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _1pkn1vrj",
22
+ disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _112eglyw",
23
+ focused: "_bfhk166n _16qsu4to _112e5u6v",
24
+ selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _112e5u6v",
25
25
  focusedSelected: "_bfhki1yw"
26
26
  };
27
27
  var Option = function Option(props) {
@@ -79,7 +79,8 @@ var defaultProps = exports.defaultProps = {
79
79
  styles: {},
80
80
  tabIndex: 0,
81
81
  tabSelectsValue: true,
82
- UNSAFE_is_experimental_generic: false
82
+ UNSAFE_is_experimental_generic: false,
83
+ shouldKeepInputOnSelect: false
83
84
  };
84
85
  function toCategorizedOption(props, option, selectValue, index) {
85
86
  var isDisabled = _isOptionDisabled(props, option, selectValue);
@@ -291,9 +292,10 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
291
292
  var _this$props2 = _this.props,
292
293
  closeMenuOnSelect = _this$props2.closeMenuOnSelect,
293
294
  isMulti = _this$props2.isMulti,
294
- inputValue = _this$props2.inputValue;
295
+ inputValue = _this$props2.inputValue,
296
+ shouldKeepInputOnSelect = _this$props2.shouldKeepInputOnSelect;
295
297
  // for multiple selection options, do not clear the search input value
296
- if (isMulti && (0, _platformFeatureFlags.fg)('platform_do_not_clear_input_for_multiselect')) {
298
+ if (isMulti && shouldKeepInputOnSelect && (0, _platformFeatureFlags.fg)('platform_do_not_clear_input_for_multiselect')) {
297
299
  _this.onInputChange(inputValue, {
298
300
  action: 'set-value',
299
301
  prevInputValue: inputValue
@@ -19,4 +19,4 @@
19
19
  ._1di619ru:active{background-color:var(--ds-background-selected-pressed,#85b8ff)}
20
20
  ._1di61dty:active{background-color:var(--ds-background-neutral-subtle-pressed,#091e4224)}
21
21
  ._1di61j28:active{background-color:transparent}
22
- @media screen and (-ms-high-contrast:active){._1pkn1vrj{border-left:2px solid transparent}._1pknglyw{border-left:none}}
22
+ @media screen and (-ms-high-contrast:active){._112e5u6v{border-inline-start:var(--ds-border-width-selected,2px) solid transparent}._112eglyw{border-inline-start:none}}
@@ -8,9 +8,9 @@ import { getStyleProps } from '../utils';
8
8
  export const optionCSS = () => ({});
9
9
  const optionStyles = {
10
10
  root: "_1rjc12x7 _18zrutpp _syaz1fxt _80om73ad _1e0c1ule _1wyb1kw7 _1bsb1osq _uiztglyw _18ql1j7p _1di61dty",
11
- disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _1pknglyw",
12
- focused: "_bfhk166n _16qsu4to _1pkn1vrj",
13
- selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _1pkn1vrj",
11
+ disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _112eglyw",
12
+ focused: "_bfhk166n _16qsu4to _112e5u6v",
13
+ selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _112e5u6v",
14
14
  focusedSelected: "_bfhki1yw"
15
15
  };
16
16
  const Option = props => {
@@ -53,7 +53,8 @@ export const defaultProps = {
53
53
  styles: {},
54
54
  tabIndex: 0,
55
55
  tabSelectsValue: true,
56
- UNSAFE_is_experimental_generic: false
56
+ UNSAFE_is_experimental_generic: false,
57
+ shouldKeepInputOnSelect: false
57
58
  };
58
59
  function toCategorizedOption(props, option, selectValue, index) {
59
60
  const isDisabled = isOptionDisabled(props, option, selectValue);
@@ -261,10 +262,11 @@ export default class Select extends Component {
261
262
  const {
262
263
  closeMenuOnSelect,
263
264
  isMulti,
264
- inputValue
265
+ inputValue,
266
+ shouldKeepInputOnSelect
265
267
  } = this.props;
266
268
  // for multiple selection options, do not clear the search input value
267
- if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
269
+ if (isMulti && shouldKeepInputOnSelect && fg('platform_do_not_clear_input_for_multiselect')) {
268
270
  this.onInputChange(inputValue, {
269
271
  action: 'set-value',
270
272
  prevInputValue: inputValue
@@ -19,4 +19,4 @@
19
19
  ._1di619ru:active{background-color:var(--ds-background-selected-pressed,#85b8ff)}
20
20
  ._1di61dty:active{background-color:var(--ds-background-neutral-subtle-pressed,#091e4224)}
21
21
  ._1di61j28:active{background-color:transparent}
22
- @media screen and (-ms-high-contrast:active){._1pkn1vrj{border-left:2px solid transparent}._1pknglyw{border-left:none}}
22
+ @media screen and (-ms-high-contrast:active){._112e5u6v{border-inline-start:var(--ds-border-width-selected,2px) solid transparent}._112eglyw{border-inline-start:none}}
@@ -10,9 +10,9 @@ export var optionCSS = function optionCSS() {
10
10
  };
11
11
  var optionStyles = {
12
12
  root: "_1rjc12x7 _18zrutpp _syaz1fxt _80om73ad _1e0c1ule _1wyb1kw7 _1bsb1osq _uiztglyw _18ql1j7p _1di61dty",
13
- disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _1pknglyw",
14
- focused: "_bfhk166n _16qsu4to _1pkn1vrj",
15
- selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _1pkn1vrj",
13
+ disabled: "_syaz1lh4 _80om13gf _bfhk1j28 _16qsglyw _1di61j28 _112eglyw",
14
+ focused: "_bfhk166n _16qsu4to _112e5u6v",
15
+ selected: "_syazaqb7 _bfhkfg4m _16qsu4to _1di619ru _112e5u6v",
16
16
  focusedSelected: "_bfhki1yw"
17
17
  };
18
18
  var Option = function Option(props) {
@@ -70,7 +70,8 @@ export var defaultProps = {
70
70
  styles: {},
71
71
  tabIndex: 0,
72
72
  tabSelectsValue: true,
73
- UNSAFE_is_experimental_generic: false
73
+ UNSAFE_is_experimental_generic: false,
74
+ shouldKeepInputOnSelect: false
74
75
  };
75
76
  function toCategorizedOption(props, option, selectValue, index) {
76
77
  var isDisabled = _isOptionDisabled(props, option, selectValue);
@@ -282,9 +283,10 @@ var Select = /*#__PURE__*/function (_Component) {
282
283
  var _this$props2 = _this.props,
283
284
  closeMenuOnSelect = _this$props2.closeMenuOnSelect,
284
285
  isMulti = _this$props2.isMulti,
285
- inputValue = _this$props2.inputValue;
286
+ inputValue = _this$props2.inputValue,
287
+ shouldKeepInputOnSelect = _this$props2.shouldKeepInputOnSelect;
286
288
  // for multiple selection options, do not clear the search input value
287
- if (isMulti && fg('platform_do_not_clear_input_for_multiselect')) {
289
+ if (isMulti && shouldKeepInputOnSelect && fg('platform_do_not_clear_input_for_multiselect')) {
288
290
  _this.onInputChange(inputValue, {
289
291
  action: 'set-value',
290
292
  prevInputValue: inputValue
@@ -433,6 +433,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
433
433
  appearance: 'default' | 'subtle' | 'none';
434
434
  [key: string]: any;
435
435
  UNSAFE_is_experimental_generic?: boolean;
436
+ /**
437
+ * If `true`, the input value will be kept when an option is selected and isMulti is `true`. The default is `false`.
438
+ */
439
+ shouldKeepInputOnSelect?: boolean;
436
440
  }
437
441
  export declare const defaultProps: {
438
442
  backspaceRemovesValue: boolean;
@@ -476,6 +480,7 @@ export declare const defaultProps: {
476
480
  tabIndex: number;
477
481
  tabSelectsValue: boolean;
478
482
  UNSAFE_is_experimental_generic: boolean;
483
+ shouldKeepInputOnSelect: boolean;
479
484
  };
480
485
  interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
481
486
  ariaSelection: AriaSelection<Option, IsMulti> | null;
@@ -556,6 +561,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
556
561
  tabIndex: number;
557
562
  tabSelectsValue: boolean;
558
563
  UNSAFE_is_experimental_generic: boolean;
564
+ shouldKeepInputOnSelect: boolean;
559
565
  };
560
566
  state: State<Option, IsMulti, Group>;
561
567
  blockOptionHover: boolean;
@@ -433,6 +433,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
433
433
  appearance: 'default' | 'subtle' | 'none';
434
434
  [key: string]: any;
435
435
  UNSAFE_is_experimental_generic?: boolean;
436
+ /**
437
+ * If `true`, the input value will be kept when an option is selected and isMulti is `true`. The default is `false`.
438
+ */
439
+ shouldKeepInputOnSelect?: boolean;
436
440
  }
437
441
  export declare const defaultProps: {
438
442
  backspaceRemovesValue: boolean;
@@ -476,6 +480,7 @@ export declare const defaultProps: {
476
480
  tabIndex: number;
477
481
  tabSelectsValue: boolean;
478
482
  UNSAFE_is_experimental_generic: boolean;
483
+ shouldKeepInputOnSelect: boolean;
479
484
  };
480
485
  interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
481
486
  ariaSelection: AriaSelection<Option, IsMulti> | null;
@@ -556,6 +561,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
556
561
  tabIndex: number;
557
562
  tabSelectsValue: boolean;
558
563
  UNSAFE_is_experimental_generic: boolean;
564
+ shouldKeepInputOnSelect: boolean;
559
565
  };
560
566
  state: State<Option, IsMulti, Group>;
561
567
  blockOptionHover: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "3.5.4",
3
+ "version": "3.6.1",
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",
@@ -21,7 +21,7 @@
21
21
  "atlaskit:src": "src/index.tsx",
22
22
  "dependencies": {
23
23
  "@atlaskit/ds-lib": "^5.0.0",
24
- "@atlaskit/icon": "^28.1.0",
24
+ "@atlaskit/icon": "^28.2.0",
25
25
  "@atlaskit/layering": "^3.0.0",
26
26
  "@atlaskit/platform-feature-flags": "^1.1.0",
27
27
  "@atlaskit/primitives": "^14.14.0",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@atlaskit/checkbox": "^17.1.0",
42
- "@atlaskit/form": "^12.5.0",
42
+ "@atlaskit/form": "^12.7.0",
43
43
  "@atlassian/feature-flags-test-utils": "^0.3.0",
44
44
  "@testing-library/react": "^13.4.0",
45
45
  "@testing-library/user-event": "^14.4.3",