@rebasepro/cms-types 0.17.0-canary.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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin_collection.d.ts +650 -0
  3. package/dist/augment.d.ts +81 -0
  4. package/dist/collections.d.ts +282 -0
  5. package/dist/controllers/analytics_controller.d.ts +7 -0
  6. package/dist/controllers/auth.d.ts +111 -0
  7. package/dist/controllers/customization_controller.d.ts +69 -0
  8. package/dist/controllers/dialogs_controller.d.ts +36 -0
  9. package/dist/controllers/index.d.ts +10 -0
  10. package/dist/controllers/local_config_persistence.d.ts +20 -0
  11. package/dist/controllers/navigation.d.ts +248 -0
  12. package/dist/controllers/registry.d.ts +96 -0
  13. package/dist/controllers/side_dialogs_controller.d.ts +67 -0
  14. package/dist/controllers/side_panel_controller.d.ts +97 -0
  15. package/dist/controllers/snackbar.d.ts +45 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.es.js +154 -0
  18. package/dist/index.es.js.map +1 -0
  19. package/dist/react_component_ref.d.ts +43 -0
  20. package/dist/rebase_context.d.ts +68 -0
  21. package/dist/types/breadcrumbs.d.ts +15 -0
  22. package/dist/types/builders.d.ts +15 -0
  23. package/dist/types/collection_views.d.ts +105 -0
  24. package/dist/types/component_overrides.d.ts +196 -0
  25. package/dist/types/entity_actions.d.ts +112 -0
  26. package/dist/types/entity_display.d.ts +148 -0
  27. package/dist/types/entity_link_builder.d.ts +7 -0
  28. package/dist/types/entity_views.d.ts +115 -0
  29. package/dist/types/export_import.d.ts +21 -0
  30. package/dist/types/form_layout.d.ts +126 -0
  31. package/dist/types/formex.d.ts +40 -0
  32. package/dist/types/index.d.ts +18 -0
  33. package/dist/types/locales.d.ts +4 -0
  34. package/dist/types/modify_collections.d.ts +5 -0
  35. package/dist/types/plugins.d.ts +277 -0
  36. package/dist/types/property_config.d.ts +74 -0
  37. package/dist/types/property_options.d.ts +255 -0
  38. package/dist/types/slots.d.ts +279 -0
  39. package/dist/types/translations.d.ts +989 -0
  40. package/dist/types/user_management_delegate.d.ts +22 -0
  41. package/package.json +103 -0
  42. package/src/admin_collection.ts +775 -0
  43. package/src/augment.ts +79 -0
  44. package/src/collections.ts +312 -0
  45. package/src/controllers/analytics_controller.tsx +57 -0
  46. package/src/controllers/auth.ts +122 -0
  47. package/src/controllers/customization_controller.tsx +81 -0
  48. package/src/controllers/dialogs_controller.tsx +37 -0
  49. package/src/controllers/index.ts +10 -0
  50. package/src/controllers/local_config_persistence.tsx +22 -0
  51. package/src/controllers/navigation.ts +288 -0
  52. package/src/controllers/registry.ts +114 -0
  53. package/src/controllers/side_dialogs_controller.tsx +82 -0
  54. package/src/controllers/side_panel_controller.tsx +112 -0
  55. package/src/controllers/snackbar.ts +51 -0
  56. package/src/index.ts +20 -0
  57. package/src/react_component_ref.ts +52 -0
  58. package/src/rebase_context.ts +81 -0
  59. package/src/types/breadcrumbs.ts +16 -0
  60. package/src/types/builders.ts +18 -0
  61. package/src/types/collection_views.tsx +125 -0
  62. package/src/types/component_overrides.ts +244 -0
  63. package/src/types/entity_actions.tsx +134 -0
  64. package/src/types/entity_display.ts +182 -0
  65. package/src/types/entity_link_builder.ts +8 -0
  66. package/src/types/entity_views.tsx +135 -0
  67. package/src/types/export_import.ts +26 -0
  68. package/src/types/form_layout.ts +137 -0
  69. package/src/types/formex.ts +45 -0
  70. package/src/types/index.ts +18 -0
  71. package/src/types/locales.ts +81 -0
  72. package/src/types/modify_collections.tsx +6 -0
  73. package/src/types/plugins.tsx +346 -0
  74. package/src/types/property_config.tsx +97 -0
  75. package/src/types/property_options.ts +300 -0
  76. package/src/types/slots.tsx +334 -0
  77. package/src/types/translations.ts +1104 -0
  78. package/src/types/user_management_delegate.ts +23 -0
