@atlaskit/link-datasource 1.9.1 → 1.10.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/common/utils/locale/fetch-messages-for-locale.js +63 -0
  4. package/dist/cjs/common/zindex.js +4 -2
  5. package/dist/cjs/ui/assets-modal/modal/index.js +9 -3
  6. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +75 -0
  7. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +12 -0
  8. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +12 -0
  9. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +28 -0
  10. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +42 -0
  11. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +76 -0
  12. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +121 -0
  13. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +38 -0
  14. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +31 -0
  15. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +5 -0
  16. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +40 -0
  17. package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/index.js +11 -0
  18. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +4 -2
  19. package/dist/es2019/analytics/constants.js +1 -1
  20. package/dist/es2019/common/utils/locale/fetch-messages-for-locale.js +21 -0
  21. package/dist/es2019/common/zindex.js +3 -1
  22. package/dist/es2019/ui/assets-modal/modal/index.js +9 -3
  23. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +39 -0
  24. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +6 -0
  25. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +6 -0
  26. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +16 -0
  27. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +36 -0
  28. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +74 -0
  29. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +91 -0
  30. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +32 -0
  31. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +22 -0
  32. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +1 -0
  33. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +26 -0
  34. package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/index.js +5 -0
  35. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +4 -2
  36. package/dist/esm/analytics/constants.js +1 -1
  37. package/dist/esm/common/utils/locale/fetch-messages-for-locale.js +41 -0
  38. package/dist/esm/common/zindex.js +3 -1
  39. package/dist/esm/ui/assets-modal/modal/index.js +9 -3
  40. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +68 -0
  41. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +6 -0
  42. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +6 -0
  43. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +21 -0
  44. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +35 -0
  45. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +69 -0
  46. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +111 -0
  47. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +32 -0
  48. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +21 -0
  49. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +1 -0
  50. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +30 -0
  51. package/dist/esm/ui/jira-issues-modal/basic-filters/utils/index.js +5 -0
  52. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +4 -2
  53. package/dist/types/common/utils/locale/fetch-messages-for-locale.d.ts +2 -0
  54. package/dist/types/common/zindex.d.ts +1 -0
  55. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +12 -0
  56. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.d.ts +3 -0
  57. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.d.ts +3 -0
  58. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +5 -0
  59. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.d.ts +7 -0
  60. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +3 -0
  61. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +9 -0
  62. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +32 -0
  63. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +9 -0
  64. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +23 -0
  65. package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +6 -0
  66. package/dist/types/ui/jira-issues-modal/basic-filters/utils/index.d.ts +1 -0
  67. package/dist/types-ts4.5/common/utils/locale/fetch-messages-for-locale.d.ts +2 -0
  68. package/dist/types-ts4.5/common/zindex.d.ts +1 -0
  69. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +12 -0
  70. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.d.ts +3 -0
  71. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.d.ts +3 -0
  72. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +5 -0
  73. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.d.ts +7 -0
  74. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +3 -0
  75. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +9 -0
  76. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +32 -0
  77. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +9 -0
  78. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +23 -0
  79. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +6 -0
  80. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/index.d.ts +1 -0
  81. package/package.json +6 -4
  82. package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -17
  83. package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -15
  84. package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -13
  85. package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -15
  86. package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -11
  87. package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -8
  88. package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -6
  89. package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -8
  90. package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -11
  91. package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -8
  92. package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -6
  93. package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -8
  94. package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.d.ts +0 -4
  95. package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.d.ts +0 -3
  96. package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.d.ts +0 -3
  97. package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.d.ts +0 -3
  98. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.d.ts +0 -4
  99. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.d.ts +0 -3
  100. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.d.ts +0 -3
  101. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.d.ts +0 -3
  102. /package/dist/cjs/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
  103. /package/dist/es2019/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
  104. /package/dist/esm/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
  105. /package/dist/types/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.d.ts +0 -0
  106. /package/dist/types-ts4.5/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.d.ts +0 -0
@@ -12,10 +12,10 @@ var _react2 = require("@emotion/react");
12
12
  var _reactIntlNext = require("react-intl-next");
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
14
  var _analytics = require("../../../analytics");
15
+ var _basicFilters = require("../basic-filters");
15
16
  var _basicSearchInput = require("../basic-search-input");
