@atlaskit/smart-card 17.4.1 → 17.4.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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/constants.js +61 -13
  3. package/dist/cjs/index.js +6 -0
  4. package/dist/cjs/utils/token.js +1 -0
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +10 -2
  7. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +51 -0
  8. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/types.js +5 -0
  9. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +6 -4
  10. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +5 -1
  11. package/dist/cjs/view/FlexibleCard/components/utils.js +15 -1
  12. package/dist/es2019/constants.js +52 -13
  13. package/dist/es2019/index.js +1 -1
  14. package/dist/es2019/utils/token.js +1 -0
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +3 -2
  17. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +29 -0
  18. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  19. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +4 -3
  20. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +4 -1
  21. package/dist/es2019/view/FlexibleCard/components/utils.js +11 -0
  22. package/dist/esm/constants.js +52 -13
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/utils/token.js +1 -0
  25. package/dist/esm/version.json +1 -1
  26. package/dist/esm/view/FlexibleCard/components/blocks/index.js +3 -2
  27. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +34 -0
  28. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  29. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +6 -4
  30. package/dist/esm/view/FlexibleCard/components/elements/utils.js +4 -1
  31. package/dist/esm/view/FlexibleCard/components/utils.js +11 -0
  32. package/dist/types/constants.d.ts +51 -0
  33. package/dist/types/index.d.ts +1 -1
  34. package/dist/types/utils/token.d.ts +1 -0
  35. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +2 -1
  36. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +4 -0
  37. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +4 -0
  38. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -0
  39. package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 17.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c8285bdcde4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c8285bdcde4) - Flexible UI: Add SnippetBlock
8
+
3
9
  ## 17.4.1
4
10
 
5
11
  ### Patch Changes
@@ -4,7 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.IconType = exports.ElementName = exports.ActionName = void 0;
7
+
8
+ /**
9
+ * The alignment of Flexible UI component.
10
+ */
7
11
  var SmartLinkAlignment;
12
+ /**
13
+ * The direction of Flexible UI components. It establish the main-axis
14
+ * or how the child components laid out inside the parent component.
15
+ * Similar to flex's flex-direction concept.
16
+ */
17
+
8
18
  exports.SmartLinkAlignment = SmartLinkAlignment;
9
19
 
10
20
  (function (SmartLinkAlignment) {
@@ -13,6 +23,11 @@ exports.SmartLinkAlignment = SmartLinkAlignment;
13
23
  })(SmartLinkAlignment || (exports.SmartLinkAlignment = SmartLinkAlignment = {}));
14
24
 
15
25
  var SmartLinkDirection;
26
+ /**
27
+ * The positioning of the component within the parent component.
28
+ * Similar to flex's align-items or align-self concept.
29
+ */
30
+
16
31
  exports.SmartLinkDirection = SmartLinkDirection;
17
32
 
18
33
  (function (SmartLinkDirection) {
@@ -21,6 +36,12 @@ exports.SmartLinkDirection = SmartLinkDirection;
21
36
  })(SmartLinkDirection || (exports.SmartLinkDirection = SmartLinkDirection = {}));
22
37
 
23
38
  var SmartLinkPosition;
39
+ /**
40
+ * The sizing options of the Flexible UI component. Every component
41
+ * has or inherits the sizing props. Implementation varies
42
+ * as per component.
43
+ */
44
+
24
45
  exports.SmartLinkPosition = SmartLinkPosition;
25
46
 
26
47
  (function (SmartLinkPosition) {
@@ -29,6 +50,10 @@ exports.SmartLinkPosition = SmartLinkPosition;
29
50
  })(SmartLinkPosition || (exports.SmartLinkPosition = SmartLinkPosition = {}));
30
51
 
31
52
  var SmartLinkSize;
53
+ /**
54
+ * Smart Links link request status
55
+ */
56
+
32
57
  exports.SmartLinkSize = SmartLinkSize;
33
58
 
34
59
  (function (SmartLinkSize) {
@@ -39,6 +64,11 @@ exports.SmartLinkSize = SmartLinkSize;
39
64
  })(SmartLinkSize || (exports.SmartLinkSize = SmartLinkSize = {}));
40
65
 
41
66
  var SmartLinkStatus;
67
+ /**
68
+ * Flexible UI theme available on the Card level.
69
+ * This determine the styling of the link.
70
+ */
71
+
42
72
  exports.SmartLinkStatus = SmartLinkStatus;
