@panneau/medias 4.0.50 → 4.0.56

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 (3) hide show
  1. package/dist/index.d.ts +49 -63
  2. package/dist/index.js +879 -438
  3. package/package.json +20 -17
package/dist/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as _panneau_core from '@panneau/core';
4
- import { Media, Resource } from '@panneau/core';
4
+ import { Media, Field, MediaType, Filter, Column, Resource } from '@panneau/core';
5
5
  import * as _panneau_data from '@panneau/data';
6
6
  import { UseItemsResponse } from '@panneau/data';
7
7
  import * as _tanstack_query_core from '@tanstack/query-core';
8
8
 
9
- type MediaFormField = Record<string, unknown>;
10
9
  interface MediaFormProps {
11
10
  value?: Media | null;
12
- fields?: MediaFormField[] | null;
11
+ fields?: Field[] | null;
13
12
  onChange?: ((newValue: Media | null) => void) | null;
14
13
  onSave?: ((newValue: Media | null) => void) | null;
15
14
  onReplace?: ((newValue: unknown) => void) | null;
@@ -21,22 +20,8 @@ interface MediaFormProps {
21
20
  className?: string | null;
22
21
  children?: ReactNode | null;
23
22
  }
24
- declare function MediaForm({ value: initialValue, fields: initialFields, onChange, onSave, onReplace, onDelete, onClose, withDelete, withTrash, withReplace, className, children, }: MediaFormProps): react_jsx_runtime.JSX.Element;
23
+ declare function MediaForm({ value: initialValue, fields: initialFields, onChange, onSave, onReplace, onDelete, onClose, withDelete, withTrash, withReplace, className, children, }: MediaFormProps): react.JSX.Element;
25
24
 
26
- type FilterItem = Record<string, unknown> & {
27
- id?: string | null;
28
- };
29
- type ColumnAction = string | {
30
- id?: string;
31
- component?: string;
32
- withConfirmation?: boolean;
33
- action?: (ids: Array<string | number>) => Promise<unknown> | unknown;
34
- [key: string]: unknown;
35
- };
36
- type ColumnItem = Record<string, unknown> & {
37
- id?: string | null;
38
- actions?: ColumnAction[];
39
- };
40
25
  interface LayoutItem {
41
26
  id: string;
42
27
  label: ReactNode;
@@ -45,17 +30,17 @@ interface LayoutItem {
45
30
  interface MediasBrowserProps {
46
31
  items?: Media[] | null;
47
32
  extraItems?: Media[] | null;
48
- types?: string[] | null;
33
+ types?: MediaType[] | null;
49
34
  permissions?: {
50
35
  create?: boolean;
51
36
  edit?: boolean;
52
37
  delete?: boolean;
53
38
  } | null;
54
- filters?: FilterItem[] | null;
55
- columns?: ColumnItem[] | null;
39
+ filters?: Filter[] | null;
40
+ columns?: Column[] | null;
56
41
  query?: Record<string, unknown> | null;
57
42
  baseUrl?: string | null;
58
- fields?: Array<Record<string, unknown>> | null;
43
+ fields?: Field[] | null;
59
44
  layout?: string;
60
45
  layouts?: LayoutItem[] | null;
61
46
  theme?: string | null;
@@ -75,19 +60,18 @@ interface MediasBrowserProps {
75
60
  withStickySelection?: boolean;
76
61
  withoutUpload?: boolean;
77
62
  className?: string | null;
63
+ filtersClassName?: string | null;
78
64
  formChildren?: ReactNode | null;
79
65
  }
80
- declare function MediasBrowser({ items: initialItems, extraItems, types, permissions, baseUrl, filters, columns, fields, query: initialQuery, layout: initialLayout, layouts, theme, onMediaUploaded, onItemsChange, onLayoutChange, onMediaFormOpen, onMediaFormClose, selectable, selectedItems, onSelectionChange, multipleSelection, uppyConfig, withDelete, withTrash, withReplace, withStickySelection, withoutUpload, className, formChildren, }: MediasBrowserProps): react_jsx_runtime.JSX.Element;
66
+ declare function MediasBrowser({ items: initialItems, extraItems, types, permissions, baseUrl, filters, columns, fields, query: initialQuery, layout: initialLayout, layouts, theme, onMediaUploaded, onItemsChange, onLayoutChange, onMediaFormOpen, onMediaFormClose, selectable, selectedItems, onSelectionChange, multipleSelection, uppyConfig, withDelete, withTrash, withReplace, withStickySelection, withoutUpload, className, filtersClassName, formChildren, }: MediasBrowserProps): react.JSX.Element;
81
67
 
82
- interface MediasPickerProps {
68
+ interface MediasPickerProps extends MediasBrowserProps {
83
69
  items?: Media[] | null;
84
70
  value?: Media[] | null;
85
71
  onChange?: ((selection: Media[] | null) => void) | null;
86
72
  multiple?: boolean;
87
- className?: string | null;
88
- [key: string]: unknown;
89
73
  }
90
- declare function MediasPicker({ items: initialItems, value: initialSelectedItems, onChange, multiple, className, ...props }: MediasPickerProps): react_jsx_runtime.JSX.Element;
74
+ declare function MediasPicker({ items: initialItems, value: initialSelectedItems, onChange, multiple, ...props }: MediasPickerProps): react.JSX.Element;
91
75
 
92
76
  interface MediasApi {
93
77
  get: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<UseItemsResponse<Media>>;
@@ -104,22 +88,19 @@ interface MediasApiProviderProps {
104
88
  children: ReactNode;
105
89
  }
106
90
  declare function useMediasApi(): MediasApi;
107
- declare function MediasApiProvider({ api: providedApi, children }: MediasApiProviderProps): react_jsx_runtime.JSX.Element;
91
+ declare function MediasApiProvider({ api: providedApi, children }: MediasApiProviderProps): react.JSX.Element;
108
92
 
109
- interface MediasBrowserContainerProps {
93
+ interface MediasBrowserContainerProps extends MediasBrowserProps {
110
94
  api?: MediasApi | null;
111
95
  media?: Media | null;
112
- [key: string]: unknown;
113
96
  }
114
- declare function MediasBrowserContainer({ api, media, ...props }: MediasBrowserContainerProps): react_jsx_runtime.JSX.Element;
97
+ declare function MediasBrowserContainer({ api, media, ...props }: MediasBrowserContainerProps): react.JSX.Element;
115
98
 
116
- interface MediasPickerContainerProps {
99
+ interface MediasPickerContainerProps extends MediasPickerProps {
117
100
  api?: MediasApi | null;
118
101
  media?: Media | null;
119
- onChange?: ((...args: unknown[]) => void) | null;
120
- [key: string]: unknown;
121
102
  }
122
- declare function MediasPickerContainer({ api, media, onChange, ...props }: MediasPickerContainerProps): react_jsx_runtime.JSX.Element;
103
+ declare function MediasPickerContainer({ api, media, ...props }: MediasPickerContainerProps): react.JSX.Element;
123
104
 
124
105
  interface MediaContextValue {
125
106
  currentMedia: Media | null;
@@ -130,7 +111,7 @@ interface MediaProviderProps {
130
111
  children: ReactNode;
131
112
  }
132
113
  declare function useCurrentMedia(): MediaContextValue;
133
- declare function MediaProvider({ media: providedMedia, children }: MediaProviderProps): react_jsx_runtime.JSX.Element;
114
+ declare function MediaProvider({ media: providedMedia, children }: MediaProviderProps): react.JSX.Element;
134
115
 
135
116
  interface UseMediasOpts {
136
117
  trashed?: boolean;
@@ -138,6 +119,7 @@ interface UseMediasOpts {
138
119
  }
139
120
  declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMediasOpts): {
140
121
  allItems: _panneau_core.Media[];
122
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
141
123
  pagination: {
142
124
  page: number;
143
125
  lastPage: number;
@@ -176,6 +158,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
176
158
  items: _panneau_core.Media[];
177
159
  } | {
178
160
  allItems: _panneau_core.Media[];
161
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
179
162
  pagination: {
180
163
  page: number;
181
164
  lastPage: number;
@@ -214,6 +197,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
214
197
  items: _panneau_core.Media[];
215
198
  } | {
216
199
  allItems: _panneau_core.Media[];
200
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
217
201
  pagination: {
218
202
  page: number;
219
203
  lastPage: number;
@@ -252,6 +236,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
252
236
  items: _panneau_core.Media[];
253
237
  } | {
254
238
  allItems: _panneau_core.Media[];
239
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
255
240
  pagination: {
256
241
  page: number;
257
242
  lastPage: number;
@@ -290,6 +275,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
290
275
  items: _panneau_core.Media[];
291
276
  } | {
292
277
  allItems: _panneau_core.Media[];
278
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
293
279
  pagination: {
294
280
  page: number;
295
281
  lastPage: number;
@@ -328,6 +314,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
328
314
  items: _panneau_core.Media[];
329
315
  } | {
330
316
  allItems: _panneau_core.Media[];
317
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
331
318
  pagination: {
332
319
  page: number;
333
320
  lastPage: number;
@@ -389,9 +376,9 @@ declare function useMedia(id: string, opts: any): {
389
376
  isRefetching: boolean;
390
377
  isStale: boolean;
391
378
  isEnabled: boolean;
392
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<Media, Error>>;
379
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<Media>, Error>>;
393
380
  fetchStatus: _tanstack_query_core.FetchStatus;
394
- promise: Promise<Media>;
381
+ promise: Promise<NoInfer<Media>>;
395
382
  media: Media;
396
383
  } | {
397
384
  error: null;
@@ -416,9 +403,9 @@ declare function useMedia(id: string, opts: any): {
416
403
  isRefetching: boolean;
417
404
  isStale: boolean;
418
405
  isEnabled: boolean;
419
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<Media, Error>>;
406
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<Media>, Error>>;
420
407
  fetchStatus: _tanstack_query_core.FetchStatus;
421
- promise: Promise<Media>;
408
+ promise: Promise<NoInfer<Media>>;
422
409
  media: Media;
423
410
  };
424
411
 
@@ -454,7 +441,7 @@ declare function useMediaReplace(): {
454
441
 
455
442
  declare const _default$2: ({
456
443
  id: string;
457
- label: react_jsx_runtime.JSX.Element;
444
+ label: react.JSX.Element;
458
445
  component: string;
459
446
  path: string;
460
447
  sortable: boolean;
@@ -464,22 +451,22 @@ declare const _default$2: ({
464
451
  actions?: undefined;
465
452
  } | {
466
453
  id: string;
467
- label: react_jsx_runtime.JSX.Element;
454
+ label: react.JSX.Element;
468
455
  component: string;
469
456
  path: string;
470
457
  descriptionPath: string;
471
458
  descriptionValues: {
472
- image: react_jsx_runtime.JSX.Element;
473
- video: react_jsx_runtime.JSX.Element;
474
- audio: react_jsx_runtime.JSX.Element;
475
- document: react_jsx_runtime.JSX.Element;
459
+ image: react.JSX.Element;
460
+ video: react.JSX.Element;
461
+ audio: react.JSX.Element;
462
+ document: react.JSX.Element;
476
463
  };
477
464
  sortable: boolean;
478
465
  format?: undefined;
479
466
  actions?: undefined;
480
467
  } | {
481
468
  id: string;
482
- label: react_jsx_runtime.JSX.Element;
469
+ label: react.JSX.Element;
483
470
  component: string;
484
471
  format: string;
485
472
  path: string;
@@ -489,7 +476,7 @@ declare const _default$2: ({
489
476
  actions?: undefined;
490
477
  } | {
491
478
  id: string;
492
- label: react_jsx_runtime.JSX.Element;
479
+ label: react.JSX.Element;
493
480
  component: string;
494
481
  path: string;
495
482
  format: string;
@@ -499,7 +486,7 @@ declare const _default$2: ({
499
486
  actions?: undefined;
500
487
  } | {
501
488
  id: string;
502
- label: react_jsx_runtime.JSX.Element;
489
+ label: react.JSX.Element;
503
490
  actions: string[];
504
491
  component?: undefined;
505
492
  path?: undefined;
@@ -511,7 +498,7 @@ declare const _default$2: ({
511
498
 
512
499
  declare const _default$1: ({
513
500
  name: string;
514
- label: react_jsx_runtime.JSX.Element;
501
+ label: react.JSX.Element;
515
502
  type: string;
516
503
  component: string;
517
504
  id?: undefined;
@@ -521,12 +508,12 @@ declare const _default$1: ({
521
508
  } | {
522
509
  id: string;
523
510
  component: string;
524
- label: react_jsx_runtime.JSX.Element;
511
+ label: react.JSX.Element;
525
512
  isList: boolean;
526
513
  hideWithoutValue: boolean;
527
514
  fields: ({
528
515
  id: string;
529
- label: react_jsx_runtime.JSX.Element;
516
+ label: react.JSX.Element;
530
517
  type: string;
531
518
  display: string;
532
519
  name: string;
@@ -534,7 +521,7 @@ declare const _default$1: ({
534
521
  format?: undefined;
535
522
  } | {
536
523
  id: string;
537
- label: react_jsx_runtime.JSX.Element;
524
+ label: react.JSX.Element;
538
525
  type: string;
539
526
  display: string;
540
527
  name: string;
@@ -557,26 +544,25 @@ declare const _default: ({
557
544
  id: string;
558
545
  component: string;
559
546
  name: string;
560
- placeholder: react_jsx_runtime.JSX.Element;
547
+ placeholder: react.JSX.Element;
561
548
  options: {
562
- label: react_jsx_runtime.JSX.Element;
549
+ label: react.JSX.Element;
563
550
  value: string;
564
551
  }[];
565
552
  multiple: boolean;
566
553
  width?: undefined;
567
554
  })[];
568
555
 
569
- interface MediasResourceBrowserProps {
570
- resource?: string | null;
571
- [key: string]: unknown;
556
+ interface MediasResourceBrowserProps extends MediasBrowserContainerProps {
557
+ resource?: Resource | string | null;
572
558
  }
573
- declare function MediasResourceBrowser({ resource: resourceId, ...props }: MediasResourceBrowserProps): react_jsx_runtime.JSX.Element;
559
+ declare function MediasResourceBrowser({ resource: resourceId, ...props }: MediasResourceBrowserProps): react.JSX.Element;
574
560
 
575
- interface MediasResourcePickerProps {
561
+ interface MediasResourcePickerProps extends MediasPickerContainerProps {
576
562
  resource?: Resource | string | null;
577
563
  [key: string]: unknown;
578
564
  }
579
- declare function MediasResourcePicker({ resource: resourceId, ...props }: MediasResourcePickerProps): react_jsx_runtime.JSX.Element;
565
+ declare function MediasResourcePicker({ resource: resourceId, ...props }: MediasResourcePickerProps): react.JSX.Element;
580
566
 
581
567
  export { MediaForm, MediaProvider, MediasApiProvider, MediasBrowser, MediasBrowserContainer, MediasPicker, MediasPickerContainer, MediasResourceBrowser, MediasResourcePicker, _default$2 as columns, _default$1 as fields, _default as filters, useCurrentMedia, useMedia, useMediaCreate, useMediaDelete, useMediaReplace, useMediaRestore, useMediaTrash, useMediaUpdate, useMedias, useMediasApi };
582
- export type { MediaContextValue, MediasApi };
568
+ export type { MediaContextValue, MediasApi, MediasBrowserContainerProps, MediasBrowserProps, MediasPickerContainerProps, MediasPickerProps };