@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
@@ -0,0 +1,89 @@
1
+ /// <reference types="react" />
2
+ import { ContentNode } from './content-node.interface';
3
+ /**
4
+ * Represents a Block of content provided by the Block Editor
5
+ *
6
+ * @export
7
+ * @interface Block
8
+ */
9
+ export interface Block {
10
+ content: ContentNode[];
11
+ type: string;
12
+ }
13
+ /**
14
+ * Props for a contentlet inside the Block Editor
15
+ *
16
+ * @export
17
+ * @interface DotContentletProps
18
+ */
19
+ export interface DotContentletProps {
20
+ title: string;
21
+ baseType: string;
22
+ inode: string;
23
+ archived: boolean;
24
+ working: boolean;
25
+ locked: boolean;
26
+ contentType: string;
27
+ live: boolean;
28
+ identifier: string;
29
+ image: string;
30
+ imageContentAsset: string;
31
+ urlTitle: string;
32
+ url: string;
33
+ titleImage: string;
34
+ urlMap: string;
35
+ hasLiveVersion: boolean;
36
+ hasTitleImage: boolean;
37
+ sortOrder: number;
38
+ modUser: string;
39
+ __icon__: string;
40
+ contentTypeIcon: string;
41
+ language: string;
42
+ description: string;
43
+ shortDescription: string;
44
+ salePrice: string;
45
+ retailPrice: string;
46
+ mimeType: string;
47
+ thumbnail?: string;
48
+ }
49
+ /**
50
+ * Props for a block inside the Block Editor Component
51
+ *
52
+ * @export
53
+ * @interface BlockProps
54
+ */
55
+ export interface BlockProps {
56
+ children: React.ReactNode;
57
+ }
58
+ /**
59
+ * Represents the different types of Blocks that can be used in the Block Editor
60
+ *
61
+ * @export
62
+ * @enum {number}
63
+ */
64
+ export declare enum Blocks {
65
+ PARAGRAPH = "paragraph",
66
+ HEADING = "heading",
67
+ TEXT = "text",
68
+ BULLET_LIST = "bulletList",
69
+ ORDERED_LIST = "orderedList",
70
+ LIST_ITEM = "listItem",
71
+ BLOCK_QUOTE = "blockquote",
72
+ CODE_BLOCK = "codeBlock",
73
+ HARDBREAK = "hardBreak",
74
+ HORIZONTAL_RULE = "horizontalRule",
75
+ DOT_IMAGE = "dotImage",
76
+ DOT_VIDEO = "dotVideo",
77
+ TABLE = "table",
78
+ DOT_CONTENT = "dotContent"
79
+ }
80
+ /**
81
+ * Represents the validation state of a Block Editor instance
82
+ *
83
+ * @interface BlockEditorState
84
+ * @property {boolean} isValid - Whether the blocks structure is valid
85
+ * @property {string | null} error - Error message if blocks are invalid, null otherwise
86
+ */
87
+ export interface BlockEditorState {
88
+ error: string | null;
89
+ }
@@ -0,0 +1,82 @@
1
+ /// <reference types="react" />
2
+ import { BlockProps } from './blocks.interface';
3
+ /**
4
+ * Represents a Mark used by text content in the Block Editor
5
+ *
6
+ * @export
7
+ * @interface Mark
8
+ */
9
+ export interface Mark {
10
+ type: string;
11
+ attrs: Record<string, string>;
12
+ }
13
+ /**
14
+ * Represents a Content Node used by the Block Editor
15
+ *
16
+ * @export
17
+ * @interface ContentNode
18
+ */
19
+ export interface ContentNode {
20
+ type: string;
21
+ content: ContentNode[];
22
+ attrs?: Record<string, string>;
23
+ marks?: Mark[];
24
+ text?: string;
25
+ }
26
+ /**
27
+ * Represents a Custom Renderer used by the Block Editor Component
28
+ *
29
+ * @export
30
+ * @interface CustomRenderer
31
+ */
32
+ export type CustomRenderer<T = any> = Record<string, React.FC<T>>;
33
+ /**
34
+ * Represents a CodeBlock used by the Block Editor Component
35
+ * @export
36
+ * @interface CodeBlockProps
37
+ */
38
+ export type CodeBlockProps = BlockProps & ContentNode;
39
+ /**
40
+ * Represents a Heading used by the Block Editor Component
41
+ * @export
42
+ * @interface HeadingProps
43
+ */
44
+ export type HeadingProps = BlockProps & ContentNode;
45
+ /**
46
+ * Represents a Link used by the Block Editor Component
47
+ * @export
48
+ * @interface LinkProps
49
+ */
50
+ export type LinkProps = BlockProps & {
51
+ attrs?: Mark['attrs'];
52
+ };
53
+ /**
54
+ * Represents a Paragraph used by the Block Editor Component
55
+ * @export
56
+ * @interface ParagraphProps
57
+ */
58
+ export type ParagraphProps = BlockProps & ContentNode;
59
+ /**
60
+ * Represents a DotCMSVideo used by the Block Editor Component
61
+ * @export
62
+ * @interface DotCMSVideoProps
63
+ */
64
+ export type DotCMSVideoProps = ContentNode['attrs'] & {
65
+ data?: Record<string, string>;
66
+ };
67
+ /**
68
+ * Represents a DotCMSImage used by the Block Editor Component
69
+ * @export
70
+ * @interface DotCMSImageProps
71
+ */
72
+ export type DotCMSImageProps = ContentNode['attrs'] & {
73
+ data?: Record<string, unknown>;
74
+ };
75
+ /**
76
+ * Represents a DotContent used by the Block Editor Component
77
+ * @export
78
+ * @interface DotContentProps
79
+ */
80
+ export type DotContentProps = ContentNode & {
81
+ customRenderers?: CustomRenderer;
82
+ };
@@ -0,0 +1,127 @@
1
+ /// <reference types="react" />
2
+ export interface ContainerData {
3
+ [key: string]: {
4
+ container: {
5
+ path: string;
6
+ identifier: string;
7
+ maxContentlets: number;
8
+ parentPermissionable: Record<string, string>;
9
+ };
10
+ containerStructures: {
11
+ contentTypeVar: string;
12
+ }[];
13
+ contentlets: {
14
+ [key: string]: {
15
+ contentType: string;
16
+ identifier: string;
17
+ title: string;
18
+ inode: string;
19
+ onNumberOfPages: number;
20
+ widgetTitle?: string;
21
+ baseType: string;
22
+ }[];
23
+ };
24
+ };
25
+ }
26
+ export interface DotCMSPageContext {
27
+ /**
28
+ * `components` is a property of the `PageProviderProps` type.
29
+ * It is an object that maps content type variables to their corresponding React components.
30
+ *
31
+ * It will be use to render the contentlets in the page.
32
+ *
33
+ * @property {Object} components
34
+ * @memberof PageProviderProps
35
+ * @type {Object.<string, React.ElementType>}
36
+ */
37
+ components: {
38
+ [contentTypeVariable: string]: React.ElementType;
39
+ };
40
+ pageAsset: {
41
+ containers: ContainerData;
42
+ layout: {
43
+ header: boolean;
44
+ footer: boolean;
45
+ body: {
46
+ rows: {
47
+ styleClass: string;
48
+ columns: {
49
+ styleClass: string;
50
+ width: number;
51
+ leftOffset: number;
52
+ containers: {
53
+ identifier: string;
54
+ uuid: string;
55
+ }[];
56
+ }[];
57
+ }[];
58
+ };
59
+ };
60
+ page: {
61
+ title: string;
62
+ identifier: string;
63
+ };
64
+ viewAs: {
65
+ language: {
66
+ id: string;
67
+ };
68
+ persona: {
69
+ keyTag: string;
70
+ };
71
+ variantId: string;
72
+ };
73
+ vanityUrl?: {
74
+ pattern: string;
75
+ vanityUrlId: string;
76
+ url: string;
77
+ siteId: string;
78
+ languageId: number;
79
+ forwardTo: string;
80
+ response: number;
81
+ order: number;
82
+ temporaryRedirect: boolean;
83
+ permanentRedirect: boolean;
84
+ forward: boolean;
85
+ };
86
+ };
87
+ isInsideEditor: boolean;
88
+ }
89
+ export interface DotCMSContentlet {
90
+ archived: boolean;
91
+ binaryContentAsset?: string;
92
+ deleted?: boolean;
93
+ baseType: string;
94
+ binary?: string;
95
+ binaryVersion?: string;
96
+ file?: string;
97
+ contentType: string;
98
+ hasLiveVersion?: boolean;
99
+ folder: string;
100
+ hasTitleImage: boolean;
101
+ hostName: string;
102
+ host: string;
103
+ inode: string;
104
+ identifier: string;
105
+ languageId: number;
106
+ image?: string;
107
+ locked: boolean;
108
+ language?: string;
109
+ mimeType?: string;
110
+ modUser: string;
111
+ modDate: string;
112
+ live: boolean;
113
+ sortOrder: number;
114
+ owner: string;
115
+ title: string;
116
+ stInode: string;
117
+ titleImage: string;
118
+ modUserName: string;
119
+ text?: string;
120
+ working: boolean;
121
+ url: string;
122
+ contentTypeIcon?: string;
123
+ body?: string;
124
+ variant?: string;
125
+ __icon__?: string;
126
+ [key: string]: any;
127
+ }
@@ -0,0 +1,58 @@
1
+ import { ContainerData, DotCMSPageContext } from '../models';
2
+ import { Block, BlockEditorState } from '../models/blocks.interface';
3
+ /**
4
+ * Get the container data from the containers object using the current container reference obtained from the layout.
5
+ *
6
+ * @param {ContainerData} containers
7
+ * @param {DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]} containerRef
8
+ * @returns {Object} Container with all the data it has.
9
+ */
10
+ export declare const getContainersData: (containers: ContainerData, containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]) => {
11
+ acceptTypes: string;
12
+ contentlets: {
13
+ contentType: string;
14
+ identifier: string;
15
+ title: string;
16
+ inode: string;
17
+ onNumberOfPages: number;
18
+ widgetTitle?: string | undefined;
19
+ baseType: string;
20
+ }[];
21
+ variantId: string;
22
+ path: string;
23
+ identifier: string;
24
+ maxContentlets: number;
25
+ parentPermissionable: Record<string, string>;
26
+ };
27
+ /**
28
+ * Combine classes into a single string.
29
+ *
30
+ * @param {string[]} classes
31
+ * @returns {string} Combined classes
32
+ */
33
+ export declare const combineClasses: (classes: string[]) => string;
34
+ /**
35
+ * Get the start and end classes for the column based on the left offset and width.
36
+ *
37
+ * @param {number} start
38
+ * @param {number} end
39
+ * @returns {Object} Start and end classes
40
+ */
41
+ export declare const getPositionStyleClasses: (start: number, end: number) => {
42
+ startClass: string;
43
+ endClass: string;
44
+ };
45
+ /**
46
+ * Validates the structure of a Block Editor block.
47
+ *
48
+ * This function checks that:
49
+ * 1. The blocks parameter is a valid object
50
+ * 2. The block has a 'doc' type
51
+ * 3. The block has a valid content array that is not empty
52
+ *
53
+ * @param {Block} blocks - The blocks structure to validate
54
+ * @returns {BlockEditorState} Object containing validation state and any error message
55
+ * @property {boolean} BlockEditorState.isValid - Whether the blocks structure is valid
56
+ * @property {string | null} BlockEditorState.error - Error message if invalid, null if valid
57
+ */
58
+ export declare const isValidBlocks: (blocks: Block) => BlockEditorState;
@@ -0,0 +1,11 @@
1
+ import { DotCMSColumnContainer, DotCMSPageAsset, DotPageAssetLayoutColumn } from '../types';
2
+ export declare const MOCK_COLUMN: DotPageAssetLayoutColumn;
3
+ export declare const MOCK_CONTAINER: DotCMSColumnContainer;
4
+ export declare const MOCK_PAGE_ASSET: DotCMSPageAsset;
5
+ export declare const EMPTY_PAGE_ASSET: DotCMSPageAsset;
6
+ export declare const MOCK_CONTAINER_DATA: {
7
+ uuid: string;
8
+ identifier: string;
9
+ acceptTypes: string;
10
+ maxContentlets: number;
11
+ };
@@ -0,0 +1,37 @@
1
+ import { DotPageAssetLayoutColumn } from '../../types';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Props for the Column component, which represents a single column in the grid layout system.
6
+ *
7
+ * @export
8
+ * @interface ColumnProps
9
+ * @property {DotPageAssetLayoutColumn} column - Column configuration from dotCMS Page API including
10
+ * width, leftOffset, styleClass, and containers
11
+ */
12
+ export interface ColumnProps {
13
+ readonly column: DotPageAssetLayoutColumn;
14
+ }
15
+ /**
16
+ * @internal
17
+ *
18
+ * Renders a Column component that represents a single column in a 12-column grid system.
19
+ * The column's position and width are determined by the leftOffset and width properties
20
+ * from the dotCMS Page API. Uses CSS Grid classes for positioning.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <Column column={{
25
+ * leftOffset: 0,
26
+ * width: 6,
27
+ * styleClass: "custom-class",
28
+ * containers: []
29
+ * }} />
30
+ * ```
31
+ *
32
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
33
+ * @export
34
+ * @param {ColumnProps} { column } - Column configuration object
35
+ * @return {JSX.Element} Rendered column with its containers positioned in the grid
36
+ */
37
+ export declare function Column({ column }: ColumnProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { DotCMSColumnContainer } from '../../types';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Props for the Container component
6
+ * @interface DotCMSContainerRendererProps
7
+ * @property {DotCMSColumnContainer} container - The container data to be rendered
8
+ */
9
+ type DotCMSContainerRendererProps = {
10
+ container: DotCMSColumnContainer;
11
+ };
12
+ /**
13
+ * @internal
14
+ *
15
+ * Container component that renders DotCMS containers and their contentlets.
16
+ * This component is responsible for:
17
+ * - Rendering container content based on DotCMS Page API data
18
+ * - Handling empty container states
19
+ * - Providing proper data attributes for DotCMS functionality
20
+ * - Managing container contentlets rendering
21
+ *
22
+ * @component
23
+ * @param {DotCMSContainerRendererProps} props - Component properties
24
+ * @returns {JSX.Element} Rendered container with its contentlets or empty state message
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <Container container={containerData} />
29
+ * ```
30
+ */
31
+ export declare function Container({ container }: DotCMSContainerRendererProps): import("react/jsx-runtime").JSX.Element;
32
+ export {};
@@ -0,0 +1,24 @@
1
+ import { DotContainerAttributes } from '../../utils';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Component to display when a container is not found in the system.
6
+ * Only renders in development mode for debugging purposes.
7
+ *
8
+ * @component
9
+ * @param {Object} props - Component properties
10
+ * @param {string} props.identifier - Container identifier
11
+ * @returns {JSX.Element | null} Message about missing container or null in production
12
+ */
13
+ export declare const ContainerNoFound: ({ identifier }: {
14
+ identifier: string;
15
+ }) => import("react/jsx-runtime").JSX.Element | null;
16
+ /**
17
+ * @internal
18
+ *
19
+ * Component to display when a container is empty.
20
+ *
21
+ * @param {DotContainerAttributes} dotAttributes
22
+ * @return {*}
23
+ */
24
+ export declare const EmptyContainer: (dotAttributes: DotContainerAttributes) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,32 @@
1
+ import { DotCMSContentlet } from '../../types';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Props for the Contentlet component
6
+ * @interface DotCMSContentletRendererProps
7
+ * @property {DotCMSContentlet} contentlet - The contentlet data to be rendered
8
+ * @property {string} container - The container identifier where the contentlet is placed
9
+ */
10
+ interface DotCMSContentletRendererProps {
11
+ contentlet: DotCMSContentlet;
12
+ container: string;
13
+ }
14
+ /**
15
+ * Contentlet component that renders DotCMS content with development mode support
16
+ *
17
+ * @component
18
+ * @param {DotCMSContentletRendererProps} props - Component properties
19
+ * @param {DotCMSContentlet} props.contentlet - The contentlet to be rendered
20
+ * @param {string} props.container - The container identifier
21
+ * @returns {JSX.Element} Rendered contentlet with appropriate wrapper and attributes
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <Contentlet
26
+ * contentlet={myContentlet}
27
+ * container="container-1"
28
+ * />
29
+ * ```
30
+ */
31
+ export declare function Contentlet({ contentlet, container }: DotCMSContentletRendererProps): import("react/jsx-runtime").JSX.Element;
32
+ export {};
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSPageRendererMode } from '../../contexts/DotCMSPageContext';
3
+ import { DotCMSContentlet, DotCMSPageAsset } from '../../types';
4
+ interface DotCMSLayoutBodyProps {
5
+ page: DotCMSPageAsset;
6
+ components: Record<string, React.ComponentType<DotCMSContentlet>>;
7
+ mode?: DotCMSPageRendererMode;
8
+ }
9
+ /**
10
+ * DotCMSLayoutBody component renders the layout body for a DotCMS page.
11
+ *
12
+ * It utilizes the page asset's layout body to render rows using the Row component.
13
+ * If the layout body does not exist, it renders an error message.
14
+ * It also provides context (DotCMSPageContext) with the page asset, optional user components,
15
+ * and the renderer mode to its children.
16
+ *
17
+ * @public
18
+ * @component
19
+ * @param {Object} props - Component properties.
20
+ * @param {DotCMSPageAsset} props.page - The DotCMS page asset containing the layout information.
21
+ * @param {Record<string, React.ComponentType<DotCMSContentlet>>} [props.components] - Optional mapping of custom components for content rendering.
22
+ * @param {DotCMSPageRendererMode} [props.mode='production'] - The renderer mode; defaults to 'production'. Alternate modes might trigger different behaviors.
23
+ *
24
+ * @returns {JSX.Element} The rendered DotCMS page body or an error message if the layout body is missing.
25
+ *
26
+ * -------------------------------------------------------------------
27
+ *
28
+ * El componente DotCMSLayoutBody renderiza el cuerpo del layout para una página de DotCMS.
29
+ *
30
+ * Utiliza el "body" del layout del asset de la página para renderizar las filas mediante el componente Row.
31
+ * Si el "body" del layout no está presente, renderiza un mensaje de error.
32
+ * También provee un contexto (DotCMSPageContext) con el asset de la página, componentes de usuario opcionales,
33
+ * y el modo del renderizado para sus componentes hijos.
34
+ */
35
+ export declare const DotCMSLayoutBody: ({ page, components, mode }: DotCMSLayoutBodyProps) => import("react/jsx-runtime").JSX.Element;
36
+ export {};
@@ -0,0 +1,9 @@
1
+ import { DotCMSPageRendererMode } from '../../../contexts/DotCMSPageContext';
2
+ /**
3
+ * Error message component for when the page body is missing
4
+ *
5
+ * @return {JSX.Element} Error message component
6
+ */
7
+ export declare const ErrorMessage: ({ mode }: {
8
+ mode: DotCMSPageRendererMode;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSContentlet } from '../../types';
3
+ /**
4
+ * @internal
5
+ *
6
+ * Type definition for components that can be used as fallback when no matching component is found
7
+ */
8
+ export type NoComponentType = React.ComponentType<DotCMSContentlet>;
9
+ /**
10
+ * @internal
11
+ *
12
+ * Props for the FallbackComponent
13
+ * @interface DotCMSFallbackComponentProps
14
+ * @property {React.ComponentType<DotCMSContentlet>} [UserNoComponent] - Optional custom component to render when no matching component is found
15
+ * @property {DotCMSContentlet} [contentlet] - The contentlet that couldn't be rendered
16
+ */
17
+ interface DotCMSFallbackComponentProps {
18
+ contentlet: DotCMSContentlet;
19
+ UserNoComponent?: React.ComponentType<DotCMSContentlet>;
20
+ }
21
+ /**
22
+ * @internal
23
+ *
24
+ * Renders a fallback component when no matching component is found for a content type
25
+ *
26
+ * @component
27
+ * @param {DotCMSFallbackComponentProps} props - Component properties
28
+ * @param {NoComponentType} [props.UserNoComponent] - Optional custom component to render
29
+ * @param {DotCMSContentlet} [props.contentlet] - The contentlet that couldn't be rendered
30
+ * @returns {JSX.Element} The rendered fallback component
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * <FallbackComponent
35
+ * UserNoComponent={CustomNoComponent}
36
+ * contentlet={contentlet}
37
+ * />
38
+ * ```
39
+ */
40
+ export declare function FallbackComponent({ UserNoComponent, contentlet }: DotCMSFallbackComponentProps): import("react/jsx-runtime").JSX.Element | null;
41
+ export {};
@@ -0,0 +1,21 @@
1
+ import { DotPageAssetLayoutRow } from '../../types';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Props for the Row component
6
+ * @interface DotCMSRowRendererProps
7
+ * @property {DotPageAssetLayoutRow} row - The row data to be rendered
8
+ */
9
+ type DotCMSRowRendererProps = {
10
+ row: DotPageAssetLayoutRow;
11
+ };
12
+ /**
13
+ * This component renders a row with all it's content using the layout provided by dotCMS Page API.
14
+ *
15
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
16
+ * @category Components
17
+ * @param {React.ForwardedRef<HTMLDivElement, DotCMS>} ref
18
+ * @return {JSX.Element} Rendered rows with columns
19
+ */
20
+ export declare const Row: ({ row }: DotCMSRowRendererProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { DotCMSContentlet, DotCMSPageAsset } from '../types';
3
+ export type DotCMSPageRendererMode = 'production' | 'development';
4
+ /**
5
+ * @internal
6
+ *
7
+ * Props for the DotCMSPageContext
8
+ * @interface DotCMSPageContextProps
9
+ * @property {DotCMSPageAsset} pageAsset - The DotCMS page asset
10
+ * @property {RendererMode} mode - The renderer mode
11
+ * @property {Record<string, React.ComponentType<DotCMSContentlet>>} userComponents - The user components
12
+ */
13
+ export interface DotCMSPageContextProps {
14
+ pageAsset: DotCMSPageAsset;
15
+ mode: DotCMSPageRendererMode;
16
+ userComponents: Record<string, React.ComponentType<DotCMSContentlet>>;
17
+ }
18
+ /**
19
+ * The `PageContext` is a React context that provides access to the DotCMS page context.
20
+ *
21
+ * @category Contexts
22
+ */
23
+ export declare const DotCMSPageContext: import("react").Context<DotCMSPageContextProps>;
@@ -0,0 +1,24 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * @internal
4
+ * A custom React hook that checks whether a referenced HTMLDivElement has visible content based on its height.
5
+ *
6
+ * @param {RefObject<HTMLDivElement>} ref - A React ref object pointing to an HTMLDivElement.
7
+ * @returns {boolean} - Returns true if the element's height is greater than zero (indicating visible content), otherwise false.
8
+ *
9
+ * @example
10
+ * import { useRef } from 'react';
11
+ * import { useCheckVisibleContent } from 'src/lib/next/hooks/useCheckVisibleContent';
12
+ *
13
+ * function MyComponent() {
14
+ * const contentRef = useRef<HTMLDivElement>(null);
15
+ * const isContentVisible = useCheckVisibleContent(contentRef);
16
+ *
17
+ * return (
18
+ * <div ref={contentRef}>
19
+ * {isContentVisible ? 'Content is visible' : 'Content is not visible'}
20
+ * </div>
21
+ * );
22
+ * }
23
+ */
24
+ export declare const useCheckVisibleContent: (ref: RefObject<HTMLDivElement>) => boolean;
@@ -0,0 +1,13 @@
1
+ import { DotCMSPageRendererMode } from '../contexts/DotCMSPageContext';
2
+ /**
3
+ * @internal
4
+ * A React hook that determines if the current environment is in development mode.
5
+ *
6
+ * The hook returns `true` if either:
7
+ * - The context mode (or the optional `renderMode` argument) is set to 'development', or
8
+ * - The application is running inside the DotCMS editor (as determined by `isInsideEditor()`).
9
+ *
10
+ * @param {DotCMSPageRendererMode} [renderMode] - Optional override for the render mode.
11
+ * @returns {boolean} - `true` if in development mode or inside the editor; otherwise, `false`.
12
+ */
13
+ export declare const useIsDevMode: (renderMode?: DotCMSPageRendererMode) => boolean;