@@ -0,0 +1,248 @@
1
+ import React from "react";
2
+ import type { AdminCollection } from "@rebasepro/cms-types";
3
+ /**
4
+ * Controller that handles URL path building and resolution.
5
+ * @group Models
6
+ */
7
+ export type UrlController = {
8
+ /**
9
+ * Default path under the navigation routes of the admin will be created.
10
+ * Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
11
+ */
12
+ basePath: string;
13
+ /**
14
+ * Default path under the collection routes of the admin will be created.
15
+ * It defaults to '/c'
16
+ */
17
+ baseCollectionPath: string;
18
+ /**
19
+ * Convert a URL path to a collection or entity path
20
+ * `/c/products` => `products`
21
+ * `/my_cms/c/products/B34SAP8Z` => `products/B34SAP8Z`
22
+ * `/my_cms/my_view` => `my_view`
23
+ * @param cmsPath
24
+ */
25
+ urlPathToDataPath: (cmsPath: string) => string;
26
+ /**
27
+ * Base url path for the home screen
28
+ */
29
+ homeUrl: string;
30
+ /**
31
+ * Check if a url path belongs to a collection
32
+ * @param path
33
+ */
34
+ isUrlCollectionPath: (urlPath: string) => boolean;
35
+ /**
36
+ * Build a URL collection path from a data path
37
+ * `products` => `/c/products`
38
+ * `products/B34SAP8Z` => `/c/products/B34SAP8Z`
39
+ * @param path
40
+ */
41
+ buildUrlCollectionPath: (path: string) => string;
42
+ /**
43
+ * Build a URL path for the admin (e.g. for custom views)
44
+ * @param path
45
+ */
46
+ buildAppUrlPath: (path: string) => string;
47
+ /**
48
+ * Turn a path with collection ids into a resolved path.
49
+ * The ids (typically used in urls) will be replaced with relative paths (typically used in database paths)
50
+ * @param path
51
+ */
52
+ resolveDatabasePathsFrom: (path: string) => string;
53
+ /**
54
+ * A function to navigate to a specified route or URL.
55
+ *
56
+ * @param {string} to - The target route or URL to navigate to.
57
+ * @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
58
+ */
59
+ navigate: (to: string, options?: NavigateOptions) => void;
60
+ };
61
+ /**
62
+ * Controller that manages the state of the navigation menu,
63
+ * including resolved views and top-level grouping.
64
+ * @group Models
65
+ */
66
+ export type NavigationStateController = {
67
+ /**
68
+ * Custom additional views created by the developer, added to the main
69
+ * navigation
70
+ */
71
+ views?: AppView[];
72
+ /**
73
+ * Custom additional views created by the developer, added to the admin
74
+ * navigation
75
+ */
76
+ adminViews?: AppView[];
77
+ /**
78
+ * Configuration for the views that should be displayed at the top
79
+ * level of the navigation (e.g. in the home page or the navigation
80
+ * drawer)
81
+ */
82
+ topLevelNavigation?: NavigationResult;
83
+ /**
84
+ * Is the navigation loading (the configuration persistence has not
85
+ * loaded yet, or a specified navigation builder has not completed)
86
+ */
87
+ loading: boolean;
88
+ /**
89
+ * Was there an error while loading the navigation data
90
+ */
91
+ navigationLoadingError?: Error;
92
+ /**
93
+ * Call this method to recalculate the navigation
94
+ */
95
+ refreshNavigation: () => void;
96
+ };
97
+ export interface NavigateOptions {
98
+ replace?: boolean;
99
+ state?: unknown;
100
+ preventScrollReset?: boolean;
101
+ relative?: "route" | "path";
102
+ flushSync?: boolean;
103
+ viewTransition?: boolean;
104
+ }
105
+ /**
106
+ * Custom additional views created by the developer, added to the main
107
+ * navigation.
108
+ * @group Models
109
+ */
110
+ export interface AppView {
111
+ /**
112
+ * admin Path you can reach this view from.
113
+ */
114
+ slug: string;
115
+ /**
116
+ * Name of this view
117
+ */
118
+ name: string;
119
+ /**
120
+ * Optional description of this view. You can use Markdown
121
+ */
122
+ description?: string;
123
+ /**
124
+ * Icon key to use in this view.
125
+ * You can use any of the icons in the Lucide specs:
126
+ * https://lucide.dev/icons/
127
+ * e.g. 'ShoppingCart' or 'User'
128
+ * Find all the icons in https://rebase.pro/docs/icons
129
+ */
130
+ icon?: string | React.ReactNode;
131
+ /**
132
+ * Should this view be hidden from the main navigation panel.
133
+ * It will still be accessible if you reach the specified path
134
+ */
135
+ hideFromNavigation?: boolean;
136
+ /**
137
+ * Navigation group for this view.
138
+ * Views sharing the same group name will be visually grouped
139
+ * together in the drawer and home page. If not set, the view
140
+ * falls into the default "Views" group.
141
+ *
142
+ * Two names are special: a group called `"Admin"` or `"Settings"` sinks to
143
+ * the bottom of the drawer, by string comparison on the name. That predates
144
+ * {@link pinToBottom} and still works, but rename the group — translate the
145
+ * label, say — and the ordering silently stops happening. Use
146
+ * `pinToBottom` for anything that is not literally one of those two words.
147
+ */
148
+ group?: string;
149
+ /**
150
+ * Sink this view's group to the bottom of the drawer, below the ordinary
151
+ * groups.
152
+ *
153
+ * What `group: "Settings"` has always done, said out loud. Setting it on
154
+ * any one view in a group pins the whole group, since the drawer orders
155
+ * groups and not individual views.
156
+ */
157
+ pinToBottom?: boolean;
158
+ /**
159
+ * Component to be rendered. This can be any React component, and can use
160
+ * any of the provided hooks.
161
+ *
162
+ * Pass a `ComponentType` to enable lazy rendering — the component will
163
+ * only be instantiated when the route is visited. This is recommended
164
+ * for dynamic views generated from database data.
165
+ */
166
+ view: React.ReactNode | React.ComponentType;
167
+ /**
168
+ * If true, a wildcard route (slug/*) is automatically registered
169
+ * alongside the base route, enabling nested navigation within this view.
170
+ */
171
+ nestedRoutes?: boolean;
172
+ /**
173
+ * Restrict this view to users with at least one of the listed roles.
174
+ * When omitted or empty, the view is visible to all authenticated users.
175
+ * Applied during view resolution — the view is filtered out entirely
176
+ * (not just hidden from nav) if the user lacks a matching role.
177
+ */
178
+ roles?: string[];
179
+ }
180
+ /**
181
+ * A composable section that can be rendered on the home page.
182
+ * Use this to add custom content alongside the auto-generated
183
+ * navigation groups.
184
+ * @group Models
185
+ */
186
+ export interface HomePageSection {
187
+ /**
188
+ * Unique key for this section.
189
+ */
190
+ key: string;
191
+ /**
192
+ * Title displayed as the section header.
193
+ */
194
+ title: string;
195
+ /**
196
+ * Arbitrary React content rendered inside the section.
197
+ */
198
+ children: React.ReactNode;
199
+ }
200
+ /**
201
+ * Used to group navigation entries in the main navigation.
202
+ */
203
+ export interface NavigationGroupMapping {
204
+ /**
205
+ * Name of the group, used to display the group header in the UI
206
+ */
207
+ name: string;
208
+ /**
209
+ * List of collection ids or view paths that belong to this group.
210
+ */
211
+ entries: string[];
212
+ /**
213
+ * Icon for the group header, as a Lucide icon name (`"Users"`, `"CreditCard"`).
214
+ *
215
+ * It labels the group header and nothing more — the entries below keep their own
216
+ * icons either way. Only shown while the drawer is expanded, since a drawer
217
+ * collapsed to a rail hides the headers entirely.
218
+ */
219
+ icon?: string;
220
+ /**
221
+ * Configure which groups start collapsed.
222
+ * Set to `true` to collapse in both drawer and home page,
223
+ * or use an object to control each independently.
224
+ *
225
+ * @defaultValue false (expanded)
226
+ */
227
+ collapsedByDefault?: boolean | {
228
+ drawer?: boolean;
229
+ home?: boolean;
230
+ };
231
+ }
232
+ export interface NavigationEntry {
233
+ id: string;
234
+ url: string;
235
+ name: string;
236
+ slug: string;
237
+ type: "collection" | "view" | "admin";
238
+ collection?: AdminCollection;
239
+ view?: AppView;
240
+ description?: string;
241
+ group: string;
242
+ }
243
+ export type NavigationResult = {
244
+ allowDragAndDrop: boolean;
245
+ navigationEntries: NavigationEntry[];
246
+ groups: string[];
247
+ onNavigationEntriesUpdate: (entries: NavigationGroupMapping[]) => void;
248
+ };
@@ -0,0 +1,96 @@
1
+ import { ReactNode } from "react";
2
+ import type { CollectionConfigsBuilder, AppViewsBuilder } from "../types/builders.js";
3
+ import type { EntityCustomView } from "../types/entity_views.js";
4
+ import type { CollectionCustomView } from "../types/collection_views.js";
5
+ import type { EntityAction } from "../types/entity_actions.js";
6
+ import type { AppView, NavigationGroupMapping } from "./navigation.js";
7
+ import type { AdminCollection } from "@rebasepro/cms-types";
8
+ /**
9
+ * Options to enable the built-in collection editor.
10
+ * When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
11
+ */
12
+ export interface CollectionEditorOptions {
13
+ /**
14
+ * Function that returns an auth token for schema-editor API calls.
15
+ * Falls back to `authController.getAuthToken` when omitted.
16
+ */
17
+ getAuthToken?: () => Promise<string | null>;
18
+ /** Mark the editor as read-only (disable mutations). */
19
+ readOnly?: boolean;
20
+ /** Suggested base paths shown when creating new collections. */
21
+ pathSuggestions?: string[];
22
+ }
23
+ export interface RebaseCMSConfig<EC extends AdminCollection = AdminCollection> {
24
+ collections?: EC[] | CollectionConfigsBuilder<EC>;
25
+ /**
26
+ * Custom top-level views added to the main navigation.
27
+ * Accepts a static array of views or an async builder function
28
+ * that receives the current user/auth context for role-based views.
29
+ */
30
+ views?: AppView[] | AppViewsBuilder;
31
+ homePage?: ReactNode;
32
+ entityViews?: EntityCustomView[];
33
+ /**
34
+ * Custom collection view modes available to every collection by `key`.
35
+ * A collection opts into one by naming that key in `admin.customViews`,
36
+ * the same way `entityViews` works.
37
+ */
38
+ collectionViews?: CollectionCustomView[];
39
+ entityActions?: EntityAction[];
40
+ /**
41
+ * Centralized configuration for how collections and views are grouped
42
+ * in the navigation sidebar and home page.
43
+ * Each mapping defines a named group and the collection/view slugs
44
+ * that belong to it. The array order determines group display order.
45
+ * Entry order within each group determines card order.
46
+ */
47
+ navigationGroupMappings?: NavigationGroupMapping[];
48
+ /**
49
+ * Enable the built-in visual collection/schema editor.
50
+ * Pass `true` for zero-config, or an options object for fine-grained control.
51
+ * When enabled, the editor slots, provider, and Studio schema view
52
+ * are all auto-wired — no plugin or manual view injection needed.
53
+ */
54
+ collectionEditor?: boolean | CollectionEditorOptions;
55
+ /**
56
+ * URL path prefix the admin is mounted under, when it does not live at the
57
+ * site root. Set this when the admin is rendered inside a path-prefixed
58
+ * route (e.g. `<Route path="/admin/*">`) so URL⇄collection resolution
59
+ * accounts for the prefix — otherwise the current path won't be recognized
60
+ * as a collection path and views hang on a spinner with no data fetch.
61
+ *
62
+ * Do NOT set this when mounting via a react-router `basename` — react-router
63
+ * already strips the prefix from the location, so the default (`/`) is correct.
64
+ *
65
+ * @default "/"
66
+ */
67
+ basePath?: string;
68
+ }
69
+ export interface RebaseStudioConfig {
70
+ tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "backups" | "api" | "logs" | "api-keys")[];
71
+ homePage?: ReactNode;
72
+ devViews?: AppView[];
73
+ }
74
+ /**
75
+ * Props of the `<RebaseAuth>` front-end route — what the sign-in screen renders.
76
+ *
77
+ * Named `RebaseAuthConfig` until it collided head-on with `RebaseAuthConfig` in
78
+ * `@rebasepro/server`, which is the *backend* auth configuration: JWT secrets,
79
+ * OAuth providers, password hooks, the users collection. Two unrelated shapes
80
+ * under one name, one of them exported from a package whose whole job is to be
81
+ * imported alongside the other.
82
+ */
83
+ export interface RebaseAuthViewConfig {
84
+ loginView?: ReactNode;
85
+ }
86
+ export interface RebaseRegistryController {
87
+ cmsConfig: RebaseCMSConfig | null;
88
+ studioConfig: RebaseStudioConfig | null;
89
+ authConfig: RebaseAuthViewConfig | null;
90
+ registerAdmin: (config: RebaseCMSConfig) => void;
91
+ unregisterAdmin: () => void;
92
+ registerStudio: (config: RebaseStudioConfig) => void;
93
+ unregisterStudio: () => void;
94
+ registerAuth: (config: RebaseAuthViewConfig) => void;
95
+ unregisterAuth: () => void;
96
+ }
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ /**
3
+ * Controller to open the side dialog
4
+ * @group Hooks and utilities
5
+ */
6
+ export interface SideDialogsController {
7
+ /**
8
+ * Close the last panel
9
+ */
10
+ close: () => void;
11
+ /**
12
+ * List of side panels currently open
13
+ */
14
+ sidePanels: SideDialogPanelProps[];
15
+ /**
16
+ * Override the current side panels
17
+ * @param panels
18
+ */
19
+ setSidePanels: (panels: SideDialogPanelProps[]) => void;
20
+ /**
21
+ * Open one or multiple side panels
22
+ * @param props
23
+ */
24
+ open: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
25
+ /**
26
+ * Replace the last open panel with the given one
27
+ * @param props
28
+ */
29
+ replace: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
30
+ }
31
+ /**
32
+ * Props used to open a side dialog
33
+ * @group Hooks and utilities
34
+ */
35
+ export interface SideDialogPanelProps {
36
+ /**
37
+ * A key that identifies this panel
38
+ */
39
+ key: string;
40
+ /**
41
+ * The component type that will be rendered
42
+ */
43
+ component: React.ReactNode;
44
+ /**
45
+ * Optional width of the panel
46
+ */
47
+ width?: string;
48
+ /**
49
+ * When open, change the URL to this path.
50
+ * Note that if you want to restore state from a URL you need to add the
51
+ * logic yourself by listening to URL updates, and probably call `open`.
52
+ */
53
+ urlPath?: string;
54
+ /**
55
+ * If the navigation stack is empty (you landed in the `urlPath` url), what
56
+ * url path to change to when the panel gets closed.
57
+ */
58
+ parentUrlPath?: string;
59
+ /**
60
+ * Callback when the panel is closed
61
+ */
62
+ onClose?: () => void;
63
+ /**
64
+ * Use this prop to store additional data in the panel
65
+ */
66
+ additional?: unknown;
67
+ }
@@ -0,0 +1,97 @@
1
+ import type { Entity } from "@rebasepro/types";
2
+ import type { AdminCollection } from "@rebasepro/cms-types";
3
+ /**
4
+ * Props used to open a side dialog
5
+ * @group Hooks and utilities
6
+ */
7
+ export interface SidePanelBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {
8
+ /**
9
+ * Absolute path of the entity
10
+ */
11
+ path: string;
12
+ /**
13
+ * ID of the entity, if not set, it means we are creating a new entity
14
+ */
15
+ entityId?: string | number;
16
+ /**
17
+ * Set this flag to true if you want to make a copy of an existing entity
18
+ */
19
+ copy?: boolean;
20
+ /**
21
+ * Open the entity with a selected sub-collection view. If the panel for this
22
+ * entity was already open, it is replaced.
23
+ */
24
+ selectedTab?: string;
25
+ /**
26
+ * Use this prop to override the width of the form view.
27
+ * e.g. "600px"
28
+ */
29
+ width?: number | string;
30
+ /**
31
+ * Collection representing the entities of this view.
32
+ * If you leave it blank it will be induced by your navigation
33
+ */
34
+ collection?: AdminCollection<M>;
35
+ /**
36
+ * Should update the URL when opening the dialog.
37
+ * Consider that if the collection that you provide is not defined in the base
38
+ * config of your `Rebase` component, you will not be able to recreate
39
+ * the state if copying the URL to a different window.
40
+ */
41
+ updateUrl?: boolean;
42
+ /**
43
+ * Callback when the entity is updated
44
+ * @param params
45
+ */
46
+ onUpdate?: (params: {
47
+ entity: Entity<M>;
48
+ }) => void;
49
+ /**
50
+ * Callback when the dialog is closed
51
+ */
52
+ onClose?: () => void;
53
+ /**
54
+ * Should this panel close when saving
55
+ */
56
+ closeOnSave?: boolean;
57
+ /**
58
+ * Override some form properties
59
+ */
60
+ formProps?: Record<string, unknown>;
61
+ /**
62
+ * Allow the user to open the entity fullscreen
63
+ */
64
+ allowFullScreen?: boolean;
65
+ /**
66
+ * Pre-populate the form with these values when creating a new entity.
67
+ * Only applied when `entityId` is not set (i.e. the form is in "new" mode).
68
+ * Useful for actions that fetch data from an external source (e.g. a URL)
69
+ * and want to pre-fill the document before the user saves.
70
+ */
71
+ defaultValues?: Partial<M>;
72
+ }
73
+ /**
74
+ * Controller to open the side dialog displaying entity forms
75
+ * @group Hooks and utilities
76
+ */
77
+ export interface SidePanelController {
78
+ /**
79
+ * Close the last panel
80
+ */
81
+ close: () => void;
82
+ /**
83
+ * Open a new entity sideDialog. By default, the collection and configuration
84
+ * of the view is fetched from the collections you have specified in the
85
+ * navigation.
86
+ * At least you need to pass the path of the entity you would like
87
+ * to edit. You can set a entityId if you would like to edit and existing one
88
+ * (or a new one with that id).
89
+ * @param props
90
+ */
91
+ open: <M extends Record<string, unknown> = Record<string, unknown>>(props: SidePanelBindingProps<M>) => void;
92
+ /**
93
+ * Replace the last open entity panel with the given one.
94
+ * @param props
95
+ */
96
+ replace: <M extends Record<string, unknown> = Record<string, unknown>>(props: SidePanelBindingProps<M>) => void;
97
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Possible snackbar types
3
+ * @group Hooks and utilities
4
+ */
5
+ export type SnackbarMessageType = "success" | "info" | "warning" | "error";
6
+ /**
7
+ * A single button rendered inside a snackbar.
8
+ *
9
+ * The reason snackbars have one: undo-after-mutation is the core interaction of
10
+ * any queue or triage screen, and the window in which "undo" means anything is
11
+ * exactly the window the snackbar is on screen. Without a slot here every such
12
+ * view has to build its own strip somewhere else on the page, at which point the
13
+ * confirmation and the way to reverse it are two different pieces of UI.
14
+ *
15
+ * The snackbar dismisses itself after `onClick`, since the action it was
16
+ * offering has been taken.
17
+ *
18
+ * @group Hooks and utilities
19
+ */
20
+ export interface SnackbarAction {
21
+ label: string;
22
+ onClick: () => void;
23
+ }
24
+ /**
25
+ * Controller to display snackbars
26
+ * @group Hooks and utilities
27
+ */
28
+ export interface SnackbarController {
29
+ /**
30
+ * Close the currently open snackbar
31
+ */
32
+ close: () => void;
33
+ /**
34
+ * Display a new snackbar. You need to specify the type and message.
35
+ * You can optionally specify a title
36
+ */
37
+ open: (props: {
38
+ type: SnackbarMessageType;
39
+ title?: string;
40
+ message: React.ReactNode;
41
+ autoHideDuration?: number;
42
+ /** A button rendered alongside the message — typically "Undo". */
43
+ action?: SnackbarAction;
44
+ }) => void;
45
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @rebasepro/cms-types — the React-flavoured half of the Rebase type surface.
3
+ *
4
+ * Everything here describes the admin panel: what a collection looks like on
5
+ * screen, the controllers the panel runs on, the props a custom field or view
6
+ * receives. It depends on @rebasepro/types and nothing in @rebasepro/types
7
+ * depends on it, which is what lets a BaaS install exist without React.
8
+ *
9
+ * If you are building a backend, you want @rebasepro/types.
10
+ */
11
+ import "./augment.js";
12
+ export * from "./types/property_options.js";
13
+ export * from "./react_component_ref.js";
14
+ export * from "./collections.js";
15
+ export * from "./admin_collection.js";
16
+ export * from "./rebase_context.js";
17
+ export * from "./types/index.js";
18
+ export * from "./controllers/index.js";