43
73
 
44
74
  (function (SmartLinkStatus) {
@@ -53,6 +83,12 @@ exports.SmartLinkStatus = SmartLinkStatus;
53
83
  })(SmartLinkStatus || (exports.SmartLinkStatus = SmartLinkStatus = {}));
54
84
 
55
85
  var SmartLinkTheme;
86
+ /**
87
+ * Determines whether the container size will fit to the content
88
+ * or expand to the available width or the parent component.
89
+ * Similar to flex's flex-grow concept.
90
+ */
91
+
56
92
  exports.SmartLinkTheme = SmartLinkTheme;
57
93
 
58
94
  (function (SmartLinkTheme) {
@@ -60,19 +96,23 @@ exports.SmartLinkTheme = SmartLinkTheme;
60
96
  SmartLinkTheme["Link"] = "link";
61
97
  })(SmartLinkTheme || (exports.SmartLinkTheme = SmartLinkTheme = {}));
62
98
 
63
- var SmartLinkWidth; // When adding an element...
64
- // 1) Create base element if it doesn't already existed.
65
- // Base element are inside src/view/FlexibleCard/components/elements.
66
- // E.g. Badge,DateTime, Icon, Lozenge, etc.
67
- // 2) Update FlexibleUiContext with the new prop for data representing
68
- // the element, preferably with the same name as the element itself.
69
- // (src/state/flexible-ui-context/types.ts)
70
- // 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
71
- // 4) Set base element and data mapping.
72
- // (src/view/FlexibleCard/components/elements/utils.tsx)
73
- // 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
74
- // 6) Update element ElementDisplaySchema for inline/block display
75
- // (src/view/FlexibleCard/components/blocks/utils.tsx)
99
+ var SmartLinkWidth;
100
+ /**
101
+ * Flexible UI element name - each reflecting the link data its represented.
102
+ * When adding an element...
103
+ * 1) Create base element if it doesn't already existed.
104
+ * Base element are inside src/view/FlexibleCard/components/elements.
105
+ * E.g. Badge,DateTime, Icon, Lozenge, etc.
106
+ * 2) Update FlexibleUiContext with the new prop for data representing
107
+ * the element, preferably with the same name as the element itself.
108
+ * (src/state/flexible-ui-context/types.ts)
109
+ * 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
110
+ * 4) Set base element and data mapping
111
+ * (src/view/FlexibleCard/components/elements/utils.tsx)
112
+ * 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
113
+ * 6) Update element ElementDisplaySchema for inline/block display
114
+ * (src/view/FlexibleCard/components/blocks/utils.tsx)
115
+ */
76
116
 
77
117
  exports.SmartLinkWidth = SmartLinkWidth;
78
118
 
@@ -82,6 +122,10 @@ exports.SmartLinkWidth = SmartLinkWidth;
82
122
  })(SmartLinkWidth || (exports.SmartLinkWidth = SmartLinkWidth = {}));
83
123
 
84
124
  var ElementName;
125
+ /**
126
+ * Flexible UI action (button)
127
+ */
128
+
85
129
  exports.ElementName = ElementName;
86
130
 
87
131
  (function (ElementName) {
@@ -103,6 +147,10 @@ exports.ElementName = ElementName;
103
147
  })(ElementName || (exports.ElementName = ElementName = {}));
104
148
 
105
149
  var ActionName;
150
+ /**
151
+ * Flexible UI icons - each mapped to AK icons.
152
+ */
153
+
106
154
  exports.ActionName = ActionName;
107
155
 
