@atlaskit/smart-card 26.46.0 → 26.46.2

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 (81) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/messages.js +5 -0
  3. package/dist/cjs/utils/analytics/analytics.js +1 -1
  4. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/index.js +33 -0
  5. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +77 -0
  6. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/types.js +5 -0
  7. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +8 -19
  8. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
  9. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +10 -2
  10. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +11 -2
  11. package/dist/cjs/view/LinkUrl/index.js +1 -1
  12. package/dist/cjs/view/common/ai-icon/index.js +117 -0
  13. package/dist/cjs/view/common/ai-prism/ai-glowing-border/animated-svg-container.js +249 -0
  14. package/dist/cjs/view/common/ai-prism/ai-glowing-border/index.js +55 -0
  15. package/dist/cjs/view/common/ai-prism/ai-glowing-border/types.js +5 -0
  16. package/dist/cjs/view/common/ai-prism/constants.js +53 -0
  17. package/dist/cjs/view/common/ai-prism/index.js +45 -0
  18. package/dist/cjs/view/common/ai-prism/types.js +5 -0
  19. package/dist/es2019/messages.js +5 -0
  20. package/dist/es2019/utils/analytics/analytics.js +1 -1
  21. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/index.js +25 -0
  22. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +66 -0
  23. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/types.js +1 -0
  24. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +1 -12
  25. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +2 -1
  26. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +10 -0
  27. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +14 -4
  28. package/dist/es2019/view/LinkUrl/index.js +1 -1
  29. package/dist/es2019/view/common/ai-icon/index.js +108 -0
  30. package/dist/es2019/view/common/ai-prism/ai-glowing-border/animated-svg-container.js +236 -0
  31. package/dist/es2019/view/common/ai-prism/ai-glowing-border/index.js +45 -0
  32. package/dist/es2019/view/common/ai-prism/ai-glowing-border/types.js +1 -0
  33. package/dist/es2019/view/common/ai-prism/constants.js +47 -0
  34. package/dist/es2019/view/common/ai-prism/index.js +36 -0
  35. package/dist/es2019/view/common/ai-prism/types.js +1 -0
  36. package/dist/esm/messages.js +5 -0
  37. package/dist/esm/utils/analytics/analytics.js +1 -1
  38. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/index.js +27 -0
  39. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +67 -0
  40. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/types.js +1 -0
  41. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +1 -12
  42. package/dist/esm/view/FlexibleCard/components/blocks/index.js +2 -1
  43. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +9 -1
  44. package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -4
  45. package/dist/esm/view/LinkUrl/index.js +1 -1
  46. package/dist/esm/view/common/ai-icon/index.js +110 -0
  47. package/dist/esm/view/common/ai-prism/ai-glowing-border/animated-svg-container.js +239 -0
  48. package/dist/esm/view/common/ai-prism/ai-glowing-border/index.js +47 -0
  49. package/dist/esm/view/common/ai-prism/ai-glowing-border/types.js +1 -0
  50. package/dist/esm/view/common/ai-prism/constants.js +47 -0
  51. package/dist/esm/view/common/ai-prism/index.js +37 -0
  52. package/dist/esm/view/common/ai-prism/types.js +1 -0
  53. package/dist/types/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -0
  54. package/dist/types/messages.d.ts +1 -1
  55. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/index.d.ts +11 -0
  56. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +4 -0
  57. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +23 -0
  58. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  59. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -0
  60. package/dist/types/view/common/ai-icon/index.d.ts +9 -0
  61. package/dist/types/view/common/ai-prism/ai-glowing-border/animated-svg-container.d.ts +9 -0
  62. package/dist/types/view/common/ai-prism/ai-glowing-border/index.d.ts +10 -0
  63. package/dist/types/view/common/ai-prism/ai-glowing-border/types.d.ts +25 -0
  64. package/dist/types/view/common/ai-prism/constants.d.ts +30 -0
  65. package/dist/types/view/common/ai-prism/index.d.ts +4 -0
  66. package/dist/types/view/common/ai-prism/types.d.ts +13 -0
  67. package/dist/types-ts4.5/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -0
  68. package/dist/types-ts4.5/messages.d.ts +1 -1
  69. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/index.d.ts +11 -0
  70. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +4 -0
  71. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +23 -0
  72. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +1 -0
  74. package/dist/types-ts4.5/view/common/ai-icon/index.d.ts +9 -0
  75. package/dist/types-ts4.5/view/common/ai-prism/ai-glowing-border/animated-svg-container.d.ts +9 -0
  76. package/dist/types-ts4.5/view/common/ai-prism/ai-glowing-border/index.d.ts +10 -0
  77. package/dist/types-ts4.5/view/common/ai-prism/ai-glowing-border/types.d.ts +25 -0
  78. package/dist/types-ts4.5/view/common/ai-prism/constants.d.ts +30 -0
  79. package/dist/types-ts4.5/view/common/ai-prism/index.d.ts +4 -0
  80. package/dist/types-ts4.5/view/common/ai-prism/types.d.ts +13 -0
  81. package/package.json +10 -7
