@atlaskit/smart-card 26.14.2 → 26.14.4

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 (25) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/utils/index.js +25 -2
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/cjs/view/BlockCard/actions/ViewAction.js +4 -33
  5. package/dist/cjs/view/BlockCard/views/flexible/styled.js +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +2 -31
  7. package/dist/es2019/utils/index.js +6 -0
  8. package/dist/es2019/version.json +1 -1
  9. package/dist/es2019/view/BlockCard/actions/ViewAction.js +2 -11
  10. package/dist/es2019/view/BlockCard/views/flexible/styled.js +1 -1
  11. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +2 -11
  12. package/dist/esm/utils/index.js +22 -0
  13. package/dist/esm/version.json +1 -1
  14. package/dist/esm/view/BlockCard/actions/ViewAction.js +4 -32
  15. package/dist/esm/view/BlockCard/views/flexible/styled.js +1 -1
  16. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +2 -30
  17. package/dist/types/utils/index.d.ts +1 -0
  18. package/dist/types/view/BlockCard/actions/ViewAction.d.ts +0 -4
  19. package/dist/types/view/FlexibleCard/components/actions/action/view-action/index.d.ts +1 -2
  20. package/dist/types/view/FlexibleCard/components/actions/action/view-action/types.d.ts +0 -3
  21. package/dist/types-ts4.5/utils/index.d.ts +1 -0
  22. package/dist/types-ts4.5/view/BlockCard/actions/ViewAction.d.ts +0 -4
  23. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/view-action/index.d.ts +1 -2
  24. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/view-action/types.d.ts +0 -3
  25. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.14.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f6e68d0feb1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f6e68d0feb1) - Update css style for avatar groups in block card
8
+
9
+ ## 26.14.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c5a8ab5629d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c5a8ab5629d) - Refactor view url action
14
+
3
15
  ## 26.14.2
4
16
 
5
17
  ### Patch Changes
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.sleep = exports.isSpecialKey = exports.isSpecialEvent = exports.isSpecialClick = exports.isIntersectionObserverSupported = exports.isIframe = exports.isCardWithData = exports.importWithRetry = exports.handleOnClick = exports.getLabelForFileType = exports.getIframeSandboxAttribute = exports.getIconForFileType = void 0;
8
+ exports.sleep = exports.openUrl = exports.isSpecialKey = exports.isSpecialEvent = exports.isSpecialClick = exports.isIntersectionObserverSupported = exports.isIframe = exports.isCardWithData = exports.importWithRetry = exports.handleOnClick = exports.getLabelForFileType = exports.getIframeSandboxAttribute = exports.getIconForFileType = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -397,4 +397,27 @@ var importWithRetry = /*#__PURE__*/function () {
397
397
  return _ref.apply(this, arguments);
398
398
  };
399
399
  }();
400
- exports.importWithRetry = importWithRetry;
400
+ exports.importWithRetry = importWithRetry;
401
+ var openUrl = /*#__PURE__*/function () {
402
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
403
+ return _regenerator.default.wrap(function _callee2$(_context2) {
404
+ while (1) switch (_context2.prev = _context2.next) {
405
+ case 0:
406
+ if (url) {
407
+ _context2.next = 2;
408
+ break;
409
+ }
410
+ return _context2.abrupt("return");
411
+ case 2:
412
+ window.open(url, '_blank', 'noopener=yes');
413
+ case 3:
414
+ case "end":
415
+ return _context2.stop();
416
+ }
417
+ }, _callee2);
418
+ }));
419
+ return function openUrl(_x2) {
420
+ return _ref2.apply(this, arguments);
421
+ };
422
+ }();
423
+ exports.openUrl = openUrl;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.14.2",
3
+ "version": "26.14.4",
4
4
  "sideEffects": false
5
5
  }
@@ -5,46 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ViewAction = void 0;
8
- exports.viewFunction = viewFunction;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
8
  var _react = _interopRequireDefault(require("react"));
12
9
  var _reactIntlNext = require("react-intl-next");
13
10
  var _messages = require("../../../messages");
