@atlaskit/smart-card 17.4.2 → 17.5.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 +18 -0
- package/dist/cjs/constants.js +14 -2
- package/dist/cjs/extractors/flexible/extract-preview.js +21 -0
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/utils/token.js +14 -24
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +18 -7
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +50 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +24 -4
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +45 -0
- package/dist/cjs/view/FlexibleCard/components/elements/media/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +4 -0
- package/dist/es2019/constants.js +11 -1
- package/dist/es2019/extractors/flexible/extract-preview.js +12 -0
- package/dist/es2019/extractors/flexible/index.js +2 -0
- package/dist/es2019/utils/token.js +14 -22
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +34 -6
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +5 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +35 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +20 -5
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +35 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +4 -0
- package/dist/esm/constants.js +11 -1
- package/dist/esm/extractors/flexible/extract-preview.js +12 -0
- package/dist/esm/extractors/flexible/index.js +2 -0
- package/dist/esm/utils/token.js +14 -22
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +17 -7
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +9 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +34 -0
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +25 -6
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +34 -0
- package/dist/esm/view/FlexibleCard/components/elements/media/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +3 -0
- package/dist/types/constants.d.ts +7 -0
- package/dist/types/extractors/flexible/extract-preview.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +6 -1
- package/dist/types/utils/token.d.ts +13 -14
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export var CreatedOn = createElement(ElementName.CreatedOn);
|
|
|
11
11
|
export var LinkIcon = createElement(ElementName.LinkIcon);
|
|
12
12
|
export var ModifiedBy = createElement(ElementName.ModifiedBy);
|
|
13
13
|
export var ModifiedOn = createElement(ElementName.ModifiedOn);
|
|
14
|
+
export var Preview = createElement(ElementName.Preview);
|
|
14
15
|
export var Priority = createElement(ElementName.Priority);
|
|
15
16
|
export var ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
16
17
|
export var Snippet = createElement(ElementName.Snippet);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import ImageIcon from '../../common/image-icon';
|
|
9
|
+
|
|
10
|
+
var styles = function styles(url) {
|
|
11
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n width: 100%;\n > img {\n max-width: 100%;\n max-height: 100%;\n }\n"])));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var Media = function Media(_ref) {
|
|
15
|
+
var _ref$testId = _ref.testId,
|
|
16
|
+
testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
|
|
17
|
+
type = _ref.type,
|
|
18
|
+
url = _ref.url;
|
|
19
|
+
|
|
20
|
+
if (!type || !url) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return jsx("div", {
|
|
25
|
+
css: styles(url),
|
|
26
|
+
"data-smart-element-media": true,
|
|
27
|
+
"data-testid": testId
|
|
28
|
+
}, jsx(ImageIcon, {
|
|
29
|
+
testId: "".concat(testId, "-image"),
|
|
30
|
+
url: url
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default Media;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,7 @@ import Lozenge from './lozenge';
|
|
|
11
11
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
12
12
|
import Badge from './badge';
|
|
13
13
|
import AvatarGroup from './avatar-group';
|
|
14
|
+
import Media from './media';
|
|
14
15
|
import Text from './text';
|
|
15
16
|
import { messages } from '../../../../messages';
|
|
16
17
|
import DateTime from './date-time';
|
|
@@ -31,6 +32,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
31
32
|
component: Icon
|
|
32
33
|
}), _defineProperty(_elementMappings, ElementName.ModifiedBy, {
|
|
33
34
|
component: Text
|
|
35
|
+
}), _defineProperty(_elementMappings, ElementName.Preview, {
|
|
36
|
+
component: Media
|
|
34
37
|
}), _defineProperty(_elementMappings, ElementName.Priority, {
|
|
35
38
|
component: Badge
|
|
36
39
|
}), _defineProperty(_elementMappings, ElementName.ProgrammingLanguage, {
|
|
@@ -88,6 +88,7 @@ export declare enum ElementName {
|
|
|
88
88
|
LinkIcon = "LinkIcon",
|
|
89
89
|
ModifiedBy = "ModifiedBy",
|
|
90
90
|
ModifiedOn = "ModifiedOn",
|
|
91
|
+
Preview = "Preview",
|
|
91
92
|
Priority = "Priority",
|
|
92
93
|
ProgrammingLanguage = "ProgrammingLanguage",
|
|
93
94
|
Snippet = "Snippet",
|
|
@@ -164,3 +165,9 @@ export declare enum IconType {
|
|
|
164
165
|
ProgrammingLanguage = "Badge:ProgrammingLanguage",
|
|
165
166
|
Subscriber = "Badge:Subscriber"
|
|
166
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Type for Flexible UI's Media element
|
|
170
|
+
*/
|
|
171
|
+
export declare enum MediaType {
|
|
172
|
+
Image = "image"
|
|
173
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LinkLozenge } from '../../extractors/common/lozenge/types';
|
|
2
2
|
import { LinkPerson } from '../../extractors/common/person/types';
|
|
3
|
-
import { IconType } from '../../constants';
|
|
3
|
+
import { IconType, MediaType } from '../../constants';
|
|
4
4
|
export declare type FlexibleUiDataContext = {
|
|
5
5
|
authorGroup?: LinkPerson[];
|
|
6
6
|
collaboratorGroup?: LinkPerson[];
|
|
@@ -10,6 +10,7 @@ export declare type FlexibleUiDataContext = {
|
|
|
10
10
|
linkIcon?: Icon;
|
|
11
11
|
modifiedBy?: string;
|
|
12
12
|
modifiedOn?: string;
|
|
13
|
+
preview?: Media;
|
|
13
14
|
priority?: Icon;
|
|
14
15
|
programmingLanguage?: string;
|
|
15
16
|
snippet?: string;
|
|
@@ -24,3 +25,7 @@ export declare type Icon = {
|
|
|
24
25
|
label?: string;
|
|
25
26
|
url?: string;
|
|
26
27
|
};
|
|
28
|
+
export declare type Media = {
|
|
29
|
+
type: MediaType;
|
|
30
|
+
url: string;
|
|
31
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
export declare const safeToken: (path: string, fallback?: string | undefined) => any;
|
|
2
1
|
export declare const tokens: {
|
|
3
|
-
actionIcon:
|
|
4
|
-
background:
|
|
5
|
-
badgeIcon:
|
|
6
|
-
badgeText:
|
|
7
|
-
blackLink:
|
|
8
|
-
blackLinkPressed:
|
|
9
|
-
blueLink:
|
|
10
|
-
blueLinkPressed:
|
|
11
|
-
elevation:
|
|
12
|
-
errorMessage:
|
|
13
|
-
errorMessageHover:
|
|
14
|
-
snippet:
|
|
15
|
-
text:
|
|
2
|
+
actionIcon: "var(--ds-icon)";
|
|
3
|
+
background: "var(--ds-surface)";
|
|
4
|
+
badgeIcon: "var(--ds-icon-subtle)";
|
|
5
|
+
badgeText: "var(--ds-text-subtlest)";
|
|
6
|
+
blackLink: "var(--ds-text-subtle)";
|
|
7
|
+
blackLinkPressed: "var(--ds-text)";
|
|
8
|
+
blueLink: "var(--ds-link)";
|
|
9
|
+
blueLinkPressed: "var(--ds-link-pressed)";
|
|
10
|
+
elevation: "var(--ds-shadow-raised)";
|
|
11
|
+
errorMessage: "var(--ds-text-disabled)";
|
|
12
|
+
errorMessageHover: "var(--ds-text-subtle)";
|
|
13
|
+
snippet: "var(--ds-text)";
|
|
14
|
+
text: "var(--ds-text-subtlest)";
|
|
16
15
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
2
2
|
import { ActionItem } from '../types';
|
|
3
|
+
import { Appearance } from '@atlaskit/button';
|
|
3
4
|
export declare type ActionGroupProps = {
|
|
4
5
|
items: ActionItem[];
|
|
5
6
|
size?: SmartLinkSize;
|
|
6
7
|
direction?: SmartLinkDirection;
|
|
7
8
|
testId?: string;
|
|
9
|
+
appearance?: Appearance;
|
|
8
10
|
};
|
|
@@ -8,4 +8,4 @@ export declare const getGapSize: (size: SmartLinkSize) => number;
|
|
|
8
8
|
export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
|
|
9
9
|
export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
|
|
10
10
|
export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
|
|
11
|
-
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize) => React.ReactNode | undefined;
|
|
11
|
+
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: "link" | "default" | "danger" | "primary" | "subtle" | "subtle-link" | "warning" | undefined) => React.ReactNode | undefined;
|
|
@@ -6,6 +6,7 @@ import { LozengeProps } from './lozenge/types';
|
|
|
6
6
|
import { AvatarGroupProps } from './avatar-group/types';
|
|
7
7
|
import { TextProps } from './text/types';
|
|
8
8
|
import { DateTimeProps } from './date-time/types';
|
|
9
|
+
import { MediaProps } from './media/types';
|
|
9
10
|
export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
|
|
10
11
|
export declare const CollaboratorGroup: import("react").FC<AvatarGroupProps>;
|
|
11
12
|
export declare const CommentCount: import("react").FC<BadgeProps>;
|
|
@@ -14,6 +15,7 @@ export declare const CreatedOn: import("react").FC<DateTimeProps>;
|
|
|
14
15
|
export declare const LinkIcon: import("react").FC<IconProps>;
|
|
15
16
|
export declare const ModifiedBy: import("react").FC<TextProps>;
|
|
16
17
|
export declare const ModifiedOn: import("react").FC<DateTimeProps>;
|
|
18
|
+
export declare const Preview: import("react").FC<MediaProps>;
|
|
17
19
|
export declare const Priority: import("react").FC<BadgeProps>;
|
|
18
20
|
export declare const ProgrammingLanguage: import("react").FC<BadgeProps>;
|
|
19
21
|
export declare const Snippet: import("react").FC<TextProps>;
|