@atlaskit/link-datasource 1.13.2 → 1.14.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,15 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42756](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42756) [`89ed621ec92`](https://bitbucket.org/atlassian/atlassian-frontend/commits/89ed621ec92) - Add loading message UI for basic filter dropdown
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
3
13
  ## 1.13.2
4
14
 
5
15
  ### Patch Changes
@@ -7,5 +7,5 @@ exports.packageMetaData = exports.EVENT_CHANNEL = void 0;
7
7
  var EVENT_CHANNEL = exports.EVENT_CHANNEL = 'media';
8
8
  var packageMetaData = exports.packageMetaData = {
9
9
  packageName: "@atlaskit/link-datasource",
10
- packageVersion: "1.13.2"
10
+ packageVersion: "1.14.0"
11
11
  };
@@ -12,14 +12,15 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
14
  var _react = _interopRequireWildcard(require("react"));
15
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
16
15
  var _reactIntlNext = require("react-intl-next");
16
+ var _useDebounce = require("use-debounce");
17
17
  var _select = require("@atlaskit/select");
18
18
  var _useFilterOptions2 = require("../../hooks/useFilterOptions");
19
19
  var _control = _interopRequireDefault(require("./control"));
20
20
  var _dropdownIndicator = _interopRequireDefault(require("./dropdownIndicator"));
21
21
  var _footer = _interopRequireDefault(require("./footer"));
22
22
  var _formatOptionLabel = _interopRequireDefault(require("./formatOptionLabel"));
23
+ var _loadingMessage = _interopRequireDefault(require("./loadingMessage"));
23
24
  var _messages = require("./messages");
24
25
  var _trigger = _interopRequireDefault(require("./trigger"));
25
26
  var _excluded = ["isOpen"];
@@ -57,9 +58,13 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
57
58
  fetchFilterOptions = _useFilterOptions.fetchFilterOptions,
58
59
  totalCount = _useFilterOptions.totalCount,
59
60
  status = _useFilterOptions.status;
60
- var handleDebouncedFetchFilterOptions = (0, _react.useMemo)(function () {
61
- return (0, _debounce.default)(fetchFilterOptions, SEARCH_DEBOUNCE_MS);
62
- }, [fetchFilterOptions]);
61
+ var _useDebouncedCallback = (0, _useDebounce.useDebouncedCallback)(function (searchString) {
62
+ fetchFilterOptions({
63
+ searchString: searchString
64
+ });
65
+ }, SEARCH_DEBOUNCE_MS),
66
+ _useDebouncedCallback2 = (0, _slicedToArray2.default)(_useDebouncedCallback, 1),
67
+ handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
63
68
  var handleInputChange = (0, _react.useCallback)( /*#__PURE__*/function () {
64
69
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newSearchTerm, actionMeta) {
65
70
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -67,9 +72,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
67
72
  case 0:
68
73
  if (actionMeta.action === 'input-change' && newSearchTerm !== searchTerm) {
69
74
  setSearchTerm(newSearchTerm);
70
- handleDebouncedFetchFilterOptions({
71
- searchString: newSearchTerm
72
- });
75
+ handleDebouncedFetchFilterOptions(newSearchTerm);
73
76
  }
74
77
  case 1:
75
78
  case "end":
@@ -129,15 +132,18 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
129
132
  closeMenuOnSelect: false,
130
133
  hideSelectedOptions: false,
131
134
  isLoading: isLoading,
135
+ loadingMessage: _loadingMessage.default,
132
136
  placeholder: formatMessage(_messages.asyncPopupSelectMessages.selectPlaceholder),
133
137
  components: {
134
138
  /* @ts-expect-error - This component has stricter OptionType, hence a temp setup untill its made generic */
135
139
  Option: _select.CheckboxOption,
136
140
  Control: _control.default,
141
+ DropdownIndicator: _dropdownIndicator.default,
137
142
  LoadingIndicator: undefined,
138
143
  // disables the three ... indicator in the searchbox when picker is loading
139
- DropdownIndicator: _dropdownIndicator.default
144
+ IndicatorSeparator: undefined // disables the | separator between search input and icon
140
145
  },
146
+
141
147
  options: options,
142
148
  value: selectedOptions,
143
149
  filterOption: noFilterOptions,
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _heading = _interopRequireDefault(require("@atlaskit/heading"));
11
+ var _primitives = require("@atlaskit/primitives");
12
+ var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
13
+ var _messages = require("./messages");
14
+ var boxStyles = (0, _primitives.xcss)({
15
+ height: "var(--ds-space-800, 64px)",
16
+ marginBottom: "var(--ds-space-200, 16px)"
17
+ });
18
+ var CustomDropdownLoadingMessage = function CustomDropdownLoadingMessage() {
19
+ return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
20
+ testId: "jlol-basic-filter-popup-select--loading-message"
21
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
22
+ xcss: boxStyles,
23
+ alignItems: "center",
24
+ justifyContent: "center"
25
+ }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
26
+ size: "large"
27
+ })), /*#__PURE__*/_react.default.createElement(_heading.default, {
28
+ level: "h400"
29
+ }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.asyncPopupSelectMessages.loadingMessage)));
30
+ };
31
+ var _default = exports.default = CustomDropdownLoadingMessage;
@@ -34,5 +34,10 @@ var asyncPopupSelectMessages = exports.asyncPopupSelectMessages = {
34
34
  id: 'linkDataSource.basic-filter.assignee.label',
35
35
  description: 'Label to be displayed for assignee filter dropdown button.',
36
36
  defaultMessage: 'Assignee'
37
+ },
38
+ loadingMessage: {
39
+ id: 'linkDataSource.basic-filter.loading-message',
40
+ defaultMessage: 'Loading...',
41
+ description: 'The text for when options are being loaded in dropdown'
37
42
  }
