@atlaskit/react-select 3.4.4 → 3.5.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`782e1924230d5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/782e1924230d5) -
8
+ Introduced new optional "shouldPreventEscapePropagation" prop to prevent Escape keydown event
9
+ propagation
10
+
11
+ ## 3.4.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 3.4.4
4
18
 
5
19
  ### Patch Changes
@@ -68,6 +68,7 @@ var defaultProps = exports.defaultProps = {
68
68
  },
69
69
  openMenuOnFocus: false,
70
70
  openMenuOnClick: true,
71
+ shouldPreventEscapePropagation: false,
71
72
  options: [],
72
73
  pageSize: 5,
73
74
  placeholder: 'Select...',
@@ -690,7 +691,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
690
691
  menuIsOpen = _this$props5.menuIsOpen,
691
692
  onKeyDown = _this$props5.onKeyDown,
692
693
  tabSelectsValue = _this$props5.tabSelectsValue,
693
- openMenuOnFocus = _this$props5.openMenuOnFocus;
694
+ openMenuOnFocus = _this$props5.openMenuOnFocus,
695
+ shouldPreventEscapePropagation = _this$props5.shouldPreventEscapePropagation;
694
696
  var _this$state = _this.state,
695
697
  focusedOption = _this$state.focusedOption,
696
698
  focusedValue = _this$state.focusedValue,
@@ -780,6 +782,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
780
782
  prevInputValue: inputValue
781
783
  });
782
784
  _this.onMenuClose();
785
+ if (shouldPreventEscapePropagation && event.target instanceof HTMLElement) {
786
+ event.stopPropagation();
787
+ }
783
788
  } else if (isClearable && escapeClearsValue) {
784
789
  _this.clearValue();
785
790
  }
@@ -43,6 +43,7 @@ export const defaultProps = {
43
43
  noOptionsMessage: () => 'No options',
44
44
  openMenuOnFocus: false,
45
45
  openMenuOnClick: true,
46
+ shouldPreventEscapePropagation: false,
46
47
  options: [],
47
48
  pageSize: 5,
48
49
  placeholder: 'Select...',
@@ -663,7 +664,8 @@ export default class Select extends Component {
663
664
  menuIsOpen,
664
665
  onKeyDown,
665
666
  tabSelectsValue,
666
- openMenuOnFocus
667
+ openMenuOnFocus,
668
+ shouldPreventEscapePropagation
667
669
  } = this.props;
668
670
  const {
669
671
  focusedOption,
@@ -755,6 +757,9 @@ export default class Select extends Component {
755
757
  prevInputValue: inputValue
756
758
  });
757
759
  this.onMenuClose();
760
+ if (shouldPreventEscapePropagation && event.target instanceof HTMLElement) {
761
+ event.stopPropagation();
762
+ }
758
763
  } else if (isClearable && escapeClearsValue) {
759
764
  this.clearValue();
760
765
  }
@@ -59,6 +59,7 @@ export var defaultProps = {
59
59
  },
60
60
  openMenuOnFocus: false,
61
61
  openMenuOnClick: true,
62
+ shouldPreventEscapePropagation: false,
62
63
  options: [],
63
64
  pageSize: 5,
64
65
  placeholder: 'Select...',
@@ -681,7 +682,8 @@ var Select = /*#__PURE__*/function (_Component) {
681
682
  menuIsOpen = _this$props5.menuIsOpen,
682
683
  onKeyDown = _this$props5.onKeyDown,
683
684
  tabSelectsValue = _this$props5.tabSelectsValue,
684
- openMenuOnFocus = _this$props5.openMenuOnFocus;
685
+ openMenuOnFocus = _this$props5.openMenuOnFocus,
686
+ shouldPreventEscapePropagation = _this$props5.shouldPreventEscapePropagation;
685
687
  var _this$state = _this.state,
686
688
  focusedOption = _this$state.focusedOption,
687
689
  focusedValue = _this$state.focusedValue,
@@ -771,6 +773,9 @@ var Select = /*#__PURE__*/function (_Component) {
771
773
  prevInputValue: inputValue
772
774
  });
773
775
  _this.onMenuClose();
776
+ if (shouldPreventEscapePropagation && event.target instanceof HTMLElement) {
777
+ event.stopPropagation();
778
+ }
774
779
  } else if (isClearable && escapeClearsValue) {
775
780
  _this.clearValue();
776
781
  }
@@ -349,6 +349,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
349
349
  * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
350
350
  */
351
351
  openMenuOnClick: boolean;
352
+ /**
353
+ * Prevents "Escape" keydown event propagation
354
+ */
355
+ shouldPreventEscapePropagation?: boolean;
352
356
  /**
353
357
  * Array of options that populate the select menu
354
358
  */
@@ -461,6 +465,7 @@ export declare const defaultProps: {
461
465
  noOptionsMessage: () => string;
462
466
  openMenuOnFocus: boolean;
463
467
  openMenuOnClick: boolean;
468
+ shouldPreventEscapePropagation: boolean;
464
469
  options: never[];
465
470
  pageSize: number;
466
471
  placeholder: string;
@@ -540,6 +545,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
540
545
  noOptionsMessage: () => string;
541
546
  openMenuOnFocus: boolean;
542
547
  openMenuOnClick: boolean;
548
+ shouldPreventEscapePropagation: boolean;
543
549
  options: never[];
544
550
  pageSize: number;
545
551
  placeholder: string;
@@ -349,6 +349,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
349
349
  * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
350
350
  */
351
351
  openMenuOnClick: boolean;
352
+ /**
353
+ * Prevents "Escape" keydown event propagation
354
+ */
355
+ shouldPreventEscapePropagation?: boolean;
352
356
  /**
353
357
  * Array of options that populate the select menu
354
358
  */
@@ -461,6 +465,7 @@ export declare const defaultProps: {
461
465
  noOptionsMessage: () => string;
462
466
  openMenuOnFocus: boolean;
463
467
  openMenuOnClick: boolean;
468
+ shouldPreventEscapePropagation: boolean;
464
469
  options: never[];
465
470
  pageSize: number;
466
471
  placeholder: string;
@@ -540,6 +545,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
540
545
  noOptionsMessage: () => string;
541
546
  openMenuOnFocus: boolean;
542
547
  openMenuOnClick: boolean;
548
+ shouldPreventEscapePropagation: boolean;
543
549
  options: never[];
544
550
  pageSize: number;
545
551
  placeholder: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "3.4.4",
3
+ "version": "3.5.0",
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.12.0",
32
+ "@atlaskit/icon": "^28.0.0",
33
33
  "@atlaskit/layering": "^3.0.0",
34
34
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
35
  "@atlaskit/primitives": "^14.11.0",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@atlaskit/checkbox": "^17.1.0",
50
- "@atlaskit/form": "^12.0.0",
50
+ "@atlaskit/form": "^12.2.0",
51
51
  "@atlassian/feature-flags-test-utils": "^0.3.0",
52
52
  "@testing-library/react": "^13.4.0",
53
53
  "@testing-library/user-event": "^14.4.3",