@panneau/medias 4.0.2 → 4.0.4

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 (2) hide show
  1. package/es/index.js +327 -293
  2. package/package.json +17 -17
package/es/index.js CHANGED
@@ -12,6 +12,7 @@ import FormStatus from '@panneau/element-form-status';
12
12
  import UploadField from '@panneau/field-upload';
13
13
  import ImageDisplay from '@panneau/display-image';
14
14
  import MediaPlayer from '@panneau/element-media-player';
15
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
16
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
16
17
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
17
18
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
@@ -54,9 +55,10 @@ function MediasApiProvider(_ref) {
54
55
  var api = useMemo(function () {
55
56
  return providedApi || previousApi;
56
57
  }, [providedApi, previousApi]);
57
- return /*#__PURE__*/React.createElement(MediasApiContext.Provider, {
58
- value: api
59
- }, children);
58
+ return /*#__PURE__*/jsx(MediasApiContext.Provider, {
59
+ value: api,
60
+ children: children
61
+ });
60
62
  }
61
63
  MediasApiProvider.propTypes = propTypes$9;
62
64
 
@@ -251,25 +253,26 @@ function MediaFrame(_ref) {
251
253
  var onClick = useCallback(function () {
252
254
  setShowPlayer(!showPlayer);
253
255
  }, [showPlayer, setShowPlayer]);
254
- return /*#__PURE__*/React.createElement("div", {
255
- className: classNames([styles.mediaFrame, 'position-relative', 'd-flex', 'flex-grow-1', 'w-100', 'mw-100', _defineProperty({}, className, className != null)])
256
- }, showPlayer && type !== 'image' ? /*#__PURE__*/React.createElement(MediaPlayer, {
257
- value: value,
258
- autoPlay: false,
259
- width: "100%"
260
- }) : /*#__PURE__*/React.createElement(ImageDisplay, {
261
- className: "w-100",
262
- value: value,
263
- maxWidth: "100%",
264
- maxHeight: "100%",
265
- onClick: type === 'video' || type === 'audio' ? onClick : null
266
- }));
256
+ return /*#__PURE__*/jsx("div", {
257
+ className: classNames([styles.mediaFrame, 'position-relative', 'd-flex', 'flex-grow-1', 'w-100', 'mw-100', _defineProperty({}, className, className != null)]),
258
+ children: showPlayer && type !== 'image' ? /*#__PURE__*/jsx(MediaPlayer, {
259
+ value: value,
260
+ autoPlay: false,
261
+ width: "100%"
262
+ }) : /*#__PURE__*/jsx(ImageDisplay, {
263
+ className: "w-100",
264
+ value: value,
265
+ maxWidth: "100%",
266
+ maxHeight: "100%",
267
+ onClick: type === 'video' || type === 'audio' ? onClick : null
268
+ })
269
+ });
267
270
  }
268
271
  MediaFrame.propTypes = propTypes$8;
269
272
 
270
273
  var defaultFields = [{
271
274
  name: 'name',
272
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
275
+ label: /*#__PURE__*/jsx(FormattedMessage, {
273
276
  id: "WX83V9",
274
277
  defaultMessage: [{
275
278
  "type": 0,
@@ -280,7 +283,7 @@ var defaultFields = [{
280
283
  component: 'text'
281
284
  }, {
282
285
  name: 'description',
283
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
286
+ label: /*#__PURE__*/jsx(FormattedMessage, {
284
287
  id: "ygNvmz",
285
288
  defaultMessage: [{
286
289
  "type": 0,
@@ -307,7 +310,7 @@ var defaultFields = [{
307
310
  {
308
311
  id: 'info',
309
312
  component: 'fields',
310
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
313
+ label: /*#__PURE__*/jsx(FormattedMessage, {
311
314
  id: "3RT69u",
312
315
  defaultMessage: [{
313
316
  "type": 0,
@@ -318,7 +321,7 @@ var defaultFields = [{
318
321
  hideWithoutValue: true,
319
322
  fields: [{
320
323
  id: 'user',
321
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
324
+ label: /*#__PURE__*/jsx(FormattedMessage, {
322
325
  id: "yByaBh",
323
326
  defaultMessage: [{
324
327
  "type": 0,
@@ -331,7 +334,7 @@ var defaultFields = [{
331
334
  horizontal: true
332
335
  }, {
333
336
  id: 'created_at',
334
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
337
+ label: /*#__PURE__*/jsx(FormattedMessage, {
335
338
  id: "PN+75e",
336
339
  defaultMessage: [{
337
340
  "type": 0,
@@ -347,7 +350,7 @@ var defaultFields = [{
347
350
  }, {
348
351
  id: 'technical',
349
352
  component: 'fields',
350
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
353
+ label: /*#__PURE__*/jsx(FormattedMessage, {
351
354
  id: "xKUOLG",
352
355
  defaultMessage: [{
353
356
  "type": 0,
@@ -358,7 +361,7 @@ var defaultFields = [{
358
361
  hideWithoutValue: true,
359
362
  fields: [{
360
363
  id: 'format',
361
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
364
+ label: /*#__PURE__*/jsx(FormattedMessage, {
362
365
  id: "JuxiUN",
363
366
  defaultMessage: [{
364
367
  "type": 0,
@@ -372,7 +375,7 @@ var defaultFields = [{
372
375
  horizontal: true
373
376
  }, {
374
377
  id: 'dimensions',
375
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
378
+ label: /*#__PURE__*/jsx(FormattedMessage, {
376
379
  id: "rmJBin",
377
380
  defaultMessage: [{
378
381
  "type": 0,
@@ -386,7 +389,7 @@ var defaultFields = [{
386
389
  horizontal: true
387
390
  }, {
388
391
  id: 'size',
389
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
392
+ label: /*#__PURE__*/jsx(FormattedMessage, {
390
393
  id: "g2CRt5",
391
394
  defaultMessage: [{
392
395
  "type": 0,
@@ -400,7 +403,7 @@ var defaultFields = [{
400
403
  horizontal: true
401
404
  }, {
402
405
  id: 'duration',
403
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
406
+ label: /*#__PURE__*/jsx(FormattedMessage, {
404
407
  id: "wU++NJ",
405
408
  defaultMessage: [{
406
409
  "type": 0,
@@ -545,107 +548,124 @@ function MediaForm(_ref) {
545
548
  onSubmit = _useForm.onSubmit,
546
549
  status = _useForm.status,
547
550
  generalError = _useForm.generalError;
548
- return /*#__PURE__*/React.createElement("div", {
549
- className: classNames(['text-body', _defineProperty({}, className, className !== null)])
550
- }, /*#__PURE__*/React.createElement("nav", {
551
- className: "navbar d-flex w-100 align-items-end justify-content-between border-bottom mb-3"
552
- }, /*#__PURE__*/React.createElement("div", {
553
- className: "d-flex align-items-end justify-content-start mb-1",
554
- style: {
555
- maxWidth: '66%'
556
- }
557
- }, /*#__PURE__*/React.createElement("div", {
558
- className: "me-3 mb-0"
559
- }, /*#__PURE__*/React.createElement(Button, {
560
- theme: "secondary",
561
- outline: true,
562
- onClick: onClose,
563
- icon: "arrow-left"
564
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
565
- id: "8NyYTH",
566
- defaultMessage: [{
567
- "type": 0,
568
- "value": "Back"
569
- }]
570
- }))), /*#__PURE__*/React.createElement("h4", {
571
- className: "d-inline text-truncate mb-0"
572
- }, name), /*#__PURE__*/React.createElement("span", {
573
- className: "mx-2"
574
- }, type)), /*#__PURE__*/React.createElement("div", {
575
- className: classNames('d-flex', 'justify-content-between', 'align-items-center', 'gap-1')
576
- }, withReplace ? /*#__PURE__*/React.createElement(UploadField, {
577
- className: "w-auto text-nowrap",
578
- withButton: true,
579
- withoutMedia: true,
580
- types: [type],
581
- outline: false,
582
- closeAfterFinish: true,
583
- disabled: deleting || trashing || updating || replacing,
584
- addButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
585
- id: "GxOBVL",
586
- defaultMessage: [{
587
- "type": 0,
588
- "value": "Replace"
589
- }]
590
- }),
591
- onChange: onUploadComplete
592
- }) : null, withDelete ? /*#__PURE__*/React.createElement(Button, {
593
- className: "me-2 mb-1 mt-1",
594
- theme: "danger",
595
- icon: withTrash && deletedAt !== null ? 'trash-fill' : 'trash',
596
- iconPosition: "right",
597
- onClick: onDeleteMedia,
598
- disabled: deleting || trashing || updating || replacing
599
- }, withTrash && deletedAt === null ? /*#__PURE__*/React.createElement(FormattedMessage, {
600
- id: "PSlT7H",
601
- defaultMessage: [{
602
- "type": 0,
603
- "value": "Trash"
604
- }]
605
- }) : /*#__PURE__*/React.createElement(FormattedMessage, {
606
- id: "Bhu3B2",
607
- defaultMessage: [{
608
- "type": 0,
609
- "value": "Delete"
610
- }]
611
- })) : null, onSave !== null ? /*#__PURE__*/React.createElement(Button, {
612
- className: "mb-1 mt-1",
613
- theme: "primary",
614
- icon: changed ? 'check' : 'check',
615
- iconPosition: "right",
616
- onClick: onSubmit,
617
- disabled: !changed || updating || deleting || trashing
618
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
619
- id: "R1HYj0",
620
- defaultMessage: [{
621
- "type": 0,
622
- "value": "Save"
623
- }]
624
- })) : null)), /*#__PURE__*/React.createElement("div", {
625
- className: "row"
626
- }, /*#__PURE__*/React.createElement("div", {
627
- className: "col-md-6"
628
- }, /*#__PURE__*/React.createElement("div", {
629
- className: "position-relative w-100"
630
- }, /*#__PURE__*/React.createElement("div", {
631
- className: styles.mediaFrame
632
- }, /*#__PURE__*/React.createElement(MediaFrame, {
633
- value: value
634
- }))), children), /*#__PURE__*/React.createElement("div", {
635
- className: "col-md-6"
636
- }, /*#__PURE__*/React.createElement(Form, {
637
- onChange: onChangeMedia,
638
- withoutActions: true
639
- }, /*#__PURE__*/React.createElement(FieldsComponent, {
640
- fields: fields,
641
- value: value,
642
- onChange: setValue,
643
- disabled: disabled
644
- })), generalError !== null && status !== null ? /*#__PURE__*/React.createElement("div", {
645
- className: "mt-5"
646
- }, /*#__PURE__*/React.createElement(FormStatus, {
647
- status: status
648
- })) : null)));
551
+ return /*#__PURE__*/jsxs("div", {
552
+ className: classNames(['text-body', _defineProperty({}, className, className !== null)]),
553
+ children: [/*#__PURE__*/jsxs("nav", {
554
+ className: "navbar d-flex w-100 align-items-end justify-content-between border-bottom mb-3",
555
+ children: [/*#__PURE__*/jsxs("div", {
556
+ className: "d-flex align-items-end justify-content-start mb-1",
557
+ style: {
558
+ maxWidth: '66%'
559
+ },
560
+ children: [/*#__PURE__*/jsx("div", {
561
+ className: "me-3 mb-0",
562
+ children: /*#__PURE__*/jsx(Button, {
563
+ theme: "secondary",
564
+ outline: true,
565
+ onClick: onClose,
566
+ icon: "arrow-left",
567
+ children: /*#__PURE__*/jsx(FormattedMessage, {
568
+ id: "8NyYTH",
569
+ defaultMessage: [{
570
+ "type": 0,
571
+ "value": "Back"
572
+ }]
573
+ })
574
+ })
575
+ }), /*#__PURE__*/jsx("h4", {
576
+ className: "d-inline text-truncate mb-0",
577
+ children: name
578
+ }), /*#__PURE__*/jsx("span", {
579
+ className: "mx-2",
580
+ children: type
581
+ })]
582
+ }), /*#__PURE__*/jsxs("div", {
583
+ className: classNames('d-flex', 'justify-content-between', 'align-items-center', 'gap-1'),
584
+ children: [withReplace ? /*#__PURE__*/jsx(UploadField, {
585
+ className: "w-auto text-nowrap",
586
+ withButton: true,
587
+ withoutMedia: true,
588
+ types: [type],
589
+ outline: false,
590
+ closeAfterFinish: true,
591
+ disabled: deleting || trashing || updating || replacing,
592
+ addButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
593
+ id: "GxOBVL",
594
+ defaultMessage: [{
595
+ "type": 0,
596
+ "value": "Replace"
597
+ }]
598
+ }),
599
+ onChange: onUploadComplete
600
+ }) : null, withDelete ? /*#__PURE__*/jsx(Button, {
601
+ className: "me-2 mb-1 mt-1",
602
+ theme: "danger",
603
+ icon: withTrash && deletedAt !== null ? 'trash-fill' : 'trash',
604
+ iconPosition: "right",
605
+ onClick: onDeleteMedia,
606
+ disabled: deleting || trashing || updating || replacing,
607
+ children: withTrash && deletedAt === null ? /*#__PURE__*/jsx(FormattedMessage, {
608
+ id: "PSlT7H",
609
+ defaultMessage: [{
610
+ "type": 0,
611
+ "value": "Trash"
612
+ }]
613
+ }) : /*#__PURE__*/jsx(FormattedMessage, {
614
+ id: "Bhu3B2",
615
+ defaultMessage: [{
616
+ "type": 0,
617
+ "value": "Delete"
618
+ }]
619
+ })
620
+ }) : null, onSave !== null ? /*#__PURE__*/jsx(Button, {
621
+ className: "mb-1 mt-1",
622
+ theme: "primary",
623
+ icon: changed ? 'check' : 'check',
624
+ iconPosition: "right",
625
+ onClick: onSubmit,
626
+ disabled: !changed || updating || deleting || trashing,
627
+ children: /*#__PURE__*/jsx(FormattedMessage, {
628
+ id: "R1HYj0",
629
+ defaultMessage: [{
630
+ "type": 0,
631
+ "value": "Save"
632
+ }]
633
+ })
634
+ }) : null]
635
+ })]
636
+ }), /*#__PURE__*/jsxs("div", {
637
+ className: "row",
638
+ children: [/*#__PURE__*/jsxs("div", {
639
+ className: "col-md-6",
640
+ children: [/*#__PURE__*/jsx("div", {
641
+ className: "position-relative w-100",
642
+ children: /*#__PURE__*/jsx("div", {
643
+ className: styles.mediaFrame,
644
+ children: /*#__PURE__*/jsx(MediaFrame, {
645
+ value: value
646
+ })
647
+ })
648
+ }), children]
649
+ }), /*#__PURE__*/jsxs("div", {
650
+ className: "col-md-6",
651
+ children: [/*#__PURE__*/jsx(Form, {
652
+ onChange: onChangeMedia,
653
+ withoutActions: true,
654
+ children: /*#__PURE__*/jsx(FieldsComponent, {
655
+ fields: fields,
656
+ value: value,
657
+ onChange: setValue,
658
+ disabled: disabled
659
+ })
660
+ }), generalError !== null && status !== null ? /*#__PURE__*/jsx("div", {
661
+ className: "mt-5",
662
+ children: /*#__PURE__*/jsx(FormStatus, {
663
+ status: status
664
+ })
665
+ }) : null]
666
+ })]
667
+ })]
668
+ });
649
669
  }
650
670
  MediaForm.propTypes = propTypes$7;
651
671
 
@@ -673,15 +693,16 @@ function MediaProvider(_ref) {
673
693
  setCurrentMedia: setCurrentMedia
674
694
  };
675
695
  }, [currentMedia, setCurrentMedia]);
676
- return /*#__PURE__*/React.createElement(MediaContext.Provider, {
677
- value: values
678
- }, children);
696
+ return /*#__PURE__*/jsx(MediaContext.Provider, {
697
+ value: values,
698
+ children: children
699
+ });
679
700
  }
680
701
  MediaProvider.propTypes = propTypes$6;
681
702
 
682
703
  var defaultColumns = [{
683
704
  id: 'image',
684
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
705
+ label: /*#__PURE__*/jsx(FormattedMessage, {
685
706
  id: "UbxbKP",
686
707
  defaultMessage: [{
687
708
  "type": 0,
@@ -693,7 +714,7 @@ var defaultColumns = [{
693
714
  sortable: false
694
715
  }, {
695
716
  id: 'name',
696
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
717
+ label: /*#__PURE__*/jsx(FormattedMessage, {
697
718
  id: "WX83V9",
698
719
  defaultMessage: [{
699
720
  "type": 0,
@@ -704,28 +725,28 @@ var defaultColumns = [{
704
725
  path: 'name',
705
726
  descriptionPath: 'type',
706
727
  descriptionValues: {
707
- image: /*#__PURE__*/React.createElement(FormattedMessage, {
728
+ image: /*#__PURE__*/jsx(FormattedMessage, {
708
729
  id: "AwDQvD",
709
730
  defaultMessage: [{
710
731
  "type": 0,
711
732
  "value": "Image"
712
733
  }]
713
734
  }),
714
- video: /*#__PURE__*/React.createElement(FormattedMessage, {
735
+ video: /*#__PURE__*/jsx(FormattedMessage, {
715
736
  id: "mQiyAm",
716
737
  defaultMessage: [{
717
738
  "type": 0,
718
739
  "value": "Video"
719
740
  }]
720
741
  }),
721
- audio: /*#__PURE__*/React.createElement(FormattedMessage, {
742
+ audio: /*#__PURE__*/jsx(FormattedMessage, {
722
743
  id: "XnyI69",
723
744
  defaultMessage: [{
724
745
  "type": 0,
725
746
  "value": "Audio"
726
747
  }]
727
748
  }),
728
- document: /*#__PURE__*/React.createElement(FormattedMessage, {
749
+ document: /*#__PURE__*/jsx(FormattedMessage, {
729
750
  id: "1dqmFw",
730
751
  defaultMessage: [{
731
752
  "type": 0,
@@ -736,7 +757,7 @@ var defaultColumns = [{
736
757
  sortable: true
737
758
  }, {
738
759
  id: 'dimensions',
739
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
760
+ label: /*#__PURE__*/jsx(FormattedMessage, {
740
761
  id: "eCe9ZY",
741
762
  defaultMessage: [{
742
763
  "type": 0,
@@ -748,7 +769,7 @@ var defaultColumns = [{
748
769
  path: 'metadata'
749
770
  }, {
750
771
  id: 'size',
751
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
772
+ label: /*#__PURE__*/jsx(FormattedMessage, {
752
773
  id: "c3hu9o",
753
774
  defaultMessage: [{
754
775
  "type": 0,
@@ -760,7 +781,7 @@ var defaultColumns = [{
760
781
  path: 'metadata.size'
761
782
  }, {
762
783
  id: 'duration',
763
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
784
+ label: /*#__PURE__*/jsx(FormattedMessage, {
764
785
  id: "002oWQ",
765
786
  defaultMessage: [{
766
787
  "type": 0,
@@ -781,7 +802,7 @@ var defaultColumns = [{
781
802
  // },
782
803
  {
783
804
  id: 'created_at',
784
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
805
+ label: /*#__PURE__*/jsx(FormattedMessage, {
785
806
  id: "OzYWZz",
786
807
  defaultMessage: [{
787
808
  "type": 0,
@@ -794,7 +815,7 @@ var defaultColumns = [{
794
815
  sortable: true
795
816
  }, {
796
817
  id: 'actions',
797
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
818
+ label: /*#__PURE__*/jsx(FormattedMessage, {
798
819
  id: "rtwfuZ",
799
820
  defaultMessage: [{
800
821
  "type": 0,
@@ -823,7 +844,7 @@ var defaultFilters = [{
823
844
  id: 'types',
824
845
  component: 'select',
825
846
  name: 'types',
826
- placeholder: /*#__PURE__*/React.createElement(FormattedMessage, {
847
+ placeholder: /*#__PURE__*/jsx(FormattedMessage, {
827
848
  id: "9/t5wK",
828
849
  defaultMessage: [{
829
850
  "type": 0,
@@ -831,7 +852,7 @@ var defaultFilters = [{
831
852
  }]
832
853
  }),
833
854
  options: [{
834
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
855
+ label: /*#__PURE__*/jsx(FormattedMessage, {
835
856
  id: "yHAmDD",
836
857
  defaultMessage: [{
837
858
  "type": 0,
@@ -840,7 +861,7 @@ var defaultFilters = [{
840
861
  }),
841
862
  value: 'image'
842
863
  }, {
843
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
864
+ label: /*#__PURE__*/jsx(FormattedMessage, {
844
865
  id: "xSERPA",
845
866
  defaultMessage: [{
846
867
  "type": 0,
@@ -849,7 +870,7 @@ var defaultFilters = [{
849
870
  }),
850
871
  value: 'video'
851
872
  }, {
852
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
873
+ label: /*#__PURE__*/jsx(FormattedMessage, {
853
874
  id: "yQRtgx",
854
875
  defaultMessage: [{
855
876
  "type": 0,
@@ -858,7 +879,7 @@ var defaultFilters = [{
858
879
  }),
859
880
  value: 'audio'
860
881
  }, {
861
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
882
+ label: /*#__PURE__*/jsx(FormattedMessage, {
862
883
  id: "8INLfU",
863
884
  defaultMessage: [{
864
885
  "type": 0,
@@ -893,12 +914,12 @@ var _excluded$5 = ["page", "count"],
893
914
  _excluded2 = ["types", "trashed"];
894
915
  var DEFAULT_LAYOUTS = [{
895
916
  id: 'table',
896
- label: /*#__PURE__*/React.createElement(Icon, {
917
+ label: /*#__PURE__*/jsx(Icon, {
897
918
  name: "table"
898
919
  })
899
920
  }, {
900
921
  id: 'grid',
901
- label: /*#__PURE__*/React.createElement(Icon, {
922
+ label: /*#__PURE__*/jsx(Icon, {
902
923
  name: "grid"
903
924
  })
904
925
  }];
@@ -1200,7 +1221,7 @@ function MediasBrowser(_ref) {
1200
1221
  onUploadedMediaChanged(rawMedias);
1201
1222
  }
1202
1223
  }, [onMediaUploaded, setUploadedMedias, setUploadProcessing, onUploadedMediaChanged]);
1203
- var pagination = /*#__PURE__*/React.createElement(Pagination, {
1224
+ var pagination = /*#__PURE__*/jsx(Pagination, {
1204
1225
  page: page,
1205
1226
  lastPage: lastPage,
1206
1227
  total: total,
@@ -1248,7 +1269,7 @@ function MediasBrowser(_ref) {
1248
1269
  if (columnId === 'created_at') {
1249
1270
  return _objectSpread(_objectSpread({}, column), {}, {
1250
1271
  path: 'deleted_at',
1251
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
1272
+ label: /*#__PURE__*/jsx(FormattedMessage, {
1252
1273
  id: "uds4wJ",
1253
1274
  defaultMessage: [{
1254
1275
  "type": 0,
@@ -1343,123 +1364,131 @@ function MediasBrowser(_ref) {
1343
1364
  // [items, finalItems],
1344
1365
  // );
1345
1366
 
1346
- return /*#__PURE__*/React.createElement("div", {
1347
- className: className
1348
- }, currentMedia !== null ? /*#__PURE__*/React.createElement(MediaForm, {
1349
- value: currentMedia,
1350
- fields: fields,
1351
- onChange: setCurrentMedia,
1352
- onSave: onSaveMedia,
1353
- onReplace: onReplaceMedia,
1354
- onClose: onCloseMedia,
1355
- onDelete: onDeleteMedia,
1356
- withDelete: withDelete,
1357
- withTrash: withTrash,
1358
- withReplace: withReplace
1359
- }, formChildren) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1360
- className: classNames(['d-flex', 'justify-content-between'])
1361
- }, filters !== null ? /*#__PURE__*/React.createElement(Filters, {
1362
- value: query,
1363
- clearValue: types !== null ? queryWithoutTypes : null,
1364
- filters: finalFilters,
1365
- onChange: onQueryChange,
1366
- onReset: onQueryReset,
1367
- theme: theme
1368
- }) : null, canUpload ? /*#__PURE__*/React.createElement(UploadField, {
1369
- className: "ms-auto w-auto text-nowrap mt-2 mb-2 ps-2",
1370
- withButton: true,
1371
- withoutMedia: true,
1372
- uppyProps: uppyConfig,
1373
- types: types,
1374
- allowMultipleUploads: true,
1375
- onChange: onUploadComplete,
1376
- disabled: uploadProcessing,
1377
- loading: uploadProcessing,
1378
- outline: false,
1379
- closeAfterFinish: true
1380
- }) : null), /*#__PURE__*/React.createElement("div", {
1381
- className: classNames(['d-flex', 'mt-1', 'mb-3', {
1382
- 'justify-content-between': hasLayouts,
1383
- 'justify-content-end': !hasLayouts
1384
- }])
1385
- }, hasLayouts ? /*#__PURE__*/React.createElement(Buttons, {
1386
- size: "sm",
1387
- theme: "secondary",
1388
- outline: true,
1389
- items: (layouts || []).map(function (lay) {
1390
- return _objectSpread(_objectSpread({}, lay), {}, {
1391
- active: layout === lay.id,
1392
- onClick: function onClick() {
1393
- return onClickLayout(lay.id);
1394
- },
1395
- className: 'px-3 py-2'
1396
- });
1397
- })
1398
- }) : null, !hidePagination ? pagination : /*#__PURE__*/React.createElement("div", null)), layout === 'grid' ? /*#__PURE__*/React.createElement(Grid, {
1399
- size: "small",
1400
- theme: theme,
1401
- component: MediaCard,
1402
- componentProps: {
1403
- className: 'd-flex w-100',
1404
- cardClassName: 'flex-grow-1',
1405
- vertical: true,
1406
- onClickDescription: function onClickDescription(it) {
1407
- onOpenMedia(it);
1408
- }
1409
- },
1410
- selectable: selectable && !showTrashed,
1411
- selectedItems: selectedItems,
1412
- onSelectionChange: uploadProcessing ? null : onSelectionChange,
1413
- multipleSelection: multipleSelection,
1414
- query: query // For sort
1415
- ,
1416
- onQueryChange: onQueryChange,
1417
- items: finalItems || [],
1418
- loading: loading,
1419
- loaded: loaded
1420
- // empty={emptyWithSticky}
1421
- }) : null, layout === 'table' ? /*#__PURE__*/React.createElement(Table, {
1422
- theme: theme,
1423
- columns: finalColumns,
1424
- displayPlaceholder: /*#__PURE__*/React.createElement("span", {
1425
- className: "text-secondary text-opacity-75"
1426
- }, "\u2014"),
1427
- selectable: selectable && !showTrashed,
1428
- selectedItems: selectedItems,
1429
- onSelectionChange: uploadProcessing ? null : onSelectionChange,
1430
- multipleSelection: multipleSelection,
1431
- query: query // For sort
1432
- ,
1433
- onQueryChange: onQueryChange,
1434
- items: finalItems,
1435
- loading: loading,
1436
- loaded: loaded
1437
- // empty={emptyWithSticky}
1438
- ,
1439
- actionsProps: {
1440
- getDeletePropsFromItem: function getDeletePropsFromItem() {
1441
- return {
1442
- href: null,
1443
- withConfirmation: true,
1444
- disabled: trashing || deleting,
1445
- icon: showTrashed ? 'trash-fill' : 'trash',
1446
- action: function action(ids) {
1447
- return onTrashMedia(ids[0]);
1448
- }
1449
- };
1450
- },
1451
- getEditPropsFromItem: function getEditPropsFromItem(it) {
1452
- return {
1453
- href: null,
1454
- onClick: function onClick() {
1367
+ return /*#__PURE__*/jsx("div", {
1368
+ className: className,
1369
+ children: currentMedia !== null ? /*#__PURE__*/jsx(MediaForm, {
1370
+ value: currentMedia,
1371
+ fields: fields,
1372
+ onChange: setCurrentMedia,
1373
+ onSave: onSaveMedia,
1374
+ onReplace: onReplaceMedia,
1375
+ onClose: onCloseMedia,
1376
+ onDelete: onDeleteMedia,
1377
+ withDelete: withDelete,
1378
+ withTrash: withTrash,
1379
+ withReplace: withReplace,
1380
+ children: formChildren
1381
+ }) : /*#__PURE__*/jsxs(Fragment, {
1382
+ children: [/*#__PURE__*/jsxs("div", {
1383
+ className: classNames(['d-flex', 'justify-content-between']),
1384
+ children: [filters !== null ? /*#__PURE__*/jsx(Filters, {
1385
+ value: query,
1386
+ clearValue: types !== null ? queryWithoutTypes : null,
1387
+ filters: finalFilters,
1388
+ onChange: onQueryChange,
1389
+ onReset: onQueryReset,
1390
+ theme: theme
1391
+ }) : null, canUpload ? /*#__PURE__*/jsx(UploadField, {
1392
+ className: "ms-auto w-auto text-nowrap mt-2 mb-2 ps-2",
1393
+ withButton: true,
1394
+ withoutMedia: true,
1395
+ uppyProps: uppyConfig,
1396
+ types: types,
1397
+ allowMultipleUploads: true,
1398
+ onChange: onUploadComplete,
1399
+ disabled: uploadProcessing,
1400
+ loading: uploadProcessing,
1401
+ outline: false,
1402
+ closeAfterFinish: true
1403
+ }) : null]
1404
+ }), /*#__PURE__*/jsxs("div", {
1405
+ className: classNames(['d-flex', 'mt-1', 'mb-3', {
1406
+ 'justify-content-between': hasLayouts,
1407
+ 'justify-content-end': !hasLayouts
1408
+ }]),
1409
+ children: [hasLayouts ? /*#__PURE__*/jsx(Buttons, {
1410
+ size: "sm",
1411
+ theme: "secondary",
1412
+ outline: true,
1413
+ items: (layouts || []).map(function (lay) {
1414
+ return _objectSpread(_objectSpread({}, lay), {}, {
1415
+ active: layout === lay.id,
1416
+ onClick: function onClick() {
1417
+ return onClickLayout(lay.id);
1418
+ },
1419
+ className: 'px-3 py-2'
1420
+ });
1421
+ })
1422
+ }) : null, !hidePagination ? pagination : /*#__PURE__*/jsx("div", {})]
1423
+ }), layout === 'grid' ? /*#__PURE__*/jsx(Grid, {
1424
+ size: "small",
1425
+ theme: theme,
1426
+ component: MediaCard,
1427
+ componentProps: {
1428
+ className: 'd-flex w-100',
1429
+ cardClassName: 'flex-grow-1',
1430
+ vertical: true,
1431
+ onClickDescription: function onClickDescription(it) {
1455
1432
  onOpenMedia(it);
1456
1433
  }
1457
- };
1458
- }
1459
- }
1460
- }) : null, !hidePagination ? /*#__PURE__*/React.createElement("div", {
1461
- className: classNames(['d-flex', 'mt-3', 'mb-1', 'justify-content-end'])
1462
- }, pagination) : null));
1434
+ },
1435
+ selectable: selectable && !showTrashed,
1436
+ selectedItems: selectedItems,
1437
+ onSelectionChange: uploadProcessing ? null : onSelectionChange,
1438
+ multipleSelection: multipleSelection,
1439
+ query: query // For sort
1440
+ ,
1441
+ onQueryChange: onQueryChange,
1442
+ items: finalItems || [],
1443
+ loading: loading,
1444
+ loaded: loaded
1445
+ // empty={emptyWithSticky}
1446
+ }) : null, layout === 'table' ? /*#__PURE__*/jsx(Table, {
1447
+ theme: theme,
1448
+ columns: finalColumns,
1449
+ displayPlaceholder: /*#__PURE__*/jsx("span", {
1450
+ className: "text-secondary text-opacity-75",
1451
+ children: "\u2014"
1452
+ }),
1453
+ selectable: selectable && !showTrashed,
1454
+ selectedItems: selectedItems,
1455
+ onSelectionChange: uploadProcessing ? null : onSelectionChange,
1456
+ multipleSelection: multipleSelection,
1457
+ query: query // For sort
1458
+ ,
1459
+ onQueryChange: onQueryChange,
1460
+ items: finalItems,
1461
+ loading: loading,
1462
+ loaded: loaded
1463
+ // empty={emptyWithSticky}
1464
+ ,
1465
+ actionsProps: {
1466
+ getDeletePropsFromItem: function getDeletePropsFromItem() {
1467
+ return {
1468
+ href: null,
1469
+ withConfirmation: true,
1470
+ disabled: trashing || deleting,
1471
+ icon: showTrashed ? 'trash-fill' : 'trash',
1472
+ action: function action(ids) {
1473
+ return onTrashMedia(ids[0]);
1474
+ }
1475
+ };
1476
+ },
1477
+ getEditPropsFromItem: function getEditPropsFromItem(it) {
1478
+ return {
1479
+ href: null,
1480
+ onClick: function onClick() {
1481
+ onOpenMedia(it);
1482
+ }
1483
+ };
1484
+ }
1485
+ }
1486
+ }) : null, !hidePagination ? /*#__PURE__*/jsx("div", {
1487
+ className: classNames(['d-flex', 'mt-3', 'mb-1', 'justify-content-end']),
1488
+ children: pagination
1489
+ }) : null]
1490
+ })
1491
+ });
1463
1492
  }
1464
1493
  MediasBrowser.propTypes = propTypes$5;
1465
1494
 
@@ -1508,17 +1537,18 @@ function MediasPicker(_ref) {
1508
1537
  onChange(selectedItems);
1509
1538
  }
1510
1539
  }, [selectedItems, onChange]);
1511
- return /*#__PURE__*/React.createElement("div", {
1512
- className: className
1513
- }, /*#__PURE__*/React.createElement(MediasBrowser, Object.assign({
1514
- items: initialItems // TODO: fix useItems if actually using this
1515
- ,
1516
- selectable: true,
1517
- selectedItems: selectedItems,
1518
- onSelectionChange: onSelectionChange,
1519
- multipleSelection: multiple,
1520
- extraItems: extraItems
1521
- }, props)));
1540
+ return /*#__PURE__*/jsx("div", {
1541
+ className: className,
1542
+ children: /*#__PURE__*/jsx(MediasBrowser, _objectSpread({
1543
+ items: initialItems // TODO: fix useItems if actually using this
1544
+ ,
1545
+ selectable: true,
1546
+ selectedItems: selectedItems,
1547
+ onSelectionChange: onSelectionChange,
1548
+ multipleSelection: multiple,
1549
+ extraItems: extraItems
1550
+ }, props))
1551
+ });
1522
1552
  }
1523
1553
  MediasPicker.propTypes = propTypes$4;
1524
1554
 
@@ -1535,11 +1565,13 @@ function MediasBrowserContainer(_ref) {
1535
1565
  _ref$media = _ref.media,
1536
1566
  media = _ref$media === void 0 ? null : _ref$media,
1537
1567
  props = _objectWithoutProperties(_ref, _excluded$3);
1538
- return /*#__PURE__*/React.createElement(MediasApiProvider, {
1539
- api: api
1540
- }, /*#__PURE__*/React.createElement(MediaProvider, {
1541
- media: media
1542
- }, /*#__PURE__*/React.createElement(MediasBrowser, props)));
1568
+ return /*#__PURE__*/jsx(MediasApiProvider, {
1569
+ api: api,
1570
+ children: /*#__PURE__*/jsx(MediaProvider, {
1571
+ media: media,
1572
+ children: /*#__PURE__*/jsx(MediasBrowser, _objectSpread({}, props))
1573
+ })
1574
+ });
1543
1575
  }
1544
1576
  MediasBrowserContainer.propTypes = propTypes$3;
1545
1577
 
@@ -1558,13 +1590,15 @@ function MediasPickerContainer(_ref) {
1558
1590
  media = _ref$media === void 0 ? null : _ref$media,
1559
1591
  onChange = _ref.onChange,
1560
1592
  props = _objectWithoutProperties(_ref, _excluded$2);
1561
- return /*#__PURE__*/React.createElement(MediasApiProvider, {
1562
- api: api
1563
- }, /*#__PURE__*/React.createElement(MediaProvider, {
1564
- media: media
1565
- }, /*#__PURE__*/React.createElement(MediasPicker, Object.assign({}, props, {
1566
- onChange: onChange
1567
- }))));
1593
+ return /*#__PURE__*/jsx(MediasApiProvider, {
1594
+ api: api,
1595
+ children: /*#__PURE__*/jsx(MediaProvider, {
1596
+ media: media,
1597
+ children: /*#__PURE__*/jsx(MediasPicker, _objectSpread(_objectSpread({}, props), {}, {
1598
+ onChange: onChange
1599
+ }))
1600
+ })
1601
+ });
1568
1602
  }
1569
1603
  MediasPickerContainer.propTypes = propTypes$2;
1570
1604
 
@@ -1631,7 +1665,7 @@ function MediasResourceBrowser(_ref) {
1631
1665
  }
1632
1666
  };
1633
1667
  }, [api, resource]);
1634
- return /*#__PURE__*/React.createElement(MediasBrowserContainer, Object.assign({
1668
+ return /*#__PURE__*/jsx(MediasBrowserContainer, _objectSpread({
1635
1669
  api: mediasApi
1636
1670
  }, props));
1637
1671
  }
@@ -1710,15 +1744,15 @@ function MediasResourcePicker(_ref) {
1710
1744
  }
1711
1745
  };
1712
1746
  }, [api, resource]);
1713
- return /*#__PURE__*/React.createElement(MediasPickerContainer, Object.assign({
1747
+ return /*#__PURE__*/jsx(MediasPickerContainer, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
1714
1748
  api: mediasApi
1715
1749
  }, filters !== null ? {
1716
1750
  filters: filters
1717
- } : null, fields !== null ? {
1751
+ } : null), fields !== null ? {
1718
1752
  fields: fields
1719
- } : null, columns !== null ? {
1753
+ } : null), columns !== null ? {
1720
1754
  columns: columns
1721
- } : null, props));
1755
+ } : null), props));
1722
1756
  }
1723
1757
  MediasResourcePicker.propTypes = propTypes;
1724
1758
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/medias",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -51,21 +51,21 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@babel/runtime": "^7.12.5",
54
- "@panneau/core": "^4.0.2",
55
- "@panneau/data": "^4.0.2",
56
- "@panneau/display-image": "^4.0.2",
57
- "@panneau/element-button": "^4.0.2",
58
- "@panneau/element-buttons": "^4.0.2",
59
- "@panneau/element-form": "^4.0.2",
60
- "@panneau/element-form-status": "^4.0.2",
61
- "@panneau/element-grid": "^4.0.2",
62
- "@panneau/element-icon": "^4.0.2",
63
- "@panneau/element-media-card": "^4.0.2",
64
- "@panneau/element-media-player": "^4.0.2",
65
- "@panneau/element-pagination": "^4.0.2",
66
- "@panneau/element-table": "^4.0.2",
67
- "@panneau/field-upload": "^4.0.2",
68
- "@panneau/filter-filters": "^4.0.2",
54
+ "@panneau/core": "^4.0.4",
55
+ "@panneau/data": "^4.0.4",
56
+ "@panneau/display-image": "^4.0.4",
57
+ "@panneau/element-button": "^4.0.4",
58
+ "@panneau/element-buttons": "^4.0.4",
59
+ "@panneau/element-form": "^4.0.4",
60
+ "@panneau/element-form-status": "^4.0.4",
61
+ "@panneau/element-grid": "^4.0.4",
62
+ "@panneau/element-icon": "^4.0.4",
63
+ "@panneau/element-media-card": "^4.0.4",
64
+ "@panneau/element-media-player": "^4.0.4",
65
+ "@panneau/element-pagination": "^4.0.4",
66
+ "@panneau/element-table": "^4.0.4",
67
+ "@panneau/field-upload": "^4.0.4",
68
+ "@panneau/filter-filters": "^4.0.4",
69
69
  "classnames": "^2.5.1",
70
70
  "lodash-es": "^4.17.21",
71
71
  "prop-types": "^15.7.2",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "53ad0f27e467992c23158732e0f7d39d8615780b"
77
+ "gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
78
78
  }