@atlaskit/react-select 1.0.2 → 1.0.4

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/accessibility/helpers.js +3 -3
  3. package/dist/cjs/builtins.js +2 -0
  4. package/dist/cjs/components/containers.js +8 -2
  5. package/dist/cjs/components/menu.js +4 -1
  6. package/dist/cjs/components/option.js +2 -2
  7. package/dist/cjs/index.js +0 -7
  8. package/dist/cjs/select.js +10 -6
  9. package/dist/cjs/use-state-manager.js +2 -0
  10. package/dist/es2019/accessibility/helpers.js +3 -3
  11. package/dist/es2019/builtins.js +2 -0
  12. package/dist/es2019/components/containers.js +8 -2
  13. package/dist/es2019/components/menu.js +4 -1
  14. package/dist/es2019/components/option.js +2 -2
  15. package/dist/es2019/index.js +0 -1
  16. package/dist/es2019/select.js +10 -6
  17. package/dist/es2019/use-state-manager.js +2 -0
  18. package/dist/esm/accessibility/helpers.js +3 -3
  19. package/dist/esm/builtins.js +2 -0
  20. package/dist/esm/components/containers.js +8 -2
  21. package/dist/esm/components/menu.js +4 -1
  22. package/dist/esm/components/option.js +2 -2
  23. package/dist/esm/index.js +0 -1
  24. package/dist/esm/select.js +10 -6
  25. package/dist/esm/use-state-manager.js +2 -0
  26. package/dist/types/builtins.d.ts +4 -4
  27. package/dist/types/filters.d.ts +1 -2
  28. package/dist/types/index.d.ts +1 -2
  29. package/dist/types/select.d.ts +9 -8
  30. package/dist/types/types.d.ts +0 -4
  31. package/dist/types/utils.d.ts +2 -2
  32. package/dist/types-ts4.5/builtins.d.ts +4 -4
  33. package/dist/types-ts4.5/filters.d.ts +1 -2
  34. package/dist/types-ts4.5/index.d.ts +1 -2
  35. package/dist/types-ts4.5/select.d.ts +9 -8
  36. package/dist/types-ts4.5/types.d.ts +0 -4
  37. package/dist/types-ts4.5/utils.d.ts +2 -2
  38. package/package.json +4 -5
  39. package/dist/cjs/nonce-provider.js +0 -30
  40. package/dist/es2019/nonce-provider.js +0 -19
  41. package/dist/esm/nonce-provider.js +0 -20
  42. package/dist/types/nonce-provider.d.ts +0 -8
  43. package/dist/types-ts4.5/nonce-provider.d.ts +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150410](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150410)
8
+ [`010ae8c2986e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/010ae8c2986e6) -
9
+ If select is within react-beatiful-dnd, don't prevent onMouseDown event to fix select is not
10
+ clickable in dnd
11
+
12
+ ## 1.0.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [#143559](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/143559)
17
+ [`56dfbfe361f96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/56dfbfe361f96) -
18
+ Upgrade react-select from 5.4 to 5.8 and replace it with internal atlaskit/react-select
19
+
3
20
  ## 1.0.2
4
21
 
5
22
  ### Patch Changes
@@ -8,11 +8,11 @@ exports.isIOS = isIOS;
8
8
  exports.isIPad = isIPad;
9
9
  exports.isIPhone = isIPhone;
10
10
  exports.isMac = isMac;
11
- /// <reference types="user-agent-data-types" />
12
-
13
11
  function testPlatform(re) {
14
12
  var _window$navigator$use;
15
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
13
+ return typeof window !== 'undefined' && window.navigator != null ?
14
+ //@ts-expect-error ignore userAgentData type issue
15
+ re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
16
16
  }
17
17
  function isIPhone() {
18
18
  return testPlatform(/^iPhone/i);
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isOptionDisabled = exports.getOptionValue = exports.getOptionLabel = exports.formatGroupLabel = void 0;
7
+ /* eslint-disable @repo/internal/fs/filename-pattern-match */
8
+
7
9
  var formatGroupLabel = exports.formatGroupLabel = function formatGroupLabel(group) {
8
10
  return group.label;
9
11
  };
@@ -70,11 +70,17 @@ var ValueContainer = exports.ValueContainer = function ValueContainer(props) {
70
70
  innerProps = props.innerProps,
71
71
  isMulti = props.isMulti,
72
72
  hasValue = props.hasValue;
73
- return (0, _react.jsx)("div", (0, _extends2.default)({}, (0, _utils.getStyleProps)(props, 'valueContainer', {
73
+ var styles = (0, _utils.getStyleProps)(props, 'valueContainer', {
74
74
  'value-container': true,
75
75
  'value-container--is-multi': isMulti,
76
76
  'value-container--has-value': hasValue
77
- }), innerProps), children);
77
+ });
78
+ return (0, _react.jsx)("div", (0, _extends2.default)({
79
+ css: styles.css
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
81
+ ,
82
+ className: styles.className || 'value-container'
83
+ }, innerProps), children);
78
84
  };
79
85
 
80
86
  // ==============================
@@ -365,7 +365,10 @@ var LoadingMessage = exports.LoadingMessage = function LoadingMessage(_ref7) {
365
365
  }), 'loadingMessage', {
366
366
  'menu-notice': true,
367
367
  'menu-notice--loading': true
368
- }), innerProps), children);
368
+ }), innerProps, {
369
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
370
+ role: "option"
371
+ }), children);
369
372
  };
