@atlaskit/react-select 2.1.0 → 2.2.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,13 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#137501](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137501)
8
+ [`fb85ce5c05391`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb85ce5c05391) -
9
+ Testing unsafe experimental options, to be removed at a later time.
10
+
3
11
  ## 2.1.0
4
12
 
5
13
  ### Minor Changes
@@ -80,7 +80,8 @@ var defaultProps = exports.defaultProps = {
80
80
  },
81
81
  styles: {},
82
82
  tabIndex: 0,
83
- tabSelectsValue: true
83
+ tabSelectsValue: true,
84
+ UNSAFE_is_experimental_generic: false
84
85
  };
85
86
  function toCategorizedOption(props, option, selectValue, index) {
86
87
  var isDisabled = _isOptionDisabled(props, option, selectValue);
@@ -1269,14 +1270,14 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1269
1270
  'aria-errormessage': this.props['aria-errormessage'],
1270
1271
  'aria-expanded': menuIsOpen,
1271
1272
  // TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
1272
- 'aria-haspopup': 'listbox',
1273
+ 'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1273
1274
  'aria-describedby': this.props['aria-describedby'] || descriptionId,
1274
1275
  'aria-invalid': this.props['aria-invalid'] || isInvalid,
1275
1276
  'aria-label': this.props['aria-label'] || label,
1276
1277
  'aria-labelledby': this.props['aria-labelledby'] || labelId,
1277
1278
  'aria-required': required || isRequired,
1278
1279
  role: 'combobox',
1279
- 'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
1280
+ 'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined
1280
1281
  }, menuIsOpen && {
1281
1282
  'aria-controls': this.getElementId('listbox')
1282
1283
  }), !isSearchable && {
@@ -1543,8 +1544,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1543
1544
  onClick: onSelect,
1544
1545
  onMouseMove: onHover,
1545
1546
  onMouseOver: onHover,
1546
- role: 'option',
1547
- 'aria-selected': isSelected,
1547
+ role: _this4.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
1548
+ 'aria-selected': _this4.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
1548
1549
  // We don't want aria-disabled if it's false. It's just noisy.
1549
1550
  'aria-disabled': !isDisabled && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : isDisabled,
1550
1551
  'aria-describedby': (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? headingId : undefined
@@ -1669,8 +1670,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1669
1670
  scrollTargetRef(instance);
1670
1671
  },
1671
1672
  innerProps: _objectSpread(_objectSpread({
1672
- role: 'listbox',
1673
- 'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
1673
+ role: _this4.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1674
+ 'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') || _this4.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
1674
1675
  id: _this4.getElementId('listbox')
1675
1676
  }, testId && {
1676
1677
  'data-testid': "".concat(testId, "-select--listbox")
@@ -1678,7 +1679,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1678
1679
  isLoading: isLoading,
1679
1680
  maxHeight: maxHeight,
1680
1681
  focusedOption: focusedOption
1681
- }), menuUI);
1682
+ }), _this4.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/_react.default.createElement("div", {
1683
+ role: "list"
1684
+ }, menuUI) : menuUI);
1682
1685
  }));
1683
1686
  });
1684
1687
 
@@ -55,7 +55,8 @@ export const defaultProps = {
55
55
  }) => `${count} result${count !== 1 ? 's' : ''} available`,
56
56
  styles: {},
57
57
  tabIndex: 0,
58
- tabSelectsValue: true
58
+ tabSelectsValue: true,
59
+ UNSAFE_is_experimental_generic: false
59
60
  };
60
61
  function toCategorizedOption(props, option, selectValue, index) {
61
62
  const isDisabled = isOptionDisabled(props, option, selectValue);
@@ -1279,14 +1280,14 @@ export default class Select extends Component {
1279
1280
  'aria-errormessage': this.props['aria-errormessage'],
1280
1281
  'aria-expanded': menuIsOpen,
1281
1282
  // TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
1282
- 'aria-haspopup': 'listbox',
1283
+ 'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1283
1284
  'aria-describedby': this.props['aria-describedby'] || descriptionId,
1284
1285
  'aria-invalid': this.props['aria-invalid'] || isInvalid,
1285
1286
  'aria-label': this.props['aria-label'] || label,
1286
1287
  'aria-labelledby': this.props['aria-labelledby'] || labelId,
1287
1288
  'aria-required': required || isRequired,
1288
1289
  role: 'combobox',
1289
- 'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined,
1290
+ 'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined,
1290
1291
  ...(menuIsOpen && {
1291
1292
  'aria-controls': this.getElementId('listbox')
1292
1293
  }),
@@ -1572,8 +1573,8 @@ export default class Select extends Component {
1572
1573
  onClick: onSelect,
1573
1574
  onMouseMove: onHover,
1574
1575
  onMouseOver: onHover,
1575
- role: 'option',
1576
- 'aria-selected': isSelected,
1576
+ role: this.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
1577
+ 'aria-selected': this.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
1577
1578
  // We don't want aria-disabled if it's false. It's just noisy.
1578
1579
  'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
1579
1580
  'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined,
@@ -1703,8 +1704,8 @@ export default class Select extends Component {
1703
1704
  scrollTargetRef(instance);
1704
1705
  },
1705
1706
  innerProps: {
1706
- role: 'listbox',
1707
- 'aria-multiselectable': (this.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
1707
+ role: this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1708
+ 'aria-multiselectable': (this.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') || this.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
1708
1709
  id: this.getElementId('listbox'),
1709
1710
  ...(testId && {
1710
1711
  'data-testid': `${testId}-select--listbox`
@@ -1715,7 +1716,9 @@ export default class Select extends Component {
1715
1716
  isLoading: isLoading,
1716
1717
  maxHeight: maxHeight,
1717
1718
  focusedOption: focusedOption
1718
- }), menuUI))));
1719
+ }), this.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/React.createElement("div", {
1720
+ role: "list"
1721
+ }, menuUI) : menuUI))));
1719
1722
 
