@atlaskit/editor-plugin-card 1.2.1 → 1.2.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 (35) hide show
  1. package/.eslintrc.js +0 -12
  2. package/CHANGELOG.md +13 -0
  3. package/dist/cjs/nodeviews/datasource.js +2 -0
  4. package/dist/cjs/ui/CardContextProvider.js +4 -1
  5. package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +4 -1
  6. package/dist/cjs/ui/ResizableEmbedCard.js +2 -2
  7. package/dist/es2019/nodeviews/datasource.js +2 -0
  8. package/dist/es2019/ui/CardContextProvider.js +2 -0
  9. package/dist/es2019/ui/EditorLinkingPlatformAnalytics/index.js +2 -0
  10. package/dist/es2019/ui/InlineCardOverlay/index.js +0 -1
  11. package/dist/es2019/ui/ResizableEmbedCard.js +2 -2
  12. package/dist/esm/nodeviews/datasource.js +2 -0
  13. package/dist/esm/ui/CardContextProvider.js +4 -1
  14. package/dist/esm/ui/EditorLinkingPlatformAnalytics/index.js +4 -1
  15. package/dist/esm/ui/InlineCardOverlay/index.js +0 -1
  16. package/dist/esm/ui/ResizableEmbedCard.js +2 -2
  17. package/dist/types/datasourceErrorBoundary.d.ts +1 -1
  18. package/dist/types/nodeviews/datasource.d.ts +1 -0
  19. package/dist/types/nodeviews/embedCard.d.ts +1 -0
  20. package/dist/types/nodeviews/genericCard.d.ts +1 -1
  21. package/dist/types/ui/CardContextProvider.d.ts +1 -0
  22. package/dist/types/ui/EditorLinkingPlatformAnalytics/index.d.ts +1 -0
  23. package/dist/types/ui/EditorSmartCardEvents.d.ts +3 -4
  24. package/dist/types/ui/InlineCardOverlay/index.d.ts +3 -2
  25. package/dist/types/ui/LinkToolbarAppearance.d.ts +1 -0
  26. package/dist/types-ts4.5/datasourceErrorBoundary.d.ts +1 -1
  27. package/dist/types-ts4.5/nodeviews/datasource.d.ts +1 -0
  28. package/dist/types-ts4.5/nodeviews/embedCard.d.ts +1 -0
  29. package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -1
  30. package/dist/types-ts4.5/ui/CardContextProvider.d.ts +1 -0
  31. package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/index.d.ts +1 -0
  32. package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +3 -4
  33. package/dist/types-ts4.5/ui/InlineCardOverlay/index.d.ts +3 -2
  34. package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +1 -0
  35. package/package.json +5 -5