16
17
  var _jqlEditor = require("../jql-editor");
17
18
  var _modeSwitcher = require("../mode-switcher");
18
- var _basicFilters = require("./basic-filters");
19
19
  var _buildJQL = require("./buildJQL");
20
20
  var _messages = require("./messages");
21
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -116,7 +116,9 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
116
116
  onChange: handleBasicSearchChange,
117
117
  onSearch: handleSearch,
118
118
  searchTerm: basicSearchTerm
119
- }), showBasicFilters && (0, _react2.jsx)(_basicFilters.BasicFilters, null)), currentSearchMethod === 'jql' && (0, _react2.jsx)(_jqlEditor.JiraJQLEditor, {
119
+ }), showBasicFilters && (0, _react2.jsx)(_basicFilters.BasicFilters, {
120
+ jql: jql
121
+ })), currentSearchMethod === 'jql' && (0, _react2.jsx)(_jqlEditor.JiraJQLEditor, {
120
122
  cloudId: cloudId || '',
121
123
  isSearching: isSearching,
122
124
  onChange: onQueryChange,
@@ -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.9.1"
4
+ packageVersion: "1.10.1"
5
5
  };
@@ -0,0 +1,21 @@
1
+ import messages from '../../../i18n/en';
2
+ export const fetchMessagesForLocale = async locale => {
3
+ try {
4
+ const messages = await import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */`../../../i18n/${locale.replace('-', '_')}`);
5
+ return messages.default;
6
+ } catch (e) {
7
+ // ignore
8
+ }
9
+ try {
10
+ const parentLocale = locale.split(/[-_]/)[0];
11
+ const messages = await import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */`../../../i18n/${parentLocale}`);
12
+ return messages.default;
13
+ } catch (e) {
14
+ // ignore
15
+ }
16
+
17
+ /**
18
+ * English bundled by default as this is the majority of users
19
+ */
20
+ return messages;
21
+ };
@@ -1,2 +1,4 @@
1
+ import { layers } from '@atlaskit/theme/constants';
1
2
  export const stickyTableHeadersIndex = 10;
2
- export const siteSelectorIndex = stickyTableHeadersIndex + 1;
3
+ export const siteSelectorIndex = stickyTableHeadersIndex + 1;
4
+ export const aboveModal = layers.modal() + 1;
@@ -5,10 +5,13 @@ import { css, jsx } from '@emotion/react';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
6
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
7
7
  import Button from '@atlaskit/button/standard-button';
8
+ import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
8
9
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
9
10
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
11
+ import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
10
12
  import { useAssetsClient } from '../../../hooks/useAssetsClient';
11
13
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
14
+ import i18nEN from '../../../i18n/en';
12
15
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
13
16
  import { AssetsSearchContainer } from '../search-container';
14
17
  import { AssetsSearchContainerLoading } from '../search-container/loading-state';
@@ -153,7 +156,10 @@ const PlainAssetsConfigModal = props => {
153
156
  });
154
157
  }
155
158
  }, [aql, assetsClientLoading, handleOnSearch, objectSchema, status, workspaceError, workspaceId]);
156
- return jsx(ModalTransition, null, jsx(Modal, {
159
+ return jsx(IntlMessagesProvider, {
160
+ defaultMessages: i18nEN,
161
+ loaderFn: fetchMessagesForLocale
162
+ }, jsx(ModalTransition, null, jsx(Modal, {
157
163
  testId: 'asset-datasource-modal',
158
164
  onClose: onCancel,
159
165
  width: "calc(100% - 80px)",
@@ -187,14 +193,14 @@ const PlainAssetsConfigModal = props => {
187
193
  values: {
188
194
  objectsCount: responseItems.length
189
195
  }
190
- }))))));
196
+ })))))));
191
197
  };
192
198
  const analyticsContextAttributes = {
193
199
  dataProvider: 'jsm-assets'
194
200
  };
195
201
  const analyticsContextData = {
196
202
  packageName: "@atlaskit/link-datasource",
197
- packageVersion: "1.9.1",
203
+ packageVersion: "1.10.1",
198
204
  source: 'datasourceConfigModal'
199
205
  };
