@atlaskit/smart-card 19.1.3 → 19.1.6
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 +19 -0
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/ssr.js +17 -3
- package/dist/cjs/state/actions/index.js +3 -3
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +14 -3
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/ssr.js +9 -5
- package/dist/es2019/state/actions/index.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +11 -3
- package/dist/esm/messages.js +5 -0
- package/dist/esm/ssr.js +16 -3
- package/dist/esm/state/actions/index.js +4 -4
- package/dist/esm/state/hooks/usePrefetch.js +1 -1
- package/dist/esm/utils/mocks.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/DownloadAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/RetryAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/ViewAction.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +11 -3
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -0
- package/package.json +3 -2
- package/docs-helpers/flexible-ui-action-item.tsx +0 -6
- package/docs-helpers/flexible-ui-actions-prop.tsx +0 -6
- package/docs-helpers/flexible-ui-element-item.tsx +0 -6
- package/docs-helpers/flexible-ui-prop.tsx +0 -6
- package/docs-helpers/flexible-ui.tsx +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`28410ec919d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/28410ec919d) - Flexible UI: Passing JsonLD response on authFlow disabled
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 19.1.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`db78a813922`](https://bitbucket.org/atlassian/atlassian-frontend/commits/db78a813922) - Add error handling to smart-card ssr component
|
|
15
|
+
|
|
16
|
+
## 19.1.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`cd2e7183aa5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd2e7183aa5) - Flexible UI: Fix action tooltips not displayed on hover
|
|
21
|
+
|
|
3
22
|
## 19.1.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/cjs/messages.js
CHANGED
|
@@ -68,6 +68,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
68
68
|
defaultMessage: 'Updated on {context}',
|
|
69
69
|
description: 'Indicated when entity was modified (absolute form)'
|
|
70
70
|
},
|
|
71
|
+
more_actions: {
|
|
72
|
+
id: 'fabric.linking.more_actions',
|
|
73
|
+
defaultMessage: 'More actions',
|
|
74
|
+
description: 'Allows the users to see more link actions'
|
|
75
|
+
},
|
|
71
76
|
priority_blocker: {
|
|
72
77
|
id: 'fabric.linking.priority_blocker',
|
|
73
78
|
defaultMessage: 'Blocker',
|
package/dist/cjs/ssr.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.CardSSR = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
@@ -17,12 +17,20 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
19
19
|
|
|
20
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
21
|
+
|
|
20
22
|
var _component = require("./view/CardWithUrl/component");
|
|
21
23
|
|
|
24
|
+
var _LazyFallback = require("./view/CardWithUrl/component-lazy/LazyFallback");
|
|
25
|
+
|
|
22
26
|
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); }
|
|
23
27
|
|
|
24
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
29
|
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
+
|
|
26
34
|
// SSR friendly version of smart-card
|
|
27
35
|
// simplifies the logic around rendering and loading placeholders and
|
|
28
36
|
// only contains whats necessary to render the card on SSR mode
|
|
@@ -36,10 +44,16 @@ var CardSSR = function CardSSR(props) {
|
|
|
36
44
|
var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
|
|
37
45
|
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
var cardProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
40
48
|
id: id,
|
|
41
49
|
dispatchAnalytics: dispatchAnalytics
|
|
42
|
-
})
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
53
|
+
FallbackComponent: function FallbackComponent() {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_LazyFallback.LoadingCardLink, cardProps);
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, cardProps));
|
|
43
57
|
};
|
|
44
58
|
|
|
45
59
|
exports.CardSSR = CardSSR;
|
|
@@ -53,7 +53,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
|
53
53
|
|
|
54
54
|
var hasAuthFlowSupported = config.authFlow !== 'disabled';
|
|
55
55
|
var hasData = !!(details && details.data);
|
|
56
|
-
var handleResolvedLinkError = (0, _react.useCallback)(function (url, error) {
|
|
56
|
+
var handleResolvedLinkError = (0, _react.useCallback)(function (url, error, response) {
|
|
57
57
|
if (error.kind === 'fatal') {
|
|
58
58
|
// If there's no previous data in the store for this URL, then bail
|
|
59
59
|
// out and let the editor handle fallbacks (returns to a blue link).
|
|
@@ -82,7 +82,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
|
82
82
|
// Fallback to blue link with smart link formatting. Not part of reliability.
|
|
83
83
|
dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR_FALLBACK, {
|
|
84
84
|
url: url
|
|
85
|
-
},
|
|
85
|
+
}, response, error));
|
|
86
86
|
} else {
|
|
87
87
|
// Fallback to blue link with smart link formatting. Part of reliability.
|
|
88
88
|
dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR, {
|
|
@@ -97,7 +97,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
|
97
97
|
// throw an error and render as a normal blue link.
|
|
98
98
|
|
|
99
99
|
if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
|
|
100
|
-
handleResolvedLinkError(resourceUrl, new _linkingCommon.APIError('fallback', hostname, _constants.ERROR_MESSAGE_OAUTH));
|
|
100
|
+
handleResolvedLinkError(resourceUrl, new _linkingCommon.APIError('fallback', hostname, _constants.ERROR_MESSAGE_OAUTH), response);
|
|
101
101
|
return;
|
|
102
102
|
} // Handle any other errors
|
|
103
103
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -126,7 +126,8 @@ var Action = function Action(_ref2) {
|
|
|
126
126
|
}, content);
|
|
127
127
|
} else {
|
|
128
128
|
return (0, _core.jsx)(_tooltip.default, {
|
|
129
|
-
content: tooltipMessage
|
|
129
|
+
content: tooltipMessage,
|
|
130
|
+
testId: "".concat(testId, "-tooltip")
|
|
130
131
|
}, (0, _core.jsx)("div", {
|
|
131
132
|
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
132
133
|
"data-testid": "".concat(testId, "-button-wrapper")
|
|
@@ -50,7 +50,7 @@ var actionMappings = (_actionMappings = {}, (0, _defineProperty2.default)(_actio
|
|
|
50
50
|
icon: /*#__PURE__*/_react.default.createElement(_cross.default, {
|
|
51
51
|
label: "Delete"
|
|
52
52
|
}),
|
|
53
|
-
|
|
53
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete)
|
|
54
54
|
}
|
|
55
55
|
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.EditAction, {
|
|
56
56
|
component: _action.default,
|
|
@@ -60,7 +60,7 @@ var actionMappings = (_actionMappings = {}, (0, _defineProperty2.default)(_actio
|
|
|
60
60
|
icon: /*#__PURE__*/_react.default.createElement(_edit.default, {
|
|
61
61
|
label: "Edit"
|
|
62
62
|
}),
|
|
63
|
-
|
|
63
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit)
|
|
64
64
|
}
|
|
65
65
|
}), _actionMappings);
|
|
66
66
|
|
|
@@ -13,10 +13,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
+
var _reactIntlNext = require("react-intl-next");
|
|
17
|
+
|
|
16
18
|
var _core = require("@emotion/core");
|
|
17
19
|
|
|
18
20
|
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
19
21
|
|
|
22
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
23
|
+
|
|
20
24
|
var _utils = require("../utils");
|
|
21
25
|
|
|
22
26
|
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
|
|
@@ -31,6 +35,8 @@ var _action = require("../../actions/action");
|
|
|
31
35
|
|
|
32
36
|
var _token = require("../../../../../utils/token");
|
|
33
37
|
|
|
38
|
+
var _messages = require("../../../../../messages");
|
|
39
|
+
|
|
34
40
|
var _excluded = ["triggerRef"];
|
|
35
41
|
|
|
36
42
|
var _templateObject;
|
|
@@ -52,7 +58,8 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
52
58
|
appearance = _ref.appearance,
|
|
53
59
|
_ref$visibleButtonsNu = _ref.visibleButtonsNum,
|
|
54
60
|
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
55
|
-
onDropdownOpenChange = _ref.onDropdownOpenChange
|
|
61
|
+
onDropdownOpenChange = _ref.onDropdownOpenChange,
|
|
62
|
+
testId = _ref.testId;
|
|
56
63
|
var isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
57
64
|
var firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
58
65
|
var restActions = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
@@ -67,14 +74,18 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
67
74
|
trigger: function trigger(_ref3) {
|
|
68
75
|
var triggerRef = _ref3.triggerRef,
|
|
69
76
|
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
70
|
-
return (0, _core.jsx)(
|
|
77
|
+
return (0, _core.jsx)(_tooltip.default, {
|
|
78
|
+
content: (0, _core.jsx)(_reactIntlNext.FormattedMessage, _messages.messages.more_actions),
|
|
79
|
+
testId: "action-group-more-button-tooltip",
|
|
80
|
+
tag: "span"
|
|
81
|
+
}, (0, _core.jsx)(_standardButton.default, (0, _extends2.default)({}, props, {
|
|
71
82
|
spacing: _action.sizeToSpacing[size],
|
|
72
83
|
testId: "action-group-more-button",
|
|
73
84
|
iconBefore: (0, _core.jsx)(_more.default, {
|
|
74
85
|
label: "more"
|
|
75
86
|
}),
|
|
76
87
|
ref: triggerRef
|
|
77
|
-
}));
|
|
88
|
+
})));
|
|
78
89
|
}
|
|
79
90
|
}, (0, _utils.renderActionItems)(restActions, size, appearance, true)) : null));
|
|
80
91
|
};
|
package/dist/es2019/messages.js
CHANGED
|
@@ -60,6 +60,11 @@ export const messages = defineMessages({
|
|
|
60
60
|
defaultMessage: 'Updated on {context}',
|
|
61
61
|
description: 'Indicated when entity was modified (absolute form)'
|
|
62
62
|
},
|
|
63
|
+
more_actions: {
|
|
64
|
+
id: 'fabric.linking.more_actions',
|
|
65
|
+
defaultMessage: 'More actions',
|
|
66
|
+
description: 'Allows the users to see more link actions'
|
|
67
|
+
},
|
|
63
68
|
priority_blocker: {
|
|
64
69
|
id: 'fabric.linking.priority_blocker',
|
|
65
70
|
defaultMessage: 'Blocker',
|
package/dist/es2019/ssr.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
import uuid from 'uuid';
|
|
4
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
5
|
import { CardWithUrlContent } from './view/CardWithUrl/component';
|
|
6
|
+
import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
6
7
|
// SSR friendly version of smart-card
|
|
7
8
|
// simplifies the logic around rendering and loading placeholders and
|
|
8
9
|
// only contains whats necessary to render the card on SSR mode
|
|
@@ -12,8 +13,11 @@ export const CardSSR = props => {
|
|
|
12
13
|
const dispatchAnalytics = () => {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
id
|
|
17
|
-
dispatchAnalytics
|
|
18
|
-
}
|
|
16
|
+
const cardProps = { ...props,
|
|
17
|
+
id,
|
|
18
|
+
dispatchAnalytics
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
21
|
+
FallbackComponent: () => /*#__PURE__*/React.createElement(LoadingCardLink, cardProps)
|
|
22
|
+
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
|
|
19
23
|
};
|
|
@@ -27,7 +27,7 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
27
27
|
};
|
|
28
28
|
const hasAuthFlowSupported = config.authFlow !== 'disabled';
|
|
29
29
|
const hasData = !!(details && details.data);
|
|
30
|
-
const handleResolvedLinkError = useCallback((url, error) => {
|
|
30
|
+
const handleResolvedLinkError = useCallback((url, error, response) => {
|
|
31
31
|
if (error.kind === 'fatal') {
|
|
32
32
|
// If there's no previous data in the store for this URL, then bail
|
|
33
33
|
// out and let the editor handle fallbacks (returns to a blue link).
|
|
@@ -56,7 +56,7 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
56
56
|
// Fallback to blue link with smart link formatting. Not part of reliability.
|
|
57
57
|
dispatch(cardAction(ACTION_ERROR_FALLBACK, {
|
|
58
58
|
url
|
|
59
|
-
},
|
|
59
|
+
}, response, error));
|
|
60
60
|
} else {
|
|
61
61
|
// Fallback to blue link with smart link formatting. Part of reliability.
|
|
62
62
|
dispatch(cardAction(ACTION_ERROR, {
|
|
@@ -71,7 +71,7 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
71
71
|
// throw an error and render as a normal blue link.
|
|
72
72
|
|
|
73
73
|
if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
|
|
74
|
-
handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH));
|
|
74
|
+
handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH), response);
|
|
75
75
|
return;
|
|
76
76
|
} // Handle any other errors
|
|
77
77
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -129,7 +129,8 @@ const Action = ({
|
|
|
129
129
|
}, content);
|
|
130
130
|
} else {
|
|
131
131
|
return jsx(Tooltip, {
|
|
132
|
-
content: tooltipMessage
|
|
132
|
+
content: tooltipMessage,
|
|
133
|
+
testId: `${testId}-tooltip`
|
|
133
134
|
}, jsx("div", {
|
|
134
135
|
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
135
136
|
"data-testid": `${testId}-button-wrapper`
|
|
@@ -20,7 +20,7 @@ const actionMappings = {
|
|
|
20
20
|
icon: /*#__PURE__*/React.createElement(CrossIcon, {
|
|
21
21
|
label: "Delete"
|
|
22
22
|
}),
|
|
23
|
-
|
|
23
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.delete)
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
[ActionName.EditAction]: {
|
|
@@ -31,7 +31,7 @@ const actionMappings = {
|
|
|
31
31
|
icon: /*#__PURE__*/React.createElement(EditIcon, {
|
|
32
32
|
label: "Edit"
|
|
33
33
|
}),
|
|
34
|
-
|
|
34
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.edit)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import { css, jsx } from '@emotion/core';
|
|
5
6
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
7
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
6
8
|
import { renderActionItems } from '../utils';
|
|
7
9
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
8
10
|
import { SmartLinkSize } from '../../../../../constants';
|
|
@@ -10,6 +12,7 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
10
12
|
import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
11
13
|
import { sizeToSpacing } from '../../actions/action';
|
|
12
14
|
import { tokens } from '../../../../../utils/token';
|
|
15
|
+
import { messages } from '../../../../../messages';
|
|
13
16
|
const styles = css`
|
|
14
17
|
display: inline-flex;
|
|
15
18
|
line-height: 1rem;
|
|
@@ -39,7 +42,8 @@ const ActionGroup = ({
|
|
|
39
42
|
size = SmartLinkSize.Medium,
|
|
40
43
|
appearance,
|
|
41
44
|
visibleButtonsNum = 2,
|
|
42
|
-
onDropdownOpenChange
|
|
45
|
+
onDropdownOpenChange,
|
|
46
|
+
testId
|
|
43
47
|
}) => {
|
|
44
48
|
const isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
45
49
|
const firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
@@ -54,14 +58,18 @@ const ActionGroup = ({
|
|
|
54
58
|
trigger: ({
|
|
55
59
|
triggerRef,
|
|
56
60
|
...props
|
|
57
|
-
}) => jsx(
|
|
61
|
+
}) => jsx(Tooltip, {
|
|
62
|
+
content: jsx(FormattedMessage, messages.more_actions),
|
|
63
|
+
testId: "action-group-more-button-tooltip",
|
|
64
|
+
tag: "span"
|
|
65
|
+
}, jsx(Button, _extends({}, props, {
|
|
58
66
|
spacing: sizeToSpacing[size],
|
|
59
67
|
testId: "action-group-more-button",
|
|
60
68
|
iconBefore: jsx(MoreIcon, {
|
|
61
69
|
label: "more"
|
|
62
70
|
}),
|
|
63
71
|
ref: triggerRef
|
|
64
|
-
}))
|
|
72
|
+
})))
|
|
65
73
|
}, renderActionItems(restActions, size, appearance, true)) : null));
|
|
66
74
|
};
|
|
67
75
|
|
package/dist/esm/messages.js
CHANGED
|
@@ -60,6 +60,11 @@ export var messages = defineMessages({
|
|
|
60
60
|
defaultMessage: 'Updated on {context}',
|
|
61
61
|
description: 'Indicated when entity was modified (absolute form)'
|
|
62
62
|
},
|
|
63
|
+
more_actions: {
|
|
64
|
+
id: 'fabric.linking.more_actions',
|
|
65
|
+
defaultMessage: 'More actions',
|
|
66
|
+
description: 'Allows the users to see more link actions'
|
|
67
|
+
},
|
|
63
68
|
priority_blocker: {
|
|
64
69
|
id: 'fabric.linking.priority_blocker',
|
|
65
70
|
defaultMessage: 'Blocker',
|
package/dist/esm/ssr.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
3
8
|
import React from 'react';
|
|
4
9
|
import { useState } from 'react';
|
|
5
10
|
import uuid from 'uuid';
|
|
11
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
12
|
import { CardWithUrlContent } from './view/CardWithUrl/component';
|
|
13
|
+
import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
7
14
|
// SSR friendly version of smart-card
|
|
8
15
|
// simplifies the logic around rendering and loading placeholders and
|
|
9
16
|
// only contains whats necessary to render the card on SSR mode
|
|
@@ -17,8 +24,14 @@ export var CardSSR = function CardSSR(props) {
|
|
|
17
24
|
var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
|
|
18
25
|
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
var cardProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
21
28
|
id: id,
|
|
22
29
|
dispatchAnalytics: dispatchAnalytics
|
|
23
|
-
})
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
33
|
+
FallbackComponent: function FallbackComponent() {
|
|
34
|
+
return /*#__PURE__*/React.createElement(LoadingCardLink, cardProps);
|
|
35
|
+
}
|
|
36
|
+
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
|
|
24
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useMemo, useCallback } from 'react';
|
|
4
4
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
5
5
|
import { APIError } from '@atlaskit/linking-common';
|
|
@@ -28,7 +28,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
28
28
|
|
|
29
29
|
var hasAuthFlowSupported = config.authFlow !== 'disabled';
|
|
30
30
|
var hasData = !!(details && details.data);
|
|
31
|
-
var handleResolvedLinkError = useCallback(function (url, error) {
|
|
31
|
+
var handleResolvedLinkError = useCallback(function (url, error, response) {
|
|
32
32
|
if (error.kind === 'fatal') {
|
|
33
33
|
// If there's no previous data in the store for this URL, then bail
|
|
34
34
|
// out and let the editor handle fallbacks (returns to a blue link).
|
|
@@ -57,7 +57,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
57
57
|
// Fallback to blue link with smart link formatting. Not part of reliability.
|
|
58
58
|
dispatch(cardAction(ACTION_ERROR_FALLBACK, {
|
|
59
59
|
url: url
|
|
60
|
-
},
|
|
60
|
+
}, response, error));
|
|
61
61
|
} else {
|
|
62
62
|
// Fallback to blue link with smart link formatting. Part of reliability.
|
|
63
63
|
dispatch(cardAction(ACTION_ERROR, {
|
|
@@ -72,7 +72,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
72
72
|
// throw an error and render as a normal blue link.
|
|
73
73
|
|
|
74
74
|
if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
|
|
75
|
-
handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH));
|
|
75
|
+
handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH), response);
|
|
76
76
|
return;
|
|
77
77
|
} // Handle any other errors
|
|
78
78
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
5
5
|
export function usePrefetch(url) {
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
|
|
9
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
10
|
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { downloadUrl } from '@atlaskit/media-common';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
6
5
|
var _excluded = ["popupMountPointId", "onClose"],
|
|
7
6
|
_excluded2 = ["details"];
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -107,7 +107,8 @@ var Action = function Action(_ref2) {
|
|
|
107
107
|
}, content);
|
|
108
108
|
} else {
|
|
109
109
|
return jsx(Tooltip, {
|
|
110
|
-
content: tooltipMessage
|
|
110
|
+
content: tooltipMessage,
|
|
111
|
+
testId: "".concat(testId, "-tooltip")
|
|
111
112
|
}, jsx("div", {
|
|
112
113
|
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
113
114
|
"data-testid": "".concat(testId, "-button-wrapper")
|
|
@@ -26,7 +26,7 @@ var actionMappings = (_actionMappings = {}, _defineProperty(_actionMappings, Act
|
|
|
26
26
|
icon: /*#__PURE__*/React.createElement(CrossIcon, {
|
|
27
27
|
label: "Delete"
|
|
28
28
|
}),
|
|
29
|
-
|
|
29
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.delete)
|
|
30
30
|
}
|
|
31
31
|
}), _defineProperty(_actionMappings, ActionName.EditAction, {
|
|
32
32
|
component: Action,
|
|
@@ -36,7 +36,7 @@ var actionMappings = (_actionMappings = {}, _defineProperty(_actionMappings, Act
|
|
|
36
36
|
icon: /*#__PURE__*/React.createElement(EditIcon, {
|
|
37
37
|
label: "Edit"
|
|
38
38
|
}),
|
|
39
|
-
|
|
39
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.edit)
|
|
40
40
|
}
|
|
41
41
|
}), _actionMappings);
|
|
42
42
|
|
|
@@ -6,8 +6,10 @@ var _excluded = ["triggerRef"];
|
|
|
6
6
|
var _templateObject;
|
|
7
7
|
|
|
8
8
|
/** @jsx jsx */
|
|
9
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
9
10
|
import { css, jsx } from '@emotion/core';
|
|
10
11
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
12
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
11
13
|
import { renderActionItems } from '../utils';
|
|
12
14
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
13
15
|
import { SmartLinkSize } from '../../../../../constants';
|
|
@@ -15,6 +17,7 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
15
17
|
import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
16
18
|
import { sizeToSpacing } from '../../actions/action';
|
|
17
19
|
import { tokens } from '../../../../../utils/token';
|
|
20
|
+
import { messages } from '../../../../../messages';
|
|
18
21
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n > div {\n align-items: center;\n button:focus {\n // AK button removes the default browser outline on focus and apply\n // box-shadow styling to create the outline appearance.\n // Due to our container elements (Container/Block/ElementGroup) has\n // overflow hidden to prevent the metadata element from leaking outside\n // of its container, the box-shadow doesn't show properly.\n // Invert the AK box-shadow styling.\n box-shadow: inset 0 0 0 2px ", ";\n }\n }\n"])), tokens.focus);
|
|
19
22
|
/**
|
|
20
23
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
@@ -32,7 +35,8 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
32
35
|
appearance = _ref.appearance,
|
|
33
36
|
_ref$visibleButtonsNu = _ref.visibleButtonsNum,
|
|
34
37
|
visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
|
|
35
|
-
onDropdownOpenChange = _ref.onDropdownOpenChange
|
|
38
|
+
onDropdownOpenChange = _ref.onDropdownOpenChange,
|
|
39
|
+
testId = _ref.testId;
|
|
36
40
|
var isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
37
41
|
var firstActions = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
38
42
|
var restActions = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
@@ -48,14 +52,18 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
48
52
|
var triggerRef = _ref3.triggerRef,
|
|
49
53
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
50
54
|
|
|
51
|
-
return jsx(
|
|
55
|
+
return jsx(Tooltip, {
|
|
56
|
+
content: jsx(FormattedMessage, messages.more_actions),
|
|
57
|
+
testId: "action-group-more-button-tooltip",
|
|
58
|
+
tag: "span"
|
|
59
|
+
}, jsx(Button, _extends({}, props, {
|
|
52
60
|
spacing: sizeToSpacing[size],
|
|
53
61
|
testId: "action-group-more-button",
|
|
54
62
|
iconBefore: jsx(MoreIcon, {
|
|
55
63
|
label: "more"
|
|
56
64
|
}),
|
|
57
65
|
ref: triggerRef
|
|
58
|
-
}));
|
|
66
|
+
})));
|
|
59
67
|
}
|
|
60
68
|
}, renderActionItems(restActions, size, appearance, true)) : null));
|
|
61
69
|
};
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageDescriptor } from 'react-intl-next';
|
|
2
|
-
export declare type MessageKey = 'cannot_find_link' | 'click_to_join' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'delete' | 'edit' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access' | 'request_denied';
|
|
2
|
+
export declare type MessageKey = 'cannot_find_link' | 'click_to_join' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'delete' | 'edit' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access' | 'request_denied';
|
|
3
3
|
declare type Messages = {
|
|
4
4
|
[K in MessageKey]: MessageDescriptor;
|
|
5
5
|
};
|
|
@@ -41,6 +41,7 @@ export declare type ElementItem = {
|
|
|
41
41
|
name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount;
|
|
42
42
|
/**
|
|
43
43
|
* The size of the element to render.
|
|
44
|
+
* The elements that support sizing are AuthorGroup and CollaboratorGroup.
|
|
44
45
|
*/
|
|
45
46
|
size?: SmartLinkSize;
|
|
46
47
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.6",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"uuid": "^3.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@atlaskit/link-provider": "^1.0.
|
|
62
|
+
"@atlaskit/link-provider": "^1.0.1",
|
|
63
63
|
"react": "^16.8.0",
|
|
64
64
|
"react-dom": "^16.8.0",
|
|
65
65
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@atlaskit/section-message": "^6.1.5",
|
|
82
82
|
"@atlaskit/select": "^15.2.0",
|
|
83
83
|
"@atlaskit/table-tree": "^9.1.0",
|
|
84
|
+
"@atlaskit/tabs": "^13.2.10",
|
|
84
85
|
"@atlaskit/textarea": "^4.3.0",
|
|
85
86
|
"@atlaskit/textfield": "^5.1.0",
|
|
86
87
|
"@atlaskit/visual-regression": "*",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { css, jsx } from '@emotion/core';
|
|
3
|
-
import { Prop, Props } from '@atlaskit/docs';
|
|
4
|
-
|
|
5
|
-
const actionsStyles = css`
|
|
6
|
-
> div,
|
|
7
|
-
> div > div {
|
|
8
|
-
margin-top: 0;
|
|
9
|
-
}
|
|
10
|
-
h3 {
|
|
11
|
-
display: none;
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const actionsProps = (
|
|
16
|
-
<Props
|
|
17
|
-
heading=""
|
|
18
|
-
props={require('!!extract-react-types-loader!../docs-helpers/flexible-ui-actions-prop')}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const overrideActionsProps = (props: Object) => (
|
|
23
|
-
<Prop
|
|
24
|
-
{...props}
|
|
25
|
-
shapeComponent={() => <div css={actionsStyles}>{actionsProps}</div>}
|
|
26
|
-
type="arrayType"
|
|
27
|
-
/>
|
|
28
|
-
);
|