@atlaskit/smart-card 18.0.14 → 18.0.17
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 +27 -0
- package/dist/cjs/extractors/common/context/extractProvider.js +14 -4
- package/dist/cjs/extractors/common/detail/extractCommentCount.js +3 -1
- package/dist/cjs/extractors/common/detail/extractProgrammingLanguage.js +3 -1
- package/dist/cjs/extractors/common/detail/extractSubscriberCount.js +3 -1
- package/dist/cjs/extractors/common/primitives/extractTitleTextColor.js +3 -1
- package/dist/cjs/state/actions/index.js +1 -1
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +9 -0
- package/dist/cjs/state/flexible-ui-context/index.js +4 -0
- package/dist/cjs/utils/analytics/analytics.js +52 -2
- package/dist/cjs/utils/analytics/index.js +18 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/components/Frame.js +10 -7
- package/dist/cjs/view/BlockCard/components/Link.js +3 -1
- package/dist/cjs/view/BlockCard/components/Provider.js +3 -1
- package/dist/cjs/view/BlockCard/views/ErroredView.js +3 -1
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +3 -1
- package/dist/cjs/view/BlockCard/views/NotFoundView.js +3 -1
- package/dist/cjs/view/BlockCard/views/ResolvingView.js +4 -2
- package/dist/cjs/view/CardWithUrl/component.js +4 -2
- package/dist/cjs/view/CardWithUrl/loader.js +4 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +15 -13
- package/dist/cjs/view/EmbedCard/views/ErroredView.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +26 -4
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +39 -19
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +92 -17
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +45 -9
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -12
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -2
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +7 -3
- package/dist/cjs/view/FlexibleCard/index.js +6 -0
- package/dist/cjs/view/HoverCard/index.js +48 -10
- package/dist/cjs/view/HoverCard/styled.js +3 -1
- package/dist/cjs/view/InlineCard/ErroredView/index.js +3 -1
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +4 -2
- package/dist/cjs/view/InlineCard/Frame/styled.js +16 -13
- package/dist/cjs/view/InlineCard/Icon.js +3 -1
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +4 -2
- package/dist/cjs/view/InlineCard/styled.js +6 -4
- package/dist/cjs/view/common/Byline.js +3 -1
- package/dist/cjs/view/common/Metadata.js +3 -1
- package/dist/cjs/view/common/ModalHeader.js +4 -2
- package/dist/es2019/extractors/common/context/extractProvider.js +13 -4
- package/dist/es2019/extractors/common/detail/extractCommentCount.js +2 -1
- package/dist/es2019/extractors/common/detail/extractProgrammingLanguage.js +2 -1
- package/dist/es2019/extractors/common/detail/extractSubscriberCount.js +2 -1
- package/dist/es2019/extractors/common/primitives/extractTitleTextColor.js +2 -1
- package/dist/es2019/state/actions/index.js +1 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -2
- package/dist/es2019/state/flexible-ui-context/index.js +5 -0
- package/dist/es2019/utils/analytics/analytics.js +35 -0
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/components/Frame.js +9 -7
- package/dist/es2019/view/BlockCard/components/Link.js +2 -1
- package/dist/es2019/view/BlockCard/components/Provider.js +2 -1
- package/dist/es2019/view/BlockCard/views/ErroredView.js +2 -1
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +2 -1
- package/dist/es2019/view/BlockCard/views/NotFoundView.js +2 -1
- package/dist/es2019/view/BlockCard/views/ResolvingView.js +3 -2
- package/dist/es2019/view/CardWithUrl/component.js +4 -2
- package/dist/es2019/view/CardWithUrl/loader.js +4 -2
- package/dist/es2019/view/EmbedCard/components/styled.js +15 -15
- package/dist/es2019/view/EmbedCard/views/ErroredView.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +37 -4
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +31 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +77 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +35 -8
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -11
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -3
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +7 -6
- package/dist/es2019/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +8 -1
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +11 -4
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +5 -2
- package/dist/es2019/view/FlexibleCard/index.js +6 -0
- package/dist/es2019/view/HoverCard/index.js +40 -10
- package/dist/es2019/view/HoverCard/styled.js +6 -1
- package/dist/es2019/view/InlineCard/ErroredView/index.js +2 -1
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +3 -2
- package/dist/es2019/view/InlineCard/Frame/styled.js +15 -12
- package/dist/es2019/view/InlineCard/Icon.js +7 -6
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +3 -2
- package/dist/es2019/view/InlineCard/styled.js +5 -4
- package/dist/es2019/view/common/Byline.js +2 -1
- package/dist/es2019/view/common/Metadata.js +2 -1
- package/dist/es2019/view/common/ModalHeader.js +3 -2
- package/dist/esm/extractors/common/context/extractProvider.js +13 -4
- package/dist/esm/extractors/common/detail/extractCommentCount.js +2 -1
- package/dist/esm/extractors/common/detail/extractProgrammingLanguage.js +2 -1
- package/dist/esm/extractors/common/detail/extractSubscriberCount.js +2 -1
- package/dist/esm/extractors/common/primitives/extractTitleTextColor.js +2 -1
- package/dist/esm/state/actions/index.js +1 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +10 -1
- package/dist/esm/state/flexible-ui-context/index.js +5 -0
- package/dist/esm/utils/analytics/analytics.js +41 -0
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/components/Frame.js +9 -7
- package/dist/esm/view/BlockCard/components/Link.js +2 -1
- package/dist/esm/view/BlockCard/components/Provider.js +2 -1
- package/dist/esm/view/BlockCard/views/ErroredView.js +2 -1
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +2 -1
- package/dist/esm/view/BlockCard/views/NotFoundView.js +2 -1
- package/dist/esm/view/BlockCard/views/ResolvingView.js +3 -2
- package/dist/esm/view/CardWithUrl/component.js +4 -2
- package/dist/esm/view/CardWithUrl/loader.js +4 -2
- package/dist/esm/view/EmbedCard/components/styled.js +14 -13
- package/dist/esm/view/EmbedCard/views/ErroredView.js +2 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +25 -4
- package/dist/esm/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +33 -16
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +79 -17
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +39 -8
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +22 -11
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +8 -3
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +5 -3
- package/dist/esm/view/FlexibleCard/index.js +6 -0
- package/dist/esm/view/HoverCard/index.js +42 -10
- package/dist/esm/view/HoverCard/styled.js +2 -1
- package/dist/esm/view/InlineCard/ErroredView/index.js +2 -1
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +3 -2
- package/dist/esm/view/InlineCard/Frame/styled.js +16 -13
- package/dist/esm/view/InlineCard/Icon.js +2 -1
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +3 -2
- package/dist/esm/view/InlineCard/styled.js +5 -4
- package/dist/esm/view/common/Byline.js +2 -1
- package/dist/esm/view/common/Metadata.js +2 -1
- package/dist/esm/view/common/ModalHeader.js +3 -2
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/index.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +102 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
- package/dist/types/utils/analytics/analytics.d.ts +4 -0
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -2
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +9 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +7 -3
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -5
- package/dist/types/view/FlexibleCard/components/container/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +13 -0
- package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +5 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +77 -0
- package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/elements/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/index.d.ts +6 -0
- package/dist/types/view/HoverCard/index.d.ts +3 -2
- package/dist/types/view/HoverCard/types.d.ts +5 -2
- package/package.json +7 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/utils.js +0 -105
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/utils.js +0 -71
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/utils.js +0 -76
- package/dist/types/view/FlexibleCard/components/blocks/title-block/utils.d.ts +0 -11
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SnippetBlockProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
|
|
5
|
+
* @param {SnippetBlock} SnippetBlock
|
|
6
|
+
* @see Block
|
|
7
|
+
*/
|
|
3
8
|
declare const SnippetBlock: React.FC<SnippetBlockProps>;
|
|
4
9
|
export default SnippetBlock;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { TitleBlockViewProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Represents an Errored TitleBlock view.
|
|
6
|
+
* This will render when a Smart Link did not successfully resolve.
|
|
7
|
+
* This may be a result of a Smart Link not having the correct credentials,
|
|
8
|
+
* or the backend response was errored or malformed.
|
|
9
|
+
* @see TitleBlock
|
|
10
|
+
*/
|
|
11
|
+
declare const TitleBlockErroredView: React.FC<TitleBlockViewProps>;
|
|
5
12
|
export default TitleBlockErroredView;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TitleBlockProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
|
|
5
|
+
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
6
|
+
* The TitleBlock will also render differently given the state of the smart link.
|
|
7
|
+
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
8
|
+
* @param {TitleBlockProps} TitleBlockProps
|
|
9
|
+
* @see Block
|
|
10
|
+
* @see TitleBlockResolvingView
|
|
11
|
+
* @see TitleBlockResolvedView
|
|
12
|
+
* @see TitleBlockErroredView
|
|
13
|
+
*/
|
|
3
14
|
declare const TitleBlock: React.FC<TitleBlockProps>;
|
|
4
15
|
export default TitleBlock;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { TitleBlockViewProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* This renders a fully resolved TitleBlock.
|
|
5
|
+
* This should render when a Smart Link returns a valid response.
|
|
6
|
+
* @see TitleBlock
|
|
7
|
+
*/
|
|
8
|
+
declare const TitleBlockResolvedView: React.FC<TitleBlockViewProps>;
|
|
5
9
|
export default TitleBlockResolvedView;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { TitleBlockViewProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* This represents a TitleBlock for a Smart Link that is currently waiting
|
|
6
|
+
* for a request to finish.
|
|
7
|
+
* This should render when a Smart Link has sent a request.
|
|
8
|
+
* @see TitleBlock
|
|
9
|
+
*/
|
|
10
|
+
declare const TitleBlockResolvingView: React.FC<TitleBlockViewProps>;
|
|
5
11
|
export default TitleBlockResolvingView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BlockProps, ElementItem, ActionItem } from '../types';
|
|
3
3
|
import { SmartLinkPosition, SmartLinkTheme } from '../../../../../constants';
|
|
4
4
|
import { RetryOptions } from '../../../types';
|
|
@@ -6,6 +6,11 @@ import { LinkProps } from '../../elements/link/types';
|
|
|
6
6
|
export declare type TitleBlockProps = BlockProps & {
|
|
7
7
|
maxLines?: number;
|
|
8
8
|
metadata?: ElementItem[];
|
|
9
|
+
/** Determines the position of the icon in the TitleBlock.
|
|
10
|
+
* Top: Icon will be rendered in the "top" left of the TitleBlock
|
|
11
|
+
* Center: Icon will be rendered "center" relative to the vertical height of the TitleBlock.
|
|
12
|
+
* If direction is Horizontal, icon will be rendered in the center relative to the horizontal width of the TitleBlock.
|
|
13
|
+
*/
|
|
9
14
|
position?: SmartLinkPosition;
|
|
10
15
|
retry?: RetryOptions;
|
|
11
16
|
subtitle?: ElementItem[];
|
|
@@ -16,3 +21,7 @@ export declare type TitleBlockProps = BlockProps & {
|
|
|
16
21
|
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
17
22
|
anchorTarget?: LinkProps['target'];
|
|
18
23
|
};
|
|
24
|
+
export declare type TitleBlockViewProps = TitleBlockProps & {
|
|
25
|
+
actionGroup?: React.ReactNode;
|
|
26
|
+
title: React.ReactNode;
|
|
27
|
+
};
|
|
@@ -3,10 +3,10 @@ import { SerializedStyles } from '@emotion/core';
|
|
|
3
3
|
import { ActionProps } from '../actions/action/types';
|
|
4
4
|
export declare type BlockProps = {
|
|
5
5
|
direction?: SmartLinkDirection;
|
|
6
|
+
overrideCss?: SerializedStyles;
|
|
6
7
|
size?: SmartLinkSize;
|
|
7
8
|
status?: SmartLinkStatus;
|
|
8
9
|
testId?: string;
|
|
9
|
-
extraCss?: SerializedStyles;
|
|
10
10
|
};
|
|
11
11
|
export declare type ElementItem = {
|
|
12
12
|
name: ElementName;
|
|
@@ -14,20 +14,22 @@ export declare type ElementItem = {
|
|
|
14
14
|
testId?: string;
|
|
15
15
|
};
|
|
16
16
|
export declare type BaseActionItem = {
|
|
17
|
-
testId?: string;
|
|
18
17
|
hideContent?: boolean;
|
|
19
18
|
hideIcon?: boolean;
|
|
20
19
|
onClick: () => any;
|
|
20
|
+
overrideCss?: SerializedStyles;
|
|
21
|
+
size?: SmartLinkSize;
|
|
22
|
+
testId?: string;
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* This represents an action where Icon and Content are provided implicitly.
|
|
26
|
+
* @example DeleteAction - by default will contain a cross icon with the 'delete' content if content and icon are not provided.
|
|
24
27
|
*/
|
|
25
28
|
export declare type NamedActionItem = BaseActionItem & {
|
|
26
29
|
name: Exclude<ActionName, ActionName.CustomAction>;
|
|
27
30
|
};
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
* either `icon` and `iconPosition` OR `content` OR both BUT not neither of those things.
|
|
32
|
+
* This represents an action where either Icon or label must be provided.
|
|
31
33
|
*/
|
|
32
34
|
export declare type CustomActionItem = BaseActionItem & {
|
|
33
35
|
name: ActionName.CustomAction;
|
|
@@ -4,5 +4,9 @@ import { SerializedStyles } from '@emotion/core';
|
|
|
4
4
|
import { SmartLinkSize } from '../../../../constants';
|
|
5
5
|
import { ContainerProps } from './types';
|
|
6
6
|
export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: boolean, hideElevation: boolean, hidePadding: boolean) => SerializedStyles;
|
|
7
|
+
/**
|
|
8
|
+
* This represents the container in which all Flexible UI Smart Links are rendered.
|
|
9
|
+
* @see Block
|
|
10
|
+
*/
|
|
7
11
|
declare const Container: React.FC<ContainerProps>;
|
|
8
12
|
export default Container;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { SmartLinkSize, SmartLinkStatus, SmartLinkTheme } from '../../../../constants';
|
|
3
3
|
import { RetryOptions } from '../../types';
|
|
4
4
|
export declare type ContainerProps = {
|
|
5
|
-
hideBackground?: boolean;
|
|
6
5
|
hideElevation?: boolean;
|
|
7
6
|
hidePadding?: boolean;
|
|
7
|
+
hideBackground?: boolean;
|
|
8
8
|
retry?: RetryOptions;
|
|
9
9
|
size?: SmartLinkSize;
|
|
10
10
|
status?: SmartLinkStatus;
|
|
11
|
-
testId?: string;
|
|
12
11
|
theme?: SmartLinkTheme;
|
|
13
12
|
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
13
|
+
testId?: string;
|
|
14
14
|
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AvatarGroupProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays a group of avatars.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {AvatarGroupProps} AvatarGroupProps - The props necessary for the AvatarGroup.
|
|
8
|
+
* @see AuthorGroup
|
|
9
|
+
* @see CollaboratorGroup
|
|
10
|
+
*/
|
|
4
11
|
declare const AvatarGroup: React.FC<AvatarGroupProps>;
|
|
5
12
|
export default AvatarGroup;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { BadgeProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays some text with an associated icon.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {BadgeProps} BadgeProps - The props necessary for the Badge.
|
|
8
|
+
* @see CommentCount
|
|
9
|
+
* @see ViewCount
|
|
10
|
+
* @see ReactCount
|
|
11
|
+
* @see VoteCount
|
|
12
|
+
* @see SubscriberCount
|
|
13
|
+
* @see Priority
|
|
14
|
+
* @see ProgrammingLanguage
|
|
15
|
+
* @see Provider
|
|
16
|
+
*/
|
|
4
17
|
declare const Badge: React.FC<BadgeProps>;
|
|
5
18
|
export default Badge;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { DateTimeProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays an ISO Timestamp in text.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {DateTimeProps} DateTimeProps - The props necessary for the DateTime element.
|
|
8
|
+
* @see CreatedOn
|
|
9
|
+
* @see ModifiedOn
|
|
10
|
+
*/
|
|
4
11
|
declare const DateTime: React.FC<DateTimeProps>;
|
|
5
12
|
export default DateTime;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IconProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays an Icon or favicon.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {IconProps} IconProps - The props necessary for the Icon element.
|
|
8
|
+
* @see LinkIcon
|
|
9
|
+
*/
|
|
4
10
|
declare const Icon: React.FC<IconProps>;
|
|
5
11
|
export default Icon;
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import { ElementProps } from '../types';
|
|
3
3
|
import { IconType, SmartLinkPosition } from '../../../../../constants';
|
|
4
4
|
export declare type IconProps = ElementProps & {
|
|
5
|
+
render?: () => React.ReactNode;
|
|
5
6
|
icon?: IconType;
|
|
6
7
|
label?: string;
|
|
8
|
+
/** Determines how the icon should be rendered.
|
|
9
|
+
* Top: Icon will be rendered at the "top" of the smart link.
|
|
10
|
+
* Center: Icon will be rendered at the "center" of the smart link relative to the vertical height.
|
|
11
|
+
*/
|
|
7
12
|
position?: SmartLinkPosition;
|
|
8
|
-
render?: () => React.ReactNode;
|
|
9
13
|
url?: string;
|
|
10
14
|
};
|
|
@@ -7,22 +7,99 @@ import { AvatarGroupProps } from './avatar-group/types';
|
|
|
7
7
|
import { TextProps } from './text/types';
|
|
8
8
|
import { DateTimeProps } from './date-time/types';
|
|
9
9
|
import { MediaProps } from './media/types';
|
|
10
|
+
/**
|
|
11
|
+
* Creates an AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
|
|
12
|
+
* @see AvatarGroup
|
|
13
|
+
*/
|
|
10
14
|
export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates an AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
17
|
+
* @see AvatarGroup
|
|
18
|
+
*/
|
|
11
19
|
export declare const CollaboratorGroup: import("react").FC<AvatarGroupProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a CommentCount Badge element using the data from CommentCount in the Flexible UI Context.
|
|
22
|
+
* @see Badge
|
|
23
|
+
*/
|
|
12
24
|
export declare const CommentCount: import("react").FC<BadgeProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a ViewCount Badge element using the data from ViewCount in the Flexible UI Context.
|
|
27
|
+
* @see Badge
|
|
28
|
+
*/
|
|
13
29
|
export declare const ViewCount: import("react").FC<BadgeProps>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
32
|
+
* @see Badge
|
|
33
|
+
*/
|
|
14
34
|
export declare const ReactCount: import("react").FC<BadgeProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
37
|
+
* @see Badge
|
|
38
|
+
*/
|
|
15
39
|
export declare const VoteCount: import("react").FC<BadgeProps>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a CreatedBy text element using the data from CreatedBy in the Flexible UI Context.
|
|
42
|
+
* @see Text
|
|
43
|
+
*/
|
|
16
44
|
export declare const CreatedBy: import("react").FC<TextProps>;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
47
|
+
* @see DateTime
|
|
48
|
+
*/
|
|
17
49
|
export declare const CreatedOn: import("react").FC<DateTimeProps>;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
|
|
52
|
+
* @see Icon
|
|
53
|
+
*/
|
|
18
54
|
export declare const LinkIcon: import("react").FC<IconProps>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
57
|
+
* @see Text
|
|
58
|
+
*/
|
|
19
59
|
export declare const ModifiedBy: import("react").FC<TextProps>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a ModifiedOn DateTime element using the data from ModifiedOn in the Flexible UI Context.
|
|
62
|
+
* @see DateTime
|
|
63
|
+
*/
|
|
20
64
|
export declare const ModifiedOn: import("react").FC<DateTimeProps>;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a Preview element using the data from Preview in the Flexible UI Context.
|
|
67
|
+
* @see Preview
|
|
68
|
+
*/
|
|
21
69
|
export declare const Preview: import("react").FC<MediaProps>;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a Priority Badge element using the data from Priority in the Flexible UI Context.
|
|
72
|
+
* @see Badge
|
|
73
|
+
*/
|
|
22
74
|
export declare const Priority: import("react").FC<BadgeProps>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a ProgrammingLanguage Badge element using the data from ProgrammingLanguage in the Flexible UI Context.
|
|
77
|
+
* @see Badge
|
|
78
|
+
*/
|
|
23
79
|
export declare const ProgrammingLanguage: import("react").FC<BadgeProps>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a Snippet element using the data from Snippet in the Flexible UI Context.
|
|
82
|
+
* @see Text
|
|
83
|
+
*/
|
|
24
84
|
export declare const Snippet: import("react").FC<TextProps>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a State Lozenge element using the data from State in the Flexible UI Context.
|
|
87
|
+
* @see Lozenge
|
|
88
|
+
*/
|
|
25
89
|
export declare const State: import("react").FC<LozengeProps>;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a SubscriberCount Badge element using the data from SubscriberCount in the Flexible UI Context.
|
|
92
|
+
* @see Badge
|
|
93
|
+
*/
|
|
26
94
|
export declare const SubscriberCount: import("react").FC<BadgeProps>;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a Title Link element using the data from Title in the Flexible UI Context.
|
|
97
|
+
* This represents the main link text within the Smart Link.
|
|
98
|
+
* @see Link
|
|
99
|
+
*/
|
|
27
100
|
export declare const Title: import("react").FC<LinkProps>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a Provider Badge element using the data from Provider in the Flexible UI Context.
|
|
103
|
+
* @see Badge
|
|
104
|
+
*/
|
|
28
105
|
export declare const Provider: import("react").FC<BadgeProps>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { LinkProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that represent.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {LinkProps} LinkProps - The props necessary for the Icon element.
|
|
8
|
+
* @see LinkIcon
|
|
9
|
+
*/
|
|
4
10
|
declare const Link: React.FC<LinkProps>;
|
|
5
11
|
export default Link;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { LozengeProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays a Lozenge.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {LozengeProps} LozengeProps - The props necessary for the Lozenge element.
|
|
8
|
+
* @see State
|
|
9
|
+
*/
|
|
4
10
|
declare const Lozenge: React.FC<LozengeProps>;
|
|
5
11
|
export default Lozenge;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MediaProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays a Media.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {MediaProps} MediaProps - The props necessary for the Media element.
|
|
8
|
+
* @see Preview
|
|
9
|
+
*/
|
|
4
10
|
declare const Media: React.FC<MediaProps>;
|
|
5
11
|
export default Media;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TextProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An element that displays some Text.
|
|
6
|
+
* @public
|
|
7
|
+
* @param {TextProps} TextProps - The props necessary for the Text element.
|
|
8
|
+
* @see Title
|
|
9
|
+
*/
|
|
4
10
|
declare const Text: React.FC<TextProps>;
|
|
5
11
|
export default Text;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlexibleCardProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
5
|
+
* This is the container in which all Flexible UI Blocks and Elements exist.
|
|
6
|
+
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
7
|
+
* @see Container
|
|
8
|
+
*/
|
|
3
9
|
declare const FlexibleCard: React.FC<FlexibleCardProps>;
|
|
4
10
|
export default FlexibleCard;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
2
|
import { HoverCardProps } from './types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const HoverCardComponent: FC<HoverCardProps>;
|
|
4
|
+
export declare const HoverCard: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "analyticsContext" | "key" | "url"> & React.RefAttributes<any>>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
+
export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
2
3
|
url: string;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
5
|
+
export declare type PreviewDisplay = 'card' | 'embed';
|
|
6
|
+
export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.17",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -125,5 +125,10 @@
|
|
|
125
125
|
"./hooks": "./src/hooks.ts",
|
|
126
126
|
".": "./src/index.ts"
|
|
127
127
|
},
|
|
128
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
128
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
129
|
+
"techstack": {
|
|
130
|
+
"@repo/internal": {
|
|
131
|
+
"theming": "tokens"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
129
134
|
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.actionOnHoverOnlyStyle = exports.BaseTitleBlockComponent = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
-
|
|
18
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _core = require("@emotion/core");
|
|
23
|
-
|
|
24
|
-
var _block = _interopRequireDefault(require("../block"));
|
|
25
|
-
|
|
26
|
-
var _elements = require("../../elements");
|
|
27
|
-
|
|
28
|
-
var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
29
|
-
|
|
30
|
-
var _constants = require("../../../../../constants");
|
|
31
|
-
|
|
32
|
-
var _elementGroup = _interopRequireDefault(require("../element-group"));
|
|
33
|
-
|
|
34
|
-
var _utils = require("../utils");
|
|
35
|
-
|
|
36
|
-
var _excluded = ["children", "blockTestIdPostfix", "blockIcon", "testId", "showActionOnHover", "position", "actions", "text", "maxLines", "theme", "onClick", "metadata", "subtitle", "anchorTarget"];
|
|
37
|
-
|
|
38
|
-
var _templateObject;
|
|
39
|
-
|
|
40
|
-
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); }
|
|
41
|
-
|
|
42
|
-
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; }
|
|
43
|
-
|
|
44
|
-
var actionOnHoverOnlyStyle = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .actions-button-group {\n visibility: hidden;\n }\n\n &:hover {\n .actions-button-group {\n visibility: visible;\n }\n }\n"])));
|
|
45
|
-
exports.actionOnHoverOnlyStyle = actionOnHoverOnlyStyle;
|
|
46
|
-
|
|
47
|
-
var BaseTitleBlockComponent = function BaseTitleBlockComponent(_ref) {
|
|
48
|
-
var children = _ref.children,
|
|
49
|
-
blockTestIdPostfix = _ref.blockTestIdPostfix,
|
|
50
|
-
blockIcon = _ref.blockIcon,
|
|
51
|
-
testId = _ref.testId,
|
|
52
|
-
showActionOnHover = _ref.showActionOnHover,
|
|
53
|
-
position = _ref.position,
|
|
54
|
-
_ref$actions = _ref.actions,
|
|
55
|
-
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
56
|
-
text = _ref.text,
|
|
57
|
-
maxLines = _ref.maxLines,
|
|
58
|
-
theme = _ref.theme,
|
|
59
|
-
onClick = _ref.onClick,
|
|
60
|
-
_ref$metadata = _ref.metadata,
|
|
61
|
-
metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
|
|
62
|
-
_ref$subtitle = _ref.subtitle,
|
|
63
|
-
subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
|
|
64
|
-
anchorTarget = _ref.anchorTarget,
|
|
65
|
-
blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
66
|
-
|
|
67
|
-
var _useState = (0, _react.useState)(false),
|
|
68
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
69
|
-
actionDropdownOpen = _useState2[0],
|
|
70
|
-
setActionDropdownOpen = _useState2[1];
|
|
71
|
-
|
|
72
|
-
var extraCss = showActionOnHover && !actionDropdownOpen ? actionOnHoverOnlyStyle : undefined;
|
|
73
|
-
var overrideText = !!text ? {
|
|
74
|
-
text: text
|
|
75
|
-
} : {};
|
|
76
|
-
var metadataElements = (0, _utils.renderElementItems)(metadata);
|
|
77
|
-
var subtitleElements = (0, _utils.renderElementItems)(subtitle);
|
|
78
|
-
return (0, _core.jsx)(_block.default, (0, _extends2.default)({}, blockProps, {
|
|
79
|
-
testId: "".concat(testId, "-").concat(blockTestIdPostfix),
|
|
80
|
-
extraCss: extraCss
|
|
81
|
-
}), blockIcon || (0, _core.jsx)(_elements.LinkIcon, {
|
|
82
|
-
position: position
|
|
83
|
-
}), (0, _core.jsx)(_elementGroup.default, {
|
|
84
|
-
direction: _constants.SmartLinkDirection.Vertical,
|
|
85
|
-
width: _constants.SmartLinkWidth.Flexible
|
|
86
|
-
}, (0, _core.jsx)(_elements.Title, (0, _extends2.default)({
|
|
87
|
-
maxLines: maxLines,
|
|
88
|
-
theme: theme,
|
|
89
|
-
target: anchorTarget,
|
|
90
|
-
onClick: onClick
|
|
91
|
-
}, overrideText)), subtitleElements && (0, _core.jsx)(_elementGroup.default, {
|
|
92
|
-
direction: _constants.SmartLinkDirection.Horizontal
|
|
93
|
-
}, subtitleElements)), metadataElements && (0, _core.jsx)(_elementGroup.default, {
|
|
94
|
-
direction: _constants.SmartLinkDirection.Horizontal,
|
|
95
|
-
align: _constants.SmartLinkAlignment.Right
|
|
96
|
-
}, metadataElements), children, actions.length > 0 && (0, _core.jsx)(_actionGroup.default, {
|
|
97
|
-
items: actions,
|
|
98
|
-
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
99
|
-
onDropdownOpenChange: function onDropdownOpenChange(isOpen) {
|
|
100
|
-
return setActionDropdownOpen(isOpen);
|
|
101
|
-
}
|
|
102
|
-
}));
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
exports.BaseTitleBlockComponent = BaseTitleBlockComponent;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
/** @jsx jsx */
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
6
|
-
import { css } from '@emotion/core';
|
|
7
|
-
import Block from '../block';
|
|
8
|
-
import { LinkIcon, Title } from '../../elements';
|
|
9
|
-
import ActionGroup from '../action-group';
|
|
10
|
-
import { SmartLinkAlignment, SmartLinkWidth, SmartLinkDirection } from '../../../../../constants';
|
|
11
|
-
import ElementGroup from '../element-group';
|
|
12
|
-
import { renderElementItems } from '../utils';
|
|
13
|
-
export const actionOnHoverOnlyStyle = css`
|
|
14
|
-
.actions-button-group {
|
|
15
|
-
visibility: hidden;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
.actions-button-group {
|
|
20
|
-
visibility: visible;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
export const BaseTitleBlockComponent = ({
|
|
25
|
-
children,
|
|
26
|
-
blockTestIdPostfix,
|
|
27
|
-
blockIcon,
|
|
28
|
-
testId,
|
|
29
|
-
showActionOnHover,
|
|
30
|
-
position,
|
|
31
|
-
actions = [],
|
|
32
|
-
text,
|
|
33
|
-
maxLines,
|
|
34
|
-
theme,
|
|
35
|
-
onClick,
|
|
36
|
-
metadata = [],
|
|
37
|
-
subtitle = [],
|
|
38
|
-
anchorTarget,
|
|
39
|
-
...blockProps
|
|
40
|
-
}) => {
|
|
41
|
-
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
42
|
-
const extraCss = showActionOnHover && !actionDropdownOpen ? actionOnHoverOnlyStyle : undefined;
|
|
43
|
-
const overrideText = !!text ? {
|
|
44
|
-
text
|
|
45
|
-
} : {};
|
|
46
|
-
const metadataElements = renderElementItems(metadata);
|
|
47
|
-
const subtitleElements = renderElementItems(subtitle);
|
|
48
|
-
return jsx(Block, _extends({}, blockProps, {
|
|
49
|
-
testId: `${testId}-${blockTestIdPostfix}`,
|
|
50
|
-
extraCss: extraCss
|
|
51
|
-
}), blockIcon || jsx(LinkIcon, {
|
|
52
|
-
position: position
|
|
53
|
-
}), jsx(ElementGroup, {
|
|
54
|
-
direction: SmartLinkDirection.Vertical,
|
|
55
|
-
width: SmartLinkWidth.Flexible
|
|
56
|
-
}, jsx(Title, _extends({
|
|
57
|
-
maxLines: maxLines,
|
|
58
|
-
theme: theme,
|
|
59
|
-
target: anchorTarget,
|
|
60
|
-
onClick: onClick
|
|
61
|
-
}, overrideText)), subtitleElements && jsx(ElementGroup, {
|
|
62
|
-
direction: SmartLinkDirection.Horizontal
|
|
63
|
-
}, subtitleElements)), metadataElements && jsx(ElementGroup, {
|
|
64
|
-
direction: SmartLinkDirection.Horizontal,
|
|
65
|
-
align: SmartLinkAlignment.Right
|
|
66
|
-
}, metadataElements), children, actions.length > 0 && jsx(ActionGroup, {
|
|
67
|
-
items: actions,
|
|
68
|
-
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
69
|
-
onDropdownOpenChange: isOpen => setActionDropdownOpen(isOpen)
|
|
70
|
-
}));
|
|
71
|
-
};
|