package/.eslintrc.js CHANGED
@@ -2,18 +2,6 @@ module.exports = {
2
2
  rules: {
3
3
  '@typescript-eslint/no-duplicate-imports': 'error',
4
4
  '@typescript-eslint/no-explicit-any': 'error',
5
- '@typescript-eslint/ban-types': [
6
- 'error',
7
- {
8
- types: {
9
- 'React.FC':
10
- 'Please use types directly on props instead, and explicitly define children if required',
11
- 'React.FunctionalComponent':
12
- 'Please use types directly on props instead, and explicitly define children if required',
13
- },
14
- extendDefaults: false,
15
- },
16
- ],
17
5
  },
18
6
  overrides: [
19
7
  {
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#79684](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79684) [`f8ed04300b5c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f8ed04300b5c) - [ux] Updating hardcoded spacing variables in smart-card to use design tokens
8
+ - [#82639](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82639) [`46e1301accc1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46e1301accc1) - React 18 types for editor-plugin-card
9
+
10
+ ## 1.2.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 1.2.1
4
17
 
5
18
  ### Patch Changes
@@ -43,6 +43,8 @@ var getPosSafely = function getPosSafely(pos) {
43
43
  var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
44
44
  (0, _inherits2.default)(DatasourceComponent, _React$PureComponent);
45
45
  var _super = _createSuper(DatasourceComponent);
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+
46
48
  function DatasourceComponent(props) {
47
49
  var _this;
48
50
  (0, _classCallCheck2.default)(this, DatasourceComponent);
@@ -29,7 +29,10 @@ var CardContextProvider = exports.CardContextProvider = /*#__PURE__*/function (_
29
29
  }
30
30
  (0, _createClass2.default)(CardContextProvider, [{
31
31
  key: "render",
32
- value: function render() {
32
+ value:
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+
35
+ function render() {
33
36
  var _this$context$context;
34
37
  var cardContext = this.context.contextAdapter ? (_this$context$context = this.context.contextAdapter.card) === null || _this$context$context === void 0 ? void 0 : _this$context$context.value : undefined;
35
38
  return this.props.children({
@@ -28,7 +28,10 @@ var EditorLinkingPlatformAnalytics = exports.EditorLinkingPlatformAnalytics = /*
28
28
  }
29
29
  (0, _createClass2.default)(EditorLinkingPlatformAnalytics, [{
30
30
  key: "render",
31
- value: function render() {
31
+ value:
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+
34
+ function render() {
32
35
  var _this$context;
33
36
  var cardContext = (_this$context = this.context) === null || _this$context === void 0 || (_this$context = _this$context.contextAdapter) === null || _this$context === void 0 ? void 0 : _this$context.card;
34
37
 
@@ -354,11 +354,11 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
354
354
  }
355
355
  return {
356
356
  left: {
357
- left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
357
+ left: "calc(".concat("var(--ds-space-negative-025, -0.125em)", " * 0.5)"),
358
358
  paddingLeft: '0px'
359
359
  },
360
360
  right: {
361
- right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
361
+ right: "calc(".concat("var(--ds-space-negative-025, -0.125em)", " * 0.5)"),
362
362
  paddingRight: '0px'
363
363
  }
364
364
  };
@@ -23,6 +23,8 @@ const getPosSafely = pos => {
23
23
  };
24
24
  // eslint-disable-next-line @repo/internal/react/no-class-components
25
25
  export class DatasourceComponent extends React.PureComponent {
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
26
28
  constructor(props) {
27
29
  super(props);
28
30
  _defineProperty(this, "getDatasource", () => this.props.node.attrs.datasource);
@@ -7,6 +7,8 @@ import PropTypes from 'prop-types';
7
7
  */
8
8
  // eslint-disable-next-line @repo/internal/react/no-class-components
9
9
  export class CardContextProvider extends React.Component {
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+
10
12
  render() {
11
13
  var _this$context$context;
12
14
  const cardContext = this.context.contextAdapter ? (_this$context$context = this.context.contextAdapter.card) === null || _this$context$context === void 0 ? void 0 : _this$context$context.value : undefined;
@@ -7,6 +7,8 @@ import { LinkEventsBinding } from './LinkEvents';
7
7
 
8
8
  // eslint-disable-next-line @repo/internal/react/no-class-components
9
9
  export class EditorLinkingPlatformAnalytics extends React.PureComponent {
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+
10
12
  render() {
11
13
  var _this$context, _this$context$context;
12
14
  const cardContext = (_this$context = this.context) === null || _this$context === void 0 ? void 0 : (_this$context$context = _this$context.contextAdapter) === null || _this$context$context === void 0 ? void 0 : _this$context$context.card;
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
3
3
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
4
4
  /** @jsx jsx */
5
-
6
5
  import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
7
6
  import { css, jsx } from '@emotion/react';
8
7
  import debounce from 'lodash/debounce';
@@ -328,11 +328,11 @@ export default class ResizableEmbedCard extends React.Component {
328
328
  }
329
329
  return {
330
330
  left: {
331
- left: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
331
+ left: `calc(${"var(--ds-space-negative-025, -0.125em)"} * 0.5)`,
332
332
  paddingLeft: '0px'
333
333
  },
334
334
  right: {
335
- right: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
335
+ right: `calc(${"var(--ds-space-negative-025, -0.125em)"} * 0.5)`,
336
336
  paddingRight: '0px'
337
337
  }
338
338
  };
@@ -37,6 +37,8 @@ var getPosSafely = function getPosSafely(pos) {
37
37
  export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
38
38
  _inherits(DatasourceComponent, _React$PureComponent);
39
39
  var _super = _createSuper(DatasourceComponent);
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+
40
42
  function DatasourceComponent(props) {
41
43
  var _this;
42
44
  _classCallCheck(this, DatasourceComponent);
@@ -22,7 +22,10 @@ export var CardContextProvider = /*#__PURE__*/function (_React$Component) {
22
22
  }
23
23
  _createClass(CardContextProvider, [{
24
24
  key: "render",
25
- value: function render() {
25
+ value:
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
+ function render() {
26
29
  var _this$context$context;
27
30
  var cardContext = this.context.contextAdapter ? (_this$context$context = this.context.contextAdapter.card) === null || _this$context$context === void 0 ? void 0 : _this$context$context.value : undefined;
28
31
  return this.props.children({
@@ -22,7 +22,10 @@ export var EditorLinkingPlatformAnalytics = /*#__PURE__*/function (_React$PureCo
22
22
  }
23
23
  _createClass(EditorLinkingPlatformAnalytics, [{
24
24
  key: "render",
25
- value: function render() {
25
+ value:
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
+ function render() {
26
29
  var _this$context;
27
30
  var cardContext = (_this$context = this.context) === null || _this$context === void 0 || (_this$context = _this$context.contextAdapter) === null || _this$context === void 0 ? void 0 : _this$context.card;
28
31
 
@@ -7,7 +7,6 @@ var _active;
7
7
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
8
8
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
9
9
  /** @jsx jsx */
10
-
11
10
  import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
12
11
  import { css, jsx } from '@emotion/react';
13
12
  import debounce from 'lodash/debounce';
@@ -348,11 +348,11 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
348
348
  }
349
349
  return {
350
350
  left: {
351
- left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
351
+ left: "calc(".concat("var(--ds-space-negative-025, -0.125em)", " * 0.5)"),
352
352
  paddingLeft: '0px'
353
353
  },
354
354
  right: {
355
- right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
355
+ right: "calc(".concat("var(--ds-space-negative-025, -0.125em)", " * 0.5)"),
356
356
  paddingRight: '0px'
357
357
  }
358
358
  };
@@ -4,7 +4,7 @@ import type { APIError } from '@atlaskit/smart-card';
4
4
  import type { DatasourceProps } from './nodeviews/datasource';
5
5
  export type DatasourceErrorBoundaryProps = React.PropsWithChildren<{
6
6
  url?: string;
7
- unsupportedComponent?: React.ComponentType;
7
+ unsupportedComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
8
8
  handleError?: () => void;
9
9
  view: DatasourceProps['view'];
10
10
  datasourceModalType?: DatasourceModalType;
@@ -26,6 +26,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
26
26
  static contextTypes: {
27
27
  contextAdapter: PropTypes.Requireable<object>;
28
28
  };
29
+ context: any;
29
30
  constructor(props: DatasourceComponentProps);
30
31
  private getDatasource;
31
32
  private getTableView;
@@ -12,6 +12,7 @@ export type EmbedCardState = {
12
12
  export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps, EmbedCardState> {
13
13
  private scrollContainer?;
14
14
  private embedIframeRef;
15
+ context: any;
15
16
  onClick: () => void;
16
17
  static contextTypes: {
17
18
  contextAdapter: PropTypes.Requireable<object>;
@@ -44,4 +44,4 @@ export interface CardProps extends CardNodeViewProps {
44
44
  export interface SmartCardProps extends CardProps {
45
45
  cardContext?: EditorContext<CardContext | undefined>;
46
46
  }
47
- export declare function Card(SmartCardComponent: React.ComponentType<SmartCardProps>, UnsupportedComponent: React.ComponentType): React.ComponentType<CardProps>;
47
+ export declare function Card(SmartCardComponent: React.ComponentType<React.PropsWithChildren<SmartCardProps>>, UnsupportedComponent: React.ComponentType<React.PropsWithChildren<unknown>>): React.ComponentType<React.PropsWithChildren<CardProps>>;
@@ -14,6 +14,7 @@ export declare class CardContextProvider extends React.Component<CardContextProv
14
14
  static contextTypes: {
15
15
  contextAdapter: PropTypes.Requireable<object>;
16
16
  };
17
+ context: any;
17
18
  render(): React.ReactNode;
18
19
  }
19
20
  export {};
@@ -5,5 +5,6 @@ export declare class EditorLinkingPlatformAnalytics extends React.PureComponent<
5
5
  static contextTypes: {
6
6
  contextAdapter: PropTypes.Requireable<object>;
7
7
  };
8
+ context: any;
8
9
  render(): JSX.Element | null;
9
10
  }
@@ -1,5 +1,4 @@
1
- import { FC } from 'react';
2
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export declare const EditorSmartCardEvents: FC<{
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const EditorSmartCardEvents: ({ editorView, }: {
4
3
  editorView: EditorView;
5
- }>;
4
+ }) => null;
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
- import type { FC } from 'react';
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
3
4
  import type { InlineCardOverlayProps } from './types';
4
- declare const InlineCardOverlay: FC<InlineCardOverlayProps>;
5
+ declare const InlineCardOverlay: ({ children, isSelected, isVisible, testId, url, ...props }: React.PropsWithChildren<InlineCardOverlayProps>) => jsx.JSX.Element;
5
6
  export default InlineCardOverlay;
@@ -26,6 +26,7 @@ export declare class LinkToolbarAppearance extends React.Component<LinkToolbarAp
26
26
  static contextTypes: {
27
27
  contextAdapter: PropTypes.Requireable<object>;
28
28
  };
29
+ context: any;
29
30
  renderDropdown: (view?: EditorView, cardContext?: CardContext) => JSX.Element | null;
30
31
  render(): JSX.Element | null;
31
32
  }
@@ -4,7 +4,7 @@ import type { APIError } from '@atlaskit/smart-card';
4
4
  import type { DatasourceProps } from './nodeviews/datasource';
5
5
  export type DatasourceErrorBoundaryProps = React.PropsWithChildren<{
6
6
  url?: string;
7
- unsupportedComponent?: React.ComponentType;
7
+ unsupportedComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
8
8
  handleError?: () => void;
9
9
  view: DatasourceProps['view'];
10
10
  datasourceModalType?: DatasourceModalType;
@@ -26,6 +26,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
26
26
  static contextTypes: {
27
27
  contextAdapter: PropTypes.Requireable<object>;
28
28
  };
29
+ context: any;
29
30
  constructor(props: DatasourceComponentProps);
30
31
  private getDatasource;
31
32
  private getTableView;
@@ -12,6 +12,7 @@ export type EmbedCardState = {
12
12
  export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps, EmbedCardState> {
13
13
  private scrollContainer?;
14
14
  private embedIframeRef;
15
+ context: any;
15
16
  onClick: () => void;
16
17
  static contextTypes: {
17
18
  contextAdapter: PropTypes.Requireable<object>;
@@ -44,4 +44,4 @@ export interface CardProps extends CardNodeViewProps {
44
44
  export interface SmartCardProps extends CardProps {
45
45
  cardContext?: EditorContext<CardContext | undefined>;
46
46
  }
47
- export declare function Card(SmartCardComponent: React.ComponentType<SmartCardProps>, UnsupportedComponent: React.ComponentType): React.ComponentType<CardProps>;
47
+ export declare function Card(SmartCardComponent: React.ComponentType<React.PropsWithChildren<SmartCardProps>>, UnsupportedComponent: React.ComponentType<React.PropsWithChildren<unknown>>): React.ComponentType<React.PropsWithChildren<CardProps>>;
@@ -14,6 +14,7 @@ export declare class CardContextProvider extends React.Component<CardContextProv
14
14
  static contextTypes: {
15
15
  contextAdapter: PropTypes.Requireable<object>;
16
16
  };
17
+ context: any;
17
18
  render(): React.ReactNode;
18
19
  }
19
20
  export {};
@@ -5,5 +5,6 @@ export declare class EditorLinkingPlatformAnalytics extends React.PureComponent<
5
5
  static contextTypes: {
6
6
  contextAdapter: PropTypes.Requireable<object>;
7
7
  };
8
+ context: any;
8
9
  render(): JSX.Element | null;
9
10
  }
@@ -1,5 +1,4 @@
1
- import { FC } from 'react';
2
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export declare const EditorSmartCardEvents: FC<{
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ export declare const EditorSmartCardEvents: ({ editorView, }: {
4
3
  editorView: EditorView;
5
- }>;
4
+ }) => null;
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
- import type { FC } from 'react';
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
3
4
  import type { InlineCardOverlayProps } from './types';
4
- declare const InlineCardOverlay: FC<InlineCardOverlayProps>;
5
+ declare const InlineCardOverlay: ({ children, isSelected, isVisible, testId, url, ...props }: React.PropsWithChildren<InlineCardOverlayProps>) => jsx.JSX.Element;
5
6
  export default InlineCardOverlay;
@@ -26,6 +26,7 @@ export declare class LinkToolbarAppearance extends React.Component<LinkToolbarAp
26
26
  static contextTypes: {
27
27
  contextAdapter: PropTypes.Requireable<object>;
28
28
  };
29
+ context: any;
29
30
  renderDropdown: (view?: EditorView, cardContext?: CardContext) => JSX.Element | null;
30
31
  render(): JSX.Element | null;
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^35.6.0",
36
36
  "@atlaskit/analytics-next": "^9.2.0",
37
37
  "@atlaskit/custom-steps": "^0.0.15",
38
- "@atlaskit/editor-common": "^78.14.0",
38
+ "@atlaskit/editor-common": "^78.17.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.0.0",
41
41
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
@@ -53,10 +53,10 @@
53
53
  "@atlaskit/linking-common": "^5.5.0",
54
54
  "@atlaskit/linking-types": "^8.7.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
- "@atlaskit/primitives": "^4.1.0",
56
+ "@atlaskit/primitives": "^5.1.0",
57
57
  "@atlaskit/smart-card": "^26.50.0",
58
58
  "@atlaskit/theme": "^12.6.0",
59
- "@atlaskit/tokens": "^1.41.0",
59
+ "@atlaskit/tokens": "^1.42.0",
60
60
  "@babel/runtime": "^7.0.0",
61
61
  "@emotion/react": "^11.7.1",
62
62
  "lodash": "^4.17.21",
@@ -128,4 +128,4 @@
128
128
  "checkDevDependencies": true
129
129
  }
130
130
  }
131
- }
131
+ }