@atlaskit/smart-card 34.1.1 → 34.2.1

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 (73) hide show
  1. package/CHANGELOG.md +14 -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/cjs/view/RelatedLinksModal/components/related-links-list/index.js +1 -0
  18. package/dist/es2019/utils/analytics/analytics.js +1 -1
  19. package/dist/es2019/view/EmbedCard/components/IFrame.js +5 -2
  20. package/dist/es2019/view/EmbedModal/components/embed-content/index.compiled.css +2 -0
  21. package/dist/es2019/view/EmbedModal/components/embed-content/index.js +19 -13
  22. package/dist/es2019/view/EmbedModal/components/embed-content/indexOld.js +31 -0
  23. package/dist/es2019/view/EmbedModal/components/link-info/index.compiled.css +35 -0
  24. package/dist/es2019/view/EmbedModal/components/link-info/index.js +59 -49
  25. package/dist/es2019/view/EmbedModal/components/link-info/indexOld.js +122 -0
  26. package/dist/es2019/view/FlexibleCard/components/container/index.compiled.css +38 -0
  27. package/dist/es2019/view/FlexibleCard/components/container/index.js +88 -105
  28. package/dist/es2019/view/FlexibleCard/components/container/indexOld.js +229 -0
  29. package/dist/es2019/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.js +69 -0
  30. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.compiled.css +11 -0
  31. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +16 -45
  32. package/dist/es2019/view/LinkUrl/index.js +1 -1
  33. package/dist/es2019/view/RelatedLinksModal/components/related-links-list/index.js +1 -0
  34. package/dist/esm/utils/analytics/analytics.js +1 -1
  35. package/dist/esm/view/EmbedCard/components/IFrame.js +6 -3
  36. package/dist/esm/view/EmbedModal/components/embed-content/index.compiled.css +2 -0
  37. package/dist/esm/view/EmbedModal/components/embed-content/index.js +19 -13
  38. package/dist/esm/view/EmbedModal/components/embed-content/indexOld.js +30 -0
  39. package/dist/esm/view/EmbedModal/components/link-info/index.compiled.css +35 -0
  40. package/dist/esm/view/EmbedModal/components/link-info/index.js +59 -49
  41. package/dist/esm/view/EmbedModal/components/link-info/indexOld.js +120 -0
  42. package/dist/esm/view/FlexibleCard/components/container/index.compiled.css +38 -0
  43. package/dist/esm/view/FlexibleCard/components/container/index.js +88 -87
  44. package/dist/esm/view/FlexibleCard/components/container/indexOld.js +217 -0
  45. package/dist/esm/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.js +68 -0
  46. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.compiled.css +11 -0
  47. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +16 -45
  48. package/dist/esm/view/LinkUrl/index.js +1 -1
  49. package/dist/esm/view/RelatedLinksModal/components/related-links-list/index.js +1 -0
  50. package/dist/types/view/EmbedCard/components/IFrame.d.ts +2 -1
  51. package/dist/types/view/EmbedModal/components/embed-content/index.d.ts +3 -7
  52. package/dist/types/view/EmbedModal/components/embed-content/indexOld.d.ts +8 -0
  53. package/dist/types/view/EmbedModal/components/link-info/index.d.ts +3 -3
  54. package/dist/types/view/EmbedModal/components/link-info/indexOld.d.ts +4 -0
  55. package/dist/types/view/FlexibleCard/components/container/index.d.ts +10 -10
  56. package/dist/types/view/FlexibleCard/components/container/indexOld.d.ts +24 -0
  57. package/dist/types/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.d.ts +13 -0
  58. package/dist/types/view/FlexibleCard/components/container/layered-link/index.d.ts +2 -11
  59. package/dist/types-ts4.5/view/EmbedCard/components/IFrame.d.ts +2 -1
  60. package/dist/types-ts4.5/view/EmbedModal/components/embed-content/index.d.ts +3 -7
  61. package/dist/types-ts4.5/view/EmbedModal/components/embed-content/indexOld.d.ts +8 -0
  62. package/dist/types-ts4.5/view/EmbedModal/components/link-info/index.d.ts +3 -3
  63. package/dist/types-ts4.5/view/EmbedModal/components/link-info/indexOld.d.ts +4 -0
  64. package/dist/types-ts4.5/view/FlexibleCard/components/container/index.d.ts +10 -10
  65. package/dist/types-ts4.5/view/FlexibleCard/components/container/indexOld.d.ts +24 -0
  66. package/dist/types-ts4.5/view/FlexibleCard/components/container/layered-link/LayeredLinkOld.d.ts +13 -0
  67. package/dist/types-ts4.5/view/FlexibleCard/components/container/layered-link/index.d.ts +2 -11
  68. package/package.json +2 -2
  69. /package/dist/cjs/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  70. /package/dist/es2019/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  71. /package/dist/esm/view/EmbedModal/components/link-info/{styled.js → styledOld.js} +0 -0
  72. /package/dist/types/view/EmbedModal/components/link-info/{styled.d.ts → styledOld.d.ts} +0 -0
  73. /package/dist/types-ts4.5/view/EmbedModal/components/link-info/{styled.d.ts → styledOld.d.ts} +0 -0
