@atlaskit/smart-card 34.1.1 → 34.2.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/EmbedCard/components/IFrame.js +6 -3
  4. package/dist/cjs/view/EmbedModal/components/embed-content/index.compiled.css +2 -0
  5. package/dist/cjs/view/EmbedModal/components/embed-content/index.js +23 -14
  6. package/dist/cjs/view/EmbedModal/components/embed-content/indexOld.js +37 -0
  7. package/dist/cjs/view/EmbedModal/components/link-info/index.compiled.css +35 -0
  8. package/dist/cjs/view/EmbedModal/components/link-info/index.js +58 -49
  9. package/dist/cjs/view/EmbedModal/components/link-info/indexOld.js +131 -0
  10. package/dist/cjs/view/FlexibleCard/components/container/index.compiled.css +38 -0
  11. package/dist/cjs/view/FlexibleCard/components/container/index.js +94 -87
  12. package/dist/cjs/view/FlexibleCard/components/container/indexOld.js +226 -0
  13. package/dist/cjs/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.js +75 -0
  14. package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.compiled.css +11 -0
  15. package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +20 -46
  16. package/dist/cjs/view/LinkUrl/index.js +1 -1
  17. package/dist/es2019/utils/analytics/analytics.js +1 -1
  18. package/dist/es2019/view/EmbedCard/components/IFrame.js +5 -2
  19. package/dist/es2019/view/EmbedModal/components/embed-content/index.compiled.css +2 -0
  20. package/dist/es2019/view/EmbedModal/components/embed-content/index.js +19 -13
  21. package/dist/es2019/view/EmbedModal/components/embed-content/indexOld.js +31 -0
  22. package/dist/es2019/view/EmbedModal/components/link-info/index.compiled.css +35 -0
  23. package/dist/es2019/view/EmbedModal/components/link-info/index.js +59 -49
  24. package/dist/es2019/view/EmbedModal/components/link-info/indexOld.js +122 -0
  25. package/dist/es2019/view/FlexibleCard/components/container/index.compiled.css +38 -0
  26. package/dist/es2019/view/FlexibleCard/components/container/index.js +88 -105
  27. package/dist/es2019/view/FlexibleCard/components/container/indexOld.js +229 -0
  28. package/dist/es2019/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.js +69 -0
  29. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.compiled.css +11 -0
  30. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +16 -45
  31. package/dist/es2019/view/LinkUrl/index.js +1 -1
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/EmbedCard/components/IFrame.js +6 -3
  34. package/dist/esm/view/EmbedModal/components/embed-content/index.compiled.css +2 -0
  35. package/dist/esm/view/EmbedModal/components/embed-content/index.js +19 -13
  36. package/dist/esm/view/EmbedModal/components/embed-content/indexOld.js +30 -0
  37. package/dist/esm/view/EmbedModal/components/link-info/index.compiled.css +35 -0
  38. package/dist/esm/view/EmbedModal/components/link-info/index.js +59 -49
  39. package/dist/esm/view/EmbedModal/components/link-info/indexOld.js +120 -0
  40. package/dist/esm/view/FlexibleCard/components/container/index.compiled.css +38 -0
  41. package/dist/esm/view/FlexibleCard/components/container/index.js +88 -87
  42. package/dist/esm/view/FlexibleCard/components/container/indexOld.js +217 -0
  43. package/dist/esm/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.js +68 -0
  44. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.compiled.css +11 -0
  45. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +16 -45
  46. package/dist/esm/view/LinkUrl/index.js +1 -1
  47. package/dist/types/view/EmbedCard/components/IFrame.d.ts +2 -1
  48. package/dist/types/view/EmbedModal/components/embed-content/index.d.ts +3 -7
  49. package/dist/types/view/EmbedModal/components/embed-content/indexOld.d.ts +8 -0
  50. package/dist/types/view/EmbedModal/components/link-info/index.d.ts +3 -3
  51. package/dist/types/view/EmbedModal/components/link-info/indexOld.d.ts +4 -0
  52. package/dist/types/view/FlexibleCard/components/container/index.d.ts +10 -10
  53. package/dist/types/view/FlexibleCard/components/container/indexOld.d.ts +24 -0
  54. package/dist/types/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.d.ts +13 -0
  55. package/dist/types/view/FlexibleCard/components/container/layered-link/index.d.ts +2 -11
  56. package/dist/types-ts4.5/view/EmbedCard/components/IFrame.d.ts +2 -1
  57. package/dist/types-ts4.5/view/EmbedModal/components/embed-content/index.d.ts +3 -7
  58. package/dist/types-ts4.5/view/EmbedModal/components/embed-content/indexOld.d.ts +8 -0
  59. package/dist/types-ts4.5/view/EmbedModal/components/link-info/index.d.ts +3 -3
  60. package/dist/types-ts4.5/view/EmbedModal/components/link-info/indexOld.d.ts +4 -0
  61. package/dist/types-ts4.5/view/FlexibleCard/components/container/index.d.ts +10 -10
  62. package/dist/types-ts4.5/view/FlexibleCard/components/container/indexOld.d.ts +24 -0
  63. package/dist/types-ts4.5/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.d.ts +13 -0
  64. package/dist/types-ts4.5/view/FlexibleCard/components/container/layered-link/index.d.ts +2 -11
  65. package/package.json +1 -1
  66. /package/dist/cjs/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  67. /package/dist/es2019/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  68. /package/dist/esm/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  69. /package/dist/types/view/EmbedModal/components/link-info/{styled.d.ts → styledOld.d.ts} +0 -0
  70. /package/dist/types-ts4.5/view/EmbedModal/components/link-info/{styled.d.ts → styledOld.d.ts} +0 -0
