@panneau/modal-medias-picker 3.0.223 → 3.0.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -6
- package/lib/index.js +0 -122
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/modal-medias-picker",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.225",
|
4
4
|
"description": "Medias picker modal",
|
5
5
|
"keywords": [
|
6
6
|
"javascript"
|
@@ -25,8 +25,11 @@
|
|
25
25
|
}
|
26
26
|
],
|
27
27
|
"license": "ISC",
|
28
|
-
"
|
28
|
+
"type": "module",
|
29
29
|
"module": "es/index.js",
|
30
|
+
"exports": {
|
31
|
+
".": "./es/index.js"
|
32
|
+
},
|
30
33
|
"files": [
|
31
34
|
"lib",
|
32
35
|
"es",
|
@@ -46,9 +49,9 @@
|
|
46
49
|
},
|
47
50
|
"dependencies": {
|
48
51
|
"@babel/runtime": "^7.12.5",
|
49
|
-
"@panneau/core": "^3.0.
|
50
|
-
"@panneau/medias": "^3.0.
|
51
|
-
"@panneau/modal-dialog": "^3.0.
|
52
|
+
"@panneau/core": "^3.0.224",
|
53
|
+
"@panneau/medias": "^3.0.225",
|
54
|
+
"@panneau/modal-dialog": "^3.0.224",
|
52
55
|
"@uppy/core": "^3.9.1",
|
53
56
|
"@uppy/dashboard": "^3.7.3",
|
54
57
|
"@uppy/drag-drop": "^3.0.3",
|
@@ -64,5 +67,5 @@
|
|
64
67
|
"publishConfig": {
|
65
68
|
"access": "public"
|
66
69
|
},
|
67
|
-
"gitHead": "
|
70
|
+
"gitHead": "5603d68b2a7c406ea856abccc332318814d53fc3"
|
68
71
|
}
|
package/lib/index.js
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
6
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
8
|
-
var PropTypes = require('prop-types');
|
9
|
-
var React = require('react');
|
10
|
-
var reactIntl = require('react-intl');
|
11
|
-
var medias = require('@panneau/medias');
|
12
|
-
var Dialog = require('@panneau/modal-dialog');
|
13
|
-
|
14
|
-
var _excluded = ["id", "value", "resource", "title", "onChange", "onClose", "confirmButton", "cancelButton", "multiple"];
|
15
|
-
var propTypes = {
|
16
|
-
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
17
|
-
value: PropTypes.shape({}),
|
18
|
-
resource: PropTypes.string,
|
19
|
-
title: PropTypes.string,
|
20
|
-
multiple: PropTypes.bool,
|
21
|
-
onChange: PropTypes.func,
|
22
|
-
onClose: PropTypes.func,
|
23
|
-
confirmButton: PropTypes.shape({}),
|
24
|
-
cancelButton: PropTypes.shape({})
|
25
|
-
};
|
26
|
-
var defaultProps = {
|
27
|
-
resource: null,
|
28
|
-
value: null,
|
29
|
-
title: null,
|
30
|
-
multiple: false,
|
31
|
-
onChange: null,
|
32
|
-
onClose: null,
|
33
|
-
confirmButton: null,
|
34
|
-
cancelButton: null
|
35
|
-
};
|
36
|
-
function MediasPickerModal(_ref) {
|
37
|
-
var id = _ref.id,
|
38
|
-
value = _ref.value,
|
39
|
-
resource = _ref.resource,
|
40
|
-
title = _ref.title,
|
41
|
-
onChange = _ref.onChange,
|
42
|
-
onClose = _ref.onClose,
|
43
|
-
confirmButton = _ref.confirmButton,
|
44
|
-
cancelButton = _ref.cancelButton,
|
45
|
-
multiple = _ref.multiple,
|
46
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
47
|
-
var _useState = React.useState(value),
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
49
|
-
selectedItems = _useState2[0],
|
50
|
-
setSelectedItems = _useState2[1];
|
51
|
-
var onConfirm = React.useCallback(function () {
|
52
|
-
if (onChange !== null) {
|
53
|
-
onChange(selectedItems);
|
54
|
-
}
|
55
|
-
if (onClose !== null) {
|
56
|
-
onClose();
|
57
|
-
}
|
58
|
-
}, [onChange, onClose]);
|
59
|
-
var onSelectionChange = React.useCallback(function (items) {
|
60
|
-
setSelectedItems(items);
|
61
|
-
}, [setSelectedItems]);
|
62
|
-
var _useState3 = React.useState(false),
|
63
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
64
|
-
mediaFormOpen = _useState4[0],
|
65
|
-
setMediaFormOpen = _useState4[1];
|
66
|
-
var onMediaFormOpen = React.useCallback(function () {
|
67
|
-
setMediaFormOpen(true);
|
68
|
-
}, [setMediaFormOpen]);
|
69
|
-
var onMediaFormClose = React.useCallback(function () {
|
70
|
-
setMediaFormOpen(false);
|
71
|
-
}, [setMediaFormOpen]);
|
72
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
73
|
-
id: id || 'picker',
|
74
|
-
size: "xl",
|
75
|
-
onClose: onClose,
|
76
|
-
title: title,
|
77
|
-
buttons: !mediaFormOpen ? [_objectSpread({
|
78
|
-
id: 'cancel',
|
79
|
-
name: 'cancel',
|
80
|
-
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
81
|
-
id: "PyxZY2",
|
82
|
-
defaultMessage: [{
|
83
|
-
"type": 0,
|
84
|
-
"value": "Cancel"
|
85
|
-
}]
|
86
|
-
}),
|
87
|
-
theme: 'secondary',
|
88
|
-
onClick: onClose
|
89
|
-
}, cancelButton), _objectSpread({
|
90
|
-
id: 'confirm',
|
91
|
-
name: 'confirm',
|
92
|
-
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
93
|
-
id: "rvOVCV",
|
94
|
-
defaultMessage: [{
|
95
|
-
"type": 0,
|
96
|
-
"value": "Confirm selection"
|
97
|
-
}]
|
98
|
-
}),
|
99
|
-
theme: 'primary',
|
100
|
-
onClick: onConfirm
|
101
|
-
}, confirmButton)] : null
|
102
|
-
}, resource !== null ? /*#__PURE__*/React.createElement(medias.MediasResourcePicker, Object.assign({}, props, {
|
103
|
-
value: selectedItems,
|
104
|
-
resource: resource,
|
105
|
-
onChange: onSelectionChange,
|
106
|
-
onClose: onClose,
|
107
|
-
multiple: multiple,
|
108
|
-
onMediaFormOpen: onMediaFormOpen,
|
109
|
-
onMediaFormClose: onMediaFormClose
|
110
|
-
})) : /*#__PURE__*/React.createElement(medias.MediasPickerContainer, Object.assign({}, props, {
|
111
|
-
value: selectedItems,
|
112
|
-
onChange: onSelectionChange,
|
113
|
-
onClose: onClose,
|
114
|
-
multiple: multiple,
|
115
|
-
onMediaFormOpen: onMediaFormOpen,
|
116
|
-
onMediaFormClose: onMediaFormClose
|
117
|
-
})));
|
118
|
-
}
|
119
|
-
MediasPickerModal.propTypes = propTypes;
|
120
|
-
MediasPickerModal.defaultProps = defaultProps;
|
121
|
-
|
122
|
-
exports.default = MediasPickerModal;
|