@dotcms/react 0.0.1-alpha.33 → 0.0.1-alpha.34

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.
package/index.esm.js CHANGED
@@ -4555,4 +4555,502 @@ function useDotcmsPageContext() {
4555
4555
  return useContext(PageContext);
4556
4556
  }
4557
4557
 
4558
- export { DotEditableText, DotcmsLayout, PageProvider, Row, useDotcmsPageContext };
4558
+ var Blocks;
4559
+ (function (Blocks) {
4560
+ Blocks["PARAGRAPH"] = "paragraph";
4561
+ Blocks["HEADING"] = "heading";
4562
+ Blocks["TEXT"] = "text";
4563
+ Blocks["BULLET_LIST"] = "bulletList";
4564
+ Blocks["ORDERED_LIST"] = "orderedList";
4565
+ Blocks["LIST_ITEM"] = "listItem";
4566
+ Blocks["BLOCK_QUOTE"] = "blockquote";
4567
+ Blocks["CODE_BLOCK"] = "codeBlock";
4568
+ Blocks["HARDBREAK"] = "hardBreak";
4569
+ Blocks["HORIZONTAL_RULE"] = "horizontalRule";
4570
+ Blocks["DOT_IMAGE"] = "dotImage";
4571
+ Blocks["DOT_VIDEO"] = "dotVideo";
4572
+ Blocks["TABLE"] = "table";
4573
+ Blocks["DOT_CONTENT"] = "dotContent";
4574
+ })(Blocks || (Blocks = {}));
4575
+
4576
+ /**
4577
+ * Renders a code block component.
4578
+ *
4579
+ * @param attrs - The attributes of the code block.
4580
+ * @param children - The content of the code block.
4581
+ * @returns The rendered code block component.
4582
+ */
4583
+ const CodeBlock = ({
4584
+ attrs,
4585
+ children
4586
+ }) => {
4587
+ const language = (attrs == null ? void 0 : attrs.language) || '';
4588
+ return jsx("pre", {
4589
+ "data-language": language,
4590
+ children: jsx("code", {
4591
+ children: children
4592
+ })
4593
+ });
4594
+ };
4595
+ /**
4596
+ * Renders a blockquote component.
4597
+ *
4598
+ * @param children - The content to be rendered inside the blockquote.
4599
+ * @returns The rendered blockquote component.
4600
+ */
4601
+ const BlockQuote = ({
4602
+ children
4603
+ }) => {
4604
+ return jsx("blockquote", {
4605
+ children: children
4606
+ });
4607
+ };
4608
+
4609
+ /**
4610
+ * Renders the default content for an unknown content type.
4611
+ */
4612
+ const DefaultContent = () => jsx("div", {
4613
+ children: "Unknown Content Type"
4614
+ });
4615
+ /**
4616
+ * Renders a DotContent component.
4617
+ *
4618
+ * @param {DotContentProps} props - The props for the DotContent component.
4619
+ * @returns {JSX.Element} The rendered DotContent component.
4620
+ */
4621
+ const DotContent = props => {
4622
+ var _customRenderers$data;
4623
+ const {
4624
+ attrs,
4625
+ customRenderers
4626
+ } = props;
4627
+ const data = attrs == null ? void 0 : attrs.data;
4628
+ const Component = (_customRenderers$data = customRenderers == null ? void 0 : customRenderers[data == null ? void 0 : data.contentType]) != null ? _customRenderers$data : DefaultContent;
4629
+ if (!data) {
4630
+ console.error('DotContent: No data provided');
4631
+ }
4632
+ return jsx(Component, Object.assign({}, data));
4633
+ };
4634
+
4635
+ /**
4636
+ * Renders an image component for dotCMS.
4637
+ *
4638
+ * @param props - The props for the DotCMSImage component.
4639
+ * @returns The rendered image component.
4640
+ */
4641
+ const DotCMSImage = props => {
4642
+ const {
4643
+ data,
4644
+ src,
4645
+ alt
4646
+ } = props.attrs;
4647
+ const client = DotCmsClient.instance;
4648
+ const srcUrl = data != null && data.identifier ? `${client.dotcmsUrl}${src}` : src;
4649
+ return jsx("img", {
4650
+ alt: alt,
4651
+ src: srcUrl
4652
+ });
4653
+ };
4654
+
4655
+ /**
4656
+ * ListItem component represents a list item in a block editor.
4657
+ *
4658
+ * @param children - The content of the list item.
4659
+ * @returns The rendered list item element.
4660
+ */
4661
+ const ListItem = ({
4662
+ children
4663
+ }) => {
4664
+ return jsx("li", {
4665
+ children: children
4666
+ });
4667
+ };
4668
+ /**
4669
+ * Renders an ordered list component.
4670
+ *
4671
+ * @param children - The content to be rendered inside the ordered list.
4672
+ * @returns The ordered list component.
4673
+ */
4674
+ const OrderedList = ({
4675
+ children
4676
+ }) => {
4677
+ return jsx("ol", {
4678
+ children: children
4679
+ });
4680
+ };
4681
+ /**
4682
+ * Renders a bullet list component.
4683
+ *
4684
+ * @param children - The content of the bullet list.
4685
+ * @returns The rendered bullet list component.
4686
+ */
4687
+ const BulletList = ({
4688
+ children
4689
+ }) => {
4690
+ return jsx("ul", {
4691
+ children: children
4692
+ });
4693
+ };
4694
+
4695
+ /**
4696
+ * Renders a table component for the Block Editor.
4697
+ *
4698
+ * @param content - The content of the table.
4699
+ * @param blockEditorItem - The Block Editor item component.
4700
+ */
4701
+ const TableRenderer = ({
4702
+ content,
4703
+ blockEditorItem
4704
+ }) => {
4705
+ const BlockEditorItemComponent = blockEditorItem;
4706
+ const renderTableContent = node => {
4707
+ return jsx(BlockEditorItemComponent, {
4708
+ content: node.content
4709
+ });
4710
+ };
4711
+ return jsxs("table", {
4712
+ children: [jsx("thead", {
4713
+ children: content.slice(0, 1).map((rowNode, rowIndex) => {
4714
+ var _rowNode$content;
4715
+ return jsx("tr", {
4716
+ children: (_rowNode$content = rowNode.content) == null ? void 0 : _rowNode$content.map((cellNode, cellIndex) => {
4717
+ var _cellNode$attrs, _cellNode$attrs2;
4718
+ return jsx("th", {
4719
+ colSpan: Number(((_cellNode$attrs = cellNode.attrs) == null ? void 0 : _cellNode$attrs.colspan) || 1),
4720
+ rowSpan: Number(((_cellNode$attrs2 = cellNode.attrs) == null ? void 0 : _cellNode$attrs2.rowspan) || 1),
4721
+ children: renderTableContent(cellNode)
4722
+ }, `${cellNode.type}-${cellIndex}`);
4723
+ })
4724
+ }, `${rowNode.type}-${rowIndex}`);
4725
+ })
4726
+ }), jsx("tbody", {
4727
+ children: content.slice(1).map((rowNode, rowIndex) => {
4728
+ var _rowNode$content2;
4729
+ return jsx("tr", {
4730
+ children: (_rowNode$content2 = rowNode.content) == null ? void 0 : _rowNode$content2.map((cellNode, cellIndex) => {
4731
+ var _cellNode$attrs3, _cellNode$attrs4;
4732
+ return jsx("td", {
4733
+ colSpan: Number(((_cellNode$attrs3 = cellNode.attrs) == null ? void 0 : _cellNode$attrs3.colspan) || 1),
4734
+ rowSpan: Number(((_cellNode$attrs4 = cellNode.attrs) == null ? void 0 : _cellNode$attrs4.rowspan) || 1),
4735
+ children: renderTableContent(cellNode)
4736
+ }, `${cellNode.type}-${cellIndex}`);
4737
+ })
4738
+ }, `${rowNode.type}-${rowIndex}`);
4739
+ })
4740
+ })]
4741
+ });
4742
+ };
4743
+
4744
+ /**
4745
+ * Renders the text in bold.
4746
+ *
4747
+ * @param children - The content to be rendered in bold.
4748
+ */
4749
+ const Bold = ({
4750
+ children
4751
+ }) => jsx("strong", {
4752
+ children: children
4753
+ });
4754
+ /**
4755
+ * Renders the text in italic format.
4756
+ *
4757
+ * @param children - The content to be rendered in italic.
4758
+ */
4759
+ const Italic = ({
4760
+ children
4761
+ }) => jsx("em", {
4762
+ children: children
4763
+ });
4764
+ /**
4765
+ * Renders a strike-through text.
4766
+ *
4767
+ * @param children - The content to be rendered within the strike-through element.
4768
+ */
4769
+ const Strike = ({
4770
+ children
4771
+ }) => jsx("s", {
4772
+ children: children
4773
+ });
4774
+ /**
4775
+ * Renders an underline element for the given children.
4776
+ *
4777
+ * @param children - The content to be underlined.
4778
+ */
4779
+ const Underline = ({
4780
+ children
4781
+ }) => jsx("u", {
4782
+ children: children
4783
+ });
4784
+ /**
4785
+ * Renders a paragraph element.
4786
+ *
4787
+ * @param children - The content of the paragraph.
4788
+ * @param attrs - The style attributes for the paragraph.
4789
+ * @returns The rendered paragraph element.
4790
+ */
4791
+ const Paragraph = ({
4792
+ children,
4793
+ attrs
4794
+ }) => {
4795
+ return jsx("p", {
4796
+ style: attrs,
4797
+ children: children
4798
+ });
4799
+ };
4800
+ /**
4801
+ * Renders a link component.
4802
+ *
4803
+ * @param children - The content of the link.
4804
+ * @param attrs - The attributes to be applied to the link.
4805
+ * @returns The rendered link component.
4806
+ */
4807
+ const Link = ({
4808
+ children,
4809
+ attrs
4810
+ }) => {
4811
+ return jsx("a", Object.assign({}, attrs, {
4812
+ children: children
4813
+ }));
4814
+ };
4815
+ /**
4816
+ * Renders a heading element with the specified level.
4817
+ *
4818
+ * @param children - The content of the heading.
4819
+ * @param attrs - The attributes for the heading.
4820
+ * @returns The rendered heading element.
4821
+ */
4822
+ const Heading = ({
4823
+ children,
4824
+ attrs
4825
+ }) => {
4826
+ const level = (attrs == null ? void 0 : attrs.level) || 1;
4827
+ const Tag = `h${level}`;
4828
+ return jsx(Tag, {
4829
+ children: children
4830
+ });
4831
+ };
4832
+ /**
4833
+ * Renders the superscript text.
4834
+ *
4835
+ * @param children - The content to be rendered as superscript.
4836
+ */
4837
+ const Superscript = ({
4838
+ children
4839
+ }) => jsx("sup", {
4840
+ children: children
4841
+ });
4842
+ /**
4843
+ * Renders a subscript element.
4844
+ *
4845
+ * @param children - The content to be rendered as subscript.
4846
+ */
4847
+ const Subscript = ({
4848
+ children
4849
+ }) => jsx("sub", {
4850
+ children: children
4851
+ });
4852
+ const nodeMarks = {
4853
+ link: Link,
4854
+ bold: Bold,
4855
+ underline: Underline,
4856
+ italic: Italic,
4857
+ strike: Strike,
4858
+ superscript: Superscript,
4859
+ subscript: Subscript
4860
+ };
4861
+ /**
4862
+ * Renders a text block with optional marks.
4863
+ *
4864
+ * @param props - The props for the TextBlock component.
4865
+ * @returns The rendered text block.
4866
+ */
4867
+ const TextBlock = props => {
4868
+ const {
4869
+ marks = [],
4870
+ text
4871
+ } = props;
4872
+ const mark = marks[0] || {
4873
+ type: '',
4874
+ attrs: {}
4875
+ };
4876
+ const newProps = Object.assign({}, props, {
4877
+ marks: marks.slice(1)
4878
+ });
4879
+ const Component = nodeMarks[mark == null ? void 0 : mark.type];
4880
+ // To avoid the warning: "Warning: Invalid DOM property `class`. Did you mean `className`?"
4881
+ if (mark.attrs) {
4882
+ mark.attrs.className = mark.attrs.class;
4883
+ delete mark.attrs.class;
4884
+ }
4885
+ if (!Component) {
4886
+ return text;
4887
+ }
4888
+ return jsx(Component, {
4889
+ attrs: mark.attrs,
4890
+ children: jsx(TextBlock, Object.assign({}, newProps))
4891
+ });
4892
+ };
4893
+
4894
+ /**
4895
+ * Renders a video component for displaying videos.
4896
+ *
4897
+ * @param props - The properties for the video component.
4898
+ * @returns The rendered video component.
4899
+ */
4900
+ const DotCMSVideo = props => {
4901
+ const {
4902
+ data,
4903
+ src,
4904
+ mimeType,
4905
+ width,
4906
+ height
4907
+ } = props.attrs;
4908
+ const client = DotCmsClient.instance;
4909
+ const srcUrl = data != null && data.identifier ? `${client.dotcmsUrl}${src}` : src;
4910
+ const poster = data != null && data.thumbnail ? `${client.dotcmsUrl}${data == null ? void 0 : data.thumbnail}` : 'poster-image.jpg';
4911
+ return jsxs("video", {
4912
+ controls: true,
4913
+ preload: "metadata",
4914
+ poster: poster,
4915
+ width: width,
4916
+ height: height,
4917
+ children: [jsx("track", {
4918
+ default: true,
4919
+ kind: "captions",
4920
+ srcLang: "en"
4921
+ }), jsx("source", {
4922
+ src: srcUrl,
4923
+ type: mimeType
4924
+ }), "Your browser does not support the ", jsx("code", {
4925
+ children: "video"
4926
+ }), " element."]
4927
+ });
4928
+ };
4929
+
4930
+ /**
4931
+ * Renders a block editor item based on the provided content and custom renderers.
4932
+ *
4933
+ * @param content - The content nodes to render.
4934
+ * @param customRenderers - Optional custom renderers for specific node types.
4935
+ * @returns The rendered block editor item.
4936
+ */
4937
+ const BlockEditorBlock = ({
4938
+ content,
4939
+ customRenderers
4940
+ }) => {
4941
+ return content == null ? void 0 : content.map((node, index) => {
4942
+ const CustomRendererComponent = customRenderers == null ? void 0 : customRenderers[node.type];
4943
+ if (CustomRendererComponent) {
4944
+ return jsx(CustomRendererComponent, Object.assign({}, node.attrs, {
4945
+ content: node.content,
4946
+ children: jsx(BlockEditorBlock, {
4947
+ content: node.content,
4948
+ customRenderers: customRenderers
4949
+ })
4950
+ }), `${node.type}-${index}`);
4951
+ }
4952
+ switch (node.type) {
4953
+ case Blocks.PARAGRAPH:
4954
+ return jsx(Paragraph, Object.assign({}, node, {
4955
+ children: jsx(BlockEditorBlock, {
4956
+ content: node.content,
4957
+ customRenderers: customRenderers
4958
+ })
4959
+ }), `${node.type}-${index}`);
4960
+ case Blocks.HEADING:
4961
+ return jsx(Heading, Object.assign({}, node, {
4962
+ children: jsx(BlockEditorBlock, {
4963
+ content: node.content,
4964
+ customRenderers: customRenderers
4965
+ })
4966
+ }), `${node.type}-${index}`);
4967
+ case Blocks.TEXT:
4968
+ return jsx(TextBlock, Object.assign({}, node), `${node.type}-${index}`);
4969
+ case Blocks.BULLET_LIST:
4970
+ return jsx(BulletList, {
4971
+ children: jsx(BlockEditorBlock, {
4972
+ content: node.content,
4973
+ customRenderers: customRenderers
4974
+ })
4975
+ }, `${node.type}-${index}`);
4976
+ case Blocks.ORDERED_LIST:
4977
+ return jsx(OrderedList, {
4978
+ children: jsx(BlockEditorBlock, {
4979
+ content: node.content,
4980
+ customRenderers: customRenderers
4981
+ })
4982
+ }, `${node.type}-${index}`);
4983
+ case Blocks.LIST_ITEM:
4984
+ return jsx(ListItem, {
4985
+ children: jsx(BlockEditorBlock, {
4986
+ content: node.content,
4987
+ customRenderers: customRenderers
4988
+ })
4989
+ }, `${node.type}-${index}`);
4990
+ case Blocks.BLOCK_QUOTE:
4991
+ return jsx(BlockQuote, {
4992
+ children: jsx(BlockEditorBlock, {
4993
+ content: node.content,
4994
+ customRenderers: customRenderers
4995
+ })
4996
+ }, `${node.type}-${index}`);
4997
+ case Blocks.CODE_BLOCK:
4998
+ return jsx(CodeBlock, Object.assign({}, node, {
4999
+ children: jsx(BlockEditorBlock, {
5000
+ content: node.content,
5001
+ customRenderers: customRenderers
5002
+ })
5003
+ }), `${node.type}-${index}`);
5004
+ case Blocks.HARDBREAK:
5005
+ return jsx("br", {}, `${node.type}-${index}`);
5006
+ case Blocks.HORIZONTAL_RULE:
5007
+ return jsx("hr", {}, `${node.type}-${index}`);
5008
+ case Blocks.DOT_IMAGE:
5009
+ return jsx(DotCMSImage, Object.assign({}, node), `${node.type}-${index}`);
5010
+ case Blocks.DOT_VIDEO:
5011
+ return jsx(DotCMSVideo, Object.assign({}, node), `${node.type}-${index}`);
5012
+ case Blocks.TABLE:
5013
+ return jsx(TableRenderer, {
5014
+ content: node.content,
5015
+ blockEditorItem: BlockEditorBlock
5016
+ }, `${node.type}-${index}`);
5017
+ case Blocks.DOT_CONTENT:
5018
+ return jsx(DotContent, Object.assign({}, node, {
5019
+ customRenderers: customRenderers
5020
+ }), `${node.type}-${index}`);
5021
+ default:
5022
+ return jsxs("div", {
5023
+ children: ["Unknown Block Type ", node.type]
5024
+ }, `${node.type}-${index}`);
5025
+ }
5026
+ });
5027
+ };
5028
+
5029
+ /**
5030
+ * BlockEditorRenderer component for rendering block editor field.
5031
+ *
5032
+ * @component
5033
+ * @param {Object} props - The component props.
5034
+ * @param {Block} props.blocks - The blocks of content to render.
5035
+ * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
5036
+ * @param {string} [props.className] - Optional CSS class name for the container div.
5037
+ * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
5038
+ * @returns {JSX.Element} A div containing the rendered blocks of content.
5039
+ */
5040
+ const BlockEditorRenderer = ({
5041
+ blocks,
5042
+ customRenderers,
5043
+ className,
5044
+ style
5045
+ }) => {
5046
+ return jsx("div", {
5047
+ className: className,
5048
+ style: style,
5049
+ children: jsx(BlockEditorBlock, {
5050
+ content: blocks.content,
5051
+ customRenderers: customRenderers
5052
+ })
5053
+ });
5054
+ };
5055
+
5056
+ export { BlockEditorRenderer, DotEditableText, DotcmsLayout, PageProvider, Row, useDotcmsPageContext };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "0.0.1-alpha.33",
3
+ "version": "0.0.1-alpha.34",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18",
7
- "@dotcms/client": "0.0.1-alpha.33",
7
+ "@dotcms/client": "0.0.1-alpha.34",
8
8
  "@tinymce/tinymce-react": "^5.1.1"