108
156
  (function (ActionName) {
package/dist/cjs/index.js CHANGED
@@ -101,6 +101,12 @@ Object.defineProperty(exports, "SmartLinkTheme", {
101
101
  return _constants.SmartLinkTheme;
102
102
  }
103
103
  });
104
+ Object.defineProperty(exports, "SnippetBlock", {
105
+ enumerable: true,
106
+ get: function get() {
107
+ return _blocks.SnippetBlock;
108
+ }
109
+ });
104
110
  Object.defineProperty(exports, "TitleBlock", {
105
111
  enumerable: true,
106
112
  get: function get() {
@@ -29,6 +29,7 @@ var tokens = {
29
29
  elevation: safeToken('elevation.shadow.raised', '0px 1px 1px #091E4240, 0px 0px 1px #091E424F'),
30
30
  errorMessage: safeToken('color.text.disabled', '#6B778C'),
31
31
  errorMessageHover: safeToken('color.text.subtle', '#8993A4'),
32
+ snippet: safeToken('color.text', '#172B4D'),
32
33
  text: safeToken('color.text.subtlest', '#626F86')
33
34
  };
34
35
  exports.tokens = tokens;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.4.1",
3
+ "version": "17.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "MetadataBlock", {
11
11
  return _metadataBlock.default;
12
12
  }
13
13
  });
14
+ Object.defineProperty(exports, "SnippetBlock", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _snippetBlock.default;
18
+ }
19
+ });
14
20
  Object.defineProperty(exports, "TitleBlock", {
15
21
  enumerable: true,
16
22
  get: function get() {
@@ -18,6 +24,8 @@ Object.defineProperty(exports, "TitleBlock", {
18
24
  }
19
25
  });
20
26
 
21
- var _titleBlock = _interopRequireDefault(require("./title-block"));
27
+ var _metadataBlock = _interopRequireDefault(require("./metadata-block"));
28
+
29
+ var _snippetBlock = _interopRequireDefault(require("./snippet-block"));
22
30
 
23
- var _metadataBlock = _interopRequireDefault(require("./metadata-block"));
31
+ var _titleBlock = _interopRequireDefault(require("./title-block"));
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _block = _interopRequireDefault(require("../block"));
17
+
18
+ var _constants = require("../../../../../constants");
19
+
20
+ var _elements = require("../../elements");
21
+
22
+ var _utils = require("../../utils");
23
+
24
+ var _excluded = ["maxLines", "status", "testId"];
25
+ var DEFAULT_MAX_LINES = 3;
26
+ var MAXIMUM_MAX_LINES = 3;
27
+ var MINIMUM_MAX_LINES = 1;
28
+
29
+ var SnippetBlock = function SnippetBlock(_ref) {
30
+ var _ref$maxLines = _ref.maxLines,
31
+ maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
32
+ _ref$status = _ref.status,
33
+ status = _ref$status === void 0 ? _constants.SmartLinkStatus.Fallback : _ref$status,
34
+ _ref$testId = _ref.testId,
35
+ testId = _ref$testId === void 0 ? 'smart-block-snippet' : _ref$testId,
36
+ blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
+
38
+ if (status !== _constants.SmartLinkStatus.Resolved) {
39
+ return null;
40
+ }
41
+
42
+ var snippetMaxLines = (0, _utils.getMaxLines)(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
43
+ return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
44
+ testId: "".concat(testId, "-resolved-view")
45
+ }), /*#__PURE__*/_react.default.createElement(_elements.Snippet, {
46
+ maxLines: snippetMaxLines
47
+ }));
48
+ };
49
+
50
+ var _default = SnippetBlock;
51
+ exports.default = _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -19,12 +19,14 @@ var _token = require("../../../../../utils/token");
19
19
 
20
20
  var _templateObject;
21
21
 
22
- var getStyles = function getStyles(maxLines) {
23
- return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), _token.tokens.text, (0, _utils.getTruncateStyles)(maxLines));
22
+ var getStyles = function getStyles(maxLines, color) {
23
+ return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), color, (0, _utils.getTruncateStyles)(maxLines));
24
24
  };
25
25
 