38
43
  };
@@ -1,5 +1,5 @@
1
1
  export const EVENT_CHANNEL = 'media';
2
2
  export const packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.13.2"
4
+ packageVersion: "1.14.0"
5
5
  };
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import debounce from 'lodash/debounce';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
4
3
  import { useIntl } from 'react-intl-next';
4
+ import { useDebouncedCallback } from 'use-debounce';
5
5
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
6
6
  import { useFilterOptions } from '../../hooks/useFilterOptions';
7
7
  import CustomControl from './control';
8
8
  import CustomDropdownIndicator from './dropdownIndicator';
9
9
  import PopupFooter from './footer';
10
10
  import formatOptionLabel from './formatOptionLabel';
11
+ import CustomDropdownLoadingMessage from './loadingMessage';
11
12
  import { asyncPopupSelectMessages } from './messages';
12
13
  import PopupTrigger from './trigger';
13
14
  // Needed to disable filtering from react-select
@@ -35,13 +36,15 @@ const AsyncPopupSelect = ({
35
36
  filterType,
36
37
  cloudId
37
38
  });
38
- const handleDebouncedFetchFilterOptions = useMemo(() => debounce(fetchFilterOptions, SEARCH_DEBOUNCE_MS), [fetchFilterOptions]);
39
+ const [handleDebouncedFetchFilterOptions] = useDebouncedCallback(searchString => {
40
+ fetchFilterOptions({
41
+ searchString
42
+ });
43
+ }, SEARCH_DEBOUNCE_MS);
39
44
  const handleInputChange = useCallback(async (newSearchTerm, actionMeta) => {
40
45
  if (actionMeta.action === 'input-change' && newSearchTerm !== searchTerm) {
41
46
  setSearchTerm(newSearchTerm);
42
- handleDebouncedFetchFilterOptions({
43
- searchString: newSearchTerm
44
- });
47
+ handleDebouncedFetchFilterOptions(newSearchTerm);
45
48
  }
46
49
  }, [handleDebouncedFetchFilterOptions, searchTerm]);
