@atlaskit/smart-card 17.4.0 → 17.4.3

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 (47) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/constants.js +61 -13
  3. package/dist/cjs/index.js +6 -0
  4. package/dist/cjs/utils/flexible.js +2 -2
  5. package/dist/cjs/utils/token.js +14 -23
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/CardWithUrl/component.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +10 -2
  9. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +51 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/types.js +5 -0
  11. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +6 -4
  12. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +5 -1
  13. package/dist/cjs/view/FlexibleCard/components/utils.js +15 -1
  14. package/dist/es2019/constants.js +52 -13
  15. package/dist/es2019/index.js +1 -1
  16. package/dist/es2019/utils/flexible.js +2 -2
  17. package/dist/es2019/utils/token.js +14 -21
  18. package/dist/es2019/version.json +1 -1
  19. package/dist/es2019/view/CardWithUrl/component.js +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +3 -2
  21. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +29 -0
  22. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  23. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +4 -3
  24. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +4 -1
  25. package/dist/es2019/view/FlexibleCard/components/utils.js +11 -0
  26. package/dist/esm/constants.js +52 -13
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/utils/flexible.js +2 -2
  29. package/dist/esm/utils/token.js +14 -21
  30. package/dist/esm/version.json +1 -1
  31. package/dist/esm/view/CardWithUrl/component.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/blocks/index.js +3 -2
  33. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +34 -0
  34. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  35. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +6 -4
  36. package/dist/esm/view/FlexibleCard/components/elements/utils.js +4 -1
  37. package/dist/esm/view/FlexibleCard/components/utils.js +11 -0
  38. package/dist/types/constants.d.ts +51 -0
  39. package/dist/types/index.d.ts +1 -1
  40. package/dist/types/utils/flexible.d.ts +1 -2
  41. package/dist/types/utils/token.d.ts +13 -13
  42. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +2 -1
  43. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +4 -0
  44. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +4 -0
  45. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -0
  46. package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
  47. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Block from '../block';
4
+ import { SmartLinkStatus } from '../../../../../constants';
5
+ import { Snippet } from '../../elements';
6
+ import { getMaxLines } from '../../utils';
7
+ const DEFAULT_MAX_LINES = 3;
8
+ const MAXIMUM_MAX_LINES = 3;
9
+ const MINIMUM_MAX_LINES = 1;
10
+
11
+ const SnippetBlock = ({
12
+ maxLines = DEFAULT_MAX_LINES,
13
+ status = SmartLinkStatus.Fallback,
14
+ testId = 'smart-block-snippet',
15
+ ...blockProps
16
+ }) => {
17
+ if (status !== SmartLinkStatus.Resolved) {
18
+ return null;
19
+ }
20
+
21
+ const snippetMaxLines = getMaxLines(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
22
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
23
+ testId: `${testId}-resolved-view`
24
+ }), /*#__PURE__*/React.createElement(Snippet, {
25
+ maxLines: snippetMaxLines
26
+ }));
27
+ };
28
+
29
+ export default SnippetBlock;
@@ -4,14 +4,15 @@ import { css, jsx } from '@emotion/core';
4
4
  import { getFormattedMessage, getTruncateStyles } from '../../utils';
5
5
  import { tokens } from '../../../../../utils/token';
6
6
 
7
- const getStyles = maxLines => css`
8
- color: ${tokens.text};
7
+ const getStyles = (maxLines, color) => css`
8
+ color: ${color};
9
9
  font-size: 0.75rem;
10
10
  line-height: 1rem;
11
11
  ${getTruncateStyles(maxLines)}
