@atlaskit/smart-card 34.2.2 → 34.3.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 +8 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- 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/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/common/image-icon/index.js +4 -9
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- 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/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/common/image-icon/index.js +1 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- 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/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/common/image-icon/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- 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/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/types.d.ts +1 -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/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/types.d.ts +1 -0
- package/package.json +4 -4
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
2
1
|
"use strict";
|
|
3
2
|
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
4
|
Object.defineProperty(exports, "__esModule", {
|
|
7
5
|
value: true
|
|
8
6
|
});
|
|
9
7
|
exports.default = void 0;
|
|
10
|
-
var
|
|
11
|
-
var _runtime = require("@compiled/react/runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
9
|
var _reactRenderImage = _interopRequireDefault(require("react-render-image"));
|
|
13
10
|
var _loadingSkeleton = _interopRequireDefault(require("../loading-skeleton"));
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
11
|
var ImageIcon = function ImageIcon(_ref) {
|
|
17
12
|
var defaultIcon = _ref.defaultIcon,
|
|
18
13
|
testId = _ref.testId,
|
|
19
14
|
url = _ref.url,
|
|
20
15
|
onError = _ref.onError,
|
|
21
16
|
onLoad = _ref.onLoad;
|
|
22
|
-
return /*#__PURE__*/
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_reactRenderImage.default, {
|
|
23
18
|
src: url,
|
|
24
|
-
loading: /*#__PURE__*/
|
|
19
|
+
loading: /*#__PURE__*/_react.default.createElement(_loadingSkeleton.default, {
|
|
25
20
|
testId: "".concat(testId, "-loading")
|
|
26
21
|
})
|
|
27
22
|
// eslint-disable-next-line jsx-a11y/alt-text
|
|
28
23
|
,
|
|
29
|
-
loaded: /*#__PURE__*/
|
|
24
|
+
loaded: /*#__PURE__*/_react.default.createElement("img", {
|
|
30
25
|
src: url,
|
|
31
26
|
"data-testid": "".concat(testId, "-image")
|
|
32
27
|
}),
|
|
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
20
20
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
21
21
|
var PACKAGE_DATA = {
|
|
22
22
|
packageName: "@atlaskit/smart-card",
|
|
23
|
-
packageVersion: "34.
|
|
23
|
+
packageVersion: "34.3.0",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "34.
|
|
5
|
+
packageVersion: "34.3.0"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
3
|
import { SmartLinkSize } from '../../../../../constants';
|
|
6
4
|
import ActionButton from './action-button';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import
|
|
4
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { lazy, useCallback } from 'react';
|
|
2
|
+
import React, { lazy, useCallback } from 'react';
|
|
6
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
4
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
8
5
|
import { messages } from '../../../../../messages';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
._zulp1j6v{gap:1rem}
|
|
3
|
+
._zulp1k92{gap:1.25rem}
|
|
4
|
+
._zulp1kwk{gap:.5rem}
|
|
5
|
+
._zulp6mu8{gap:.25rem}._12ji1kw7{outline-color:inherit}
|
|
6
|
+
._12ji1snc{outline-color:currentColor!important}
|
|
7
|
+
._12y310yn{outline-width:medium!important}
|
|
8
|
+
._181uglyw{-webkit-user-select:none}
|
|
9
|
+
._18m915vq{overflow-y:hidden}
|
|
10
|
+
._18ql1j28{-webkit-tap-highlight-color:transparent}
|
|
11
|
+
._1bah1y6m{justify-content:flex-start}
|
|
12
|
+
._1e0c1txw{display:flex}
|
|
13
|
+
._1ifmglyw{-webkit-touch-callout:none}
|
|
14
|
+
._1ljq1j6v [data-separator]+[data-separator]:before{margin-right:1rem}
|
|
15
|
+
._1ljq1k92 [data-separator]+[data-separator]:before{margin-right:1.25rem}
|
|
16
|
+
._1ljq1kwk [data-separator]+[data-separator]:before{margin-right:.5rem}
|
|
17
|
+
._1ljq6mu8 [data-separator]+[data-separator]:before{margin-right:.25rem}
|
|
18
|
+
._1ouwidpf>*{min-width:0}
|
|
19
|
+
._1qu2agmp{outline-style:none!important}
|
|
20
|
+
._1reo15vq{overflow-x:hidden}
|
|
21
|
+
._1rkwglyw{-moz-user-select:none}
|
|
22
|
+
._1ul9idpf{min-width:0}
|
|
23
|
+
._1uzp1mp2 [data-separator]+[data-separator]:before{content:"•"}
|
|
24
|
+
._2lx21bp4{flex-direction:column}
|
|
25
|
+
._2lx2vrvc{flex-direction:row}
|
|
26
|
+
._4cvr1h6o{align-items:center}
|
|
27
|
+
._4cvr1y6m{align-items:flex-start}
|
|
28
|
+
._a7e8uxlv [data-smart-element=TargetBranch]+[data-smart-element=SourceBranch]:before{content:"←"}
|
|
29
|
+
._f6ju1ns9>[data-fit-to-content]{min-width:-moz-fit-content;min-width:fit-content}
|
|
30
|
+
._fiawglyw:empty{display:none}
|
|
31
|
+
._syaz1kw7{color:inherit}
|
|
32
|
+
._te17glyw{-ms-user-select:none}
|
|
33
|
+
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
34
|
+
._ytq1bjq5 [data-smart-element=SourceBranch]+[data-smart-element=TargetBranch]:before{content:"→"}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[data-smart-element='${ElementName.SourceBranch}']
|
|
23
|
-
+ [data-smart-element='${ElementName.TargetBranch}']:before {
|
|
24
|
-
content: '→';
|
|
25
|
-
}
|
|
26
|
-
// Pull request elements: target branch ← source branch
|
|
27
|
-
[data-smart-element='${ElementName.TargetBranch}']
|
|
28
|
-
+ [data-smart-element='${ElementName.SourceBranch}']:before {
|
|
29
|
-
content: '←';
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
|
|
8
|
+
import { renderChildren } from '../utils';
|
|
9
|
+
import BlockOld from './indexOld';
|
|
10
|
+
const BaseBlockStyles = null;
|
|
11
|
+
const highlightRemoveStyles = null;
|
|
12
|
+
const gapsStyles = {
|
|
13
|
+
xlarge: "_zulp1k92 _1ljq1k92",
|
|
14
|
+
large: "_zulp1j6v _1ljq1j6v",
|
|
15
|
+
medium: "_zulp1kwk _1ljq1kwk",
|
|
16
|
+
small: "_zulp6mu8 _1ljq6mu8"
|
|
17
|
+
};
|
|
18
|
+
const directionStyles = {
|
|
19
|
+
vertical: "_2lx21bp4 _4cvr1y6m",
|
|
20
|
+
horizontal: "_2lx2vrvc _4cvr1h6o"
|
|
21
|
+
};
|
|
32
22
|
|
|
33
23
|
/**
|
|
34
24
|
* A block represents a collection of elements and actions that are arranged
|
|
@@ -42,7 +32,7 @@ const Block = ({
|
|
|
42
32
|
direction = SmartLinkDirection.Horizontal,
|
|
43
33
|
size = SmartLinkSize.Medium,
|
|
44
34
|
testId = 'smart-block',
|
|
45
|
-
|
|
35
|
+
className,
|
|
46
36
|
blockRef,
|
|
47
37
|
onRender,
|
|
48
38
|
onTransitionEnd
|
|
@@ -50,13 +40,20 @@ const Block = ({
|
|
|
50
40
|
useEffect(() => {
|
|
51
41
|
onRender && onRender();
|
|
52
42
|
}, [onRender]);
|
|
53
|
-
return
|
|
54
|
-
// eslint-disable-next-line @atlaskit/
|
|
55
|
-
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
45
|
+
className: ax(["_1reo15vq _18m915vq _4cvr1h6o _1e0c1txw _1ul9idpf _1bah1y6m _fiawglyw _1ouwidpf _f6ju1ns9 _1uzp1mp2 _ytq1bjq5 _a7e8uxlv", "_12ji1snc _1qu2agmp _12y310yn _12ji1kw7 _syaz1kw7 _18ql1j28 _1ifmglyw _181uglyw _1rkwglyw _te17glyw _uiztglyw", directionStyles[direction], gapsStyles[size], className]),
|
|
56
46
|
"data-smart-block": true,
|
|
57
47
|
"data-testid": testId,
|
|
58
48
|
onTransitionEnd: onTransitionEnd,
|
|
59
49
|
ref: blockRef
|
|
60
50
|
}, renderChildren(children, size));
|
|
61
51
|
};
|
|
62
|
-
|
|
52
|
+
const Exported = props => {
|
|
53
|
+
if (fg('bandicoots-compiled-migration-smartcard')) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(Block, props);
|
|
55
|
+
} else {
|
|
56
|
+
return /*#__PURE__*/React.createElement(BlockOld, props);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export default Exported;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
+
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
|
|
10
|
+
import { getBaseStyles, getGapSize, highlightRemoveStyles, renderChildren } from '../utils';
|
|
11
|
+
const getBlockStyles = (direction, size
|
|
12
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
13
|
+
) => css`
|
|
14
|
+
${getBaseStyles(direction, size)}
|
|
15
|
+
${highlightRemoveStyles}
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
[data-separator] + [data-separator]:before {
|
|
18
|
+
content: '•';
|
|
19
|
+
margin-right: ${getGapSize(size)}rem;
|
|
20
|
+
}
|
|
21
|
+
// Pull request elements: source branch → target branch
|
|
22
|
+
[data-smart-element='${ElementName.SourceBranch}']
|
|
23
|
+
+ [data-smart-element='${ElementName.TargetBranch}']:before {
|
|
24
|
+
content: '→';
|
|
25
|
+
}
|
|
26
|
+
// Pull request elements: target branch ← source branch
|
|
27
|
+
[data-smart-element='${ElementName.TargetBranch}']
|
|
28
|
+
+ [data-smart-element='${ElementName.SourceBranch}']:before {
|
|
29
|
+
content: '←';
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A block represents a collection of elements and actions that are arranged
|
|
35
|
+
* in a row. All elements and actions should be contained within a Block.
|
|
36
|
+
* @internal
|
|
37
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
38
|
+
* @see Action
|
|
39
|
+
*/
|
|
40
|
+
const Block = ({
|
|
41
|
+
children,
|
|
42
|
+
direction = SmartLinkDirection.Horizontal,
|
|
43
|
+
size = SmartLinkSize.Medium,
|
|
44
|
+
testId = 'smart-block',
|
|
45
|
+
overrideCss,
|
|
46
|
+
blockRef,
|
|
47
|
+
onRender,
|
|
48
|
+
onTransitionEnd
|
|
49
|
+
}) => {
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
onRender && onRender();
|
|
52
|
+
}, [onRender]);
|
|
53
|
+
return jsx("div", {
|
|
54
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
55
|
+
css: [getBlockStyles(direction, size), overrideCss],
|
|
56
|
+
"data-smart-block": true,
|
|
57
|
+
"data-testid": testId,
|
|
58
|
+
onTransitionEnd: onTransitionEnd,
|
|
59
|
+
ref: blockRef
|
|
60
|
+
}, renderChildren(children, size));
|
|
61
|
+
};
|
|
62
|
+
export default Block;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
4
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
5
|
+
import PreviewBlockOld from './indexOld';
|
|
9
6
|
import PreviewBlockResolvedView from './resolved';
|
|
10
7
|
/**
|
|
11
8
|
* Represents a PreviewBlock, which typically contains media or other large format content.
|
|
@@ -20,9 +17,16 @@ const PreviewBlock = ({
|
|
|
20
17
|
overrideUrl,
|
|
21
18
|
...blockProps
|
|
22
19
|
}) => {
|
|
23
|
-
return
|
|
20
|
+
return /*#__PURE__*/React.createElement(PreviewBlockResolvedView, _extends({}, blockProps, {
|
|
24
21
|
testId: testId,
|
|
25
22
|
overrideUrl: overrideUrl
|
|
26
23
|
}));
|
|
27
24
|
};
|
|
28
|
-
|
|
25
|
+
const Exported = props => {
|
|
26
|
+
if (fg('bandicoots-compiled-migration-smartcard')) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(PreviewBlock, props);
|
|
28
|
+
} else {
|
|
29
|
+
return /*#__PURE__*/React.createElement(PreviewBlockOld, props);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export default Exported;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { jsx } from '@emotion/react';
|
|
8
|
+
import { SmartLinkStatus } from '../../../../../constants';
|
|
9
|
+
import PreviewBlockResolvedView from './resolved/indexOld';
|
|
10
|
+
/**
|
|
11
|
+
* Represents a PreviewBlock, which typically contains media or other large format content.
|
|
12
|
+
* @public
|
|
13
|
+
* @param {PreviewBlockProps} PreviewBlock
|
|
14
|
+
* @see Block
|
|
15
|
+
*/
|
|
16
|
+
const PreviewBlock = ({
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
|
+
status = SmartLinkStatus.Fallback,
|
|
19
|
+
testId = 'smart-block-preview',
|
|
20
|
+
overrideUrl,
|
|
21
|
+
...blockProps
|
|
22
|
+
}) => {
|
|
23
|
+
return jsx(PreviewBlockResolvedView, _extends({}, blockProps, {
|
|
24
|
+
testId: testId,
|
|
25
|
+
overrideUrl: overrideUrl
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
export default PreviewBlock;
|
package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.compiled.css
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
._10aa1osq [data-smart-element-media=image]{width:100%}
|
|
2
|
+
._154iidpf{top:0}
|
|
3
|
+
._18u01ivi{margin-left:calc(var(--container-gap-left)*-1)}
|
|
4
|
+
._1bsb795p{width:calc(var(--preview-block-width))}
|
|
5
|
+
._1ltvidpf{left:0}
|
|
6
|
+
._1t26n7od [data-smart-element-media=image]{aspect-ratio:unset}
|
|
7
|
+
._1xi2idpf{right:0}
|
|
8
|
+
._2hwxc10g{margin-right:calc(var(--container-gap-right)*-1)}
|
|
9
|
+
._94n5idpf{bottom:0}
|
|
10
|
+
._dmhj1ya9:last-of-type{margin-bottom:calc(var(--container-padding)*-1)}
|
|
11
|
+
._e0oi1ya9:first-of-type{margin-top:calc(var(--container-padding)*-1)}
|
|
12
|
+
._kqswstnw{position:absolute}
|
|
13
|
+
._mr051dfr [data-smart-element-media=image]{object-fit:cover}
|
|
14
|
+
._rjuj1osq [data-smart-element-media=image]{height:100%}
|
|
15
|
+
._ze72n7od [data-smart-element-media=image]{padding-top:unset}
|
|
@@ -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;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import ImageLoader from 'react-render-image';
|
|
5
3
|
import LoadingSkeleton from '../loading-skeleton';
|
|
6
4
|
const ImageIcon = ({
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "34.
|
|
13
|
+
packageVersion: "34.3.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "34.
|
|
7
|
+
packageVersion: "34.3.0"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
3
|
import { SmartLinkSize } from '../../../../../constants';
|
|
6
4
|
import ActionButton from './action-button';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
3
|
var _excluded = ["onClick"];
|
|
5
|
-
import
|
|
6
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
-
import { lazy, useCallback } from 'react';
|
|
4
|
+
import React, { lazy, useCallback } from 'react';
|
|
8
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
6
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
10
7
|
import { messages } from '../../../../../messages';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
._zulp1j6v{gap:1rem}
|
|
3
|
+
._zulp1k92{gap:1.25rem}
|
|
4
|
+
._zulp1kwk{gap:.5rem}
|
|
5
|
+
._zulp6mu8{gap:.25rem}._12ji1kw7{outline-color:inherit}
|
|
6
|
+
._12ji1snc{outline-color:currentColor!important}
|
|
7
|
+
._12y310yn{outline-width:medium!important}
|
|
8
|
+
._181uglyw{-webkit-user-select:none}
|
|
9
|
+
._18m915vq{overflow-y:hidden}
|
|
10
|
+
._18ql1j28{-webkit-tap-highlight-color:transparent}
|
|
11
|
+
._1bah1y6m{justify-content:flex-start}
|
|
12
|
+
._1e0c1txw{display:flex}
|
|
13
|
+
._1ifmglyw{-webkit-touch-callout:none}
|
|
14
|
+
._1ljq1j6v [data-separator]+[data-separator]:before{margin-right:1rem}
|
|
15
|
+
._1ljq1k92 [data-separator]+[data-separator]:before{margin-right:1.25rem}
|
|
16
|
+
._1ljq1kwk [data-separator]+[data-separator]:before{margin-right:.5rem}
|
|
17
|
+
._1ljq6mu8 [data-separator]+[data-separator]:before{margin-right:.25rem}
|
|
18
|
+
._1ouwidpf>*{min-width:0}
|
|
19
|
+
._1qu2agmp{outline-style:none!important}
|
|
20
|
+
._1reo15vq{overflow-x:hidden}
|
|
21
|
+
._1rkwglyw{-moz-user-select:none}
|
|
22
|
+
._1ul9idpf{min-width:0}
|
|
23
|
+
._1uzp1mp2 [data-separator]+[data-separator]:before{content:"•"}
|
|
24
|
+
._2lx21bp4{flex-direction:column}
|
|
25
|
+
._2lx2vrvc{flex-direction:row}
|
|
26
|
+
._4cvr1h6o{align-items:center}
|
|
27
|
+
._4cvr1y6m{align-items:flex-start}
|
|
28
|
+
._a7e8uxlv [data-smart-element=TargetBranch]+[data-smart-element=SourceBranch]:before{content:"←"}
|
|
29
|
+
._f6ju1ns9>[data-fit-to-content]{min-width:-moz-fit-content;min-width:fit-content}
|
|
30
|
+
._fiawglyw:empty{display:none}
|
|
31
|
+
._syaz1kw7{color:inherit}
|
|
32
|
+
._te17glyw{-ms-user-select:none}
|
|
33
|
+
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
34
|
+
._ytq1bjq5 [data-smart-element=SourceBranch]+[data-smart-element=TargetBranch]:before{content:"→"}
|