@atlaskit/smart-card 23.13.2 → 23.13.3
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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +88 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +90 -42
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +5 -69
- package/dist/cjs/view/FlexibleCard/index.js +3 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +27 -25
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +64 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +75 -34
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +3 -56
- package/dist/es2019/view/FlexibleCard/index.js +2 -2
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +24 -22
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +69 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +89 -42
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +4 -66
- package/dist/esm/view/FlexibleCard/index.js +4 -2
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +27 -25
- package/dist/types/view/FlexibleCard/components/blocks/action-group/action-group-item/index.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +2 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
|
3
3
|
import { SmartLinkStatus } from '../../constants';
|
|
4
4
|
import Container from './components/container';
|
|
5
5
|
import { FlexibleUiAnalyticsContext, FlexibleUiContext } from '../../state/flexible-ui-context';
|
|
@@ -27,7 +27,9 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
27
27
|
var cardType = cardState.status,
|
|
28
28
|
details = cardState.details;
|
|
29
29
|
var status = cardType;
|
|
30
|
-
var context =
|
|
30
|
+
var context = useMemo(function () {
|
|
31
|
+
return getContextByStatus(url, status, details, renderers);
|
|
32
|
+
}, [details, renderers, status, url]);
|
|
31
33
|
var retry = getRetryOptions(url, status, details, onAuthorize);
|
|
32
34
|
|
|
33
35
|
var _ref2 = context || {},
|
|
@@ -120,6 +120,31 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
120
120
|
hideCard();
|
|
121
121
|
}
|
|
122
122
|
}, [closeOnChildClick, hideCard]);
|
|
123
|
+
var content = useCallback(function (_ref2) {
|
|
124
|
+
var update = _ref2.update;
|
|
125
|
+
return jsx(HoverCardContent, {
|
|
126
|
+
onMouseEnter: initShowCard,
|
|
127
|
+
onMouseLeave: initHideCard,
|
|
128
|
+
analytics: analytics,
|
|
129
|
+
cardActions: linkActions,
|
|
130
|
+
cardState: linkState,
|
|
131
|
+
onActionClick: onActionClick,
|
|
132
|
+
onResolve: update,
|
|
133
|
+
renderers: renderers,
|
|
134
|
+
url: url
|
|
135
|
+
});
|
|
136
|
+
}, [analytics, initHideCard, initShowCard, linkActions, linkState, onActionClick, renderers, url]);
|
|
137
|
+
var trigger = useCallback(function (triggerProps) {
|
|
138
|
+
return jsx("span", {
|
|
139
|
+
ref: parentSpan
|
|
140
|
+
}, jsx("span", _extends({}, triggerProps, {
|
|
141
|
+
onMouseEnter: initShowCard,
|
|
142
|
+
onMouseLeave: initHideCard,
|
|
143
|
+
onMouseMove: setMousePosition,
|
|
144
|
+
onClick: onChildClick,
|
|
145
|
+
"data-testid": "hover-card-trigger-wrapper"
|
|
146
|
+
}), children));
|
|
147
|
+
}, [children, initHideCard, initShowCard, onChildClick, setMousePosition]);
|
|
123
148
|
return jsx(Popup, {
|
|
124
149
|
testId: "hover-card",
|
|
125
150
|
isOpen: isOpen && canOpen,
|
|
@@ -127,31 +152,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
127
152
|
placement: "bottom-start",
|
|
128
153
|
offset: popupOffset.current,
|
|
129
154
|
autoFocus: false,
|
|
130
|
-
content:
|
|
131
|
-
|
|
132
|
-
return jsx(HoverCardContent, {
|
|
133
|
-
onMouseEnter: initShowCard,
|
|
134
|
-
onMouseLeave: initHideCard,
|
|
135
|
-
analytics: analytics,
|
|
136
|
-
cardActions: linkActions,
|
|
137
|
-
cardState: linkState,
|
|
138
|
-
onActionClick: onActionClick,
|
|
139
|
-
onResolve: update,
|
|
140
|
-
renderers: renderers,
|
|
141
|
-
url: url
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
trigger: function trigger(triggerProps) {
|
|
145
|
-
return jsx("span", {
|
|
146
|
-
ref: parentSpan
|
|
147
|
-
}, jsx("span", _extends({}, triggerProps, {
|
|
148
|
-
onMouseEnter: initShowCard,
|
|
149
|
-
onMouseLeave: initHideCard,
|
|
150
|
-
onMouseMove: setMousePosition,
|
|
151
|
-
onClick: onChildClick,
|
|
152
|
-
"data-testid": "hover-card-trigger-wrapper"
|
|
153
|
-
}), children));
|
|
154
|
-
},
|
|
155
|
+
content: content,
|
|
156
|
+
trigger: trigger,
|
|
155
157
|
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
156
158
|
|
|
157
159
|
});
|
package/dist/types/view/FlexibleCard/components/blocks/action-group/action-group-item/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Appearance } from '@atlaskit/button';
|
|
3
|
+
import { SmartLinkSize } from '../../../../../../constants';
|
|
4
|
+
import { ActionItem } from '../../types';
|
|
5
|
+
declare const ActionGroupItem: React.FC<{
|
|
6
|
+
item: ActionItem;
|
|
7
|
+
size: SmartLinkSize;
|
|
8
|
+
appearance?: Appearance;
|
|
9
|
+
asDropDownItems?: boolean;
|
|
10
|
+
onActionItemClick?: () => void;
|
|
11
|
+
}>;
|
|
12
|
+
export default ActionGroupItem;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SerializedStyles } from '@emotion/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ElementItem } from './types';
|
|
4
4
|
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
|
|
5
|
-
import { Appearance } from '@atlaskit/button';
|
|
6
5
|
export declare type ElementDisplaySchemaType = 'inline' | 'block';
|
|
7
6
|
export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
|
|
8
7
|
export declare const getGapSize: (size: SmartLinkSize) => number;
|
|
9
8
|
export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
|
|
10
9
|
export declare const highlightRemoveStyles: SerializedStyles;
|
|
10
|
+
export declare const isJSXElementNull: (children: JSX.Element) => boolean;
|
|
11
11
|
export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
|
|
12
12
|
export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
|
|
13
|
-
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: Appearance | undefined, asDropDownItems?: boolean | undefined, onActionItemClick?: (() => void) | undefined) => React.ReactElement[] | undefined;
|