370
373
 
371
374
  // ==============================
@@ -53,8 +53,8 @@ var Option = function Option(props) {
53
53
  'option--is-selected': isSelected
54
54
  }), {
55
55
  //@ts-ignore
56
- ref: innerRef
57
- // aria-disabled={isDisabled}
56
+ ref: innerRef,
57
+ "aria-disabled": isDisabled
58
58
  }, innerProps), children);
59
59
  };
60
60
 
package/dist/cjs/index.js CHANGED
@@ -4,12 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "NonceProvider", {
8
- enumerable: true,
9
- get: function get() {
10
- return _nonceProvider.default;
11
- }
12
- });
13
7
  Object.defineProperty(exports, "components", {
14
8
  enumerable: true,
15
9
  get: function get() {
@@ -48,7 +42,6 @@ Object.defineProperty(exports, "useStateManager", {
48
42
  });
49
43
  var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
50
44
  var _stateManager = _interopRequireDefault(require("./state-manager"));
51
- var _nonceProvider = _interopRequireDefault(require("./nonce-provider"));
52
45
  var _styles = require("./styles");
53
46
  var _theme = require("./theme");
54
47
  var _filters = require("./filters");
@@ -453,7 +453,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
453
453
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onControlMouseDown", function (event) {
454
454
  // Event captured by dropdown indicator
455
455
  if (event.defaultPrevented) {
456
- return;
456
+ var _this$controlRef;
457
+ // react-dnd will fire preventDefault in mouseDown, which make select is not clickable.
458
+ // temp workaround to check if select is within dnd, we don't do the early return.
459
+ if (!((_this$controlRef = _this.controlRef) !== null && _this$controlRef !== void 0 && _this$controlRef.closest('[data-rbd-draggable-context-id]'))) {
460
+ return;
461
+ }
457
462
  }
458
463
  var openMenuOnClick = _this.props.openMenuOnClick;
459
464
  if (!_this.state.isFocused) {
@@ -1241,7 +1246,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1241
1246
  ariaSelection = _this$state4.ariaSelection;
1242
1247
  var commonProps = this.commonProps;
1243
1248
  var id = inputId || this.getElementId('input');
1244
- var description = this.props['aria-describedby'] || descriptionId || null;
1249
+ var description = this.props['aria-describedby'] || descriptionId;
1245
1250
 
1246
1251
  // aria attributes makes the JSX "noisy", separated for clarity
1247
1252
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
@@ -1589,7 +1594,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1589
1594
  innerRef: ref,
1590
1595
  innerProps: {
1591
1596
  onMouseDown: _this4.onMenuMouseDown,
1592
- onMouseMove: _this4.onMenuMouseMove
1597
+ onMouseMove: _this4.onMenuMouseMove,
1598
+ id: _this4.props.components.Menu ? _this4.getElementId('listbox') : undefined
1593
1599
  },
1594
1600
  isLoading: isLoading,
1595
1601
  placement: placement
@@ -1634,12 +1640,10 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1634
1640
  delimiter = _this$props13.delimiter,
1635
1641
  isDisabled = _this$props13.isDisabled,
1636
1642
  isMulti = _this$props13.isMulti,
1637
- isRequired = _this$props13.isRequired,
1638
1643
  required = _this$props13.required,
1639
1644
  name = _this$props13.name;
1640
1645
  var selectValue = this.state.selectValue;
1641
- var req = required || isRequired || null;
1642
- if (req && !this.hasValue() && !isDisabled) {
1646
+ if (required && !this.hasValue() && !isDisabled) {
1643
1647
  return /*#__PURE__*/_react.default.createElement(_internal.RequiredInput, {
1644
1648
  name: name,
1645
1649
  onFocus: this.onValueInputFocus
@@ -71,6 +71,8 @@ function useStateManager(_ref) {
71
71
  var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue;
72
72
  var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen;
73
73
  var value = propsValue !== undefined ? propsValue : stateValue;
74
+
75
+ //@ts-ignore react-select unsupported props
74
76
  return _objectSpread(_objectSpread({}, restSelectProps), {}, {
75
77
  inputValue: inputValue,
76
78
  menuIsOpen: menuIsOpen,
@@ -1,8 +1,8 @@
1
- /// <reference types="user-agent-data-types" />
2
-
3
1
  function testPlatform(re) {
4
2
  var _window$navigator$use;
5
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
3
+ return typeof window !== 'undefined' && window.navigator != null ?
4
+ //@ts-expect-error ignore userAgentData type issue
5
+ re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
6
6
  }
7
7
  export function isIPhone() {
8
8
  return testPlatform(/^iPhone/i);
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @repo/internal/fs/filename-pattern-match */
2
+
1
3
  export const formatGroupLabel = group => group.label;
2
4
  export const getOptionLabel = option => option.label;
3
5
  export const getOptionValue = option => option.value;
@@ -70,11 +70,17 @@ export const ValueContainer = props => {
70
70
  isMulti,
71
71
  hasValue
72
72
  } = props;
73
- return jsx("div", _extends({}, getStyleProps(props, 'valueContainer', {
73
+ const styles = getStyleProps(props, 'valueContainer', {
74
74
  'value-container': true,
75
75
  'value-container--is-multi': isMulti,
76
76
  'value-container--has-value': hasValue
77
- }), innerProps), children);
77
+ });
78
+ return jsx("div", _extends({
79
+ css: styles.css
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
81
+ ,
82
+ className: styles.className || 'value-container'
83
+ }, innerProps), children);
78
84
  };
79
85
 
80
86
  // ==============================
@@ -373,7 +373,10 @@ export const LoadingMessage = ({
373
373
  }, 'loadingMessage', {
374
374
  'menu-notice': true,
375
375
  'menu-notice--loading': true
376
- }), innerProps), children);
376
+ }), innerProps, {
377
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
378
+ role: "option"
379
+ }), children);
377
380
  };
378
381
 
379
382
  // ==============================
@@ -48,8 +48,8 @@ const Option = props => {
48
48
  'option--is-selected': isSelected
49
49
  }), {
50
50
  //@ts-ignore
51
- ref: innerRef
52
- // aria-disabled={isDisabled}
51
+ ref: innerRef,
52
+ "aria-disabled": isDisabled
53
53
  }, innerProps), children);
54
54
  };