26
26
  var Text = function Text(_ref) {
27
- var content = _ref.content,
27
+ var _ref$color = _ref.color,
28
+ color = _ref$color === void 0 ? _token.tokens.text : _ref$color,
29
+ content = _ref.content,
28
30
  _ref$maxLines = _ref.maxLines,
29
31
  maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
30
32
  message = _ref.message,
@@ -36,7 +38,7 @@ var Text = function Text(_ref) {
36
38
  }
37
39
 
38
40
  return (0, _core.jsx)("span", {
39
- css: getStyles(maxLines),
41
+ css: getStyles(maxLines, color),
40
42
  "data-smart-element-text": true,
41
43
  "data-testid": testId
42
44
  }, (0, _utils.getFormattedMessage)(message) || content);
@@ -35,12 +35,15 @@ var _messages = require("../../../../messages");
35
35
 
36
36
  var _dateTime = _interopRequireDefault(require("./date-time"));
37
37
 
38
+ var _token = require("../../../../utils/token");
39
+
38
40
  var _elementMappings;
39
41
 
40
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
43
 
42
44
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
45
 
46
+ var SNIPPET_DEFAULT_MAX_LINES = 3;
44
47
  var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.AuthorGroup, {
45
48
  component: _avatarGroup.default
46
49
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CollaboratorGroup, {
@@ -66,7 +69,8 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
66
69
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Snippet, {
67
70
  component: _text.default,
68
71
  props: {
69
- maxLines: 3
72
+ color: _token.tokens.snippet,
73
+ maxLines: SNIPPET_DEFAULT_MAX_LINES
70
74
  }
71
75
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.State, {
72
76
  component: _lozenge.default
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getTruncateStyles = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
8
+ exports.getTruncateStyles = exports.getMaxLines = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
 
@@ -76,6 +76,20 @@ var getLinkSizeStyles = function getLinkSizeStyles(size) {
76
76
 
77
77
  exports.getLinkSizeStyles = getLinkSizeStyles;
78
78
 
79
+ var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
80
+ if (value > max) {
81
+ return defaultValue;
82
+ }
83
+
84
+ if (value < min) {
85
+ return min;
86
+ }
87
+
88
+ return value;
89
+ };
90
+
91
+ exports.getMaxLines = getMaxLines;
92
+
79
93
  var getTruncateStyles = function getTruncateStyles(maxLines) {
80
94
  var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
81
95
  return (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\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,4 +1,12 @@
1
+ /**
2
+ * The alignment of Flexible UI component.
3
+ */
1
4
  export let 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 let SmartLinkAlignment;
6
14
  })(SmartLinkAlignment || (SmartLinkAlignment = {}));
7
15
 
8
16
  export let 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 let SmartLinkDirection;
13
25
  })(SmartLinkDirection || (SmartLinkDirection = {}));
14
26
 
15
27
  export let 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 let SmartLinkPosition;
20
37
  })(SmartLinkPosition || (SmartLinkPosition = {}));
21
38
 
22
39
  export let 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 let SmartLinkSize;
29
49
  })(SmartLinkSize || (SmartLinkSize = {}));
30
50
 
31
51
  export let 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 let SmartLinkStatus;
42
66
  })(SmartLinkStatus || (SmartLinkStatus = {}));
43
67
 
44
68
  export let 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 let 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 let 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 let SmartLinkWidth; // When adding an element...
68
101
  })(SmartLinkWidth || (SmartLinkWidth = {}));
69
102
 
70
103
  export let ElementName;
104
+ /**
105
+ * Flexible UI action (button)
106
+ */
71
107
 
72
108
  (function (ElementName) {
73
109
  ElementName["AuthorGroup"] = "AuthorGroup";
@@ -88,6 +124,9 @@ export let ElementName;
88
124
  })(ElementName || (ElementName = {}));
89
125
 
90
126
  export let ActionName;
127
+ /**
128
+ * Flexible UI icons - each mapped to AK icons.
129
+ */
91
130
 
92
131
  (function (ActionName) {
93
132
  ActionName["DeleteAction"] = "DeleteAction";
@@ -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';
@@ -19,5 +19,6 @@ export const tokens = {
19
19
  elevation: safeToken('elevation.shadow.raised', '0px 1px 1px #091E4240, 0px 0px 1px #091E424F'),
20
20
  errorMessage: safeToken('color.text.disabled', '#6B778C'),
21
21
  errorMessageHover: safeToken('color.text.subtle', '#8993A4'),
22
+ snippet: safeToken('color.text', '#172B4D'),
22
23
  text: safeToken('color.text.subtlest', '#626F86')
23
24
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.4.1",
3
+ "version": "17.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -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,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';
@@ -19,5 +19,6 @@ export var tokens = {
19
19
  elevation: safeToken('elevation.shadow.raised', '0px 1px 1px #091E4240, 0px 0px 1px #091E424F'),
20
20
  errorMessage: safeToken('color.text.disabled', '#6B778C'),
21
21
  errorMessageHover: safeToken('color.text.subtle', '#8993A4'),
22
+ snippet: safeToken('color.text', '#172B4D'),
22
23
  text: safeToken('color.text.subtlest', '#626F86')
23
24
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.4.1",
3
+ "version": "17.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -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';
@@ -11,5 +11,6 @@ export declare const tokens: {
11
11
  elevation: any;
12
12
  errorMessage: any;
13
13
  errorMessageHover: any;
14
+ snippet: any;
14
15
  text: any;
15
16
  };
@@ -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.1",
3
+ "version": "17.4.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"