9
9
  },
10
10
  "description": "Official React Components library to render a dotCMS page.",
package/src/index.d.ts CHANGED
@@ -3,3 +3,5 @@ export * from './lib/components/DotEditableText/DotEditableText';
3
3
  export * from './lib/components/PageProvider/PageProvider';
4
4
  export * from './lib/components/Row/Row';
5
5
  export * from './lib/hooks/useDotcmsPageContext';
6
+ export * from './lib/components/BlockEditorRenderer/BlockEditorRenderer';
7
+ export * from './lib/models/content-node.interface';
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { Block } from '../../models/blocks.interface';
3
+ import { CustomRenderer } from '../../models/content-node.interface';
4
+ export interface BlockEditorRendererProps {
5
+ blocks: Block;
6
+ customRenderers?: CustomRenderer;
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ }
10
+ /**
11
+ * BlockEditorRenderer component for rendering block editor field.
12
+ *
13
+ * @component
14
+ * @param {Object} props - The component props.
15
+ * @param {Block} props.blocks - The blocks of content to render.
16
+ * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
17
+ * @param {string} [props.className] - Optional CSS class name for the container div.
18
+ * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
19
+ * @returns {JSX.Element} A div containing the rendered blocks of content.
20
+ */
21
+ export declare const BlockEditorRenderer: ({ blocks, customRenderers, className, style }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -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: (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,54 @@
1
+ /// <reference types="react" />
2
+ import { ContentNode } from './content-node.interface';
3
+ export interface Block {
4
+ content: ContentNode[];
5
+ }
6
+ export interface DotContentletProps {
7
+ title: string;
8
+ baseType: string;
9
+ inode: string;
10
+ archived: boolean;
11
+ working: boolean;
12
+ locked: boolean;
13
+ contentType: string;
14
+ live: boolean;
15
+ identifier: string;
16
+ image: string;
17
+ imageContentAsset: string;
18
+ urlTitle: string;
19
+ url: string;
20
+ titleImage: string;
21
+ urlMap: string;
22
+ hasLiveVersion: boolean;
23
+ hasTitleImage: boolean;
24
+ sortOrder: number;
25
+ modUser: string;
26
+ __icon__: string;
27
+ contentTypeIcon: string;
28
+ language: string;
29
+ description: string;
30
+ shortDescription: string;
31
+ salePrice: string;
32
+ retailPrice: string;
33
+ mimeType: string;
34
+ thumbnail?: string;
35
+ }
36
+ export interface BlockProps {
37
+ children: React.ReactNode;
38
+ }
39
+ export declare enum Blocks {
40
+ PARAGRAPH = "paragraph",
41
+ HEADING = "heading",
42
+ TEXT = "text",
43
+ BULLET_LIST = "bulletList",
44
+ ORDERED_LIST = "orderedList",
45
+ LIST_ITEM = "listItem",
46
+ BLOCK_QUOTE = "blockquote",
47
+ CODE_BLOCK = "codeBlock",
48
+ HARDBREAK = "hardBreak",
49
+ HORIZONTAL_RULE = "horizontalRule",
50
+ DOT_IMAGE = "dotImage",
51
+ DOT_VIDEO = "dotVideo",
52
+ TABLE = "table",
53
+ DOT_CONTENT = "dotContent"
54
+ }
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { BlockProps } from './blocks.interface';
3
+ export interface Mark {
4
+ type: string;
5
+ attrs: Record<string, string>;
6
+ }
7
+ export interface ContentNode {
8
+ type: string;
9
+ content: ContentNode[];
10
+ attrs?: Record<string, string>;
11
+ marks?: Mark[];
12
+ text?: string;
13
+ }
14
+ export type CustomRenderer<T = any> = Record<string, React.FC<T>>;
15
+ export type CodeBlockProps = BlockProps & ContentNode;
16
+ export type HeadingProps = BlockProps & ContentNode;
17
+ export type LinkProps = BlockProps & {
18
+ attrs?: Mark['attrs'];
19
+ };
20
+ export type ParagraphProps = BlockProps & ContentNode;
21
+ export type DotCMSVideoProps = ContentNode['attrs'] & {
22
+ data?: Record<string, string>;
23
+ };
24
+ export type DotCMSImageProps = ContentNode['attrs'] & {
25
+ data?: Record<string, unknown>;
26
+ };
27
+ export type DotContentProps = ContentNode & {
28
+ customRenderers?: CustomRenderer;
29
+ };