200
206
  const contextData = {
@@ -0,0 +1,39 @@
1
+ import { useState } from 'react';
2
+ import { request } from '@atlaskit/linking-common';
3
+ // TODO: https://product-fabric.atlassian.net/browse/EDM-8118
4
+ export const useFieldValues = ({
5
+ filterType
6
+ }) => {
7
+ const [filterOptions, setFilterOptions] = useState([]);
8
+ const [totalCount] = useState(100);
9
+ const [status, setStatus] = useState('empty');
10
+ const fetchFilterOptions = async () => {
11
+ try {
12
+ setStatus('loading');
13
+ const {
14
+ data
15
+ } = await request('post', '/gateway/api/graphql', {
16
+ operationName: 'fieldValues',
17
+ variables: {
18
+ jqlTerm: filterType
19
+ }
20
+ }, {
21
+ 'Content-Type': 'application/json',
22
+ 'X-ExperimentalApi': 'JiraJqlBuilder'
23
+ });
24
+ if (data) {
25
+ setFilterOptions(data);
26
+ setStatus('resolved');
27
+ }
28
+ } catch (error) {
29
+ setStatus('error');
30
+ return setFilterOptions([]);
31
+ }
32
+ };
33
+ return {
34
+ filterOptions,
35
+ fetchFilterOptions,
36
+ totalCount,
37
+ status
38
+ };
39
+ };
@@ -0,0 +1,6 @@
1
+ export const useHydrateJqlQuery = () => {
2
+ return {
3
+ // TODO: https://product-fabric.atlassian.net/browse/EDM-8119
4
+ hydratedFields: {}
5
+ };
6
+ };
@@ -0,0 +1,6 @@
1
+ export const useIsComplexQuery = () => {
2
+ return {
3
+ // https://product-fabric.atlassian.net/browse/EDM-8103
4
+ isComplexQuery: false
5
+ };
6
+ };
@@ -0,0 +1,16 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { components } from '@atlaskit/select';
4
+ import { N40 } from '@atlaskit/theme/colors';
5
+ const popupCustomControlStyles = () => ({
6
+ display: 'flex',
7
+ padding: "var(--ds-space-050, 4px)",
8
+ borderBottom: `solid 1px ${`var(--ds-border, ${N40})`}`
9
+ });
10
+ export const CustomControl = ({
11
+ children,
12
+ ...innerProps
13
+ }) => /*#__PURE__*/React.createElement(components.Control, _extends({}, innerProps, {
14
+ getStyles: popupCustomControlStyles
15
+ }), children);
16
+ export default CustomControl;
@@ -0,0 +1,36 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import { Flex, Inline, xcss } from '@atlaskit/primitives';
5
+ import { N40 } from '@atlaskit/theme/colors';
6
+ import { asyncPopupSelectMessages } from './messages';
7
+ const footerContainerStyles = xcss({
8
+ paddingTop: 'space.050',
9
+ paddingBottom: 'space.050',
10
+ borderTop: `${`var(--ds-border, ${N40})`} solid 1px`
11
+ });
12
+ const footerPaginationInfoStyles = xcss({
13
+ color: 'color.text.subtlest',
14
+ marginBlock: 'space.100',
15
+ marginInline: 'space.150'
16
+ });
17
+ const PopupFooter = ({
18
+ currentDisplayCount,
19
+ totalCount
20
+ }) => {
21
+ return /*#__PURE__*/React.createElement(Flex, {
22
+ testId: "jlol-basic-filter-popup-select--footer",
23
+ direction: "row",
24
+ alignItems: "center",
25
+ justifyContent: "end",
26
+ xcss: footerContainerStyles
27
+ }, /*#__PURE__*/React.createElement(Inline, {
28
+ xcss: footerPaginationInfoStyles
29
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, asyncPopupSelectMessages.paginationDetails, {
30
+ values: {
31
+ currentDisplayCount,
32
+ totalCount
33
+ }
34
+ }))));
35
+ };
36
+ export default PopupFooter;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import Avatar from '@atlaskit/avatar';
3
+ import Lozenge from '@atlaskit/lozenge';
4
+ import { Box, Flex, xcss } from '@atlaskit/primitives';
5
+ const commonLabelStyles = xcss({
6
+ overflow: 'hidden',
7
+ textOverflow: 'ellipsis'
8
+ });
9
+ const avatarOptionLabelStyles = xcss({
10
+ marginLeft: 'space.050'
11
+ });
12
+ const IconOptionLabel = ({
13
+ data
14
+ }) => {
15
+ const {
16
+ label,
17
+ icon: avatar,
18
+ value
19
+ } = data;
20
+ const avatarOptionLabelData = {
21
+ label,
22
+ avatar,
23
+ value,
24
+ optionType: 'avatarLabel',
25
+ isSquare: true
26
+ };
27
+ return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
28
+ data: avatarOptionLabelData,
29
+ testId: "jlol-basic-filter-popup-select-option--icon-label"
30
+ });
31
+ };
32
+ const LozengeOptionLabel = ({
33
+ data
34
+ }) => {
35
+ return /*#__PURE__*/React.createElement(Lozenge, {
36
+ isBold: data.isBold,
37
+ appearance: data.appearance,
38
+ testId: "jlol-basic-filter-popup-select-option--lozenge"
39
+ }, /*#__PURE__*/React.createElement(Box, {
40
+ xcss: [commonLabelStyles]
41
+ }, data.label));
42
+ };
43
+ const AvatarOptionLabel = ({
44
+ data,
45
+ testId
46
+ }) => {
47
+ return /*#__PURE__*/React.createElement(Flex, {
48
+ alignItems: "center",
49
+ testId: testId || 'jlol-basic-filter-popup-select-option--avatar'
50
+ }, /*#__PURE__*/React.createElement(Avatar, {
51
+ appearance: data.isSquare ? 'square' : 'circle',
52
+ src: data.avatar,
53
+ size: "xsmall"
54
+ }), /*#__PURE__*/React.createElement(Box, {
55
+ xcss: [commonLabelStyles, avatarOptionLabelStyles],
56
+ testId: "nidhin"
57
+ }, data.label));
58
+ };
59
+ const formatOptionLabel = data => {
60
+ if (data.optionType === 'lozengeLabel') {
61
+ return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
62
+ data: data
63
+ });
64
+ }
65
+ if (data.optionType === 'avatarLabel') {
66
+ return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
67
+ data: data
68
+ });
69
+ }
70
+ return /*#__PURE__*/React.createElement(IconOptionLabel, {
71
+ data: data
72
+ });
73
+ };
74
+ export default formatOptionLabel;
@@ -0,0 +1,91 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { useIntl } from 'react-intl-next';
4
+ import { CheckboxOption, PopupSelect } from '@atlaskit/select';
5
+ import { useFieldValues } from '../../hooks/useFieldValues';
6
+ import CustomControl from './control';
7
+ import PopupFooter from './footer';
8
+ import formatOptionLabel from './formatOptionLabel';
9
+ import { asyncPopupSelectMessages } from './messages';
10
+ import PopupTrigger from './trigger';
11
+ // Needed to disable filtering from react-select
12
+ const noFilterOptions = () => true;
13
+ const AsyncPopupSelect = ({
14
+ filterType,
15
+ selection,
16
+ onSelectionChange = () => {}
17
+ }) => {
18
+ const {
19
+ formatMessage
20
+ } = useIntl();
21
+ const pickerRef = useRef(null);
22
+ const [searchTerm, setSearchTerm] = useState('');
23
+ const [selectedOptions, setSelectedOptions] = useState(selection);
24
+ const {
25
+ filterOptions,
26
+ fetchFilterOptions,
27
+ totalCount,
28
+ status
29
+ } = useFieldValues({
30
+ filterType
31
+ });
32
+ const handleInputChange = useCallback((searchString, actionMeta) => {
33
+ if (actionMeta.action === 'input-change' && searchString !== searchTerm) {
34
+ setSearchTerm(searchString);
35
+ }
36
+ }, [searchTerm]);
37
+ const handleOptionSelection = newValue => {
38
+ setSelectedOptions(newValue);
39
+ onSelectionChange(newValue);
40
+ };
41
+ const handleOpenPopup = useCallback(async () => {
42
+ if (status === 'empty') {
43
+ fetchFilterOptions();
44
+ }
45
+ }, [fetchFilterOptions, status]);
46
+ useEffect(() => {
47
+ if (status === 'resolved') {
48
+ var _pickerRef$current, _pickerRef$current$se, _pickerRef$current$se2;
49
+ // necessary to refocus the search input after the loading state
50
+ pickerRef === null || pickerRef === void 0 ? void 0 : (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : (_pickerRef$current$se = _pickerRef$current.selectRef) === null || _pickerRef$current$se === void 0 ? void 0 : (_pickerRef$current$se2 = _pickerRef$current$se.inputRef) === null || _pickerRef$current$se2 === void 0 ? void 0 : _pickerRef$current$se2.focus();
51
+ }
52
+ }, [status]);
53
+ return /*#__PURE__*/React.createElement(PopupSelect, {
54
+ isMulti: true,
55
+ maxMenuWidth: 300,
56
+ minMenuWidth: 300,
57
+ ref: pickerRef,
58
+ testId: "jlol-basic-filter-popup-select",
59
+ inputId: "jlol-basic-filter-popup-select--input",
60
+ searchThreshold: 0,
61
+ inputValue: searchTerm,
62
+ closeMenuOnSelect: false,
63
+ hideSelectedOptions: false,
64
+ isLoading: status === 'loading',
65
+ placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
66
+ components: {
67
+ /* @ts-expect-error - This component has stricter OptionType, hence a temp setup untill its made generic */
68
+ Option: CheckboxOption,
69
+ Control: CustomControl
70
+ },
71
+ options: filterOptions,
72
+ value: selectedOptions,
73
+ filterOption: noFilterOptions,
74
+ formatOptionLabel: formatOptionLabel,
75
+ onChange: handleOptionSelection,
76
+ onInputChange: handleInputChange,
77
+ target: ({
78
+ isOpen,
79
+ ...triggerProps
80
+ }) => /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
81
+ filterType: filterType,
82
+ isSelected: isOpen,
83
+ onClick: handleOpenPopup
84
+ })),
85
+ footer: /*#__PURE__*/React.createElement(PopupFooter, {
86
+ currentDisplayCount: filterOptions.length,
87
+ totalCount: totalCount
88
+ })
89
+ });
90
+ };
91
+ export default AsyncPopupSelect;
@@ -0,0 +1,32 @@
1
+ export const asyncPopupSelectMessages = {
2
+ selectPlaceholder: {
3
+ id: 'linkDataSource.basic-filter.dropdown.select.placeholder',
4
+ description: 'Placeholder text to be displayed for the search input box.',
5
+ defaultMessage: 'Search'
6
+ },
7
+ paginationDetails: {
8
+ id: 'linkDataSource.basic-filter.footer.pagination-details',
9
+ description: 'Text to indicate page count and total count information.',
10
+ defaultMessage: '{currentDisplayCount} of {totalCount}'
11
+ },
12
+ projectLabel: {
13
+ id: 'linkDataSource.basic-filter.project.label',
14
+ description: 'Label to be displayed for project filter dropdown button.',
15
+ defaultMessage: 'Project'
16
+ },
17
+ statusLabel: {
18
+ id: 'linkDataSource.basic-filter.status.label',
19
+ description: 'Label to be displayed for status filter dropdown button.',
20
+ defaultMessage: 'Status'
21
+ },
22
+ issuetypeLabel: {
23
+ id: 'linkDataSource.basic-filter.issuetype.label',
24
+ description: 'Label to be displayed for issuetype filter dropdown button.',
25
+ defaultMessage: 'Type'
26
+ },
27
+ assigneeLabel: {
28
+ id: 'linkDataSource.basic-filter.assignee.label',
29
+ description: 'Label to be displayed for assignee filter dropdown button.',
30
+ defaultMessage: 'Assignee'
31
+ }
32
+ };
@@ -0,0 +1,22 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { FormattedMessage } from 'react-intl-next';
3
+ import Button from '@atlaskit/button/standard-button';
4
+ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
5
+ import { asyncPopupSelectMessages } from './messages';
6
+ const PopupTrigger = /*#__PURE__*/forwardRef(({
7
+ filterType,
8
+ isSelected,
9
+ onClick
10
+ }, ref) => {
11
+ return /*#__PURE__*/React.createElement(Button, {
12
+ ref: ref,
13
+ appearance: "default",
14
+ isSelected: isSelected,
15
+ onClick: onClick,
16
+ testId: `jlol-basic-filter-${filterType}-trigger`,
17
+ iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
18
+ label: ""
19
+ })
20
+ }, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages[`${filterType}Label`]));
21
+ });
22
+ export default PopupTrigger;
@@ -0,0 +1,26 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Flex } from '@atlaskit/primitives';
3
+ import { isValidJql } from '../utils';
4
+ import AsyncPopupSelect from './async-popup-select';
5
+ const availableBasicFilterTypes = ['project', 'issuetype', 'status', 'assignee'];
6
+ const BasicFilterContainer = ({
7
+ jql
8
+ }) => {
9
+ const [selection] = useState([]);
10
+ useEffect(() => {
11
+ if (isValidJql(jql)) {
12
+ // hydrate hook call goes in here
13
+ }
14
+ }, [jql]);
15
+ const handleSelectionChange = () => {};
16
+ return /*#__PURE__*/React.createElement(Flex, {
17
+ gap: "space.100",
18
+ testId: "jlol-basic-filter-container"
19
+ }, availableBasicFilterTypes.map(filter => /*#__PURE__*/React.createElement(AsyncPopupSelect, {
20
+ filterType: filter,
21
+ key: filter,
22
+ selection: selection,
23
+ onSelectionChange: handleSelectionChange
24
+ })));
25
+ };
26
+ export default BasicFilterContainer;
@@ -0,0 +1,5 @@
1
+ import { JastBuilder } from '@atlaskit/jql-ast';
2
+ export const isValidJql = jql => {
3
+ const jast = new JastBuilder().build(jql);
4
+ return jast.errors.length === 0;
5
+ };
@@ -4,10 +4,10 @@ import { css, jsx } from '@emotion/react';
4
4
  import { useIntl } from 'react-intl-next';
