react-bricks 3.0.0-beta.1 → 3.0.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.
package/react-bricks.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import React, { FC, ReactElement, Context } from 'react';
1
+ import * as React from 'react';
2
+ import React__default from 'react';
2
3
  import { BaseEditor, Editor as Editor$1, Node, Descendant } from 'slate';
3
4
  import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
4
5
  import { HistoryEditor } from 'slate-history';
5
6
  import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
7
+ import * as react_query from 'react-query';
6
8
  import { UseQueryResult } from 'react-query';
7
9
  export { v4 as uuid } from 'uuid';
8
10
 
@@ -17,13 +19,15 @@ declare module 'slate' {
17
19
  * Props for Text
18
20
  */
19
21
  interface TextProps {
20
- renderBlock: (props: {
21
- children: any;
22
- }) => ReactElement;
22
+ renderBlock: (props: RenderElementProps) => JSX.Element;
23
23
  placeholder: string;
24
+ renderPlaceholder?: (props: {
25
+ children: any;
26
+ }) => JSX.Element;
24
27
  propName: string;
28
+ multiline: boolean;
25
29
  }
26
- declare const Text: FC<TextProps>;
30
+ declare const Text: React.FC<TextProps>;
27
31
 
28
32
  declare namespace types {
29
33
  /**
@@ -94,7 +98,7 @@ declare namespace types {
94
98
  /**
95
99
  * A Brick is a type of content block
96
100
  */
97
- type Brick<T = {}> = React.FC<T> & {
101
+ type Brick<T = {}> = React__default.FC<T> & {
98
102
  schema: IBlockType;
99
103
  };
100
104
  /**
@@ -231,8 +235,8 @@ declare namespace types {
231
235
  className?: string;
232
236
  activeClassName?: string;
233
237
  isAdmin?: boolean;
234
- children: React.ReactNode;
235
- }) => React.ReactElement;
238
+ children: React__default.ReactNode;
239
+ }) => React__default.ReactElement;
236
240
  /**
237
241
  * Props of a content block
238
242
  */
@@ -296,7 +300,7 @@ declare namespace types {
296
300
  name: string;
297
301
  label: string;
298
302
  type: SideEditPropType;
299
- component?: React.FC<ICustomKnobProps>;
303
+ component?: React__default.FC<ICustomKnobProps>;
300
304
  validate?: (value: any, props?: Props) => boolean | string;
301
305
  show?: (props: Props) => boolean;
302
306
  textareaOptions?: {
@@ -463,7 +467,7 @@ declare namespace types {
463
467
  renderLeaf?: (props: RenderLeafProps) => JSX.Element;
464
468
  toggle: (editor: Editor$1, plugins: RichTextPlugin[]) => void;
465
469
  button?: {
466
- icon: React.ReactElement;
470
+ icon: React__default.ReactElement;
467
471
  isActive: (editor: Editor$1) => boolean;
468
472
  };
469
473
  enhanceEditor?: (editor: Editor$1) => Editor$1;
@@ -476,7 +480,7 @@ declare namespace types {
476
480
  label?: string;
477
481
  hotKey?: string;
478
482
  render: (props: RenderLeafProps) => JSX.Element;
479
- icon: React.ReactElement;
483
+ icon: React__default.ReactElement;
480
484
  }
481
485
  /**
482
486
  * Constructor for a Mark plugin
@@ -493,7 +497,7 @@ declare namespace types {
493
497
  hotKey?: string;
494
498
  render: (props: RenderElementProps) => JSX.Element;
495
499
  renderItem?: (props: RenderElementProps) => JSX.Element;
496
- icon: React.ReactElement;
500
+ icon: React__default.ReactElement;
497
501
  }
498
502
  /**
499
503
  * Constructor for a Block plugin
@@ -508,9 +512,13 @@ interface RichTextProps {
508
512
  renderBlock: (props: RenderElementProps) => JSX.Element;
509
513
  propName: string;
510
514
  placeholder: string;
515
+ renderPlaceholder?: (props: {
516
+ children: any;
517
+ }) => JSX.Element;
511
518
  plugins?: types.RichTextPlugin[];
519
+ multiline?: boolean;
512
520
  }
513
- declare const RichText: FC<RichTextProps>;
521
+ declare const RichText: React.FC<RichTextProps>;
514
522
 
515
523
  /**
516
524
  * Props for renderLink render function
@@ -542,7 +550,7 @@ interface CompatibleRichTextProps {
542
550
  renderH6?: (props: RenderElementProps) => JSX.Element;
543
551
  renderQuote?: (props: RenderElementProps) => JSX.Element;
544
552
  }
545
- declare const CompatibleRichText: React.FC<CompatibleRichTextProps>;
553
+ declare const CompatibleRichText: React__default.FC<CompatibleRichTextProps>;
546
554
 
547
555
  /**
548
556
  * Props for Image
@@ -558,7 +566,7 @@ interface ImageProps {
558
566
  imageClassName?: string;
559
567
  imageStyle?: object;
560
568
  }
561
- declare const Image: FC<ImageProps>;
569
+ declare const Image: React.FC<ImageProps>;
562
570
 
563
571
  /**
564
572
  * Props for Repeater
@@ -566,29 +574,29 @@ declare const Image: FC<ImageProps>;
566
574
  interface RepeaterProps {
567
575
  propName: string;
568
576
  itemProps?: types.Props;
569
- renderWrapper?: (items: ReactElement) => ReactElement;
570
- renderItemWrapper?: (item: ReactElement, index: number, itemsCount: number) => ReactElement;
577
+ renderWrapper?: (items: React.ReactElement) => React.ReactElement;
578
+ renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
571
579
  }
572
- declare const Repeater: FC<RepeaterProps>;
580
+ declare const Repeater: React.FC<RepeaterProps>;
573
581
 
574
- declare const Link: FC<LinkProps>;
582
+ declare const Link: React.FC<LinkProps>;
575
583
 
576
- declare const ReactBricks: FC<types.ReactBricksConfig>;
584
+ declare const ReactBricks: React.FC<types.ReactBricksConfig>;
577
585
 
578
- declare const ReactBricksContext: Context<types.IReactBricksContext>;
586
+ declare const ReactBricksContext: React.Context<types.IReactBricksContext>;
579
587
 
580
- var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
588
+ 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}";
581
589
  styleInject(css_248z);
582
590
 
583
- declare const Admin: FC<AdminProps>;
591
+ declare const Admin: React.FC<AdminProps>;
584
592
 
585
- declare const AdminContext: Context<types.IAdminContext>;
593
+ declare const AdminContext: React.Context<types.IAdminContext>;
586
594
 
587
- declare const Header: FC<HeaderProps>;
595
+ declare const Header: React.FC<HeaderProps>;
588
596
 
589
- declare const Login: FC;
597
+ declare const Login: React.FC;
590
598
 
591
- declare const Editor: FC;
599
+ declare const Editor: React.FC;
592
600
 
593
601
  /**
594
602
  * Props for PageViewer
@@ -596,20 +604,48 @@ declare const Editor: FC;
596
604
  interface PageViewerProps {
597
605
  page: types.Page | null | undefined;
598
606
  }
599
- declare const PageViewer: FC<PageViewerProps>;
607
+ declare const PageViewer: React.FC<PageViewerProps>;
600
608
 
601
609
  declare const Playground: () => JSX.Element;
602
610
 
603
- declare const AppSettings: FC;
611
+ declare const AppSettings: React.FC;
604
612
 
605
613
  declare const useAuth: () => {
606
- loginUser: (email: string, password: string) => Promise<any>;
614
+ loginUser: (email: string, password: string) => Promise<({
615
+ id: string;
616
+ email: string;
617
+ firstName: string;
618
+ lastName: string;
619
+ company: string;
620
+ avatarUrl?: string | undefined;
621
+ isAdmin: boolean;
622
+ token: string;
623
+ appName: string;
624
+ deployHookUrl?: string | undefined;
625
+ deployHookMethod?: string | undefined;
626
+ deployHookTriggerOnScheduledPublishing: boolean;
627
+ deployHookStagingUrl?: string | undefined;
628
+ deployHookStagingMethod?: string | undefined;
629
+ deployHookStagingTriggerOnScheduledPublishing: boolean;
630
+ eventsHookUrl?: string | undefined;
631
+ eventsHookAuthToken?: string | undefined;
632
+ canCreatePage: boolean;
633
+ canDeletePage: boolean;
634
+ canDeploy: boolean;
635
+ canDeployStaging: boolean;
636
+ role: string;
637
+ plan: string;
638
+ languages: types.Language[];
639
+ defaultLanguage: string;
640
+ } & {
641
+ authToken: string;
642
+ }) | null>;
607
643
  logoutUser: () => void;
608
644
  };
609
645
 
610
- declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
646
+ declare const usePage$1: (pageId: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
611
647
 
612
- declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
648
+ declare const usePage: (slug: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
613
649
 
614
650
  /**
615
651
  * Values returned from usePages
@@ -706,7 +742,7 @@ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks
706
742
 
707
743
  declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
708
744
 
709
- declare const _default: {
745
+ declare const _default$1: {
710
746
  bold: types.RichTextPlugin;
711
747
  italic: types.RichTextPlugin;
712
748
  code: types.RichTextPlugin;
@@ -723,9 +759,9 @@ declare const _default: {
723
759
  unorderedList: types.RichTextPlugin;
724
760
  };
725
761
 
726
- declare const _default$1: {
762
+ declare const _default: {
727
763
  serialize: (nodes: Node[]) => string;
728
764
  deserialize: (input: string) => Descendant[];
729
765
  };
730
766
 
731
- export { Admin, AdminContext, AppSettings, Editor, 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 };
767
+ 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 };