react-bricks 3.9.0-beta.9 → 3.9.1-beta.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
@@ -33,12 +33,12 @@ interface TextProps {
33
33
  declare const Text: React.FC<TextProps>;
34
34
 
35
35
  declare namespace types {
36
- const EmbedProp = "RB_PAGE_EMBED";
37
- const EmbedContent = "RB_PAGE_EMBED_CONTENT";
36
+ export const EmbedProp = "RB_PAGE_EMBED";
37
+ export const EmbedContent = "RB_PAGE_EMBED_CONTENT";
38
38
  /**
39
39
  * Type of Sidebar control
40
40
  */
41
- enum SideEditPropType {
41
+ export enum SideEditPropType {
42
42
  Text = "TEXT",
43
43
  Textarea = "TEXTAREA",
44
44
  Number = "NUMBER",
@@ -53,7 +53,7 @@ declare namespace types {
53
53
  /**
54
54
  * How to display the options
55
55
  */
56
- enum OptionsDisplay {
56
+ export enum OptionsDisplay {
57
57
  Select = "SELECT",
58
58
  Radio = "RADIO",
59
59
  Color = "COLOR"
@@ -61,7 +61,7 @@ declare namespace types {
61
61
  /**
62
62
  * Features for RichText: see also the new RichTextExt
63
63
  */
64
- enum RichTextFeatures {
64
+ export enum RichTextFeatures {
65
65
  Bold = "BOLD",
66
66
  Italic = "ITALIC",
67
67
  Code = "CODE",
@@ -80,14 +80,14 @@ declare namespace types {
80
80
  /**
81
81
  * Page status
82
82
  */
83
- enum PageStatus {
83
+ export enum PageStatus {
84
84
  Draft = "DRAFT",
85
85
  Published = "PUBLISHED"
86
86
  }
87
87
  /**
88
88
  * Device type for responsive preview (for the icon)
89
89
  */
90
- enum DeviceType {
90
+ export enum DeviceType {
91
91
  Desktop = "DESKTOP",
92
92
  Tablet = "TABLET",
93
93
  Phone = "PHONE"
@@ -95,54 +95,54 @@ declare namespace types {
95
95
  /**
96
96
  * Corner for the click-to-edit button
97
97
  */
98
- enum ClickToEditSide {
98
+ export enum ClickToEditSide {
99
99
  BottomRight = "BOTTOM-RIGHT",
100
100
  BottomLeft = "BOTTOM-LEFT",
101
101
  TopRight = "TOP-RIGHT",
102
102
  TopLeft = "TOP-LEFT",
103
103
  None = "NONE"
104
104
  }
105
- enum BlockIconsPosition {
105
+ export enum BlockIconsPosition {
106
106
  InsideBlock = "INSIDE-BLOCK",
107
107
  OutsideBlock = "OUTSIDE-BLOCK"
108
108
  }
109
109
  /**
110
110
  * A Brick is a type of content block
111
111
  */
112
- type Brick<T = {}> = React__default.FC<T> & {
112
+ export type Brick<T = {}> = React__default.FC<T> & {
113
113
  schema: IBlockType<T>;
114
114
  };
115
115
  /**
116
116
  * Bricks are types of content block
117
117
  */
118
- type Bricks = {
118
+ export type Bricks = {
119
119
  [key: string]: Brick<any>;
120
120
  };
121
121
  /**
122
122
  * A Category contains bricks
123
123
  */
124
- type Category = {
124
+ export type Category = {
125
125
  categoryName: string;
126
126
  bricks: Brick<any>[];
127
127
  };
128
128
  /**
129
129
  * A Theme contains categories and bricks
130
130
  */
131
- type Theme = {
131
+ export type Theme = {
132
132
  themeName: string;
133
133
  categories: Category[];
134
134
  };
135
135
  /**
136
136
  * Custom role type
137
137
  */
138
- type CustomRole = {
138
+ export type CustomRole = {
139
139
  id: string;
140
140
  name: string;
141
141
  };
142
142
  /**
143
143
  * The type of the user passed to permission functions
144
144
  */
145
- type PermissionUser = {
145
+ export type PermissionUser = {
146
146
  firstName: string;
147
147
  lastName: string;
148
148
  email: string;
@@ -153,7 +153,7 @@ declare namespace types {
153
153
  /**
154
154
  * The type of the page passed to permission functions
155
155
  */
156
- type PermissionPage = {
156
+ export type PermissionPage = {
157
157
  slug: string;
158
158
  pageType: string;
159
159
  language: string;
@@ -161,7 +161,7 @@ declare namespace types {
161
161
  /**
162
162
  * The type of the brick passed to permission functions
163
163
  */
164
- type PermissionBrick = {
164
+ export type PermissionBrick = {
165
165
  name: string;
166
166
  category: string;
167
167
  theme: string;
@@ -170,7 +170,7 @@ declare namespace types {
170
170
  /**
171
171
  * The permission functions
172
172
  */
173
- type Permissions = {
173
+ export type Permissions = {
174
174
  canAddPage?: (user: PermissionUser, pageType: string) => boolean;
175
175
  canAddTranslation?: (user: PermissionUser, pageType: string, language: string) => boolean;
176
176
  canSeePageType?: (user: PermissionUser, pageType: string) => boolean;
@@ -183,7 +183,7 @@ declare namespace types {
183
183
  /**
184
184
  * The logged-in User
185
185
  */
186
- type User = {
186
+ export type User = {
187
187
  id: string;
188
188
  email: string;
189
189
  firstName: string;
@@ -230,14 +230,14 @@ declare namespace types {
230
230
  /**
231
231
  * Translation for a Page
232
232
  */
233
- type Translation = {
233
+ export type Translation = {
234
234
  language: string;
235
235
  slug: string;
236
236
  };
237
237
  /**
238
238
  * A React Bricks Page
239
239
  */
240
- type Page = {
240
+ export type Page = {
241
241
  id: string;
242
242
  type: string;
243
243
  name: string;
@@ -262,19 +262,19 @@ declare namespace types {
262
262
  /**
263
263
  * Page fields (without content)
264
264
  */
265
- type PageValues = Omit<Page, 'content'>;
265
+ export type PageValues = Omit<Page, 'content'>;
266
266
  /**
267
267
  * A Page with all optional fields, used for the patch
268
268
  */
269
- type PartialPage = Partial<Page>;
269
+ export type PartialPage = Partial<Page>;
270
270
  /**
271
271
  * Page from a list (no content)
272
272
  */
273
- type PageFromList = Omit<Page, 'content'>;
273
+ export type PageFromList = Omit<Page, 'content'>;
274
274
  /**
275
275
  * Page from a list with pagination
276
276
  */
277
- type PagesFromListWithPagination = {
277
+ export type PagesFromListWithPagination = {
278
278
  items: PageFromList[];
279
279
  pagination: {
280
280
  page: number;
@@ -283,7 +283,7 @@ declare namespace types {
283
283
  totalPages: number;
284
284
  };
285
285
  };
286
- type PageWithTranslationsIdentifier = {
286
+ export type PageWithTranslationsIdentifier = {
287
287
  id: string;
288
288
  name: string;
289
289
  language: string;
@@ -294,7 +294,7 @@ declare namespace types {
294
294
  /**
295
295
  * The Author of a Page
296
296
  */
297
- type Author = {
297
+ export type Author = {
298
298
  id: string;
299
299
  email: string;
300
300
  firstName: string;
@@ -302,7 +302,7 @@ declare namespace types {
302
302
  avatarUrl?: string;
303
303
  company?: string;
304
304
  };
305
- type BrickStory<T = Props> = {
305
+ export type BrickStory<T = Props> = {
306
306
  id: string;
307
307
  name: string;
308
308
  showAsBrick?: boolean;
@@ -312,31 +312,32 @@ declare namespace types {
312
312
  /**
313
313
  * A Language for i18n
314
314
  */
315
- type Language = {
315
+ export type Language = {
316
316
  code: string;
317
317
  name: string;
318
318
  };
319
319
  /**
320
320
  * Render function for local links (should use the app's Router)
321
321
  */
322
- type RenderLocalLink = ({ href, target, className, activeClassName, isAdmin, children, }: {
322
+ interface LocalLinkProps {
323
323
  href: string;
324
324
  target?: string;
325
325
  className?: string;
326
326
  activeClassName?: string;
327
327
  isAdmin?: boolean;
328
- children: React__default.ReactNode;
329
- }) => React__default.ReactElement;
328
+ }
329
+ type LocalLinkPropsReal = React__default.PropsWithChildren<Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LocalLinkProps> & LocalLinkProps>;
330
+ export type RenderLocalLink = ({ href, target, className, activeClassName, isAdmin, children, }: LocalLinkPropsReal) => React__default.ReactElement;
330
331
  /**
331
332
  * Props of a content block
332
333
  */
333
- type Props = {
334
+ export type Props = {
334
335
  [key: string]: any;
335
336
  };
336
337
  /**
337
338
  * Interface for the Schema of a Brick
338
339
  */
339
- interface IBlockType<T = Props> {
340
+ export interface IBlockType<T = Props> {
340
341
  name: string;
341
342
  label: string;
342
343
  getDefaultProps?: () => Partial<T>;
@@ -358,7 +359,7 @@ declare namespace types {
358
359
  /**
359
360
  * Item of a Repeater
360
361
  */
361
- interface IRepeaterItem {
362
+ export interface IRepeaterItem {
362
363
  name: string;
363
364
  itemType?: string;
364
365
  itemLabel?: string;
@@ -377,7 +378,7 @@ declare namespace types {
377
378
  /**
378
379
  * The content of a block (instance of a Brick)
379
380
  */
380
- interface IContentBlock {
381
+ export interface IContentBlock {
381
382
  id: string;
382
383
  type: string;
383
384
  props: Props;
@@ -389,14 +390,14 @@ declare namespace types {
389
390
  /**
390
391
  * Option of a select sidebar prop
391
392
  */
392
- interface IOption {
393
+ export interface IOption {
393
394
  value: any;
394
395
  label: string;
395
396
  }
396
397
  /**
397
398
  * Interface for Props of a Custom sidebar component
398
399
  */
399
- interface ICustomKnobProps {
400
+ export interface ICustomKnobProps {
400
401
  id: string;
401
402
  value: any;
402
403
  onChange: any;
@@ -406,7 +407,7 @@ declare namespace types {
406
407
  /**
407
408
  * Sidebar edit Props for a Page
408
409
  */
409
- interface ISideEditPropPage {
410
+ export interface ISideEditPropPage {
410
411
  name: string;
411
412
  label: string;
412
413
  type: SideEditPropType;
@@ -440,14 +441,14 @@ declare namespace types {
440
441
  /**
441
442
  * Sidebar Edit Props
442
443
  */
443
- interface ISideEditProp extends ISideEditPropPage {
444
+ export interface ISideEditProp extends ISideEditPropPage {
444
445
  shouldRefreshText?: boolean;
445
446
  shouldRefreshStyles?: boolean;
446
447
  }
447
448
  /**
448
449
  * A collapsible Group of sidebar Props
449
450
  */
450
- interface ISideGroup {
451
+ export interface ISideGroup {
451
452
  groupName: string;
452
453
  defaultOpen?: boolean;
453
454
  show?: (props: Props) => boolean;
@@ -456,7 +457,7 @@ declare namespace types {
456
457
  /**
457
458
  * Image value interface
458
459
  */
459
- interface IImageSource {
460
+ export interface IImageSource {
460
461
  src: string;
461
462
  srcSet?: string;
462
463
  type?: string;
@@ -472,7 +473,7 @@ declare namespace types {
472
473
  /**
473
474
  * File value interface
474
475
  */
475
- interface IFileSource {
476
+ export interface IFileSource {
476
477
  name: string;
477
478
  url: string;
478
479
  size: number;
@@ -480,11 +481,11 @@ declare namespace types {
480
481
  /**
481
482
  * A Color for a Select sidebar prop
482
483
  */
483
- interface IColor {
484
+ export interface IColor {
484
485
  color: string;
485
486
  [propName: string]: any;
486
487
  }
487
- interface IBrickStory {
488
+ export interface IBrickStory {
488
489
  brickName: string;
489
490
  storyName: string;
490
491
  locked?: boolean;
@@ -494,7 +495,7 @@ declare namespace types {
494
495
  /**
495
496
  * Page type
496
497
  */
497
- interface IPageType {
498
+ export interface IPageType {
498
499
  name: string;
499
500
  pluralName: string;
500
501
  isEntity?: boolean;
@@ -506,21 +507,21 @@ declare namespace types {
506
507
  defaultFeaturedImage?: string;
507
508
  getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
508
509
  customFields?: Array<ISideEditPropPage | ISideGroup>;
509
- getExternalData?: (page: Page) => Promise<Props>;
510
+ getExternalData?: (page: Page, args?: any) => Promise<Props>;
510
511
  metaImageAspectRatio?: number;
511
512
  categories?: ICategory[];
512
513
  }
513
514
  /**
514
515
  * Structure returned by the cleanBlocks function
515
516
  */
516
- interface ICleanBlocks {
517
+ export interface ICleanBlocks {
517
518
  blocks: IContentBlock[];
518
519
  invalidBlocksTypes: string[];
519
520
  }
520
521
  /**
521
522
  * Responsive breakpoint for preview
522
523
  */
523
- interface ResponsiveBreakpoint {
524
+ export interface ResponsiveBreakpoint {
524
525
  type: DeviceType;
525
526
  width: number | string;
526
527
  label: string;
@@ -528,7 +529,7 @@ declare namespace types {
528
529
  /**
529
530
  * Login UI customization
530
531
  */
531
- interface LoginUI {
532
+ export interface LoginUI {
532
533
  sideImage?: string;
533
534
  logo?: string;
534
535
  logoWidth?: number;
@@ -539,14 +540,14 @@ declare namespace types {
539
540
  /**
540
541
  * MenuItem interface
541
542
  */
542
- interface IMenuItem {
543
+ export interface IMenuItem {
543
544
  label: string;
544
545
  path?: string;
545
546
  }
546
547
  /**
547
548
  * The ReactBricks configuration
548
549
  */
549
- interface ReactBricksConfig {
550
+ export interface ReactBricksConfig {
550
551
  appId: string;
551
552
  apiKey: string;
552
553
  bricks?: types.Brick<any>[] | types.Theme[];
@@ -586,7 +587,7 @@ declare namespace types {
586
587
  /**
587
588
  * The ReactBricks context
588
589
  */
589
- interface IReactBricksContext {
590
+ export interface IReactBricksContext {
590
591
  version: string;
591
592
  appId: string;
592
593
  apiKey: string;
@@ -632,7 +633,7 @@ declare namespace types {
632
633
  /**
633
634
  * The Admin context returned from useAdminContext
634
635
  */
635
- interface IReadAdminContext {
636
+ export interface IReadAdminContext {
636
637
  isAdmin: boolean;
637
638
  previewMode: boolean;
638
639
  currentPage: ICurrentPage;
@@ -640,7 +641,7 @@ declare namespace types {
640
641
  /**
641
642
  * Meta fields on Page
642
643
  */
643
- interface IMeta {
644
+ export interface IMeta {
644
645
  title?: string;
645
646
  description?: string;
646
647
  language?: string;
@@ -650,13 +651,13 @@ declare namespace types {
650
651
  /**
651
652
  * Category on categories (pageTypes)
652
653
  */
653
- interface ICategory {
654
+ export interface ICategory {
654
655
  category?: string;
655
656
  }
656
657
  /**
657
658
  * A RichTextExt Plugin
658
659
  */
659
- interface RichTextPlugin {
660
+ export interface RichTextPlugin {
660
661
  type: 'Mark' | 'Block' | 'List';
661
662
  name: string;
662
663
  isInline?: boolean;
@@ -676,7 +677,7 @@ declare namespace types {
676
677
  /**
677
678
  * Definition for a Mark plugin
678
679
  */
679
- interface MarkPlugin {
680
+ export interface MarkPlugin {
680
681
  name: string;
681
682
  label?: string;
682
683
  hotKey?: string;
@@ -686,11 +687,11 @@ declare namespace types {
686
687
  /**
687
688
  * Constructor for a Mark plugin
688
689
  */
689
- type MarkPluginConstructor = (markPlugin: MarkPlugin) => RichTextPlugin;
690
+ export type MarkPluginConstructor = (markPlugin: MarkPlugin) => RichTextPlugin;
690
691
  /**
691
692
  * Definition for a Block plugin
692
693
  */
693
- interface BlockPlugin {
694
+ export interface BlockPlugin {
694
695
  name: string;
695
696
  isInline?: boolean;
696
697
  itemName?: string;
@@ -703,7 +704,8 @@ declare namespace types {
703
704
  /**
704
705
  * Constructor for a Block plugin
705
706
  */
706
- type BlockPluginConstructor = (blockPlugin: BlockPlugin) => RichTextPlugin;
707
+ export type BlockPluginConstructor = (blockPlugin: BlockPlugin) => RichTextPlugin;
708
+ export {};
707
709
  }
708
710
 
709
711
  /**
@@ -827,7 +829,18 @@ interface RepeaterProps {
827
829
  }
828
830
  declare const Repeater: React.FC<RepeaterProps>;
829
831
 
830
- declare const Link: React.FC<LinkProps>;
832
+ /**
833
+ * Props for Link component
834
+ */
835
+ interface LinkProps {
836
+ href: string;
837
+ target?: string;
838
+ className?: string;
839
+ activeClassName?: string;
840
+ simpleAnchor?: boolean;
841
+ }
842
+ declare type LinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps>;
843
+ declare const Link: React.FC<LinkPropsReal>;
831
844
 
832
845
  declare const useAdminContext: () => types.IReadAdminContext;
833
846
 
@@ -939,7 +952,7 @@ declare const useTagsPublic: (page?: number, pageSize?: number) => react_query.U
939
952
 
940
953
  declare const useReactBricksContext: () => types.IReactBricksContext;
941
954
 
942
- declare const fetchPage: (slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[]) => Promise<types.Page>;
955
+ declare const fetchPage: (slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[], getExternalDataArgs?: any) => Promise<types.Page>;
943
956
 
944
957
  /**
945
958
  * Values returned from fetchPages