@atlaskit/smart-card 23.1.2 → 23.1.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 (58) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +0 -2
  3. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +2 -12
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +1 -5
  6. package/dist/cjs/view/BlockCard/index.js +0 -10
  7. package/dist/cjs/view/EmbedModal/index.js +2 -4
  8. package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -1
  9. package/dist/cjs/view/InlineCard/Icon.js +1 -1
  10. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +0 -2
  11. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +2 -11
  12. package/dist/es2019/version.json +1 -1
  13. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +0 -4
  14. package/dist/es2019/view/BlockCard/index.js +0 -9
  15. package/dist/es2019/view/EmbedModal/index.js +2 -3
  16. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +3 -3
  17. package/dist/es2019/view/InlineCard/Icon.js +3 -3
  18. package/dist/esm/extractors/common/actions/extractPreviewAction.js +0 -2
  19. package/dist/esm/state/hooks-external/useSmartLinkActions.js +2 -11
  20. package/dist/esm/version.json +1 -1
  21. package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -5
  22. package/dist/esm/view/BlockCard/index.js +0 -9
  23. package/dist/esm/view/EmbedModal/index.js +2 -3
  24. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -1
  25. package/dist/esm/view/InlineCard/Icon.js +1 -1
  26. package/dist/types/extractors/block/types.d.ts +0 -2
  27. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
  28. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +0 -2
  29. package/dist/types/view/Card/index.d.ts +1 -1
  30. package/dist/types/view/EmbedModal/index.d.ts +1 -3
  31. package/dist/types/view/EmbedModal/types.d.ts +1 -4
  32. package/dist/types-ts4.0/extractors/block/types.d.ts +0 -2
  33. package/dist/types-ts4.0/extractors/common/actions/extractPreviewAction.d.ts +1 -1
  34. package/dist/types-ts4.0/view/BlockCard/actions/PreviewAction.d.ts +0 -2
  35. package/dist/types-ts4.0/view/Card/index.d.ts +1 -1
  36. package/dist/types-ts4.0/view/EmbedModal/index.d.ts +1 -3
  37. package/dist/types-ts4.0/view/EmbedModal/types.d.ts +1 -4
  38. package/package.json +3 -3
  39. package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +0 -36
  40. package/dist/cjs/view/EmbedModal/components/size-experiment/types.js +0 -5
  41. package/dist/cjs/view/common/Modal.js +0 -158
  42. package/dist/cjs/view/common/ModalHeader.js +0 -114
  43. package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +0 -24
  44. package/dist/es2019/view/EmbedModal/components/size-experiment/types.js +0 -1
  45. package/dist/es2019/view/common/Modal.js +0 -115
  46. package/dist/es2019/view/common/ModalHeader.js +0 -88
  47. package/dist/esm/view/EmbedModal/components/size-experiment/index.js +0 -23
  48. package/dist/esm/view/EmbedModal/components/size-experiment/types.js +0 -1
  49. package/dist/esm/view/common/Modal.js +0 -148
  50. package/dist/esm/view/common/ModalHeader.js +0 -89
  51. package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
  52. package/dist/types/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
  53. package/dist/types/view/common/Modal.d.ts +0 -26
  54. package/dist/types/view/common/ModalHeader.d.ts +0 -19
  55. package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
  56. package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
  57. package/dist/types-ts4.0/view/common/Modal.d.ts +0 -26
  58. package/dist/types-ts4.0/view/common/ModalHeader.d.ts +0 -19
