@atlaskit/smart-card 19.0.0 → 19.0.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 +18 -0
- package/dist/cjs/constants.js +4 -4
- package/dist/cjs/messages.js +16 -6
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -2
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +15 -2
- package/dist/cjs/view/CardWithUrl/loader.js +5 -7
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/container/index.js +19 -6
- package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +34 -12
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +2 -2
- package/dist/es2019/constants.js +4 -4
- package/dist/es2019/messages.js +16 -6
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -3
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +8 -2
- package/dist/es2019/view/CardWithUrl/loader.js +5 -7
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/container/index.js +19 -6
- package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +35 -13
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +3 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +2 -2
- package/dist/esm/constants.js +4 -4
- package/dist/esm/messages.js +16 -6
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -3
- package/dist/esm/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +8 -2
- package/dist/esm/view/CardWithUrl/loader.js +5 -7
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/container/index.js +19 -6
- package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +34 -12
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +2 -2
- package/dist/types/constants.d.ts +4 -4
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +43 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +25 -0
- package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +3 -2
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/metadata-block/types.d.ts +22 -2
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +6 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +63 -13
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +68 -2
- package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/container/index.d.ts +5 -1
- package/dist/types/view/FlexibleCard/components/container/layered-link/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +20 -10
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/badge/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/date-time/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +16 -3
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +3 -3
- package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +21 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/elements/types.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/types.d.ts +71 -1
- package/dist/types/view/__mocks__/intersection-observer.d.ts +3 -0
- package/docs-helpers/flexible-ui-action-item.tsx +6 -0
- package/docs-helpers/flexible-ui-actions-prop.tsx +6 -0
- package/docs-helpers/flexible-ui-element-item.tsx +6 -0
- package/docs-helpers/flexible-ui-prop.tsx +6 -0
- package/docs-helpers/flexible-ui.tsx +28 -0
- package/package.json +1 -1
|
@@ -55,12 +55,21 @@ var renderChildren = function renderChildren(children, containerSize, containerT
|
|
|
55
55
|
return React.Children.map(children, function (child) {
|
|
56
56
|
if ( /*#__PURE__*/React.isValidElement(child) && isFlexibleUiBlock(child)) {
|
|
57
57
|
var blockSize = child.props.size;
|
|
58
|
+
var size = blockSize || containerSize;
|
|
59
|
+
|
|
60
|
+
if (isFlexibleUiTitleBlock(child)) {
|
|
61
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
62
|
+
onClick: onClick,
|
|
63
|
+
retry: retry,
|
|
64
|
+
size: size,
|
|
65
|
+
status: status,
|
|
66
|
+
theme: containerTheme
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
size: blockSize || containerSize,
|
|
62
|
-
status: status,
|
|
63
|
-
theme: containerTheme
|
|
71
|
+
size: size,
|
|
72
|
+
status: status
|
|
64
73
|
});
|
|
65
74
|
}
|
|
66
75
|
});
|
|
@@ -94,7 +103,11 @@ var getLayeredLink = function getLayeredLink(testId, context, children) {
|
|
|
94
103
|
});
|
|
95
104
|
};
|
|
96
105
|
/**
|
|
97
|
-
*
|
|
106
|
+
* A container is a hidden component that build the Flexible Smart Link.
|
|
107
|
+
* All of the Flexible UI components are wrapped inside the container.
|
|
108
|
+
* It inherits the ui props from Card component and applies the custom styling
|
|
109
|
+
* accordingly.
|
|
110
|
+
* @internal
|
|
98
111
|
* @see Block
|
|
99
112
|
*/
|
|
100
113
|
|
|
@@ -6,6 +6,11 @@ var _templateObject;
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { jsx, css } from '@emotion/core';
|
|
8
8
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // Stretch the invisible link over the whole of the post.\n // Hide the link\u2019s text.\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow-x: hidden;\n text-indent: 100%;\n white-space: nowrap;\n\n // Needs a heightened specificity to trump other anchor.\n // Stack it under all other links in the post text.\n a&.layered-link {\n position: absolute;\n z-index: 0;\n }\n\n // When hovering over the layered link, any hidden action buttons inside\n // the Container should become visible.\n // As actions resides inside blocks and layered link is expected to be\n // on the same level of blocks. That makes the blocks, e.g. TitleBlock,\n // its sibling. Using general sibling combinator here to apply styling to\n // all the siblings of layered link.\n // The general sibling combinator (~) separates two selectors and matches all\n // iterations of the second element, that are following the first element\n // (though not necessarily immediately), and are children of the same parent\n // element.\n &:hover ~ * {\n .actions-button-group {\n opacity: 1;\n }\n }\n"])));
|
|
9
|
+
/**
|
|
10
|
+
* An anchor component to cover the entire container creating a clickable area.
|
|
11
|
+
* @internal
|
|
12
|
+
* @see `clickableContainer`
|
|
13
|
+
*/
|
|
9
14
|
|
|
10
15
|
var LayeredLink = function LayeredLink(_ref) {
|
|
11
16
|
var target = _ref.target,
|
|
@@ -23,8 +23,8 @@ var getStyles = function getStyles(size) {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
26
|
+
* A base element that displays a group of avatars.
|
|
27
|
+
* @internal
|
|
28
28
|
* @param {AvatarGroupProps} AvatarGroupProps - The props necessary for the AvatarGroup.
|
|
29
29
|
* @see AuthorGroup
|
|
30
30
|
* @see CollaboratorGroup
|
|
@@ -48,8 +48,8 @@ var renderImageIcon = function renderImageIcon(url, testId) {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
51
|
+
* A base element that displays some text with an associated icon.
|
|
52
|
+
* @internal
|
|
53
53
|
* @param {BadgeProps} BadgeProps - The props necessary for the Badge.
|
|
54
54
|
* @see CommentCount
|
|
55
55
|
* @see ViewCount
|
|
@@ -13,12 +13,18 @@ import { selectUnit } from '@formatjs/intl-utils';
|
|
|
13
13
|
import { messages } from '../../../../../messages';
|
|
14
14
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), tokens.text, getTruncateStyles(1));
|
|
15
15
|
var typeToDescriptorMap = {
|
|
16
|
-
created:
|
|
17
|
-
|
|
16
|
+
created: {
|
|
17
|
+
relative: messages.created_on_relative,
|
|
18
|
+
absolute: messages.created_on_absolute
|
|
19
|
+
},
|
|
20
|
+
modified: {
|
|
21
|
+
relative: messages.modified_on_relative,
|
|
22
|
+
absolute: messages.modified_on_absolute
|
|
23
|
+
}
|
|
18
24
|
};
|
|
19
25
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
26
|
+
* A base element that displays an ISO Timestamp in text.
|
|
27
|
+
* @internal
|
|
22
28
|
* @param {DateTimeProps} DateTimeProps - The props necessary for the DateTime element.
|
|
23
29
|
* @see CreatedOn
|
|
24
30
|
* @see ModifiedOn
|
|
@@ -32,25 +38,41 @@ var DateTime = function DateTime(_ref) {
|
|
|
32
38
|
testId = _ref$testId === void 0 ? 'smart-element-date-time' : _ref$testId;
|
|
33
39
|
|
|
34
40
|
var _useIntl = useIntl(),
|
|
35
|
-
formatRelativeTime = _useIntl.formatRelativeTime
|
|
41
|
+
formatRelativeTime = _useIntl.formatRelativeTime,
|
|
42
|
+
formatDate = _useIntl.formatDate;
|
|
36
43
|
|
|
37
44
|
if (!type || !date) {
|
|
38
45
|
return null;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
var isLongerThenWeek = Math.abs(date.getTime() - Date.now()) > 1000 * 60 * 60 * 24 * 7;
|
|
49
|
+
var context;
|
|
50
|
+
var typeVariant;
|
|
51
|
+
|
|
52
|
+
if (isLongerThenWeek) {
|
|
53
|
+
typeVariant = 'absolute';
|
|
54
|
+
context = formatDate(date, {
|
|
55
|
+
month: 'long',
|
|
56
|
+
day: 'numeric',
|
|
57
|
+
year: 'numeric'
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
var _selectUnit = selectUnit(date, Date.now()),
|
|
61
|
+
value = _selectUnit.value,
|
|
62
|
+
unit = _selectUnit.unit;
|
|
63
|
+
|
|
64
|
+
typeVariant = 'relative';
|
|
65
|
+
context = formatRelativeTime(value, unit, {
|
|
66
|
+
numeric: 'auto'
|
|
67
|
+
});
|
|
68
|
+
}
|
|
44
69
|
|
|
45
|
-
var context = formatRelativeTime(value, unit, {
|
|
46
|
-
numeric: 'auto'
|
|
47
|
-
});
|
|
48
70
|
return jsx("span", {
|
|
49
71
|
css: [styles, overrideCss],
|
|
50
72
|
"data-separator": true,
|
|
51
73
|
"data-smart-element-date-time": true,
|
|
52
74
|
"data-testid": testId
|
|
53
|
-
}, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type], {
|
|
75
|
+
}, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type][typeVariant], {
|
|
54
76
|
values: {
|
|
55
77
|
context: context
|
|
56
78
|
}
|
|
@@ -57,8 +57,8 @@ var renderImageIcon = function renderImageIcon(defaultIcon, icon, url, testId) {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
60
|
+
* A base element that displays an Icon or favicon.
|
|
61
|
+
* @internal
|
|
62
62
|
* @param {IconProps} IconProps - The props necessary for the Icon element.
|
|
63
63
|
* @see LinkIcon
|
|
64
64
|
*/
|
|
@@ -5,12 +5,12 @@ import { ElementName } from '../../../../constants';
|
|
|
5
5
|
// createElement and renderElementItems
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
|
|
9
9
|
* @see AvatarGroup
|
|
10
10
|
*/
|
|
11
11
|
export var AuthorGroup = createElement(ElementName.AuthorGroup);
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
|
|
14
14
|
* @see AvatarGroup
|
|
15
15
|
*/
|
|
16
16
|
|
|
@@ -43,9 +43,9 @@ var getMaxLines = function getMaxLines(maxLines) {
|
|
|
43
43
|
return maxLines;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
* @param {LinkProps} LinkProps - The props necessary for the
|
|
46
|
+
* A base element that represent an anchor.
|
|
47
|
+
* @internal
|
|
48
|
+
* @param {LinkProps} LinkProps - The props necessary for the Link element.
|
|
49
49
|
* @see LinkIcon
|
|
50
50
|
*/
|
|
51
51
|
|
|
@@ -8,8 +8,8 @@ import { css, jsx } from '@emotion/core';
|
|
|
8
8
|
import AtlaskitLozenge from '@atlaskit/lozenge';
|
|
9
9
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: inherit;\n"])));
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
11
|
+
* A base element that displays a Lozenge.
|
|
12
|
+
* @internal
|
|
13
13
|
* @param {LozengeProps} LozengeProps - The props necessary for the Lozenge element.
|
|
14
14
|
* @see State
|
|
15
15
|
*/
|
|
@@ -19,8 +19,8 @@ import ImageIcon from '../../common/image-icon';
|
|
|
19
19
|
*/
|
|
20
20
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
22
|
+
* A base element that displays a Media.
|
|
23
|
+
* @internal
|
|
24
24
|
* @param {MediaProps} MediaProps - The props necessary for the Media element.
|
|
25
25
|
* @see Preview
|
|
26
26
|
*/
|
|
@@ -12,8 +12,8 @@ var getStyles = function getStyles(maxLines) {
|
|
|
12
12
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), tokens.text, getTruncateStyles(maxLines));
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
15
|
+
* A base element that displays some Text.
|
|
16
|
+
* @internal
|
|
17
17
|
* @param {TextProps} TextProps - The props necessary for the Text element.
|
|
18
18
|
* @see Title
|
|
19
19
|
*/
|
|
@@ -83,9 +83,6 @@ export declare enum ElementName {
|
|
|
83
83
|
AuthorGroup = "AuthorGroup",
|
|
84
84
|
CollaboratorGroup = "CollaboratorGroup",
|
|
85
85
|
CommentCount = "CommentCount",
|
|
86
|
-
ViewCount = "ViewCount",
|
|
87
|
-
ReactCount = "ReactCount",
|
|
88
|
-
VoteCount = "VoteCount",
|
|
89
86
|
CreatedBy = "CreatedBy",
|
|
90
87
|
CreatedOn = "CreatedOn",
|
|
91
88
|
LinkIcon = "LinkIcon",
|
|
@@ -94,11 +91,14 @@ export declare enum ElementName {
|
|
|
94
91
|
Preview = "Preview",
|
|
95
92
|
Priority = "Priority",
|
|
96
93
|
ProgrammingLanguage = "ProgrammingLanguage",
|
|
94
|
+
Provider = "Provider",
|
|
95
|
+
ReactCount = "ReactCount",
|
|
97
96
|
Snippet = "Snippet",
|
|
98
97
|
State = "State",
|
|
99
98
|
SubscriberCount = "SubscriberCount",
|
|
100
99
|
Title = "Title",
|
|
101
|
-
|
|
100
|
+
ViewCount = "ViewCount",
|
|
101
|
+
VoteCount = "VoteCount"
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Flexible UI action (button)
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageDescriptor } from 'react-intl-next';
|
|
2
|
-
export declare type MessageKey = 'cannot_find_link' | 'click_to_join' | 'connect_link_account' | 'created_by' | '
|
|
2
|
+
export declare type MessageKey = 'cannot_find_link' | 'click_to_join' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'delete' | 'edit' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access' | 'request_denied';
|
|
3
3
|
declare type Messages = {
|
|
4
4
|
[K in MessageKey]: MessageDescriptor;
|
|
5
5
|
};
|
|
@@ -5,8 +5,8 @@ import { SmartLinkSize } from '../../../../../constants';
|
|
|
5
5
|
import { ActionProps } from './types';
|
|
6
6
|
export declare const sizeToSpacing: Record<SmartLinkSize, Spacing>;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
8
|
+
* A base action that can be triggered with an on click.
|
|
9
|
+
* @internal
|
|
10
10
|
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
11
11
|
* @see DeleteAction
|
|
12
12
|
* @see EditAction
|
|
@@ -3,19 +3,62 @@ import { SmartLinkSize } from '../../../../../constants';
|
|
|
3
3
|
import { Appearance } from '@atlaskit/button/types';
|
|
4
4
|
import { ReactChild } from 'react';
|
|
5
5
|
export declare type ActionProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Determines the size of the Action. Corresponds to an Action appearance.
|
|
8
|
+
*/
|
|
6
9
|
size?: SmartLinkSize;
|
|
10
|
+
/**
|
|
11
|
+
* Determines the text content of the Action.
|
|
12
|
+
*/
|
|
7
13
|
content?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Determines the appearance of the action. Corresponds to the Atlaskit action appearance.
|
|
16
|
+
*/
|
|
8
17
|
appearance?: Appearance;
|
|
18
|
+
/**
|
|
19
|
+
* Determines the onClick behaviour of the Action.
|
|
20
|
+
*/
|
|
9
21
|
onClick: () => any;
|
|
22
|
+
/**
|
|
23
|
+
* Determines the icon rendered within the Action.
|
|
24
|
+
*/
|
|
10
25
|
icon?: ReactChild;
|
|
26
|
+
/**
|
|
27
|
+
* Determines where the icon should be rendered if text is provided.
|
|
28
|
+
*/
|
|
11
29
|
iconPosition?: 'before' | 'after';
|
|
30
|
+
/**
|
|
31
|
+
* Determines the tooltip message when hovering over the Action.
|
|
32
|
+
*/
|
|
12
33
|
tooltipMessage?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Used to determine whether the Action is in a Dropdown.
|
|
36
|
+
*/
|
|
13
37
|
asDropDownItem?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Additional CSS properties on the Action.
|
|
40
|
+
*/
|
|
14
41
|
overrideCss?: SerializedStyles;
|
|
42
|
+
/**
|
|
43
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
44
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
45
|
+
* serving as a hook for automated tests
|
|
46
|
+
*/
|
|
15
47
|
testId?: string;
|
|
16
48
|
};
|
|
17
49
|
export declare type ActionIconProps = {
|
|
50
|
+
/**
|
|
51
|
+
* Determines the size of the Icon within the Action.
|
|
52
|
+
*/
|
|
18
53
|
size?: SmartLinkSize;
|
|
54
|
+
/**
|
|
55
|
+
* Determines the icon within the Action.
|
|
56
|
+
*/
|
|
19
57
|
icon?: ReactChild;
|
|
58
|
+
/**
|
|
59
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
60
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
61
|
+
* serving as a hook for automated tests
|
|
62
|
+
*/
|
|
20
63
|
testId?: string;
|
|
21
64
|
};
|
|
@@ -2,11 +2,36 @@ import { SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
|
2
2
|
import { ActionItem } from '../types';
|
|
3
3
|
import { Appearance } from '@atlaskit/button';
|
|
4
4
|
export declare type ActionGroupProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Determines the actions within the Action Group.
|
|
7
|
+
*/
|
|
5
8
|
items: ActionItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Determines the default size of the actions within the Action Group.
|
|
11
|
+
*/
|
|
6
12
|
size?: SmartLinkSize;
|
|
13
|
+
/**
|
|
14
|
+
* Determines the direction that the actions are rendered. Can be vertical
|
|
15
|
+
* or horizontal.
|
|
16
|
+
*/
|
|
7
17
|
direction?: SmartLinkDirection;
|
|
18
|
+
/**
|
|
19
|
+
* Determines the default appearance of the Action Group.
|
|
20
|
+
*/
|
|
8
21
|
appearance?: Appearance;
|
|
22
|
+
/**
|
|
23
|
+
* Determines the maximum number of singular actions that should be rendered
|
|
24
|
+
* before collapsing all actions into a Dropdown.
|
|
25
|
+
*/
|
|
9
26
|
visibleButtonsNum?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Callback used by the dropdown. Is called when the dropdown is opened.
|
|
29
|
+
*/
|
|
10
30
|
onDropdownOpenChange?: (isOpen: boolean) => void;
|
|
31
|
+
/**
|
|
32
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
33
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
34
|
+
* serving as a hook for automated tests
|
|
35
|
+
*/
|
|
11
36
|
testId?: string;
|
|
12
37
|
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { BlockProps } from '../types';
|
|
4
4
|
/**
|
|
5
|
-
* A block represents a collection of elements and actions that are arranged
|
|
6
|
-
* All elements and actions should be contained within a Block.
|
|
5
|
+
* A block represents a collection of elements and actions that are arranged
|
|
6
|
+
* in a row. All elements and actions should be contained within a Block.
|
|
7
|
+
* @internal
|
|
7
8
|
* @param {ActionGroupProps} ActionGroupProps
|
|
8
9
|
* @see Action
|
|
9
10
|
*/
|
|
@@ -7,6 +7,7 @@ export declare const getElementGroupStyles: (direction: SmartLinkDirection, size
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
9
9
|
* preferences.
|
|
10
|
+
* @internal
|
|
10
11
|
* @param {ActionGroupProps} ActionGroupProps
|
|
11
12
|
* @see Action
|
|
12
13
|
*/
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { ActionItem, BlockProps } from '../types';
|
|
2
|
-
export declare type FooterBlockProps =
|
|
2
|
+
export declare type FooterBlockProps = {
|
|
3
|
+
/**
|
|
4
|
+
* An array of actions to be displayed on the right.
|
|
5
|
+
* Adding more than three actions will result in the second and following
|
|
6
|
+
* actions being hidden inside of a dropdown
|
|
7
|
+
* @see ActionItem
|
|
8
|
+
*/
|
|
3
9
|
actions?: ActionItem[];
|
|
4
|
-
};
|
|
10
|
+
} & BlockProps;
|
|
@@ -3,6 +3,7 @@ import { MetadataBlockProps } from './types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
5
5
|
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
6
|
+
* @public
|
|
6
7
|
* @param {MetadataBlockProps} MetadataBlockProps
|
|
7
8
|
* @see Block
|
|
8
9
|
*/
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { BlockProps, ElementItem } from '../types';
|
|
2
|
-
export declare type MetadataBlockProps =
|
|
2
|
+
export declare type MetadataBlockProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Determines the number of lines the metadata should span across.
|
|
5
|
+
* Default is 2. Maximum is 2.
|
|
6
|
+
*/
|
|
3
7
|
maxLines?: number;
|
|
8
|
+
/**
|
|
9
|
+
* An array of metadata elements to display on the left.
|
|
10
|
+
* By default elements will be shown to the right of the TitleBlock.
|
|
11
|
+
* The visibility of the element is determine by the link data.
|
|
12
|
+
* If link contain no data to display a particular element, the element
|
|
13
|
+
* will simply not show up.
|
|
14
|
+
* @see ElementItem
|
|
15
|
+
*/
|
|
4
16
|
primary?: ElementItem[];
|
|
17
|
+
/**
|
|
18
|
+
* An array of metadata elements to display on the right.
|
|
19
|
+
* By default elements will be shown to the right of the TitleBlock.
|
|
20
|
+
* The visibility of the element is determine by the link data.
|
|
21
|
+
* If link contain no data to display a particular element, the element
|
|
22
|
+
* will simply not show up.
|
|
23
|
+
* @see ElementItem
|
|
24
|
+
*/
|
|
5
25
|
secondary?: ElementItem[];
|
|
6
|
-
};
|
|
26
|
+
} & BlockProps;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BlockProps } from '../types';
|
|
2
|
-
export declare type SnippetBlockProps =
|
|
2
|
+
export declare type SnippetBlockProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Determines the maximum lines the text within the snippet block should
|
|
5
|
+
* spread over. Default is 3. Maximum is 3.
|
|
6
|
+
*/
|
|
3
7
|
maxLines?: number;
|
|
4
|
-
};
|
|
8
|
+
} & BlockProps;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TitleBlockProps } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Represents a TitleBlock, which is the foundation of
|
|
4
|
+
* Represents a TitleBlock, which is the foundation of Flexible UI.
|
|
5
5
|
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
6
6
|
* The TitleBlock will also render differently given the state of the smart link.
|
|
7
7
|
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
8
|
+
* @public
|
|
8
9
|
* @param {TitleBlockProps} TitleBlockProps
|
|
9
10
|
* @see Block
|
|
10
11
|
* @see TitleBlockResolvingView
|
|
@@ -1,26 +1,76 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BlockProps, ElementItem
|
|
2
|
+
import { ActionItem, BlockProps, ElementItem } from '../types';
|
|
3
3
|
import { SmartLinkPosition, SmartLinkTheme } from '../../../../../constants';
|
|
4
4
|
import { RetryOptions } from '../../../types';
|
|
5
|
-
import {
|
|
6
|
-
export declare type TitleBlockProps =
|
|
5
|
+
import { AnchorTarget } from '../../types';
|
|
6
|
+
export declare type TitleBlockProps = {
|
|
7
|
+
/**
|
|
8
|
+
* An array of action items to be displayed after the title
|
|
9
|
+
* on the right of the block.
|
|
10
|
+
* An action item provides preset icon and label, with exception of
|
|
11
|
+
* a custom action which either Icon or label must be provided.
|
|
12
|
+
* @see ActionItem
|
|
13
|
+
*/
|
|
14
|
+
actions?: ActionItem[];
|
|
15
|
+
/**
|
|
16
|
+
* Determines the href target behaviour of the Link.
|
|
17
|
+
*/
|
|
18
|
+
anchorTarget?: AnchorTarget;
|
|
19
|
+
/**
|
|
20
|
+
* Determines the maximum number of lines for the underlying link text to
|
|
21
|
+
* spread over. Default is 2. Maximum is 2.
|
|
22
|
+
*/
|
|
7
23
|
maxLines?: number;
|
|
24
|
+
/**
|
|
25
|
+
* An array of metadata elements to display in the TitleBlock.
|
|
26
|
+
* By default elements will be shown to the right of the TitleBlock.
|
|
27
|
+
* The visibility of the element is determine by the link data.
|
|
28
|
+
* If link contain no data to display a particular element, the element
|
|
29
|
+
* will simply not show up.
|
|
30
|
+
* @see ElementItem
|
|
31
|
+
*/
|
|
8
32
|
metadata?: ElementItem[];
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
33
|
+
/**
|
|
34
|
+
* Determines the position of the link icon in relative to the vertical
|
|
35
|
+
* height of the TitleBlock. It can either be centred or placed on “top”.
|
|
36
|
+
* Default is top.
|
|
13
37
|
*/
|
|
14
38
|
position?: SmartLinkPosition;
|
|
39
|
+
/**
|
|
40
|
+
* Determines the onClick behaviour of the Link. By default used for analytics.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
44
|
+
/**
|
|
45
|
+
* The options that determine the retry behaviour when a Smart Link errors.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
15
48
|
retry?: RetryOptions;
|
|
49
|
+
/**
|
|
50
|
+
* Determines whether TitleBlock will hide actions until the user is hovering
|
|
51
|
+
* over the link.
|
|
52
|
+
*/
|
|
53
|
+
showActionOnHover?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* An array of metadata elements to display in the TitleBlock.
|
|
56
|
+
* By default elements will be shown below the link text.
|
|
57
|
+
* The visibility of the element is determine by the link data.
|
|
58
|
+
* If link contain no data to display a particular element, the element
|
|
59
|
+
* will simply not show up.
|
|
60
|
+
* @see ElementItem
|
|
61
|
+
*/
|
|
16
62
|
subtitle?: ElementItem[];
|
|
17
|
-
|
|
18
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The text to display in the link. Overrides any text that is retrieved from
|
|
65
|
+
* the Smart Link.
|
|
66
|
+
*/
|
|
19
67
|
text?: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The theme of the link text. Can be Black or Link (default URL blue)
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
theme?: SmartLinkTheme;
|
|
73
|
+
} & BlockProps;
|
|
24
74
|
export declare type TitleBlockViewProps = TitleBlockProps & {
|
|
25
75
|
actionGroup?: React.ReactNode;
|
|
26
76
|
title: React.ReactNode;
|