@atlaskit/smart-card 26.38.0 → 26.38.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 +7 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/cjs/view/BlockCard/index.js +5 -18
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -51
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +7 -18
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +28 -51
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +5 -5
- package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +41 -0
- package/dist/cjs/view/BlockCard/views/flexible/utils/index.js +30 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +12 -57
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +65 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/es2019/view/BlockCard/index.js +1 -15
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +8 -32
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -52
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +12 -31
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +15 -41
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +24 -43
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +3 -4
- package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +33 -0
- package/dist/es2019/view/BlockCard/views/flexible/utils/index.js +27 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +11 -54
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +56 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +4 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/esm/view/BlockCard/index.js +3 -18
- package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
- package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +26 -52
- package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
- package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +25 -45
- package/dist/esm/view/BlockCard/views/flexible/styled.js +4 -4
- package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +35 -0
- package/dist/esm/view/BlockCard/views/flexible/utils/index.js +30 -1
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +13 -54
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +55 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +4 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
- package/dist/types/view/BlockCard/views/flexible/styled.d.ts +0 -1
- package/dist/types/view/BlockCard/views/flexible/types.d.ts +2 -83
- package/dist/types/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
- package/dist/types/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
- package/dist/types/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
- package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +0 -1
- package/dist/types-ts4.5/view/BlockCard/views/flexible/types.d.ts +2 -83
- package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +0 -56
- package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +0 -52
- package/dist/esm/view/BlockCard/components/flexible/footer/index.js +0 -49
- package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
- package/dist/types/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
- package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
- package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
- /package/dist/cjs/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
- /package/dist/es2019/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
- /package/dist/esm/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
+
var _templateObject;
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
7
|
+
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
8
|
+
import { Provider } from '../../../elements';
|
|
9
|
+
import ActionGroup from '../../action-group';
|
|
10
|
+
import Block from '../../block';
|
|
11
|
+
import ElementGroup from '../../element-group';
|
|
12
|
+
import { filterActionItems } from '../../utils';
|
|
13
|
+
var getActionGroupStyles = function getActionGroupStyles(size) {
|
|
14
|
+
if (size === SmartLinkSize.XLarge) {
|
|
15
|
+
// The biggest height of the action button exceeds the max line-height
|
|
16
|
+
// of the elements causing the action on the block with x-large size to
|
|
17
|
+
// get cut at the bottom.
|
|
18
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
|
|
22
|
+
var actions = props.actions,
|
|
23
|
+
testId = props.testId,
|
|
24
|
+
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
25
|
+
_props$size = props.size,
|
|
26
|
+
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size;
|
|
27
|
+
var context = useFlexibleUiContext();
|
|
28
|
+
var hasActions = useMemo(function () {
|
|
29
|
+
var _filterActionItems;
|
|
30
|
+
return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
|
|
31
|
+
}, [actions, context]);
|
|
32
|
+
var onDropdownOpenChange = useCallback(function (isOpen) {
|
|
33
|
+
if (onActionMenuOpenChange) {
|
|
34
|
+
onActionMenuOpenChange({
|
|
35
|
+
isOpen: isOpen
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [onActionMenuOpenChange]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
40
|
+
testId: "".concat(testId, "-resolved-view")
|
|
41
|
+
}), /*#__PURE__*/React.createElement(Provider, {
|
|
42
|
+
testId: "".concat(testId, "-provider")
|
|
43
|
+
}), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
44
|
+
testId: "smart-element-group-actions",
|
|
45
|
+
align: SmartLinkAlignment.Right,
|
|
46
|
+
direction: SmartLinkDirection.Horizontal,
|
|
47
|
+
overrideCss: getActionGroupStyles(size),
|
|
48
|
+
width: SmartLinkWidth.Flexible
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
50
|
+
onDropdownOpenChange: onDropdownOpenChange,
|
|
51
|
+
items: actions,
|
|
52
|
+
appearance: "default"
|
|
53
|
+
})) : null);
|
|
54
|
+
};
|
|
55
|
+
export default FooterBlockResolvedView;
|
|
@@ -3,4 +3,7 @@ export { default as MetadataBlock } from './metadata-block';
|
|
|
3
3
|
export { default as PreviewBlock } from './preview-block';
|
|
4
4
|
export { default as SnippetBlock } from './snippet-block';
|
|
5
5
|
export { default as TitleBlock } from './title-block';
|
|
6
|
-
export { default as CustomBlock } from './block';
|
|
6
|
+
export { default as CustomBlock } from './block';
|
|
7
|
+
|
|
8
|
+
// Internal components to be used within @atlaskit/smart-card only.
|
|
9
|
+
export { default as InternalFooterBlock } from './footer-block/resolved';
|
|
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
var PACKAGE_DATA = {
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "26.38.
|
|
14
|
+
packageVersion: "26.38.1",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import { FlexibleBlockCardProps } from './types';
|
|
2
|
-
declare const _default: (props: FlexibleBlockCardProps) =>
|
|
4
|
+
declare const _default: (props: FlexibleBlockCardProps) => jsx.JSX.Element;
|
|
3
5
|
export default _default;
|
|
@@ -2,4 +2,3 @@ export declare const metadataBlockCss: import("@emotion/react").SerializedStyles
|
|
|
2
2
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
|
|
5
|
-
export declare const forbiddenViewTitleStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { OnErrorCallback } from '../../../types';
|
|
4
|
-
import { FlexibleUiOptions } from '../../../FlexibleCard/types';
|
|
5
|
-
import { OnResolveCallback } from '../../../Card/types';
|
|
6
|
-
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
7
|
-
import { AnalyticsFacade } from '../../../../state/analytics';
|
|
8
|
-
import { AnchorTarget } from '../../../FlexibleCard/components/types';
|
|
9
|
-
import { TitleBlockProps } from '../../../FlexibleCard/components/blocks/title-block/types';
|
|
10
|
-
export type FlexibleBlockCardProps = {
|
|
11
|
-
/**
|
|
12
|
-
* An AnalyticsFacade object used for calling analytics.
|
|
13
|
-
*/
|
|
14
|
-
analytics: AnalyticsFacade;
|
|
15
|
-
/**
|
|
16
|
-
* Determines the anchor target to be passed to the title block.
|
|
17
|
-
*/
|
|
18
|
-
anchorTarget?: AnchorTarget;
|
|
19
|
-
/**
|
|
20
|
-
* Determines the status and data of the Smart Link.
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
cardState: CardState;
|
|
24
|
-
/**
|
|
25
|
-
* Provides the extensionKey of a Smart Link resolver invoked.
|
|
26
|
-
*/
|
|
27
|
-
extensionKey?: string;
|
|
28
|
-
/**
|
|
29
|
-
* A unique id for this Smart Link instance, used for analytics.
|
|
30
|
-
*/
|
|
31
|
-
id?: string;
|
|
32
|
-
/**
|
|
33
|
-
* An additional action that can be performed when link is not resolved, e.g.
|
|
34
|
-
* connect account to gain access to 403 link.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
onAuthorize?: () => void;
|
|
38
|
-
/**
|
|
39
|
-
* Determines the onClick behaviour of Flexible UI. This will proxy to the
|
|
40
|
-
* TitleBlock if supplied.
|
|
41
|
-
*/
|
|
42
|
-
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
43
|
-
/**
|
|
44
|
-
* function to be called after a flexible card has rendered its error states
|
|
45
|
-
*/
|
|
46
|
-
onError?: OnErrorCallback;
|
|
47
|
-
/**
|
|
48
|
-
* function to be called after a flexible card has rendered its resolved state
|
|
49
|
-
*/
|
|
50
|
-
onResolve?: OnResolveCallback;
|
|
51
|
-
/**
|
|
52
|
-
* A name of the provider, needed to specify to user which account has to be connected
|
|
53
|
-
*/
|
|
54
|
-
providerName?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Any additional renderers required by Flexible UI. Currently used by icon
|
|
57
|
-
* to render Emoji.
|
|
58
|
-
*/
|
|
59
|
-
renderers?: CardProviderRenderers;
|
|
60
|
-
/**
|
|
61
|
-
* Determines whether to show available server actions.
|
|
62
|
-
*/
|
|
63
|
-
showServerActions?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* A `testId` prop is provided for specified elements, which is a unique
|
|
66
|
-
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
67
|
-
* serving as a hook for automated tests
|
|
68
|
-
*/
|
|
69
|
-
testId?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Determines the appearance of Flexible UI.
|
|
72
|
-
* @see FlexibleUiOptions
|
|
73
|
-
*/
|
|
74
|
-
ui?: FlexibleUiOptions;
|
|
75
|
-
/**
|
|
76
|
-
* Determines the URL of the Smart Link.
|
|
77
|
-
*/
|
|
78
|
-
url: string;
|
|
79
|
-
/**
|
|
80
|
-
* Determines a style of the Title Block.
|
|
81
|
-
*/
|
|
82
|
-
titleBlockProps?: TitleBlockProps;
|
|
83
|
-
};
|
|
1
|
+
import { FlexibleCardProps } from '../../../FlexibleCard/types';
|
|
2
|
+
export type FlexibleBlockCardProps = Pick<FlexibleCardProps, 'analytics' | 'cardState' | 'id' | 'onAuthorize' | 'onClick' | 'onError' | 'onResolve' | 'renderers' | 'showServerActions' | 'testId' | 'url'>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
|
|
2
|
+
import type { FlexibleBlockCardProps } from '../types';
|
|
3
|
+
export type UnresolvedViewProps = FlexibleBlockCardProps & {
|
|
4
|
+
actions?: ActionItem[];
|
|
5
|
+
showPreview?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import type { FlexibleUiOptions } from '../../../../FlexibleCard/types';
|
|
3
|
+
import type { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/footer-block/types';
|
|
4
|
+
import type { PreviewBlockProps } from '../../../../FlexibleCard/components/blocks/preview-block/types';
|
|
5
|
+
import type { TitleBlockProps } from '../../../../FlexibleCard/components/blocks/title-block/types';
|
|
2
6
|
import { ElementItem } from '../../../../FlexibleCard/components/blocks/types';
|
|
3
7
|
export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
|
|
4
8
|
export declare const getSimulatedMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
|
|
@@ -7,4 +11,8 @@ type SimulatedMetadata = {
|
|
|
7
11
|
topMetadata: ElementItem[];
|
|
8
12
|
bottomMetadata?: ElementItem[];
|
|
9
13
|
};
|
|
14
|
+
export declare const FlexibleCardUiOptions: FlexibleUiOptions;
|
|
15
|
+
export declare const getTitleBlockOptions: () => Partial<TitleBlockProps>;
|
|
16
|
+
export declare const PreviewBlockOptions: Partial<PreviewBlockProps>;
|
|
17
|
+
export declare const getFooterBlockOptions: () => Partial<FooterBlockProps>;
|
|
10
18
|
export {};
|
|
@@ -4,3 +4,4 @@ export { default as PreviewBlock } from './preview-block';
|
|
|
4
4
|
export { default as SnippetBlock } from './snippet-block';
|
|
5
5
|
export { default as TitleBlock } from './title-block';
|
|
6
6
|
export { default as CustomBlock } from './block';
|
|
7
|
+
export { default as InternalFooterBlock } from './footer-block/resolved';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import { FlexibleBlockCardProps } from './types';
|
|
2
|
-
declare const _default: (props: FlexibleBlockCardProps) =>
|
|
4
|
+
declare const _default: (props: FlexibleBlockCardProps) => jsx.JSX.Element;
|
|
3
5
|
export default _default;
|
|
@@ -2,4 +2,3 @@ export declare const metadataBlockCss: import("@emotion/react").SerializedStyles
|
|
|
2
2
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
|
|
5
|
-
export declare const forbiddenViewTitleStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { OnErrorCallback } from '../../../types';
|
|
4
|
-
import { FlexibleUiOptions } from '../../../FlexibleCard/types';
|
|
5
|
-
import { OnResolveCallback } from '../../../Card/types';
|
|
6
|
-
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
7
|
-
import { AnalyticsFacade } from '../../../../state/analytics';
|
|
8
|
-
import { AnchorTarget } from '../../../FlexibleCard/components/types';
|
|
9
|
-
import { TitleBlockProps } from '../../../FlexibleCard/components/blocks/title-block/types';
|
|
10
|
-
export type FlexibleBlockCardProps = {
|
|
11
|
-
/**
|
|
12
|
-
* An AnalyticsFacade object used for calling analytics.
|
|
13
|
-
*/
|
|
14
|
-
analytics: AnalyticsFacade;
|
|
15
|
-
/**
|
|
16
|
-
* Determines the anchor target to be passed to the title block.
|
|
17
|
-
*/
|
|
18
|
-
anchorTarget?: AnchorTarget;
|
|
19
|
-
/**
|
|
20
|
-
* Determines the status and data of the Smart Link.
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
cardState: CardState;
|
|
24
|
-
/**
|
|
25
|
-
* Provides the extensionKey of a Smart Link resolver invoked.
|
|
26
|
-
*/
|
|
27
|
-
extensionKey?: string;
|
|
28
|
-
/**
|
|
29
|
-
* A unique id for this Smart Link instance, used for analytics.
|
|
30
|
-
*/
|
|
31
|
-
id?: string;
|
|
32
|
-
/**
|
|
33
|
-
* An additional action that can be performed when link is not resolved, e.g.
|
|
34
|
-
* connect account to gain access to 403 link.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
onAuthorize?: () => void;
|
|
38
|
-
/**
|
|
39
|
-
* Determines the onClick behaviour of Flexible UI. This will proxy to the
|
|
40
|
-
* TitleBlock if supplied.
|
|
41
|
-
*/
|
|
42
|
-
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
43
|
-
/**
|
|
44
|
-
* function to be called after a flexible card has rendered its error states
|
|
45
|
-
*/
|
|
46
|
-
onError?: OnErrorCallback;
|
|
47
|
-
/**
|
|
48
|
-
* function to be called after a flexible card has rendered its resolved state
|
|
49
|
-
*/
|
|
50
|
-
onResolve?: OnResolveCallback;
|
|
51
|
-
/**
|
|
52
|
-
* A name of the provider, needed to specify to user which account has to be connected
|
|
53
|
-
*/
|
|
54
|
-
providerName?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Any additional renderers required by Flexible UI. Currently used by icon
|
|
57
|
-
* to render Emoji.
|
|
58
|
-
*/
|
|
59
|
-
renderers?: CardProviderRenderers;
|
|
60
|
-
/**
|
|
61
|
-
* Determines whether to show available server actions.
|
|
62
|
-
*/
|
|
63
|
-
showServerActions?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* A `testId` prop is provided for specified elements, which is a unique
|
|
66
|
-
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
67
|
-
* serving as a hook for automated tests
|
|
68
|
-
*/
|
|
69
|
-
testId?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Determines the appearance of Flexible UI.
|
|
72
|
-
* @see FlexibleUiOptions
|
|
73
|
-
*/
|
|
74
|
-
ui?: FlexibleUiOptions;
|
|
75
|
-
/**
|
|
76
|
-
* Determines the URL of the Smart Link.
|
|
77
|
-
*/
|
|
78
|
-
url: string;
|
|
79
|
-
/**
|
|
80
|
-
* Determines a style of the Title Block.
|
|
81
|
-
*/
|
|
82
|
-
titleBlockProps?: TitleBlockProps;
|
|
83
|
-
};
|
|
1
|
+
import { FlexibleCardProps } from '../../../FlexibleCard/types';
|
|
2
|
+
export type FlexibleBlockCardProps = Pick<FlexibleCardProps, 'analytics' | 'cardState' | 'id' | 'onAuthorize' | 'onClick' | 'onError' | 'onResolve' | 'renderers' | 'showServerActions' | 'testId' | 'url'>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
|
|
2
|
+
import type { FlexibleBlockCardProps } from '../types';
|
|
3
|
+
export type UnresolvedViewProps = FlexibleBlockCardProps & {
|
|
4
|
+
actions?: ActionItem[];
|
|
5
|
+
showPreview?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import type { FlexibleUiOptions } from '../../../../FlexibleCard/types';
|
|
3
|
+
import type { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/footer-block/types';
|
|
4
|
+
import type { PreviewBlockProps } from '../../../../FlexibleCard/components/blocks/preview-block/types';
|
|
5
|
+
import type { TitleBlockProps } from '../../../../FlexibleCard/components/blocks/title-block/types';
|
|
2
6
|
import { ElementItem } from '../../../../FlexibleCard/components/blocks/types';
|
|
3
7
|
export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
|
|
4
8
|
export declare const getSimulatedMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
|
|
@@ -7,4 +11,8 @@ type SimulatedMetadata = {
|
|
|
7
11
|
topMetadata: ElementItem[];
|
|
8
12
|
bottomMetadata?: ElementItem[];
|
|
9
13
|
};
|
|
14
|
+
export declare const FlexibleCardUiOptions: FlexibleUiOptions;
|
|
15
|
+
export declare const getTitleBlockOptions: () => Partial<TitleBlockProps>;
|
|
16
|
+
export declare const PreviewBlockOptions: Partial<PreviewBlockProps>;
|
|
17
|
+
export declare const getFooterBlockOptions: () => Partial<FooterBlockProps>;
|
|
10
18
|
export {};
|
|
@@ -4,3 +4,4 @@ export { default as PreviewBlock } from './preview-block';
|
|
|
4
4
|
export { default as SnippetBlock } from './snippet-block';
|
|
5
5
|
export { default as TitleBlock } from './title-block';
|
|
6
6
|
export { default as CustomBlock } from './block';
|
|
7
|
+
export { default as InternalFooterBlock } from './footer-block/resolved';
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
11
|
-
var _elements = require("../../../../FlexibleCard/components/elements");
|
|
12
|
-
var _elementGroup = _interopRequireDefault(require("../../../../FlexibleCard/components/blocks/element-group"));
|
|
13
|
-
var _constants = require("../../../../../constants");
|
|
14
|
-
var _actionGroup = _interopRequireDefault(require("../../../../FlexibleCard/components/blocks/action-group"));
|
|
15
|
-
var _templateObject, _templateObject2;
|
|
16
|
-
var getActionGroupStyles = function getActionGroupStyles(size) {
|
|
17
|
-
if (size === _constants.SmartLinkSize.XLarge) {
|
|
18
|
-
// The biggest height of the action button exceeds the max line-height
|
|
19
|
-
// of the elements causing the action on the block with x-large size to
|
|
20
|
-
// get cut at the bottom.
|
|
21
|
-
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n max-height: 2rem;\n "])));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var providerStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n span:first-child {\n margin-right: 0.375rem;\n }\n"])));
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* This Component is a footer that is used in a Block Card with Flexible UI.
|
|
28
|
-
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
29
|
-
* To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
|
|
30
|
-
*
|
|
31
|
-
* @see CustomBlock
|
|
32
|
-
* @param props are the data required for the block, such as actions to be displayed.
|
|
33
|
-
*/
|
|
34
|
-
var BlockCardFooter = function BlockCardFooter(props) {
|
|
35
|
-
var actions = props.actions,
|
|
36
|
-
_props$size = props.size,
|
|
37
|
-
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
38
|
-
_props$testId = props.testId,
|
|
39
|
-
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId,
|
|
40
|
-
_props$actionGroupApp = props.actionGroupAppearance,
|
|
41
|
-
actionGroupAppearance = _props$actionGroupApp === void 0 ? 'default' : _props$actionGroupApp;
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
43
|
-
testId: "".concat(testId, "-provider"),
|
|
44
|
-
overrideCss: providerStyles
|
|
45
|
-
}), actions && actions.length > 0 ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
46
|
-
testId: "smart-element-group-actions",
|
|
47
|
-
align: _constants.SmartLinkAlignment.Right,
|
|
48
|
-
direction: _constants.SmartLinkDirection.Horizontal,
|
|
49
|
-
overrideCss: getActionGroupStyles(size),
|
|
50
|
-
width: _constants.SmartLinkWidth.Flexible
|
|
51
|
-
}, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
52
|
-
items: actions,
|
|
53
|
-
appearance: actionGroupAppearance
|
|
54
|
-
})) : null);
|
|
55
|
-
};
|
|
56
|
-
var _default = exports.default = BlockCardFooter;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
import { Provider } from '../../../../FlexibleCard/components/elements';
|
|
4
|
-
import ElementGroup from '../../../../FlexibleCard/components/blocks/element-group';
|
|
5
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
-
import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
|
|
7
|
-
const getActionGroupStyles = size => {
|
|
8
|
-
if (size === SmartLinkSize.XLarge) {
|
|
9
|
-
// The biggest height of the action button exceeds the max line-height
|
|
10
|
-
// of the elements causing the action on the block with x-large size to
|
|
11
|
-
// get cut at the bottom.
|
|
12
|
-
return css`
|
|
13
|
-
max-height: 2rem;
|
|
14
|
-
`;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const providerStyles = css`
|
|
18
|
-
span:first-child {
|
|
19
|
-
margin-right: 0.375rem;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* This Component is a footer that is used in a Block Card with Flexible UI.
|
|
25
|
-
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
26
|
-
* To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
|
|
27
|
-
*
|
|
28
|
-
* @see CustomBlock
|
|
29
|
-
* @param props are the data required for the block, such as actions to be displayed.
|
|
30
|
-
*/
|
|
31
|
-
const BlockCardFooter = props => {
|
|
32
|
-
const {
|
|
33
|
-
actions,
|
|
34
|
-
size = SmartLinkSize.Medium,
|
|
35
|
-
testId = 'smart-block-card-footer',
|
|
36
|
-
actionGroupAppearance = 'default'
|
|
37
|
-
} = props;
|
|
38
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
|
|
39
|
-
testId: `${testId}-provider`,
|
|
40
|
-
overrideCss: providerStyles
|
|
41
|
-
}), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
42
|
-
testId: "smart-element-group-actions",
|
|
43
|
-
align: SmartLinkAlignment.Right,
|
|
44
|
-
direction: SmartLinkDirection.Horizontal,
|
|
45
|
-
overrideCss: getActionGroupStyles(size),
|
|
46
|
-
width: SmartLinkWidth.Flexible
|
|
47
|
-
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
48
|
-
items: actions,
|
|
49
|
-
appearance: actionGroupAppearance
|
|
50
|
-
})) : null);
|
|
51
|
-
};
|
|
52
|
-
export default BlockCardFooter;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
|
-
import { Provider } from '../../../../FlexibleCard/components/elements';
|
|
6
|
-
import ElementGroup from '../../../../FlexibleCard/components/blocks/element-group';
|
|
7
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
8
|
-
import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
|
|
9
|
-
var getActionGroupStyles = function getActionGroupStyles(size) {
|
|
10
|
-
if (size === SmartLinkSize.XLarge) {
|
|
11
|
-
// The biggest height of the action button exceeds the max line-height
|
|
12
|
-
// of the elements causing the action on the block with x-large size to
|
|
13
|
-
// get cut at the bottom.
|
|
14
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var providerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n span:first-child {\n margin-right: 0.375rem;\n }\n"])));
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* This Component is a footer that is used in a Block Card with Flexible UI.
|
|
21
|
-
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
22
|
-
* To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
|
|
23
|
-
*
|
|
24
|
-
* @see CustomBlock
|
|
25
|
-
* @param props are the data required for the block, such as actions to be displayed.
|
|
26
|
-
*/
|
|
27
|
-
var BlockCardFooter = function BlockCardFooter(props) {
|
|
28
|
-
var actions = props.actions,
|
|
29
|
-
_props$size = props.size,
|
|
30
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
31
|
-
_props$testId = props.testId,
|
|
32
|
-
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId,
|
|
33
|
-
_props$actionGroupApp = props.actionGroupAppearance,
|
|
34
|
-
actionGroupAppearance = _props$actionGroupApp === void 0 ? 'default' : _props$actionGroupApp;
|
|
35
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
|
|
36
|
-
testId: "".concat(testId, "-provider"),
|
|
37
|
-
overrideCss: providerStyles
|
|
38
|
-
}), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
39
|
-
testId: "smart-element-group-actions",
|
|
40
|
-
align: SmartLinkAlignment.Right,
|
|
41
|
-
direction: SmartLinkDirection.Horizontal,
|
|
42
|
-
overrideCss: getActionGroupStyles(size),
|
|
43
|
-
width: SmartLinkWidth.Flexible
|
|
44
|
-
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
45
|
-
items: actions,
|
|
46
|
-
appearance: actionGroupAppearance
|
|
47
|
-
})) : null);
|
|
48
|
-
};
|
|
49
|
-
export default BlockCardFooter;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BlockCardFooterProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* This Component is a footer that is used in a Block Card with Flexible UI.
|
|
5
|
-
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
6
|
-
* To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
|
|
7
|
-
*
|
|
8
|
-
* @see CustomBlock
|
|
9
|
-
* @param props are the data required for the block, such as actions to be displayed.
|
|
10
|
-
*/
|
|
11
|
-
declare const BlockCardFooter: React.FC<BlockCardFooterProps>;
|
|
12
|
-
export default BlockCardFooter;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BlockCardFooterProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* This Component is a footer that is used in a Block Card with Flexible UI.
|
|
5
|
-
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
6
|
-
* To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
|
|
7
|
-
*
|
|
8
|
-
* @see CustomBlock
|
|
9
|
-
* @param props are the data required for the block, such as actions to be displayed.
|
|
10
|
-
*/
|
|
11
|
-
declare const BlockCardFooter: React.FC<BlockCardFooterProps>;
|
|
12
|
-
export default BlockCardFooter;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|