@@ -0,0 +1,108 @@
1
+ import React from 'react';
2
+ import SVG from '@atlaskit/icon/svg';
3
+ import { B200, B400 } from '@atlaskit/theme/colors';
4
+ /**
5
+ * The bulk of this file is originally from
6
+ * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
7
+ * with modifications
8
+ */
9
+ const AiIcon = props => /*#__PURE__*/React.createElement(SVG, props, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
10
+ id: "ai_icon_lg0",
11
+ x1: "21",
12
+ y1: "12",
13
+ x2: "17.5",
14
+ y2: "12",
15
+ gradientUnits: "userSpaceOnUse"
16
+ }, /*#__PURE__*/React.createElement("stop", {
17
+ offset: "0.270833",
18
+ stopColor: `var(--ds-icon-accent-blue, ${B200})`,
19
+ color: `var(--ds-icon-accent-blue, ${B200})`
20
+ }), /*#__PURE__*/React.createElement("stop", {
21
+ offset: "1",
22
+ stopColor: `var(--ds-text-accent-blue, ${B400})`,
23
+ color: `var(--ds-text-accent-blue, ${B400})`
24
+ })), /*#__PURE__*/React.createElement("linearGradient", {
25
+ id: "ai_icon_lg1",
26
+ x1: "12.5",
27
+ y1: "3",
28
+ x2: "12.5",
29
+ y2: "6.5",
30
+ gradientUnits: "userSpaceOnUse"
31
+ }, /*#__PURE__*/React.createElement("stop", {
32
+ offset: "0.1875",
33
+ stopColor: `var(--ds-icon-accent-blue, ${B200})`,
34
+ color: `var(--ds-icon-accent-blue, ${B200})`
35
+ }), /*#__PURE__*/React.createElement("stop", {
36
+ offset: "1",
37
+ stopColor: `var(--ds-text-accent-blue, ${B400})`,
38
+ color: `var(--ds-text-accent-blue, ${B400})`
39
+ })), /*#__PURE__*/React.createElement("linearGradient", {
40
+ id: "ai_icon_lg2",
41
+ x1: "6.82996",
42
+ y1: "12",
43
+ x2: "3.32996",
44
+ y2: "12",
45
+ gradientUnits: "userSpaceOnUse"
46
+ }, /*#__PURE__*/React.createElement("stop", {
47
+ stopColor: `var(--ds-text-accent-blue, ${B400})`,
48
+ color: `var(--ds-text-accent-blue, ${B400})`
49
+ }), /*#__PURE__*/React.createElement("stop", {
50
+ offset: "0.791667",
51
+ stopColor: `var(--ds-icon-accent-blue, ${B200})`,
52
+ color: `var(--ds-icon-accent-blue, ${B200})`
53
+ })), /*#__PURE__*/React.createElement("linearGradient", {
54
+ id: "ai_icon_lg3",
55
+ x1: "12.5",
56
+ y1: "17",
57
+ x2: "12.5",
58
+ y2: "21",
59
+ gradientUnits: "userSpaceOnUse"
60
+ }, /*#__PURE__*/React.createElement("stop", {
61
+ stopColor: `var(--ds-text-accent-blue, ${B400})`,
62
+ color: `var(--ds-text-accent-blue, ${B400})`
63
+ }), /*#__PURE__*/React.createElement("stop", {
64
+ offset: "0.802083",
65
+ stopColor: `var(--ds-icon-accent-blue, ${B200})`,
66
+ color: `var(--ds-icon-accent-blue, ${B200})`
67
+ }))), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
68
+ fillRule: "evenodd",
69
+ clipRule: "evenodd",
70
+ d: "M17.17 12C17.17 11.4477 17.6177 11 18.17 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18.17C17.6177 13 17.17 12.5523 17.17 12Z",
71
+ fill: "url(#ai_icon_lg0)"
72
+ }), /*#__PURE__*/React.createElement("path", {
73
+ fillRule: "evenodd",
74
+ clipRule: "evenodd",
75
+ d: "M12 3C12.5523 3 13 3.44772 13 4V5.83C13 6.38228 12.5523 6.83 12 6.83C11.4477 6.83 11 6.38228 11 5.83V4C11 3.44772 11.4477 3 12 3Z",
76
+ fill: "url(#ai_icon_lg1)"
77
+ }), /*#__PURE__*/React.createElement("path", {
78
+ fillRule: "evenodd",
79
+ clipRule: "evenodd",
80
+ d: "M3 12C3 11.4477 3.44772 11 4 11H5.83C6.38228 11 6.83 11.4477 6.83 12C6.83 12.5523 6.38228 13 5.83 13H4C3.44772 13 3 12.5523 3 12Z",
81
+ fill: "url(#ai_icon_lg2)"
82
+ }), /*#__PURE__*/React.createElement("path", {
83
+ fillRule: "evenodd",
84
+ clipRule: "evenodd",
85
+ d: "M12 17.17C12.5523 17.17 13 17.6177 13 18.17V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V18.17C11 17.6177 11.4477 17.17 12 17.17Z",
86
+ fill: "url(#ai_icon_lg3)"
87
+ }), /*#__PURE__*/React.createElement("path", {
88
+ fillRule: "evenodd",
89
+ clipRule: "evenodd",
90
+ d: "M14.2929 14.2929C14.6835 13.9024 15.3166 13.9024 15.7071 14.2929L19.7071 18.2929C20.0977 18.6834 20.0977 19.3166 19.7071 19.7071C19.3166 20.0976 18.6835 20.0976 18.2929 19.7071L14.2929 15.7071C13.9024 15.3166 13.9024 14.6834 14.2929 14.2929Z",
91
+ fill: `var(--ds-icon-accent-blue, ${B200})`
92
+ }), /*#__PURE__*/React.createElement("path", {
93
+ fillRule: "evenodd",
94
+ clipRule: "evenodd",
95
+ d: "M19.7071 4.29289C20.0977 4.68342 20.0977 5.31658 19.7071 5.70711L15.7071 9.70711C15.3166 10.0976 14.6835 10.0976 14.2929 9.70711C13.9024 9.31658 13.9024 8.68342 14.2929 8.29289L18.2929 4.29289C18.6835 3.90237 19.3166 3.90237 19.7071 4.29289Z",
96
+ fill: `var(--ds-icon-accent-blue, ${B200})`
97
+ }), /*#__PURE__*/React.createElement("path", {
98
+ fillRule: "evenodd",
99
+ clipRule: "evenodd",
100
+ d: "M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C10.0976 8.68342 10.0976 9.31658 9.70711 9.70711C9.31658 10.0976 8.68342 10.0976 8.29289 9.70711L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z",
101
+ fill: `var(--ds-icon-accent-blue, ${B200})`
102
+ }), /*#__PURE__*/React.createElement("path", {
103
+ fillRule: "evenodd",
104
+ clipRule: "evenodd",
105
+ d: "M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071C3.90237 19.3166 3.90237 18.6834 4.29289 18.2929L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",
106
+ fill: `var(--ds-icon-accent-blue, ${B200})`
107
+ })));
108
+ export default AiIcon;
@@ -0,0 +1,236 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
+ import React, { useEffect, useRef } from 'react';
4
+ import { GLOW_SIZE, OUTER_BORDER_RADIUS } from '../constants';
5
+ let namespaceUUID = 0;
6
+ const svgStyles = css({
7
+ position: 'absolute',
8
+ borderRadius: OUTER_BORDER_RADIUS
9
+ });
10
+ const blurredStyles = css({
11
+ width: `calc(100% - ${GLOW_SIZE / 2}px)`,
12
+ height: `calc(100% - ${GLOW_SIZE / 2}px)`,
13
+ top: GLOW_SIZE / 2,
14
+ left: GLOW_SIZE / 2,
15
+ filter: `blur(${GLOW_SIZE}px)`,
16
+ // for safari... : https://stackoverflow.com/a/71353198
17
+ backfaceVisibility: 'hidden',
18
+ transform: 'translate3d(0, 0, 0)'
19
+ });
20
+ const notBlurredStyles = css({
21
+ left: 0,
22
+ top: 0,
23
+ width: '100%',
24
+ height: '100%'
25
+ });
26
+
27
+ /**
28
+ * The bulk of this file is originally from
29
+ * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
30
+ * with modifications.
31
+ */
32
+ const AnimatedSvgContainer = ({
33
+ palette,
34
+ isMoving,
35
+ isGlowing,
36
+ additionalCss
37
+ }) => {
38
+ const svgRef = useRef(null);
39
+ const namespaceId = useRef();
40
+ if (namespaceId.current === undefined) {
41
+ namespaceId.current = namespaceUUID;
42
+ namespaceUUID += 1;
43
+ }
44
+ useEffect(() => {
45
+ if (isMoving) {
46
+ const svg = svgRef.current;
47
+
48
+ // Schedule animation to begin before next browser paint
49
+ const beginReq = requestAnimationFrame(() => {
50
+ svg === null || svg === void 0 ? void 0 : svg.querySelectorAll('animate').forEach(node => node.beginElement());
51
+ });
52
+ return () => {
53
+ // Ensure any pending animation frame is cancelled as the element animation does not end properly if it
54
+ // begins in the same event tick, i.e. isLoading synchronously changes to true then false.
55
+ cancelAnimationFrame(beginReq);
56
+ requestAnimationFrame(() => {
57
+ svg === null || svg === void 0 ? void 0 : svg.querySelectorAll('animate').forEach(node => node.endElement());
58
+ });
59
+ };
60
+ }
61
+ return undefined;
62
+ }, [isMoving]);
63
+ return jsx("svg", {
64
+ css: [svgStyles, isGlowing ? blurredStyles : notBlurredStyles, additionalCss],
65
+ ref: svgRef,
66
+ viewBox: "0 0 24 24",
67
+ preserveAspectRatio: "none"
68
+ }, jsx("defs", null, jsx("linearGradient", {
69
+ id: `${namespaceId.current}_lg1`,
70
+ gradientUnits: "userSpaceOnUse",
71
+ x1: "0%",
72
+ y1: "0",
73
+ x2: "400%",
74
+ y2: "0",
75
+ spreadMethod: "reflect"
76
+ }, jsx("animate", {
77
+ begin: "indefinite",
78
+ attributeName: "x1",
79
+ from: "0%",
80
+ to: "400%",
81
+ repeatCount: "indefinite",
82
+ dur: "3s"
83
+ }), jsx("animate", {
84
+ begin: "indefinite",
85
+ attributeName: "x2",
86
+ from: "400%",
87
+ to: "800%",
88
+ repeatCount: "indefinite",
89
+ dur: "3s"
90
+ }), jsx("stop", {
91
+ offset: "0",
92
+ stopColor: palette.blue
93
+ }), jsx("stop", {
94
+ offset: "0.25",
95
+ stopColor: palette.teal
96
+ }), jsx("stop", {
97
+ offset: "0.5",
98
+ stopColor: palette.yellow
99
+ }), jsx("stop", {
100
+ offset: "0.75",
101
+ stopColor: palette.teal
102
+ }), jsx("stop", {
103
+ offset: "1",
104
+ stopColor: palette.blue
105
+ })), jsx("linearGradient", {
106
+ id: `${namespaceId.current}_lg2`,
107
+ gradientUnits: "userSpaceOnUse",
108
+ x1: "0",
109
+ y1: "-100%",
110
+ x2: "0",
111
+ y2: "300%",
112
+ spreadMethod: "reflect"
113
+ }, jsx("animate", {
114
+ begin: "indefinite",
115
+ attributeName: "y1",
116
+ from: "-100%",
117
+ to: "300%",
118
+ repeatCount: "indefinite",
119
+ dur: "3s"
120
+ }), jsx("animate", {
121
+ begin: "indefinite",
122
+ attributeName: "y2",
123
+ from: "300%",
124
+ to: "700%",
125
+ repeatCount: "indefinite",
126
+ dur: "3s"
127
+ }), jsx("stop", {
128
+ offset: "0",
129
+ stopColor: palette.blue
130
+ }), jsx("stop", {
131
+ offset: "0.25",
132
+ stopColor: palette.teal
133
+ }), jsx("stop", {
134
+ offset: "0.5",
135
+ stopColor: palette.yellow
136
+ }), jsx("stop", {
137
+ offset: "0.75",
138
+ stopColor: palette.teal
139
+ }), jsx("stop", {
140
+ offset: "1",
141
+ stopColor: palette.blue
142
+ })), jsx("linearGradient", {
143
+ id: `${namespaceId.current}_lg3`,
144
+ gradientUnits: "userSpaceOnUse",
145
+ x1: "300%",
146
+ y1: "0",
147
+ x2: "700%",
148
+ y2: "0",
149
+ spreadMethod: "reflect"
150
+ }, jsx("animate", {
151
+ begin: "indefinite",
152
+ attributeName: "x1",
153
+ from: "300%",
154
+ to: "-100%",
155
+ repeatCount: "indefinite",
156
+ dur: "3s"
157
+ }), jsx("animate", {
158
+ begin: "indefinite",
159
+ attributeName: "x2",
160
+ from: "700%",
161
+ to: "300%",
162
+ repeatCount: "indefinite",
163
+ dur: "3s"
164
+ }), jsx("stop", {
165
+ offset: "0",
166
+ stopColor: palette.blue
167
+ }), jsx("stop", {
168
+ offset: "0.25",
169
+ stopColor: palette.teal
170
+ }), jsx("stop", {
171
+ offset: "0.5",
172
+ stopColor: palette.yellow
173
+ }), jsx("stop", {
174
+ offset: "0.75",
175
+ stopColor: palette.teal
176
+ }), jsx("stop", {
177
+ offset: "1",
178
+ stopColor: palette.blue
179
+ })), jsx("linearGradient", {
180
+ id: `${namespaceId.current}_lg4`,
181
+ gradientUnits: "userSpaceOnUse",
182
+ x1: "0",
183
+ y1: "0",
184
+ x2: "0",
185
+ y2: "400%",
186
+ spreadMethod: "reflect"
187
+ }, jsx("animate", {
188
+ begin: "indefinite",
189
+ attributeName: "y1",
190
+ from: "0%",
191
+ to: "-400%",
192
+ repeatCount: "indefinite",
193
+ dur: "3s"
194
+ }), jsx("animate", {
195
+ begin: "indefinite",
196
+ attributeName: "y2",
197
+ from: "400%",
198
+ to: "0%",
199
+ repeatCount: "indefinite",
200
+ dur: "3s"
201
+ }), jsx("stop", {
202
+ offset: "0",
203
+ stopColor: palette.blue
204
+ }), jsx("stop", {
205
+ offset: "0.25",
206
+ stopColor: palette.teal
207
+ }), jsx("stop", {
208
+ offset: "0.5",
209
+ stopColor: palette.yellow
210
+ }), jsx("stop", {
211
+ offset: "0.75",
212
+ stopColor: palette.teal
213
+ }), jsx("stop", {
214
+ offset: "1",
215
+ stopColor: palette.blue
216
+ }))), jsx("g", {
217
+ strokeWidth: "8"
218
+ }, jsx("path", {
219
+ stroke: `url(#${namespaceId.current}_lg1)`,
220
+ d: "M0 0h24",
221
+ vectorEffect: "non-scaling-stroke"
222
+ }), jsx("path", {
223
+ stroke: `url(#${namespaceId.current}_lg2)`,
224
+ d: "M24 0v24",
225
+ vectorEffect: "non-scaling-stroke"
226
+ }), jsx("path", {
227
+ stroke: `url(#${namespaceId.current}_lg3)`,
228
+ d: "M24 24H0",
229
+ vectorEffect: "non-scaling-stroke"
230
+ }), jsx("path", {
231
+ stroke: `url(#${namespaceId.current}_lg4)`,
232
+ d: "M0 24V0",
233
+ vectorEffect: "non-scaling-stroke"
234
+ })));
235
+ };
236
+ export default AnimatedSvgContainer;
@@ -0,0 +1,45 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
+ import React from 'react';
4
+ import AnimatedSvgContainer from './animated-svg-container';
5
+ import { INNER_BORDER_RADIUS } from '../constants';
6
+ const borderContainerStyles = css({
7
+ display: 'flex',
8
+ position: 'relative',
9
+ padding: "var(--ds-space-025, 2px)",
10
+ width: 'fit-content'
11
+ });
12
+ export const borderContentStyles = css({
13
+ borderRadius: INNER_BORDER_RADIUS,
14
+ flexGrow: 1,
15
+ zIndex: 1 // needs to be more than the svg container at least
16
+ });
17
+
18
+ /**
19
+ * The bulk of this file is originally from
20
+ * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
21
+ * with modifications.
22
+ */
23
+ const AIGlowingBorder = ({
24
+ children,
25
+ palette,
26
+ isMoving = true,
27
+ isGlowing,
28
+ testId,
29
+ additionalCss
30
+ }) => jsx("div", {
31
+ css: [borderContainerStyles, additionalCss === null || additionalCss === void 0 ? void 0 : additionalCss.container],
32
+ "data-testid": testId
33
+ }, jsx(AnimatedSvgContainer, {
34
+ palette: palette,
35
+ isMoving: isMoving,
36
+ additionalCss: additionalCss === null || additionalCss === void 0 ? void 0 : additionalCss.animatedSvgContainer
37
+ }), isGlowing && jsx(AnimatedSvgContainer, {
38
+ palette: palette,
39
+ isMoving: isMoving,
40
+ isGlowing: true,
41
+ additionalCss: additionalCss === null || additionalCss === void 0 ? void 0 : additionalCss.animatedSvgContainer
42
+ }), jsx("div", {
43
+ css: borderContentStyles
44
+ }, children, " "));
45
+ export default AIGlowingBorder;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The bulk of this file is originally from
3
+ * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
4
+ * with modifications.
5
+ */
6
+
7
+ export const GLOW_SIZE = 8;
8
+ export const INNER_BORDER_RADIUS = 8;
9
+ export const OUTER_BORDER_RADIUS = 10;
10
+
11
+ // We don't yet have design system tokens representing the AI prism colour palette. We should replace this with
12
+ // equivalent tokens when available
13
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
14
+ export const aiThemeTokens = {
15
+ blueUniqueGradientLight: '#00ACF8',
16
+ blueUniqueGradientDark: '#008BD2',
17
+ blue1000: '#092957',
18
+ blue800: '#0055CC',
19
+ blue700: '#0C66E4',
20
+ blue600: '#1D7AFC',
21
+ blue500: '#388BFF',
22
+ blue300: '#85B8FF',
23
+ blue200: '#CCE0FF',
24
+ blue100: '#E9F2FF',
25
+ teal500: '#37B4C3',
26
+ teal300: '#8BDBE5',
27
+ yellow500: '#CF9F02',
28
+ yellow200: '#F8E6A0',
29
+ red800: '#AE2A19',
30
+ red600: '#E34935',
31
+ orange500: '#F18D13',
32
+ orange300: '#FEC57B'
33
+ };
34
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
35
+
36
+ export const AI_BORDER_PALETTE = {
37
+ dark: {
38
+ blue: aiThemeTokens.blue800,
39
+ teal: aiThemeTokens.teal500,
40
+ yellow: aiThemeTokens.yellow500
41
+ },
42
+ light: {
43
+ blue: aiThemeTokens.blue600,
44
+ teal: aiThemeTokens.teal300,
45
+ yellow: aiThemeTokens.yellow200
46
+ }
47
+ };
@@ -0,0 +1,36 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
+ import React from 'react';
4
+ import { useThemeObserver } from '@atlaskit/tokens';
5
+ import { AI_BORDER_PALETTE, INNER_BORDER_RADIUS } from './constants';
6
+ import AIGlowingBorder from './ai-glowing-border';
7
+ const contentStyles = css({
8
+ backgroundColor: "var(--ds-surface-raised, white)",
9
+ borderRadius: INNER_BORDER_RADIUS
10
+ });
11
+ const AIPrism = ({
12
+ children,
13
+ isGlowing = true,
14
+ isMoving = true,
15
+ isVisible,
16
+ testId
17
+ }) => {
18
+ var _AI_BORDER_PALETTE$co;
19
+ const {
20
+ colorMode = 'light'
21
+ } = useThemeObserver();
22
+ return jsx(AIGlowingBorder, {
23
+ additionalCss: {
24
+ animatedSvgContainer: css({
25
+ opacity: isVisible ? 1 : 0
26
+ })
27
+ },
28
+ palette: (_AI_BORDER_PALETTE$co = AI_BORDER_PALETTE[colorMode]) !== null && _AI_BORDER_PALETTE$co !== void 0 ? _AI_BORDER_PALETTE$co : AI_BORDER_PALETTE.light,
29
+ isGlowing: isGlowing,
30
+ isMoving: isMoving,
31
+ testId: testId
32
+ }, jsx("div", {
33
+ css: contentStyles
34
+ }, children));
35
+ };
36
+ export default AIPrism;
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,11 @@ export var messages = defineMessages({
13
13
  defaultMessage: 'Add account',
14
14
  description: 'Allows to add a new account'
15
15
  },
16
+ ai_summarize: {
17
+ id: 'fabric.linking.ai_summarize',
18
+ defaultMessage: 'Summarize',
19
+ description: 'Action to summarize link resource content with AI'
20
+ },
16
21
  assigned_to: {
17
22
  id: 'fabric.linking.assigned_to',
18
23
  defaultMessage: 'Assigned to {context}',
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.46.0"
18
+ packageVersion: "26.46.2"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,27 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["status", "testId"];
4
+ import React from 'react';
5
+ import AISummaryBlockResolvedView from './resolved';
6
+ import { SmartLinkStatus } from '../../../../../constants';
7
+
8
+ /**
9
+ * Represents an AISummaryBlock, designed to summarising link resource
10
+ * content using AI.
11
+ * @public
12
+ * @param {AISummaryBlockProps} AISummaryBlock
13
+ * @see Block
14
+ */
15
+ var AISummaryBlock = function AISummaryBlock(_ref) {
16
+ var status = _ref.status,
17
+ _ref$testId = _ref.testId,
18
+ testId = _ref$testId === void 0 ? 'smart-ai-summary-block' : _ref$testId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+ if (status !== SmartLinkStatus.Resolved) {
21
+ return null;
22
+ }
23
+ return /*#__PURE__*/React.createElement(AISummaryBlockResolvedView, _extends({}, props, {
24
+ testId: testId
25
+ }));
26
+ };
27
+ export default AISummaryBlock;
@@ -0,0 +1,67 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ import React, { useCallback, useMemo } from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { ActionName, SmartLinkAlignment, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
6
+ import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
7
+ import ActionGroup from '../../action-group';
8
+ import Block from '../../block';
9
+ import ElementGroup from '../../element-group';
10
+ import { filterActionItems, getActionGroupStyles, renderElementItems } from '../../utils';
11
+ import { messages } from '../../../../../../messages';
12
+ import AiIcon from '../../../../../common/ai-icon';
13
+ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
14
+ var _props$actions = props.actions,
15
+ actions = _props$actions === void 0 ? [] : _props$actions,
16
+ metadata = props.metadata,
17
+ testId = props.testId,
18
+ onActionMenuOpenChange = props.onActionMenuOpenChange,
19
+ onAIActionChange = props.onAIActionChange,
20
+ _props$size = props.size,
21
+ size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size;
22
+ var context = useFlexibleUiContext();
23
+ var metadataElements = renderElementItems(metadata);
24
+ var onAIActionClick = useCallback(function () {
25
+ if (onAIActionChange) {
26
+ onAIActionChange();
27
+ }
28
+ }, [onAIActionChange]);
29
+ var combinedActions = useMemo(function () {
30
+ var aiAction = {
31
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
32
+ name: ActionName.CustomAction,
33
+ onClick: onAIActionClick,
34
+ testId: "".concat(testId, "-ai-summary-action"),
35
+ icon: /*#__PURE__*/React.createElement(AiIcon, {
36
+ label: "AiIcon"
37
+ })
38
+ };
39
+ return [aiAction].concat(_toConsumableArray(actions));
40
+ }, [actions, onAIActionClick, testId]);
41
+ var hasActions = useMemo(function () {
42
+ var _filterActionItems;
43
+ return ((_filterActionItems = filterActionItems(combinedActions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
44
+ }, [combinedActions, context]);
45
+ var onDropdownOpenChange = useCallback(function (isOpen) {
46
+ if (onActionMenuOpenChange) {
47
+ onActionMenuOpenChange({
48
+ isOpen: isOpen
49
+ });
50
+ }
51
+ }, [onActionMenuOpenChange]);
52
+ return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
53
+ testId: "".concat(testId, "-resolved-view")
54
+ }), /*#__PURE__*/React.createElement(ElementGroup, {
55
+ width: SmartLinkWidth.Flexible
56
+ }, metadataElements), hasActions && /*#__PURE__*/React.createElement(ElementGroup, {
57
+ testId: "smart-element-group-actions",
58
+ align: SmartLinkAlignment.Right,
59
+ overrideCss: getActionGroupStyles(size),
60
+ width: SmartLinkWidth.Flexible
61
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
62
+ onDropdownOpenChange: onDropdownOpenChange,
63
+ items: combinedActions,
64
+ appearance: "default"
65
+ })));
66
+ };
67
+ export default AISummaryBlockResolvedView;
@@ -1,7 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject;
4
- import { css } from '@emotion/react';
5
2
  import React, { useCallback, useMemo } from 'react';
6
3
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
7
4
  import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
@@ -9,15 +6,7 @@ import { Provider } from '../../../elements';
9
6
  import ActionGroup from '../../action-group';
10
7
  import Block from '../../block';
11
8
  import ElementGroup from '../../element-group';
12
- import { filterActionItems } from '../../utils';
13
- var getActionGroupStyles = function getActionGroupStyles(size) {
14
- if (size === SmartLinkSize.XLarge) {
15
- // The biggest height of the action button exceeds the max line-height
16
- // of the elements causing the action on the block with x-large size to
17
- // get cut at the bottom.
18
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
19
- }
20
- };
9
+ import { filterActionItems, getActionGroupStyles } from '../../utils';
21
10
  var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
22
11
  var actions = props.actions,
23
12
  testId = props.testId,
@@ -7,4 +7,5 @@ export { default as CustomBlock } from './block';
7
7
 
8
8
  // Internal components to be used within @atlaskit/smart-card only.
9
9
  export { default as InternalFooterBlock } from './footer-block/resolved';
10
- export { default as RelatedUrlsBlock } from './related-urls-block';
10
+ export { default as RelatedUrlsBlock } from './related-urls-block';
11
+ export { default as AISummaryBlock } from './ai-summary-block';
@@ -4,7 +4,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
4
4
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  var _excluded = ["name"];
7
- var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
7
+ var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
8
8
  import React from 'react';
9
9
  import { css } from '@emotion/react';
10
10
  import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
@@ -55,6 +55,14 @@ export var isJSXElementNull = function isJSXElementNull(children) {
55
55
  var isElementOrElementGroup = function isElementOrElementGroup(node) {
56
56
  return /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
57
57
  };
58
+ export var getActionGroupStyles = function getActionGroupStyles(size) {
59
+ if (size === SmartLinkSize.XLarge) {
60
+ // The biggest height of the action button exceeds the max line-height
61
+ // of the elements causing the action on the block with x-large size to
62
+ // get cut at the bottom.
63
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
64
+ }
65
+ };
58
66
  export var filterActionItems = function filterActionItems() {
59
67
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
60
68
  var context = arguments.length > 1 ? arguments[1] : undefined;