@@ -1,87 +1,24 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
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";
5
6
  import React, { useContext } 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
7
  import { di } from 'react-magnetic-di';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { N40 } from '@atlaskit/theme/colors';
11
10
  import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
12
11
  import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
13
12
  import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
14
13
  import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
15
14
  import HoverCardControl from './hover-card-control';
15
+ import ContainerOld from './indexOld';
16
16
  import LayeredLink from './layered-link';
17
- const elevationStyles = css({
18
- border: `1px solid ${`var(--ds-border, ${N40})`}`,
19
- borderRadius: "var(--ds-border-radius-200, 8px)",
20
- margin: "var(--ds-space-025, 2px)"
21
- });
22
- const getGap = size => {
23
- switch (size) {
24
- case SmartLinkSize.XLarge:
25
- return '1.25rem';
26
- case SmartLinkSize.Large:
27
- return '1rem';
28
- case SmartLinkSize.Medium:
29
- return '.5rem';
30
- case SmartLinkSize.Small:
31
- default:
32
- return '.25rem';
33
- }
34
- };
35
-
36
17
  /**
37
- * Get container padding based on smart link size
38
- * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
39
- * at view/FlexibleCard/components/utils.tsx
18
+ * Eventually these exports should be removed on FF clean up bandicoots-compiled-migration-smartcard
40
19
  */