55
55
 
@@ -1,6 +1,5 @@
1
1
  import useStateManager from './use-state-manager';
2
2
  export { default } from './state-manager';
3
- export { default as NonceProvider } from './nonce-provider';
4
3
  export { mergeStyles } from './styles';
5
4
  export { defaultTheme } from './theme';
6
5
  export { createFilter } from './filters';
@@ -419,7 +419,12 @@ export default class Select extends Component {
419
419
  _defineProperty(this, "onControlMouseDown", event => {
420
420
  // Event captured by dropdown indicator
421
421
  if (event.defaultPrevented) {
422
- return;
422
+ var _this$controlRef;
423
+ // react-dnd will fire preventDefault in mouseDown, which make select is not clickable.
424
+ // temp workaround to check if select is within dnd, we don't do the early return.
425
+ if (!((_this$controlRef = this.controlRef) !== null && _this$controlRef !== void 0 && _this$controlRef.closest('[data-rbd-draggable-context-id]'))) {
426
+ return;
427
+ }
423
428
  }
424
429
  const {
425
430
  openMenuOnClick
@@ -1251,7 +1256,7 @@ export default class Select extends Component {
1251
1256
  commonProps
1252
1257
  } = this;
1253
1258
  const id = inputId || this.getElementId('input');
1254
- const description = this.props['aria-describedby'] || descriptionId || null;
1259
+ const description = this.props['aria-describedby'] || descriptionId;
1255
1260
 
1256
1261
  // aria attributes makes the JSX "noisy", separated for clarity
1257
1262
  const ariaAttributes = {
@@ -1620,7 +1625,8 @@ export default class Select extends Component {
1620
1625
  innerRef: ref,
1621
1626
  innerProps: {
1622
1627
  onMouseDown: this.onMenuMouseDown,
1623
- onMouseMove: this.onMenuMouseMove
1628
+ onMouseMove: this.onMenuMouseMove,
1629
+ id: this.props.components.Menu ? this.getElementId('listbox') : undefined
1624
1630
  },
1625
1631
  isLoading: isLoading,
1626
1632
  placement: placement
@@ -1659,15 +1665,13 @@ export default class Select extends Component {
1659
1665
  delimiter,
1660
1666
  isDisabled,
1661
1667
  isMulti,
1662
- isRequired,
1663
1668
  required,
1664
1669
  name
1665
1670
  } = this.props;
1666
1671
  const {
1667
1672
  selectValue
1668
1673
  } = this.state;
1669
- const req = required || isRequired || null;
1670
- if (req && !this.hasValue() && !isDisabled) {
1674
+ if (required && !this.hasValue() && !isDisabled) {
1671
1675
  return /*#__PURE__*/React.createElement(RequiredInput, {
1672
1676
  name: name,
1673
1677
  onFocus: this.onValueInputFocus
@@ -47,6 +47,8 @@ export default function useStateManager({
47
47
  const inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue;
48
48
  const menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen;
49
49
  const value = propsValue !== undefined ? propsValue : stateValue;
50
+
51
+ //@ts-ignore react-select unsupported props
50
52
  return {
51
53
  ...restSelectProps,
52
54
  inputValue,
@@ -1,8 +1,8 @@
1
- /// <reference types="user-agent-data-types" />
2
-
3
1
  function testPlatform(re) {
4
2
  var _window$navigator$use;
5
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
3
+ return typeof window !== 'undefined' && window.navigator != null ?
4
+ //@ts-expect-error ignore userAgentData type issue
5
+ re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
6
6
  }
7
7
  export function isIPhone() {
8
8
  return testPlatform(/^iPhone/i);
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @repo/internal/fs/filename-pattern-match */
2
+
1
3
  export var formatGroupLabel = function formatGroupLabel(group) {
2
4
  return group.label;
3
5
  };
@@ -66,11 +66,17 @@ export var ValueContainer = function ValueContainer(props) {
66
66
  innerProps = props.innerProps,
67
67
  isMulti = props.isMulti,
68
68
  hasValue = props.hasValue;
69
- return jsx("div", _extends({}, getStyleProps(props, 'valueContainer', {
69
+ var styles = getStyleProps(props, 'valueContainer', {
70
70
  'value-container': true,
71
71
  'value-container--is-multi': isMulti,
72
72
  'value-container--has-value': hasValue
73
- }), innerProps), children);
73
+ });
74
+ return jsx("div", _extends({
75
+ css: styles.css
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
77
+ ,
78
+ className: styles.className || 'value-container'
79
+ }, innerProps), children);
74
80
  };
75
81
 
76
82
  // ==============================
@@ -361,7 +361,10 @@ export var LoadingMessage = function LoadingMessage(_ref7) {
361
361
  }), 'loadingMessage', {
362
362
  'menu-notice': true,
363
363
  'menu-notice--loading': true
364
- }), innerProps), children);
364
+ }), innerProps, {
365
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
366
+ role: "option"
367
+ }), children);
365
368
  };
366
369
 
367
370
  // ==============================
@@ -48,8 +48,8 @@ var Option = function Option(props) {
48
48
  'option--is-selected': isSelected
49
49
  }), {
50
50
  //@ts-ignore
51
- ref: innerRef
52
- // aria-disabled={isDisabled}
51
+ ref: innerRef,
52
+ "aria-disabled": isDisabled
53
53
  }, innerProps), children);
54
54
  };
55
55
 
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import useStateManager from './use-state-manager';
2
2
  export { default } from './state-manager';
3
- export { default as NonceProvider } from './nonce-provider';
4
3
  export { mergeStyles } from './styles';
5
4
  export { defaultTheme } from './theme';
6
5
  export { createFilter } from './filters';
@@ -443,7 +443,12 @@ var Select = /*#__PURE__*/function (_Component) {
443
443
  _defineProperty(_assertThisInitialized(_this), "onControlMouseDown", function (event) {
444
444
  // Event captured by dropdown indicator
445
445
  if (event.defaultPrevented) {
446
- return;
446
+ var _this$controlRef;
447
+ // react-dnd will fire preventDefault in mouseDown, which make select is not clickable.
448
+ // temp workaround to check if select is within dnd, we don't do the early return.
449
+ if (!((_this$controlRef = _this.controlRef) !== null && _this$controlRef !== void 0 && _this$controlRef.closest('[data-rbd-draggable-context-id]'))) {
450
+ return;
451
+ }
447
452
  }
448
453
  var openMenuOnClick = _this.props.openMenuOnClick;
449
454
  if (!_this.state.isFocused) {
@@ -1231,7 +1236,7 @@ var Select = /*#__PURE__*/function (_Component) {
1231
1236
  ariaSelection = _this$state4.ariaSelection;
1232
1237
  var commonProps = this.commonProps;
1233
1238
  var id = inputId || this.getElementId('input');
1234
- var description = this.props['aria-describedby'] || descriptionId || null;
1239
+ var description = this.props['aria-describedby'] || descriptionId;
1235
1240
 
1236
1241
  // aria attributes makes the JSX "noisy", separated for clarity
1237
1242
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
@@ -1579,7 +1584,8 @@ var Select = /*#__PURE__*/function (_Component) {
1579
1584
  innerRef: ref,
1580
1585
  innerProps: {
1581
1586
  onMouseDown: _this4.onMenuMouseDown,
1582
- onMouseMove: _this4.onMenuMouseMove
1587
+ onMouseMove: _this4.onMenuMouseMove,
1588
+ id: _this4.props.components.Menu ? _this4.getElementId('listbox') : undefined
1583
1589
  },
1584
1590
  isLoading: isLoading,
1585
1591
  placement: placement
@@ -1624,12 +1630,10 @@ var Select = /*#__PURE__*/function (_Component) {
1624
1630
  delimiter = _this$props13.delimiter,
1625
1631
  isDisabled = _this$props13.isDisabled,
1626
1632
  isMulti = _this$props13.isMulti,
1627
- isRequired = _this$props13.isRequired,
1628
1633
  required = _this$props13.required,
1629
1634
  name = _this$props13.name;
1630
1635
  var selectValue = this.state.selectValue;
1631
- var req = required || isRequired || null;
1632
- if (req && !this.hasValue() && !isDisabled) {
1636
+ if (required && !this.hasValue() && !isDisabled) {
1633
1637
  return /*#__PURE__*/React.createElement(RequiredInput, {
1634
1638
  name: name,
1635
1639
  onFocus: this.onValueInputFocus
@@ -64,6 +64,8 @@ export default function useStateManager(_ref) {
64
64
  var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue;
65
65
  var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen;
66
66
  var value = propsValue !== undefined ? propsValue : stateValue;
67
+
68
+ //@ts-ignore react-select unsupported props
67
69
  return _objectSpread(_objectSpread({}, restSelectProps), {}, {
68
70
  inputValue: inputValue,
69
71
  menuIsOpen: menuIsOpen,
@@ -1,5 +1,5 @@
1
- import { type GroupBase, type Option } from './types';
1
+ import { type GroupBase } from './types';
2
2
  export declare const formatGroupLabel: <Option, Group extends GroupBase<Option>>(group: Group) => string;
3
- export declare const getOptionLabel: (option: Option) => string;
4
- export declare const getOptionValue: (option: Option) => string;
5
- export declare const isOptionDisabled: (option: Option) => boolean;
3
+ export declare const getOptionLabel: <Option>(option: Option) => string;
4
+ export declare const getOptionValue: <Option>(option: Option) => string;
5
+ export declare const isOptionDisabled: <Option>(option: Option) => boolean;
@@ -1,4 +1,3 @@
1
- import { type Option } from './types';
2
1
  export interface FilterOptionOption<Option> {
3
2
  readonly label: string;
4
3
  readonly value: string;
@@ -11,5 +10,5 @@ interface Config<Option> {
11
10
  readonly trim?: boolean;
12
11
  readonly matchFrom?: 'any' | 'start';
13
12
  }
14
- export declare const createFilter: (config?: Config<Option>) => (option: FilterOptionOption<Option>, rawInput: string) => boolean;
13
+ export declare const createFilter: <Option>(config?: Config<Option>) => (option: FilterOptionOption<Option>, rawInput: string) => boolean;
15
14
  export {};
@@ -2,7 +2,6 @@ import type Select from './select';
2
2
  import type { GroupBase } from './types';
3
3
  import useStateManager from './use-state-manager';
4
4
  export { default } from './state-manager';
5
- export { default as NonceProvider } from './nonce-provider';
6
5
  export { mergeStyles } from './styles';
7
6
  export { defaultTheme } from './theme';
8
7
  export { createFilter } from './filters';
@@ -23,6 +22,6 @@ export type { PlaceholderProps } from './components/placeholder';
23
22
  export type { SingleValueProps } from './components/single-value';
24
23
  export type { ThemeConfig } from './theme';
25
24
  export type { ClassNamesConfig, StylesConfig } from './styles';
26
- export { type GroupBase, type OptionsOrGroups, type Option, type Options, type SingleValue, type MultiValue, type PropsValue, type OnChangeValue, type Colors, type ThemeSpacing, type Theme, type ClassNamesState, type CX, type GetStyles, type CommonProps, type CommonPropsAndClassName, type ActionMetaBase, type SelectOptionActionMeta, type DeselectOptionActionMeta, type RemoveValueActionMeta, type PopValueActionMeta, type ClearActionMeta, type CreateOptionActionMeta, type InitialInputFocusedActionMeta, type ActionMeta, type SetValueAction, type InputAction, type InputActionMeta, type MenuPlacement, type CoercedMenuPlacement, type MenuPosition, type FocusDirection, type GetOptionLabel, type GetOptionValue, type CSSObjectWithLabel, } from './types';
25
+ export { type GroupBase, type OptionsOrGroups, type Options, type SingleValue, type MultiValue, type PropsValue, type OnChangeValue, type Colors, type ThemeSpacing, type Theme, type ClassNamesState, type CX, type GetStyles, type CommonProps, type CommonPropsAndClassName, type ActionMetaBase, type SelectOptionActionMeta, type DeselectOptionActionMeta, type RemoveValueActionMeta, type PopValueActionMeta, type ClearActionMeta, type CreateOptionActionMeta, type InitialInputFocusedActionMeta, type ActionMeta, type SetValueAction, type InputAction, type InputActionMeta, type MenuPlacement, type CoercedMenuPlacement, type MenuPosition, type FocusDirection, type GetOptionLabel, type GetOptionValue, type CSSObjectWithLabel, } from './types';
27
26
  export type { OptionContext, GuidanceContext, AriaGuidanceProps, AriaOnChangeProps, AriaOnFilterProps, AriaOnFocusProps, AriaLiveMessages, AriaGuidance, AriaOnChange, AriaOnFilter, AriaOnFocus, } from './accessibility';
28
27
  export type { FormatOptionLabelContext, FormatOptionLabelMeta } from './select';
@@ -405,6 +405,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
405
405
  * Use `isRequired` instead.
406
406
  */
407
407
  required?: boolean;
408
+ [key: string]: any;
408
409
  }
409
410
  export declare const defaultProps: {
410
411
  'aria-live': string;
@@ -417,16 +418,16 @@ export declare const defaultProps: {
417
418
  components: {};
418
419
  controlShouldRenderValue: boolean;
419
420
  escapeClearsValue: boolean;
420
- filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
421
+ filterOption: (option: FilterOptionOption<unknown>, rawInput: string) => boolean;
421
422
  formatGroupLabel: <Option, Group extends GroupBase<Option>>(group: Group) => string;
422
- getOptionLabel: (option: import("./types").Option) => string;
423
- getOptionValue: (option: import("./types").Option) => string;
423
+ getOptionLabel: <Option_1>(option: Option_1) => string;
424
+ getOptionValue: <Option_2>(option: Option_2) => string;
424
425
  isDisabled: boolean;
425
426
  isLoading: boolean;
426
427
  isMulti: boolean;
427
428
  isRtl: boolean;
428
429
  isSearchable: boolean;
429
- isOptionDisabled: (option: import("./types").Option) => boolean;
430
+ isOptionDisabled: <Option_3>(option: Option_3) => boolean;
430
431
  loadingMessage: () => string;
431
432
  maxMenuHeight: number;
432
433
  minMenuHeight: number;
@@ -496,16 +497,16 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
496
497
  components: {};
497
498
  controlShouldRenderValue: boolean;
498
499
  escapeClearsValue: boolean;
499
- filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
500
+ filterOption: (option: FilterOptionOption<unknown>, rawInput: string) => boolean;
500
501
  formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
501
- getOptionLabel: (option: import("./types").Option) => string;
502
- getOptionValue: (option: import("./types").Option) => string;
502
+ getOptionLabel: <Option_2>(option: Option_2) => string;
503
+ getOptionValue: <Option_3>(option: Option_3) => string;
503
504
  isDisabled: boolean;
504
505
  isLoading: boolean;
505
506
  isMulti: boolean;
506
507
  isRtl: boolean;
507
508
  isSearchable: boolean;
508
- isOptionDisabled: (option: import("./types").Option) => boolean;
509
+ isOptionDisabled: <Option_4>(option: Option_4) => boolean;
509
510
  loadingMessage: () => string;
510
511
  maxMenuHeight: number;
511
512
  minMenuHeight: number;
@@ -5,10 +5,6 @@ export interface GroupBase<Option> {
5
5
  readonly options: readonly Option[];
6
6
  readonly label?: string;
7
7
  }
8
- export interface Option {
9
- label: string;
10
- value: string;
11
- }
12
8
  export type OptionsOrGroups<Option, Group extends GroupBase<Option>> = readonly (Option | Group)[];
13
9
  export type Options<Option> = readonly Option[];
14
10
  export type SingleValue<Option> = Option | null;
@@ -1,9 +1,9 @@
1
1
  import type { StylesProps } from './styles';
2
- import type { ClassNamesState, CommonPropsAndClassName, GroupBase, InputActionMeta, MultiValue, OnChangeValue, Option, Options, PropsValue, SingleValue } from './types';
2
+ import type { ClassNamesState, CommonPropsAndClassName, GroupBase, InputActionMeta, MultiValue, OnChangeValue, Options, PropsValue, SingleValue } from './types';
3
3
  export declare const noop: () => void;
4
4
  export declare const emptyString: () => string;
5
5
  export declare function classNames(prefix?: string | null, state?: ClassNamesState, ...classNameList: string[]): string;
6
- export declare const cleanValue: (value: PropsValue<Option>) => Options<Option>;
6
+ export declare const cleanValue: <Option>(value: PropsValue<Option>) => Options<Option>;
7
7
  export declare const cleanCommonProps: <Option, IsMulti extends boolean, Group extends GroupBase<Option>, AdditionalProps>(props: Partial<CommonPropsAndClassName<Option, IsMulti, Group>> & AdditionalProps) => Omit<AdditionalProps, keyof CommonPropsAndClassName<Option, IsMulti, Group>>;
8
8
  export declare const getStyleProps: <Option, IsMulti extends boolean, Group extends GroupBase<Option>, Key extends keyof StylesProps<Option, IsMulti, Group>>(props: Pick<CommonPropsAndClassName<Option, IsMulti, Group>, 'cx' | 'getStyles' | 'getClassNames' | 'className'> & StylesProps<Option, IsMulti, Group>[Key], name: Key, classNamesState?: ClassNamesState) => {
9
9
  css: import("./types").CSSObjectWithLabel;
@@ -1,5 +1,5 @@
1
- import { type GroupBase, type Option } from './types';
1
+ import { type GroupBase } from './types';
2
2
  export declare const formatGroupLabel: <Option, Group extends GroupBase<Option>>(group: Group) => string;
3
- export declare const getOptionLabel: (option: Option) => string;
4
- export declare const getOptionValue: (option: Option) => string;
5
- export declare const isOptionDisabled: (option: Option) => boolean;
3
+ export declare const getOptionLabel: <Option>(option: Option) => string;
4
+ export declare const getOptionValue: <Option>(option: Option) => string;
5
+ export declare const isOptionDisabled: <Option>(option: Option) => boolean;
@@ -1,4 +1,3 @@
1
- import { type Option } from './types';
2
1
  export interface FilterOptionOption<Option> {
3
2
  readonly label: string;
4
3
  readonly value: string;
@@ -11,5 +10,5 @@ interface Config<Option> {
11
10
  readonly trim?: boolean;
12
11
  readonly matchFrom?: 'any' | 'start';
13
12
  }
14
- export declare const createFilter: (config?: Config<Option>) => (option: FilterOptionOption<Option>, rawInput: string) => boolean;
13
+ export declare const createFilter: <Option>(config?: Config<Option>) => (option: FilterOptionOption<Option>, rawInput: string) => boolean;
15
14
  export {};
@@ -2,7 +2,6 @@ import type Select from './select';
2
2
  import type { GroupBase } from './types';
3
3
  import useStateManager from './use-state-manager';
4
4
  export { default } from './state-manager';
5
- export { default as NonceProvider } from './nonce-provider';
6
5
  export { mergeStyles } from './styles';
7
6
  export { defaultTheme } from './theme';
8
7
  export { createFilter } from './filters';
@@ -23,6 +22,6 @@ export type { PlaceholderProps } from './components/placeholder';
23
22
  export type { SingleValueProps } from './components/single-value';
24
23
  export type { ThemeConfig } from './theme';
25
24
  export type { ClassNamesConfig, StylesConfig } from './styles';
26
- export { type GroupBase, type OptionsOrGroups, type Option, type Options, type SingleValue, type MultiValue, type PropsValue, type OnChangeValue, type Colors, type ThemeSpacing, type Theme, type ClassNamesState, type CX, type GetStyles, type CommonProps, type CommonPropsAndClassName, type ActionMetaBase, type SelectOptionActionMeta, type DeselectOptionActionMeta, type RemoveValueActionMeta, type PopValueActionMeta, type ClearActionMeta, type CreateOptionActionMeta, type InitialInputFocusedActionMeta, type ActionMeta, type SetValueAction, type InputAction, type InputActionMeta, type MenuPlacement, type CoercedMenuPlacement, type MenuPosition, type FocusDirection, type GetOptionLabel, type GetOptionValue, type CSSObjectWithLabel, } from './types';
25
+ export { type GroupBase, type OptionsOrGroups, type Options, type SingleValue, type MultiValue, type PropsValue, type OnChangeValue, type Colors, type ThemeSpacing, type Theme, type ClassNamesState, type CX, type GetStyles, type CommonProps, type CommonPropsAndClassName, type ActionMetaBase, type SelectOptionActionMeta, type DeselectOptionActionMeta, type RemoveValueActionMeta, type PopValueActionMeta, type ClearActionMeta, type CreateOptionActionMeta, type InitialInputFocusedActionMeta, type ActionMeta, type SetValueAction, type InputAction, type InputActionMeta, type MenuPlacement, type CoercedMenuPlacement, type MenuPosition, type FocusDirection, type GetOptionLabel, type GetOptionValue, type CSSObjectWithLabel, } from './types';
27
26
  export type { OptionContext, GuidanceContext, AriaGuidanceProps, AriaOnChangeProps, AriaOnFilterProps, AriaOnFocusProps, AriaLiveMessages, AriaGuidance, AriaOnChange, AriaOnFilter, AriaOnFocus, } from './accessibility';
28
27
  export type { FormatOptionLabelContext, FormatOptionLabelMeta } from './select';
@@ -405,6 +405,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
405
405
  * Use `isRequired` instead.
406
406
  */
407
407
  required?: boolean;
408
+ [key: string]: any;
408
409
  }
409
410
  export declare const defaultProps: {
410
411
  'aria-live': string;
@@ -417,16 +418,16 @@ export declare const defaultProps: {
417
418
  components: {};
418
419
  controlShouldRenderValue: boolean;
419
420
  escapeClearsValue: boolean;
420
- filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
421
+ filterOption: (option: FilterOptionOption<unknown>, rawInput: string) => boolean;
421
422
  formatGroupLabel: <Option, Group extends GroupBase<Option>>(group: Group) => string;
422
- getOptionLabel: (option: import("./types").Option) => string;
423
- getOptionValue: (option: import("./types").Option) => string;
423
+ getOptionLabel: <Option_1>(option: Option_1) => string;
424
+ getOptionValue: <Option_2>(option: Option_2) => string;
424
425
  isDisabled: boolean;
425
426
  isLoading: boolean;
426
427
  isMulti: boolean;
427
428
  isRtl: boolean;
428
429
  isSearchable: boolean;
429
- isOptionDisabled: (option: import("./types").Option) => boolean;
430
+ isOptionDisabled: <Option_3>(option: Option_3) => boolean;
430
431
  loadingMessage: () => string;
431
432
  maxMenuHeight: number;
432
433
  minMenuHeight: number;
@@ -496,16 +497,16 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
496
497
  components: {};
497
498
  controlShouldRenderValue: boolean;
498
499
  escapeClearsValue: boolean;
499
- filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
500
+ filterOption: (option: FilterOptionOption<unknown>, rawInput: string) => boolean;
500
501
  formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
501
- getOptionLabel: (option: import("./types").Option) => string;
502
- getOptionValue: (option: import("./types").Option) => string;
502
+ getOptionLabel: <Option_2>(option: Option_2) => string;
503
+ getOptionValue: <Option_3>(option: Option_3) => string;
503
504
  isDisabled: boolean;
504
505
  isLoading: boolean;
505
506
  isMulti: boolean;
506
507
  isRtl: boolean;
507
508
  isSearchable: boolean;
508
- isOptionDisabled: (option: import("./types").Option) => boolean;
509
+ isOptionDisabled: <Option_4>(option: Option_4) => boolean;
509
510
  loadingMessage: () => string;
510
511
  maxMenuHeight: number;
511
512
  minMenuHeight: number;
@@ -5,10 +5,6 @@ export interface GroupBase<Option> {
5
5
  readonly options: readonly Option[];
6
6
  readonly label?: string;
7
7
  }
8
- export interface Option {
9
- label: string;
10
- value: string;
11
- }
12
8
  export type OptionsOrGroups<Option, Group extends GroupBase<Option>> = readonly (Option | Group)[];
13
9
  export type Options<Option> = readonly Option[];
14
10
  export type SingleValue<Option> = Option | null;
@@ -1,9 +1,9 @@
1
1
  import type { StylesProps } from './styles';
2
- import type { ClassNamesState, CommonPropsAndClassName, GroupBase, InputActionMeta, MultiValue, OnChangeValue, Option, Options, PropsValue, SingleValue } from './types';
2
+ import type { ClassNamesState, CommonPropsAndClassName, GroupBase, InputActionMeta, MultiValue, OnChangeValue, Options, PropsValue, SingleValue } from './types';
3
3
  export declare const noop: () => void;
4
4
  export declare const emptyString: () => string;
5
5
  export declare function classNames(prefix?: string | null, state?: ClassNamesState, ...classNameList: string[]): string;
6
- export declare const cleanValue: (value: PropsValue<Option>) => Options<Option>;
6
+ export declare const cleanValue: <Option>(value: PropsValue<Option>) => Options<Option>;
7
7
  export declare const cleanCommonProps: <Option, IsMulti extends boolean, Group extends GroupBase<Option>, AdditionalProps>(props: Partial<CommonPropsAndClassName<Option, IsMulti, Group>> & AdditionalProps) => Omit<AdditionalProps, keyof CommonPropsAndClassName<Option, IsMulti, Group>>;
8
8
  export declare const getStyleProps: <Option, IsMulti extends boolean, Group extends GroupBase<Option>, Key extends keyof StylesProps<Option, IsMulti, Group>>(props: Pick<CommonPropsAndClassName<Option, IsMulti, Group>, 'cx' | 'getStyles' | 'getClassNames' | 'className'> & StylesProps<Option, IsMulti, Group>[Key], name: Key, classNamesState?: ClassNamesState) => {
9
9
  css: import("./types").CSSObjectWithLabel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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,15 +29,14 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/ds-lib": "^3.0.0",
31
31
  "@babel/runtime": "^7.0.0",
32
- "@emotion/cache": "^11.10.0",
33
32
  "@emotion/react": "^11.7.1",
34
33
  "@floating-ui/dom": "^1.0.1",
35
34
  "memoize-one": "^6.0.0",
36
35
  "use-isomorphic-layout-effect": "^1.1.2"
37
36
  },
38
37
  "peerDependencies": {
39
- "react": "^16.8.0 || ^17.0.0 || ^18.2.0",
40
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0"
38
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
39
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
41
40
  },
42
41
  "devDependencies": {
43
42
  "@af/integration-testing": "*",
@@ -47,8 +46,8 @@
47
46
  "@testing-library/react": "^12.1.5",
48
47
  "@testing-library/user-event": "^14.4.3",
49
48
  "jest-in-case": "^1.0.2",
49
+ "react-intl-next": "npm:react-intl@^5.18.1",
50
50
  "typescript": "~5.4.2",
51
- "user-agent-data-types": "^0.4.2",
52
51
  "wait-for-expect": "^1.2.0"
53
52
  },
54
53
  "techstack": {
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _cache = _interopRequireDefault(require("@emotion/cache"));
11
- var _react2 = require("@emotion/react");
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- var NonceProvider = function NonceProvider(_ref) {
15
- var nonce = _ref.nonce,
16
- children = _ref.children,
17
- cacheKey = _ref.cacheKey;
18
- var emotionCache = (0, _react.useMemo)(function () {
19
- return (0, _cache.default)({
20
- key: cacheKey,
21
- nonce: nonce
22
- });
23
- }, [cacheKey, nonce]);
24
- return /*#__PURE__*/_react.default.createElement(_react2.CacheProvider, {
25
- value: emotionCache
26
- }, children);
27
- };
28
-
29
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
30
- var _default = exports.default = NonceProvider;
@@ -1,19 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import createCache from '@emotion/cache';
3
- import { CacheProvider } from '@emotion/react';
4
- const NonceProvider = ({
5
- nonce,
6
- children,
7
- cacheKey
8
- }) => {
9
- const emotionCache = useMemo(() => createCache({
10
- key: cacheKey,
11
- nonce
12
- }), [cacheKey, nonce]);
13
- return /*#__PURE__*/React.createElement(CacheProvider, {
14
- value: emotionCache
15
- }, children);
16
- };
17
-
18
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
19
- export default NonceProvider;
@@ -1,20 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import createCache from '@emotion/cache';
3
- import { CacheProvider } from '@emotion/react';
4
- var NonceProvider = function NonceProvider(_ref) {
5
- var nonce = _ref.nonce,
6
- children = _ref.children,
7
- cacheKey = _ref.cacheKey;
8
- var emotionCache = useMemo(function () {
9
- return createCache({
10
- key: cacheKey,
11
- nonce: nonce
12
- });
13
- }, [cacheKey, nonce]);
14
- return /*#__PURE__*/React.createElement(CacheProvider, {
15
- value: emotionCache
16
- }, children);
17
- };
18
-
19
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
20
- export default NonceProvider;
@@ -1,8 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- interface NonceProviderProps {
3
- nonce: string;
4
- children: ReactNode;
5
- cacheKey: string;
6
- }
7
- declare const NonceProvider: ({ nonce, children, cacheKey }: NonceProviderProps) => JSX.Element;
8
- export default NonceProvider;
@@ -1,8 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- interface NonceProviderProps {
3
- nonce: string;
4
- children: ReactNode;
5
- cacheKey: string;
6
- }
7
- declare const NonceProvider: ({ nonce, children, cacheKey }: NonceProviderProps) => JSX.Element;
8
- export default NonceProvider;