@@ -1,87 +1,24 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- /**
4
- * @jsxRuntime classic
5
- * @jsx jsx
6
- */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.35.0 */
2
+ /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
3
+ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
4
+ import "./index.compiled.css";
5
+ import { ax, ix } from "@compiled/react/runtime";
7
6
  import React, { useContext } from 'react';
8
-
9
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
- import { css, jsx } from '@emotion/react';
11
7
  import { di } from 'react-magnetic-di';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
12
9
  import { N40 } from '@atlaskit/theme/colors';
13
10
  import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
14
11
  import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
15
12
  import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
16
13
  import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
17
14
  import HoverCardControl from './hover-card-control';
15
+ import ContainerOld from './indexOld';
18
16
  import LayeredLink from './layered-link';
19
- var elevationStyles = css({
20
- border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
21
- borderRadius: "var(--ds-border-radius-200, 8px)",
22
- margin: "var(--ds-space-025, 2px)"
23
- });
24
- var getGap = function getGap(size) {
25
- switch (size) {
26
- case SmartLinkSize.XLarge:
27
- return '1.25rem';
28
- case SmartLinkSize.Large:
29
- return '1rem';
30
- case SmartLinkSize.Medium:
31
- return '.5rem';
32
- case SmartLinkSize.Small:
33
- default:
34
- return '.25rem';
35
- }
36
- };
37
-
38
17
  /**
39
- * Get container padding based on smart link size
40
- * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
41
- * at view/FlexibleCard/components/utils.tsx
18
+ * Eventually these exports should be removed on FF clean up bandicoots-compiled-migration-smartcard
42
19
  */
