@atlaskit/react-select 3.4.5 → 3.5.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,26 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 3.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d281a835c4897`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d281a835c4897) -
8
+ [ux]
9
+
10
+ - `TeamCreateDialog`
11
+ - Fixed incorrect ariaDescribedBy identifier so that VoiceOver can read out the error message.
12
+ - Programmatically focus the input on submit when there is an error.
13
+
14
+ - Updated dependencies
15
+
16
+ ## 3.5.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [`782e1924230d5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/782e1924230d5) -
21
+ Introduced new optional "shouldPreventEscapePropagation" prop to prevent Escape keydown event
22
+ propagation
23
+
3
24
  ## 3.4.5
4
25
 
5
26
  ### 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
  }
@@ -1368,6 +1373,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1368
1373
  "data-testid": testId && "".concat(testId, "-select--input")
1369
1374
  }, ariaAttributes));
1370
1375
  }
1376
+
1377
+ // NOTE: Don't add the `name` prop to this Input, `name` is already a prop on the hidden input element that has the value of the select.
1378
+ // Adding `name` to this Input will cause unexpected behavior.
1371
1379
  return /*#__PURE__*/_react.default.createElement(Input, (0, _extends2.default)({}, commonProps, {
1372
1380
  autoCapitalize: "none",
1373
1381
  autoComplete: "off",
@@ -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
  }
@@ -1374,6 +1379,9 @@ export default class Select extends Component {
1374
1379
  "data-testid": testId && `${testId}-select--input`
1375
1380
  }, ariaAttributes));
1376
1381
  }
1382
+
1383
+ // NOTE: Don't add the `name` prop to this Input, `name` is already a prop on the hidden input element that has the value of the select.
1384
+ // Adding `name` to this Input will cause unexpected behavior.
1377
1385
  return /*#__PURE__*/React.createElement(Input, _extends({}, commonProps, {
1378
1386
  autoCapitalize: "none",
1379
1387
  autoComplete: "off",
@@ -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
  }
@@ -1359,6 +1364,9 @@ var Select = /*#__PURE__*/function (_Component) {
1359
1364
  "data-testid": testId && "".concat(testId, "-select--input")
1360
1365
  }, ariaAttributes));
1361
1366
  }
1367
+
1368
+ // NOTE: Don't add the `name` prop to this Input, `name` is already a prop on the hidden input element that has the value of the select.
1369
+ // Adding `name` to this Input will cause unexpected behavior.
1362
1370
  return /*#__PURE__*/React.createElement(Input, _extends({}, commonProps, {
1363
1371
  autoCapitalize: "none",
1364
1372
  autoComplete: "off",
@@ -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.5",
3
+ "version": "3.5.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",
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@atlaskit/ds-lib": "^5.0.0",
32
- "@atlaskit/icon": "^28.0.0",
32
+ "@atlaskit/icon": "^28.1.0",
33
33
  "@atlaskit/layering": "^3.0.0",
34
34
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
- "@atlaskit/primitives": "^14.11.0",
35
+ "@atlaskit/primitives": "^14.12.0",
36
36
  "@atlaskit/spinner": "^19.0.0",
37
- "@atlaskit/tokens": "^6.0.0",
37
+ "@atlaskit/tokens": "^6.1.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@compiled/react": "^0.18.3",
40
40
  "@floating-ui/dom": "^1.0.1",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@atlaskit/checkbox": "^17.1.0",
50
- "@atlaskit/form": "^12.1.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",