@atlaskit/link-datasource 3.12.1 → 3.13.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 (53) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/hooks/useLoadOptions.js +100 -0
  3. package/dist/cjs/ui/common/error-state/loading-error.js +11 -12
  4. package/dist/cjs/ui/common/error-state/modal-loading-error.js +10 -17
  5. package/dist/cjs/ui/common/error-state/no-instances.js +11 -11
  6. package/dist/cjs/ui/common/error-state/no-results.js +15 -19
  7. package/dist/cjs/ui/common/modal/count-view-smart-link/index.js +19 -15
  8. package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +16 -106
  9. package/dist/cjs/ui/issue-like-table/edit-type/index.js +26 -9
  10. package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +10 -112
  11. package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +4 -6
  12. package/dist/cjs/ui/issue-like-table/edit-type/user/index.js +97 -0
  13. package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +5 -2
  14. package/dist/es2019/hooks/useLoadOptions.js +63 -0
  15. package/dist/es2019/ui/common/error-state/loading-error.js +11 -12
  16. package/dist/es2019/ui/common/error-state/modal-loading-error.js +10 -17
  17. package/dist/es2019/ui/common/error-state/no-instances.js +13 -13
  18. package/dist/es2019/ui/common/error-state/no-results.js +16 -20
  19. package/dist/es2019/ui/common/modal/count-view-smart-link/index.js +20 -16
  20. package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +13 -74
  21. package/dist/es2019/ui/issue-like-table/edit-type/index.js +24 -5
  22. package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +8 -76
  23. package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +5 -5
  24. package/dist/es2019/ui/issue-like-table/edit-type/user/index.js +74 -0
  25. package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +5 -2
  26. package/dist/esm/hooks/useLoadOptions.js +93 -0
  27. package/dist/esm/ui/common/error-state/loading-error.js +11 -12
  28. package/dist/esm/ui/common/error-state/modal-loading-error.js +10 -17
  29. package/dist/esm/ui/common/error-state/no-instances.js +13 -13
  30. package/dist/esm/ui/common/error-state/no-results.js +16 -20
  31. package/dist/esm/ui/common/modal/count-view-smart-link/index.js +20 -16
  32. package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +18 -107
  33. package/dist/esm/ui/issue-like-table/edit-type/index.js +25 -5
  34. package/dist/esm/ui/issue-like-table/edit-type/status/index.js +11 -113
  35. package/dist/esm/ui/issue-like-table/edit-type/text/index.js +3 -5
  36. package/dist/esm/ui/issue-like-table/edit-type/user/index.js +87 -0
  37. package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +5 -2
  38. package/dist/types/hooks/useLoadOptions.d.ts +11 -0
  39. package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +2 -2
  40. package/dist/types/ui/issue-like-table/edit-type/index.d.ts +1 -0
  41. package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +4 -4
  42. package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +2 -3
  43. package/dist/types/ui/issue-like-table/edit-type/user/index.d.ts +11 -0
  44. package/dist/types/ui/issue-like-table/types.d.ts +3 -0
  45. package/dist/types-ts4.5/hooks/useLoadOptions.d.ts +11 -0
  46. package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +2 -2
  47. package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +1 -0
  48. package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +4 -4
  49. package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +2 -3
  50. package/dist/types-ts4.5/ui/issue-like-table/edit-type/user/index.d.ts +11 -0
  51. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +3 -0
  52. package/examples-helpers/buildIssueLikeTable.tsx +2 -1
  53. package/package.json +8 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#167375](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167375)