47
50
  const handleOptionSelection = newValue => {
@@ -81,15 +84,18 @@ const AsyncPopupSelect = ({
81
84
  closeMenuOnSelect: false,
82
85
  hideSelectedOptions: false,
83
86
  isLoading: isLoading,
87
+ loadingMessage: CustomDropdownLoadingMessage,
84
88
  placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
85
89
  components: {
86
90
  /* @ts-expect-error - This component has stricter OptionType, hence a temp setup untill its made generic */
87
91
  Option: CheckboxOption,
88
92
  Control: CustomControl,
93
+ DropdownIndicator: CustomDropdownIndicator,
89
94
  LoadingIndicator: undefined,
90
95
  // disables the three ... indicator in the searchbox when picker is loading
91
- DropdownIndicator: CustomDropdownIndicator
96
+ IndicatorSeparator: undefined // disables the | separator between search input and icon
92
97
  },
98
+
93
99
  options: options,
94
100
  value: selectedOptions,
95
101
  filterOption: noFilterOptions,
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import { Flex, Stack, xcss } from '@atlaskit/primitives';
5
+ import Spinner from '@atlaskit/spinner';
6
+ import { asyncPopupSelectMessages } from './messages';
7
+ const boxStyles = xcss({
8
+ height: "var(--ds-space-800, 64px)",
9
+ marginBottom: "var(--ds-space-200, 16px)"
10
+ });
11
+ const CustomDropdownLoadingMessage = () => {
12
+ return /*#__PURE__*/React.createElement(Stack, {
13
+ testId: "jlol-basic-filter-popup-select--loading-message"
14
+ }, /*#__PURE__*/React.createElement(Flex, {
15
+ xcss: boxStyles,
16
+ alignItems: "center",
17
+ justifyContent: "center"
18
+ }, /*#__PURE__*/React.createElement(Spinner, {
19
+ size: "large"
20
+ })), /*#__PURE__*/React.createElement(Heading, {
21
+ level: "h400"
22
+ }, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages.loadingMessage)));
23
+ };
24
+ export default CustomDropdownLoadingMessage;
@@ -28,5 +28,10 @@ export const asyncPopupSelectMessages = {
28
28
  id: 'linkDataSource.basic-filter.assignee.label',
29
29
  description: 'Label to be displayed for assignee filter dropdown button.',
30
30
  defaultMessage: 'Assignee'
31
+ },
32
+ loadingMessage: {
33
+ id: 'linkDataSource.basic-filter.loading-message',
34
+ defaultMessage: 'Loading...',
35
+ description: 'The text for when options are being loaded in dropdown'
31
36
  }
32
37
  };
@@ -1,5 +1,5 @@
1
1
  export var EVENT_CHANNEL = 'media';
2
2
  export var packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.13.2"
4
+ packageVersion: "1.14.0"
5
5
  };
@@ -4,15 +4,16 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  var _excluded = ["isOpen"];
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
- import debounce from 'lodash/debounce';
7
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
9
8
  import { useIntl } from 'react-intl-next';
9
+ import { useDebouncedCallback } from 'use-debounce';
10
10
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
11
11
  import { useFilterOptions } from '../../hooks/useFilterOptions';
12
12
  import CustomControl from './control';
13
13
  import CustomDropdownIndicator from './dropdownIndicator';
14
14
  import PopupFooter from './footer';
15
15
  import formatOptionLabel from './formatOptionLabel';
16
+ import CustomDropdownLoadingMessage from './loadingMessage';
16
17
  import { asyncPopupSelectMessages } from './messages';
17
18
  import PopupTrigger from './trigger';
18
19
  // Needed to disable filtering from react-select
@@ -47,9 +48,13 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
47
48
  fetchFilterOptions = _useFilterOptions.fetchFilterOptions,
48
49
  totalCount = _useFilterOptions.totalCount,
49
50
  status = _useFilterOptions.status;
