@dotcms/react 1.4.0 → 1.5.0

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.
@@ -34,6 +34,7 @@ const DotCMSLayoutBody = ({
34
34
  mode: _mode,
35
35
  slots: _slots,
36
36
  children: dotCMSPageBody ? dotCMSPageBody.rows.map((row, index) => jsx(Row, {
37
+ index: index + 1,
37
38
  row: row
38
39
  }, index)) : jsx(ErrorMessage, {})
39
40
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { combineClasses } from '@dotcms/uve/internal';
2
+ import { combineClasses, DOT_SECTION_ID_PREFIX } from '@dotcms/uve/internal';
3
3
  import styles from './Row.module.css.esm.js';
4
4
  import { Column } from '../Column/Column.esm.js';
5
5
 
@@ -12,10 +12,12 @@ import { Column } from '../Column/Column.esm.js';
12
12
  * @return {JSX.Element} Rendered rows with columns
13
13
  */
14
14
  const Row = ({
15
- row
15
+ row,
16
+ index
16
17
  }) => {
17
18
  const customRowClass = combineClasses(['dot-row-container', row.styleClass || '']);
18
19
  return jsx("div", {
20
+ id: `${DOT_SECTION_ID_PREFIX}${index}`,
19
21
  className: customRowClass,
20
22
  children: jsx("div", {
21
23
  className: styles.row,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18"
@@ -8,6 +8,8 @@ import { DotPageAssetLayoutRow } from '@dotcms/types';
8
8
  */
9
9
  type DotCMSRowRendererProps = {
10
10
  row: DotPageAssetLayoutRow;
11
+ /** 1-based section index used as the `id` anchor for editor scroll-to-section. */
12
+ index: number;
11
13
  };
12
14
  /**
13
15
  * This component renders a row with all it's content using the layout provided by dotCMS Page API.
@@ -17,5 +19,5 @@ type DotCMSRowRendererProps = {
17
19
  * @param {React.ForwardedRef<HTMLDivElement, DotCMS>} ref
18
20
  * @return {JSX.Element} Rendered rows with columns
19
21
  */
20
- export declare const Row: ({ row }: DotCMSRowRendererProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const Row: ({ row, index }: DotCMSRowRendererProps) => import("react/jsx-runtime").JSX.Element;
21
23
  export {};