5
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
6
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
7
+ import { BasicFilters } from '../basic-filters';
7
8
  import { BasicSearchInput } from '../basic-search-input';
8
9
  import { JiraJQLEditor } from '../jql-editor';
9
10
  import { ModeSwitcher } from '../mode-switcher';
10
- import { BasicFilters } from './basic-filters';
11
11
  import { buildJQL } from './buildJQL';
12
12
  import { modeSwitcherMessages } from './messages';
13
13
  const inputContainerStyles = css({
@@ -92,7 +92,9 @@ export const JiraSearchContainer = props => {
92
92
  onChange: handleBasicSearchChange,
93
93
  onSearch: handleSearch,
94
94
  searchTerm: basicSearchTerm
95
- }), showBasicFilters && jsx(BasicFilters, null)), currentSearchMethod === 'jql' && jsx(JiraJQLEditor, {
95
+ }), showBasicFilters && jsx(BasicFilters, {
96
+ jql: jql
97
+ })), currentSearchMethod === 'jql' && jsx(JiraJQLEditor, {
96
98
  cloudId: cloudId || '',
97
99
  isSearching: isSearching,
98
100
  onChange: onQueryChange,
@@ -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.9.1"
4
+ packageVersion: "1.10.1"
5
5
  };
@@ -0,0 +1,41 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import messages from '../../../i18n/en';
4
+ export var fetchMessagesForLocale = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(locale) {
6
+ var _messages, parentLocale, _messages2;
7
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
8
+ while (1) switch (_context.prev = _context.next) {
9
+ case 0:
10
+ _context.prev = 0;
11
+ _context.next = 3;
12
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(locale.replace('-', '_')));
13
+ case 3:
14
+ _messages = _context.sent;
15
+ return _context.abrupt("return", _messages.default);
16
+ case 7:
17
+ _context.prev = 7;
18
+ _context.t0 = _context["catch"](0);
19
+ case 9:
20
+ _context.prev = 9;
21
+ parentLocale = locale.split(/[-_]/)[0];
22
+ _context.next = 13;
23
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(parentLocale));
24
+ case 13:
25
+ _messages2 = _context.sent;
26
+ return _context.abrupt("return", _messages2.default);
27
+ case 17:
28
+ _context.prev = 17;
29
+ _context.t1 = _context["catch"](9);
30
+ case 19:
31
+ return _context.abrupt("return", messages);
32
+ case 20:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee, null, [[0, 7], [9, 17]]);
37
+ }));
38
+ return function fetchMessagesForLocale(_x) {
39
+ return _ref.apply(this, arguments);
40
+ };
41
+ }();
@@ -1,2 +1,4 @@
1
+ import { layers } from '@atlaskit/theme/constants';
1
2
  export var stickyTableHeadersIndex = 10;