41
- const getPadding = size => {
42
- switch (size) {
43
- case SmartLinkSize.XLarge:
44
- return '1.5rem';
45
- case SmartLinkSize.Large:
46
- return '1.25rem';
47
- case SmartLinkSize.Medium:
48
- return '1rem';
49
- case SmartLinkSize.Small:
50
- default:
51
- return '.5rem';
52
- }
53
- };
54
- const clickableContainerStyles = css({
55
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
56
- 'a, button, .has-action': {
57
- position: 'relative',
58
- zIndex: 1
59
- }
60
- });
61
- const getContainerPaddingStyles = (size, hidePadding, childrenOptions) => {
62
- const padding = hidePadding ? '0rem' : getPadding(size);
63
- const gap = getGap(size);
64
- const {
65
- previewOnLeft,
66
- previewOnRight
67
- } = childrenOptions;
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) + ${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) + ${gap});` : '');
83
- };
84
- const getChildrenOptions = (children, context) => {
20
+ export { getContainerStyles } from './indexOld';
21
+ export const getChildrenOptions = (children, context) => {
85
22
  let options = {};
86
23
  if (isFlexUiPreviewPresent(context)) {
87
24
  React.Children.map(children, child => {
@@ -102,30 +39,6 @@ const getChildrenOptions = (children, context) => {
102
39
  }
103
40
  return options;
104
41
  };
105
- export const getContainerStyles = (size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) => {
106
- const paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
107
-
108
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
109
- return css`
110
- display: flex;
111
- gap: ${getGap(size)} 0;
112
- flex-direction: column;
113
- min-width: 0;
114
- overflow-x: hidden;
115
- position: relative;
116
- ${hideBackground ? '' : `background-color: ${"var(--ds-surface-raised, #FFFFFF)"};`}
117
- ${paddingCss}
118
- ${hideElevation ? '' : elevationStyles}
119
- ${clickableContainer ? clickableContainerStyles : ''}
120
- &:hover ~ .actions-button-group {
121
- opacity: 1;
122
- }
123
- a:focus,
124
- .has-action:focus {
125
- outline-offset: -2px;
126
- }
127
- `;
128
- };
129
42
  const renderChildren = (children, containerSize, containerTheme, status, retry, onClick) => React.Children.map(children, child => {
130
43
  // TODO: EDM-6468: Use useFlexibleUiOptionContext for rendering options inside block/element instead
131
44
  if ( /*#__PURE__*/React.isValidElement(child) && isFlexibleUiBlock(child)) {
@@ -165,7 +78,7 @@ const getLayeredLink = (testId, context, children, onClick) => {
165
78
  anchorTarget: target,
166
79
  text
167
80
  } = getTitleBlockProps(children) || {};
168
- return jsx(LayeredLink, {
81
+ return /*#__PURE__*/React.createElement(LayeredLink, {
169
82
  onClick: onClick,
170
83
  target: target,
171
84
  testId: testId,
@@ -173,6 +86,60 @@ const getLayeredLink = (testId, context, children, onClick) => {
173
86
  url: url
174
87
  });
175
88
  };
89
+ const baseStyleCommon = null;
90
+ const backgroundStyle = null;
91
+ const elevationStyles = null;
92
+ const clickableContainerStyles = null;
93
+ const gapStyleMap = {
94
+ xlarge: "_zulp1jvo",
95
+ large: "_zulph3jc",
96
+ medium: "_zulp1qos",
97
+ small: "_zulpfzsm"
98
+ };
99
+
100
+ /**
101
+ * Get container padding based on smart link size
102
+ * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
103
+ * at view/FlexibleCard/components/utils.tsx
104
+ */
105
+ const getPadding = size => {
106
+ switch (size) {
107
+ case SmartLinkSize.XLarge:
108
+ return '1.5rem';
109
+ case SmartLinkSize.Large:
110
+ return '1.25rem';
111
+ case SmartLinkSize.Medium:
112
+ return '1rem';
113
+ case SmartLinkSize.Small:
114
+ default:
115
+ return '.5rem';
116
+ }
117
+ };
118
+ const getGap = size => {
119
+ switch (size) {
120
+ case SmartLinkSize.XLarge:
121
+ return '1.25rem';
122
+ case SmartLinkSize.Large:
123
+ return '1rem';
124
+ case SmartLinkSize.Medium:
125
+ return '.5rem';
126
+ case SmartLinkSize.Small:
127
+ default:
128
+ return '.25rem';
129
+ }
130
+ };
131
+ const previewOnLeftStyleMap = {
132
+ xlarge: "_19bv15sf _y5vk1k92",
133
+ large: "_19bvf557 _y5vk1j6v",
134
+ medium: "_19bvqox2 _y5vk1kwk",
135
+ small: "_19bv1ltm _y5vk6mu8"
136
+ };
137
+ const previewOnRightStyleMap = {
138
+ xlarge: "_u5f315sf _1yob1k92",
139
+ large: "_u5f3f557 _1yob1j6v",
140
+ medium: "_u5f3qox2 _1yob1kwk",
141
+ small: "_u5f31ltm _1yob6mu8"
142
+ };
176
143
 
177
144
  /**
178
145
  * A container is a hidden component that build the Flexible Smart Link.
@@ -182,7 +149,7 @@ const getLayeredLink = (testId, context, children, onClick) => {
182
149
  * @internal
183
150
  * @see Block
184
151
  */
185
- const Container = ({
152
+ const ContainerNew = ({
186
153
  children,
187
154
  clickableContainer = false,
188
155
  hideBackground = false,
@@ -198,20 +165,30 @@ const Container = ({
198
165
  testId = 'smart-links-container',
199
166
  theme = SmartLinkTheme.Link
200
167
  }) => {
168
+ const padding = hidePadding ? '0rem' : getPadding(size);
169
+ const gap = getGap(size);
201
170
  const context = useContext(FlexibleUiContext);
202
- const childrenOptions = getChildrenOptions(children, context);
171
+ const {
172
+ previewOnLeft,
173
+ previewOnRight
174
+ } = getChildrenOptions(children, context);
203
175
  const canShowHoverPreview = showHoverPreview && status === 'resolved';
204
176
  // `retry` object contains action that can be performed on
205
177
  // unresolved link (unauthorized, forbidden, not found, etc.)
206
178
  const canShowAuthTooltip = showHoverPreview && status === 'unauthorized' && retry !== undefined;
207
- const container = jsx("div", {
208
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
209
- css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
179
+ const containerPaddingStyles = null;
180
+ const container = /*#__PURE__*/React.createElement("div", {
210
181
  "data-smart-link-container": true,
211
- "data-testid": testId
182
+ "data-testid": testId,
183
+ 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 && "_19ith6cr _2rkopd34 _18s8v77o", clickableContainer && "_nqwih2mm _18ywh2mm _1nq3h2mm _1t4ckb7n _1nxdkb7n _xnbykb7n"]),
184
+ style: {
185
+ "--_1xumd0e": ix(padding),
186
+ "--_73mooq": ix(previewOnLeft ? gap : padding),
187
+ "--_12k13bg": ix(previewOnRight ? gap : padding)
188
+ }
212
189
  }, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
213
190
  if (context !== null && context !== void 0 && context.url && (canShowHoverPreview || canShowAuthTooltip)) {
214
- return jsx(HoverCardControl, {
191
+ return /*#__PURE__*/React.createElement(HoverCardControl, {
215
192
  isHoverPreview: canShowHoverPreview,
216
193
  isAuthTooltip: canShowAuthTooltip,
217
194
  actionOptions: actionOptions,
@@ -222,4 +199,10 @@ const Container = ({
222
199
  }
223
200
  return container;
224
201
  };
202
+ const Container = props => {
203
+ if (fg('bandicoots-compiled-migration-smartcard')) {
204
+ return /*#__PURE__*/React.createElement(ContainerNew, props);
205
+ }
206
+ return /*#__PURE__*/React.createElement(ContainerOld, props);
207
+ };
225
208
  export default Container;
@@ -0,0 +1,229 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React, { useContext } 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 { di } from 'react-magnetic-di';
10
+ import { N40 } from '@atlaskit/theme/colors';
11
+ import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
12
+ import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
13
+ import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
14
+ import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
15
+ import HoverCardControl from './hover-card-control';
16
+ import LayeredLink from './layered-link';
17
+ const elevationStyles = css({
18
+ border: `1px solid ${`var(--ds-border, ${N40})`}`,
19
+ borderRadius: "var(--ds-border-radius-200, 8px)",
20
+ margin: "var(--ds-space-025, 2px)"
21
+ });
22
+ const clickableContainerStyles = css({
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
24
+ 'a, button, .has-action': {
25
+ position: 'relative',
26
+ zIndex: 1
27
+ }
28
+ });
29
+ const getGap = size => {
30
+ switch (size) {
31
+ case SmartLinkSize.XLarge:
32
+ return '1.25rem';
33
+ case SmartLinkSize.Large:
34
+ return '1rem';
35
+ case SmartLinkSize.Medium:
36
+ return '.5rem';
37
+ case SmartLinkSize.Small:
38
+ default:
39
+ return '.25rem';
40
+ }
41
+ };
42
+
43
+ /**
44
+ * Get container padding based on smart link size
45
+ * Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
46
+ * at view/FlexibleCard/components/utils.tsx
47
+ */
48
+ const getPadding = size => {
49
+ switch (size) {
50
+ case SmartLinkSize.XLarge:
51
+ return '1.5rem';
52
+ case SmartLinkSize.Large:
53
+ return '1.25rem';
54
+ case SmartLinkSize.Medium:
55
+ return '1rem';
56
+ case SmartLinkSize.Small:
57
+ default:
58
+ return '.5rem';
59
+ }
60
+ };
61
+ const getContainerPaddingStyles = (size, hidePadding, childrenOptions) => {
62
+ const padding = hidePadding ? '0rem' : getPadding(size);
63
+ const gap = getGap(size);
64
+ const {
65
+ previewOnLeft,
66
+ previewOnRight
67
+ } = childrenOptions;
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) + ${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) + ${gap});` : '');
83
+ };
84
+
85
+ /**
86
+ * @deprecated consider removing on FF bandicoots-compiled-migration-smartcard
87
+ */
88
+ export const getContainerStyles = (size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) => {
89
+ const 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`
93
+ display: flex;
94
+ gap: ${getGap(size)} 0;
95
+ flex-direction: column;
96
+ min-width: 0;
97
+ overflow-x: hidden;
98
+ position: relative;
99
+ ${hideBackground ? '' : `background-color: ${"var(--ds-surface-raised, #FFFFFF)"};`}
100
+ ${paddingCss}
101
+ ${hideElevation ? '' : elevationStyles}
102
+ ${clickableContainer ? clickableContainerStyles : ''}
103
+ &:hover ~ .actions-button-group {
104
+ opacity: 1;
105
+ }
106
+ a:focus,
107
+ .has-action:focus {
108
+ outline-offset: -2px;
109
+ }
110
+ `;
111
+ };
112
+ const getLayeredLink = (testId, context, children, onClick) => {
113
+ const {
114
+ title,
115
+ url = ''
116
+ } = context || {};
117
+ const {
118
+ anchorTarget: target,
119
+ text
120
+ } = getTitleBlockProps(children) || {};
121
+ return jsx(LayeredLink, {
122
+ onClick: onClick,
123
+ target: target,
124
+ testId: testId,
125
+ text: text || title,
126
+ url: url
127
+ });
128
+ };
129
+ const getTitleBlockProps = children => {
130
+ const block = React.Children.toArray(children).find(child => isFlexibleUiTitleBlock(child));
131
+ if ( /*#__PURE__*/React.isValidElement(block)) {
132
+ return block.props;
133
+ }
134
+ };
135
+ export const getChildrenOptions = (children, context) => {
136
+ let options = {};
137
+ if (isFlexUiPreviewPresent(context)) {
138
+ React.Children.map(children, child => {
139
+ if ( /*#__PURE__*/React.isValidElement(child)) {
140
+ if (isFlexibleUiPreviewBlock(child)) {
141
+ const {
142
+ placement
143
+ } = child.props;
144
+ if (placement === MediaPlacement.Left) {
145
+ options.previewOnLeft = true;
146
+ }
147
+ if (placement === MediaPlacement.Right) {
148
+ options.previewOnRight = true;
149
+ }
150
+ }
151
+ }
152
+ });
153
+ }
154
+ return options;
155
+ };
156
+ const renderChildren = (children, containerSize, containerTheme, status, retry, onClick) => React.Children.map(children, child => {
157
+ // TODO: EDM-6468: Use useFlexibleUiOptionContext for rendering options inside block/element instead
158
+ if ( /*#__PURE__*/React.isValidElement(child) && isFlexibleUiBlock(child)) {
159
+ const {
160
+ size: blockSize
161
+ } = child.props;
162
+ const size = blockSize || containerSize;
163
+ if (isFlexibleUiTitleBlock(child)) {
164
+ return /*#__PURE__*/React.cloneElement(child, {
165
+ // @ts-expect-error
166
+ onClick,
167
+ retry,
168
+ size,
169
+ status,
170
+ theme: containerTheme
171
+ });
172
+ }
173
+ // @ts-expect-error
174
+ return /*#__PURE__*/React.cloneElement(child, {
175
+ size,
176
+ status
177
+ });
178
+ }
179
+ });
180
+
181
+ /**
182
+ * A container is a hidden component that build the Flexible Smart Link.
183
+ * All the Flexible UI components are wrapped inside the container.
184
+ * It inherits the ui props from Card component and applies the custom styling
185
+ * accordingly.
186
+ * @internal
187
+ * @see Block
188
+ */
189
+ const ContainerOld = ({
190
+ children,
191
+ clickableContainer = false,
192
+ hideBackground = false,
193
+ hideElevation = false,
194
+ hidePadding = false,
195
+ onClick,
196
+ retry,
197
+ showHoverPreview = false,
198
+ hoverPreviewOptions,
199
+ actionOptions,
200
+ size = SmartLinkSize.Medium,
201
+ status,
202
+ testId = 'smart-links-container',
203
+ theme = SmartLinkTheme.Link
204
+ }) => {
205
+ const context = useContext(FlexibleUiContext);
206
+ const childrenOptions = getChildrenOptions(children, context);
207
+ const canShowHoverPreview = showHoverPreview && status === 'resolved';
208
+ // `retry` object contains action that can be performed on
209
+ // unresolved link (unauthorized, forbidden, not found, etc.)
210
+ const canShowAuthTooltip = showHoverPreview && status === 'unauthorized' && retry !== undefined;
211
+ const container = jsx("div", {
212
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
213
+ css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
214
+ "data-smart-link-container": true,
215
+ "data-testid": testId
216
+ }, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
217
+ if (context !== null && context !== void 0 && context.url && (canShowHoverPreview || canShowAuthTooltip)) {
218
+ return jsx(HoverCardControl, {
219
+ isHoverPreview: canShowHoverPreview,
220
+ isAuthTooltip: canShowAuthTooltip,
221
+ actionOptions: actionOptions,
222
+ testId: testId,
223
+ url: context.url,
224
+ hoverPreviewOptions: hoverPreviewOptions
225
+ }, container);
226
+ }
227
+ return container;
228
+ };
229
+ export default ContainerOld;
@@ -0,0 +1,69 @@
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
+ const 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
+ const LayeredLinkOld = ({
50
+ onClick,
51
+ target,
52
+ testId,
53
+ text,
54
+ url
55
+ }) => {
56
+ const onMouseDown = useMouseDownEvent();
57
+ return jsx("a", {
58
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
59
+ className: "layered-link",
60
+ css: styles,
61
+ "data-testid": `${testId}-layered-link`,
62
+ href: url,
63
+ onClick: onClick,
64
+ onMouseDown: onMouseDown,
65
+ target: target,
66
+ tabIndex: -1 // Hide tab index and let the title link be the link.
67
+ }, text);
68
+ };
69
+ 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,52 +1,18 @@
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
- const 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
+ const 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
- const LayeredLink = ({
15
+ const LayeredLinkNew = ({
50
16
  onClick,
51
17
  target,
52
18
  testId,
@@ -54,10 +20,9 @@ const LayeredLink = ({
54
20
  url
55
21
  }) => {
56
22
  const onMouseDown = useMouseDownEvent();
57
- return jsx("a", {
23
+ return /*#__PURE__*/React.createElement("a", {
58
24
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
59
- className: "layered-link",
60
- css: styles,
25
+ className: ax(["_1reo15vq _18m915vq _154iidpf _1xi2idpf _94n5idpf _1ltvidpf _azhw1osq _o5721q9c _hboxstnw _obkmidpf _a52dkb7n", "layered-link"]),
61
26
  "data-testid": `${testId}-layered-link`,
62
27
  href: url,
63
28
  onClick: onClick,
@@ -66,4 +31,10 @@ const LayeredLink = ({
66
31
  tabIndex: -1 // Hide tab index and let the title link be the link.
67
32
  }, text);
68
33
  };
34
+ const LayeredLink = props => {
35
+ if (fg('bandicoots-compiled-migration-smartcard')) {
36
+ return /*#__PURE__*/React.createElement(LayeredLinkNew, props);
37
+ }
38
+ return /*#__PURE__*/React.createElement(LayeredLinkOld, props);
39
+ };
69
40
  export default LayeredLink;
@@ -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.1.1",
13
+ packageVersion: "34.2.1",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  const Anchor = withLinkClickedEvent('a');
@@ -22,6 +22,7 @@ const RelatedLinksList = ({
22
22
  ,
23
23
  xcss: xcss({
24
24
  font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
25
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
25
26
  textTransform: 'uppercase'
26
27
  })
27
28
  }, jsx(FormattedMessage, title)), urls.length > 0 && jsx(Box, null, urls.map((url, idx) => jsx(Stack, {
@@ -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.1.1"
7
+ packageVersion: "34.2.1"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";