12
12
  `;
13
13
 
14
14
  const Text = ({
15
+ color = tokens.text,
15
16
  content,
16
17
  maxLines = 1,
17
18
  message,
@@ -22,7 +23,7 @@ const Text = ({
22
23
  }
23
24
 
24
25
  return jsx("span", {
25
- css: getStyles(maxLines),
26
+ css: getStyles(maxLines, color),
26
27
  "data-smart-element-text": true,
27
28
  "data-testid": testId
28
29
  }, getFormattedMessage(message) || content);
@@ -10,6 +10,8 @@ import AvatarGroup from './avatar-group';
10
10
  import Text from './text';
11
11
  import { messages } from '../../../../messages';
12
12
  import DateTime from './date-time';
13
+ import { tokens } from '../../../../utils/token';
14
+ const SNIPPET_DEFAULT_MAX_LINES = 3;
13
15
  const elementMappings = {
14
16
  [ElementName.AuthorGroup]: {
15
17
  component: AvatarGroup
@@ -44,7 +46,8 @@ const elementMappings = {
44
46
  [ElementName.Snippet]: {
45
47
  component: Text,
46
48
  props: {
47
- maxLines: 3
49
+ color: tokens.snippet,
50
+ maxLines: SNIPPET_DEFAULT_MAX_LINES
48
51
  }
49
52
  },
50
53
  [ElementName.State]: {
@@ -80,6 +80,17 @@ export const getLinkSizeStyles = size => {
80
80
  `;
81
81
  }
82
82
  };