1720
1723
  // positioning behaviour is almost identical for portalled and fixed,
1721
1724
  // so we use the same component. the actual portalling logic is forked
@@ -71,7 +71,8 @@ export var defaultProps = {
71
71
  },
72
72
  styles: {},
73
73
  tabIndex: 0,
74
- tabSelectsValue: true
74
+ tabSelectsValue: true,
75
+ UNSAFE_is_experimental_generic: false
75
76
  };
76
77
  function toCategorizedOption(props, option, selectValue, index) {
77
78
  var isDisabled = _isOptionDisabled(props, option, selectValue);
@@ -1260,14 +1261,14 @@ var Select = /*#__PURE__*/function (_Component) {
1260
1261
  'aria-errormessage': this.props['aria-errormessage'],
1261
1262
  'aria-expanded': menuIsOpen,
1262
1263
  // TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
1263
- 'aria-haspopup': 'listbox',
1264
+ 'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1264
1265
  'aria-describedby': this.props['aria-describedby'] || descriptionId,
1265
1266
  'aria-invalid': this.props['aria-invalid'] || isInvalid,
1266
1267
  'aria-label': this.props['aria-label'] || label,
1267
1268
  'aria-labelledby': this.props['aria-labelledby'] || labelId,
1268
1269
  'aria-required': required || isRequired,
1269
1270
  role: 'combobox',
1270
- 'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
1271
+ 'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined
1271
1272
  }, menuIsOpen && {
1272
1273
  'aria-controls': this.getElementId('listbox')
1273
1274
  }), !isSearchable && {
@@ -1534,8 +1535,8 @@ var Select = /*#__PURE__*/function (_Component) {
1534
1535
  onClick: onSelect,
1535
1536
  onMouseMove: onHover,
1536
1537
  onMouseOver: onHover,
1537
- role: 'option',
1538
- 'aria-selected': isSelected,
1538
+ role: _this4.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
1539
+ 'aria-selected': _this4.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
1539
1540
  // We don't want aria-disabled if it's false. It's just noisy.
1540
1541
  'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
1541
1542
  'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined
@@ -1660,8 +1661,8 @@ var Select = /*#__PURE__*/function (_Component) {
1660
1661
  scrollTargetRef(instance);
1661
1662
  },
1662
1663
  innerProps: _objectSpread(_objectSpread({
1663
- role: 'listbox',
1664
- 'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
1664
+ role: _this4.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
1665
+ 'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') || _this4.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
1665
1666
  id: _this4.getElementId('listbox')
1666
1667
  }, testId && {
1667
1668
  'data-testid': "".concat(testId, "-select--listbox")
@@ -1669,7 +1670,9 @@ var Select = /*#__PURE__*/function (_Component) {
1669
1670
  isLoading: isLoading,
1670
1671
  maxHeight: maxHeight,
1671
1672
  focusedOption: focusedOption
1672
- }), menuUI);
1673
+ }), _this4.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/React.createElement("div", {
1674
+ role: "list"
1675
+ }, menuUI) : menuUI);
1673
1676
  }));
1674
1677
  });
1675
1678
 
@@ -1,5 +1,7 @@
1
- import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
2
- type NotifyOpenLayerObserverProps = Parameters<typeof useNotifyOpenLayerObserver>[0];
1
+ type NotifyOpenLayerObserverProps = {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ };
3
5
  /**
4
6
  * Functional component wrapper around `useNotifyOpenLayerObserver`.
5
7
  *
@@ -155,7 +155,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
155
155
  /**
156
156
  * Formats group labels in the menu as React components
157
157
  *
158
- * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
158
+ * An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
159
159
  */
160
160
  formatGroupLabel: (group: Group) => ReactNode;
161
161
  /**
@@ -212,7 +212,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
212
212
  /**
213
213
  * Override the built-in logic to detect whether an option is disabled
214
214
  *
215
- * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
215
+ * An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
216
216
  */
217
217
  isOptionDisabled: (option: Option, selectValue: Options<Option>) => boolean;