14
- function viewFunction(_x) {
15
- return _viewFunction.apply(this, arguments);
16
- }
17
- function _viewFunction() {
18
- _viewFunction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
19
- var url;
20
- return _regenerator.default.wrap(function _callee$(_context) {
21
- while (1) switch (_context.prev = _context.next) {
22
- case 0:
23
- url = _ref.url;
24
- if (url) {
25
- _context.next = 3;
26
- break;
27
- }
28
- return _context.abrupt("return");
29
- case 3:
30
- window.open(url, '_blank', 'noopener=yes');
31
- case 4:
32
- case "end":
33
- return _context.stop();
34
- }
35
- }, _callee);
36
- }));
37
- return _viewFunction.apply(this, arguments);
38
- }
39
- var ViewAction = function ViewAction(_ref2) {
40
- var url = _ref2.url;
11
+ var _utils = require("../../../utils");
12
+ var ViewAction = function ViewAction(_ref) {
13
+ var url = _ref.url;
41
14
  return {
42
15
  id: 'view-content',
43
16
  text: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.view),
44
17
  promise: function promise() {
45
- return viewFunction({
46
- url: url
47
- });
18
+ return (0, _utils.openUrl)(url);
48
19
  }
49
20
  };
50
21
  };
@@ -9,7 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _templateObject, _templateObject2;
11
11
  // in editor prosemirror adds padding-left so we need to overwrite it
