@dotcms/react 1.2.5 → 1.2.6-next.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 (49) hide show
  1. package/README.md +71 -17
  2. package/_virtual/_style-inject.esm.js +30 -0
  3. package/index.esm.js +9 -7097
  4. package/index.server.d.ts +1 -0
  5. package/index.server.esm.js +8 -0
  6. package/lib/next/components/Column/Column.esm.js +48 -0
  7. package/lib/next/components/Column/Column.module.css.esm.js +8 -0
  8. package/lib/next/components/Container/Container.esm.js +54 -0
  9. package/lib/next/components/Container/ContainerFallbacks.esm.js +60 -0
  10. package/lib/next/components/Contentlet/Contentlet.esm.js +87 -0
  11. package/lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.esm.js +46 -0
  12. package/lib/next/components/DotCMSBlockEditorRenderer/components/BlockEditorBlock.esm.js +179 -0
  13. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Code.esm.js +37 -0
  14. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/DotContent.esm.js +47 -0
  15. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/GridBlock.esm.js +44 -0
  16. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Image.esm.js +22 -0
  17. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Lists.esm.js +43 -0
  18. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/NoComponentProvided.esm.js +40 -0
  19. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Table.esm.js +53 -0
  20. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Texts.esm.js +157 -0
  21. package/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Video.esm.js +42 -0
  22. package/lib/next/components/DotCMSEditableText/DotCMSEditableText.esm.js +181 -0
  23. package/lib/next/components/DotCMSEditableText/utils.esm.js +12 -0
  24. package/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.esm.js +42 -0
  25. package/lib/next/components/DotCMSLayoutBody/DotCMSPageProvider.esm.js +30 -0
  26. package/lib/next/components/DotCMSLayoutBody/components/ErrorMessage.esm.js +43 -0
  27. package/lib/next/components/DotCMSShow/DotCMSShow.esm.js +49 -0
  28. package/lib/next/components/FallbackComponent/FallbackComponent.esm.js +54 -0
  29. package/lib/next/components/Row/Row.esm.js +30 -0
  30. package/lib/next/components/Row/Row.module.css.esm.js +8 -0
  31. package/lib/next/contexts/DotCMSPageContext.esm.js +16 -0
  32. package/lib/next/hooks/useAISearch.esm.js +119 -0
  33. package/lib/next/hooks/useCheckVisibleContent.esm.js +40 -0
  34. package/lib/next/hooks/useDotCMSShowWhen.esm.js +42 -0
  35. package/lib/next/hooks/useEditableDotCMSPage.esm.js +131 -0
  36. package/lib/next/hooks/useIsDevMode.esm.js +35 -0
  37. package/lib/next/hooks/useStyleEditorSchemas.esm.js +15 -0
  38. package/lib/next/utils/buildSlots.esm.js +43 -0
  39. package/package.json +3 -2
  40. package/src/index.d.ts +1 -0
  41. package/src/index.server.d.ts +11 -0
  42. package/src/lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.d.ts +2 -1
  43. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/BlockEditorBlock.d.ts +2 -1
  44. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/DotContent.d.ts +2 -1
  45. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/GridBlock.d.ts +19 -0
  46. package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +20 -1
  47. package/src/lib/next/components/DotCMSLayoutBody/DotCMSPageProvider.d.ts +18 -0
  48. package/src/lib/next/contexts/DotCMSPageContext.d.ts +3 -0
  49. package/src/lib/next/utils/buildSlots.d.ts +24 -0
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useIsDevMode } from '../../hooks/useIsDevMode.esm.js';
4
+
5
+ /**
6
+ * @internal
7
+ *
8
+ * Renders a fallback component when no matching component is found for a content type
9
+ *
10
+ * @component
11
+ * @param {DotCMSFallbackComponentProps} props - Component properties
12
+ * @param {NoComponentType} [props.UserNoComponent] - Optional custom component to render
13
+ * @param {DotCMSContentlet} [props.contentlet] - The contentlet that couldn't be rendered
14
+ * @returns {JSX.Element} The rendered fallback component
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <FallbackComponent
19
+ * UserNoComponent={CustomNoComponent}
20
+ * contentlet={contentlet}
21
+ * />
22
+ * ```
23
+ */
24
+ function FallbackComponent({
25
+ UserNoComponent,
26
+ contentlet
27
+ }) {
28
+ const isDevMode = useIsDevMode();
29
+ if (!isDevMode) {
30
+ return null;
31
+ }
32
+ const NoComponentFound = UserNoComponent || NoComponent;
33
+ return jsx(NoComponentFound, Object.assign({}, contentlet));
34
+ }
35
+ /**
36
+ * @internal
37
+ *
38
+ * Component to render when there is no component for the content type.
39
+ *
40
+ * @param {DotCMSBasicContentlet} contentType - The content type that couldn't be rendered
41
+ * @return {*}
42
+ */
43
+ function NoComponent({
44
+ contentType
45
+ }) {
46
+ return jsxs("div", {
47
+ "data-testid": "no-component",
48
+ children: ["No Component for ", jsx("strong", {
49
+ children: contentType
50
+ }), "."]
51
+ });
52
+ }
53
+
54
+ export { FallbackComponent };
@@ -0,0 +1,30 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { combineClasses } from '@dotcms/uve/internal';
3
+ import styles from './Row.module.css.esm.js';
4
+ import { Column } from '../Column/Column.esm.js';
5
+
6
+ /**
7
+ * This component renders a row with all it's content using the layout provided by dotCMS Page API.
8
+ *
9
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
10
+ * @category Components
11
+ * @param {React.ForwardedRef<HTMLDivElement, DotCMS>} ref
12
+ * @return {JSX.Element} Rendered rows with columns
13
+ */
14
+ const Row = ({
15
+ row
16
+ }) => {
17
+ const customRowClass = combineClasses(['dot-row-container', row.styleClass || '']);
18
+ return jsx("div", {
19
+ className: customRowClass,
20
+ children: jsx("div", {
21
+ className: styles.row,
22
+ "data-dot-object": 'row',
23
+ children: row.columns.map((column, index) => jsx(Column, {
24
+ column: column
25
+ }, index))
26
+ })
27
+ });
28
+ };
29
+
30
+ export { Row };
@@ -0,0 +1,8 @@
1
+ import styleInject from '../../../../_virtual/_style-inject.esm.js';
2
+
3
+ var css = "._row_1e5l5_1 {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n gap: 1rem;\n}\n";
4
+
5
+ styleInject(css);
6
+ var styles = {"row":"_row_1e5l5_1"};
7
+
8
+ export { styles as default };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { createContext } from 'react';
3
+
4
+ /**
5
+ * The `PageContext` is a React context that provides access to the DotCMS page context.
6
+ *
7
+ * @category Contexts
8
+ */
9
+ const DotCMSPageContext = /*#__PURE__*/createContext({
10
+ pageAsset: {},
11
+ mode: 'production',
12
+ userComponents: {},
13
+ slots: {}
14
+ });
15
+
16
+ export { DotCMSPageContext };
@@ -0,0 +1,119 @@
1
+ import { useReducer, useRef, useEffect, useCallback } from 'react';
2
+ import { DotCMSEntityState } from '@dotcms/types';
3
+
4
+ function reducer(state, action) {
5
+ switch (action.type) {
6
+ case DotCMSEntityState.LOADING:
7
+ return Object.assign({}, state, {
8
+ status: {
9
+ state: DotCMSEntityState.LOADING
10
+ }
11
+ });
12
+ case DotCMSEntityState.SUCCESS:
13
+ return {
14
+ response: action.payload,
15
+ status: {
16
+ state: DotCMSEntityState.SUCCESS
17
+ }
18
+ };
19
+ case DotCMSEntityState.ERROR:
20
+ return Object.assign({}, state, {
21
+ status: {
22
+ state: DotCMSEntityState.ERROR,
23
+ error: action.payload
24
+ }
25
+ });
26
+ case DotCMSEntityState.IDLE:
27
+ return {
28
+ response: null,
29
+ status: {
30
+ state: DotCMSEntityState.IDLE
31
+ }
32
+ };
33
+ default:
34
+ return state;
35
+ }
36
+ }
37
+ /**
38
+ * Hook to search for contentlets using AI.
39
+ * @template T - The type of the contentlet.
40
+ * @param client - The client to use for the search.
41
+ * @param indexName - The name of the index to search in.
42
+ * @param params - The parameters for the search.
43
+ * @returns The search results.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const { results, status, search, reset } = useAISearch<BlogPost>({
48
+ * client: dotCMSClient,
49
+ * indexName: 'blog-search-index',
50
+ * params: {
51
+ * query: {
52
+ * limit: 10,
53
+ * offset: 0,
54
+ * contentType: 'Blog'
55
+ * },
56
+ * config: {
57
+ * threshold: 0.5,
58
+ * responseLength: 1024
59
+ * }
60
+ * }
61
+ * });
62
+ * ```
63
+ */
64
+ const useAISearch = ({
65
+ client,
66
+ indexName,
67
+ params
68
+ }) => {
69
+ var _state$response$resul, _state$response;
70
+ const [state, dispatch] = useReducer(reducer, {
71
+ response: null,
72
+ status: {
73
+ state: DotCMSEntityState.IDLE
74
+ }
75
+ });
76
+ // Use ref to store params so search callback doesn't change when params change
77
+ const paramsRef = useRef(params);
78
+ // Keep ref updated with latest params
79
+ useEffect(() => {
80
+ paramsRef.current = params;
81
+ }, [params]);
82
+ const reset = useCallback(() => {
83
+ dispatch({
84
+ type: DotCMSEntityState.IDLE
85
+ });
86
+ }, []);
87
+ const search = useCallback(async prompt => {
88
+ if (!prompt.trim()) {
89
+ dispatch({
90
+ type: DotCMSEntityState.IDLE
91
+ });
92
+ return;
93
+ }
94
+ dispatch({
95
+ type: DotCMSEntityState.LOADING
96
+ });
97
+ try {
98
+ const response = await client.ai.search(prompt, indexName, Object.assign({}, paramsRef.current));
99
+ dispatch({
100
+ type: DotCMSEntityState.SUCCESS,
101
+ payload: response
102
+ });
103
+ } catch (error) {
104
+ dispatch({
105
+ type: DotCMSEntityState.ERROR,
106
+ payload: error
107
+ });
108
+ }
109
+ }, [client, indexName]);
110
+ return {
111
+ response: state.response,
112
+ results: (_state$response$resul = (_state$response = state.response) == null ? void 0 : _state$response.results) != null ? _state$response$resul : [],
113
+ status: state.status,
114
+ search,
115
+ reset
116
+ };
117
+ };
118
+
119
+ export { useAISearch };
@@ -0,0 +1,40 @@
1
+ import { useState, useLayoutEffect } from 'react';
2
+
3
+ /**
4
+ * @internal
5
+ * A custom React hook that checks whether a referenced HTMLDivElement has visible content based on its height.
6
+ *
7
+ * @param {RefObject<HTMLDivElement>} ref - A React ref object pointing to an HTMLDivElement.
8
+ * @returns {boolean} - Returns true if the element's height is greater than zero (indicating visible content), otherwise false.
9
+ *
10
+ * @example
11
+ * import { useRef } from 'react';
12
+ * import { useCheckVisibleContent } from 'src/lib/next/hooks/useCheckVisibleContent';
13
+ *
14
+ * function MyComponent() {
15
+ * const contentRef = useRef<HTMLDivElement>(null);
16
+ * const isContentVisible = useCheckVisibleContent(contentRef);
17
+ *
18
+ * return (
19
+ * <div ref={contentRef}>
20
+ * {isContentVisible ? 'Content is visible' : 'Content is not visible'}
21
+ * </div>
22
+ * );
23
+ * }
24
+ */
25
+ const useCheckVisibleContent = ref => {
26
+ const [haveContent, setHaveContent] = useState(false);
27
+ useLayoutEffect(() => {
28
+ if (!ref.current) {
29
+ setHaveContent(false);
30
+ return;
31
+ }
32
+ const {
33
+ height
34
+ } = ref.current.getBoundingClientRect();
35
+ setHaveContent(height > 0);
36
+ }, [ref]);
37
+ return haveContent;
38
+ };
39
+
40
+ export { useCheckVisibleContent };
@@ -0,0 +1,42 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { getUVEState } from '@dotcms/uve';
3
+
4
+ /**
5
+ * Custom hook to determine if the current UVE (Universal Visual Editor) mode
6
+ * matches the specified mode. This hook is useful for conditionally rendering
7
+ * components based on the UVE mode.
8
+ *
9
+ * @param {UVE_MODE} when - The UVE mode to check against.
10
+ * @returns {boolean} True if the current UVE mode matches the specified mode, otherwise false.
11
+ *
12
+ * @example
13
+ * // Basic usage: Check if the UVE is in edit mode
14
+ * const showInEditMode = useDotCMSShowWhen(UVE_MODE.EDIT);
15
+ * if (showInEditMode) {
16
+ * // Render edit-specific components
17
+ * }
18
+ *
19
+ * @example
20
+ * // Check if the UVE is in preview mode
21
+ * const showInPreviewMode = useDotCMSShowWhen(UVE_MODE.PREVIEW);
22
+ * if (showInPreviewMode) {
23
+ * // Render preview-specific components
24
+ * }
25
+ *
26
+ * @example
27
+ * // Check if the UVE is in live mode
28
+ * const showInLiveMode = useDotCMSShowWhen(UVE_MODE.LIVE);
29
+ * if (showInLiveMode) {
30
+ * // Render live-specific components
31
+ * }
32
+ */
33
+ const useDotCMSShowWhen = when => {
34
+ const [show, setShow] = useState(false);
35
+ useEffect(() => {
36
+ var _getUVEState;
37
+ setShow(((_getUVEState = getUVEState()) == null ? void 0 : _getUVEState.mode) === when);
38
+ }, [when]);
39
+ return show;
40
+ };
41
+
42
+ export { useDotCMSShowWhen };
@@ -0,0 +1,131 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { UVEEventType } from '@dotcms/types';
3
+ import { getUVEState, initUVE, updateNavigation, createUVESubscription } from '@dotcms/uve';
4
+
5
+ /**
6
+ * Custom hook to manage the editable state of a DotCMS page.
7
+ *
8
+ * This hook initializes the Universal Visual Editor (UVE) and subscribes to content changes.
9
+ * It updates the editable page state when content changes are detected in the UVE,
10
+ * ensuring your React components always display the latest content when editing in DotCMS.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Import the hook and the client
15
+ * import { useEditableDotCMSPage } from '@dotcms/react';
16
+ * import { createDotCMSClient } from '@dotcms/client';
17
+ *
18
+ * // Create the client
19
+ * const client = createDotCMSClient({
20
+ * dotcmsURL: 'https://your-dotcms-instance.com',
21
+ * authToken: 'your-auth-token'
22
+ * });
23
+ *
24
+ * // Get the page
25
+ * const page = await client.page.get('/', {
26
+ * languageId: '1',
27
+ * });
28
+ *
29
+ * // Use the hook to get an editable version of the page
30
+ * const editablePage = useEditableDotCMSPage(page);
31
+ *
32
+ * // Then use the page data in your component
33
+ * return (
34
+ * <div>
35
+ * <h1>{editablePage.page.title}</h1>
36
+ * <div dangerouslySetInnerHTML={{ __html: editablePage.page.body }} />
37
+ * </div>
38
+ * );
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // Import the hook and the client
44
+ * import { useEditableDotCMSPage } from '@dotcms/react';
45
+ * import { createDotCMSClient } from '@dotcms/client';
46
+ *
47
+ * // Create the client
48
+ * const client = createDotCMSClient({
49
+ * dotcmsURL: 'https://your-dotcms-instance.com',
50
+ * authToken: 'your-auth-token'
51
+ * });
52
+ *
53
+ * // Get the page with GraphQL content
54
+ * const page = await client.page.get('/', {
55
+ * languageId: '1',
56
+ * graphql: {
57
+ * content: {
58
+ * products: `ProductCollection(query: "+title:snow", limit: 10, offset: 0, sortBy: "score") {
59
+ * title
60
+ * urlMap
61
+ * category {
62
+ * name
63
+ * inode
64
+ * }
65
+ * retailPrice
66
+ * image {
67
+ * versionPath
68
+ * }
69
+ * }`
70
+ * }
71
+ * }
72
+ * });
73
+ *
74
+ * // Use the hook to get an editable version of the page and its content
75
+ * const editablePage = useEditableDotCMSPage(page);
76
+ *
77
+ * // Access both page data and GraphQL content
78
+ * const { page: pageData, content } = editablePage;
79
+ *
80
+ * // Use the products from GraphQL content
81
+ * return (
82
+ * <div>
83
+ * <h1>{pageData.title}</h1>
84
+ * <ProductList products={content.products} />
85
+ * </div>
86
+ * );
87
+ * ```
88
+ * @param {DotCMSPageResponse} pageResponse - The initial editable page data from client.page.get().
89
+ *
90
+ * @returns {DotCMSPageResponse} The updated editable page state that reflects any changes made in the UVE.
91
+ * The structure includes page data and any GraphQL content that was requested.
92
+ */
93
+ const useEditableDotCMSPage = pageResponse => {
94
+ const [updatedPageResponse, setUpdatedPageResponse] = useState(pageResponse);
95
+ useEffect(() => {
96
+ var _pageResponse$pageAss;
97
+ if (!getUVEState()) {
98
+ return;
99
+ }
100
+ if (!pageResponse) {
101
+ console.warn('[useEditableDotCMSPage]: No DotCMSPageResponse provided');
102
+ return;
103
+ }
104
+ const pageURI = pageResponse == null || (_pageResponse$pageAss = pageResponse.pageAsset) == null || (_pageResponse$pageAss = _pageResponse$pageAss.page) == null ? void 0 : _pageResponse$pageAss.pageURI;
105
+ const {
106
+ destroyUVESubscriptions
107
+ } = initUVE(pageResponse);
108
+ // Update the navigation to the pageURI, when we have a pageURI
109
+ // Sometimes the page is null due to permissions, so we don't want to update the navigation
110
+ // And wait for the UVE to resolve the page
111
+ if (pageURI) {
112
+ updateNavigation(pageURI);
113
+ }
114
+ return () => {
115
+ destroyUVESubscriptions();
116
+ };
117
+ }, [pageResponse]);
118
+ useEffect(() => {
119
+ const {
120
+ unsubscribe
121
+ } = createUVESubscription(UVEEventType.CONTENT_CHANGES, payload => {
122
+ setUpdatedPageResponse(payload);
123
+ });
124
+ return () => {
125
+ unsubscribe();
126
+ };
127
+ }, []);
128
+ return updatedPageResponse;
129
+ };
130
+
131
+ export { useEditableDotCMSPage };
@@ -0,0 +1,35 @@
1
+ import { useContext, useState, useEffect } from 'react';
2
+ import { UVE_MODE } from '@dotcms/types';
3
+ import { getUVEState } from '@dotcms/uve';
4
+ import { DEVELOPMENT_MODE } from '@dotcms/uve/internal';
5
+ import { DotCMSPageContext } from '../contexts/DotCMSPageContext.esm.js';
6
+
7
+ /**
8
+ * @internal
9
+ * A React hook that determines if the current environment is in development mode.
10
+ *
11
+ * The hook returns `true` if either:
12
+ * - The application is running inside the DotCMS editor (as determined by `getUVEState()`).
13
+ *
14
+ * @returns {boolean} - `true` if in development mode or inside the editor; otherwise, `false`.
15
+ */
16
+ const useIsDevMode = () => {
17
+ const {
18
+ mode
19
+ } = useContext(DotCMSPageContext);
20
+ const [isDevMode, setIsDevMode] = useState(mode === 'development');
21
+ useEffect(() => {
22
+ var _getUVEState;
23
+ // Inside UVE we rely on the UVE state to determine if we are in development mode
24
+ if ((_getUVEState = getUVEState()) != null && _getUVEState.mode) {
25
+ var _getUVEState2;
26
+ const isUVEInEditor = ((_getUVEState2 = getUVEState()) == null ? void 0 : _getUVEState2.mode) === UVE_MODE.EDIT;
27
+ setIsDevMode(isUVEInEditor);
28
+ return;
29
+ }
30
+ setIsDevMode(mode === DEVELOPMENT_MODE);
31
+ }, [mode]);
32
+ return isDevMode;
33
+ };
34
+
35
+ export { useIsDevMode };
@@ -0,0 +1,15 @@
1
+ import { useEffect } from 'react';
2
+ import { registerStyleEditorSchemas } from '@dotcms/uve';
3
+
4
+ /**
5
+ * Hook to register style editor forms with the UVE editor.
6
+ * @param forms - Array of style editor form schemas to register
7
+ * @returns void
8
+ */
9
+ const useStyleEditorSchemas = styleEditorForms => {
10
+ useEffect(() => {
11
+ registerStyleEditorSchemas(styleEditorForms);
12
+ }, [styleEditorForms]);
13
+ };
14
+
15
+ export { useStyleEditorSchemas };
@@ -0,0 +1,43 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ /**
4
+ * Builds a slots map of pre-rendered server component nodes keyed by contentlet identifier.
5
+ *
6
+ * Use this in Next.js server components to render async server components
7
+ * (e.g., components that fetch data) within a DotCMS page layout. Pass the
8
+ * resulting map to `DotCMSLayoutBody` via the `slots` prop.
9
+ *
10
+ * @public
11
+ * @param containers - The containers map from `pageAsset.containers`
12
+ * @param serverComponents - A map of content type names to async server components
13
+ * @returns A record mapping contentlet identifiers to pre-rendered ReactNodes
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const slots = buildSlots(pageContent.pageAsset.containers, {
18
+ * BlogList: BlogListContainer,
19
+ * });
20
+ *
21
+ * <DotCMSLayoutBody page={pageAsset} components={pageComponents} slots={slots} />
22
+ * ```
23
+ */
24
+ function buildSlots(containers,
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ serverComponents) {
27
+ const slots = {};
28
+ for (const {
29
+ contentlets
30
+ } of Object.values(containers)) {
31
+ for (const contentletList of Object.values(contentlets)) {
32
+ for (const contentlet of contentletList) {
33
+ const Component = serverComponents[contentlet.contentType];
34
+ if (Component) {
35
+ slots[contentlet.identifier] = jsx(Component, Object.assign({}, contentlet));
36
+ }
37
+ }
38
+ }
39
+ }
40
+ return slots;
41
+ }
42
+
43
+ export { buildSlots };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "1.2.5",
3
+ "version": "1.2.6-next.2",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18"
@@ -30,6 +30,7 @@
30
30
  "exports": {
31
31
  "./package.json": "./package.json",
32
32
  ".": {
33
+ "react-server": "./index.server.esm.js",
33
34
  "import": "./index.esm.js",
34
35
  "types": "./index.d.ts"
35
36
  }
@@ -51,4 +52,4 @@
51
52
  "type": "module",
52
53
  "main": "./index.esm.js",
53
54
  "types": "./index.d.ts"
54
- }
55
+ }
package/src/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/Do
8
8
  export { useAISearch } from './lib/next/hooks/useAISearch';
