@atlaskit/react-select 1.2.0 → 1.3.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
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#160447](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160447)
8
+ [`515ed7a31a9fb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/515ed7a31a9fb) -
9
+ Make async select by default in select
10
+
3
11
  ## 1.2.0
4
12
 
5
13
  ### Minor Changes
package/dist/cjs/async.js CHANGED
@@ -20,8 +20,12 @@ var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
20
20
  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); }
21
21
  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; }
22
22
  var AsyncSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
+ // when isAsync is true, options are not provided and async props are used, we will enable async
24
+ var isAsyncEnabledInBaseSelect = props.isAsync && !props.options && (!!props.loadOptions || !!props.defaultOptions);
23
25
  var stateManagedProps = (0, _useAsync.default)(props);
24
- var selectProps = (0, _useStateManager.default)(stateManagedProps);
26
+ // when isAsync is falsy or isAsyncEnabledInBaseSelect is true, we use async props, otherwise we use base props
27
+ var selectAsyncProps = !props.isAsync || isAsyncEnabledInBaseSelect ? stateManagedProps : props;
28
+ var selectProps = (0, _useStateManager.default)(selectAsyncProps);
25
29
  return /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({
26
30
  ref: ref
27
31
  }, selectProps));
@@ -4,8 +4,12 @@ import Select from './select';
4
4
  import useAsync from './use-async';
5
5
  import useStateManager from './use-state-manager';
6
6
  const AsyncSelect = /*#__PURE__*/forwardRef((props, ref) => {
7
+ // when isAsync is true, options are not provided and async props are used, we will enable async
8
+ const isAsyncEnabledInBaseSelect = props.isAsync && !props.options && (!!props.loadOptions || !!props.defaultOptions);
7
9
  const stateManagedProps = useAsync(props);
8
- const selectProps = useStateManager(stateManagedProps);
10
+ // when isAsync is falsy or isAsyncEnabledInBaseSelect is true, we use async props, otherwise we use base props
11
+ let selectAsyncProps = !props.isAsync || isAsyncEnabledInBaseSelect ? stateManagedProps : props;
12
+ const selectProps = useStateManager(selectAsyncProps);
9
13
  return /*#__PURE__*/React.createElement(Select, _extends({
10
14
  ref: ref
11
15
  }, selectProps));
package/dist/esm/async.js CHANGED
@@ -4,8 +4,12 @@ import Select from './select';
4
4
  import useAsync from './use-async';
5
5
  import useStateManager from './use-state-manager';
6
6
  var AsyncSelect = /*#__PURE__*/forwardRef(function (props, ref) {
7
+ // when isAsync is true, options are not provided and async props are used, we will enable async
8
+ var isAsyncEnabledInBaseSelect = props.isAsync && !props.options && (!!props.loadOptions || !!props.defaultOptions);
7
9
  var stateManagedProps = useAsync(props);
8
- var selectProps = useStateManager(stateManagedProps);
10
+ // when isAsync is falsy or isAsyncEnabledInBaseSelect is true, we use async props, otherwise we use base props
11
+ var selectAsyncProps = !props.isAsync || isAsyncEnabledInBaseSelect ? stateManagedProps : props;
12
+ var selectProps = useStateManager(selectAsyncProps);
9
13
  return /*#__PURE__*/React.createElement(Select, _extends({
10
14
  ref: ref
11
15
  }, selectProps));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "1.2.0",
3
+ "version": "1.3.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",