@atlaskit/smart-card 34.2.2 → 34.4.0
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 +23 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +201 -263
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +8 -13
- package/dist/cjs/view/FlexibleCard/components/actions/view-related-links-action/index.js +5 -8
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.compiled.css +34 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +33 -18
- package/dist/cjs/view/FlexibleCard/components/blocks/block/indexOld.js +56 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +115 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +58 -81
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +12 -8
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/indexOld.js +37 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.compiled.css +15 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +18 -52
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/indexOld.js +104 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +135 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +108 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +10 -57
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +38 -37
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +58 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +24 -16
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +48 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -19
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +14 -9
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -9
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/cjs/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +63 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +61 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/index.js +20 -19
- package/dist/cjs/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +51 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-links-list/index.js +24 -24
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +66 -0
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/index.js +31 -25
- package/dist/cjs/view/RelatedLinksModal/views/resolved/ResolvedOld.js +45 -0
- package/dist/cjs/view/RelatedLinksModal/views/resolved/index.js +16 -14
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +141 -0
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +56 -50
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +69 -55
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +1 -3
- package/dist/es2019/view/FlexibleCard/components/actions/view-related-links-action/index.js +1 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.compiled.css +34 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +32 -35
- package/dist/es2019/view/FlexibleCard/components/blocks/block/indexOld.js +62 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +113 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +60 -95
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +12 -8
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/indexOld.js +28 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.compiled.css +15 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +14 -62
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/indexOld.js +106 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +118 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +102 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +11 -57
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +35 -36
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +50 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +15 -11
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +42 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -18
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +1 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/es2019/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +55 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +55 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/index.js +19 -18
- package/dist/es2019/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +42 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-links-list/index.js +23 -22
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +58 -0
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/index.js +28 -24
- package/dist/es2019/view/RelatedLinksModal/views/resolved/ResolvedOld.js +36 -0
- package/dist/es2019/view/RelatedLinksModal/views/resolved/index.js +16 -13
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +133 -0
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +53 -49
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +116 -162
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +1 -3
- package/dist/esm/view/FlexibleCard/components/actions/view-related-links-action/index.js +1 -4
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.compiled.css +34 -0
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +31 -20
- package/dist/esm/view/FlexibleCard/components/blocks/block/indexOld.js +50 -0
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +108 -0
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +54 -79
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +12 -8
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/indexOld.js +30 -0
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.compiled.css +15 -0
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +15 -53
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/indexOld.js +98 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +127 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +101 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +11 -56
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +36 -37
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +53 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +15 -11
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +42 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -18
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +14 -9
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/esm/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +53 -0
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +54 -0
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/index.js +19 -18
- package/dist/esm/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +43 -0
- package/dist/esm/view/RelatedLinksModal/components/related-links-list/index.js +24 -23
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +58 -0
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/index.js +28 -24
- package/dist/esm/view/RelatedLinksModal/views/resolved/ResolvedOld.js +37 -0
- package/dist/esm/view/RelatedLinksModal/views/resolved/index.js +16 -13
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +133 -0
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +53 -49
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +3 -10
- package/dist/types/view/FlexibleCard/components/blocks/block/indexOld.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +5 -9
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +3 -13
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/indexOld.d.ts +14 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/resolved/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/resolved/indexOld.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.d.ts +16 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +5 -7
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -13
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.d.ts +9 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.d.ts +14 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +5 -3
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +2 -0
- package/dist/types/view/RelatedLinksModal/components/RelatedLinksBaseModal.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-link-item/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-links-list/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.d.ts +6 -0
- package/dist/types/view/RelatedLinksModal/views/errored/error-svg/index.d.ts +2 -6
- package/dist/types/view/RelatedLinksModal/views/resolved/ResolvedOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/views/resolved/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.d.ts +6 -0
- package/dist/types/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/utils/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/block/index.d.ts +3 -10
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/block/indexOld.d.ts +11 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/index.d.ts +5 -9
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/index.d.ts +3 -13
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/indexOld.d.ts +14 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/resolved/index.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/resolved/indexOld.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.d.ts +16 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.d.ts +15 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +5 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -13
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.d.ts +9 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +8 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.d.ts +14 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +5 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +2 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/RelatedLinksBaseModal.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-link-item/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-links-list/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.d.ts +6 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/errored/error-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/view/RelatedLinksModal/views/resolved/ResolvedOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/resolved/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.d.ts +6 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.d.ts +2 -6
- package/package.json +4 -4
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { MediaPlacement } from '../../../../../../constants';
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useCallback } from 'react';
|
|
11
7
|
import { Preview } from '../../../elements';
|
|
12
8
|
import Block from '../../block';
|
|
13
9
|
/**
|
|
@@ -25,42 +21,10 @@ import Block from '../../block';
|
|
|
25
21
|
* @param placement
|
|
26
22
|
* @param ignoreContainerPadding
|
|
27
23
|
*/
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return css`
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: ${containerPadding};
|
|
35
|
-
bottom: ${containerPadding};
|
|
36
|
-
width: calc(var(--preview-block-width) - ${containerPadding});
|
|
37
|
-
|
|
38
|
-
${placement === MediaPlacement.Left ? `left: ${containerPadding};` : ''}
|
|
39
|
-
${placement === MediaPlacement.Right ? `right: ${containerPadding};` : ''}
|
|
40
|
-
|
|
41
|
-
[data-smart-element-media='image'] {
|
|
42
|
-
aspect-ratio: unset;
|
|
43
|
-
padding-top: unset;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: 100%;
|
|
46
|
-
object-fit: cover;
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
if (ignoreContainerPadding) {
|
|
51
|
-
return css({
|
|
52
|
-
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
53
|
-
marginRight: 'calc(var(--container-gap-right) * -1)',
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
55
|
-
'&:first-of-type': {
|
|
56
|
-
marginTop: 'calc(var(--container-padding) * -1)'
|
|
57
|
-
},
|
|
58
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
59
|
-
'&:last-of-type': {
|
|
60
|
-
marginBottom: 'calc(var(--container-padding) * -1)'
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
24
|
+
const previewBlockStyles = {
|
|
25
|
+
left: "_kqswstnw _154iidpf _94n5idpf _1bsb795p _1ltvidpf _1t26n7od _ze72n7od _10aa1osq _rjuj1osq _mr051dfr",
|
|
26
|
+
right: "_kqswstnw _154iidpf _94n5idpf _1bsb795p _1xi2idpf _1t26n7od _ze72n7od _10aa1osq _rjuj1osq _mr051dfr",
|
|
27
|
+
ignoreContainerPadding: "_18u01ivi _2hwxc10g _e0oi1ya9 _dmhj1ya9"
|
|
64
28
|
};
|
|
65
29
|
|
|
66
30
|
/**
|
|
@@ -72,34 +36,22 @@ const getPreviewBlockStyles = (placement, ignoreContainerPadding) => {
|
|
|
72
36
|
const PreviewBlockResolvedView = ({
|
|
73
37
|
ignoreContainerPadding = false,
|
|
74
38
|
onError,
|
|
75
|
-
|
|
39
|
+
className,
|
|
76
40
|
placement,
|
|
77
41
|
testId,
|
|
78
42
|
overrideUrl,
|
|
79
43
|
...blockProps
|
|
80
44
|
}) => {
|
|
81
|
-
const [styles, setStyles] = useState(overrideCss);
|
|
82
|
-
const updateStyles = useCallback(() => {
|
|
83
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
84
|
-
setStyles(css(getPreviewBlockStyles(placement, ignoreContainerPadding), overrideCss));
|
|
85
|
-
}, [ignoreContainerPadding, overrideCss, placement]);
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
updateStyles();
|
|
88
|
-
}, [ignoreContainerPadding, overrideCss, placement, updateStyles]);
|
|
89
|
-
const handleOnLoad = useCallback(() => {
|
|
90
|
-
updateStyles();
|
|
91
|
-
}, [updateStyles]);
|
|
92
45
|
const handleOnError = useCallback(() => {
|
|
93
46
|
if (onError) {
|
|
94
47
|
onError();
|
|
95
48
|
}
|
|
96
49
|
}, [onError]);
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}),
|
|
50
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
51
|
+
testId: `${testId}-resolved-view`,
|
|
52
|
+
className: ax([placement && previewBlockStyles[placement], !placement && ignoreContainerPadding && previewBlockStyles.ignoreContainerPadding])
|
|
53
|
+
}), /*#__PURE__*/React.createElement(Preview, {
|
|
101
54
|
onError: handleOnError,
|
|
102
|
-
onLoad: handleOnLoad,
|
|
103
55
|
overrideUrl: overrideUrl
|
|
104
56
|
}));
|
|
105
57
|
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { MediaPlacement } from '../../../../../../constants';
|
|
11
|
+
import { Preview } from '../../../elements';
|
|
12
|
+
import Block from '../../block';
|
|
13
|
+
/**
|
|
14
|
+
* Due to its placement on the left/right and ignoreContainerPadding prop
|
|
15
|
+
* rely on its parent container styling, css variables are declared in
|
|
16
|
+
* <Container /> to preset the base values for the preview block styling.
|
|
17
|
+
*
|
|
18
|
+
* `--container-padding` is the padding of the Container. This value is based
|
|
19
|
+
* on size and hidePadding.
|
|
20
|
+
* `--container-gap-left` and `--container-gap-right` are the gap or padding of
|
|
21
|
+
* the Container depending on whether the container has other preview blocks
|
|
22
|
+
* with left/right positioning.
|
|
23
|
+
* `--preview-block-width` is the size of the preview image in relation to
|
|
24
|
+
* the Container width when the placement is left/right.
|
|
25
|
+
* @param placement
|
|
26
|
+
* @param ignoreContainerPadding
|
|
27
|
+
*/
|
|
28
|
+
const getPreviewBlockStyles = (placement, ignoreContainerPadding) => {
|
|
29
|
+
if (placement === MediaPlacement.Left || placement === MediaPlacement.Right) {
|
|
30
|
+
const containerPadding = ignoreContainerPadding ? '0rem' : 'var(--container-padding)';
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
32
|
+
return css`
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: ${containerPadding};
|
|
35
|
+
bottom: ${containerPadding};
|
|
36
|
+
width: calc(var(--preview-block-width) - ${containerPadding});
|
|
37
|
+
|
|
38
|
+
${placement === MediaPlacement.Left ? `left: ${containerPadding};` : ''}
|
|
39
|
+
${placement === MediaPlacement.Right ? `right: ${containerPadding};` : ''}
|
|
40
|
+
|
|
41
|
+
[data-smart-element-media='image'] {
|
|
42
|
+
aspect-ratio: unset;
|
|
43
|
+
padding-top: unset;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
object-fit: cover;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
if (ignoreContainerPadding) {
|
|
51
|
+
return css({
|
|
52
|
+
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
53
|
+
marginRight: 'calc(var(--container-gap-right) * -1)',
|
|
54
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
55
|
+
'&:first-of-type': {
|
|
56
|
+
marginTop: 'calc(var(--container-padding) * -1)'
|
|
57
|
+
},
|
|
58
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
59
|
+
'&:last-of-type': {
|
|
60
|
+
marginBottom: 'calc(var(--container-padding) * -1)'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents a resolved PreviewBlock, which typically contains media or other large format content.
|
|
68
|
+
* @public
|
|
69
|
+
* @param {PreviewBlock} PreviewBlock
|
|
70
|
+
* @see Block
|
|
71
|
+
*/
|
|
72
|
+
const PreviewBlockResolvedView = ({
|
|
73
|
+
ignoreContainerPadding = false,
|
|
74
|
+
onError,
|
|
75
|
+
overrideCss,
|
|
76
|
+
placement,
|
|
77
|
+
testId,
|
|
78
|
+
overrideUrl,
|
|
79
|
+
...blockProps
|
|
80
|
+
}) => {
|
|
81
|
+
const [styles, setStyles] = useState(overrideCss);
|
|
82
|
+
const updateStyles = useCallback(() => {
|
|
83
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
84
|
+
setStyles(css(getPreviewBlockStyles(placement, ignoreContainerPadding), overrideCss));
|
|
85
|
+
}, [ignoreContainerPadding, overrideCss, placement]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
updateStyles();
|
|
88
|
+
}, [ignoreContainerPadding, overrideCss, placement, updateStyles]);
|
|
89
|
+
const handleOnLoad = useCallback(() => {
|
|
90
|
+
updateStyles();
|
|
91
|
+
}, [updateStyles]);
|
|
92
|
+
const handleOnError = useCallback(() => {
|
|
93
|
+
if (onError) {
|
|
94
|
+
onError();
|
|
95
|
+
}
|
|
96
|
+
}, [onError]);
|
|
97
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
98
|
+
overrideCss: styles,
|
|
99
|
+
testId: `${testId}-resolved-view`
|
|
100
|
+
}), jsx(Preview, {
|
|
101
|
+
onError: handleOnError,
|
|
102
|
+
onLoad: handleOnLoad,
|
|
103
|
+
overrideUrl: overrideUrl
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
export default PreviewBlockResolvedView;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { SmartLinkStatus } from '../../../../../constants';
|
|
7
|
+
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
8
|
+
import { Title } from '../../elements';
|
|
9
|
+
import ActionGroup from '../action-group';
|
|
10
|
+
import TitleBlockErroredView from './errored';
|
|
11
|
+
import TitleBlockResolvedView from './resolved';
|
|
12
|
+
import TitleBlockResolvingView from './resolving';
|
|
13
|
+
const getActionStyles = (showOnHover, isOpen) => {
|
|
14
|
+
if (showOnHover && !isOpen) {
|
|
15
|
+
return css({
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
17
|
+
'.actions-button-group': {
|
|
18
|
+
opacity: 0
|
|
19
|
+
},
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
21
|
+
'&:hover .actions-button-group, .actions-button-group:focus-within': {
|
|
22
|
+
opacity: 1
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const getTitleBlockViewComponent = status => {
|
|
28
|
+
switch (status) {
|
|
29
|
+
case SmartLinkStatus.Pending:
|
|
30
|
+
case SmartLinkStatus.Resolving:
|
|
31
|
+
return TitleBlockResolvingView;
|
|
32
|
+
case SmartLinkStatus.Resolved:
|
|
33
|
+
return TitleBlockResolvedView;
|
|
34
|
+
case SmartLinkStatus.Unauthorized:
|
|
35
|
+
case SmartLinkStatus.Forbidden:
|
|
36
|
+
case SmartLinkStatus.NotFound:
|
|
37
|
+
case SmartLinkStatus.Errored:
|
|
38
|
+
case SmartLinkStatus.Fallback:
|
|
39
|
+
default:
|
|
40
|
+
return TitleBlockErroredView;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Represents a TitleBlock, which is the foundation of Flexible UI.
|
|
46
|
+
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
47
|
+
* The TitleBlock will also render differently given the state of the smart link.
|
|
48
|
+
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
49
|
+
* @public
|
|
50
|
+
* @param {TitleBlockProps} TitleBlockProps
|
|
51
|
+
* @see Block
|
|
52
|
+
* @see TitleBlockResolvingView
|
|
53
|
+
* @see TitleBlockResolvedView
|
|
54
|
+
* @see TitleBlockErroredView
|
|
55
|
+
*/
|
|
56
|
+
const TitleBlock = ({
|
|
57
|
+
actions = [],
|
|
58
|
+
anchorTarget,
|
|
59
|
+
hideTitleTooltip,
|
|
60
|
+
maxLines,
|
|
61
|
+
onActionMenuOpenChange,
|
|
62
|
+
onClick,
|
|
63
|
+
overrideCss,
|
|
64
|
+
status = SmartLinkStatus.Fallback,
|
|
65
|
+
showActionOnHover,
|
|
66
|
+
testId = 'smart-block-title',
|
|
67
|
+
text,
|
|
68
|
+
icon,
|
|
69
|
+
theme,
|
|
70
|
+
hideRetry,
|
|
71
|
+
metadataPosition,
|
|
72
|
+
hideIcon = false,
|
|
73
|
+
...props
|
|
74
|
+
}) => {
|
|
75
|
+
if (hideRetry && props.retry) {
|
|
76
|
+
delete props.retry;
|
|
77
|
+
}
|
|
78
|
+
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
79
|
+
const onDropdownOpenChange = useCallback(isOpen => {
|
|
80
|
+
setActionDropdownOpen(isOpen);
|
|
81
|
+
if (onActionMenuOpenChange) {
|
|
82
|
+
onActionMenuOpenChange({
|
|
83
|
+
isOpen
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, [onActionMenuOpenChange]);
|
|
87
|
+
const actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
88
|
+
items: actions,
|
|
89
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
90
|
+
onDropdownOpenChange: onDropdownOpenChange
|
|
91
|
+
});
|
|
92
|
+
const actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
93
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
94
|
+
const combinedCss = css(actionStyles, overrideCss);
|
|
95
|
+
const overrideText = !!text ? {
|
|
96
|
+
text
|
|
97
|
+
} : {};
|
|
98
|
+
const onMouseDown = useMouseDownEvent();
|
|
99
|
+
const title = /*#__PURE__*/React.createElement(Title, _extends({
|
|
100
|
+
hideTooltip: hideTitleTooltip,
|
|
101
|
+
maxLines: maxLines,
|
|
102
|
+
onClick: onClick,
|
|
103
|
+
onMouseDown: onMouseDown,
|
|
104
|
+
target: anchorTarget,
|
|
105
|
+
theme: theme
|
|
106
|
+
}, overrideText));
|
|
107
|
+
const Component = getTitleBlockViewComponent(status);
|
|
108
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
109
|
+
actionGroup: actionGroup,
|
|
110
|
+
overrideCss: combinedCss,
|
|
111
|
+
testId: testId,
|
|
112
|
+
title: title,
|
|
113
|
+
metadataPosition: metadataPosition,
|
|
114
|
+
hideIcon: hideIcon,
|
|
115
|
+
icon: icon
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
118
|
+
export default TitleBlock;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
9
|
+
import { Box } from '@atlaskit/primitives';
|
|
10
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize } from '../../../../../../constants';
|
|
11
|
+
import { LinkIcon } from '../../../elements';
|
|
12
|
+
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
13
|
+
import Block from '../../block';
|
|
14
|
+
import ElementGroup from '../../element-group';
|
|
15
|
+
const actionStyles = css({
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
18
|
+
':hover': {
|
|
19
|
+
color: "var(--ds-text-subtle, #8993A4)",
|
|
20
|
+
textDecoration: 'underline'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const actionHoverStyles = css({
|
|
24
|
+
position: 'relative',
|
|
25
|
+
zIndex: 1,
|
|
26
|
+
'&:focus': {
|
|
27
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* This function does not work in the component below as it needs to be xcss.
|
|
33
|
+
* The component instead uses inherited styles
|
|
34
|
+
*/
|
|
35
|
+
const getMessageStyles = (size, hasAction) => {
|
|
36
|
+
const sizeStyles = getLinkSizeStyles(size);
|
|
37
|
+
return css({
|
|
38
|
+
flex: '1 1 auto',
|
|
39
|
+
justifyContent: 'flex-end'
|
|
40
|
+
},
|
|
41
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
42
|
+
hasAction ? actionStyles : '',
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
44
|
+
sizeStyles,
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
46
|
+
getTruncateStyles(1, getLinkLineHeight(size)), {
|
|
47
|
+
color: "var(--ds-text-disabled, #6B778C)",
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
49
|
+
':focus': {
|
|
50
|
+
outline: `${"var(--ds-border-focused, #388BFF)"} solid 2px`
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
54
|
+
hasAction ? actionHoverStyles : '');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Represents an Errored TitleBlock view.
|
|
59
|
+
* This will render when a Smart Link did not successfully resolve.
|
|
60
|
+
* This may be a result of a Smart Link not having the correct credentials,
|
|
61
|
+
* or the backend response was errored or malformed.
|
|
62
|
+
* @see TitleBlock
|
|
63
|
+
*/
|
|
64
|
+
const TitleBlockErroredView = ({
|
|
65
|
+
actionGroup,
|
|
66
|
+
retry,
|
|
67
|
+
position,
|
|
68
|
+
testId,
|
|
69
|
+
title,
|
|
70
|
+
icon,
|
|
71
|
+
hideIcon,
|
|
72
|
+
...blockProps
|
|
73
|
+
}) => {
|
|
74
|
+
const {
|
|
75
|
+
descriptor,
|
|
76
|
+
onClick,
|
|
77
|
+
values
|
|
78
|
+
} = retry || {};
|
|
79
|
+
const {
|
|
80
|
+
size = SmartLinkSize.Medium
|
|
81
|
+
} = blockProps;
|
|
82
|
+
const hasAction = onClick !== undefined;
|
|
83
|
+
return jsx(Block, _extends({}, blockProps, {
|
|
84
|
+
testId: `${testId}-errored-view`
|
|
85
|
+
}), !hideIcon && jsx(LinkIcon, {
|
|
86
|
+
overrideIcon: icon,
|
|
87
|
+
position: position
|
|
88
|
+
}), title, descriptor && jsx(ElementGroup, {
|
|
89
|
+
direction: SmartLinkDirection.Horizontal,
|
|
90
|
+
align: SmartLinkAlignment.Right
|
|
91
|
+
}, jsx(Box
|
|
92
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
93
|
+
, {
|
|
94
|
+
xcss: getMessageStyles(size, hasAction),
|
|
95
|
+
onClick: onClick,
|
|
96
|
+
testId: `${testId}-errored-view-message`,
|
|
97
|
+
tabIndex: hasAction ? 0 : -1
|
|
98
|
+
}, jsx(FormattedMessage, _extends({}, descriptor, {
|
|
99
|
+
values: values
|
|
100
|
+
})))), actionGroup);
|
|
101
|
+
};
|
|
102
|
+
export default TitleBlockErroredView;
|
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
8
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
4
|
import { Box } from '@atlaskit/primitives';
|
|
10
|
-
import { SmartLinkAlignment, SmartLinkDirection
|
|
5
|
+
import { SmartLinkAlignment, SmartLinkDirection } from '../../../../../../constants';
|
|
11
6
|
import { LinkIcon } from '../../../elements';
|
|
12
|
-
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
13
7
|
import Block from '../../block';
|
|
14
8
|
import ElementGroup from '../../element-group';
|
|
15
|
-
|
|
16
|
-
cursor: 'pointer',
|
|
17
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
18
|
-
':hover': {
|
|
19
|
-
color: "var(--ds-text-subtle, #8993A4)",
|
|
20
|
-
textDecoration: 'underline'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const actionHoverStyles = css({
|
|
24
|
-
position: 'relative',
|
|
25
|
-
zIndex: 1,
|
|
26
|
-
'&:focus': {
|
|
27
|
-
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const getMessageStyles = (size, hasAction) => {
|
|
31
|
-
const sizeStyles = getLinkSizeStyles(size);
|
|
32
|
-
return css({
|
|
33
|
-
flex: '1 1 auto',
|
|
34
|
-
justifyContent: 'flex-end'
|
|
35
|
-
},
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
37
|
-
hasAction ? actionStyles : '',
|
|
38
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
39
|
-
sizeStyles,
|
|
40
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
41
|
-
getTruncateStyles(1, getLinkLineHeight(size)), {
|
|
42
|
-
color: "var(--ds-text-disabled, #6B778C)",
|
|
43
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
44
|
-
':focus': {
|
|
45
|
-
outline: `${"var(--ds-border-focused, #388BFF)"} solid 2px`
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
49
|
-
hasAction ? actionHoverStyles : '');
|
|
50
|
-
};
|
|
9
|
+
import TitleBlockErroredViewOld from './TitleBlockErroredViewOld';
|
|
51
10
|
|
|
52
11
|
/**
|
|
53
12
|
* Represents an Errored TitleBlock view.
|
|
@@ -56,7 +15,7 @@ const getMessageStyles = (size, hasAction) => {
|
|
|
56
15
|
* or the backend response was errored or malformed.
|
|
57
16
|
* @see TitleBlock
|
|
58
17
|
*/
|
|
59
|
-
const
|
|
18
|
+
const TitleBlockErroredViewNew = ({
|
|
60
19
|
actionGroup,
|
|
61
20
|
retry,
|
|
62
21
|
position,
|
|
@@ -71,27 +30,22 @@ const TitleBlockErroredView = ({
|
|
|
71
30
|
onClick,
|
|
72
31
|
values
|
|
73
32
|
} = retry || {};
|
|
74
|
-
const {
|
|
75
|
-
size = SmartLinkSize.Medium
|
|
76
|
-
} = blockProps;
|
|
77
33
|
const hasAction = onClick !== undefined;
|
|
78
|
-
return
|
|
34
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
79
35
|
testId: `${testId}-errored-view`
|
|
80
|
-
}), !hideIcon &&
|
|
36
|
+
}), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
|
|
81
37
|
overrideIcon: icon,
|
|
82
38
|
position: position
|
|
83
|
-
}), title, descriptor &&
|
|
39
|
+
}), title, descriptor && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
84
40
|
direction: SmartLinkDirection.Horizontal,
|
|
85
41
|
align: SmartLinkAlignment.Right
|
|
86
|
-
},
|
|
87
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
88
|
-
, {
|
|
89
|
-
xcss: getMessageStyles(size, hasAction),
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
90
43
|
onClick: onClick,
|
|
91
44
|
testId: `${testId}-errored-view-message`,
|
|
92
45
|
tabIndex: hasAction ? 0 : -1
|
|
93
|
-
},
|
|
46
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, descriptor, {
|
|
94
47
|
values: values
|
|
95
48
|
})))), actionGroup);
|
|
96
49
|
};
|
|
97
|
-
export default
|
|
50
|
+
export default TitleBlockErroredViewOld;
|
|
51
|
+
export { TitleBlockErroredViewNew };
|
|
@@ -1,43 +1,34 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useCallback, useState } from 'react';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
7
9
|
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
8
10
|
import { Title } from '../../elements';
|
|
9
11
|
import ActionGroup from '../action-group';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
17
|
-
'.actions-button-group': {
|
|
18
|
-
opacity: 0
|
|
19
|
-
},
|
|
20
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
21
|
-
'&:hover .actions-button-group, .actions-button-group:focus-within': {
|
|
22
|
-
opacity: 1
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
};
|
|
12
|
+
import { TitleBlockErroredViewNew } from './errored';
|
|
13
|
+
import { TitleBlockResolvedViewNew } from './resolved';
|
|
14
|
+
import { TitleBlockResolvingViewNew } from './resolving';
|
|
15
|
+
import TitleBlockOld from './TitleBlockOld';
|
|
16
|
+
const styles = null;
|
|
17
|
+
const actionStyles = null;
|
|
27
18
|
const getTitleBlockViewComponent = status => {
|
|
28
19
|
switch (status) {
|
|
29
20
|
case SmartLinkStatus.Pending:
|
|
30
21
|
case SmartLinkStatus.Resolving:
|
|
31
|
-
return
|
|
22
|
+
return TitleBlockResolvingViewNew;
|
|
32
23
|
case SmartLinkStatus.Resolved:
|
|
33
|
-
return
|
|
24
|
+
return TitleBlockResolvedViewNew;
|
|
34
25
|
case SmartLinkStatus.Unauthorized:
|
|
35
26
|
case SmartLinkStatus.Forbidden:
|
|
36
27
|
case SmartLinkStatus.NotFound:
|
|
37
28
|
case SmartLinkStatus.Errored:
|
|
38
29
|
case SmartLinkStatus.Fallback:
|
|
39
30
|
default:
|
|
40
|
-
return
|
|
31
|
+
return TitleBlockErroredViewNew;
|
|
41
32
|
}
|
|
42
33
|
};
|
|
43
34
|
|
|
@@ -49,18 +40,17 @@ const getTitleBlockViewComponent = status => {
|
|
|
49
40
|
* @public
|
|
50
41
|
* @param {TitleBlockProps} TitleBlockProps
|
|
51
42
|
* @see Block
|
|
52
|
-
* @see
|
|
53
|
-
* @see
|
|
54
|
-
* @see
|
|
43
|
+
* @see TitleBlockResolvingViewNew
|
|
44
|
+
* @see TitleBlockResolvedViewNew
|
|
45
|
+
* @see TitleBlockErroredViewNew
|
|
55
46
|
*/
|
|
56
|
-
const
|
|
47
|
+
const TitleBlockNew = ({
|
|
57
48
|
actions = [],
|
|
58
49
|
anchorTarget,
|
|
59
50
|
hideTitleTooltip,
|
|
60
51
|
maxLines,
|
|
61
52
|
onActionMenuOpenChange,
|
|
62
53
|
onClick,
|
|
63
|
-
overrideCss,
|
|
64
54
|
status = SmartLinkStatus.Fallback,
|
|
65
55
|
showActionOnHover,
|
|
66
56
|
testId = 'smart-block-title',
|
|
@@ -70,6 +60,7 @@ const TitleBlock = ({
|
|
|
70
60
|
hideRetry,
|
|
71
61
|
metadataPosition,
|
|
72
62
|
hideIcon = false,
|
|
63
|
+
className,
|
|
73
64
|
...props
|
|
74
65
|
}) => {
|
|
75
66
|
if (hideRetry && props.retry) {
|
|
@@ -89,9 +80,6 @@ const TitleBlock = ({
|
|
|
89
80
|
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
90
81
|
onDropdownOpenChange: onDropdownOpenChange
|
|
91
82
|
});
|
|
92
|
-
const actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
93
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
94
|
-
const combinedCss = css(actionStyles, overrideCss);
|
|
95
83
|
const overrideText = !!text ? {
|
|
96
84
|
text
|
|
97
85
|
} : {};
|
|
@@ -105,14 +93,25 @@ const TitleBlock = ({
|
|
|
105
93
|
theme: theme
|
|
106
94
|
}, overrideText));
|
|
107
95
|
const Component = getTitleBlockViewComponent(status);
|
|
108
|
-
return /*#__PURE__*/React.createElement(
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: ax([showActionOnHover && !actionDropdownOpen && "_1bfhidpf _wn5xkb7n _h157kb7n"])
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
99
|
+
actionGroup: actionGroup
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
101
|
+
,
|
|
102
|
+
className: className,
|
|
111
103
|
testId: testId,
|
|
112
104
|
title: title,
|
|
113
105
|
metadataPosition: metadataPosition,
|
|
114
106
|
hideIcon: hideIcon,
|
|
115
107
|
icon: icon
|
|
116
|
-
}));
|
|
108
|
+
})));
|
|
109
|
+
};
|
|
110
|
+
const TitleBlock = props => {
|
|
111
|
+
if (fg('bandicoots-compiled-migration-smartcard')) {
|
|
112
|
+
return /*#__PURE__*/React.createElement(TitleBlockNew, props);
|
|
113
|
+
} else {
|
|
114
|
+
return /*#__PURE__*/React.createElement(TitleBlockOld, props);
|
|
115
|
+
}
|
|
117
116
|
};
|
|
118
117
|
export default TitleBlock;
|