43
- var getPadding = function getPadding(size) {
44
- switch (size) {
45
- case SmartLinkSize.XLarge:
46
- return '1.5rem';
47
- case SmartLinkSize.Large:
48
- return '1.25rem';
49
- case SmartLinkSize.Medium:
50
- return '1rem';
51
- case SmartLinkSize.Small:
52
- default:
53
- return '.5rem';
54
- }
55
- };
56
- var clickableContainerStyles = css({
57
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
58
- 'a, button, .has-action': {
59
- position: 'relative',
60
- zIndex: 1
61
- }
62
- });
63
- var getContainerPaddingStyles = function getContainerPaddingStyles(size, hidePadding, childrenOptions) {
64
- var padding = hidePadding ? '0rem' : getPadding(size);
65
- var gap = getGap(size);
66
- var previewOnLeft = childrenOptions.previewOnLeft,
67
- previewOnRight = childrenOptions.previewOnRight;
68
- return css({
69
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
70
- '--container-padding': padding,
71
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
72
- '--container-gap-left': previewOnLeft ? gap : padding,
73
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
74
- '--container-gap-right': previewOnRight ? gap : padding,
75
- '--preview-block-width': '30%',
76
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
77
- padding: padding
78
- },
79
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
80
- previewOnLeft ? "padding-left: calc(var(--preview-block-width) + ".concat(gap, ");") : '',
81
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
82
- previewOnRight ? "padding-right: calc(var(--preview-block-width) + ".concat(gap, ");") : '');
83
- };
84
- var getChildrenOptions = function getChildrenOptions(children, context) {
20
+ export { getContainerStyles } from './indexOld';
21
+ export var getChildrenOptions = function getChildrenOptions(children, context) {
85
22
  var options = {};
86
23
  if (isFlexUiPreviewPresent(context)) {
87
24
  React.Children.map(children, function (child) {
@@ -100,12 +37,6 @@ var getChildrenOptions = function getChildrenOptions(children, context) {
100
37
  }
101
38
  return options;
102
39
  };
103
- export var getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) {
104
- var paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
105
-
106
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
107
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tdisplay: flex;\n\t\tgap: ", " 0;\n\t\tflex-direction: column;\n\t\tmin-width: 0;\n\t\toverflow-x: hidden;\n\t\tposition: relative;\n\t\t", "\n\t\t", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n\t\t\topacity: 1;\n\t\t}\n\t\ta:focus,\n\t\t.has-action:focus {\n\t\t\toutline-offset: -2px;\n\t\t}\n\t"])), getGap(size), hideBackground ? '' : "background-color: ".concat("var(--ds-surface-raised, #FFFFFF)", ";"), paddingCss, hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
108
- };
109
40
  var renderChildren = function renderChildren(children, containerSize, containerTheme, status, retry, onClick) {
110
41
  return React.Children.map(children, function (child) {
111
42
  // TODO: EDM-6468: Use useFlexibleUiOptionContext for rendering options inside block/element instead
@@ -146,7 +77,7 @@ var getLayeredLink = function getLayeredLink(testId, context, children, onClick)
146
77
  var _ref2 = getTitleBlockProps(children) || {},
147
78
  target = _ref2.anchorTarget,
148
79
  text = _ref2.text;
149
- return jsx(LayeredLink, {
80
+ return /*#__PURE__*/React.createElement(LayeredLink, {
150
81
  onClick: onClick,
151
82
  target: target,
152
83
  testId: testId,
@@ -154,6 +85,60 @@ var getLayeredLink = function getLayeredLink(testId, context, children, onClick)
154
85
  url: url
155
86
  });
156
87
  };
88
+ var baseStyleCommon = null;
89
+ var backgroundStyle = null;
90
+ var elevationStyles = null;
91
+ var clickableContainerStyles = null;
92
+ var gapStyleMap = {
93
+ xlarge: "_zulp1jvo",
94
+ large: "_zulph3jc",
95
+ medium: "_zulp1qos",
96
+ small: "_zulpfzsm"
97
+ };
98
+
99
+ /**
100
+ * Get container padding based on smart link size
101
+ * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
102
+ * at view/FlexibleCard/components/utils.tsx
103
+ */
104
+ var getPadding = function getPadding(size) {
105
+ switch (size) {
106
+ case SmartLinkSize.XLarge:
107
+ return '1.5rem';
108
+ case SmartLinkSize.Large:
109
+ return '1.25rem';
110
+ case SmartLinkSize.Medium:
111
+ return '1rem';
112
+ case SmartLinkSize.Small:
113
+ default:
114
+ return '.5rem';
115
+ }
116
+ };
117
+ var getGap = function getGap(size) {
118
+ switch (size) {
119
+ case SmartLinkSize.XLarge:
120
+ return '1.25rem';
121
+ case SmartLinkSize.Large:
122
+ return '1rem';
123
+ case SmartLinkSize.Medium:
124
+ return '.5rem';
125
+ case SmartLinkSize.Small:
126
+ default:
127
+ return '.25rem';
128
+ }
129
+ };
130
+ var previewOnLeftStyleMap = {
131
+ xlarge: "_19bv15sf _y5vk1k92",
132
+ large: "_19bvf557 _y5vk1j6v",
133
+ medium: "_19bvqox2 _y5vk1kwk",
134
+ small: "_19bv1ltm _y5vk6mu8"
135
+ };
136
+ var previewOnRightStyleMap = {
137
+ xlarge: "_u5f315sf _1yob1k92",
138
+ large: "_u5f3f557 _1yob1j6v",
139
+ medium: "_u5f3qox2 _1yob1kwk",
140
+ small: "_u5f31ltm _1yob6mu8"
141
+ };
157
142
 
158
143
  /**
159
144
  * A container is a hidden component that build the Flexible Smart Link.
@@ -163,7 +148,7 @@ var getLayeredLink = function getLayeredLink(testId, context, children, onClick)
163
148
  * @internal
164
149
  * @see Block
165
150
  */
166
- var Container = function Container(_ref3) {
151
+ var ContainerNew = function ContainerNew(_ref3) {
167
152
  var children = _ref3.children,
168
153
  _ref3$clickableContai = _ref3.clickableContainer,
169
154
  clickableContainer = _ref3$clickableContai === void 0 ? false : _ref3$clickableContai,
@@ -186,20 +171,30 @@ var Container = function Container(_ref3) {
186
171
  testId = _ref3$testId === void 0 ? 'smart-links-container' : _ref3$testId,
187
172
  _ref3$theme = _ref3.theme,
188
173
  theme = _ref3$theme === void 0 ? SmartLinkTheme.Link : _ref3$theme;
174
+ var padding = hidePadding ? '0rem' : getPadding(size);
175
+ var gap = getGap(size);
189
176
  var context = useContext(FlexibleUiContext);
190
- var childrenOptions = getChildrenOptions(children, context);
177
+ var _getChildrenOptions = getChildrenOptions(children, context),
178
+ previewOnLeft = _getChildrenOptions.previewOnLeft,
179
+ previewOnRight = _getChildrenOptions.previewOnRight;
191
180
  var canShowHoverPreview = showHoverPreview && status === 'resolved';
192
181
  // `retry` object contains action that can be performed on
193
182
  // unresolved link (unauthorized, forbidden, not found, etc.)
194
183
  var canShowAuthTooltip = showHoverPreview && status === 'unauthorized' && retry !== undefined;
195
- var container = jsx("div", {
196
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
197
- css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
184
+ var containerPaddingStyles = null;
185
+ var container = /*#__PURE__*/React.createElement("div", {
198
186
  "data-smart-link-container": true,
199
- "data-testid": testId
187
+ "data-testid": testId,
188
+ className: ax(["_1e0c1txw _2lx21bp4 _1ul9idpf _1reo15vq _kqswh2mm _1pcmkb7n _1v7y1i6y _ufn21i6y", gapStyleMap[size], !hideBackground && "_bfhkhp5a", "_1yt418y6 _jb7v18y6 _y5vk167t _1yob1wow _r37x1r5k", previewOnLeft && previewOnLeftStyleMap[size], previewOnRight && previewOnRightStyleMap[size], !hideElevation && "_19itn8v0 _2rkopd34 _18s8v77o", clickableContainer && "_nqwih2mm _18ywh2mm _1nq3h2mm _1t4ckb7n _1nxdkb7n _xnbykb7n"]),
189
+ style: {
190
+ "--_1xumd0e": ix(padding),
191
+ "--_73mooq": ix(previewOnLeft ? gap : padding),
192
+ "--_12k13bg": ix(previewOnRight ? gap : padding),
193
+ "--_vzvmm2": ix("1px solid ".concat("var(--ds-border, ".concat(N40, ")")))
194
+ }
200
195
  }, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
201
196
  if (context !== null && context !== void 0 && context.url && (canShowHoverPreview || canShowAuthTooltip)) {
202
- return jsx(HoverCardControl, {
197
+ return /*#__PURE__*/React.createElement(HoverCardControl, {
203
198
  isHoverPreview: canShowHoverPreview,
204
199
  isAuthTooltip: canShowAuthTooltip,
205
200
  actionOptions: actionOptions,
@@ -210,4 +205,10 @@ var Container = function Container(_ref3) {
210
205
  }
211
206
  return container;
212
207
  };
208
+ var Container = function Container(props) {
209
+ if (fg('bandicoots-compiled-migration-smartcard')) {
210
+ return /*#__PURE__*/React.createElement(ContainerNew, props);
211
+ }
212
+ return /*#__PURE__*/React.createElement(ContainerOld, props);
213
+ };
213
214
  export default Container;
@@ -0,0 +1,217 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ /**
4
+ * @jsxRuntime classic
5
+ * @jsx jsx
6
+ */
7
+ import React, { useContext } from 'react';
8
+
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
+ import { css, jsx } from '@emotion/react';
11
+ import { di } from 'react-magnetic-di';
12
+ import { N40 } from '@atlaskit/theme/colors';
13
+ import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
14
+ import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
15
+ import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
16
+ import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
17
+ import HoverCardControl from './hover-card-control';
18
+ import LayeredLink from './layered-link';
19
+ var elevationStyles = css({
20
+ border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
21
+ borderRadius: "var(--ds-border-radius-200, 8px)",
22
+ margin: "var(--ds-space-025, 2px)"
23
+ });
24
+ var clickableContainerStyles = css({
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
26
+ 'a, button, .has-action': {
27
+ position: 'relative',
28
+ zIndex: 1
29
+ }
30
+ });
31
+ var getGap = function getGap(size) {
32
+ switch (size) {
33
+ case SmartLinkSize.XLarge:
34
+ return '1.25rem';
35
+ case SmartLinkSize.Large:
36
+ return '1rem';
37
+ case SmartLinkSize.Medium:
38
+ return '.5rem';
39
+ case SmartLinkSize.Small:
40
+ default:
41
+ return '.25rem';
42
+ }
43
+ };
44
+
45
+ /**
46
+ * Get container padding based on smart link size
47
+ * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
48
+ * at view/FlexibleCard/components/utils.tsx
49
+ */
50
+ var getPadding = function getPadding(size) {
51
+ switch (size) {
52
+ case SmartLinkSize.XLarge:
53
+ return '1.5rem';
54
+ case SmartLinkSize.Large:
55
+ return '1.25rem';
56
+ case SmartLinkSize.Medium:
57
+ return '1rem';
58
+ case SmartLinkSize.Small:
59
+ default:
60
+ return '.5rem';
61
+ }
62
+ };
63
+ var getContainerPaddingStyles = function getContainerPaddingStyles(size, hidePadding, childrenOptions) {
64
+ var padding = hidePadding ? '0rem' : getPadding(size);
65
+ var gap = getGap(size);
66
+ var previewOnLeft = childrenOptions.previewOnLeft,
67
+ previewOnRight = childrenOptions.previewOnRight;
68
+ return css({
69
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
70
+ '--container-padding': padding,
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
72
+ '--container-gap-left': previewOnLeft ? gap : padding,
73
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
74
+ '--container-gap-right': previewOnRight ? gap : padding,
75
+ '--preview-block-width': '30%',
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
77
+ padding: padding
78
+ },
79
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
80
+ previewOnLeft ? "padding-left: calc(var(--preview-block-width) + ".concat(gap, ");") : '',
81
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
82
+ previewOnRight ? "padding-right: calc(var(--preview-block-width) + ".concat(gap, ");") : '');
83
+ };
84
+
85
+ /**
86
+ * @deprecated consider removing on FF bandicoots-compiled-migration-smartcard
87
+ */
88
+ export var getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) {
89
+ var paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
90
+
91
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
92
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tdisplay: flex;\n\t\tgap: ", " 0;\n\t\tflex-direction: column;\n\t\tmin-width: 0;\n\t\toverflow-x: hidden;\n\t\tposition: relative;\n\t\t", "\n\t\t", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n\t\t\topacity: 1;\n\t\t}\n\t\ta:focus,\n\t\t.has-action:focus {\n\t\t\toutline-offset: -2px;\n\t\t}\n\t"])), getGap(size), hideBackground ? '' : "background-color: ".concat("var(--ds-surface-raised, #FFFFFF)", ";"), paddingCss, hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
93
+ };
94
+ var getLayeredLink = function getLayeredLink(testId, context, children, onClick) {
95
+ var _ref = context || {},
96
+ title = _ref.title,
97
+ _ref$url = _ref.url,
98
+ url = _ref$url === void 0 ? '' : _ref$url;
99
+ var _ref2 = getTitleBlockProps(children) || {},
100
+ target = _ref2.anchorTarget,
101
+ text = _ref2.text;
102
+ return jsx(LayeredLink, {
103
+ onClick: onClick,
104
+ target: target,
105
+ testId: testId,
106
+ text: text || title,
107
+ url: url
108
+ });
109
+ };
110
+ var getTitleBlockProps = function getTitleBlockProps(children) {
111
+ var block = React.Children.toArray(children).find(function (child) {
112
+ return isFlexibleUiTitleBlock(child);
113
+ });
114
+ if ( /*#__PURE__*/React.isValidElement(block)) {
115
+ return block.props;
116
+ }
117
+ };
118
+ export var getChildrenOptions = function getChildrenOptions(children, context) {
119
+ var options = {};
120
+ if (isFlexUiPreviewPresent(context)) {
121
+ React.Children.map(children, function (child) {
122
+ if ( /*#__PURE__*/React.isValidElement(child)) {
123
+ if (isFlexibleUiPreviewBlock(child)) {
124
+ var placement = child.props.placement;
125
+ if (placement === MediaPlacement.Left) {
126
+ options.previewOnLeft = true;
127
+ }
128
+ if (placement === MediaPlacement.Right) {
129
+ options.previewOnRight = true;
130
+ }
131
+ }
132
+ }
133
+ });
134
+ }
135
+ return options;
136
+ };
137
+ var renderChildren = function renderChildren(children, containerSize, containerTheme, status, retry, onClick) {
138
+ return React.Children.map(children, function (child) {
139
+ // TODO: EDM-6468: Use useFlexibleUiOptionContext for rendering options inside block/element instead
140
+ if ( /*#__PURE__*/React.isValidElement(child) && isFlexibleUiBlock(child)) {
141
+ var blockSize = child.props.size;
142
+ var size = blockSize || containerSize;
143
+ if (isFlexibleUiTitleBlock(child)) {
144
+ return /*#__PURE__*/React.cloneElement(child, {
145
+ // @ts-expect-error
146
+ onClick: onClick,
147
+ retry: retry,
148
+ size: size,
149
+ status: status,
150
+ theme: containerTheme
151
+ });
152
+ }
153
+ // @ts-expect-error
154
+ return /*#__PURE__*/React.cloneElement(child, {
155
+ size: size,
156
+ status: status
157
+ });
158
+ }
159
+ });
160
+ };
161
+
162
+ /**
163
+ * A container is a hidden component that build the Flexible Smart Link.
164
+ * All the Flexible UI components are wrapped inside the container.
165
+ * It inherits the ui props from Card component and applies the custom styling
166
+ * accordingly.
167
+ * @internal
168
+ * @see Block
169
+ */
170
+ var ContainerOld = function ContainerOld(_ref3) {
171
+ var children = _ref3.children,
172
+ _ref3$clickableContai = _ref3.clickableContainer,
173
+ clickableContainer = _ref3$clickableContai === void 0 ? false : _ref3$clickableContai,
174
+ _ref3$hideBackground = _ref3.hideBackground,
175
+ hideBackground = _ref3$hideBackground === void 0 ? false : _ref3$hideBackground,
176
+ _ref3$hideElevation = _ref3.hideElevation,
177
+ hideElevation = _ref3$hideElevation === void 0 ? false : _ref3$hideElevation,
178
+ _ref3$hidePadding = _ref3.hidePadding,
179
+ hidePadding = _ref3$hidePadding === void 0 ? false : _ref3$hidePadding,
180
+ onClick = _ref3.onClick,
181
+ retry = _ref3.retry,
182
+ _ref3$showHoverPrevie = _ref3.showHoverPreview,
183
+ showHoverPreview = _ref3$showHoverPrevie === void 0 ? false : _ref3$showHoverPrevie,
184
+ hoverPreviewOptions = _ref3.hoverPreviewOptions,
185
+ actionOptions = _ref3.actionOptions,
186
+ _ref3$size = _ref3.size,
187
+ size = _ref3$size === void 0 ? SmartLinkSize.Medium : _ref3$size,
188
+ status = _ref3.status,
189
+ _ref3$testId = _ref3.testId,
190
+ testId = _ref3$testId === void 0 ? 'smart-links-container' : _ref3$testId,
191
+ _ref3$theme = _ref3.theme,
192
+ theme = _ref3$theme === void 0 ? SmartLinkTheme.Link : _ref3$theme;
193
+ var context = useContext(FlexibleUiContext);
194
+ var childrenOptions = getChildrenOptions(children, context);
195
+ var canShowHoverPreview = showHoverPreview && status === 'resolved';
196
+ // `retry` object contains action that can be performed on
197
+ // unresolved link (unauthorized, forbidden, not found, etc.)
198
+ var canShowAuthTooltip = showHoverPreview && status === 'unauthorized' && retry !== undefined;
199
+ var container = jsx("div", {
200
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
201
+ css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
202
+ "data-smart-link-container": true,
203
+ "data-testid": testId
204
+ }, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
205
+ if (context !== null && context !== void 0 && context.url && (canShowHoverPreview || canShowAuthTooltip)) {
206
+ return jsx(HoverCardControl, {
207
+ isHoverPreview: canShowHoverPreview,
208
+ isAuthTooltip: canShowAuthTooltip,
209
+ actionOptions: actionOptions,
210
+ testId: testId,
211
+ url: context.url,
212
+ hoverPreviewOptions: hoverPreviewOptions
213
+ }, container);
214
+ }
215
+ return container;
216
+ };
217
+ export default ContainerOld;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
+ import { css, jsx } from '@emotion/react';
7
+ import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
8
+ var styles = css({
9
+ // Stretch the invisible link over the whole of the post.
10
+ // Hide the link’s text.
11
+ top: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ left: 0,
15
+ overflow: 'hidden',
16
+ textIndent: '100%',
17
+ whiteSpace: 'nowrap',
18
+ // Needs a heightened specificity to trump other anchor.
19
+ // Stack it under all other links in the post text.
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
21
+ 'a&.layered-link': {
22
+ position: 'absolute',
23
+ zIndex: 0
24
+ },
25
+ // When hovering over the layered link, any hidden action buttons inside
26
+ // the Container should become visible.
27
+ // As actions resides inside blocks and layered link is expected to be
28
+ // on the same level of blocks. That makes the blocks, e.g. TitleBlock,
29
+ // its sibling. Using general sibling combinator here to apply styling to
30
+ // all the siblings of layered link.
31
+ // The general sibling combinator (~) separates two selectors and matches all
32
+ // iterations of the second element, that are following the first element
33
+ // (though not necessarily immediately), and are children of the same parent
34
+ // element.
35
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
36
+ '&:hover ~ *': {
37
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
38
+ '.actions-button-group': {
39
+ opacity: 1
40
+ }
41
+ }
42
+ });
43
+
44
+ /**
45
+ * An anchor component to cover the entire container creating a clickable area.
46
+ * @internal
47
+ * @see `clickableContainer`
48
+ */
49
+ var LayeredLinkOld = function LayeredLinkOld(_ref) {
50
+ var onClick = _ref.onClick,
51
+ target = _ref.target,
52
+ testId = _ref.testId,
53
+ text = _ref.text,
54
+ url = _ref.url;
55
+ var onMouseDown = useMouseDownEvent();
56
+ return jsx("a", {
57
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
58
+ className: "layered-link",
59
+ css: styles,
60
+ "data-testid": "".concat(testId, "-layered-link"),
61
+ href: url,
62
+ onClick: onClick,
63
+ onMouseDown: onMouseDown,
64
+ target: target,
65
+ tabIndex: -1 // Hide tab index and let the title link be the link.
66
+ }, text);
67
+ };
68
+ export default LayeredLinkOld;
@@ -0,0 +1,11 @@
1
+ ._154iidpf{top:0}
2
+ ._18m915vq{overflow-y:hidden}
3
+ ._1ltvidpf{left:0}
4
+ ._1reo15vq{overflow-x:hidden}
5
+ ._1xi2idpf{right:0}
6
+ ._94n5idpf{bottom:0}
7
+ ._a52dkb7n:hover~* .actions-button-group{opacity:1}
8
+ ._azhw1osq{text-indent:100%}
9
+ ._o5721q9c{white-space:nowrap}
10
+ a._hboxstnw.layered-link{position:absolute}
11
+ a._obkmidpf.layered-link{z-index:0}
@@ -1,62 +1,27 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
- import { css, jsx } from '@emotion/react';
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
+ import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
8
- var styles = css({
9
- // Stretch the invisible link over the whole of the post.
10
- // Hide the link’s text.
11
- top: 0,
12
- right: 0,
13
- bottom: 0,
14
- left: 0,
15
- overflow: 'hidden',
16
- textIndent: '100%',
17
- whiteSpace: 'nowrap',
18
- // Needs a heightened specificity to trump other anchor.
19
- // Stack it under all other links in the post text.
20
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
21
- 'a&.layered-link': {
22
- position: 'absolute',
23
- zIndex: 0
24
- },
25
- // When hovering over the layered link, any hidden action buttons inside
26
- // the Container should become visible.
27
- // As actions resides inside blocks and layered link is expected to be
28
- // on the same level of blocks. That makes the blocks, e.g. TitleBlock,
29
- // its sibling. Using general sibling combinator here to apply styling to
30
- // all the siblings of layered link.
31
- // The general sibling combinator (~) separates two selectors and matches all
32
- // iterations of the second element, that are following the first element
33
- // (though not necessarily immediately), and are children of the same parent
34
- // element.
35
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
36
- '&:hover ~ *': {
37
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
38
- '.actions-button-group': {
39
- opacity: 1
40
- }
41
- }
42
- });
7
+ import LayeredLinkOld from './LayeredLinkOld';
8
+ var styles = null;
43
9
 
44
10
  /**
45
11
  * An anchor component to cover the entire container creating a clickable area.
46
12
  * @internal
47
13
  * @see `clickableContainer`
48
14
  */
49
- var LayeredLink = function LayeredLink(_ref) {
15
+ var LayeredLinkNew = function LayeredLinkNew(_ref) {
50
16
  var onClick = _ref.onClick,
51
17
  target = _ref.target,
52
18
  testId = _ref.testId,
53
19
  text = _ref.text,
54
20
  url = _ref.url;
55
21
  var onMouseDown = useMouseDownEvent();
56
- return jsx("a", {
22
+ return /*#__PURE__*/React.createElement("a", {
57
23
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
58
- className: "layered-link",
59
- css: styles,
24
+ className: ax(["_1reo15vq _18m915vq _154iidpf _1xi2idpf _94n5idpf _1ltvidpf _azhw1osq _o5721q9c _hboxstnw _obkmidpf _a52dkb7n", "layered-link"]),
60
25
  "data-testid": "".concat(testId, "-layered-link"),
61
26
  href: url,
62
27
  onClick: onClick,
@@ -65,4 +30,10 @@ var LayeredLink = function LayeredLink(_ref) {
65
30
  tabIndex: -1 // Hide tab index and let the title link be the link.
66
31
  }, text);
67
32
  };
33
+ var LayeredLink = function LayeredLink(props) {
34
+ if (fg('bandicoots-compiled-migration-smartcard')) {
35
+ return /*#__PURE__*/React.createElement(LayeredLinkNew, props);
36
+ }
37
+ return /*#__PURE__*/React.createElement(LayeredLinkOld, props);
38
+ };
68
39
  export default LayeredLink;
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
13
13
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
14
14
  var PACKAGE_DATA = {
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "34.1.1",
16
+ packageVersion: "34.2.0",
17
17
  componentName: 'linkUrl'
18
18
  };
19
19
  var Anchor = withLinkClickedEvent('a');
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  interface IFrameProps {
3
+ className?: string;
3
4
  childRef?: React.Ref<HTMLIFrameElement>;
4
5
  }
5
6
  /**
6
7
  * Iframe element isolated for DI purposes
7
8
  */
8
- export declare const IFrame: ({ childRef, ...props }: React.ComponentProps<'iframe'> & IFrameProps) => JSX.Element;
9
+ export declare const IFrame: ({ childRef, className, ...props }: React.ComponentProps<'iframe'> & IFrameProps) => JSX.Element;
9
10
  export {};
@@ -1,8 +1,4 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
6
2
  import { type EmbedProps } from './types';
7
- declare const EmbedContent: ({ isTrusted, name, src, testId }: EmbedProps) => jsx.JSX.Element;
8
- export default EmbedContent;
3
+ declare const Exported: (props: EmbedProps) => JSX.Element;
4
+ export default Exported;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ import { type EmbedProps } from './types';
7
+ declare const EmbedContent: ({ isTrusted, name, src, testId }: EmbedProps) => jsx.JSX.Element;
8
+ export default EmbedContent;