218
218
  /**
@@ -275,7 +275,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
275
275
  /**
276
276
  * Whether the menu should use a portal, and where it should attach
277
277
  *
278
- * An example can be found in the [Portaling](/advanced#portaling) documentation
278
+ * An example can be found in the [Portaling](https://react-select.com/advanced#portaling) documentation
279
279
  */
280
280
  menuPortalTarget?: HTMLElement | null;
281
281
  /**
@@ -369,7 +369,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
369
369
  /**
370
370
  * Style modifier methods
371
371
  *
372
- * A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
372
+ * A basic example can be found at the bottom of the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
373
373
  */
374
374
  styles: StylesConfig<Option, IsMulti, Group>;
375
375
  /**
@@ -424,6 +424,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
424
424
  spacing?: 'compact' | 'default';
425
425
  appearance: 'default' | 'subtle' | 'none';
426
426
  [key: string]: any;
427
+ UNSAFE_is_experimental_generic?: boolean;
427
428
  }
428
429
  export declare const defaultProps: {
429
430
  'aria-live': string | undefined;
@@ -466,6 +467,7 @@ export declare const defaultProps: {
466
467
  styles: {};
467
468
  tabIndex: number;
468
469
  tabSelectsValue: boolean;
470
+ UNSAFE_is_experimental_generic: boolean;
469
471
  };
470
472
  interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
471
473
  ariaSelection: AriaSelection<Option, IsMulti> | null;
@@ -545,6 +547,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
545
547
  styles: {};
546
548
  tabIndex: number;
547
549
  tabSelectsValue: boolean;
550
+ UNSAFE_is_experimental_generic: boolean;
548
551
  };
549
552
  state: State<Option, IsMulti, Group>;
550
553
  blockOptionHover: boolean;
@@ -1,5 +1,7 @@
1
- import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
2
- type NotifyOpenLayerObserverProps = Parameters<typeof useNotifyOpenLayerObserver>[0];
1
+ type NotifyOpenLayerObserverProps = {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ };
3
5
  /**
4
6
  * Functional component wrapper around `useNotifyOpenLayerObserver`.
5
7
  *
@@ -155,7 +155,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
155
155
  /**
156
156
  * Formats group labels in the menu as React components
157
157
  *
158
- * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
158
+ * An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
159
159
  */
160
160
  formatGroupLabel: (group: Group) => ReactNode;
161
161
  /**
@@ -212,7 +212,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
212
212
  /**
213
213
  * Override the built-in logic to detect whether an option is disabled
214
214
  *
215
- * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
215
+ * An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
216
216
  */
217
217
  isOptionDisabled: (option: Option, selectValue: Options<Option>) => boolean;
218
218
  /**
@@ -275,7 +275,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
275
275
  /**
276
276
  * Whether the menu should use a portal, and where it should attach
277
277
  *
278
- * An example can be found in the [Portaling](/advanced#portaling) documentation
278
+ * An example can be found in the [Portaling](https://react-select.com/advanced#portaling) documentation
279
279
  */
280
280
  menuPortalTarget?: HTMLElement | null;
281
281
  /**
@@ -369,7 +369,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
369
369
  /**
370
370
  * Style modifier methods
371
371
  *
372
- * A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
372
+ * A basic example can be found at the bottom of the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
373
373
  */
374
374
  styles: StylesConfig<Option, IsMulti, Group>;
375
375
  /**
@@ -424,6 +424,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
424
424
  spacing?: 'compact' | 'default';
425
425
  appearance: 'default' | 'subtle' | 'none';
426
426
  [key: string]: any;
427
+ UNSAFE_is_experimental_generic?: boolean;
427
428
  }
428
429
  export declare const defaultProps: {
429
430
  'aria-live': string | undefined;
@@ -466,6 +467,7 @@ export declare const defaultProps: {
466
467
  styles: {};
467
468
  tabIndex: number;
468
469
  tabSelectsValue: boolean;
470
+ UNSAFE_is_experimental_generic: boolean;
469
471
  };
470
472
  interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
471
473
  ariaSelection: AriaSelection<Option, IsMulti> | null;
@@ -545,6 +547,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
545
547
  styles: {};
546
548
  tabIndex: number;
547
549
  tabSelectsValue: boolean;
550
+ UNSAFE_is_experimental_generic: boolean;
548
551
  };
549
552
  state: State<Option, IsMulti, Group>;
550
553
  blockOptionHover: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "2.1.0",
3
+ "version": "2.2.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",
@@ -33,9 +33,9 @@
33
33
  "@atlaskit/icon": "^25.5.0",
34
34
  "@atlaskit/layering": "^2.1.0",
35
35
  "@atlaskit/platform-feature-flags": "^1.1.0",
36
- "@atlaskit/primitives": "^14.3.0",
36
+ "@atlaskit/primitives": "^14.4.0",
37
37
  "@atlaskit/spinner": "^18.0.0",
38
- "@atlaskit/tokens": "^4.6.0",
38
+ "@atlaskit/tokens": "^4.7.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@emotion/react": "^11.7.1",
41
41
  "@floating-ui/dom": "^1.0.1",