50
- var handleDebouncedFetchFilterOptions = useMemo(function () {
51
- return debounce(fetchFilterOptions, SEARCH_DEBOUNCE_MS);
52
- }, [fetchFilterOptions]);
51
+ var _useDebouncedCallback = useDebouncedCallback(function (searchString) {
52
+ fetchFilterOptions({
53
+ searchString: searchString
54
+ });
55
+ }, SEARCH_DEBOUNCE_MS),
56
+ _useDebouncedCallback2 = _slicedToArray(_useDebouncedCallback, 1),
57
+ handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
53
58
  var handleInputChange = useCallback( /*#__PURE__*/function () {
54
59
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchTerm, actionMeta) {
55
60
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -57,9 +62,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
57
62
  case 0:
58
63
  if (actionMeta.action === 'input-change' && newSearchTerm !== searchTerm) {
59
64
  setSearchTerm(newSearchTerm);
60
- handleDebouncedFetchFilterOptions({
61
- searchString: newSearchTerm
62
- });
65
+ handleDebouncedFetchFilterOptions(newSearchTerm);
63
66
  }
64
67
  case 1:
65
68
  case "end":
@@ -119,15 +122,18 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
119
122
  closeMenuOnSelect: false,
120
123
  hideSelectedOptions: false,
121
124
  isLoading: isLoading,
125
+ loadingMessage: CustomDropdownLoadingMessage,
122
126
  placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
123
127
  components: {
124
128
  /* @ts-expect-error - This component has stricter OptionType, hence a temp setup untill its made generic */
125
129
  Option: CheckboxOption,
126
130
  Control: CustomControl,
131
+ DropdownIndicator: CustomDropdownIndicator,
127
132
  LoadingIndicator: undefined,
128
133
  // disables the three ... indicator in the searchbox when picker is loading
129
- DropdownIndicator: CustomDropdownIndicator
134
+ IndicatorSeparator: undefined // disables the | separator between search input and icon
130
135
  },
136
+
131
137
  options: options,
132
138
  value: selectedOptions,
133
139
  filterOption: noFilterOptions,
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import { Flex, Stack, xcss } from '@atlaskit/primitives';
5
+ import Spinner from '@atlaskit/spinner';
6
+ import { asyncPopupSelectMessages } from './messages';
7
+ var boxStyles = xcss({
8
+ height: "var(--ds-space-800, 64px)",
9
+ marginBottom: "var(--ds-space-200, 16px)"
10
+ });
11
+ var CustomDropdownLoadingMessage = function CustomDropdownLoadingMessage() {
12
+ return /*#__PURE__*/React.createElement(Stack, {
13
+ testId: "jlol-basic-filter-popup-select--loading-message"
14
+ }, /*#__PURE__*/React.createElement(Flex, {
15
+ xcss: boxStyles,
16
+ alignItems: "center",
17
+ justifyContent: "center"
18
+ }, /*#__PURE__*/React.createElement(Spinner, {
19
+ size: "large"
20
+ })), /*#__PURE__*/React.createElement(Heading, {
21
+ level: "h400"
22
+ }, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages.loadingMessage)));
23
+ };
24
+ export default CustomDropdownLoadingMessage;
@@ -28,5 +28,10 @@ export var asyncPopupSelectMessages = {
28
28
  id: 'linkDataSource.basic-filter.assignee.label',
29
29
  description: 'Label to be displayed for assignee filter dropdown button.',
30
30
  defaultMessage: 'Assignee'
31
+ },
32
+ loadingMessage: {
33
+ id: 'linkDataSource.basic-filter.loading-message',
34
+ defaultMessage: 'Loading...',
35
+ description: 'The text for when options are being loaded in dropdown'
31
36
  }
32
37
  };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const CustomDropdownLoadingMessage: () => JSX.Element;
3
+ export default CustomDropdownLoadingMessage;
@@ -29,4 +29,9 @@ export declare const asyncPopupSelectMessages: {
29
29
  description: string;
30
30
  defaultMessage: string;
31
31
  };
32
+ loadingMessage: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
32
37
  };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const CustomDropdownLoadingMessage: () => JSX.Element;
3
+ export default CustomDropdownLoadingMessage;
@@ -29,4 +29,9 @@ export declare const asyncPopupSelectMessages: {
29
29
  description: string;
30
30
  defaultMessage: string;
31
31
  };
32
+ loadingMessage: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
32
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.13.2",
3
+ "version": "1.14.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/button": "^16.13.0",
37
37
  "@atlaskit/editor-prosemirror": "1.1.0",
38
38
  "@atlaskit/empty-state": "^7.5.0",
39
- "@atlaskit/form": "^8.11.0",
39
+ "@atlaskit/form": "^9.0.0",
40
40
  "@atlaskit/heading": "^1.4.0",
41
41
  "@atlaskit/icon": "^21.12.0",
42
42
  "@atlaskit/icon-object": "^6.3.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-indicator": "^0.17.0",
57
57
  "@atlaskit/primitives": "^1.9.0",
58
58
  "@atlaskit/select": "^16.7.0",
59
- "@atlaskit/smart-card": "^26.41.0",
59
+ "@atlaskit/smart-card": "^26.42.0",
60
60
  "@atlaskit/spinner": "^15.6.0",
61
61
  "@atlaskit/tag": "^11.6.0",
62
62
  "@atlaskit/textfield": "5.6.8",
@@ -72,6 +72,7 @@
72
72
  "lodash": "^4.17.21",
73
73
  "react-dom": "^16.8.0",
74
74
  "tiny-invariant": "^1.2.0",
75
+ "use-debounce": "^3.4.0",
75
76
  "uuid": "^3.1.0"
76
77
  },
77
78
  "peerDependencies": {