2
- export var siteSelectorIndex = stickyTableHeadersIndex + 1;
3
+ export var siteSelectorIndex = stickyTableHeadersIndex + 1;
4
+ export var aboveModal = layers.modal() + 1;
@@ -11,10 +11,13 @@ import { css, jsx } from '@emotion/react';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
13
13
  import Button from '@atlaskit/button/standard-button';
14
+ import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
14
15
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
15
16
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
17
+ import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
16
18
  import { useAssetsClient } from '../../../hooks/useAssetsClient';
17
19
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
20
+ import i18nEN from '../../../i18n/en';
18
21
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
19
22
  import { AssetsSearchContainer } from '../search-container';
20
23
  import { AssetsSearchContainerLoading } from '../search-container/loading-state';
@@ -184,7 +187,10 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
184
187
  });
185
188
  }
186
189
  }, [aql, assetsClientLoading, handleOnSearch, objectSchema, status, workspaceError, workspaceId]);
187
- return jsx(ModalTransition, null, jsx(Modal, {
190
+ return jsx(IntlMessagesProvider, {
191
+ defaultMessages: i18nEN,
192
+ loaderFn: fetchMessagesForLocale
193
+ }, jsx(ModalTransition, null, jsx(Modal, {
188
194
  testId: 'asset-datasource-modal',
189
195
  onClose: onCancel,
190
196
  width: "calc(100% - 80px)",
@@ -218,14 +224,14 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
218
224
  values: {
219
225
  objectsCount: responseItems.length
220
226
  }
221
- }))))));
227
+ })))))));
222
228
  };