@@ -1,148 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
-
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
- /* TODO: (from codemod)
13
- We have converted this file as best we could but you might still need
14
- to manually complete migrating this usage of ModalDialog.
15
-
16
- This file uses one or more of the following ModalDialog props: 'components', 'header',
17
- 'footer', 'body'. These props have been removed as part of moving to
18
- a compositional API.
19
-
20
- The render props that used to be exposed by the custom component APIs are
21
- now accessible using the 'useModal' hook instead: 'testId', 'titleId', and 'onClose'.
22
-
23
- We are also no longer exposing 'appearance' as render prop, so this needs to be
24
- manually passed to your custom components.
25
-
26
- For a complete guide on customization using the new compositional API, refer to the docs at
27
- https://atlassian.design/components/modal-dialog/examples#customizing-modal-dialog. */
28
- import React, { useCallback, useRef, useState } from 'react';
29
- import ModalDialog, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
30
- import { Header } from './ModalHeader';
31
- import { getIframeSandboxAttribute } from '../../utils';
32
- import withAnalytics from '../EmbedModal/components/analytics';
33
- import { EmbedModalSize } from '../EmbedModal/types';
34
- var iframeStyles = {
35
- width: "100%",
36
- height: 'calc(100vh - 248px)'
37
- };
38
-
39
- var ModalWithErrorBoundary = /*#__PURE__*/function (_React$Component) {
40
- _inherits(ModalWithErrorBoundary, _React$Component);
41
-
42
- var _super = _createSuper(ModalWithErrorBoundary);
43
-
44
- function ModalWithErrorBoundary() {
45
- _classCallCheck(this, ModalWithErrorBoundary);
46
-
47
- return _super.apply(this, arguments);
48
- }
49
-
50
- _createClass(ModalWithErrorBoundary, [{
51
- key: "componentDidCatch",
52
- value: function componentDidCatch(error, errorInfo) {
53
- if (this.props.onOpenFailed) {
54
- this.props.onOpenFailed(error, errorInfo);
55
- }
56
- }
57
- }, {
58
- key: "render",
59
- value: function render() {
60
- return /*#__PURE__*/React.createElement(Modal, this.props);
61
- }
62
- }]);
63
-
64
- return ModalWithErrorBoundary;
65
- }(React.Component);
66
-
67
- var Modal = function Modal(_ref) {
68
- var onClose = _ref.onClose,
69
- onOpen = _ref.onOpen,
70
- src = _ref.src,
71
- _ref$testId = _ref.testId,
72
- testId = _ref$testId === void 0 ? 'smart-links-preview-modal' : _ref$testId,
73
- showModal = _ref.showModal,
74
- providerName = _ref.providerName,
75
- metadata = _ref.metadata,
76
- icon = _ref.icon,
77
- _ref$closeLabel = _ref.closeLabel,
78
- closeLabel = _ref$closeLabel === void 0 ? 'Close Preview' : _ref$closeLabel,
79
- iframeName = _ref.iframeName,
80
- title = _ref.title,
81
- url = _ref.url,
82
- download = _ref.download,
83
- byline = _ref.byline,
84
- _ref$isTrusted = _ref.isTrusted,
85
- isTrusted = _ref$isTrusted === void 0 ? false : _ref$isTrusted,
86
- onViewActionClick = _ref.onViewActionClick,
87
- onDownloadActionClick = _ref.onDownloadActionClick;
88
-
89
- var _useState = useState(showModal),
90
- _useState2 = _slicedToArray(_useState, 2),
91
- isOpen = _useState2[0],
92
- setIsOpen = _useState2[1];
93
-
94
- var openAt = useRef();
95
- var handleOnOpenComplete = useCallback(function () {
96
- openAt.current = Date.now();
97
-
98
- if (onOpen) {
99
- onOpen({
100
- size: EmbedModalSize.Small
101
- });
102
- }
103
- }, [onOpen]);
104
- var handleOnCloseComplete = useCallback(function () {
105
- if (onClose) {
106
- var duration = openAt.current ? Date.now() - openAt.current : undefined;
107
- onClose({
108
- duration: duration,
109
- size: EmbedModalSize.Small
110
- });
111
- }
112
- }, [onClose]);
113
- var sandbox = getIframeSandboxAttribute(isTrusted);
114
- return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
115
- height: "100%",
116
- width: "large",
117
- testId: testId,
118
- onOpenComplete: handleOnOpenComplete,
119
- onClose: function onClose() {
120
- setIsOpen(false);
121
- },
122
- onCloseComplete: handleOnCloseComplete
123
- }, /*#__PURE__*/React.createElement(Header, {
124
- providerName: providerName,
125
- icon: icon,
126
- metadata: metadata,
127
- url: url,
128
- title: title,
129
- label: closeLabel,
130
- download: download,
131
- byline: byline,
132
- onViewActionClick: onViewActionClick,
133
- onDownloadActionClick: onDownloadActionClick
134
- }), /*#__PURE__*/React.createElement(ModalBody, null, src ? /*#__PURE__*/React.createElement("iframe", {
135
- style: iframeStyles,
136
- name: iframeName,
137
- frameBorder: 0,
138
- src: src,
139
- sandbox: sandbox
140
- }) : /*#__PURE__*/React.createElement("iframe", {
141
- style: iframeStyles,
142
- name: iframeName,
143
- frameBorder: 0,
144
- sandbox: sandbox
145
- }))));
146
- };
147
-
148
- export default withAnalytics(ModalWithErrorBoundary);
@@ -1,89 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { Fragment as F } from 'react';
4
- import { useModal } from '@atlaskit/modal-dialog';
5
- import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
6
- import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
7
- import Button from '@atlaskit/button/custom-theme-button';
8
- import { N100, N30A } from '@atlaskit/theme/colors';
9
- import { token } from '@atlaskit/tokens';
10
- import { FormattedMessage } from 'react-intl-next';
11
- import { gs } from './utils';
12
- import { Icon } from './Icon';
13
- import { MetadataList } from './MetadataList';
14
- import { Byline } from './Byline';
15
- import { messages } from '../../messages';
16
- export var Header = function Header(_ref) {
17
- var title = _ref.title,
18
- label = _ref.label,
19
- _ref$metadata = _ref.metadata,
20
- metadata = _ref$metadata === void 0 ? {
21
- items: []
22
- } : _ref$metadata,
23
- icon = _ref.icon,
24
- providerName = _ref.providerName,
25
- url = _ref.url,
26
- download = _ref.download,
27
- byline = _ref.byline,
28
- onViewActionClick = _ref.onViewActionClick,
29
- onDownloadActionClick = _ref.onDownloadActionClick;
30
-
31
- var _useModal = useModal(),
32
- onClose = _useModal.onClose;
33
-
34
- return jsx("div", {
35
- style: {
36
- paddingLeft: gs(3),
37
- paddingRight: gs(3),
38
- paddingBottom: gs(2),
39
- paddingTop: gs(2)
40
- }
41
- }, jsx("div", {
42
- style: {
43
- display: 'flex',
44
- justifyContent: 'space-between',
45
- alignItems: 'baseline',
46
- borderBottom: "1px solid ".concat(token('color.border', N30A))
47
- }
48
- }, jsx("div", {
49
- css: {
50
- flex: 1
51
- }
52
- }, jsx("div", {
53
- css: {
54
- display: 'flex'
55
- }
56
- }, icon && jsx(Icon, icon), jsx("div", {
57
- css: {
58
- paddingLeft: gs(2),
59
- paddingBottom: gs(2)
60
- }
61
- }, jsx("h3", null, title), jsx("div", {
62
- css: {
63
- color: token('color.text.subtlest', N100)
64
- }
65
- }, metadata.items.length && jsx(MetadataList, {
66
- items: metadata.items
67
- }) || jsx(Byline, null, byline))))), jsx("div", null, download && jsx(Button, {
68
- appearance: "primary",
69
- href: download,
70
- onClick: onDownloadActionClick
71
- }, jsx(FormattedMessage, messages.download)), url && jsx(Button, {
72
- href: url,
73
- target: "_blank",
74
- appearance: "link",
75
- testId: "preview-view-action",
76
- iconAfter: jsx(ShortcutIcon, {
77
- size: "small",
78
- label: ""
79
- }),
80
- onClick: onViewActionClick
81
- }, providerName ? jsx(F, null, jsx(FormattedMessage, messages.viewIn), " ", providerName) : jsx(FormattedMessage, messages.viewOriginal)), jsx(Button, {
82
- appearance: "subtle",
83
- iconBefore: jsx(EditorCloseIcon, {
84
- label: label
85
- }),
86
- onClick: onClose,
87
- testId: "preview-close-button"
88
- }))));
89
- };
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import Modal from '../../../common/Modal';
3
- import { WithSizeExperimentProps } from './types';
4
- declare const withSizeExperiment: <Props, Component>(Component: React.ComponentType<Props>) => React.FC<Props & import("../../types").EmbedModalProps & import("../analytics/types").WithAnalytics & {
5
- children?: React.ReactNode;
6
- } & WithSizeExperimentProps>;
7
- export default withSizeExperiment;
@@ -1,4 +0,0 @@
1
- import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
2
- export declare type WithSizeExperimentProps = {
3
- featureFlags?: Partial<LinkingPlatformFeatureFlags>;
4
- };
@@ -1,26 +0,0 @@
1
- import React, { ErrorInfo } from 'react';
2
- import { IconProps } from './Icon';
3
- import { MetadataListProps } from './MetadataList';
4
- import { EmbedModalContext } from '../EmbedModal/types';
5
- export interface ModalProps {
6
- onClose: (context: EmbedModalContext) => void;
7
- onOpen?: (context: EmbedModalContext) => void;
8
- onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
9
- src?: string;
10
- showModal?: boolean;
11
- iframeName: string;
12
- providerName?: string;
13
- closeLabel?: string;
14
- url?: string;
15
- title?: string;
16
- metadata?: MetadataListProps;
17
- icon?: IconProps;
18
- download?: string;
19
- byline?: React.ReactNode;
20
- isTrusted?: boolean;
21
- onViewActionClick?: () => void;
22
- onDownloadActionClick?: () => void;
23
- testId?: string;
24
- }
25
- declare const _default: React.FC<import("../EmbedModal/types").EmbedModalProps & import("../EmbedModal/components/analytics/types").WithAnalytics>;
26
- export default _default;
@@ -1,19 +0,0 @@
1
- /// <reference types="react" />
2
- /** @jsx jsx */
3
- import { jsx } from '@emotion/react';
4
- import { ModalHeaderProps as HeaderComponentProps } from '@atlaskit/modal-dialog';
5
- import { IconProps } from './Icon';
6
- import { MetadataListProps } from './MetadataList';
7
- export interface HeaderProps extends HeaderComponentProps {
8
- title?: string;
9
- label: string;
10
- metadata?: MetadataListProps;
11
- icon?: IconProps;
12
- providerName?: string;
13
- url?: string;
14
- download?: string;
15
- byline?: React.ReactNode;
16
- onViewActionClick?: () => void;
17
- onDownloadActionClick?: () => void;
18
- }
19
- export declare const Header: ({ title, label, metadata, icon, providerName, url, download, byline, onViewActionClick, onDownloadActionClick, }: HeaderProps) => jsx.JSX.Element;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import Modal from '../../../common/Modal';
3
- import { WithSizeExperimentProps } from './types';
4
- declare const withSizeExperiment: <Props, Component>(Component: React.ComponentType<Props>) => React.FC<Props & import("../../types").EmbedModalProps & import("../analytics/types").WithAnalytics & {
5
- children?: React.ReactNode;
6
- } & WithSizeExperimentProps>;
7
- export default withSizeExperiment;
@@ -1,4 +0,0 @@
1
- import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
2
- export declare type WithSizeExperimentProps = {
3
- featureFlags?: Partial<LinkingPlatformFeatureFlags>;
4
- };
@@ -1,26 +0,0 @@
1
- import React, { ErrorInfo } from 'react';
2
- import { IconProps } from './Icon';
3
- import { MetadataListProps } from './MetadataList';
4
- import { EmbedModalContext } from '../EmbedModal/types';
5
- export interface ModalProps {
6
- onClose: (context: EmbedModalContext) => void;
7
- onOpen?: (context: EmbedModalContext) => void;
8
- onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
9
- src?: string;
10
- showModal?: boolean;
11
- iframeName: string;
12
- providerName?: string;
13
- closeLabel?: string;
14
- url?: string;
15
- title?: string;
16
- metadata?: MetadataListProps;
17
- icon?: IconProps;
18
- download?: string;
19
- byline?: React.ReactNode;
20
- isTrusted?: boolean;
21
- onViewActionClick?: () => void;
22
- onDownloadActionClick?: () => void;
23
- testId?: string;
24
- }
25
- declare const _default: React.FC<import("../EmbedModal/types").EmbedModalProps & import("../EmbedModal/components/analytics/types").WithAnalytics>;
26
- export default _default;
@@ -1,19 +0,0 @@
1
- /// <reference types="react" />
2
- /** @jsx jsx */
3
- import { jsx } from '@emotion/react';
4
- import { ModalHeaderProps as HeaderComponentProps } from '@atlaskit/modal-dialog';
5
- import { IconProps } from './Icon';
6
- import { MetadataListProps } from './MetadataList';
7
- export interface HeaderProps extends HeaderComponentProps {
8
- title?: string;
9
- label: string;
10
- metadata?: MetadataListProps;
11
- icon?: IconProps;
12
- providerName?: string;
13
- url?: string;
14
- download?: string;
15
- byline?: React.ReactNode;
16
- onViewActionClick?: () => void;
17
- onDownloadActionClick?: () => void;
18
- }
19
- export declare const Header: ({ title, label, metadata, icon, providerName, url, download, byline, onViewActionClick, onDownloadActionClick, }: HeaderProps) => jsx.JSX.Element;