@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
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import LazilyRender from 'react-lazily-render';
|
|
4
4
|
import { CardWithUrlContent } from '../component';
|
|
5
5
|
import { LoadingCardLink } from './LazyFallback';
|
|
6
|
+
import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
|
|
6
7
|
export function LazyLazilyRenderCard(props) {
|
|
7
8
|
const {
|
|
8
9
|
appearance,
|
|
9
10
|
container,
|
|
10
|
-
showActions
|
|
11
|
+
showActions,
|
|
12
|
+
id
|
|
11
13
|
} = props;
|
|
12
14
|
const offset = Math.ceil(window.innerHeight / 4);
|
|
15
|
+
useState(() => {
|
|
16
|
+
// Start of experience when intersectionObserver is not supported.
|
|
17
|
+
startUfoExperience('smart-link-rendered', id);
|
|
18
|
+
});
|
|
13
19
|
return /*#__PURE__*/React.createElement(LazilyRender, {
|
|
14
20
|
offset: offset,
|
|
15
21
|
component: appearance === 'inline' ? 'span' : 'div',
|
|
@@ -9,12 +9,7 @@ const LazyCardWithUrlContent = /*#__PURE__*/lazy(() => import(
|
|
|
9
9
|
/* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */
|
|
10
10
|
'./component-lazy/index'));
|
|
11
11
|
export function CardWithURLRenderer(props) {
|
|
12
|
-
const [id] = useState(() => uuid());
|
|
13
|
-
|
|
14
|
-
useState(() => {
|
|
15
|
-
// We want to start timing of render event only once and right at the start
|
|
16
|
-
startUfoExperience('smart-link-rendered', id);
|
|
17
|
-
});
|
|
12
|
+
const [id] = useState(() => uuid());
|
|
18
13
|
useEffect(() => {
|
|
19
14
|
// ComponentWillUnmount
|
|
20
15
|
return () => {
|
|
@@ -68,7 +63,10 @@ export function CardWithURLRenderer(props) {
|
|
|
68
63
|
else {
|
|
69
64
|
const errorInfo = {
|
|
70
65
|
componentStack
|
|
71
|
-
};
|
|
66
|
+
}; // Start and fail the smart-link-rendered experience. If it has already
|
|
67
|
+
// been started nothing happens.
|
|
68
|
+
|
|
69
|
+
startUfoExperience('smart-link-rendered', id);
|
|
72
70
|
failUfoExperience('smart-link-rendered', id);
|
|
73
71
|
failUfoExperience('smart-link-authenticated', id);
|
|
74
72
|
dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
|
|
@@ -84,8 +84,8 @@ export const sizeToSpacing = {
|
|
|
84
84
|
[SmartLinkSize.XLarge]: 'default'
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
87
|
+
* A base action that can be triggered with an on click.
|
|
88
|
+
* @internal
|
|
89
89
|
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
90
90
|
* @see DeleteAction
|
|
91
91
|
* @see EditAction
|
|
@@ -13,8 +13,9 @@ const getBlockStyles = (direction, size) => css`
|
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
15
|
/**
|
|
16
|
-
* A block represents a collection of elements and actions that are arranged
|
|
17
|
-
* All elements and actions should be contained within a Block.
|
|
16
|
+
* A block represents a collection of elements and actions that are arranged
|
|
17
|
+
* in a row. All elements and actions should be contained within a Block.
|
|
18
|
+
* @internal
|
|
18
19
|
* @param {ActionGroupProps} ActionGroupProps
|
|
19
20
|
* @see Action
|
|
20
21
|
*/
|
|
@@ -30,6 +30,7 @@ export const getElementGroupStyles = (direction, size, align, width) => css`
|
|
|
30
30
|
/**
|
|
31
31
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
32
32
|
* preferences.
|
|
33
|
+
* @internal
|
|
33
34
|
* @param {ActionGroupProps} ActionGroupProps
|
|
34
35
|
* @see Action
|
|
35
36
|
*/
|
|
@@ -63,6 +63,7 @@ const getMaxLines = maxLines => {
|
|
|
63
63
|
/**
|
|
64
64
|
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
65
65
|
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
66
|
+
* @public
|
|
66
67
|
* @param {MetadataBlockProps} MetadataBlockProps
|
|
67
68
|
* @see Block
|
|
68
69
|
*/
|
|
@@ -42,10 +42,11 @@ const getTitleBlockViewComponent = status => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Represents a TitleBlock, which is the foundation of
|
|
45
|
+
* Represents a TitleBlock, which is the foundation of Flexible UI.
|
|
46
46
|
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
47
47
|
* The TitleBlock will also render differently given the state of the smart link.
|
|
48
48
|
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
49
|
+
* @public
|
|
49
50
|
* @param {TitleBlockProps} TitleBlockProps
|
|
50
51
|
* @see Block
|
|
51
52
|
* @see TitleBlockResolvingView
|
|
@@ -81,12 +81,21 @@ const renderChildren = (children, containerSize, containerTheme, status, retry,
|
|
|
81
81
|
const {
|
|
82
82
|
size: blockSize
|
|
83
83
|
} = child.props;
|
|
84
|
+
const size = blockSize || containerSize;
|
|
85
|
+
|
|
86
|
+
if (isFlexibleUiTitleBlock(child)) {
|
|
87
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
88
|
+
onClick,
|
|
89
|
+
retry,
|
|
90
|
+
size,
|
|
91
|
+
status,
|
|
92
|
+
theme: containerTheme
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
size: blockSize || containerSize,
|
|
88
|
-
status,
|
|
89
|
-
theme: containerTheme
|
|
97
|
+
size,
|
|
98
|
+
status
|
|
90
99
|
});
|
|
91
100
|
}
|
|
92
101
|
});
|
|
@@ -116,7 +125,11 @@ const getLayeredLink = (testId, context, children) => {
|
|
|
116
125
|
});
|
|
117
126
|
};
|
|
118
127
|
/**
|
|
119
|
-
*
|
|
128
|
+
* A container is a hidden component that build the Flexible Smart Link.
|
|
129
|
+
* All of the Flexible UI components are wrapped inside the container.
|
|
130
|
+
* It inherits the ui props from Card component and applies the custom styling
|
|
131
|
+
* accordingly.
|
|
132
|
+
* @internal
|
|
120
133
|
* @see Block
|
|
121
134
|
*/
|
|
122
135
|
|
|
@@ -27,8 +27,8 @@ const getStyles = size => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
30
|
+
* A base element that displays a group of avatars.
|
|
31
|
+
* @internal
|
|
32
32
|
* @param {AvatarGroupProps} AvatarGroupProps - The props necessary for the AvatarGroup.
|
|
33
33
|
* @see AuthorGroup
|
|
34
34
|
* @see CollaboratorGroup
|
|
@@ -71,8 +71,8 @@ const renderImageIcon = (url, testId) => {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
74
|
+
* A base element that displays some text with an associated icon.
|
|
75
|
+
* @internal
|
|
76
76
|
* @param {BadgeProps} BadgeProps - The props necessary for the Badge.
|
|
77
77
|
* @see CommentCount
|
|
78
78
|
* @see ViewCount
|
|
@@ -15,12 +15,18 @@ const styles = css`
|
|
|
15
15
|
${getTruncateStyles(1)}
|
|
16
16
|
`;
|
|
17
17
|
const typeToDescriptorMap = {
|
|
18
|
-
created:
|
|
19
|
-
|
|
18
|
+
created: {
|
|
19
|
+
relative: messages.created_on_relative,
|
|
20
|
+
absolute: messages.created_on_absolute
|
|
21
|
+
},
|
|
22
|
+
modified: {
|
|
23
|
+
relative: messages.modified_on_relative,
|
|
24
|
+
absolute: messages.modified_on_absolute
|
|
25
|
+
}
|
|
20
26
|
};
|
|
21
27
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
28
|
+
* A base element that displays an ISO Timestamp in text.
|
|
29
|
+
* @internal
|
|
24
30
|
* @param {DateTimeProps} DateTimeProps - The props necessary for the DateTime element.
|
|
25
31
|
* @see CreatedOn
|
|
26
32
|
* @see ModifiedOn
|
|
@@ -33,26 +39,42 @@ const DateTime = ({
|
|
|
33
39
|
testId = 'smart-element-date-time'
|
|
34
40
|
}) => {
|
|
35
41
|
const {
|
|
36
|
-
formatRelativeTime
|
|
42
|
+
formatRelativeTime,
|
|
43
|
+
formatDate
|
|
37
44
|
} = useIntl();
|
|
38
45
|
|
|
39
46
|
if (!type || !date) {
|
|
40
47
|
return null;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
const isLongerThenWeek = Math.abs(date.getTime() - Date.now()) > 1000 * 60 * 60 * 24 * 7;
|
|
51
|
+
let context;
|
|
52
|
+
let typeVariant;
|
|
53
|
+
|
|
54
|
+
if (isLongerThenWeek) {
|
|
55
|
+
typeVariant = 'absolute';
|
|
56
|
+
context = formatDate(date, {
|
|
57
|
+
month: 'long',
|
|
58
|
+
day: 'numeric',
|
|
59
|
+
year: 'numeric'
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
const {
|
|
63
|
+
value,
|
|
64
|
+
unit
|
|
65
|
+
} = selectUnit(date, Date.now());
|
|
66
|
+
typeVariant = 'relative';
|
|
67
|
+
context = formatRelativeTime(value, unit, {
|
|
68
|
+
numeric: 'auto'
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
return jsx("span", {
|
|
51
73
|
css: [styles, overrideCss],
|
|
52
74
|
"data-separator": true,
|
|
53
75
|
"data-smart-element-date-time": true,
|
|
54
76
|
"data-testid": testId
|
|
55
|
-
}, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type], {
|
|
77
|
+
}, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type][typeVariant], {
|
|
56
78
|
values: {
|
|
57
79
|
context
|
|
58
80
|
}
|
|
@@ -67,8 +67,8 @@ const renderImageIcon = (defaultIcon, icon, url, testId) => {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
70
|
+
* A base element that displays an Icon or favicon.
|
|
71
|
+
* @internal
|
|
72
72
|
* @param {IconProps} IconProps - The props necessary for the Icon element.
|
|
73
73
|
* @see LinkIcon
|
|
74
74
|
*/
|
|
@@ -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 const 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
|
|
|
@@ -65,9 +65,9 @@ const getMaxLines = maxLines => {
|
|
|
65
65
|
return maxLines;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @
|
|
70
|
-
* @param {LinkProps} LinkProps - The props necessary for the
|
|
68
|
+
* A base element that represent an anchor.
|
|
69
|
+
* @internal
|
|
70
|
+
* @param {LinkProps} LinkProps - The props necessary for the Link element.
|
|
71
71
|
* @see LinkIcon
|
|
72
72
|
*/
|
|
73
73
|
|
|
@@ -6,8 +6,8 @@ const styles = css`
|
|
|
6
6
|
line-height: inherit;
|
|
7
7
|
`;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
9
|
+
* A base element that displays a Lozenge.
|
|
10
|
+
* @internal
|
|
11
11
|
* @param {LozengeProps} LozengeProps - The props necessary for the Lozenge element.
|
|
12
12
|
* @see State
|
|
13
13
|
*/
|
|
@@ -11,8 +11,8 @@ const getStyles = maxLines => css`
|
|
|
11
11
|
${getTruncateStyles(maxLines)}
|
|
12
12
|
`;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
14
|
+
* A base element that displays some Text.
|
|
15
|
+
* @internal
|
|
16
16
|
* @param {TextProps} TextProps - The props necessary for the Text element.
|
|
17
17
|
* @see Title
|
|
18
18
|
*/
|
package/dist/esm/constants.js
CHANGED
|
@@ -109,9 +109,6 @@ export var ElementName;
|
|
|
109
109
|
ElementName["AuthorGroup"] = "AuthorGroup";
|
|
110
110
|
ElementName["CollaboratorGroup"] = "CollaboratorGroup";
|
|
111
111
|
ElementName["CommentCount"] = "CommentCount";
|
|
112
|
-
ElementName["ViewCount"] = "ViewCount";
|
|
113
|
-
ElementName["ReactCount"] = "ReactCount";
|
|
114
|
-
ElementName["VoteCount"] = "VoteCount";
|
|
115
112
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
116
113
|
ElementName["CreatedOn"] = "CreatedOn";
|
|
117
114
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
@@ -120,11 +117,14 @@ export var ElementName;
|
|
|
120
117
|
ElementName["Preview"] = "Preview";
|
|
121
118
|
ElementName["Priority"] = "Priority";
|
|
122
119
|
ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
|
|
120
|
+
ElementName["Provider"] = "Provider";
|
|
121
|
+
ElementName["ReactCount"] = "ReactCount";
|
|
123
122
|
ElementName["Snippet"] = "Snippet";
|
|
124
123
|
ElementName["State"] = "State";
|
|
125
124
|
ElementName["SubscriberCount"] = "SubscriberCount";
|
|
126
125
|
ElementName["Title"] = "Title";
|
|
127
|
-
ElementName["
|
|
126
|
+
ElementName["ViewCount"] = "ViewCount";
|
|
127
|
+
ElementName["VoteCount"] = "VoteCount";
|
|
128
128
|
})(ElementName || (ElementName = {}));
|
|
129
129
|
|
|
130
130
|
export var ActionName;
|
package/dist/esm/messages.js
CHANGED
|
@@ -25,10 +25,15 @@ export var messages = defineMessages({
|
|
|
25
25
|
defaultMessage: 'Created by {context}',
|
|
26
26
|
description: 'Indicates the person or entity that created the resource.'
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
id: 'fabric.linking.
|
|
28
|
+
created_on_relative: {
|
|
29
|
+
id: 'fabric.linking.create_on_relative',
|
|
30
30
|
defaultMessage: 'Created {context}',
|
|
31
|
-
description: 'Indicated when entity was created'
|
|
31
|
+
description: 'Indicated when entity was created (relative form)'
|
|
32
|
+
},
|
|
33
|
+
created_on_absolute: {
|
|
34
|
+
id: 'fabric.linking.create_on_absolute',
|
|
35
|
+
defaultMessage: 'Created on {context}',
|
|
36
|
+
description: 'Indicated when entity was created (absolute form)'
|
|
32
37
|
},
|
|
33
38
|
delete: {
|
|
34
39
|
id: 'fabric.linking.delete',
|
|
@@ -45,10 +50,15 @@ export var messages = defineMessages({
|
|
|
45
50
|
defaultMessage: 'Modified by {context}',
|
|
46
51
|
description: 'Indicates the person or entity that modified the resource.'
|
|
47
52
|
},
|
|
48
|
-
|
|
49
|
-
id: 'fabric.linking.
|
|
53
|
+
modified_on_relative: {
|
|
54
|
+
id: 'fabric.linking.modified_on_relative',
|
|
50
55
|
defaultMessage: 'Updated {context}',
|
|
51
|
-
description: 'Indicated when entity was modified'
|
|
56
|
+
description: 'Indicated when entity was modified (relative form)'
|
|
57
|
+
},
|
|
58
|
+
modified_on_absolute: {
|
|
59
|
+
id: 'fabric.linking.modified_on_absolute',
|
|
60
|
+
defaultMessage: 'Updated on {context}',
|
|
61
|
+
description: 'Indicated when entity was modified (absolute form)'
|
|
52
62
|
},
|
|
53
63
|
priority_blocker: {
|
|
54
64
|
id: 'fabric.linking.priority_blocker',
|
package/dist/esm/version.json
CHANGED
|
@@ -3,7 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import React, { useCallback, useState } from 'react';
|
|
4
4
|
import { usePrefetch } from '../../../state';
|
|
5
5
|
import { CardWithUrlContent } from '../component';
|
|
6
|
-
import { LoadingCardLink } from './LazyFallback';
|
|
6
|
+
import { LoadingCardLink } from './LazyFallback';
|
|
7
|
+
import { startUfoExperience } from '../../../state/analytics/ufoExperiences'; // This property enables the intersection observer to be run once the
|
|
7
8
|
// HTML element being observed is within `X` px of the target container it is
|
|
8
9
|
// being compared to. Since the default container is the `document`, we set this
|
|
9
10
|
// up to check once a Smart Link is within `X` px from the bottom of the viewport.
|
|
@@ -17,7 +18,8 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
17
18
|
|
|
18
19
|
var showActions = props.showActions,
|
|
19
20
|
appearance = props.appearance,
|
|
20
|
-
url = props.url
|
|
21
|
+
url = props.url,
|
|
22
|
+
id = props.id;
|
|
21
23
|
var prefetch = usePrefetch(url);
|
|
22
24
|
var Component = appearance === 'inline' ? 'span' : 'div';
|
|
23
25
|
var ComponentObserver = Component;
|
|
@@ -27,12 +29,13 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
if (isVisible) {
|
|
32
|
+
startUfoExperience('smart-link-rendered', id);
|
|
30
33
|
setIsIntersecting(true);
|
|
31
34
|
observer.disconnect();
|
|
32
35
|
} else {
|
|
33
36
|
prefetch();
|
|
34
37
|
}
|
|
35
|
-
}, [prefetch]);
|
|
38
|
+
}, [prefetch, id]);
|
|
36
39
|
var onRef = useCallback(function (element) {
|
|
37
40
|
if (!element) {
|
|
38
41
|
return;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import LazilyRender from 'react-lazily-render';
|
|
4
4
|
import { CardWithUrlContent } from '../component';
|
|
5
5
|
import { LoadingCardLink } from './LazyFallback';
|
|
6
|
+
import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
|
|
6
7
|
export function LazyLazilyRenderCard(props) {
|
|
7
8
|
var appearance = props.appearance,
|
|
8
9
|
container = props.container,
|
|
9
|
-
showActions = props.showActions
|
|
10
|
+
showActions = props.showActions,
|
|
11
|
+
id = props.id;
|
|
10
12
|
var offset = Math.ceil(window.innerHeight / 4);
|
|
13
|
+
useState(function () {
|
|
14
|
+
// Start of experience when intersectionObserver is not supported.
|
|
15
|
+
startUfoExperience('smart-link-rendered', id);
|
|
16
|
+
});
|
|
11
17
|
return /*#__PURE__*/React.createElement(LazilyRender, {
|
|
12
18
|
offset: offset,
|
|
13
19
|
component: appearance === 'inline' ? 'span' : 'div',
|
|
@@ -16,13 +16,8 @@ export function CardWithURLRenderer(props) {
|
|
|
16
16
|
return uuid();
|
|
17
17
|
}),
|
|
18
18
|
_useState2 = _slicedToArray(_useState, 1),
|
|
19
|
-
id = _useState2[0];
|
|
19
|
+
id = _useState2[0];
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
useState(function () {
|
|
23
|
-
// We want to start timing of render event only once and right at the start
|
|
24
|
-
startUfoExperience('smart-link-rendered', id);
|
|
25
|
-
});
|
|
26
21
|
useEffect(function () {
|
|
27
22
|
// ComponentWillUnmount
|
|
28
23
|
return function () {
|
|
@@ -72,7 +67,10 @@ export function CardWithURLRenderer(props) {
|
|
|
72
67
|
else {
|
|
73
68
|
var errorInfo = {
|
|
74
69
|
componentStack: componentStack
|
|
75
|
-
};
|
|
70
|
+
}; // Start and fail the smart-link-rendered experience. If it has already
|
|
71
|
+
// been started nothing happens.
|
|
72
|
+
|
|
73
|
+
startUfoExperience('smart-link-rendered', id);
|
|
76
74
|
failUfoExperience('smart-link-rendered', id);
|
|
77
75
|
failUfoExperience('smart-link-authenticated', id);
|
|
78
76
|
dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
|
|
@@ -58,8 +58,8 @@ var ActionIcon = function ActionIcon(_ref) {
|
|
|
58
58
|
|
|
59
59
|
export var sizeToSpacing = (_sizeToSpacing = {}, _defineProperty(_sizeToSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.XLarge, 'default'), _sizeToSpacing);
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @
|
|
61
|
+
* A base action that can be triggered with an on click.
|
|
62
|
+
* @internal
|
|
63
63
|
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
64
64
|
* @see DeleteAction
|
|
65
65
|
* @see EditAction
|
|
@@ -19,6 +19,7 @@ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["
|
|
|
19
19
|
/**
|
|
20
20
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
21
21
|
* preferences.
|
|
22
|
+
* @internal
|
|
22
23
|
* @param {ActionGroupProps} ActionGroupProps
|
|
23
24
|
* @see Action
|
|
24
25
|
*/
|
|
@@ -12,8 +12,9 @@ var getBlockStyles = function getBlockStyles(direction, size) {
|
|
|
12
12
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n"])), getBaseStyles(direction, size), getGapSize(size));
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* A block represents a collection of elements and actions that are arranged
|
|
16
|
-
* All elements and actions should be contained within a Block.
|
|
15
|
+
* A block represents a collection of elements and actions that are arranged
|
|
16
|
+
* in a row. All elements and actions should be contained within a Block.
|
|
17
|
+
* @internal
|
|
17
18
|
* @param {ActionGroupProps} ActionGroupProps
|
|
18
19
|
* @see Action
|
|
19
20
|
*/
|
|
@@ -25,6 +25,7 @@ export var getElementGroupStyles = function getElementGroupStyles(direction, siz
|
|
|
25
25
|
/**
|
|
26
26
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
27
27
|
* preferences.
|
|
28
|
+
* @internal
|
|
28
29
|
* @param {ActionGroupProps} ActionGroupProps
|
|
29
30
|
* @see Action
|
|
30
31
|
*/
|
|
@@ -59,6 +59,7 @@ var getMaxLines = function getMaxLines(maxLines) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
61
61
|
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
62
|
+
* @public
|
|
62
63
|
* @param {MetadataBlockProps} MetadataBlockProps
|
|
63
64
|
* @see Block
|
|
64
65
|
*/
|
|
@@ -40,10 +40,11 @@ var getTitleBlockViewComponent = function getTitleBlockViewComponent(status) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
|
-
* Represents a TitleBlock, which is the foundation of
|
|
43
|
+
* Represents a TitleBlock, which is the foundation of Flexible UI.
|
|
44
44
|
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
45
45
|
* The TitleBlock will also render differently given the state of the smart link.
|
|
46
46
|
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
47
|
+
* @public
|
|
47
48
|
* @param {TitleBlockProps} TitleBlockProps
|
|
48
49
|
* @see Block
|
|
49
50
|
* @see TitleBlockResolvingView
|