223
229
  var analyticsContextAttributes = {
224
230
  dataProvider: 'jsm-assets'
225
231
  };
226
232
  var analyticsContextData = {
227
233
  packageName: "@atlaskit/link-datasource",
228
- packageVersion: "1.9.1",
234
+ packageVersion: "1.10.1",
229
235
  source: 'datasourceConfigModal'
230
236
  };
231
237
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -0,0 +1,68 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { useState } from 'react';
5
+ import { request } from '@atlaskit/linking-common';
6
+ // TODO: https://product-fabric.atlassian.net/browse/EDM-8118
7
+ export var useFieldValues = function useFieldValues(_ref) {
8
+ var filterType = _ref.filterType;
9
+ var _useState = useState([]),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ filterOptions = _useState2[0],
12
+ setFilterOptions = _useState2[1];
13
+ var _useState3 = useState(100),
14
+ _useState4 = _slicedToArray(_useState3, 1),
15
+ totalCount = _useState4[0];
16
+ var _useState5 = useState('empty'),
17
+ _useState6 = _slicedToArray(_useState5, 2),
18
+ status = _useState6[0],
19
+ setStatus = _useState6[1];
20
+ var fetchFilterOptions = /*#__PURE__*/function () {
21
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
22
+ var _yield$request, data;
23
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ _context.prev = 0;
27
+ setStatus('loading');
28
+ _context.next = 4;
29
+ return request('post', '/gateway/api/graphql', {
30
+ operationName: 'fieldValues',
31
+ variables: {
32
+ jqlTerm: filterType
33
+ }
34
+ }, {
35
+ 'Content-Type': 'application/json',
36
+ 'X-ExperimentalApi': 'JiraJqlBuilder'
37
+ });
38
+ case 4:
39
+ _yield$request = _context.sent;
40
+ data = _yield$request.data;
41
+ if (data) {
42
+ setFilterOptions(data);
43
+ setStatus('resolved');
44
+ }
45
+ _context.next = 13;
46
+ break;
47
+ case 9:
48
+ _context.prev = 9;
49
+ _context.t0 = _context["catch"](0);
50
+ setStatus('error');
51
+ return _context.abrupt("return", setFilterOptions([]));
52
+ case 13:
53
+ case "end":
54
+ return _context.stop();
55
+ }
56
+ }, _callee, null, [[0, 9]]);
57
+ }));
58
+ return function fetchFilterOptions() {
59
+ return _ref2.apply(this, arguments);
60
+ };
61
+ }();
62
+ return {
63
+ filterOptions: filterOptions,
64
+ fetchFilterOptions: fetchFilterOptions,
65
+ totalCount: totalCount,
66
+ status: status
67
+ };
68
+ };