8
+ [`ce85e442a7d6e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ce85e442a7d6e) -
9
+ [ux] Use atlaskit primitives for typography
10
+ - Updated dependencies
11
+
12
+ ## 3.13.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#165646](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165646)
17
+ [`4f3ffed207bd9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4f3ffed207bd9) -
18
+ [ux] Add assignee inline edit component for datasource
19
+
20
+ ### Patch Changes
21
+
22
+ - [#166191](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166191)
23
+ [`4a75bbe263f85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4a75bbe263f85) -
24
+ Internal refactor behind ff - Make loadOptions reusable for all inline edit dropdown fields
25
+ - Updated dependencies
26
+
3
27
  ## 3.12.1
4
28
 
5
29
  ### Patch Changes
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useLoadOptions = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _react = require("react");
12
+ var _linkingTypes = require("@atlaskit/linking-types");
13
+ var _useDatasourceTableFlag = require("./useDatasourceTableFlag");
14
+ var loadOptions = /*#__PURE__*/function () {
15
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
16
+ var fetchInputs,
17
+ executeFetch,
18
+ result,
19
+ operationStatus,
20
+ entities,
21
+ _args = arguments;
22
+ return _regenerator.default.wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
26
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
27
+ if (executeFetch) {
28
+ _context.next = 4;
29
+ break;
30
+ }
31
+ return _context.abrupt("return", []);
32
+ case 4:
33
+ _context.next = 6;
34
+ return executeFetch(fetchInputs);
35
+ case 6:
36
+ result = _context.sent;
37
+ operationStatus = result.operationStatus, entities = result.entities;
38
+ if (!(operationStatus === _linkingTypes.ActionOperationStatus.FAILURE)) {
39
+ _context.next = 10;
40
+ break;
41
+ }
42
+ throw new Error('Failed to fetch status options');
43
+ case 10:
44
+ return _context.abrupt("return", entities !== null && entities !== void 0 ? entities : []);
45
+ case 11:
46
+ case "end":
47
+ return _context.stop();
48
+ }
49
+ }, _callee);
50
+ }));
51
+ return function loadOptions() {
52
+ return _ref.apply(this, arguments);
53
+ };
54
+ }();
55
+ var useLoadOptions = exports.useLoadOptions = function useLoadOptions(_ref2) {
56
+ var fetchInputs = _ref2.fetchInputs,
57
+ executeFetch = _ref2.executeFetch;
58
+ var _useState = (0, _react.useState)({
59
+ isLoading: true,
60
+ options: [],
61
+ hasFailed: false
62
+ }),
63
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
+ _useState2$ = _useState2[0],
65
+ options = _useState2$.options,
66
+ isLoading = _useState2$.isLoading,
67
+ hasFailed = _useState2$.hasFailed,
68
+ setOptions = _useState2[1];
69
+ var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
70
+ isFetchAction: true
71
+ }),
72
+ showErrorFlag = _useDatasourceTableFl.showErrorFlag;
73
+ (0, _react.useEffect)(function () {
74
+ var isMounted = true;
75
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
76
+ if (isMounted) {
77
+ setOptions({
78
+ isLoading: false,
79
+ options: options,
80
+ hasFailed: false
81
+ });
82
+ }
83
+ }).catch(function (err) {
84
+ showErrorFlag();
85
+ setOptions({
86
+ isLoading: false,
87
+ options: [],
88
+ hasFailed: true
89
+ });
90
+ });
91
+ return function () {
92
+ isMounted = false;
93
+ };
94
+ }, [fetchInputs, executeFetch, showErrorFlag]);
95
+ return {
96
+ options: options,
97
+ isLoading: isLoading,
98
+ hasFailed: hasFailed
99
+ };
100
+ };
@@ -9,6 +9,7 @@ var _react = require("react");
9
9
  var _react2 = require("@emotion/react");
10
10
  var _reactIntlNext = require("react-intl-next");
11
11
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
12
+ var _primitives = require("@atlaskit/primitives");
12
13
  var _typography = require("@atlaskit/theme/typography");
13
14
  var _analytics = require("../../../analytics");
14
15
  var _loadingErrorSvg = require("./loading-error-svg");
@@ -35,9 +36,6 @@ var errorMessageStyles = (0, _react2.css)({
35
36
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
36
37
  font: "var(--ds-font-heading-small, ".concat(_typography.fontFallback.heading.small, ")")
37
38
  });
38
- var errorDescriptionStyles = (0, _react2.css)({
39
- margin: 0
40
- });
41
39
  var LoadingError = exports.LoadingError = function LoadingError(_ref) {
42
40
  var onRefresh = _ref.onRefresh;
43
41
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
@@ -47,15 +45,16 @@ var LoadingError = exports.LoadingError = function LoadingError(_ref) {
47
45
  reason: 'network'
48
46
  });
49
47
  }, [fireEvent]);
50
- return (0, _react2.jsx)("div", {
51
- css: errorContainerStyles,
52
- "data-testid": "datasource--loading-error"
53
- }, (0, _react2.jsx)(_loadingErrorSvg.LoadingErrorSVG, null), (0, _react2.jsx)("div", {
54
- css: errorMessageContainerStyles
55
- }, (0, _react2.jsx)("span", {
56
- css: errorMessageStyles
57
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadItems)), (0, _react2.jsx)("p", {
58
- css: errorDescriptionStyles
48
+ return (0, _react2.jsx)(_primitives.Box, {
49
+ xcss: errorContainerStyles,
50
+ testId: "datasource--loading-error"
51
+ }, (0, _react2.jsx)(_loadingErrorSvg.LoadingErrorSVG, null), (0, _react2.jsx)(_primitives.Box, {
52
+ xcss: errorMessageContainerStyles
53
+ }, (0, _react2.jsx)(_primitives.Inline, {
54
+ as: "span",
55
+ xcss: errorMessageStyles
56
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadItems)), (0, _react2.jsx)(_primitives.Text, {
57
+ as: "p"
59
58
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.checkConnection)), onRefresh && (0, _react2.jsx)(_standardButton.default, {
60
59
  appearance: "primary",
61
60
  onClick: onRefresh
@@ -7,7 +7,7 @@ exports.ModalLoadingError = void 0;
7
7
  var _react = require("react");
8
8
  var _react2 = require("@emotion/react");
9
9
  var _reactIntlNext = require("react-intl-next");
10
- var _typography = require("@atlaskit/theme/typography");
10
+ var _primitives = require("@atlaskit/primitives");
11
11
  var _analytics = require("../../../analytics");
12
12
  var _loadingErrorSvg = require("./loading-error-svg");
13
13
  var _messages = require("./messages");
@@ -29,13 +29,6 @@ var errorMessageContainerStyles = (0, _react2.css)({
29
29
  gap: "var(--ds-space-100, 8px)",
30
30
  placeItems: 'center'
31
31
  });
32
- var errorMessageStyles = (0, _react2.css)({
33
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
34
- font: "var(--ds-font-heading-small, ".concat(_typography.fontFallback.heading.small, ")")
35
- });
36
- var errorDescriptionStyles = (0, _react2.css)({
37
- margin: 0
38
- });
39
32
  var ModalLoadingError = exports.ModalLoadingError = function ModalLoadingError(_ref) {
40
33
  var _ref$errorMessage = _ref.errorMessage,
41
34
  errorMessage = _ref$errorMessage === void 0 ? (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.checkConnection) : _ref$errorMessage;
@@ -46,14 +39,14 @@ var ModalLoadingError = exports.ModalLoadingError = function ModalLoadingError(_
46
39
  reason: 'network'
47
40
  });
48
41
  }, [fireEvent]);
49
- return (0, _react2.jsx)("div", {
50
- css: errorContainerStyles,
51
- "data-testid": "datasource-modal--loading-error"
52
- }, (0, _react2.jsx)(_loadingErrorSvg.LoadingErrorSVG, null), (0, _react2.jsx)("div", {
53
- css: errorMessageContainerStyles
54
- }, (0, _react2.jsx)("span", {
55
- css: errorMessageStyles
56
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadResults)), (0, _react2.jsx)("p", {
57
- css: errorDescriptionStyles
42
+ return (0, _react2.jsx)(_primitives.Box, {
43
+ xcss: errorContainerStyles,
44
+ testId: "datasource-modal--loading-error"
45
+ }, (0, _react2.jsx)(_loadingErrorSvg.LoadingErrorSVG, null), (0, _react2.jsx)(_primitives.Box, {
46
+ xcss: errorMessageContainerStyles
47
+ }, (0, _react2.jsx)(_primitives.Text, {
48
+ size: "small"
49
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadResults)), (0, _react2.jsx)(_primitives.Text, {
50
+ as: "p"
58
51
  }, errorMessage)));
59
52
  };
@@ -7,7 +7,6 @@ exports.NoInstancesView = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  var _reactIntlNext = require("react-intl-next");
9
9
  var _primitives = require("@atlaskit/primitives");
10
- var _typography = require("@atlaskit/theme/typography");
11
10
  var _noInstancesSvg = require("./no-instances-svg");
12
11
  /**
13
12
  * @jsxRuntime classic
@@ -15,13 +14,12 @@ var _noInstancesSvg = require("./no-instances-svg");
15
14
  */
16
15
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
17
16
 
18
- var titleStyles = (0, _react.css)({
19
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
20
- font: "var(--ds-font-heading-small, ".concat(_typography.fontFallback.heading.small, ")"),
21
- marginTop: "var(--ds-space-200, 16px)"
17
+ var titleStyles = (0, _primitives.xcss)({
18
+ font: 'font.heading.small',
19
+ marginTop: 'space.200'
22
20
  });
23
- var descriptionStyles = (0, _react.css)({
24
- marginTop: "var(--ds-space-100, 8px)"
21
+ var descriptionStyles = (0, _primitives.xcss)({
22
+ marginTop: 'space.100'
25
23
  });
26
24
  var containerStyles = (0, _primitives.xcss)({
27
25
  marginTop: 'space.800'
@@ -37,9 +35,11 @@ var NoInstancesView = exports.NoInstancesView = function NoInstancesView(_ref) {
37
35
  direction: "column",
38
36
  alignItems: "center",
39
37
  xcss: containerStyles
40
- }, (0, _react.jsx)(_noInstancesSvg.NoInstancesSvg, null), (0, _react.jsx)("span", {
41
- css: titleStyles
42
- }, formatMessage(title)), (0, _react.jsx)("span", {
43
- css: descriptionStyles
38
+ }, (0, _react.jsx)(_noInstancesSvg.NoInstancesSvg, null), (0, _react.jsx)(_primitives.Inline, {
39
+ as: "span",
40
+ xcss: titleStyles
41
+ }, formatMessage(title)), (0, _react.jsx)(_primitives.Inline, {
42
+ as: "span",
43
+ xcss: descriptionStyles
44
44
  }, formatMessage(description)));
45
45
  };
@@ -9,7 +9,7 @@ var _react = require("react");
9
9
  var _react2 = require("@emotion/react");
10
10
  var _reactIntlNext = require("react-intl-next");
11
11
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
12
- var _typography = require("@atlaskit/theme/typography");
12
+ var _primitives = require("@atlaskit/primitives");
13
13
  var _analytics = require("../../../analytics");
14
14
  var _messages = require("./messages");
15
15
  /**
@@ -19,22 +19,16 @@ var _messages = require("./messages");
19
19
 
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
21
 
22
- var noResultsContainerStyles = (0, _react2.css)({
23
- margin: "var(--ds-space-500, 40px)".concat(" auto"),
24
- display: 'grid',
25
- gap: "var(--ds-space-300, 24px)",
22
+ var noResultsContainerStyles = (0, _primitives.xcss)({
23
+ margin: 'space.500',
24
+ gap: 'space.300',
26
25
  placeItems: 'center',
27
26
  placeSelf: 'center'
28
27
  });
29
- var noResultsMessageContainerStyles = (0, _react2.css)({
30
- display: 'grid',
31
- gap: "var(--ds-space-100, 8px)",
28
+ var noResultsMessageContainerStyles = (0, _primitives.xcss)({
29
+ gap: 'space.100',
32
30
  placeItems: 'center'
33
31
  });
34
- var noResultsMessageStyles = (0, _react2.css)({
35
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
36
- font: "var(--ds-font-heading-small, ".concat(_typography.fontFallback.heading.small, ")")
37
- });
38
32
  var NoResults = exports.NoResults = function NoResults(_ref) {
39
33
  var onRefresh = _ref.onRefresh;
40
34
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
@@ -42,9 +36,9 @@ var NoResults = exports.NoResults = function NoResults(_ref) {
42
36
  (0, _react.useEffect)(function () {
43
37
  fireEvent('ui.emptyResult.shown.datasource', {});
44
38
  }, [fireEvent]);
45
- return (0, _react2.jsx)("div", {
46
- css: noResultsContainerStyles,
47
- "data-testid": "datasource-modal--no-results"
39
+ return (0, _react2.jsx)(_primitives.Grid, {
40
+ xcss: noResultsContainerStyles,
41
+ testId: "datasource-modal--no-results"
48
42
  }, (0, _react2.jsx)("svg", {
49
43
  width: "131",
50
44
  height: "120",
@@ -170,10 +164,12 @@ var NoResults = exports.NoResults = function NoResults(_ref) {
170
164
  width: "130.927",
171
165
  height: "120",
172
166
  fill: "white"
173
- })))), (0, _react2.jsx)("div", {
174
- css: noResultsMessageContainerStyles
175
- }, (0, _react2.jsx)("span", {
176
- css: noResultsMessageStyles
167
+ })))), (0, _react2.jsx)(_primitives.Grid, {
168
+ xcss: noResultsMessageContainerStyles
169
+ }, (0, _react2.jsx)(_primitives.Text, {
170
+ as: "span",
171
+ size: "large",
172
+ weight: "bold"
177
173
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.noResultsFound)), onRefresh && (0, _react2.jsx)(_standardButton.default, {
178
174
  appearance: "primary",
179
175
  onClick: onRefresh
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.SmartLink = exports.SmartCardPlaceholder = void 0;
8
8
  var _react = require("@emotion/react");
9
9
  var _reactIntlNext = require("react-intl-next");
10
- var _colors = require("@atlaskit/theme/colors");
10
+ var _primitives = require("@atlaskit/primitives");
11
11
  var _link = _interopRequireDefault(require("../../../issue-like-table/render-type/link"));
12
12
  /**
13
13
  * @jsxRuntime classic
@@ -15,29 +15,33 @@ var _link = _interopRequireDefault(require("../../../issue-like-table/render-typ
15
15
  */
16
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
17
17
 
18
- var placeholderSmartLinkStyles = (0, _react.css)({
19
- backgroundColor: "var(--ds-surface-raised, ".concat(_colors.N0, ")"),
18
+ var placeholderSmartLinkStyles = (0, _primitives.xcss)({
19
+ backgroundColor: 'elevation.surface.raised',
20
20
  borderRadius: "var(--ds-border-radius-200, 3px)",
21
- boxShadow: '0px 1px 1px rgba(9, 30, 66, 0.25), 0px 0px 1px rgba(9, 30, 66, 0.31)',
22
- color: "var(--ds-text-brand, ".concat(_colors.B400, ")"),
23
- padding: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-025, 2px)")
21
+ color: 'color.text.brand',
22
+ paddingTop: 'space.0',
23
+ paddingBottom: 'space.0',
24
+ paddingLeft: 'space.025',
25
+ paddingRight: 'space.025',
26
+ boxShadow: 'elevation.shadow.raised'
24
27
  });
25
- var smartLinkContainerStyles = (0, _react.css)({
26
- paddingLeft: "var(--ds-space-025, 2px)"
28
+ var smartLinkContainerStyles = (0, _primitives.xcss)({
29
+ paddingLeft: 'space.025'
27
30
  });
28
31
  var SmartCardPlaceholder = exports.SmartCardPlaceholder = function SmartCardPlaceholder(_ref) {
29
32
  var placeholderText = _ref.placeholderText;
30
- return (0, _react.jsx)("div", {
31
- css: smartLinkContainerStyles
32
- }, (0, _react.jsx)("span", {
33
- "data-testid": "datasource-modal--smart-card-placeholder",
34
- css: placeholderSmartLinkStyles
33
+ return (0, _react.jsx)(_primitives.Box, {
34
+ xcss: smartLinkContainerStyles
35
+ }, (0, _react.jsx)(_primitives.Box, {
36
+ as: "span",
37
+ testId: "datasource-modal--smart-card-placeholder",
38
+ xcss: placeholderSmartLinkStyles
35
39
  }, (0, _react.jsx)(_reactIntlNext.FormattedMessage, placeholderText)));
36
40
  };
37
41
  var SmartLink = exports.SmartLink = function SmartLink(_ref2) {
38
42
  var url = _ref2.url;
39
- return (0, _react.jsx)("div", {
40
- css: smartLinkContainerStyles
43
+ return (0, _react.jsx)(_primitives.Box, {
44
+ xcss: smartLinkContainerStyles
41
45
  }, (0, _react.jsx)(_link.default, {
42
46
  url: url
43
47
  }));
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
10
  var _react = _interopRequireWildcard(require("react"));
14
- var _linkingTypes = require("@atlaskit/linking-types");
15
11
  var _select = _interopRequireDefault(require("@atlaskit/select"));
16
12
  var _ufoExperiences = require("../../../../analytics/ufoExperiences");
17
13
  var _datasourceExperienceId = require("../../../../contexts/datasource-experience-id");
18
- var _useDatasourceTableFlag = require("../../../../hooks/useDatasourceTableFlag");
14
+ var _useLoadOptions2 = require("../../../../hooks/useLoadOptions");
19
15
  var _icon = require("../../shared-components/icon");
20
16
  var _inlineEdit = require("../../table-cell-content/inline-edit");
21
17
  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); }
@@ -30,10 +26,12 @@ var IconEditType = function IconEditType(props) {
30
26
  var _currentValue$values;
31
27
  var currentValue = props.currentValue,
32
28
  executeFetch = props.executeFetch;
33
- var _usePriorityOptions = usePriorityOptions(currentValue, executeFetch),
34
- options = _usePriorityOptions.options,
35
- isLoading = _usePriorityOptions.isLoading,
36
- hasFailed = _usePriorityOptions.hasFailed;
29
+ var _useLoadOptions = (0, _useLoadOptions2.useLoadOptions)({
30
+ executeFetch: executeFetch
31
+ }),
32
+ options = _useLoadOptions.options,
33
+ isLoading = _useLoadOptions.isLoading,
34
+ hasFailed = _useLoadOptions.hasFailed;
37
35
  var experienceId = (0, _datasourceExperienceId.useDatasourceExperienceId)();
38
36
  (0, _react.useEffect)(function () {
39
37
  if (!experienceId) {
@@ -49,18 +47,19 @@ var IconEditType = function IconEditType(props) {
49
47
  }, experienceId);
50
48
  }
51
49
  }, [experienceId, isLoading, hasFailed]);
52
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
53
- testId: "inline-edit-priority",
50
+ return /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
54
51
  autoFocus: true,
55
- defaultMenuIsOpen: true,
56
52
  blurInputOnSelect: true,
57
- getOptionValue: function getOptionValue(option) {
58
- return option.text || '';
59
- },
53
+ defaultMenuIsOpen: true,
60
54
  options: options,
55
+ menuPlacement: "auto",
61
56
  isLoading: isLoading,
62
- defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
63
57
  filterOption: filterOption,
58
+ testId: "inline-edit-priority",
59
+ defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
60
+ getOptionValue: function getOptionValue(option) {
61
+ return option.text || '';
62
+ },
64
63
  formatOptionLabel: function formatOptionLabel(_ref) {
65
64
  var source = _ref.source,
66
65
  label = _ref.label,
@@ -78,98 +77,9 @@ var IconEditType = function IconEditType(props) {
78
77
  values: e ? [e] : []
79
78
  });
80
79
  }
81
- })));
80
+ }));
82
81
  };
83
82
  var filterOption = function filterOption(option, inputValue) {
84
83
  return option.label.toLowerCase().includes(inputValue.toLowerCase());
85
84
  };
86
- var usePriorityOptions = function usePriorityOptions(currentValue, executeFetch) {
87
- var _useState = (0, _react.useState)({
88
- isLoading: true,
89
- options: [],
90
- hasFailed: false
91
- }),
92
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
93
- _useState2$ = _useState2[0],
94
- options = _useState2$.options,
95
- isLoading = _useState2$.isLoading,
96
- hasFailed = _useState2$.hasFailed,
97
- setOptions = _useState2[1];
98
- var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
99
- isFetchAction: true
100
- }),
101
- showErrorFlag = _useDatasourceTableFl.showErrorFlag;
102
- (0, _react.useEffect)(function () {
103
- var isMounted = true;
104
- loadOptions(currentValue, executeFetch).then(function (options) {
105
- if (isMounted) {
106
- setOptions({
107
- isLoading: false,
108
- options: options,
109
- hasFailed: false
110
- });
111
- }
112
- }).catch(function (err) {
113
- showErrorFlag();
114
- setOptions({
115
- isLoading: false,
116
- options: [],
117
- hasFailed: true
118
- });
119
- });
120
- return function () {
121
- isMounted = false;
122
- };
123
- }, [currentValue, executeFetch, showErrorFlag]);
124
- return {
125
- options: options,
126
- isLoading: isLoading,
127
- hasFailed: hasFailed
128
- };
129
- };
130
-
131
- /**
132
- * Load options for the select
133
- */
134
- var loadOptions = /*#__PURE__*/function () {
135
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_currentValue, executeFetch) {
136
- var _yield$executeFetch, operationStatus, entities;
137
- return _regenerator.default.wrap(function _callee$(_context) {
138
- while (1) switch (_context.prev = _context.next) {
139
- case 0:
140
- if (executeFetch) {
141
- _context.next = 2;
142
- break;
143
- }
144
- return _context.abrupt("return", []);
145
- case 2:
146
- _context.next = 4;
147
- return executeFetch({});
148
- case 4:
149
- _yield$executeFetch = _context.sent;
150
- operationStatus = _yield$executeFetch.operationStatus;
151
- entities = _yield$executeFetch.entities;
152
- if (!(operationStatus === _linkingTypes.ActionOperationStatus.FAILURE)) {
153
- _context.next = 9;
154
- break;
155
- }
156
- throw new Error('Failed to fetch icon options');
157
- case 9:
158
- if (!(operationStatus === _linkingTypes.ActionOperationStatus.SUCCESS && entities)) {
159
- _context.next = 11;
160
- break;
161
- }
162
- return _context.abrupt("return", entities);
163
- case 11:
164
- return _context.abrupt("return", []);
165
- case 12:
166
- case "end":
167
- return _context.stop();
168
- }
169
- }, _callee);
170
- }));
171
- return function loadOptions(_x, _x2) {
172
- return _ref2.apply(this, arguments);
173
- };
174
- }();
175
85
  var _default = exports.default = IconEditType;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.isEditTypeSupported = exports.isEditTypeSelectable = exports.editType = void 0;
7
+ exports.toValueType = exports.isEditTypeSupported = exports.isEditTypeSelectable = exports.editType = void 0;
9
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
10
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
@@ -14,13 +13,13 @@ var _react = _interopRequireDefault(require("react"));
14
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _icon = _interopRequireDefault(require("./icon"));
16
15
  var _status = _interopRequireDefault(require("./status"));
17
- var _text = _interopRequireWildcard(require("./text"));
16
+ var _text = _interopRequireDefault(require("./text"));
17
+ var _user = _interopRequireDefault(require("./user"));
18
18
  var _excluded = ["value"];
19
- 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); }
20
- 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; }
21
19
  // This is used in editor-card-plugin to identify if any type of inline edit is active.
22
20
  var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
23
21
  var editType = exports.editType = function editType(_ref) {
22
+ var _toValueType, _value$atlassianUserI;
24
23
  var defaultValue = _ref.defaultValue,
25
24
  currentValue = _ref.currentValue,
26
25
  setEditValues = _ref.setEditValues,
@@ -28,7 +27,7 @@ var editType = exports.editType = function editType(_ref) {
28
27
  switch (defaultValue.type) {
29
28
  case 'string':
30
29
  return {
31
- defaultValue: (0, _text.toTextValue)(defaultValue),
30
+ defaultValue: (_toValueType = toValueType(defaultValue)) !== null && _toValueType !== void 0 ? _toValueType : '',
32
31
  editView: function editView(_ref2) {
33
32
  var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref2), _ref2));
34
33
  return /*#__PURE__*/_react.default.createElement(_text.default, (0, _extends2.default)({}, fieldProps, {
@@ -40,7 +39,7 @@ var editType = exports.editType = function editType(_ref) {
40
39
  };
41
40
  case 'icon':
42
41
  return {
43
- defaultValue: (0, _text.toTextValue)(defaultValue),
42
+ defaultValue: toValueType(defaultValue),
44
43
  editView: function editView(_ref3) {
45
44
  var value = _ref3.value,
46
45
  fieldProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
@@ -54,7 +53,7 @@ var editType = exports.editType = function editType(_ref) {
54
53
  };
55
54
  case 'status':
56
55
  return {
57
- defaultValue: (0, _text.toTextValue)(defaultValue),
56
+ defaultValue: toValueType(defaultValue),
58
57
  editView: function editView(_ref4) {
59
58
  var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref4), _ref4));
60
59
  return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
@@ -65,6 +64,20 @@ var editType = exports.editType = function editType(_ref) {
65
64
  }));
66
65
  }
67
66
  };
67
+ case 'user':
68
+ var value = toValueType(defaultValue);
69
+ return {
70
+ defaultValue: (_value$atlassianUserI = value === null || value === void 0 ? void 0 : value.atlassianUserId) !== null && _value$atlassianUserI !== void 0 ? _value$atlassianUserI : '',
71
+ editView: function editView(_ref5) {
72
+ var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref5), _ref5));
73
+ return /*#__PURE__*/_react.default.createElement(_user.default, (0, _extends2.default)({}, fieldProps, {
74
+ currentValue: currentValue,
75
+ setEditValues: setEditValues,
76
+ id: ACTIVE_INLINE_EDIT_ID,
77
+ executeFetch: executeFetch
78
+ }));
79
+ }
80
+ };
68
81
  }
69
82
  return {
70
83
  defaultValue: '',
@@ -74,10 +87,14 @@ var editType = exports.editType = function editType(_ref) {
74
87
  };
75
88
  };
76
89
  var isEditTypeSupported = exports.isEditTypeSupported = function isEditTypeSupported(type) {
77
- var supportedEditType = ['string'].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['status'] : []), (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-priority') ? ['icon'] : []));
90
+ var supportedEditType = ['string'].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['status'] : []), (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-priority') ? ['icon'] : []), (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-assignee') ? ['user'] : []));
78
91
  return supportedEditType.includes(type);
79
92
  };
80
93
  var isEditTypeSelectable = exports.isEditTypeSelectable = function isEditTypeSelectable(type) {
81
94
  var selectEditTypes = ['status', 'icon', 'user'];
82
95
  return selectEditTypes.includes(type);
96
+ };
97
+ var toValueType = exports.toValueType = function toValueType(typeWithValues) {
98
+ var _typeWithValues$value;
99
+ return (_typeWithValues$value = typeWithValues.values) === null || _typeWithValues$value === void 0 ? void 0 : _typeWithValues$value[0];
83
100
  };