9
9
  export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas';
10
10
  export type { DotCMSAISearchValue, DotCMSAISearchProps } from './lib/next/shared/types';
11
+ export { buildSlots } from './lib/next/utils/buildSlots';
@@ -0,0 +1,11 @@
1
+ export { DotCMSLayoutBody } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
2
+ export { DotCMSShow } from './lib/next/components/DotCMSShow/DotCMSShow';
3
+ export { useDotCMSShowWhen } from './lib/next/hooks/useDotCMSShowWhen';
4
+ export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage';
5
+ export { DotCMSBlockEditorRenderer, CustomRenderer } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
6
+ export type { BlockEditorRendererProps, CustomRendererProps } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
7
+ export type { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
8
+ export { useAISearch } from './lib/next/hooks/useAISearch';
9
+ export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas';
10
+ export type { DotCMSAISearchValue, DotCMSAISearchProps } from './lib/next/shared/types';
11
+ export { buildSlots } from './lib/next/utils/buildSlots';
@@ -38,6 +38,7 @@ export interface BlockEditorRendererProps {
38
38
  style?: React.CSSProperties;
39
39
  className?: string;
40
40
  customRenderers?: CustomRenderer;
41
+ isDevMode?: boolean;
41
42
  }
42
43
  /**
43
44
  * BlockEditorRenderer component for rendering block editor field.
@@ -50,4 +51,4 @@ export interface BlockEditorRendererProps {
50
51
  * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
51
52
  * @returns {JSX.Element} A div containing the rendered blocks of content.
52
53
  */
53
- export declare const DotCMSBlockEditorRenderer: ({ blocks, style, className, customRenderers }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element | null;
54
+ export declare const DotCMSBlockEditorRenderer: ({ blocks, style, className, customRenderers, isDevMode }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -3,6 +3,7 @@ import { CustomRenderer } from '../DotCMSBlockEditorRenderer';
3
3
  interface BlockEditorBlockProps {
4
4
  content: BlockEditorNode[] | undefined;
5
5
  customRenderers?: CustomRenderer;
6
+ isDevMode?: boolean;
6
7
  }
7
8
  /**
8
9
  * Renders a block editor item based on the provided content and custom renderers.
@@ -11,5 +12,5 @@ interface BlockEditorBlockProps {
11
12
  * @param customRenderers - Optional custom renderers for specific node types.
12
13
  * @returns The rendered block editor item.
13
14
  */
14
- export declare const BlockEditorBlock: ({ content, customRenderers }: BlockEditorBlockProps) => import("react/jsx-runtime").JSX.Element[] | null;
15
+ export declare const BlockEditorBlock: ({ content, customRenderers, isDevMode }: BlockEditorBlockProps) => import("react/jsx-runtime").JSX.Element[] | null;
15
16
  export {};
@@ -3,6 +3,7 @@ import { CustomRenderer } from '../../DotCMSBlockEditorRenderer';
3
3
  interface DotContentProps {
4
4
  customRenderers?: CustomRenderer;
5
5
  node: BlockEditorNode;
6
+ isDevMode?: boolean;
6
7
  }
7
8
  /**
8
9
  * Renders a DotContent component.
@@ -10,5 +11,5 @@ interface DotContentProps {
10
11
  * @param {DotContentProps} props - The props for the DotContent component.
11
12
  * @returns {JSX.Element} The rendered DotContent component.
12
13
  */
13
- export declare const DotContent: ({ customRenderers, node }: DotContentProps) => import("react/jsx-runtime").JSX.Element | null;
14
+ export declare const DotContent: ({ customRenderers, node, isDevMode }: DotContentProps) => import("react/jsx-runtime").JSX.Element | null;
14
15
  export {};
@@ -0,0 +1,19 @@
1
+ import { BlockEditorNode } from '@dotcms/types';
2
+ import { CustomRenderer } from '../../DotCMSBlockEditorRenderer';
3
+ interface GridBlockProps {
4
+ node: BlockEditorNode;
5
+ customRenderers?: CustomRenderer;
6
+ blockEditorBlock: React.FC<{
7
+ content: BlockEditorNode[] | undefined;
8
+ customRenderers?: CustomRenderer;
9
+ }>;
10
+ }
11
+ /**
12
+ * Renders a grid block with two columns using a 12-column grid system.
13
+ *
14
+ * @param node - The grid block node containing column configuration.
15
+ * @param blockEditorBlock - The block editor component for rendering nested content.
16
+ * @param customRenderers - Optional custom renderers for nested blocks.
17
+ */
18
+ export declare const GridBlock: ({ node, blockEditorBlock, customRenderers }: GridBlockProps) => import("react/jsx-runtime").JSX.Element;
19
+ export {};