12
- var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* primary element group */\n [data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n"])));
12
+ var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n"])));
13
13
  exports.metadataBlockCss = metadataBlockCss;
14
14
  var titleBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n gap: 0.5em;\n"])));
15
15
  exports.titleBlockCss = titleBlockCss;
@@ -5,13 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- exports.viewFunction = viewFunction;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
10
  var _react = _interopRequireDefault(require("react"));
14
11
  var _index = _interopRequireDefault(require("../index"));
12
+ var _utils = require("../../../../../../utils");
15
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
15
  var ViewAction = function ViewAction(props) {
@@ -24,9 +22,7 @@ var ViewAction = function ViewAction(props) {
24
22
  if (viewUrl && url) {
25
23
  var action = _objectSpread(_objectSpread({}, props), {}, {
26
24
  onClick: function onClick() {
27
- viewFunction({
28
- url: viewUrl
29
- });
25
+ (0, _utils.openUrl)(viewUrl);
30
26
  if (_onClick) {
31
27
  _onClick();
32
28
  }
@@ -41,30 +37,5 @@ var ViewAction = function ViewAction(props) {
41
37
  return null;
42
38
  }
43
39
  };
44
- function viewFunction(_x) {
45
- return _viewFunction.apply(this, arguments);
46
- }
47
- function _viewFunction() {
48
- _viewFunction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
49
- var url;
50
- return _regenerator.default.wrap(function _callee$(_context) {
51
- while (1) switch (_context.prev = _context.next) {
52
- case 0:
53
- url = _ref.url;
54
- if (url) {
55
- _context.next = 3;
56
- break;
57
- }
58
- return _context.abrupt("return");
59
- case 3:
60
- window.open(url, '_blank', 'noopener=yes');
61
- case 4:
62
- case "end":
63
- return _context.stop();
64
- }
65
- }, _callee);
66
- }));
67
- return _viewFunction.apply(this, arguments);
68
- }
69
40
  var _default = ViewAction;
70
41
  exports.default = _default;
@@ -119,4 +119,10 @@ export const importWithRetry = async (importFn, retries = 2, interval = 500) =>
119
119
  throw error;
120
120
  }
121
121
  }
122
+ };
123
+ export const openUrl = async url => {
124
+ if (!url) {
125
+ return;
126
+ }
127
+ window.open(url, '_blank', 'noopener=yes');
122
128
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.14.2",
3
+ "version": "26.14.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,20 +1,11 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl-next';
3
3
  import { messages } from '../../../messages';
4
- export async function viewFunction({
5
- url
6
- }) {
7
- if (!url) {
8
- return;
9
- }
10
- window.open(url, '_blank', 'noopener=yes');
11
- }
4
+ import { openUrl } from '../../../utils';
12
5
  export const ViewAction = ({
13
6
  url
14
7
  }) => ({
15
8
  id: 'view-content',
16
9
  text: /*#__PURE__*/React.createElement(FormattedMessage, messages.view),
17
- promise: () => viewFunction({
18
- url
19
- })
10
+ promise: () => openUrl(url)
20
11
  });
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
3
3
  // in editor prosemirror adds padding-left so we need to overwrite it
4
4
  export const metadataBlockCss = css`
5
5
  /* primary element group */
6
- [data-smart-element-avatar-group] {
6
+ span[data-smart-element-avatar-group] {
7
7
  > ul {
8
8
  padding-left: 0px;
9
9
  }
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Action from '../index';
4
+ import { openUrl } from '../../../../../../utils';
4
5
  const ViewAction = props => {
5
6
  const {
6
7
  appearance,
@@ -14,9 +15,7 @@ const ViewAction = props => {
14
15
  const action = {
15
16
  ...props,
16
17
  onClick: () => {
17
- viewFunction({
18
- url: viewUrl
19
- });
18
+ openUrl(viewUrl);
20
19
  if (onClick) {
21
20
  onClick();
22
21
  }
@@ -31,12 +30,4 @@ const ViewAction = props => {
31
30
  return null;
32
31
  }
33
32
  };
34
- export async function viewFunction({
35
- url
36
- }) {
37
- if (!url) {
38
- return;
39
- }
40
- window.open(url, '_blank', 'noopener=yes');
41
- }
42
33
  export default ViewAction;
@@ -275,4 +275,26 @@ export var importWithRetry = /*#__PURE__*/function () {
275
275
  return function importWithRetry(_x) {
276
276
  return _ref.apply(this, arguments);
277
277
  };
278
+ }();
279
+ export var openUrl = /*#__PURE__*/function () {
280
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
281
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
282
+ while (1) switch (_context2.prev = _context2.next) {
283
+ case 0:
284
+ if (url) {
285
+ _context2.next = 2;
286
+ break;
287
+ }
288
+ return _context2.abrupt("return");
289
+ case 2:
290
+ window.open(url, '_blank', 'noopener=yes');
291
+ case 3:
292
+ case "end":
293
+ return _context2.stop();
294
+ }
295
+ }, _callee2);
296
+ }));
297
+ return function openUrl(_x2) {
298
+ return _ref2.apply(this, arguments);
299
+ };
278
300
  }();
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.14.2",
3
+ "version": "26.14.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,42 +1,14 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import React from 'react';
4
2
  import { FormattedMessage } from 'react-intl-next';
5
3
  import { messages } from '../../../messages';
6
- export function viewFunction(_x) {
7
- return _viewFunction.apply(this, arguments);
8
- }
9
- function _viewFunction() {
10
- _viewFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
11
- var url;
12
- return _regeneratorRuntime.wrap(function _callee$(_context) {
13
- while (1) switch (_context.prev = _context.next) {
14
- case 0:
15
- url = _ref.url;
16
- if (url) {
17
- _context.next = 3;
18
- break;
19
- }
20
- return _context.abrupt("return");
21
- case 3:
22
- window.open(url, '_blank', 'noopener=yes');
23
- case 4:
24
- case "end":
25
- return _context.stop();
26
- }
27
- }, _callee);
28
- }));
29
- return _viewFunction.apply(this, arguments);
30
- }
31
- export var ViewAction = function ViewAction(_ref2) {
32
- var url = _ref2.url;
4
+ import { openUrl } from '../../../utils';
5
+ export var ViewAction = function ViewAction(_ref) {
6
+ var url = _ref.url;
33
7
  return {
34
8
  id: 'view-content',
35
9
  text: /*#__PURE__*/React.createElement(FormattedMessage, messages.view),
36
10
  promise: function promise() {
37
- return viewFunction({
38
- url: url
39
- });
11
+ return openUrl(url);
40
12
  }
41
13
  };
42
14
  };
@@ -3,5 +3,5 @@ var _templateObject, _templateObject2;
3
3
  import { css } from '@emotion/react';
4
4
 
5
5
  // in editor prosemirror adds padding-left so we need to overwrite it
6
- export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n [data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n"])));
6
+ export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n"])));
7
7
  export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 0.5em;\n"])));
@@ -1,11 +1,10 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
5
  import React from 'react';
8
6
  import Action from '../index';
7
+ import { openUrl } from '../../../../../../utils';
9
8
  var ViewAction = function ViewAction(props) {
10
9
  var appearance = props.appearance,
11
10
  asDropDownItem = props.asDropDownItem,
@@ -16,9 +15,7 @@ var ViewAction = function ViewAction(props) {
16
15
  if (viewUrl && url) {
17
16
  var action = _objectSpread(_objectSpread({}, props), {}, {
18
17
  onClick: function onClick() {
19
- viewFunction({
20
- url: viewUrl
21
- });
18
+ openUrl(viewUrl);
22
19
  if (_onClick) {
23
20
  _onClick();
24
21
  }
@@ -33,29 +30,4 @@ var ViewAction = function ViewAction(props) {
33
30
  return null;
34
31
  }
35
32
  };
36
- export function viewFunction(_x) {
37
- return _viewFunction.apply(this, arguments);
38
- }
39
- function _viewFunction() {
40
- _viewFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
41
- var url;
42
- return _regeneratorRuntime.wrap(function _callee$(_context) {
43
- while (1) switch (_context.prev = _context.next) {
44
- case 0:
45
- url = _ref.url;
46
- if (url) {
47
- _context.next = 3;
48
- break;
49
- }
50
- return _context.abrupt("return");
51
- case 3:
52
- window.open(url, '_blank', 'noopener=yes');
53
- case 4:
54
- case "end":
55
- return _context.stop();
56
- }
57
- }, _callee);
58
- }));
59
- return _viewFunction.apply(this, arguments);
60
- }
61
33
  export default ViewAction;
@@ -21,3 +21,4 @@ export declare const handleOnClick: (handler: Function) => (e: React.BaseSynthet
21
21
  export declare const isIntersectionObserverSupported: () => boolean;
22
22
  export declare const sleep: (ms: number) => Promise<void>;
23
23
  export declare const importWithRetry: <T>(importFn: () => Promise<T>, retries?: number, interval?: number) => Promise<T>;
24
+ export declare const openUrl: (url?: string) => Promise<void>;
@@ -1,8 +1,4 @@
1
1
  import { ActionProps } from '../components/Action';
2
- export interface ViewFunctionArg {
3
- url?: string;
4
- }
5
- export declare function viewFunction({ url }: ViewFunctionArg): Promise<void>;
6
2
  export declare const ViewAction: ({ url }: {
7
3
  url?: string | undefined;
8
4
  }) => ActionProps;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { ViewActionProps, ViewFunctionProps } from './types';
2
+ import { ViewActionProps } from './types';
3
3
  declare const ViewAction: React.FC<ViewActionProps>;
4
- export declare function viewFunction({ url }: ViewFunctionProps): Promise<void>;
5
4
  export default ViewAction;
@@ -3,6 +3,3 @@ export type ViewActionProps = ActionProps & {
3
3
  viewUrl?: string;
4
4
  url: string;
5
5
  };
6
- export interface ViewFunctionProps {
7
- url?: string;
8
- }
@@ -21,3 +21,4 @@ export declare const handleOnClick: (handler: Function) => (e: React.BaseSynthet
21
21
  export declare const isIntersectionObserverSupported: () => boolean;
22
22
  export declare const sleep: (ms: number) => Promise<void>;
23
23
  export declare const importWithRetry: <T>(importFn: () => Promise<T>, retries?: number, interval?: number) => Promise<T>;
24
+ export declare const openUrl: (url?: string) => Promise<void>;
@@ -1,8 +1,4 @@
1
1
  import { ActionProps } from '../components/Action';
2
- export interface ViewFunctionArg {
3
- url?: string;
4
- }
5
- export declare function viewFunction({ url }: ViewFunctionArg): Promise<void>;
6
2
  export declare const ViewAction: ({ url }: {
7
3
  url?: string | undefined;
8
4
  }) => ActionProps;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { ViewActionProps, ViewFunctionProps } from './types';
2
+ import { ViewActionProps } from './types';
3
3
  declare const ViewAction: React.FC<ViewActionProps>;
4
- export declare function viewFunction({ url }: ViewFunctionProps): Promise<void>;
5
4
  export default ViewAction;
@@ -3,6 +3,3 @@ export type ViewActionProps = ActionProps & {
3
3
  viewUrl?: string;
4
4
  url: string;
5
5
  };
6
- export interface ViewFunctionProps {
7
- url?: string;
8
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.14.2",
3
+ "version": "26.14.4",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"