@panneau/core 4.0.11 → 4.0.15

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.
@@ -0,0 +1,450 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, ComponentType } from 'react';
4
+ export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
5
+ export { TrackingContext } from '@folklore/tracking';
6
+
7
+ declare class ComponentsManager {
8
+ components: Record<string, unknown>;
9
+ constructor(components?: Record<string, unknown>);
10
+ addComponent(name: string, component: unknown, namespace?: string | null): this;
11
+ addComponents(components: Record<string, unknown>, namespace?: string | null): this;
12
+ merge(manager: ComponentsManager, namespace?: string | null): this;
13
+ addNamespace(namespace: string | null): this;
14
+ getComponent(name: string, namespace?: string | null): unknown;
15
+ getComponents(namespace?: string | null): Record<string, unknown> | null;
16
+ hasComponent(name: string, namespace?: string | null): boolean;
17
+ }
18
+
19
+ interface Definition$1 {
20
+ id: string;
21
+ component?: unknown;
22
+ [key: string]: unknown;
23
+ }
24
+ declare class DefinitionsManager {
25
+ definitions: Definition$1[];
26
+ constructor(definitions?: Definition$1[]);
27
+ addDefinition(definition: Definition$1 | Definition$1[]): this;
28
+ addDefinitions(definitions: Definition$1[]): this;
29
+ merge(manager: DefinitionsManager): this;
30
+ getDefinition(id: string | null): Definition$1 | null;
31
+ getDefinitions(): Definition$1[];
32
+ hasDefinition(id: string): boolean;
33
+ getComponent(id: string): unknown;
34
+ getComponents(): Record<string, unknown>;
35
+ }
36
+
37
+ declare class FieldsManager extends DefinitionsManager {
38
+ }
39
+
40
+ declare const MODALS_NAMESPACE = "modals";
41
+ declare const FIELDS_NAMESPACE = "fields";
42
+ declare const FORMS_NAMESPACE = "forms";
43
+ declare const FILTERS_NAMESPACE = "filters";
44
+ declare const LISTS_NAMESPACE = "lists";
45
+ declare const DISPLAYS_NAMESPACE = "displays";
46
+ declare const ACTIONS_NAMESPACE = "actions";
47
+ declare const BUTTONS_NAMESPACE = "buttons";
48
+ declare const PAGES_NAMESPACE = "pages";
49
+ declare const PREVIEWS_NAMESPACE = "previews";
50
+ declare const APP_NAMESPACE = "app";
51
+ declare const ComponentsContext: react.Context<ComponentsManager>;
52
+ /**
53
+ * Hooks
54
+ */
55
+ declare function useComponentsManager(namespace?: string | null): ComponentsManager;
56
+ declare function useComponents(namespace?: string | null, defaultComponents?: Record<string, unknown>): Record<string, unknown>;
57
+ declare function useComponent(name: unknown, defaultComponent?: unknown, namespace?: string | null): unknown;
58
+ /**
59
+ * Fields hooks
60
+ */
61
+ declare function useFieldsComponentsManager(): ComponentsManager;
62
+ declare function useFieldsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
63
+ declare function useFieldComponent(name: unknown, defaultComponent?: unknown): unknown;
64
+ /**
65
+ * Forms hooks
66
+ */
67
+ declare function useFormsComponentsManager(): ComponentsManager;
68
+ declare function useFormsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
69
+ declare function useFormComponent(name: unknown, defaultComponent?: unknown): unknown;
70
+ /**
71
+ * Modals hooks
72
+ */
73
+ declare function useModalsComponentsManager(): ComponentsManager;
74
+ declare function useModalsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
75
+ declare function useModalComponent(name: unknown, defaultComponent?: unknown): unknown;
76
+ /**
77
+ * Filters hooks
78
+ */
79
+ declare function useFiltersComponentsManager(): ComponentsManager;
80
+ declare function useFiltersComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
81
+ declare function useFilterComponent(name: unknown, defaultComponent?: unknown): unknown;
82
+ /**
83
+ * Lists hooks
84
+ */
85
+ declare function useListsComponentsManager(): ComponentsManager;
86
+ declare function useListsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
87
+ declare function useListComponent(name: unknown, defaultComponent?: unknown): unknown;
88
+ /**
89
+ * Displays hooks
90
+ */
91
+ declare function useDisplaysComponentsManager(): ComponentsManager;
92
+ declare function useDisplaysComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
93
+ declare function useDisplayComponent(name: unknown, defaultComponent?: unknown): unknown;
94
+ /**
95
+ * Actions hooks
96
+ */
97
+ declare function useActionsComponentsManager(): ComponentsManager;
98
+ declare function useActionsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
99
+ declare function useActionComponent(name: unknown, defaultComponent?: unknown): unknown;
100
+ /**
101
+ * Buttons hooks
102
+ */
103
+ declare function useButtonsComponentsManager(): ComponentsManager;
104
+ declare function useButtonsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
105
+ declare function useButtonComponent(name: unknown, defaultComponent?: unknown): unknown;
106
+ /**
107
+ * Pages hooks
108
+ */
109
+ declare function usePagesComponentsManager(): ComponentsManager;
110
+ declare function usePagesComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
111
+ declare function usePageComponent(name: unknown, defaultComponent?: unknown): unknown;
112
+ /**
113
+ * Previews hooks
114
+ */
115
+ declare function usePreviewsComponentsManager(): ComponentsManager;
116
+ declare function usePreviewsComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
117
+ declare function usePreviewComponent(name: unknown, defaultComponent?: unknown): unknown;
118
+ /**
119
+ * App hooks
120
+ */
121
+ declare function useAppComponentsManager(): ComponentsManager;
122
+ declare function useAppComponents(defaultComponents?: Record<string, unknown>): Record<string, unknown>;
123
+ declare function useAppComponent(name: unknown, defaultComponent?: unknown): unknown;
124
+ /**
125
+ * Provider
126
+ */
127
+ interface ComponentsProviderProps {
128
+ children: ReactNode;
129
+ namespace?: string | null;
130
+ manager?: ComponentsManager | null;
131
+ components?: Record<string, unknown>;
132
+ }
133
+ declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react_jsx_runtime.JSX.Element;
134
+
135
+ /**
136
+ * Core UI Types
137
+ */
138
+
139
+ /**
140
+ * Font definition
141
+ */
142
+ interface Font {
143
+ name: string;
144
+ }
145
+ /**
146
+ * Tracking variables
147
+ */
148
+ type TrackingVariables = Record<string, unknown>;
149
+
150
+ /**
151
+ * Form Types
152
+ * TypeScript interfaces for form-related components
153
+ */
154
+
155
+ /**
156
+ * Field definition
157
+ */
158
+ interface Field {
159
+ name?: string;
160
+ type?: string;
161
+ component?: string;
162
+ label?: ReactNode;
163
+ }
164
+
165
+ /**
166
+ * Resource Types
167
+ * TypeScript interfaces for resources, items, users, media, and other entities
168
+ */
169
+
170
+ interface ResourceIntlValues {
171
+ a_singular?: string;
172
+ a_plural?: string;
173
+ [key: string]: unknown;
174
+ }
175
+ /**
176
+ * Internationalization configuration
177
+ */
178
+ interface ResourceIntl {
179
+ messages?: Record<string, string>;
180
+ values?: ResourceIntlValues;
181
+ }
182
+ /**
183
+ * Resource definition
184
+ */
185
+ interface Resource {
186
+ id: string;
187
+ name: string;
188
+ intl?: ResourceIntl;
189
+ fields?: Field[];
190
+ forms?: Record<string, unknown>;
191
+ shows_in_navbar?: boolean;
192
+ settings?: Record<string, unknown>;
193
+ }
194
+
195
+ /**
196
+ * Panneau Definition Types
197
+ * TypeScript interfaces for main Panneau configuration and definitions
198
+ */
199
+
200
+ /**
201
+ * Panneau route configuration
202
+ */
203
+ interface Routes {
204
+ 'resources.index': string;
205
+ 'resources.create': string;
206
+ 'resources.store': string;
207
+ 'resources.show': string;
208
+ 'resources.edit': string;
209
+ 'resources.update': string;
210
+ 'resources.delete': string;
211
+ 'resources.destroy': string;
212
+ 'resources.duplicate': string;
213
+ 'resources.clone': string;
214
+ 'resources.restore': string;
215
+ [key: string]: string;
216
+ }
217
+ /**
218
+ * Page definition
219
+ */
220
+ interface Page {
221
+ component: string;
222
+ [key: string]: unknown;
223
+ }
224
+ interface PanneauTheme {
225
+ colorScheme?: string | null;
226
+ [key: string]: unknown;
227
+ }
228
+ interface PanneauComponents {
229
+ [key: string]: string | {
230
+ component: string;
231
+ [key: string]: unknown;
232
+ };
233
+ }
234
+ interface PanneauIntlValues {
235
+ [key: string]: string;
236
+ }
237
+ interface PanneauIntl {
238
+ locale?: string;
239
+ locales?: string[];
240
+ messages?: Record<string, string>;
241
+ values?: PanneauIntlValues;
242
+ }
243
+ /**
244
+ * Panneau definition (main configuration)
245
+ */
246
+ interface PanneauDefinition {
247
+ name?: string;
248
+ resources?: Resource[];
249
+ routes?: Routes;
250
+ pages?: Record<string, Page>;
251
+ intl?: PanneauIntl;
252
+ theme?: PanneauTheme;
253
+ components?: PanneauComponents;
254
+ settings?: Record<string, unknown>;
255
+ }
256
+ /**
257
+ * Generic definition
258
+ */
259
+ interface Definition {
260
+ name?: string;
261
+ [key: string]: unknown;
262
+ }
263
+
264
+ declare function useDefinitionContext(): Definition | null;
265
+ declare function useDefinition(): Definition | null;
266
+ interface DefinitionProviderProps {
267
+ definition: Definition;
268
+ children: ReactNode;
269
+ }
270
+ declare function DefinitionProvider({ definition, children }: DefinitionProviderProps): react_jsx_runtime.JSX.Element;
271
+
272
+ declare const FieldsContext: react.Context<FieldsManager>;
273
+ declare function useFieldsManager(): FieldsManager | null;
274
+ declare function useField(id: string): Field | null;
275
+ declare function useFields(): Field[];
276
+ interface FieldsProviderProps {
277
+ fields?: Field[] | null;
278
+ manager?: FieldsManager | null;
279
+ children: ReactNode;
280
+ }
281
+ declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react_jsx_runtime.JSX.Element;
282
+
283
+ interface FontsContextValue {
284
+ systemFonts: Font[] | null;
285
+ googleFonts: Font[] | null;
286
+ customFonts: Font[] | null;
287
+ setGoogleFonts?: ((fonts: Font[]) => void) | null;
288
+ }
289
+ declare const FontsContext: react.Context<FontsContextValue>;
290
+ declare function useGoogleFonts({ disabled, setFonts, }?: {
291
+ disabled?: boolean;
292
+ setFonts?: ((fonts: Font[]) => void) | null;
293
+ }): Font[] | null;
294
+ declare function useFonts({ withoutGoogleFonts, }?: {
295
+ withoutGoogleFonts?: boolean;
296
+ }): FontsContextValue;
297
+ interface FontsProviderProps {
298
+ children: ReactNode;
299
+ systemFonts?: (Font | string)[] | null;
300
+ customFonts?: (Font | string)[] | null;
301
+ }
302
+ declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): react_jsx_runtime.JSX.Element;
303
+
304
+ interface FormContextValue {
305
+ value: Record<string, unknown>;
306
+ setValue: (value: Record<string, unknown>) => void;
307
+ }
308
+ declare function useFormContext(): FormContextValue | null;
309
+ declare function useFormValue(): Record<string, unknown>;
310
+ declare function useFormSetValue(): (value: Record<string, unknown>) => void;
311
+ interface FormProviderProps {
312
+ value: Record<string, unknown>;
313
+ setValue: (value: Record<string, unknown>) => void;
314
+ children: ReactNode;
315
+ }
316
+ declare function FormProvider({ value, setValue, children }: FormProviderProps): react_jsx_runtime.JSX.Element;
317
+
318
+ declare const GoogleApiClientContext: react.Context<any>;
319
+ declare function useGoogleApiClient(): any | null;
320
+ declare function withGoogleApiClient(WrappedComponent: ComponentType<any>): {
321
+ (props: any): react_jsx_runtime.JSX.Element;
322
+ displayName: string;
323
+ };
324
+ interface GoogleApiClientProviderProps {
325
+ children: ReactNode;
326
+ }
327
+ declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): react_jsx_runtime.JSX.Element;
328
+
329
+ interface GoogleKeysContextValue {
330
+ apiKey: string | null;
331
+ }
332
+ declare const GoogleKeysContext: react.Context<GoogleKeysContextValue>;
333
+ declare function useGoogleKeys(): GoogleKeysContextValue;
334
+ interface GoogleKeysProviderProps {
335
+ children: ReactNode;
336
+ apiKey?: string | null;
337
+ }
338
+ declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): react_jsx_runtime.JSX.Element;
339
+
340
+ declare const GoogleMapsClientContext: react.Context<any>;
341
+ declare function useGoogleMapsClient(): any | null;
342
+ declare function withGoogleMapsClient(WrappedComponent: ComponentType<any>): {
343
+ (props: any): react_jsx_runtime.JSX.Element;
344
+ displayName: string;
345
+ };
346
+ interface GoogleMapsClientProviderProps {
347
+ children: ReactNode;
348
+ locale?: string;
349
+ libraries?: string[] | null;
350
+ }
351
+ declare function GoogleMapsClientProvider({ children, locale, libraries, }: GoogleMapsClientProviderProps): react_jsx_runtime.JSX.Element;
352
+
353
+ interface LocalesContextValue {
354
+ locales: string[];
355
+ }
356
+ declare const LocalesContext: react.Context<LocalesContextValue>;
357
+ declare function useLocalesContext(): LocalesContextValue;
358
+ declare function useLocales(): string[];
359
+ declare function useOtherLocales(): string[];
360
+ interface LocalesProviderProps {
361
+ locales?: string[];
362
+ children: ReactNode;
363
+ }
364
+ declare function LocalesProvider({ locales, children }: LocalesProviderProps): react_jsx_runtime.JSX.Element;
365
+
366
+ interface ModalData {
367
+ id: string;
368
+ onClose?: (() => void) | null;
369
+ [key: string]: unknown;
370
+ }
371
+ interface ModalContextValue {
372
+ modals: ModalData[];
373
+ container: unknown | null;
374
+ setContainer: (container: unknown) => void;
375
+ register: (id: string, data?: Record<string, unknown> | null) => void;
376
+ unregister: (id?: string | null, data?: Record<string, unknown> | null) => void;
377
+ closeLastModal: () => void;
378
+ getModalById: (modalId: string) => ModalData | null;
379
+ }
380
+ declare const ModalContext: react.Context<ModalContextValue>;
381
+ declare function useModal(): ModalContextValue;
382
+ interface ModalProviderProps {
383
+ children: ReactNode;
384
+ container?: unknown | null;
385
+ }
386
+ declare function ModalProvider({ children, container: initialContainer }: ModalProviderProps): react_jsx_runtime.JSX.Element;
387
+
388
+ interface PanelData {
389
+ id: string;
390
+ [key: string]: unknown;
391
+ }
392
+ interface PanelsContextValue {
393
+ panels: PanelData[];
394
+ container: unknown | null;
395
+ setContainer: (container: unknown) => void;
396
+ register: (id: string, data?: Record<string, unknown> | null) => void;
397
+ unregister: (id: string) => void;
398
+ }
399
+ declare const PanelsContext: react.Context<PanelsContextValue>;
400
+ declare function usePanels(): PanelsContextValue;
401
+ declare function withPanels(WrappedComponent: ComponentType<any>): {
402
+ (props: any): react_jsx_runtime.JSX.Element;
403
+ displayName: string;
404
+ };
405
+ interface PanelsProviderProps {
406
+ children: ReactNode;
407
+ container?: unknown | null;
408
+ }
409
+ declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): react_jsx_runtime.JSX.Element;
410
+
411
+ declare function usePanneau(): PanneauDefinition | null;
412
+ declare function usePanneauResources(): Resource[];
413
+ declare function usePanneauResource(id: string): Resource | null;
414
+ declare function usePanneauColorScheme(): {
415
+ theme: string;
416
+ background: string | null;
417
+ text: string | null;
418
+ sidebarPosition?: string | null;
419
+ };
420
+ declare function usePanneauComponents(): Record<string, unknown>;
421
+ declare function usePanneauComponent(namespace: string | null, name: string): string | null;
422
+ declare function usePanneauAuth(): Record<string, unknown>;
423
+ declare function usePanneauSettings(): Record<string, unknown>;
424
+ interface PanneauProviderProps {
425
+ definition: PanneauDefinition;
426
+ children: ReactNode;
427
+ }
428
+ declare function PanneauProvider({ definition, children }: PanneauProviderProps): react_jsx_runtime.JSX.Element;
429
+
430
+ declare function useResource(): Resource | null;
431
+ interface ResourceProviderProps {
432
+ resource: Resource;
433
+ children: ReactNode;
434
+ }
435
+ declare function ResourceProvider({ resource, children }: ResourceProviderProps): react_jsx_runtime.JSX.Element;
436
+
437
+ declare function useRoutePush(): (route: string | {
438
+ pathname?: string | null;
439
+ search?: string | null;
440
+ }, data?: unknown, ...args: unknown[]) => void;
441
+ declare function useRouteBack(): () => void;
442
+
443
+ declare function useTracking(): any;
444
+ interface TrackingProviderProps {
445
+ children: ReactNode;
446
+ variables?: TrackingVariables | null;
447
+ }
448
+ declare function TrackingProvider({ variables, children }: TrackingProviderProps): react_jsx_runtime.JSX.Element;
449
+
450
+ export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };