@dotcms/react 0.0.1-alpha.9 → 0.0.1-beta.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 (79) hide show
  1. package/README.md +24 -4
  2. package/es.regexp.to-string.esm.js +1878 -0
  3. package/index.esm.d.ts +1 -0
  4. package/index.esm.js +3461 -0
  5. package/next.esm.d.ts +1 -0
  6. package/next.esm.js +665 -0
  7. package/package.json +34 -28
  8. package/src/index.d.ts +1 -0
  9. package/src/lib/deprecated/components/BlockEditorRenderer/BlockEditorRenderer.d.ts +37 -0
  10. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Code.d.ts +17 -0
  11. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Contentlet.d.ts +41 -0
  12. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Image.d.ts +8 -0
  13. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Lists.d.ts +22 -0
  14. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Table.d.ts +16 -0
  15. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Texts.d.ts +71 -0
  16. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Video.d.ts +8 -0
  17. package/src/lib/deprecated/components/BlockEditorRenderer/item/BlockEditorBlock.d.ts +12 -0
  18. package/src/lib/deprecated/components/Column/Column.d.ts +19 -0
  19. package/src/lib/deprecated/components/Container/Container.d.ts +19 -0
  20. package/src/lib/deprecated/components/DotEditableText/DotEditableText.d.ts +30 -0
  21. package/src/lib/deprecated/components/DotEditableText/utils.d.ts +36 -0
  22. package/src/lib/{components/DotcmsLayout/DotcmsLayout.tsx → deprecated/components/DotcmsLayout/DotcmsLayout.d.ts} +9 -23
  23. package/src/lib/deprecated/components/PageProvider/PageProvider.d.ts +14 -0
  24. package/src/lib/deprecated/components/Row/Row.d.ts +26 -0
  25. package/src/lib/deprecated/contexts/PageContext.d.ts +8 -0
  26. package/src/lib/deprecated/deprecated_api.d.ts +7 -0
  27. package/src/lib/deprecated/hooks/useCheckHaveContent.d.ts +5 -0
  28. package/src/lib/deprecated/hooks/useDotcmsEditor.d.ts +13 -0
  29. package/src/lib/deprecated/hooks/useDotcmsPageContext.d.ts +9 -0
  30. package/src/lib/deprecated/mocks/mockPageContext.d.ts +7 -0
  31. package/src/lib/deprecated/models/blocks.interface.d.ts +89 -0
  32. package/src/lib/deprecated/models/content-node.interface.d.ts +82 -0
  33. package/src/lib/deprecated/models/index.d.ts +127 -0
  34. package/src/lib/deprecated/utils/utils.d.ts +58 -0
  35. package/src/lib/next/__test__/mock.d.ts +11 -0
  36. package/src/lib/next/components/Column/Column.d.ts +37 -0
  37. package/src/lib/next/components/Container/Container.d.ts +32 -0
  38. package/src/lib/next/components/Container/ContainerFallbakcs.d.ts +24 -0
  39. package/src/lib/next/components/Contentlet/Contentlet.d.ts +32 -0
  40. package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +36 -0
  41. package/src/lib/next/components/DotCMSLayoutBody/components/ErrorMessage.d.ts +9 -0
  42. package/src/lib/next/components/FallbackComponent/FallbackComponent.d.ts +41 -0
  43. package/src/lib/next/components/Row/Row.d.ts +21 -0
  44. package/src/lib/next/contexts/DotCMSPageContext.d.ts +23 -0
  45. package/src/lib/next/hooks/useCheckVisibleContent.d.ts +24 -0
  46. package/src/lib/next/hooks/useIsDevMode.d.ts +13 -0
  47. package/src/lib/next/types.d.ts +421 -0
  48. package/src/lib/next/utils/index.d.ts +136 -0
  49. package/src/next.d.ts +1 -0
  50. package/.babelrc +0 -12
  51. package/.eslintrc.json +0 -18
  52. package/jest.config.ts +0 -11
  53. package/project.json +0 -51
  54. package/src/index.ts +0 -4
  55. package/src/lib/components/Column/Column.module.css +0 -99
  56. package/src/lib/components/Column/Column.spec.tsx +0 -78
  57. package/src/lib/components/Column/Column.tsx +0 -45
  58. package/src/lib/components/Container/Container.module.css +0 -7
  59. package/src/lib/components/Container/Container.spec.tsx +0 -82
  60. package/src/lib/components/Container/Container.tsx +0 -105
  61. package/src/lib/components/DotcmsLayout/DotcmsLayout.module.css +0 -7
  62. package/src/lib/components/DotcmsLayout/DotcmsLayout.spec.tsx +0 -41
  63. package/src/lib/components/PageProvider/PageProvider.module.css +0 -7
  64. package/src/lib/components/PageProvider/PageProvider.spec.tsx +0 -54
  65. package/src/lib/components/PageProvider/PageProvider.tsx +0 -95
  66. package/src/lib/components/Row/Row.module.css +0 -5
  67. package/src/lib/components/Row/Row.spec.tsx +0 -92
  68. package/src/lib/components/Row/Row.tsx +0 -51
  69. package/src/lib/contexts/PageContext.tsx +0 -5
  70. package/src/lib/hooks/useDotcmsEditor.spec.ts +0 -56
  71. package/src/lib/hooks/useDotcmsEditor.ts +0 -29
  72. package/src/lib/hooks/useDotcmsPageContext.spec.tsx +0 -43
  73. package/src/lib/hooks/useDotcmsPageContext.tsx +0 -15
  74. package/src/lib/mocks/mockPageContext.tsx +0 -84
  75. package/src/lib/utils/utils.ts +0 -69
  76. package/tsconfig.json +0 -20
  77. package/tsconfig.lib.json +0 -23
  78. package/tsconfig.spec.json +0 -20
  79. /package/src/lib/{mocks/index.ts → deprecated/mocks/index.d.ts} +0 -0
package/package.json CHANGED
@@ -1,29 +1,35 @@
1
1
  {
2
- "name": "@dotcms/react",
3
- "version": "0.0.1-alpha.9",
4
- "peerDependencies": {
5
- "react": ">=18",
6
- "react-dom": ">=18",
7
- "@dotcms/client": "0.0.1-alpha.9"
8
- },
9
- "description": "Official React Components library to render a dotCMS page.",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/dotCMS/core.git#master"
13
- },
14
- "keywords": [
15
- "dotCMS",
16
- "CMS",
17
- "Content Management",
18
- "API Client",
19
- "REST API",
20
- "React",
21
- "Components"
22
- ],
23
- "author": "dotcms <dev@dotcms.com>",
24
- "license": "MIT",
25
- "bugs": {
26
- "url": "https://github.com/dotCMS/core/issues"
27
- },
28
- "homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/react/README.md"
29
- }
2
+ "name": "@dotcms/react",
3
+ "version": "0.0.1-beta.2",
4
+ "peerDependencies": {
5
+ "react": ">=18",
6
+ "react-dom": ">=18",
7
+ "@dotcms/client": "0.0.1-beta.2",
8
+ "@dotcms/uve": "0.0.1-beta.2",
9
+ "@tinymce/tinymce-react": "^5.1.1"
10
+ },
11
+ "description": "Official React Components library to render a dotCMS page.",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/dotCMS/core.git#main"
15
+ },
16
+ "keywords": [
17
+ "dotCMS",
18
+ "CMS",
19
+ "Content Management",
20
+ "API Client",
21
+ "REST API",
22
+ "React",
23
+ "Components"
24
+ ],
25
+ "author": "dotcms <dev@dotcms.com>",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/dotCMS/core/issues"
29
+ },
30
+ "homepage": "https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/react/README.md",
31
+ "module": "./index.esm.js",
32
+ "type": "module",
33
+ "main": "./index.esm.js",
34
+ "types": "./index.esm.d.ts"
35
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/deprecated/deprecated_api';
@@ -0,0 +1,37 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSContentlet } from '../../models';
3
+ import { Block } from '../../models/blocks.interface';
4
+ import { CustomRenderer } from '../../models/content-node.interface';
5
+ interface BaseProps {
6
+ blocks: Block;
7
+ customRenderers?: CustomRenderer;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ }
11
+ interface EditableProps extends BaseProps {
12
+ editable: true;
13
+ contentlet: DotCMSContentlet;
14
+ fieldName: string;
15
+ }
16
+ interface NonEditableProps extends BaseProps {
17
+ editable?: false;
18
+ contentlet?: never;
19
+ fieldName?: never;
20
+ }
21
+ type BlockEditorRendererProps = EditableProps | NonEditableProps;
22
+ /**
23
+ * BlockEditorRenderer component for rendering block editor field.
24
+ *
25
+ * @component
26
+ * @param {Object} props - The component props.
27
+ * @param {Block} props.blocks - The blocks of content to render.
28
+ * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
29
+ * @param {string} [props.className] - Optional CSS class name for the container div.
30
+ * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
31
+ * @param {boolean} props.editable - Flag to enable inline editing. When true, `contentlet` and `fieldName` are required. Note: Enterprise only feature.
32
+ * @param {DotCMSContentlet} [props.contentlet] - Contentlet object for inline editing. Required when `editable` is true.
33
+ * @param {string} [props.fieldName] - Field name for inline editing. Required when `editable` is true.
34
+ * @returns {JSX.Element} A div containing the rendered blocks of content.
35
+ */
36
+ export declare const BlockEditorRenderer: ({ style, blocks, editable, fieldName, className, contentlet, customRenderers }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element | null;
37
+ export {};
@@ -0,0 +1,17 @@
1
+ import { BlockProps } from '../../../models/blocks.interface';
2
+ import { CodeBlockProps } from '../../../models/content-node.interface';
3
+ /**
4
+ * Renders a code block component.
5
+ *
6
+ * @param attrs - The attributes of the code block.
7
+ * @param children - The content of the code block.
8
+ * @returns The rendered code block component.
9
+ */
10
+ export declare const CodeBlock: ({ attrs, children }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * Renders a blockquote component.
13
+ *
14
+ * @param children - The content to be rendered inside the blockquote.
15
+ * @returns The rendered blockquote component.
16
+ */
17
+ export declare const BlockQuote: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { DotContentProps } from '../../../models/content-node.interface';
2
+ export interface Contentlet {
3
+ hostName: string;
4
+ modDate: string;
5
+ publishDate: string;
6
+ title: string;
7
+ baseType: string;
8
+ inode: string;
9
+ archived: boolean;
10
+ ownerName: string;
11
+ host: string;
12
+ working: boolean;
13
+ locked: boolean;
14
+ stInode: string;
15
+ contentType: string;
16
+ live: boolean;
17
+ owner: string;
18
+ identifier: string;
19
+ publishUserName: string;
20
+ publishUser: string;
21
+ languageId: number;
22
+ creationDate: string;
23
+ url: string;
24
+ titleImage: string;
25
+ modUserName: string;
26
+ hasLiveVersion: boolean;
27
+ folder: string;
28
+ hasTitleImage: boolean;
29
+ sortOrder: number;
30
+ modUser: string;
31
+ __icon__: string;
32
+ contentTypeIcon: string;
33
+ variant: string;
34
+ }
35
+ /**
36
+ * Renders a DotContent component.
37
+ *
38
+ * @param {DotContentProps} props - The props for the DotContent component.
39
+ * @returns {JSX.Element} The rendered DotContent component.
40
+ */
41
+ export declare const DotContent: ({ customRenderers, ...props }: DotContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { ContentNode } from '../../../models/content-node.interface';
2
+ /**
3
+ * Renders an image component for dotCMS.
4
+ *
5
+ * @param props - The props for the DotCMSImage component.
6
+ * @returns The rendered image component.
7
+ */
8
+ export declare const DotCMSImage: (props: ContentNode) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { BlockProps } from '../../../models/blocks.interface';
2
+ /**
3
+ * ListItem component represents a list item in a block editor.
4
+ *
5
+ * @param children - The content of the list item.
6
+ * @returns The rendered list item element.
7
+ */
8
+ export declare const ListItem: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
9
+ /**
10
+ * Renders an ordered list component.
11
+ *
12
+ * @param children - The content to be rendered inside the ordered list.
13
+ * @returns The ordered list component.
14
+ */
15
+ export declare const OrderedList: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * Renders a bullet list component.
18
+ *
19
+ * @param children - The content of the bullet list.
20
+ * @returns The rendered bullet list component.
21
+ */
22
+ export declare const BulletList: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { ContentNode } from '../../../models/content-node.interface';
3
+ interface TableRendererProps {
4
+ content: ContentNode[];
5
+ blockEditorItem: React.FC<{
6
+ content: ContentNode[];
7
+ }>;
8
+ }
9
+ /**
10
+ * Renders a table component for the Block Editor.
11
+ *
12
+ * @param content - The content of the table.
13
+ * @param blockEditorItem - The Block Editor item component.
14
+ */
15
+ export declare const TableRenderer: React.FC<TableRendererProps>;
16
+ export {};
@@ -0,0 +1,71 @@
1
+ import { BlockProps } from '../../../models/blocks.interface';
2
+ import { ContentNode, HeadingProps, LinkProps, ParagraphProps } from '../../../models/content-node.interface';
3
+ /**
4
+ * Renders the text in bold.
5
+ *
6
+ * @param children - The content to be rendered in bold.
7
+ */
8
+ export declare const Bold: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
9
+ /**
10
+ * Renders the text in italic format.
11
+ *
12
+ * @param children - The content to be rendered in italic.
13
+ */
14
+ export declare const Italic: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * Renders a strike-through text.
17
+ *
18
+ * @param children - The content to be rendered within the strike-through element.
19
+ */
20
+ export declare const Strike: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Renders an underline element for the given children.
23
+ *
24
+ * @param children - The content to be underlined.
25
+ */
26
+ export declare const Underline: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
27
+ /**
28
+ * Renders a paragraph element.
29
+ *
30
+ * @param children - The content of the paragraph.
31
+ * @param attrs - The style attributes for the paragraph.
32
+ * @returns The rendered paragraph element.
33
+ */
34
+ export declare const Paragraph: ({ children, attrs }: ParagraphProps) => import("react/jsx-runtime").JSX.Element;
35
+ /**
36
+ * Renders a link component.
37
+ *
38
+ * @param children - The content of the link.
39
+ * @param attrs - The attributes to be applied to the link.
40
+ * @returns The rendered link component.
41
+ */
42
+ export declare const Link: ({ children, attrs }: LinkProps) => import("react/jsx-runtime").JSX.Element;
43
+ /**
44
+ * Renders a heading element with the specified level.
45
+ *
46
+ * @param children - The content of the heading.
47
+ * @param attrs - The attributes for the heading.
48
+ * @returns The rendered heading element.
49
+ */
50
+ export declare const Heading: ({ children, attrs }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
51
+ /**
52
+ * Renders the superscript text.
53
+ *
54
+ * @param children - The content to be rendered as superscript.
55
+ */
56
+ export declare const Superscript: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
57
+ /**
58
+ * Renders a subscript element.
59
+ *
60
+ * @param children - The content to be rendered as subscript.
61
+ */
62
+ export declare const Subscript: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
63
+ type TextBlockProps = Omit<ContentNode, 'content' | 'attrs'>;
64
+ /**
65
+ * Renders a text block with optional marks.
66
+ *
67
+ * @param props - The props for the TextBlock component.
68
+ * @returns The rendered text block.
69
+ */
70
+ export declare const TextBlock: (props: TextBlockProps) => string | import("react/jsx-runtime").JSX.Element | undefined;
71
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ContentNode } from '../../../models/content-node.interface';
2
+ /**
3
+ * Renders a video component for displaying videos.
4
+ *
5
+ * @param props - The properties for the video component.
6
+ * @returns The rendered video component.
7
+ */
8
+ export declare const DotCMSVideo: (props: ContentNode) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { ContentNode, CustomRenderer } from '../../../models/content-node.interface';
2
+ /**
3
+ * Renders a block editor item based on the provided content and custom renderers.
4
+ *
5
+ * @param content - The content nodes to render.
6
+ * @param customRenderers - Optional custom renderers for specific node types.
7
+ * @returns The rendered block editor item.
8
+ */
9
+ export declare const BlockEditorBlock: ({ content, customRenderers }: {
10
+ content: ContentNode[];
11
+ customRenderers?: CustomRenderer;
12
+ }) => import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,19 @@
1
+ import { DotCMSPageContext } from '../../models';
2
+ /**
3
+ * Props for Column component to render a column with its containers.
4
+ *
5
+ * @export
6
+ * @interface ColumnProps
7
+ */
8
+ export interface ColumnProps {
9
+ readonly column: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0];
10
+ }
11
+ /**
12
+ * Renders a Column with its containers using information provided by dotCMS Page API.
13
+ *
14
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
15
+ * @export
16
+ * @param {ColumnProps} { column }
17
+ * @return {JSX.Element} Rendered column with containers
18
+ */
19
+ export declare function Column({ column }: ColumnProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { DotCMSPageContext } from '../../models';
2
+ /**
3
+ * Props for the Container component.
4
+ *
5
+ * @export
6
+ * @interface ContainerProps
7
+ */
8
+ export interface ContainerProps {
9
+ readonly containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0];
10
+ }
11
+ /**
12
+ * Renders a Container with its content using information provided by dotCMS Page API.
13
+ *
14
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
15
+ * @export
16
+ * @param {ContainerProps} { containerRef }
17
+ * @return {JSX.Element} Rendered container with content
18
+ */
19
+ export declare function Container({ containerRef }: ContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { DotEditableTextProps } from './utils';
2
+ /**
3
+ * Allows inline edit content pulled from dotCMS API using TinyMCE editor
4
+ *
5
+ * @export
6
+ * @component
7
+ * @param {Readonly<DotEditableTextProps>} props {
8
+ * mode = 'plain',
9
+ * format = 'text',
10
+ * contentlet,
11
+ * fieldName = ''
12
+ * }
13
+ * @example
14
+ * ```javascript
15
+ * import { DotEditableText } from '@dotcms/react';
16
+ *
17
+ * const MyContentletWithTitle = ({ contentlet }) => (
18
+ * <h2>
19
+ * <DotEditableText
20
+ * contentlet={contentlet}
21
+ * fieldName="title"
22
+ * mode='full'
23
+ * format='text'/>
24
+ * </h2>
25
+ * );
26
+ * ```
27
+ * @returns {JSX.Element} A component to edit content inline
28
+ */
29
+ export declare function DotEditableText({ mode, format, contentlet, fieldName }: Readonly<DotEditableTextProps>): JSX.Element;
30
+ export default DotEditableText;
@@ -0,0 +1,36 @@
1
+ import { IAllProps } from '@tinymce/tinymce-react';
2
+ import { DotCMSContentlet } from '../../models';
3
+ export type DOT_EDITABLE_TEXT_FORMAT = 'html' | 'text';
4
+ export type DOT_EDITABLE_TEXT_MODE = 'minimal' | 'full' | 'plain';
5
+ export interface DotEditableTextProps {
6
+ /**
7
+ * Represents the field name of the `contentlet` that can be edited
8
+ *
9
+ * @memberof DotEditableTextProps
10
+ */
11
+ fieldName: string;
12
+ /**
13
+ * Represents the format of the editor which can be `text` or `html`
14
+ *
15
+ * @type {DOT_EDITABLE_TEXT_FORMAT}
16
+ * @memberof DotEditableTextProps
17
+ */
18
+ format?: DOT_EDITABLE_TEXT_FORMAT;
19
+ /**
20
+ * Represents the mode of the editor which can be `plain`, `minimal`, or `full`
21
+ *
22
+ * @type {DOT_EDITABLE_TEXT_MODE}
23
+ * @memberof DotEditableTextProps
24
+ */
25
+ mode?: DOT_EDITABLE_TEXT_MODE;
26
+ /**
27
+ * Represents the `contentlet` that can be inline edited
28
+ *
29
+ * @type {DotCMSContentlet}
30
+ * @memberof DotEditableTextProps
31
+ */
32
+ contentlet: DotCMSContentlet;
33
+ }
34
+ export declare const TINYMCE_CONFIG: {
35
+ [key in DOT_EDITABLE_TEXT_MODE]: IAllProps['init'];
36
+ };
@@ -1,32 +1,27 @@
1
1
  import { DotCMSPageEditorConfig } from '@dotcms/client';
2
-
3
- import { useDotcmsEditor } from '../../hooks/useDotcmsEditor';
4
- import { PageProvider, PageProviderContext } from '../PageProvider/PageProvider';
5
- import { Row } from '../Row/Row';
2
+ import { DotCMSPageContext } from '../../models';
6
3
  /**
7
4
  * `DotcmsPageProps` is a type that defines the properties for the `DotcmsLayout` component.
8
5
  * It includes a readonly `entity` property that represents the context for a DotCMS page.
9
6
  *
10
7
  * @typedef {Object} DotcmsPageProps
11
8
  *
12
- * @property {PageProviderContext} entity - The context for a DotCMS page.
9
+ * @property {DotCMSPageContext} entity - The context for a DotCMS page.
13
10
  * @readonly
14
11
  */
15
12
  export type DotcmsPageProps = {
16
13
  /**
17
- * `entity` is a readonly property of the `DotcmsPageProps` type.
14
+ * `pageContext` is a readonly property of the `DotcmsPageProps` type.
18
15
  * It represents the context for a DotCMS page and is of type `PageProviderContext`.
19
16
  *
20
- * @property {PageProviderContext} entity
17
+ * @property {PageProviderContext} pageContext
21
18
  * @memberof DotcmsPageProps
22
- * @type {PageProviderContext}
19
+ * @type {DotCMSPageContext}
23
20
  * @readonly
24
21
  */
25
- readonly entity: PageProviderContext;
26
-
27
- readonly config?: DotCMSPageEditorConfig;
22
+ readonly pageContext: DotCMSPageContext;
23
+ readonly config: DotCMSPageEditorConfig;
28
24
  };
29
-
30
25
  /**
31
26
  * `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
32
27
  * It takes a `DotcmsPageProps` object as a parameter and returns a JSX element.
@@ -34,15 +29,6 @@ export type DotcmsPageProps = {
34
29
  * @category Components
35
30
  * @param {DotcmsPageProps} props - The properties for the DotCMS page.
36
31
  * @returns {JSX.Element} - A JSX element that represents the layout for a DotCMS page.
32
+ * @deprecated Use {@link https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/react/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.tsx DotCMSLayoutBody} instead.
37
33
  */
38
- export function DotcmsLayout({ entity, config }: DotcmsPageProps): JSX.Element {
39
- const isInsideEditor = useDotcmsEditor(config);
40
-
41
- return (
42
- <PageProvider entity={{ ...entity, isInsideEditor }}>
43
- {entity.layout.body.rows.map((row, index) => (
44
- <Row key={index} row={row} />
45
- ))}
46
- </PageProvider>
47
- );
48
- }
34
+ export declare function DotcmsLayout(dotPageProps: DotcmsPageProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PageProviderProps {
3
+ readonly pageContext: any;
4
+ readonly children: ReactNode;
5
+ }
6
+ /**
7
+ * `PageProvider` is a functional component that provides a context for a DotCMS page.
8
+ * It takes a `PageProviderProps` object as a parameter and returns a JSX element.
9
+ *
10
+ * @category Components
11
+ * @param {PageProviderProps} props - The properties for the PageProvider. Includes an `entity` and `children`.
12
+ * @returns {JSX.Element} - A JSX element that provides a context for a DotCMS page.
13
+ */
14
+ export declare function PageProvider(props: PageProviderProps): JSX.Element;
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSPageContext } from '../../models';
3
+ /**
4
+ * Props for the row component
5
+ *
6
+ * @interface RowProps
7
+ *
8
+ */
9
+ export interface RowProps {
10
+ /**
11
+ * Row data
12
+ *
13
+ * @type {DotCMSPageContext['layout']['body']['rows'][0]}
14
+ * @memberof RowProps
15
+ */
16
+ row: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0];
17
+ }
18
+ /**
19
+ * This component renders a row with all it's content using the layout provided by dotCMS Page API.
20
+ *
21
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
22
+ * @category Components
23
+ * @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
24
+ * @return {JSX.Element} Rendered rows with columns
25
+ */
26
+ export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSPageContext } from '../models';
3
+ /**
4
+ * The `PageContext` is a React context that provides access to the DotCMS page context.
5
+ *
6
+ * @category Contexts
7
+ */
8
+ export declare const PageContext: import("react").Context<DotCMSPageContext | null>;
@@ -0,0 +1,7 @@
1
+ export * from './components/DotcmsLayout/DotcmsLayout';
2
+ export * from './components/DotEditableText/DotEditableText';
3
+ export * from './components/PageProvider/PageProvider';
4
+ export * from './components/Row/Row';
5
+ export * from './hooks/useDotcmsPageContext';
6
+ export * from './components/BlockEditorRenderer/BlockEditorRenderer';
7
+ export * from './models/content-node.interface';
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const useCheckHaveContent: () => {
3
+ contentletDivRef: import("react").MutableRefObject<HTMLDivElement | null>;
4
+ haveContent: boolean;
5
+ };
@@ -0,0 +1,13 @@
1
+ import { DotcmsPageProps } from '../components/DotcmsLayout/DotcmsLayout';
2
+ import { DotCMSPageContext } from '../models';
3
+ /**
4
+ * Custom Hook to handle the DotCMS editor interaction with the page.
5
+ *
6
+ * @category Hooks
7
+ * @param {DotcmsPageProps} props {
8
+ * pageContext,
9
+ * config,
10
+ * }
11
+ * @returns {DotCMSPageContext} The context for a DotCMS page provided by the editor.
12
+ */
13
+ export declare const useDotcmsEditor: ({ pageContext, config }: DotcmsPageProps) => DotCMSPageContext;
@@ -0,0 +1,9 @@
1
+ import { DotCMSPageContext } from '../models';
2
+ /**
3
+ * `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
4
+ * It takes no parameters and returns the context value or `null` if it's not available.
5
+ *
6
+ * @category Hooks
7
+ * @returns {DotCMSPageContext | null} - The context value or `null` if it's not available.
8
+ */
9
+ export declare function useDotcmsPageContext(): DotCMSPageContext | null;
@@ -0,0 +1,7 @@
1
+ import { DotCMSPageContext, DotCMSContentlet } from '../models';
2
+ export declare const dotcmsContentletMock: DotCMSContentlet;
3
+ export declare const mockPageContext: DotCMSPageContext;
4
+ export declare const MockContextRender: ({ children, mockContext }: {
5
+ children: JSX.Element;
6
+ mockContext: Partial<DotCMSPageContext>;
7
+ }) => import("react/jsx-runtime").JSX.Element;