83
+ export const getMaxLines = (value, defaultValue, max, min) => {
84
+ if (value > max) {
85
+ return defaultValue;
86
+ }
87
+
88
+ if (value < min) {
89
+ return min;
90
+ }
91
+
92
+ return value;
93
+ };
83
94
  export const getTruncateStyles = (maxLines, lineHeight = '1rem') => css`
84
95
  display: -webkit-box;
85
96
  overflow: hidden;
@@ -1,4 +1,12 @@
1
+ /**
2
+ * The alignment of Flexible UI component.
3
+ */
1
4
  export var SmartLinkAlignment;
5
+ /**
6
+ * The direction of Flexible UI components. It establish the main-axis
7
+ * or how the child components laid out inside the parent component.
8
+ * Similar to flex's flex-direction concept.
9
+ */
2
10
 
3
11
  (function (SmartLinkAlignment) {
4
12
  SmartLinkAlignment["Left"] = "left";
@@ -6,6 +14,10 @@ export var SmartLinkAlignment;
6
14
  })(SmartLinkAlignment || (SmartLinkAlignment = {}));
7
15
 
8
16
  export var SmartLinkDirection;
17
+ /**
18
+ * The positioning of the component within the parent component.
19
+ * Similar to flex's align-items or align-self concept.
20
+ */
9
21
 
10
22
  (function (SmartLinkDirection) {
11
23
  SmartLinkDirection["Horizontal"] = "horizontal";
@@ -13,6 +25,11 @@ export var SmartLinkDirection;
13
25
  })(SmartLinkDirection || (SmartLinkDirection = {}));
14
26
 
15
27
  export var SmartLinkPosition;
28
+ /**
29
+ * The sizing options of the Flexible UI component. Every component
30
+ * has or inherits the sizing props. Implementation varies
31
+ * as per component.
32
+ */
16
33
 
17
34
  (function (SmartLinkPosition) {
18
35
  SmartLinkPosition["Top"] = "top";
@@ -20,6 +37,9 @@ export var SmartLinkPosition;
20
37
  })(SmartLinkPosition || (SmartLinkPosition = {}));
21
38
 
22
39
  export var SmartLinkSize;
40
+ /**
41
+ * Smart Links link request status
42
+ */
23
43
 
24
44
  (function (SmartLinkSize) {
25
45
  SmartLinkSize["XLarge"] = "xlarge";
@@ -29,6 +49,10 @@ export var SmartLinkSize;
29
49
  })(SmartLinkSize || (SmartLinkSize = {}));
30
50
 
31
51
  export var SmartLinkStatus;
52
+ /**
53
+ * Flexible UI theme available on the Card level.
54
+ * This determine the styling of the link.
55
+ */
32
56
 
33
57
  (function (SmartLinkStatus) {
34
58
  SmartLinkStatus["Pending"] = "pending";
@@ -42,25 +66,34 @@ export var SmartLinkStatus;
42
66
  })(SmartLinkStatus || (SmartLinkStatus = {}));
43
67
 
44
68
  export var SmartLinkTheme;
69
+ /**
70
+ * Determines whether the container size will fit to the content
71
+ * or expand to the available width or the parent component.
72
+ * Similar to flex's flex-grow concept.
73
+ */
45
74
 
46
75
  (function (SmartLinkTheme) {
47
76
  SmartLinkTheme["Black"] = "black";
48
77
  SmartLinkTheme["Link"] = "link";
49
78
  })(SmartLinkTheme || (SmartLinkTheme = {}));
50
79
 
51
- export var SmartLinkWidth; // When adding an element...
52
- // 1) Create base element if it doesn't already existed.
53
- // Base element are inside src/view/FlexibleCard/components/elements.
54
- // E.g. Badge,DateTime, Icon, Lozenge, etc.
55
- // 2) Update FlexibleUiContext with the new prop for data representing
56
- // the element, preferably with the same name as the element itself.
57
- // (src/state/flexible-ui-context/types.ts)
58
- // 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
59
- // 4) Set base element and data mapping.
60
- // (src/view/FlexibleCard/components/elements/utils.tsx)
61
- // 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
62
- // 6) Update element ElementDisplaySchema for inline/block display
63
- // (src/view/FlexibleCard/components/blocks/utils.tsx)
80
+ export var SmartLinkWidth;
81
+ /**
82
+ * Flexible UI element name - each reflecting the link data its represented.
83
+ * When adding an element...
84
+ * 1) Create base element if it doesn't already existed.
85
+ * Base element are inside src/view/FlexibleCard/components/elements.
86
+ * E.g. Badge,DateTime, Icon, Lozenge, etc.
87
+ * 2) Update FlexibleUiContext with the new prop for data representing
88
+ * the element, preferably with the same name as the element itself.
89
+ * (src/state/flexible-ui-context/types.ts)
90
+ * 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
91
+ * 4) Set base element and data mapping
92
+ * (src/view/FlexibleCard/components/elements/utils.tsx)
93
+ * 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
94
+ * 6) Update element ElementDisplaySchema for inline/block display
95
+ * (src/view/FlexibleCard/components/blocks/utils.tsx)
96
+ */
64
97
 
65
98
  (function (SmartLinkWidth) {
66
99
  SmartLinkWidth["FitToContent"] = "fit-to-content";
@@ -68,6 +101,9 @@ export var SmartLinkWidth; // When adding an element...
68
101
  })(SmartLinkWidth || (SmartLinkWidth = {}));
69
102
 
70
103
  export var ElementName;
104
+ /**
105
+ * Flexible UI action (button)
106
+ */
71
107
 
72
108
  (function (ElementName) {
73
109
  ElementName["AuthorGroup"] = "AuthorGroup";
@@ -88,6 +124,9 @@ export var ElementName;
88
124
  })(ElementName || (ElementName = {}));
89
125
 
90
126
  export var ActionName;
127
+ /**
128
+ * Flexible UI icons - each mapped to AK icons.
129
+ */
91
130
 
92
131
  (function (ActionName) {
93
132
  ActionName["DeleteAction"] = "DeleteAction";
package/dist/esm/index.js CHANGED
@@ -13,4 +13,4 @@ export { contentFooterClassName, metadataListClassName, blockCardResolvingViewCl
13
13
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback'; // Flexible UI
14
14
 
15
15
  export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from './constants';
16
- export { MetadataBlock, TitleBlock } from './view/FlexibleCard/components/blocks';
16
+ export { MetadataBlock, SnippetBlock, TitleBlock } from './view/FlexibleCard/components/blocks';
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import * as Blocks from '../view/FlexibleCard/components/blocks';
3
3
  import { TitleBlock } from '../view/FlexibleCard/components/blocks';
4
4
  import * as Elements from '../view/FlexibleCard/components/elements';
5
- export var isFlexibleUiCard = function isFlexibleUiCard(appearance, children) {
6
- if ((appearance === 'inline' || appearance === 'block') && children && React.Children.toArray(children).some(function (child) {
5
+ export var isFlexibleUiCard = function isFlexibleUiCard(children) {
6
+ if (children && React.Children.toArray(children).some(function (child) {
7
7
  return isFlexibleUiBlock(child);
8
8
  })) {
9
9
  return true;
@@ -1,23 +1,16 @@
1
- import { token } from '@atlaskit/tokens'; // Temporary safeguard while @atlaskit/tokens is being developed
2
-
3
- export var safeToken = function safeToken(path, fallback) {
4
- try {
5
- return token(path, fallback);
6
- } catch (e) {
7
- return fallback;
8
- }
9
- };
1
+ import { token } from '@atlaskit/tokens';
10
2
  export var tokens = {
11
- actionIcon: safeToken('color.icon', '#44546F'),
12
- background: safeToken('elevation.surface', '#FFFFFF'),
13
- badgeIcon: safeToken('color.icon.subtle', '#626F86'),
14
- badgeText: safeToken('color.text.subtlest', '#626F86'),
15
- blackLink: safeToken('color.text.subtle', '#44546F'),
16
- blackLinkPressed: safeToken('color.text', '#172B4D'),
17
- blueLink: safeToken('color.link', '#0C66E4'),
18
- blueLinkPressed: safeToken('color.link.pressed', '#0055CC'),
19
- elevation: safeToken('elevation.shadow.raised', '0px 1px 1px #091E4240, 0px 0px 1px #091E424F'),
20
- errorMessage: safeToken('color.text.disabled', '#6B778C'),
21
- errorMessageHover: safeToken('color.text.subtle', '#8993A4'),
22
- text: safeToken('color.text.subtlest', '#626F86')
3
+ actionIcon: token('color.icon', '#44546F'),
4
+ background: token('elevation.surface', '#FFFFFF'),
5
+ badgeIcon: token('color.icon.subtle', '#626F86'),
6
+ badgeText: token('color.text.subtlest', '#626F86'),
7
+ blackLink: token('color.text.subtle', '#44546F'),
8
+ blackLinkPressed: token('color.text', '#172B4D'),
9
+ blueLink: token('color.link', '#0C66E4'),
10
+ blueLinkPressed: token('color.link.pressed', '#0055CC'),
11
+ elevation: token('elevation.shadow.raised', '0px 1px 1px #091E4240, 0px 0px 1px #091E424F'),
12
+ errorMessage: token('color.text.disabled', '#6B778C'),
13
+ errorMessageHover: token('color.text.subtle', '#8993A4'),
14
+ snippet: token('color.text', '#172B4D'),
15
+ text: token('color.text.subtlest', '#626F86')
23
16
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.4.0",
3
+ "version": "17.4.3",
4
4
  "sideEffects": false
5
5
  }
@@ -84,7 +84,7 @@ export function CardWithUrlContent(_ref) {
84
84
  throw error;
85
85
  }
86
86
 
87
- if (isFlexibleUiCard(appearance, children)) {
87
+ if (isFlexibleUiCard(children)) {
88
88
  return /*#__PURE__*/React.createElement(FlexibleCard, {
89
89
  cardState: state,
90
90
  onAuthorize: services.length && handleAuthorize || undefined,
@@ -1,2 +1,3 @@
1
- export { default as TitleBlock } from './title-block';
2
- export { default as MetadataBlock } from './metadata-block';
1
+ export { default as MetadataBlock } from './metadata-block';
2
+ export { default as SnippetBlock } from './snippet-block';
3
+ export { default as TitleBlock } from './title-block';
@@ -0,0 +1,34 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["maxLines", "status", "testId"];
4
+ import React from 'react';
5
+ import Block from '../block';
6
+ import { SmartLinkStatus } from '../../../../../constants';
7
+ import { Snippet } from '../../elements';
8
+ import { getMaxLines } from '../../utils';
9
+ var DEFAULT_MAX_LINES = 3;
10
+ var MAXIMUM_MAX_LINES = 3;
11
+ var MINIMUM_MAX_LINES = 1;
12
+
13
+ var SnippetBlock = function SnippetBlock(_ref) {
14
+ var _ref$maxLines = _ref.maxLines,
15
+ maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
16
+ _ref$status = _ref.status,
17
+ status = _ref$status === void 0 ? SmartLinkStatus.Fallback : _ref$status,
18
+ _ref$testId = _ref.testId,
19
+ testId = _ref$testId === void 0 ? 'smart-block-snippet' : _ref$testId,
20
+ blockProps = _objectWithoutProperties(_ref, _excluded);
21
+
22
+ if (status !== SmartLinkStatus.Resolved) {
23
+ return null;
24
+ }
25
+
26
+ var snippetMaxLines = getMaxLines(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
27
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
28
+ testId: "".concat(testId, "-resolved-view")
29
+ }), /*#__PURE__*/React.createElement(Snippet, {
30
+ maxLines: snippetMaxLines
31
+ }));
32
+ };
33
+
34
+ export default SnippetBlock;
@@ -8,12 +8,14 @@ import { css, jsx } from '@emotion/core';
8
8
  import { getFormattedMessage, getTruncateStyles } from '../../utils';
9
9
  import { tokens } from '../../../../../utils/token';
10
10
 
11
- var getStyles = function getStyles(maxLines) {
12
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), tokens.text, getTruncateStyles(maxLines));
11
+ var getStyles = function getStyles(maxLines, color) {
12
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), color, getTruncateStyles(maxLines));
13
13
  };
14
14
 
15
15
  var Text = function Text(_ref) {
16
- var content = _ref.content,
16
+ var _ref$color = _ref.color,
17
+ color = _ref$color === void 0 ? tokens.text : _ref$color,
18
+ content = _ref.content,
17
19
  _ref$maxLines = _ref.maxLines,
18
20
  maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
19
21
  message = _ref.message,
@@ -25,7 +27,7 @@ var Text = function Text(_ref) {
25
27
  }
26
28
 
27
29
  return jsx("span", {
28
- css: getStyles(maxLines),
30
+ css: getStyles(maxLines, color),
29
31
  "data-smart-element-text": true,
30
32
  "data-testid": testId
31
33
  }, getFormattedMessage(message) || content);
@@ -14,6 +14,8 @@ import AvatarGroup from './avatar-group';
14
14
  import Text from './text';
15
15
  import { messages } from '../../../../messages';
16
16
  import DateTime from './date-time';
17
+ import { tokens } from '../../../../utils/token';
18
+ var SNIPPET_DEFAULT_MAX_LINES = 3;
17
19
  var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings, ElementName.AuthorGroup, {
18
20
  component: AvatarGroup
19
21
  }), _defineProperty(_elementMappings, ElementName.CollaboratorGroup, {
@@ -39,7 +41,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
39
41
  }), _defineProperty(_elementMappings, ElementName.Snippet, {
40
42
  component: Text,
41
43
  props: {
42
- maxLines: 3
44
+ color: tokens.snippet,
45
+ maxLines: SNIPPET_DEFAULT_MAX_LINES
43
46
  }
44
47
  }), _defineProperty(_elementMappings, ElementName.State, {
45
48
  component: Lozenge
@@ -51,6 +51,17 @@ export var getLinkSizeStyles = function getLinkSizeStyles(size) {
51
51
  return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 0.75rem;\n font-weight: 500;\n letter-spacing: 0em;\n line-height: ", ";\n "])), getLinkLineHeight(size));
52
52
  }
53
53
  };
54
+ export var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
55
+ if (value > max) {
56
+ return defaultValue;
57
+ }
58
+
59
+ if (value < min) {
60
+ return min;
61
+ }
62
+
63
+ return value;
64
+ };
54
65
  export var getTruncateStyles = function getTruncateStyles(maxLines) {
55
66
  var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
56
67
  return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n -webkit-line-clamp: ", ";\n -webkit-box-orient: vertical;\n // Fallback options\n max-height: calc(", " * ", ");\n "])), maxLines, maxLines, lineHeight);
@@ -1,21 +1,41 @@
1
+ /**
2
+ * The alignment of Flexible UI component.
3
+ */
1
4
  export declare enum SmartLinkAlignment {
2
5
  Left = "left",
3
6
  Right = "right"
4
7
  }
8
+ /**
9
+ * The direction of Flexible UI components. It establish the main-axis
10
+ * or how the child components laid out inside the parent component.
11
+ * Similar to flex's flex-direction concept.
12
+ */
5
13
  export declare enum SmartLinkDirection {
6
14
  Horizontal = "horizontal",
7
15
  Vertical = "vertical"
8
16
  }
17
+ /**
18
+ * The positioning of the component within the parent component.
19
+ * Similar to flex's align-items or align-self concept.
20
+ */
9
21
  export declare enum SmartLinkPosition {
10
22
  Top = "top",
11
23
  Center = "center"
12
24
  }
25
+ /**
26
+ * The sizing options of the Flexible UI component. Every component
27
+ * has or inherits the sizing props. Implementation varies
28
+ * as per component.
29
+ */
13
30
  export declare enum SmartLinkSize {
14
31
  XLarge = "xlarge",
15
32
  Large = "large",
16
33
  Medium = "medium",
17
34
  Small = "small"
18
35
  }
36
+ /**
37
+ * Smart Links link request status
38
+ */
19
39
  export declare enum SmartLinkStatus {
20
40
  Pending = "pending",
21
41
  Resolving = "resolving",
@@ -26,14 +46,39 @@ export declare enum SmartLinkStatus {
26
46
  Unauthorized = "unauthorized",
27
47
  Fallback = "fallback"
28
48
  }
49
+ /**
50
+ * Flexible UI theme available on the Card level.
51
+ * This determine the styling of the link.
52
+ */
29
53
  export declare enum SmartLinkTheme {
30
54
  Black = "black",
31
55
  Link = "link"
32
56
  }
57
+ /**
58
+ * Determines whether the container size will fit to the content
59
+ * or expand to the available width or the parent component.
60
+ * Similar to flex's flex-grow concept.
61
+ */
33
62
  export declare enum SmartLinkWidth {
34
63
  FitToContent = "fit-to-content",
35
64
  Flexible = "flexible"
36
65
  }
66
+ /**
67
+ * Flexible UI element name - each reflecting the link data its represented.
68
+ * When adding an element...
69
+ * 1) Create base element if it doesn't already existed.
70
+ * Base element are inside src/view/FlexibleCard/components/elements.
71
+ * E.g. Badge,DateTime, Icon, Lozenge, etc.
72
+ * 2) Update FlexibleUiContext with the new prop for data representing
73
+ * the element, preferably with the same name as the element itself.
74
+ * (src/state/flexible-ui-context/types.ts)
75
+ * 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
76
+ * 4) Set base element and data mapping
77
+ * (src/view/FlexibleCard/components/elements/utils.tsx)
78
+ * 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
79
+ * 6) Update element ElementDisplaySchema for inline/block display
80
+ * (src/view/FlexibleCard/components/blocks/utils.tsx)
81
+ */
37
82
  export declare enum ElementName {
38
83
  AuthorGroup = "AuthorGroup",
39
84
  CollaboratorGroup = "CollaboratorGroup",
@@ -51,9 +96,15 @@ export declare enum ElementName {
51
96
  Title = "Title",
52
97
  Provider = "Provider"
53
98
  }
99
+ /**
100
+ * Flexible UI action (button)
101
+ */
54
102
  export declare enum ActionName {
55
103
  DeleteAction = "DeleteAction"
56
104
  }
105
+ /**
106
+ * Flexible UI icons - each mapped to AK icons.
107
+ */
57
108
  export declare enum IconType {
58
109
  Archive = "FileType:Archive",
59
110
  Audio = "FileType:Audio",
@@ -17,5 +17,5 @@ export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents';
17
17
  export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName, } from './classNames';
18
18
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
19
19
  export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
20
- export { MetadataBlock, TitleBlock, } from './view/FlexibleCard/components/blocks';
20
+ export { MetadataBlock, SnippetBlock, TitleBlock, } from './view/FlexibleCard/components/blocks';
21
21
  export type { ActionItem, ElementItem, } from './view/FlexibleCard/components/blocks/types';
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { CardAppearance } from '../view/Card';
3
- export declare const isFlexibleUiCard: (appearance: CardAppearance, children?: React.ReactNode) => boolean;
2
+ export declare const isFlexibleUiCard: (children?: React.ReactNode) => boolean;
4
3
  export declare const isFlexibleUiBlock: (node: React.ReactNode) => boolean;
5
4
  export declare const isFlexibleUiElement: (node: React.ReactNode) => boolean;
6
5
  export declare const isFlexibleUiTitleBlock: (node: React.ReactNode) => boolean;
@@ -1,15 +1,15 @@
1
- export declare const safeToken: (path: string, fallback?: string | undefined) => any;
2
1
  export declare const tokens: {
3
- actionIcon: any;
4
- background: any;
5
- badgeIcon: any;
6
- badgeText: any;
7
- blackLink: any;
8
- blackLinkPressed: any;
9
- blueLink: any;
10
- blueLinkPressed: any;
11
- elevation: any;
12
- errorMessage: any;
13
- errorMessageHover: any;
14
- text: any;
2
+ actionIcon: "var(--ds-icon)";
3
+ background: "var(--ds-surface)";
4
+ badgeIcon: "var(--ds-icon-subtle)";
5
+ badgeText: "var(--ds-text-subtlest)";
6
+ blackLink: "var(--ds-text-subtle)";
7
+ blackLinkPressed: "var(--ds-text)";
8
+ blueLink: "var(--ds-link)";
9
+ blueLinkPressed: "var(--ds-link-pressed)";
10
+ elevation: "var(--ds-shadow-raised)";
11
+ errorMessage: "var(--ds-text-disabled)";
12
+ errorMessageHover: "var(--ds-text-subtle)";
13
+ snippet: "var(--ds-text)";
14
+ text: "var(--ds-text-subtlest)";
15
15
  };
@@ -1,2 +1,3 @@
1
- export { default as TitleBlock } from './title-block';
2
1
  export { default as MetadataBlock } from './metadata-block';
2
+ export { default as SnippetBlock } from './snippet-block';
3
+ export { default as TitleBlock } from './title-block';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SnippetBlockProps } from './types';
3
+ declare const SnippetBlock: React.FC<SnippetBlockProps>;
4
+ export default SnippetBlock;
@@ -0,0 +1,4 @@
1
+ import { BlockProps } from '../types';
2
+ export declare type SnippetBlockProps = BlockProps & {
3
+ maxLines?: number;
4
+ };
@@ -1,6 +1,7 @@
1
1
  import { ElementProps } from '../types';
2
2
  import { MessageProps } from '../../types';
3
3
  export declare type TextProps = ElementProps & {
4
+ color?: string;
4
5
  content?: string;
5
6
  maxLines?: number;
6
7
  message?: MessageProps;
@@ -6,4 +6,5 @@ export declare const getFormattedMessage: (message?: MessageProps | undefined) =
6
6
  export declare const getIconSizeStyles: (width: string) => SerializedStyles;
7
7
  export declare const getLinkLineHeight: (size: SmartLinkSize) => string;
8
8
  export declare const getLinkSizeStyles: (size: SmartLinkSize) => SerializedStyles;
9
+ export declare const getMaxLines: (value: number, defaultValue: number, max: number, min: number) => number;
9
10
  export declare const getTruncateStyles: (maxLines: number, lineHeight?: string) => SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.4.0",
3
+ "version": "17.4.3",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"