@atlaskit/smart-card 25.6.1 → 25.7.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/messages.js +20 -0
- package/dist/cjs/state/flexible-ui-context/index.js +13 -2
- package/dist/cjs/state/hooks/use-invoke/types.js +1 -17
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/index.js +42 -31
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/index.js +33 -12
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +21 -0
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/types.js +15 -1
- package/dist/cjs/view/FlexibleCard/components/container/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +4 -1
- package/dist/cjs/view/FlexibleCard/index.js +5 -2
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +6 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +3 -1
- package/dist/cjs/view/HoverCard/styled.js +6 -2
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +4 -1
- package/dist/cjs/view/InlineCard/index.js +3 -1
- package/dist/es2019/messages.js +20 -0
- package/dist/es2019/state/flexible-ui-context/index.js +8 -1
- package/dist/es2019/state/hooks/use-invoke/types.js +1 -15
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/index.js +22 -13
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/index.js +30 -7
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +41 -0
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/types.js +12 -1
- package/dist/es2019/view/FlexibleCard/components/container/index.js +5 -2
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/index.js +6 -3
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -4
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +3 -1
- package/dist/es2019/view/HoverCard/styled.js +4 -1
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +3 -1
- package/dist/es2019/view/InlineCard/index.js +3 -1
- package/dist/esm/messages.js +20 -0
- package/dist/esm/state/flexible-ui-context/index.js +9 -0
- package/dist/esm/state/hooks/use-invoke/types.js +1 -15
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +5 -3
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/index.js +42 -31
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/index.js +30 -8
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +11 -0
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/types.js +12 -1
- package/dist/esm/view/FlexibleCard/components/container/index.js +7 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +4 -1
- package/dist/esm/view/FlexibleCard/index.js +6 -3
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +7 -4
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +3 -1
- package/dist/esm/view/HoverCard/styled.js +4 -1
- package/dist/esm/view/InlineCard/ResolvedView/index.js +4 -1
- package/dist/esm/view/InlineCard/index.js +3 -1
- package/dist/types/__fixtures__/bitbucket-pull-request.d.ts +73 -0
- package/dist/types/__fixtures__/confluence-blog.d.ts +49 -0
- package/dist/types/__fixtures__/confluence-page.d.ts +49 -0
- package/dist/types/__fixtures__/confluence-space.d.ts +36 -0
- package/dist/types/__fixtures__/confluence-template.d.ts +31 -0
- package/dist/types/__fixtures__/figma.d.ts +43 -0
- package/dist/types/__fixtures__/jira-roadmap.d.ts +35 -0
- package/dist/types/__fixtures__/jira-task.d.ts +78 -0
- package/dist/types/__fixtures__/youtube-video.d.ts +44 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/index.d.ts +7 -0
- package/dist/types/state/hooks/use-invoke/types.d.ts +0 -4
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/types.d.ts +14 -2
- package/dist/types/view/FlexibleCard/components/common/lozenge-action/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +2 -13
- package/dist/types/view/FlexibleCard/types.d.ts +8 -3
- package/dist/types/view/HoverCard/index.d.ts +1 -1
- package/dist/types/view/HoverCard/styled.d.ts +1 -0
- package/dist/types/view/HoverCard/types.d.ts +5 -0
- package/dist/types/view/InlineCard/ResolvedView/index.d.ts +2 -0
- package/dist/types/view/InlineCard/types.d.ts +1 -0
- package/package.json +2 -2
- package/report.api.md +2 -1
- package/tmp/api-report-tmp.d.ts +2 -1
|
@@ -64,7 +64,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
64
64
|
testId = _ref.testId,
|
|
65
65
|
inlinePreloaderStyle = _ref.inlinePreloaderStyle,
|
|
66
66
|
showHoverPreview = _ref.showHoverPreview,
|
|
67
|
-
showAuthTooltip = _ref.showAuthTooltip
|
|
67
|
+
showAuthTooltip = _ref.showAuthTooltip,
|
|
68
|
+
showServerActions = _ref.showServerActions;
|
|
68
69
|
var status = cardState.status,
|
|
69
70
|
details = cardState.details;
|
|
70
71
|
var cardDetails = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
@@ -95,6 +96,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
95
96
|
return /*#__PURE__*/_react.default.createElement(_ResolvedView.InlineCardResolvedView, (0, _extends2.default)({}, resolvedProps, {
|
|
96
97
|
id: id,
|
|
97
98
|
showHoverPreview: showHoverPreview,
|
|
99
|
+
showServerActions: showServerActions,
|
|
98
100
|
link: url,
|
|
99
101
|
isSelected: isSelected,
|
|
100
102
|
onClick: handleFrameClick,
|
package/dist/es2019/messages.js
CHANGED
|
@@ -200,6 +200,11 @@ export const messages = defineMessages({
|
|
|
200
200
|
defaultMessage: "Uh oh. We can't find this link!",
|
|
201
201
|
description: 'Error case for when a provided link is not found'
|
|
202
202
|
},
|
|
203
|
+
open_issue_in_jira: {
|
|
204
|
+
id: 'fabric.linking.open_issue_in_jira',
|
|
205
|
+
defaultMessage: 'Open issue in Jira',
|
|
206
|
+
description: 'Click to open link in Jira'
|
|
207
|
+
},
|
|
203
208
|
open_link_in_a_new_tab: {
|
|
204
209
|
id: 'fabric.linking.open_link_in_a_new_tab',
|
|
205
210
|
defaultMessage: 'Open link in a new tab',
|
|
@@ -345,6 +350,21 @@ export const messages = defineMessages({
|
|
|
345
350
|
defaultMessage: 'Save',
|
|
346
351
|
description: 'Just the "save" word'
|
|
347
352
|
},
|
|
353
|
+
status_change_load_error: {
|
|
354
|
+
id: 'fabric.linking.status_change_load_error',
|
|
355
|
+
defaultMessage: 'We couldn’t load the statuses and transitions',
|
|
356
|
+
description: 'Informs the user that the loading of status transitions failed'
|
|
357
|
+
},
|
|
358
|
+
status_change_permission_error: {
|
|
359
|
+
id: 'fabric.linking.status_change_permission_error',
|
|
360
|
+
defaultMessage: 'You don’t have permission to transition this issue. ',
|
|
361
|
+
description: 'Informs the user that they do not have enough permissions to update a status'
|
|
362
|
+
},
|
|
363
|
+
status_change_update_error: {
|
|
364
|
+
id: 'fabric.linking.status_change_update_error',
|
|
365
|
+
defaultMessage: 'We couldn’t update the status',
|
|
366
|
+
description: "Occurs when a user tries to update an issue's status but fails to do so"
|
|
367
|
+
},
|
|
348
368
|
try_again: {
|
|
349
369
|
id: 'fabric.linking.try_again',
|
|
350
370
|
defaultMessage: 'Try again',
|
|
@@ -11,4 +11,11 @@ export const useFlexibleUiContext = () => useContext(FlexibleUiContext);
|
|
|
11
11
|
* underlying elements.
|
|
12
12
|
*/
|
|
13
13
|
export const FlexibleUiAnalyticsContext = /*#__PURE__*/createContext(undefined);
|
|
14
|
-
export const useFlexibleUiAnalyticsContext = () => useContext(FlexibleUiAnalyticsContext);
|
|
14
|
+
export const useFlexibleUiAnalyticsContext = () => useContext(FlexibleUiAnalyticsContext);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
18
|
+
* to render its underlying elements.
|
|
19
|
+
*/
|
|
20
|
+
export const FlexibleUiOptionContext = /*#__PURE__*/createContext(undefined);
|
|
21
|
+
export const useFlexibleUiOptionContext = () => useContext(FlexibleUiOptionContext);
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Additional details for invoke function that may be required for component
|
|
5
|
-
*/
|
|
6
|
-
(function (InvokeActionError) {
|
|
7
|
-
InvokeActionError["NoData"] = "NoData";
|
|
8
|
-
InvokeActionError["Unknown"] = "Unknown";
|
|
9
|
-
})(InvokeActionError || (InvokeActionError = {}));
|
|
10
|
-
/**
|
|
11
|
-
* Invoke request with additional details for the component
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* CRUD invoke requests for the component that support server actions
|
|
15
|
-
*/
|
|
1
|
+
export {};
|
package/dist/es2019/version.json
CHANGED
|
@@ -205,7 +205,8 @@ export function CardWithUrlContent({
|
|
|
205
205
|
testId: testId,
|
|
206
206
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
207
207
|
showHoverPreview: showHoverPreview,
|
|
208
|
-
showAuthTooltip: showAuthTooltip
|
|
208
|
+
showAuthTooltip: showAuthTooltip,
|
|
209
|
+
showServerActions: showServerActions
|
|
209
210
|
});
|
|
210
211
|
case 'block':
|
|
211
212
|
return /*#__PURE__*/React.createElement(BlockCard, {
|
|
@@ -11,7 +11,7 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
11
11
|
import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
12
12
|
import { sizeToButtonSpacing } from '../../utils';
|
|
13
13
|
import { messages } from '../../../../../messages';
|
|
14
|
-
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
14
|
+
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
15
15
|
import ActionGroupItem from './action-group-item';
|
|
16
16
|
const styles = css`
|
|
17
17
|
display: inline-flex;
|
|
@@ -70,6 +70,7 @@ const ActionGroup = ({
|
|
|
70
70
|
testId
|
|
71
71
|
}) => {
|
|
72
72
|
const context = useFlexibleUiContext();
|
|
73
|
+
const ui = useFlexibleUiOptionContext();
|
|
73
74
|
const [isOpen, setIsOpen] = useState(false);
|
|
74
75
|
const renderableActionItems = useMemo(() => filterActionItems(items, context), [context, items]);
|
|
75
76
|
const isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
|
|
@@ -115,11 +116,12 @@ const ActionGroup = ({
|
|
|
115
116
|
iconBefore: moreIcon,
|
|
116
117
|
ref: triggerRef
|
|
117
118
|
}))),
|
|
118
|
-
testId: "action-group-dropdown"
|
|
119
|
+
testId: "action-group-dropdown",
|
|
120
|
+
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
119
121
|
}, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
|
|
120
122
|
}
|
|
121
123
|
return null;
|
|
122
|
-
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, visibleButtonsNum]);
|
|
124
|
+
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum]);
|
|
123
125
|
return renderableActionItems.length > 0 ? jsx("div", {
|
|
124
126
|
css: styles,
|
|
125
127
|
className: "actions-button-group"
|
|
@@ -9,24 +9,26 @@ import LozengeActionError from './lozenge-action-error';
|
|
|
9
9
|
import withErrorBoundary from './error-boundary';
|
|
10
10
|
import { dropdownItemGroupStyles } from './styled';
|
|
11
11
|
import useInvoke from '../../../../../state/hooks/use-invoke';
|
|
12
|
-
import { InvokeActionError } from '../../../../../state/hooks/use-invoke/types';
|
|
13
12
|
import extractLozengeActionItems from '../../../../../extractors/action/extract-lozenge-action-items';
|
|
14
13
|
import createStatusUpdateRequest from '../../../../../utils/actions/create-status-update-request';
|
|
15
14
|
import useResolve from '../../../../../state/hooks/use-resolve';
|
|
15
|
+
import { LozengeActionErrorMessages } from './lozenge-action-error/types';
|
|
16
16
|
const validateItems = (items = [], text) => {
|
|
17
17
|
return items.filter(item => item.text !== text);
|
|
18
18
|
};
|
|
19
|
+
const isInvokeCustomError = err => err.message !== undefined && err.errorCode !== undefined;
|
|
19
20
|
const LozengeAction = ({
|
|
20
21
|
action,
|
|
21
22
|
appearance,
|
|
22
23
|
testId = 'smart-element-lozenge-action',
|
|
23
|
-
text
|
|
24
|
+
text,
|
|
25
|
+
zIndex
|
|
24
26
|
}) => {
|
|
25
27
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
26
28
|
const [isLoading, setIsLoading] = useState(false);
|
|
27
29
|
const [isOpen, setIsOpen] = useState(false);
|
|
28
30
|
const [items, setItems] = useState();
|
|
29
|
-
const [
|
|
31
|
+
const [errorMessage, setErrorMessage] = useState();
|
|
30
32
|
const invoke = useInvoke();
|
|
31
33
|
const reload = useResolve();
|
|
32
34
|
const handleOpenChange = useCallback(async args => {
|
|
@@ -39,17 +41,18 @@ const LozengeAction = ({
|
|
|
39
41
|
setItems(validItems);
|
|
40
42
|
setIsLoaded(true);
|
|
41
43
|
if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
|
|
42
|
-
|
|
44
|
+
setErrorMessage(LozengeActionErrorMessages.noData);
|
|
45
|
+
setIsLoaded(false);
|
|
43
46
|
}
|
|
44
47
|
} catch (err) {
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
setErrorMessage(LozengeActionErrorMessages.unknown);
|
|
49
|
+
setIsLoaded(false);
|
|
47
50
|
} finally {
|
|
48
51
|
setIsLoading(false);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
if (!args.isOpen) {
|
|
52
|
-
|
|
55
|
+
setErrorMessage(undefined);
|
|
53
56
|
}
|
|
54
57
|
}, [action === null || action === void 0 ? void 0 : action.read, invoke, isLoaded, text]);
|
|
55
58
|
const trigger = useCallback(props => jsx(LozengeActionTrigger, _extends({}, props, {
|
|
@@ -65,7 +68,9 @@ const LozengeAction = ({
|
|
|
65
68
|
const request = createStatusUpdateRequest(updateAction, id);
|
|
66
69
|
await invoke(request);
|
|
67
70
|
setIsLoading(false);
|
|
71
|
+
setIsLoaded(false);
|
|
68
72
|
setIsOpen(false);
|
|
73
|
+
setItems([]);
|
|
69
74
|
const {
|
|
70
75
|
url,
|
|
71
76
|
id: linkId
|
|
@@ -75,15 +80,18 @@ const LozengeAction = ({
|
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
} catch (err) {
|
|
78
|
-
// TODO: EDM-6261: Error state
|
|
79
83
|
setIsLoading(false);
|
|
80
|
-
|
|
84
|
+
if (isInvokeCustomError(err)) {
|
|
85
|
+
setErrorMessage(err.message);
|
|
86
|
+
} else {
|
|
87
|
+
setErrorMessage(LozengeActionErrorMessages.updateFailed);
|
|
88
|
+
}
|
|
81
89
|
}
|
|
82
90
|
}, [action === null || action === void 0 ? void 0 : action.update, invoke, reload]);
|
|
83
91
|
const dropdownItemGroup = useMemo(() => {
|
|
84
|
-
if (
|
|
92
|
+
if (errorMessage) {
|
|
85
93
|
return jsx(LozengeActionError, {
|
|
86
|
-
|
|
94
|
+
errorMessage: errorMessage,
|
|
87
95
|
testId: testId
|
|
88
96
|
});
|
|
89
97
|
}
|
|
@@ -97,13 +105,14 @@ const LozengeAction = ({
|
|
|
97
105
|
testId: `${testId}-item-${idx}`
|
|
98
106
|
})))));
|
|
99
107
|
}
|
|
100
|
-
}, [
|
|
108
|
+
}, [errorMessage, handleItemClick, items, testId]);
|
|
101
109
|
return jsx(DropdownMenu, {
|
|
102
110
|
isLoading: isLoading,
|
|
103
111
|
isOpen: isOpen,
|
|
104
112
|
onOpenChange: handleOpenChange,
|
|
105
113
|
testId: testId,
|
|
106
|
-
trigger: trigger
|
|
114
|
+
trigger: trigger,
|
|
115
|
+
zIndex: zIndex
|
|
107
116
|
}, dropdownItemGroup);
|
|
108
117
|
};
|
|
109
118
|
export default withErrorBoundary(LozengeAction);
|
package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/index.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { Fragment, useMemo } from 'react';
|
|
2
4
|
import { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
5
|
+
import { R50, R500 } from '@atlaskit/theme/colors';
|
|
6
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
7
|
+
import { dropdownItemGroupStyles, contentStyles, textStyles } from './styled';
|
|
8
|
+
import { getFormattedMessage } from '../../../utils';
|
|
9
|
+
const MAX_LINE_NUMBER = 8;
|
|
3
10
|
const LozengeActionError = ({
|
|
4
|
-
|
|
5
|
-
testId
|
|
11
|
+
errorMessage,
|
|
12
|
+
testId,
|
|
13
|
+
maxLineNumber = MAX_LINE_NUMBER
|
|
6
14
|
}) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
const content = useMemo(() => {
|
|
16
|
+
return jsx(Fragment, null, jsx("div", {
|
|
17
|
+
css: contentStyles
|
|
18
|
+
}, jsx(ErrorIcon, {
|
|
19
|
+
testId: `${testId}-icon`,
|
|
20
|
+
size: "medium",
|
|
21
|
+
primaryColor: `var(--ds-icon-danger, ${R500})`,
|
|
22
|
+
secondaryColor: `var(--ds-background-danger, ${R50})`,
|
|
23
|
+
label: 'error'
|
|
24
|
+
}), jsx("span", {
|
|
25
|
+
css: textStyles(maxLineNumber),
|
|
26
|
+
"data-testid": `${testId}-error-message`
|
|
27
|
+
}, typeof errorMessage === 'string' ? errorMessage : getFormattedMessage(errorMessage))));
|
|
28
|
+
}, [errorMessage, maxLineNumber, testId]);
|
|
29
|
+
return jsx("span", {
|
|
30
|
+
css: dropdownItemGroupStyles,
|
|
31
|
+
"data-testid": `${testId}-error-item-group`
|
|
32
|
+
}, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
|
|
10
33
|
testId: `${testId}-error`
|
|
11
|
-
}, content));
|
|
34
|
+
}, content)));
|
|
12
35
|
};
|
|
13
36
|
export default LozengeActionError;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { N800 } from '@atlaskit/theme/colors';
|
|
3
|
+
import { getTruncateStyles } from '../../../utils';
|
|
4
|
+
export const dropdownItemGroupStyles = css`
|
|
5
|
+
button {
|
|
6
|
+
width: 220px;
|
|
7
|
+
|
|
8
|
+
&:hover {
|
|
9
|
+
background-color: inherit;
|
|
10
|
+
cursor: default;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const sharedBlockStyles = css`
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: 0.5rem;
|
|
17
|
+
line-height: 1rem;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
align-items: center;
|
|
22
|
+
`;
|
|
23
|
+
export const contentStyles = css`
|
|
24
|
+
${sharedBlockStyles};
|
|
25
|
+
|
|
26
|
+
margin-top: 2px;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
|
|
29
|
+
> span,
|
|
30
|
+
> div {
|
|
31
|
+
&[data-smart-element-text] {
|
|
32
|
+
font-size: 0.875rem;
|
|
33
|
+
color: ${`var(--ds-text, ${N800})`};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const textStyles = maxLines => css`
|
|
38
|
+
line-height: 1rem;
|
|
39
|
+
white-space: normal;
|
|
40
|
+
${getTruncateStyles(maxLines)};
|
|
41
|
+
`;
|
package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/types.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { messages } from '../../../../../../messages';
|
|
2
|
+
export const LozengeActionErrorMessages = {
|
|
3
|
+
noData: {
|
|
4
|
+
descriptor: messages['status_change_permission_error']
|
|
5
|
+
},
|
|
6
|
+
unknown: {
|
|
7
|
+
descriptor: messages['status_change_load_error']
|
|
8
|
+
},
|
|
9
|
+
updateFailed: {
|
|
10
|
+
descriptor: messages['status_change_update_error']
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -112,6 +112,7 @@ export const getContainerStyles = (size, hideBackground, hideElevation, hidePadd
|
|
|
112
112
|
`;
|
|
113
113
|
};
|
|
114
114
|
const renderChildren = (children, containerSize, containerTheme, status, retry, onClick, onActionMenuOpenChange) => React.Children.map(children, child => {
|
|
115
|
+
// TODO: EDM-6468: Use useFlexibleUiOptionContext for rendering options inside block/element instead
|
|
115
116
|
if ( /*#__PURE__*/React.isValidElement(child) && isFlexibleUiBlock(child)) {
|
|
116
117
|
const {
|
|
117
118
|
size: blockSize
|
|
@@ -177,9 +178,10 @@ const Container = ({
|
|
|
177
178
|
hideElevation = false,
|
|
178
179
|
hideHoverCardPreviewButton = false,
|
|
179
180
|
hidePadding = false,
|
|
180
|
-
showHoverPreview = false,
|
|
181
181
|
onClick,
|
|
182
182
|
retry,
|
|
183
|
+
showHoverPreview = false,
|
|
184
|
+
showServerActions = false,
|
|
183
185
|
size = SmartLinkSize.Medium,
|
|
184
186
|
status,
|
|
185
187
|
testId = 'smart-links-container',
|
|
@@ -199,7 +201,8 @@ const Container = ({
|
|
|
199
201
|
url: context === null || context === void 0 ? void 0 : context.url,
|
|
200
202
|
canOpen: hoverCardCanOpen,
|
|
201
203
|
closeOnChildClick: true,
|
|
202
|
-
hidePreviewButton: hideHoverCardPreviewButton
|
|
204
|
+
hidePreviewButton: hideHoverCardPreviewButton,
|
|
205
|
+
showServerActions: showServerActions
|
|
203
206
|
}, containerContent);
|
|
204
207
|
}
|
|
205
208
|
return containerContent;
|
|
@@ -3,6 +3,7 @@ import React, { useCallback, useState } from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import AtlaskitLozenge from '@atlaskit/lozenge';
|
|
5
5
|
import LozengeAction from '../../common/lozenge-action';
|
|
6
|
+
import { useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
6
7
|
const styles = css`
|
|
7
8
|
display: inline-flex;
|
|
8
9
|
line-height: inherit;
|
|
@@ -26,6 +27,7 @@ const Lozenge = ({
|
|
|
26
27
|
text,
|
|
27
28
|
testId = 'smart-element-lozenge'
|
|
28
29
|
}) => {
|
|
30
|
+
const ui = useFlexibleUiOptionContext();
|
|
29
31
|
const [isBold, setIsBold] = useState(false);
|
|
30
32
|
const onHover = useCallback(isHover => {
|
|
31
33
|
if (onClick) {
|
|
@@ -41,7 +43,8 @@ const Lozenge = ({
|
|
|
41
43
|
action: action,
|
|
42
44
|
appearance: appearance,
|
|
43
45
|
testId: testId,
|
|
44
|
-
text: text
|
|
46
|
+
text: text,
|
|
47
|
+
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
45
48
|
}) : jsx(AtlaskitLozenge, {
|
|
46
49
|
appearance: appearance,
|
|
47
50
|
isBold: isBold,
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
4
|
import { SmartLinkStatus } from '../../constants';
|
|
5
5
|
import Container from './components/container';
|
|
6
|
-
import { FlexibleUiAnalyticsContext, FlexibleUiContext } from '../../state/flexible-ui-context';
|
|
6
|
+
import { FlexibleUiAnalyticsContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
7
7
|
import { getContextByStatus, getRetryOptions } from './utils';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -76,15 +76,18 @@ const FlexibleCard = ({
|
|
|
76
76
|
}, [onError, onResolve, status, title, url]);
|
|
77
77
|
return /*#__PURE__*/React.createElement(FlexibleUiAnalyticsContext.Provider, {
|
|
78
78
|
value: analytics
|
|
79
|
+
}, /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
80
|
+
value: ui
|
|
79
81
|
}, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
|
|
80
82
|
value: context
|
|
81
83
|
}, /*#__PURE__*/React.createElement(Container, _extends({
|
|
82
84
|
testId: testId
|
|
83
85
|
}, ui, {
|
|
84
|
-
showHoverPreview: showHoverPreview,
|
|
85
86
|
onClick: onClick,
|
|
86
87
|
retry: retry,
|
|
88
|
+
showHoverPreview: showHoverPreview,
|
|
89
|
+
showServerActions: showServerActions,
|
|
87
90
|
status: status
|
|
88
|
-
}), children)));
|
|
91
|
+
}), children))));
|
|
89
92
|
};
|
|
90
93
|
export default FlexibleCard;
|
|
@@ -7,7 +7,7 @@ import { useSmartLinkActions } from '../../../state/hooks-external/useSmartLinkA
|
|
|
7
7
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
8
8
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
9
9
|
import HoverCardContent from '../components/HoverCardContent';
|
|
10
|
-
import { CARD_GAP_PX } from '../styled';
|
|
10
|
+
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
11
11
|
import { CardDisplay } from '../../../constants';
|
|
12
12
|
export const HoverCardComponent = ({
|
|
13
13
|
children,
|
|
@@ -16,7 +16,8 @@ export const HoverCardComponent = ({
|
|
|
16
16
|
analytics,
|
|
17
17
|
canOpen = true,
|
|
18
18
|
closeOnChildClick = false,
|
|
19
|
-
hidePreviewButton = false
|
|
19
|
+
hidePreviewButton = false,
|
|
20
|
+
showServerActions = false
|
|
20
21
|
}) => {
|
|
21
22
|
const delay = 300;
|
|
22
23
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -120,8 +121,9 @@ export const HoverCardComponent = ({
|
|
|
120
121
|
onActionClick: onActionClick,
|
|
121
122
|
onResolve: update,
|
|
122
123
|
renderers: renderers,
|
|
124
|
+
showServerActions: showServerActions,
|
|
123
125
|
url: url
|
|
124
|
-
}), [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, url]);
|
|
126
|
+
}), [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url]);
|
|
125
127
|
const trigger = useCallback(triggerProps => jsx("span", {
|
|
126
128
|
ref: parentSpan
|
|
127
129
|
}, jsx("span", _extends({}, triggerProps, {
|
|
@@ -140,6 +142,6 @@ export const HoverCardComponent = ({
|
|
|
140
142
|
autoFocus: false,
|
|
141
143
|
content: content,
|
|
142
144
|
trigger: trigger,
|
|
143
|
-
zIndex:
|
|
145
|
+
zIndex: HOVER_CARD_Z_INDEX
|
|
144
146
|
});
|
|
145
147
|
};
|
|
@@ -58,7 +58,8 @@ const HoverCardContent = ({
|
|
|
58
58
|
renderers,
|
|
59
59
|
url,
|
|
60
60
|
onMouseEnter,
|
|
61
|
-
onMouseLeave
|
|
61
|
+
onMouseLeave,
|
|
62
|
+
showServerActions
|
|
62
63
|
}) => {
|
|
63
64
|
var _cardState$details;
|
|
64
65
|
const {
|
|
@@ -99,6 +100,7 @@ const HoverCardContent = ({
|
|
|
99
100
|
onClick: onClick,
|
|
100
101
|
onResolve: onResolve,
|
|
101
102
|
renderers: renderers,
|
|
103
|
+
showServerActions,
|
|
102
104
|
ui: flexibleUiOptions,
|
|
103
105
|
url: url,
|
|
104
106
|
children: {}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { loadingPlaceholderClassName } from '../../index';
|
|
3
3
|
import { SmartLinkSize, SmartLinkTheme } from '../../constants';
|
|
4
|
+
// Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
5
|
+
export const HOVER_CARD_Z_INDEX = 511;
|
|
4
6
|
export const flexibleUiOptions = {
|
|
5
7
|
hideBackground: true,
|
|
6
8
|
hideElevation: true,
|
|
@@ -8,7 +10,8 @@ export const flexibleUiOptions = {
|
|
|
8
10
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
9
11
|
theme: SmartLinkTheme.Black,
|
|
10
12
|
hidePadding: true,
|
|
11
|
-
hideHoverCardPreviewButton: false
|
|
13
|
+
hideHoverCardPreviewButton: false,
|
|
14
|
+
zIndex: HOVER_CARD_Z_INDEX + 1
|
|
12
15
|
};
|
|
13
16
|
export const CARD_WIDTH_REM = 24;
|
|
14
17
|
// gap between mouse cursor and hover card
|
|
@@ -29,7 +29,8 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
29
29
|
testId = 'inline-card-resolved-view',
|
|
30
30
|
titleTextColor,
|
|
31
31
|
titlePrefix,
|
|
32
|
-
showHoverPreview = false
|
|
32
|
+
showHoverPreview = false,
|
|
33
|
+
showServerActions = false
|
|
33
34
|
} = this.props;
|
|
34
35
|
const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
|
|
35
36
|
testId: testId,
|
|
@@ -45,6 +46,7 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
45
46
|
if (showHoverPreview && link) {
|
|
46
47
|
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
47
48
|
id: id,
|
|
49
|
+
showServerActions: showServerActions,
|
|
48
50
|
url: link
|
|
49
51
|
}, inlineCardResolvedView);
|
|
50
52
|
}
|
|
@@ -27,7 +27,8 @@ export const InlineCard = ({
|
|
|
27
27
|
testId,
|
|
28
28
|
inlinePreloaderStyle,
|
|
29
29
|
showHoverPreview,
|
|
30
|
-
showAuthTooltip
|
|
30
|
+
showAuthTooltip,
|
|
31
|
+
showServerActions
|
|
31
32
|
}) => {
|
|
32
33
|
var _details$meta;
|
|
33
34
|
const {
|
|
@@ -62,6 +63,7 @@ export const InlineCard = ({
|
|
|
62
63
|
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
63
64
|
id: id,
|
|
64
65
|
showHoverPreview: showHoverPreview,
|
|
66
|
+
showServerActions: showServerActions,
|
|
65
67
|
link: url,
|
|
66
68
|
isSelected: isSelected,
|
|
67
69
|
onClick: handleFrameClick,
|
package/dist/esm/messages.js
CHANGED
|
@@ -200,6 +200,11 @@ export var messages = defineMessages({
|
|
|
200
200
|
defaultMessage: "Uh oh. We can't find this link!",
|
|
201
201
|
description: 'Error case for when a provided link is not found'
|
|
202
202
|
},
|
|
203
|
+
open_issue_in_jira: {
|
|
204
|
+
id: 'fabric.linking.open_issue_in_jira',
|
|
205
|
+
defaultMessage: 'Open issue in Jira',
|
|
206
|
+
description: 'Click to open link in Jira'
|
|
207
|
+
},
|
|
203
208
|
open_link_in_a_new_tab: {
|
|
204
209
|
id: 'fabric.linking.open_link_in_a_new_tab',
|
|
205
210
|
defaultMessage: 'Open link in a new tab',
|
|
@@ -345,6 +350,21 @@ export var messages = defineMessages({
|
|
|
345
350
|
defaultMessage: 'Save',
|
|
346
351
|
description: 'Just the "save" word'
|
|
347
352
|
},
|
|
353
|
+
status_change_load_error: {
|
|
354
|
+
id: 'fabric.linking.status_change_load_error',
|
|
355
|
+
defaultMessage: 'We couldn’t load the statuses and transitions',
|
|
356
|
+
description: 'Informs the user that the loading of status transitions failed'
|
|
357
|
+
},
|
|
358
|
+
status_change_permission_error: {
|
|
359
|
+
id: 'fabric.linking.status_change_permission_error',
|
|
360
|
+
defaultMessage: 'You don’t have permission to transition this issue. ',
|
|
361
|
+
description: 'Informs the user that they do not have enough permissions to update a status'
|
|
362
|
+
},
|
|
363
|
+
status_change_update_error: {
|
|
364
|
+
id: 'fabric.linking.status_change_update_error',
|
|
365
|
+
defaultMessage: 'We couldn’t update the status',
|
|
366
|
+
description: "Occurs when a user tries to update an issue's status but fails to do so"
|
|
367
|
+
},
|
|
348
368
|
try_again: {
|
|
349
369
|
id: 'fabric.linking.try_again',
|
|
350
370
|
defaultMessage: 'Try again',
|
|
@@ -15,4 +15,13 @@ export var useFlexibleUiContext = function useFlexibleUiContext() {
|
|
|
15
15
|
export var FlexibleUiAnalyticsContext = /*#__PURE__*/createContext(undefined);
|
|
16
16
|
export var useFlexibleUiAnalyticsContext = function useFlexibleUiAnalyticsContext() {
|
|
17
17
|
return useContext(FlexibleUiAnalyticsContext);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
22
|
+
* to render its underlying elements.
|
|
23
|
+
*/
|
|
24
|
+
export var FlexibleUiOptionContext = /*#__PURE__*/createContext(undefined);
|
|
25
|
+
export var useFlexibleUiOptionContext = function useFlexibleUiOptionContext() {
|
|
26
|
+
return useContext(FlexibleUiOptionContext);
|
|
18
27
|
};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Additional details for invoke function that may be required for component
|
|
5
|
-
*/
|
|
6
|
-
(function (InvokeActionError) {
|
|
7
|
-
InvokeActionError["NoData"] = "NoData";
|
|
8
|
-
InvokeActionError["Unknown"] = "Unknown";
|
|
9
|
-
})(InvokeActionError || (InvokeActionError = {}));
|
|
10
|
-
/**
|
|
11
|
-
* Invoke request with additional details for the component
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* CRUD invoke requests for the component that support server actions
|
|
15
|
-
*/
|
|
1
|
+
export {};
|
package/dist/esm/version.json
CHANGED
|
@@ -208,7 +208,8 @@ export function CardWithUrlContent(_ref) {
|
|
|
208
208
|
testId: testId,
|
|
209
209
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
210
210
|
showHoverPreview: showHoverPreview,
|
|
211
|
-
showAuthTooltip: showAuthTooltip
|
|
211
|
+
showAuthTooltip: showAuthTooltip,
|
|
212
|
+
showServerActions: showServerActions
|
|
212
213
|
});
|
|
213
214
|
case 'block':
|
|
214
215
|
return /*#__PURE__*/React.createElement(BlockCard, {
|
|
@@ -16,7 +16,7 @@ import Button from '@atlaskit/button/standard-button';
|
|
|
16
16
|
import MoreIcon from '@atlaskit/icon/glyph/more';
|
|
17
17
|
import { sizeToButtonSpacing } from '../../utils';
|
|
18
18
|
import { messages } from '../../../../../messages';
|
|
19
|
-
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
19
|
+
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
20
20
|
import ActionGroupItem from './action-group-item';
|
|
21
21
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n > div {\n align-items: center;\n button:focus-visible {\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 outline-offset: -2px;\n }\n }\n"])));
|
|
22
22
|
var renderActionItems = function renderActionItems() {
|
|
@@ -73,6 +73,7 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
73
73
|
onDropdownOpenChange = _ref.onDropdownOpenChange,
|
|
74
74
|
testId = _ref.testId;
|
|
75
75
|
var context = useFlexibleUiContext();
|
|
76
|
+
var ui = useFlexibleUiOptionContext();
|
|
76
77
|
var _useState = useState(false),
|
|
77
78
|
_useState2 = _slicedToArray(_useState, 2),
|
|
78
79
|
isOpen = _useState2[0],
|
|
@@ -124,11 +125,12 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
124
125
|
ref: triggerRef
|
|
125
126
|
})));
|
|
126
127
|
},
|
|
127
|
-
testId: "action-group-dropdown"
|
|
128
|
+
testId: "action-group-dropdown",
|
|
129
|
+
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
128
130
|
}, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
|
|
129
131
|
}
|
|
130
132
|
return null;
|
|
131
|
-
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, visibleButtonsNum]);
|
|
133
|
+
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum]);
|
|
132
134
|
return renderableActionItems.length > 0 ? jsx("div", {
|
|
133
135
|
css: styles,
|
|
134
136
|
className: "actions-button-group"
|