react-bricks 3.0.1 → 3.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-bricks",
3
- "version": "3.0.1",
3
+ "version": "3.1.2",
4
4
  "description": "React Bricks is a CMS with visual editing based on React components.",
5
5
  "keywords": [
6
6
  "react bricks",
@@ -9,15 +9,20 @@
9
9
  "gatsby cms",
10
10
  "react visual editor",
11
11
  "react site builder",
12
- "react vidsual builder",
12
+ "react visual builder",
13
13
  "react blocks"
14
14
  ],
15
15
  "homepage": "https://reactbricks.com",
16
16
  "license": "UNLICENSED",
17
17
  "author": "Matteo Frana @ F2 .net engineering s.r.l. <f2@f2.net>",
18
18
  "main": "index.js",
19
- "module": "react-bricks.esm.production.min.js",
19
+ "module": "react-bricks.esm.js",
20
20
  "typings": "react-bricks.d.ts",
21
+ "exports": {
22
+ "require": "./index.js",
23
+ "import": "./react-bricks.esm.js",
24
+ "default": "./react-bricks.esm.js"
25
+ },
21
26
  "peerDependencies": {
22
27
  "react": ">=17",
23
28
  "react-dom": ">=17"
package/react-bricks.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
1
+ import React, { FC, ReactElement, Context } from 'react';
3
2
  import { BaseEditor, Editor as Editor$1, Node, Descendant } from 'slate';
4
- import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
5
3
  import { HistoryEditor } from 'slate-history';
6
- import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
7
- import * as react_query from 'react-query';
4
+ import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
8
5
  import { UseQueryResult } from 'react-query';
6
+ import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
9
7
  export { v4 as uuid } from 'uuid';
10
8
 
11
9
  declare module 'slate' {
@@ -27,7 +25,7 @@ interface TextProps {
27
25
  propName: string;
28
26
  multiline?: boolean;
29
27
  }
30
- declare const Text: React.FC<TextProps>;
28
+ declare const Text: FC<TextProps>;
31
29
 
32
30
  declare namespace types {
33
31
  /**
@@ -98,7 +96,7 @@ declare namespace types {
98
96
  /**
99
97
  * A Brick is a type of content block
100
98
  */
101
- type Brick<T = {}> = React__default.FC<T> & {
99
+ type Brick<T = {}> = React.FC<T> & {
102
100
  schema: IBlockType;
103
101
  };
104
102
  /**
@@ -154,6 +152,7 @@ declare namespace types {
154
152
  slug: string;
155
153
  meta: IMeta;
156
154
  customValues?: Props;
155
+ externalData?: Props;
157
156
  content: IContentBlock[];
158
157
  authorId?: string;
159
158
  author: Author;
@@ -235,8 +234,8 @@ declare namespace types {
235
234
  className?: string;
236
235
  activeClassName?: string;
237
236
  isAdmin?: boolean;
238
- children: React__default.ReactNode;
239
- }) => React__default.ReactElement;
237
+ children: React.ReactNode;
238
+ }) => React.ReactElement;
240
239
  /**
241
240
  * Props of a content block
242
241
  */
@@ -253,6 +252,7 @@ declare namespace types {
253
252
  hideFromAddMenu?: boolean;
254
253
  sideEditProps?: Array<ISideEditProp | ISideGroup>;
255
254
  repeaterItems?: IRepeaterItem[];
255
+ mapExternalDataToProps?: (externalData: Props, brickProps?: Props) => Props;
256
256
  playgroundLinkUrl?: string;
257
257
  playgroundLinkLabel?: string;
258
258
  category?: string;
@@ -300,7 +300,7 @@ declare namespace types {
300
300
  name: string;
301
301
  label: string;
302
302
  type: SideEditPropType;
303
- component?: React__default.FC<ICustomKnobProps>;
303
+ component?: React.FC<ICustomKnobProps>;
304
304
  validate?: (value: any, props?: Props) => boolean | string;
305
305
  show?: (props: Props) => boolean;
306
306
  textareaOptions?: {
@@ -347,6 +347,14 @@ declare namespace types {
347
347
  width: number;
348
348
  height: number;
349
349
  }
350
+ /**
351
+ * File value interface
352
+ */
353
+ interface IFileSource {
354
+ name: string;
355
+ url: string;
356
+ size: number;
357
+ }
350
358
  /**
351
359
  * A Color for a Select sidebar prop
352
360
  */
@@ -368,6 +376,7 @@ declare namespace types {
368
376
  defaultFeaturedImage?: string;
369
377
  getDefaultContent?: () => string[];
370
378
  customFields?: Array<ISideEditPropPage | ISideGroup>;
379
+ getExternalData?: (page: Page) => Promise<Props>;
371
380
  }
372
381
  /**
373
382
  * Structure returned by the cleanBlocks function
@@ -429,6 +438,7 @@ declare namespace types {
429
438
  isDarkColorMode?: boolean;
430
439
  toggleColorMode?: () => void;
431
440
  useCssInJs?: boolean;
441
+ appRootElement: string | HTMLElement;
432
442
  clickToEditSide?: ClickToEditSide;
433
443
  customFields?: Array<ISideEditPropPage | ISideGroup>;
434
444
  responsiveBreakpoints: ResponsiveBreakpoint[];
@@ -467,7 +477,7 @@ declare namespace types {
467
477
  renderLeaf?: (props: RenderLeafProps) => JSX.Element;
468
478
  toggle: (editor: Editor$1, plugins: RichTextPlugin[]) => void;
469
479
  button?: {
470
- icon: React__default.ReactElement;
480
+ icon: React.ReactElement;
471
481
  isActive: (editor: Editor$1) => boolean;
472
482
  };
473
483
  enhanceEditor?: (editor: Editor$1) => Editor$1;
@@ -480,7 +490,7 @@ declare namespace types {
480
490
  label?: string;
481
491
  hotKey?: string;
482
492
  render: (props: RenderLeafProps) => JSX.Element;
483
- icon: React__default.ReactElement;
493
+ icon: React.ReactElement;
484
494
  }
485
495
  /**
486
496
  * Constructor for a Mark plugin
@@ -497,7 +507,7 @@ declare namespace types {
497
507
  hotKey?: string;
498
508
  render: (props: RenderElementProps) => JSX.Element;
499
509
  renderItem?: (props: RenderElementProps) => JSX.Element;
500
- icon: React__default.ReactElement;
510
+ icon: React.ReactElement;
501
511
  }
502
512
  /**
503
513
  * Constructor for a Block plugin
@@ -518,7 +528,7 @@ interface RichTextProps {
518
528
  plugins?: types.RichTextPlugin[];
519
529
  multiline?: boolean;
520
530
  }
521
- declare const RichText: React.FC<RichTextProps>;
531
+ declare const RichText: FC<RichTextProps>;
522
532
 
523
533
  /**
524
534
  * Props for renderLink render function
@@ -551,7 +561,7 @@ interface CompatibleRichTextProps {
551
561
  renderH6?: (props: RenderElementProps) => JSX.Element;
552
562
  renderQuote?: (props: RenderElementProps) => JSX.Element;
553
563
  }
554
- declare const CompatibleRichText: React__default.FC<CompatibleRichTextProps>;
564
+ declare const CompatibleRichText: React.FC<CompatibleRichTextProps>;
555
565
 
556
566
  /**
557
567
  * Props for Image
@@ -567,7 +577,22 @@ interface ImageProps {
567
577
  imageClassName?: string;
568
578
  imageStyle?: object;
569
579
  }
570
- declare const Image: React.FC<ImageProps>;
580
+ declare const Image: FC<ImageProps>;
581
+
582
+ /**
583
+ * Props for Text
584
+ */
585
+ interface FileProps {
586
+ propName: string;
587
+ renderBlock: (props?: File) => JSX.Element;
588
+ allowedExtensions?: string[];
589
+ }
590
+ interface File {
591
+ name: string;
592
+ size: string;
593
+ url: string;
594
+ }
595
+ declare const File: React.FC<FileProps>;
571
596
 
572
597
  /**
573
598
  * Props for Repeater
@@ -575,29 +600,16 @@ declare const Image: React.FC<ImageProps>;
575
600
  interface RepeaterProps {
576
601
  propName: string;
577
602
  itemProps?: types.Props;
578
- renderWrapper?: (items: React.ReactElement) => React.ReactElement;
579
- renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
603
+ renderWrapper?: (items: ReactElement) => ReactElement;
604
+ renderItemWrapper?: (item: ReactElement, index: number, itemsCount: number) => ReactElement;
580
605
  }
581
- declare const Repeater: React.FC<RepeaterProps>;
582
-
583
- declare const Link: React.FC<LinkProps>;
584
-
585
- declare const ReactBricks: React.FC<types.ReactBricksConfig>;
606
+ declare const Repeater: FC<RepeaterProps>;
586
607
 
587
- declare const ReactBricksContext: React.Context<types.IReactBricksContext>;
588
-
589
- var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:\"\";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}";
590
- styleInject(css_248z);
608
+ declare const Link: FC<LinkProps>;
591
609
 
592
- declare const Admin: React.FC<AdminProps>;
610
+ declare const ReactBricks: FC<types.ReactBricksConfig>;
593
611
 
594
- declare const AdminContext: React.Context<types.IAdminContext>;
595
-
596
- declare const Header: React.FC<HeaderProps>;
597
-
598
- declare const Login: React.FC;
599
-
600
- declare const Editor: React.FC;
612
+ declare const ReactBricksContext: Context<types.IReactBricksContext>;
601
613
 
602
614
  /**
603
615
  * Props for PageViewer
@@ -605,48 +617,17 @@ declare const Editor: React.FC;
605
617
  interface PageViewerProps {
606
618
  page: types.Page | null | undefined;
607
619
  }
608
- declare const PageViewer: React.FC<PageViewerProps>;
620
+ declare const PageViewer: FC<PageViewerProps>;
609
621
 
610
- declare const Playground: () => JSX.Element;
622
+ declare const Editor: FC;
611
623
 
612
- declare const AppSettings: React.FC;
624
+ declare const Playground: () => JSX.Element;
613
625
 
614
- declare const useAuth: () => {
615
- loginUser: (email: string, password: string) => Promise<({
616
- id: string;
617
- email: string;
618
- firstName: string;
619
- lastName: string;
620
- company: string;
621
- avatarUrl?: string | undefined;
622
- isAdmin: boolean;
623
- token: string;
624
- appName: string;
625
- deployHookUrl?: string | undefined;
626
- deployHookMethod?: string | undefined;
627
- deployHookTriggerOnScheduledPublishing: boolean;
628
- deployHookStagingUrl?: string | undefined;
629
- deployHookStagingMethod?: string | undefined;
630
- deployHookStagingTriggerOnScheduledPublishing: boolean;
631
- eventsHookUrl?: string | undefined;
632
- eventsHookAuthToken?: string | undefined;
633
- canCreatePage: boolean;
634
- canDeletePage: boolean;
635
- canDeploy: boolean;
636
- canDeployStaging: boolean;
637
- role: string;
638
- plan: string;
639
- languages: types.Language[];
640
- defaultLanguage: string;
641
- } & {
642
- authToken: string;
643
- }) | null>;
644
- logoutUser: () => void;
645
- };
626
+ declare const AppSettings: FC;
646
627
 
647
- declare const usePage$1: (pageId: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
628
+ declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
648
629
 
649
- declare const usePage: (slug: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
630
+ declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
650
631
 
651
632
  /**
652
633
  * Values returned from usePages
@@ -708,9 +689,7 @@ declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPa
708
689
 
709
690
  declare const useReactBricksContext: () => types.IReactBricksContext;
710
691
 
711
- declare const useAdminContext: () => types.IReadAdminContext;
712
-
713
- declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined) => Promise<types.Page>;
692
+ declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined, pageTypes?: types.IPageType[] | undefined) => Promise<types.Page>;
714
693
 
715
694
  /**
716
695
  * Values returned from fetchPages
@@ -743,7 +722,7 @@ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks
743
722
 
744
723
  declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
745
724
 
746
- declare const _default$1: {
725
+ declare const _default: {
747
726
  bold: types.RichTextPlugin;
748
727
  italic: types.RichTextPlugin;
749
728
  code: types.RichTextPlugin;
@@ -760,9 +739,56 @@ declare const _default$1: {
760
739
  unorderedList: types.RichTextPlugin;
761
740
  };
762
741
 
763
- declare const _default: {
742
+ declare const _default$1: {
764
743
  serialize: (nodes: Node[]) => string;
765
744
  deserialize: (input: string) => Descendant[];
745
+ isText: (value: any) => boolean;
766
746
  };
767
747
 
768
- export { Admin, AdminContext, AppSettings, Editor, Header, Image, Link, Login, PageViewer, _default as Plain, Playground, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, cleanPage, fetchPage, fetchPages, getPagePlainText, _default$1 as plugins, types, useAdminContext, useAuth, usePage$1 as usePage, usePage as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useVisualEdit };
748
+ var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:\"\";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}";
749
+ styleInject(css_248z);
750
+
751
+ declare const Admin: FC<AdminProps>;
752
+
753
+ declare const AdminContext: Context<types.IAdminContext>;
754
+
755
+ declare const Header: FC<HeaderProps>;
756
+
757
+ declare const Login: FC;
758
+
759
+ declare const useAuth: () => {
760
+ loginUser: (email: string, password: string) => Promise<({
761
+ id: string;
762
+ email: string;
763
+ firstName: string;
764
+ lastName: string;
765
+ company: string;
766
+ avatarUrl?: string | undefined;
767
+ isAdmin: boolean;
768
+ token: string;
769
+ appName: string;
770
+ deployHookUrl?: string | undefined;
771
+ deployHookMethod?: string | undefined;
772
+ deployHookTriggerOnScheduledPublishing: boolean;
773
+ deployHookStagingUrl?: string | undefined;
774
+ deployHookStagingMethod?: string | undefined;
775
+ deployHookStagingTriggerOnScheduledPublishing: boolean;
776
+ eventsHookUrl?: string | undefined;
777
+ eventsHookAuthToken?: string | undefined;
778
+ canCreatePage: boolean;
779
+ canDeletePage: boolean;
780
+ canDeploy: boolean;
781
+ canDeployStaging: boolean;
782
+ role: string;
783
+ plan: string;
784
+ languages: types.Language[];
785
+ defaultLanguage: string;
786
+ } & {
787
+ authToken: string;
788
+ }) | null>;
789
+ logoutUser: () => void;
790
+ };
791
+
792
+ declare const useAdminContext: () => types.IReadAdminContext;
793
+
794
+ export { Admin, AdminContext, AppSettings, Editor, File, Header, Image, Link, Login, PageViewer, _default$1 as Plain, Playground, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, cleanPage, fetchPage, fetchPages, getPagePlainText, _default as plugins, types, useAdminContext, useAuth, usePage, usePage$1 as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useVisualEdit };