@elliemae/ds-uploader 2.2.0-alpha.4 → 3.0.0-next.2
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/cjs/DSUploader.js +166 -112
- package/cjs/index.d.js +2 -27
- package/cjs/index.js +10 -36
- package/cjs/propTypes.js +40 -63
- package/esm/DSUploader.js +151 -81
- package/esm/index.d.js +1 -2
- package/esm/index.js +1 -7
- package/esm/propTypes.js +32 -30
- package/package.json +6 -6
- package/cjs/DSUploader.js.map +0 -7
- package/cjs/index.d.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/esm/DSUploader.js.map +0 -7
- package/esm/index.d.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
package/cjs/DSUploader.js
CHANGED
|
@@ -1,135 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
require('react');
|
|
15
|
+
var reactDesc = require('react-desc');
|
|
16
|
+
var dsClassnames = require('@elliemae/ds-classnames');
|
|
17
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
18
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
19
|
+
var DSButton = require('@elliemae/ds-button');
|
|
20
|
+
var reactDropzone = require('react-dropzone');
|
|
21
|
+
var DSTooltip = require('@elliemae/ds-tooltip');
|
|
22
|
+
var propTypes = require('./propTypes.js');
|
|
23
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
24
|
+
|
|
25
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
|
+
|
|
27
|
+
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
28
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
29
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
30
|
+
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
31
|
+
var DSTooltip__default = /*#__PURE__*/_interopDefaultLegacy(DSTooltip);
|
|
32
|
+
|
|
33
|
+
var _DividerVertical, _DividerVertical2;
|
|
34
|
+
|
|
35
|
+
const _excluded = ["labelText"],
|
|
36
|
+
_excluded2 = ["containerProps", "label", "icon", "defaultActionLabel", "dragActiveInstructionalText", "dragActiveIcon", "altActionLabel", "acceptedTypesText", "disabledDefault", "disabledAlt", "onDefaultHandlerClick", "onAltHandlerClick", "actions", "showAltAction", "defaultActionTooltipText", "altActionTooltipText"],
|
|
37
|
+
_excluded3 = ["onClick"];
|
|
38
|
+
|
|
39
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
40
|
+
|
|
41
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
42
|
+
const blockName = 'uploader';
|
|
43
|
+
const blockNameInfo = "".concat(blockName, "-info");
|
|
44
|
+
const blockNameDragActive = "".concat(blockName, "-drag-active");
|
|
45
|
+
const blockNameWrapper = "".concat(blockName, "-wrapper");
|
|
46
|
+
const UploaderWrapper = dsClassnames.aggregatedClasses('div')(blockNameWrapper, null, _ref => {
|
|
47
|
+
let {
|
|
48
|
+
disabled
|
|
49
|
+
} = _ref;
|
|
50
|
+
return {
|
|
51
|
+
disabled
|
|
26
52
|
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSUploader_exports = {};
|
|
29
|
-
__export(DSUploader_exports, {
|
|
30
|
-
UploaderWithSchema: () => UploaderWithSchema,
|
|
31
|
-
default: () => DSUploader_default
|
|
32
53
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function ActionButton(
|
|
57
|
-
|
|
58
|
-
...otherProps,
|
|
59
|
-
buttonType: "text",
|
|
54
|
+
const Uploader = dsClassnames.aggregatedClasses('div')(blockName, null, _ref2 => {
|
|
55
|
+
let {
|
|
56
|
+
isDragActive
|
|
57
|
+
} = _ref2;
|
|
58
|
+
return {
|
|
59
|
+
'drag-active': isDragActive
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const UploaderDragActive = dsClassnames.aggregatedClasses('div')(blockNameDragActive);
|
|
63
|
+
const UploaderIconArea = dsClassnames.aggregatedClasses('div')("".concat(blockName, "-icon-wrapper"));
|
|
64
|
+
const UploaderInfo = dsClassnames.aggregatedClasses('div')(blockNameInfo);
|
|
65
|
+
const InfoText = dsClassnames.aggregatedClasses('span')(blockNameInfo, 'text');
|
|
66
|
+
const UploaderActions = dsClassnames.aggregatedClasses('div')(blockNameInfo, 'actions');
|
|
67
|
+
const AcceptedTypes = dsClassnames.aggregatedClasses('div')(blockNameWrapper, 'accepted-types');
|
|
68
|
+
const DividerVertical = dsClassnames.aggregatedClasses('div')('divider', null, _ref3 => {
|
|
69
|
+
let {
|
|
70
|
+
vertical
|
|
71
|
+
} = _ref3;
|
|
72
|
+
return {
|
|
73
|
+
vertical
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
function ActionButton(_ref4) {
|
|
78
|
+
let {
|
|
60
79
|
labelText
|
|
61
|
-
}
|
|
80
|
+
} = _ref4,
|
|
81
|
+
otherProps = _objectWithoutProperties__default["default"](_ref4, _excluded);
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
84
|
+
buttonType: "text",
|
|
85
|
+
labelText: labelText
|
|
86
|
+
}));
|
|
62
87
|
}
|
|
88
|
+
|
|
63
89
|
const noop = () => null;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
|
|
91
|
+
const DSUploader = _ref5 => {
|
|
92
|
+
let {
|
|
93
|
+
containerProps = {},
|
|
94
|
+
label = 'Browse',
|
|
95
|
+
// todo: i18n
|
|
96
|
+
icon: UploadFileIcon = dsIcons.UploadFile,
|
|
97
|
+
defaultActionLabel = 'LOCAL DRIVE',
|
|
98
|
+
// todo: i18n
|
|
99
|
+
dragActiveInstructionalText = 'DROP FILES HERE',
|
|
100
|
+
dragActiveIcon: DragActiveIcon = dsIcons.UploadFile,
|
|
101
|
+
altActionLabel = 'DOCUMENTS',
|
|
102
|
+
// todo: i18n
|
|
103
|
+
acceptedTypesText = 'JPG, JPEG, PNG, PDF',
|
|
104
|
+
disabledDefault = false,
|
|
105
|
+
disabledAlt = false,
|
|
106
|
+
onDefaultHandlerClick = noop,
|
|
107
|
+
onAltHandlerClick = noop,
|
|
108
|
+
actions = {
|
|
109
|
+
defaultAction: 'LOCAL DRIVE',
|
|
110
|
+
altAction: 'DOCUMENTS'
|
|
111
|
+
},
|
|
112
|
+
showAltAction = false,
|
|
113
|
+
defaultActionTooltipText,
|
|
114
|
+
altActionTooltipText
|
|
115
|
+
} = _ref5,
|
|
116
|
+
dropzoneProps = _objectWithoutProperties__default["default"](_ref5, _excluded2);
|
|
117
|
+
|
|
118
|
+
const {
|
|
119
|
+
getRootProps,
|
|
120
|
+
getInputProps,
|
|
121
|
+
isDragActive
|
|
122
|
+
} = reactDropzone.useDropzone(dropzoneProps);
|
|
123
|
+
|
|
124
|
+
const _getRootProps = getRootProps(),
|
|
125
|
+
{
|
|
126
|
+
onClick: onOpenFile
|
|
127
|
+
} = _getRootProps,
|
|
128
|
+
rootProps = _objectWithoutProperties__default["default"](_getRootProps, _excluded3);
|
|
129
|
+
|
|
85
130
|
const disabledAll = disabledDefault && disabledAlt;
|
|
86
|
-
|
|
87
|
-
|
|
131
|
+
|
|
132
|
+
const delfaultActionButton = /*#__PURE__*/_jsx2__default["default"](ActionButton, {
|
|
133
|
+
variant: disabledDefault && DSButton.BUTTON_VARIANT.DISABLED,
|
|
88
134
|
labelText: actions.defaultAction ? actions.defaultAction : defaultActionLabel,
|
|
89
|
-
onClick: (
|
|
90
|
-
if (!disabledDefault)
|
|
91
|
-
(0, import_ds_utilities.runAll)(onDefaultHandlerClick, onOpenFile)(...args);
|
|
135
|
+
onClick: function () {
|
|
136
|
+
if (!disabledDefault) dsUtilities.runAll(onDefaultHandlerClick, onOpenFile)(...arguments);
|
|
92
137
|
}
|
|
93
138
|
});
|
|
94
|
-
|
|
95
|
-
|
|
139
|
+
|
|
140
|
+
const altActionButton = /*#__PURE__*/_jsx2__default["default"](ActionButton, {
|
|
141
|
+
variant: disabledAlt && DSButton.BUTTON_VARIANT.DISABLED,
|
|
96
142
|
labelText: actions.altAction ? actions.altAction : altActionLabel,
|
|
97
|
-
onClick: (
|
|
98
|
-
if (!disabledAlt)
|
|
99
|
-
onAltHandlerClick(...args);
|
|
143
|
+
onClick: function () {
|
|
144
|
+
if (!disabledAlt) onAltHandlerClick(...arguments);
|
|
100
145
|
}
|
|
101
146
|
});
|
|
102
|
-
|
|
103
|
-
|
|
147
|
+
|
|
148
|
+
const defaultAction = !defaultActionTooltipText ? delfaultActionButton : /*#__PURE__*/_jsx2__default["default"](DSTooltip__default["default"], {
|
|
149
|
+
containerProps: {
|
|
150
|
+
id: 'default-action-tooltip'
|
|
151
|
+
},
|
|
104
152
|
interactionType: "hover",
|
|
105
153
|
title: defaultActionTooltipText,
|
|
106
154
|
triggerComponent: delfaultActionButton
|
|
107
155
|
});
|
|
108
|
-
const altAction = !altActionTooltipText ? altActionButton :
|
|
109
|
-
containerProps: {
|
|
156
|
+
const altAction = !altActionTooltipText ? altActionButton : /*#__PURE__*/_jsx2__default["default"](DSTooltip__default["default"], {
|
|
157
|
+
containerProps: {
|
|
158
|
+
id: 'alt-action-tooltip'
|
|
159
|
+
},
|
|
110
160
|
interactionType: "hover",
|
|
111
161
|
title: altActionTooltipText,
|
|
112
162
|
triggerComponent: altActionButton
|
|
113
163
|
});
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
164
|
+
return /*#__PURE__*/jsxRuntime.jsxs(UploaderWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
165
|
+
classProps: {
|
|
166
|
+
disabled: disabledAll
|
|
167
|
+
},
|
|
168
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Uploader, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
169
|
+
classProps: {
|
|
170
|
+
isDragActive
|
|
171
|
+
},
|
|
172
|
+
children: [/*#__PURE__*/_jsx2__default["default"](UploaderIconArea, {}, void 0, /*#__PURE__*/_jsx2__default["default"](UploadFileIcon, {
|
|
173
|
+
size: "l"
|
|
174
|
+
})), _DividerVertical || (_DividerVertical = /*#__PURE__*/_jsx2__default["default"](DividerVertical, {})), /*#__PURE__*/_jsx2__default["default"](UploaderInfo, {}, void 0, /*#__PURE__*/_jsx2__default["default"](InfoText, {}, void 0, label), /*#__PURE__*/_jsx2__default["default"](UploaderActions, {}, void 0, actions.defaultAction && defaultAction, (actions.altAction || showAltAction) && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
175
|
+
children: [actions.defaultAction && (_DividerVertical2 || (_DividerVertical2 = /*#__PURE__*/_jsx2__default["default"](DividerVertical, {}))), altAction]
|
|
176
|
+
}))), !disabledAll && /*#__PURE__*/_jsx2__default["default"](UploaderDragActive, {}, void 0, /*#__PURE__*/_jsx2__default["default"](DragActiveIcon, {}), dragActiveInstructionalText), !disabledAll && /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread({}, getInputProps()))]
|
|
177
|
+
})), typeof acceptedTypesText === 'string' && /*#__PURE__*/_jsx2__default["default"](AcceptedTypes, {}, void 0, acceptedTypesText.toUpperCase())]
|
|
178
|
+
}));
|
|
125
179
|
};
|
|
180
|
+
|
|
126
181
|
DSUploader.actions = {
|
|
127
|
-
defaultAction:
|
|
128
|
-
altAction:
|
|
182
|
+
defaultAction: 'LOCAL DRIVE',
|
|
183
|
+
altAction: 'DOCUMENTS'
|
|
129
184
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//# sourceMappingURL=DSUploader.js.map
|
|
185
|
+
const UploaderWithSchema = reactDesc.describe(DSUploader);
|
|
186
|
+
UploaderWithSchema.propTypes = propTypes.propTypes;
|
|
187
|
+
|
|
188
|
+
exports.UploaderWithSchema = UploaderWithSchema;
|
|
189
|
+
exports["default"] = DSUploader;
|
package/cjs/index.d.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(module2))
|
|
11
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (module2, isNodeMode) => {
|
|
17
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
-
return (module2, temp) => {
|
|
21
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
-
};
|
|
23
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
-
var index_d_exports = {};
|
|
25
|
-
var React = __toESM(require("react"));
|
|
26
|
-
module.exports = __toCommonJS(index_d_exports);
|
|
27
|
-
//# sourceMappingURL=index.d.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
package/cjs/index.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
UploaderWithSchema: () => import_DSUploader.UploaderWithSchema,
|
|
31
|
-
default: () => import_DSUploader.default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_DSUploader = require("./DSUploader");
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSUploader = require('./DSUploader.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.UploaderWithSchema = DSUploader.UploaderWithSchema;
|
|
10
|
+
exports["default"] = DSUploader["default"];
|
package/cjs/propTypes.js
CHANGED
|
@@ -1,65 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var propTypes_exports = {};
|
|
29
|
-
__export(propTypes_exports, {
|
|
30
|
-
propTypes: () => propTypes
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react_desc = require("react-desc");
|
|
34
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactDesc = require('react-desc');
|
|
6
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
7
|
+
|
|
8
|
+
/** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */
|
|
9
|
+
|
|
35
10
|
const propTypes = {
|
|
36
|
-
containerProps:
|
|
37
|
-
validator:
|
|
38
|
-
maxFiles:
|
|
39
|
-
minSize:
|
|
40
|
-
maxSize:
|
|
41
|
-
onDropRejected:
|
|
42
|
-
disabled:
|
|
43
|
-
multiple:
|
|
44
|
-
accept:
|
|
45
|
-
label:
|
|
46
|
-
icon:
|
|
47
|
-
actions:
|
|
48
|
-
defaultAction:
|
|
49
|
-
altAction:
|
|
50
|
-
}).description(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container.'),
|
|
12
|
+
validator: reactDesc.PropTypes.func.description("Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not."),
|
|
13
|
+
maxFiles: reactDesc.PropTypes.number.description('Number of files accepted.'),
|
|
14
|
+
minSize: reactDesc.PropTypes.number.description('Minimun file size accepted in bytes.'),
|
|
15
|
+
maxSize: reactDesc.PropTypes.number.description('Maximum file size accepted in bytes.'),
|
|
16
|
+
onDropRejected: reactDesc.PropTypes.func.description('Cb called when files are rejected using maxFiles, minSize or maxSize properties.'),
|
|
17
|
+
disabled: reactDesc.PropTypes.bool.description('Disables the DSUploader.'),
|
|
18
|
+
multiple: reactDesc.PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),
|
|
19
|
+
accept: reactDesc.PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),
|
|
20
|
+
label: reactDesc.PropTypes.string.description('Uploader label.').defaultValue('Browse'),
|
|
21
|
+
icon: reactDesc.PropTypes.element.description('Uploader left icon.').defaultValue(dsIcons.UploadFile),
|
|
22
|
+
actions: reactDesc.PropTypes.shape({
|
|
23
|
+
defaultAction: reactDesc.PropTypes.string,
|
|
24
|
+
altAction: reactDesc.PropTypes.string
|
|
25
|
+
}).description('Uploader actions.').defaultValue({
|
|
26
|
+
defaultAction: 'LOCAL DRIVE'
|
|
27
|
+
}),
|
|
28
|
+
defaultActionLabel: reactDesc.PropTypes.string.description('First action button label.'),
|
|
29
|
+
showAltAction: reactDesc.PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),
|
|
30
|
+
altActionLabel: reactDesc.PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),
|
|
31
|
+
dragActiveInstructionalText: reactDesc.PropTypes.string.description('informative text when user drags a file over the uploader zone.').defaultValue('DROP FILES HERE'),
|
|
32
|
+
dragActiveIcon: reactDesc.PropTypes.string.description('Icon when user drags a file over the uploader zone.'),
|
|
33
|
+
acceptedTypesText: reactDesc.PropTypes.string.description('Information text to show what types are supported.').defaultValue('JPG, JPEG, PNG, PDF'),
|
|
34
|
+
disabledDefault: reactDesc.PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),
|
|
35
|
+
disabledAlt: reactDesc.PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),
|
|
36
|
+
onDefaultHandlerClick: reactDesc.PropTypes.func.description('First action button click handler.'),
|
|
37
|
+
onAltHandlerClick: reactDesc.PropTypes.func.description('Second action button click handler.'),
|
|
38
|
+
defaultActionTooltipText: reactDesc.PropTypes.string.description('shows tooltip in default action button.'),
|
|
39
|
+
altActionTooltipText: reactDesc.PropTypes.string.description('Shows tooltip in alternate action button.')
|
|
63
40
|
};
|
|
64
|
-
|
|
65
|
-
|
|
41
|
+
|
|
42
|
+
exports.propTypes = propTypes;
|
package/esm/DSUploader.js
CHANGED
|
@@ -1,106 +1,176 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import { describe } from 'react-desc';
|
|
12
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
13
|
+
import { runAll } from '@elliemae/ds-utilities';
|
|
14
|
+
import { UploadFile } from '@elliemae/ds-icons';
|
|
15
|
+
import DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';
|
|
16
|
+
import { useDropzone } from 'react-dropzone';
|
|
17
|
+
import DSTooltip from '@elliemae/ds-tooltip';
|
|
18
|
+
import { propTypes } from './propTypes.js';
|
|
19
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
20
|
+
|
|
21
|
+
var _DividerVertical, _DividerVertical2;
|
|
22
|
+
|
|
23
|
+
const _excluded = ["labelText"],
|
|
24
|
+
_excluded2 = ["containerProps", "label", "icon", "defaultActionLabel", "dragActiveInstructionalText", "dragActiveIcon", "altActionLabel", "acceptedTypesText", "disabledDefault", "disabledAlt", "onDefaultHandlerClick", "onAltHandlerClick", "actions", "showAltAction", "defaultActionTooltipText", "altActionTooltipText"],
|
|
25
|
+
_excluded3 = ["onClick"];
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
+
const blockName = 'uploader';
|
|
31
|
+
const blockNameInfo = "".concat(blockName, "-info");
|
|
32
|
+
const blockNameDragActive = "".concat(blockName, "-drag-active");
|
|
33
|
+
const blockNameWrapper = "".concat(blockName, "-wrapper");
|
|
34
|
+
const UploaderWrapper = aggregatedClasses('div')(blockNameWrapper, null, _ref => {
|
|
35
|
+
let {
|
|
36
|
+
disabled
|
|
37
|
+
} = _ref;
|
|
38
|
+
return {
|
|
39
|
+
disabled
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
const Uploader = aggregatedClasses('div')(blockName, null, _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
isDragActive
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return {
|
|
47
|
+
'drag-active': isDragActive
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const UploaderDragActive = aggregatedClasses('div')(blockNameDragActive);
|
|
51
|
+
const UploaderIconArea = aggregatedClasses('div')("".concat(blockName, "-icon-wrapper"));
|
|
52
|
+
const UploaderInfo = aggregatedClasses('div')(blockNameInfo);
|
|
53
|
+
const InfoText = aggregatedClasses('span')(blockNameInfo, 'text');
|
|
54
|
+
const UploaderActions = aggregatedClasses('div')(blockNameInfo, 'actions');
|
|
55
|
+
const AcceptedTypes = aggregatedClasses('div')(blockNameWrapper, 'accepted-types');
|
|
56
|
+
const DividerVertical = aggregatedClasses('div')('divider', null, _ref3 => {
|
|
57
|
+
let {
|
|
58
|
+
vertical
|
|
59
|
+
} = _ref3;
|
|
60
|
+
return {
|
|
61
|
+
vertical
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function ActionButton(_ref4) {
|
|
66
|
+
let {
|
|
28
67
|
labelText
|
|
29
|
-
}
|
|
68
|
+
} = _ref4,
|
|
69
|
+
otherProps = _objectWithoutProperties(_ref4, _excluded);
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
72
|
+
buttonType: "text",
|
|
73
|
+
labelText: labelText
|
|
74
|
+
}));
|
|
30
75
|
}
|
|
76
|
+
|
|
31
77
|
const noop = () => null;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
78
|
+
|
|
79
|
+
const DSUploader = _ref5 => {
|
|
80
|
+
let {
|
|
81
|
+
containerProps = {},
|
|
82
|
+
label = 'Browse',
|
|
83
|
+
// todo: i18n
|
|
84
|
+
icon: UploadFileIcon = UploadFile,
|
|
85
|
+
defaultActionLabel = 'LOCAL DRIVE',
|
|
86
|
+
// todo: i18n
|
|
87
|
+
dragActiveInstructionalText = 'DROP FILES HERE',
|
|
88
|
+
dragActiveIcon: DragActiveIcon = UploadFile,
|
|
89
|
+
altActionLabel = 'DOCUMENTS',
|
|
90
|
+
// todo: i18n
|
|
91
|
+
acceptedTypesText = 'JPG, JPEG, PNG, PDF',
|
|
92
|
+
disabledDefault = false,
|
|
93
|
+
disabledAlt = false,
|
|
94
|
+
onDefaultHandlerClick = noop,
|
|
95
|
+
onAltHandlerClick = noop,
|
|
96
|
+
actions = {
|
|
97
|
+
defaultAction: 'LOCAL DRIVE',
|
|
98
|
+
altAction: 'DOCUMENTS'
|
|
99
|
+
},
|
|
100
|
+
showAltAction = false,
|
|
101
|
+
defaultActionTooltipText,
|
|
102
|
+
altActionTooltipText
|
|
103
|
+
} = _ref5,
|
|
104
|
+
dropzoneProps = _objectWithoutProperties(_ref5, _excluded2);
|
|
105
|
+
|
|
106
|
+
const {
|
|
107
|
+
getRootProps,
|
|
108
|
+
getInputProps,
|
|
109
|
+
isDragActive
|
|
110
|
+
} = useDropzone(dropzoneProps);
|
|
111
|
+
|
|
112
|
+
const _getRootProps = getRootProps(),
|
|
113
|
+
{
|
|
114
|
+
onClick: onOpenFile
|
|
115
|
+
} = _getRootProps,
|
|
116
|
+
rootProps = _objectWithoutProperties(_getRootProps, _excluded3);
|
|
117
|
+
|
|
53
118
|
const disabledAll = disabledDefault && disabledAlt;
|
|
54
|
-
|
|
119
|
+
|
|
120
|
+
const delfaultActionButton = /*#__PURE__*/_jsx2(ActionButton, {
|
|
55
121
|
variant: disabledDefault && BUTTON_VARIANT.DISABLED,
|
|
56
122
|
labelText: actions.defaultAction ? actions.defaultAction : defaultActionLabel,
|
|
57
|
-
onClick: (
|
|
58
|
-
if (!disabledDefault)
|
|
59
|
-
runAll(onDefaultHandlerClick, onOpenFile)(...args);
|
|
123
|
+
onClick: function () {
|
|
124
|
+
if (!disabledDefault) runAll(onDefaultHandlerClick, onOpenFile)(...arguments);
|
|
60
125
|
}
|
|
61
126
|
});
|
|
62
|
-
|
|
127
|
+
|
|
128
|
+
const altActionButton = /*#__PURE__*/_jsx2(ActionButton, {
|
|
63
129
|
variant: disabledAlt && BUTTON_VARIANT.DISABLED,
|
|
64
130
|
labelText: actions.altAction ? actions.altAction : altActionLabel,
|
|
65
|
-
onClick: (
|
|
66
|
-
if (!disabledAlt)
|
|
67
|
-
onAltHandlerClick(...args);
|
|
131
|
+
onClick: function () {
|
|
132
|
+
if (!disabledAlt) onAltHandlerClick(...arguments);
|
|
68
133
|
}
|
|
69
134
|
});
|
|
70
|
-
|
|
71
|
-
|
|
135
|
+
|
|
136
|
+
const defaultAction = !defaultActionTooltipText ? delfaultActionButton : /*#__PURE__*/_jsx2(DSTooltip, {
|
|
137
|
+
containerProps: {
|
|
138
|
+
id: 'default-action-tooltip'
|
|
139
|
+
},
|
|
72
140
|
interactionType: "hover",
|
|
73
141
|
title: defaultActionTooltipText,
|
|
74
142
|
triggerComponent: delfaultActionButton
|
|
75
143
|
});
|
|
76
|
-
const altAction = !altActionTooltipText ? altActionButton :
|
|
77
|
-
containerProps: {
|
|
144
|
+
const altAction = !altActionTooltipText ? altActionButton : /*#__PURE__*/_jsx2(DSTooltip, {
|
|
145
|
+
containerProps: {
|
|
146
|
+
id: 'alt-action-tooltip'
|
|
147
|
+
},
|
|
78
148
|
interactionType: "hover",
|
|
79
149
|
title: altActionTooltipText,
|
|
80
150
|
triggerComponent: altActionButton
|
|
81
151
|
});
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
152
|
+
return /*#__PURE__*/jsxs(UploaderWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
153
|
+
classProps: {
|
|
154
|
+
disabled: disabledAll
|
|
155
|
+
},
|
|
156
|
+
children: [/*#__PURE__*/jsxs(Uploader, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
157
|
+
classProps: {
|
|
158
|
+
isDragActive
|
|
159
|
+
},
|
|
160
|
+
children: [/*#__PURE__*/_jsx2(UploaderIconArea, {}, void 0, /*#__PURE__*/_jsx2(UploadFileIcon, {
|
|
161
|
+
size: "l"
|
|
162
|
+
})), _DividerVertical || (_DividerVertical = /*#__PURE__*/_jsx2(DividerVertical, {})), /*#__PURE__*/_jsx2(UploaderInfo, {}, void 0, /*#__PURE__*/_jsx2(InfoText, {}, void 0, label), /*#__PURE__*/_jsx2(UploaderActions, {}, void 0, actions.defaultAction && defaultAction, (actions.altAction || showAltAction) && /*#__PURE__*/jsxs(Fragment, {
|
|
163
|
+
children: [actions.defaultAction && (_DividerVertical2 || (_DividerVertical2 = /*#__PURE__*/_jsx2(DividerVertical, {}))), altAction]
|
|
164
|
+
}))), !disabledAll && /*#__PURE__*/_jsx2(UploaderDragActive, {}, void 0, /*#__PURE__*/_jsx2(DragActiveIcon, {}), dragActiveInstructionalText), !disabledAll && /*#__PURE__*/jsx("input", _objectSpread({}, getInputProps()))]
|
|
165
|
+
})), typeof acceptedTypesText === 'string' && /*#__PURE__*/_jsx2(AcceptedTypes, {}, void 0, acceptedTypesText.toUpperCase())]
|
|
166
|
+
}));
|
|
93
167
|
};
|
|
168
|
+
|
|
94
169
|
DSUploader.actions = {
|
|
95
|
-
defaultAction:
|
|
96
|
-
altAction:
|
|
170
|
+
defaultAction: 'LOCAL DRIVE',
|
|
171
|
+
altAction: 'DOCUMENTS'
|
|
97
172
|
};
|
|
98
|
-
DSUploader.propTypes = propTypes;
|
|
99
173
|
const UploaderWithSchema = describe(DSUploader);
|
|
100
174
|
UploaderWithSchema.propTypes = propTypes;
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
UploaderWithSchema,
|
|
104
|
-
DSUploader_default as default
|
|
105
|
-
};
|
|
106
|
-
//# sourceMappingURL=DSUploader.js.map
|
|
175
|
+
|
|
176
|
+
export { UploaderWithSchema, DSUploader as default };
|
package/esm/index.d.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.d.js.map
|
|
1
|
+
|
package/esm/index.js
CHANGED
package/esm/propTypes.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { UploadFile } from '@elliemae/ds-icons';
|
|
3
|
+
|
|
4
|
+
/** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */
|
|
5
|
+
|
|
4
6
|
const propTypes = {
|
|
5
|
-
containerProps: PropTypes.object.description(
|
|
7
|
+
containerProps: PropTypes.object.description('Set of Properties attached to the main container.'),
|
|
6
8
|
validator: PropTypes.func.description("Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not."),
|
|
7
|
-
maxFiles: PropTypes.number.description(
|
|
8
|
-
minSize: PropTypes.number.description(
|
|
9
|
-
maxSize: PropTypes.number.description(
|
|
10
|
-
onDropRejected: PropTypes.func.description(
|
|
11
|
-
disabled: PropTypes.bool.description(
|
|
12
|
-
multiple: PropTypes.bool.description(
|
|
13
|
-
accept: PropTypes.string.description(
|
|
14
|
-
label: PropTypes.string.description(
|
|
15
|
-
icon: PropTypes.element.description(
|
|
9
|
+
maxFiles: PropTypes.number.description('Number of files accepted.'),
|
|
10
|
+
minSize: PropTypes.number.description('Minimun file size accepted in bytes.'),
|
|
11
|
+
maxSize: PropTypes.number.description('Maximum file size accepted in bytes.'),
|
|
12
|
+
onDropRejected: PropTypes.func.description('Cb called when files are rejected using maxFiles, minSize or maxSize properties.'),
|
|
13
|
+
disabled: PropTypes.bool.description('Disables the DSUploader.'),
|
|
14
|
+
multiple: PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),
|
|
15
|
+
accept: PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),
|
|
16
|
+
label: PropTypes.string.description('Uploader label.').defaultValue('Browse'),
|
|
17
|
+
icon: PropTypes.element.description('Uploader left icon.').defaultValue(UploadFile),
|
|
16
18
|
actions: PropTypes.shape({
|
|
17
19
|
defaultAction: PropTypes.string,
|
|
18
20
|
altAction: PropTypes.string
|
|
19
|
-
}).description(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
}).description('Uploader actions.').defaultValue({
|
|
22
|
+
defaultAction: 'LOCAL DRIVE'
|
|
23
|
+
}),
|
|
24
|
+
defaultActionLabel: PropTypes.string.description('First action button label.'),
|
|
25
|
+
showAltAction: PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),
|
|
26
|
+
altActionLabel: PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),
|
|
27
|
+
dragActiveInstructionalText: PropTypes.string.description('informative text when user drags a file over the uploader zone.').defaultValue('DROP FILES HERE'),
|
|
28
|
+
dragActiveIcon: PropTypes.string.description('Icon when user drags a file over the uploader zone.'),
|
|
29
|
+
acceptedTypesText: PropTypes.string.description('Information text to show what types are supported.').defaultValue('JPG, JPEG, PNG, PDF'),
|
|
30
|
+
disabledDefault: PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),
|
|
31
|
+
disabledAlt: PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),
|
|
32
|
+
onDefaultHandlerClick: PropTypes.func.description('First action button click handler.'),
|
|
33
|
+
onAltHandlerClick: PropTypes.func.description('Second action button click handler.'),
|
|
34
|
+
defaultActionTooltipText: PropTypes.string.description('shows tooltip in default action button.'),
|
|
35
|
+
altActionTooltipText: PropTypes.string.description('Shows tooltip in alternate action button.')
|
|
32
36
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=propTypes.js.map
|
|
37
|
+
|
|
38
|
+
export { propTypes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-uploader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Uploader",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"build": "node ../../scripts/build/build.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elliemae/ds-button": "
|
|
44
|
-
"@elliemae/ds-classnames": "
|
|
45
|
-
"@elliemae/ds-icons": "
|
|
46
|
-
"@elliemae/ds-tooltip": "
|
|
47
|
-
"@elliemae/ds-utilities": "
|
|
43
|
+
"@elliemae/ds-button": "3.0.0-next.2",
|
|
44
|
+
"@elliemae/ds-classnames": "3.0.0-next.2",
|
|
45
|
+
"@elliemae/ds-icons": "3.0.0-next.2",
|
|
46
|
+
"@elliemae/ds-tooltip": "3.0.0-next.2",
|
|
47
|
+
"@elliemae/ds-utilities": "3.0.0-next.2",
|
|
48
48
|
"react-desc": "~4.1.3",
|
|
49
49
|
"react-dropzone": "~10.2.2"
|
|
50
50
|
},
|
package/cjs/DSUploader.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSUploader.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { UploadFile } from '@elliemae/ds-icons';\nimport DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';\nimport { useDropzone } from 'react-dropzone';\nimport DSTooltip from '@elliemae/ds-tooltip';\nimport { propTypes } from './propTypes';\nimport type { DSUploaderPropsT, ActionButtonPropsT } from './index.d';\n\nconst blockName = 'uploader';\nconst blockNameInfo = `${blockName}-info`;\nconst blockNameDragActive = `${blockName}-drag-active`;\nconst blockNameWrapper = `${blockName}-wrapper`;\n\nconst UploaderWrapper = aggregatedClasses('div')(blockNameWrapper, null, ({ disabled }) => ({ disabled }));\nconst Uploader = aggregatedClasses('div')(blockName, null, ({ isDragActive }) => ({ 'drag-active': isDragActive }));\nconst UploaderDragActive = aggregatedClasses('div')(blockNameDragActive);\nconst UploaderIconArea = aggregatedClasses('div')(`${blockName}-icon-wrapper`);\nconst UploaderInfo = aggregatedClasses('div')(blockNameInfo);\nconst InfoText = aggregatedClasses('span')(blockNameInfo, 'text');\nconst UploaderActions = aggregatedClasses('div')(blockNameInfo, 'actions');\nconst AcceptedTypes = aggregatedClasses('div')(blockNameWrapper, 'accepted-types');\n\nconst DividerVertical = aggregatedClasses('div')('divider', null, ({ vertical }) => ({ vertical }));\n\nfunction ActionButton({ labelText, ...otherProps }: ActionButtonPropsT): React.ReactElement {\n return <DSButton {...otherProps} buttonType=\"text\" labelText={labelText} />;\n}\n\nconst noop = () => null;\n\nconst DSUploader = ({\n containerProps = {},\n label = 'Browse', // todo: i18n\n icon: UploadFileIcon = UploadFile,\n defaultActionLabel = 'LOCAL DRIVE', // todo: i18n\n dragActiveInstructionalText = 'DROP FILES HERE',\n dragActiveIcon: DragActiveIcon = UploadFile,\n altActionLabel = 'DOCUMENTS', // todo: i18n\n acceptedTypesText = 'JPG, JPEG, PNG, PDF',\n disabledDefault = false,\n disabledAlt = false,\n onDefaultHandlerClick = noop,\n onAltHandlerClick = noop,\n actions = { defaultAction: 'LOCAL DRIVE', altAction: 'DOCUMENTS' },\n showAltAction = false,\n defaultActionTooltipText,\n altActionTooltipText,\n ...dropzoneProps\n}: DSUploaderPropsT): JSX.Element => {\n const { getRootProps, getInputProps, isDragActive } = useDropzone(dropzoneProps);\n const { onClick: onOpenFile, ...rootProps } = getRootProps();\n const disabledAll = disabledDefault && disabledAlt;\n\n const delfaultActionButton = (\n <ActionButton\n variant={disabledDefault && BUTTON_VARIANT.DISABLED}\n labelText={actions.defaultAction ? (actions.defaultAction as string) : defaultActionLabel}\n onClick={(...args) => {\n if (!disabledDefault) runAll(onDefaultHandlerClick, onOpenFile)(...args);\n }}\n />\n );\n\n const altActionButton = (\n <ActionButton\n variant={disabledAlt && BUTTON_VARIANT.DISABLED}\n labelText={actions.altAction ? (actions.altAction as string) : altActionLabel}\n onClick={(...args) => {\n if (!disabledAlt) onAltHandlerClick(...args);\n }}\n />\n );\n\n const defaultAction = !defaultActionTooltipText ? (\n delfaultActionButton\n ) : (\n <DSTooltip\n containerProps={{ id: 'default-action-tooltip' }}\n interactionType=\"hover\"\n title={defaultActionTooltipText}\n triggerComponent={delfaultActionButton}\n />\n );\n\n const altAction = !altActionTooltipText ? (\n altActionButton\n ) : (\n <DSTooltip\n containerProps={{ id: 'alt-action-tooltip' }}\n interactionType=\"hover\"\n title={altActionTooltipText}\n triggerComponent={altActionButton}\n />\n );\n\n return (\n <UploaderWrapper {...containerProps} classProps={{ disabled: disabledAll }}>\n <Uploader {...rootProps} classProps={{ isDragActive }}>\n <UploaderIconArea>\n <UploadFileIcon size=\"l\" />\n </UploaderIconArea>\n <DividerVertical />\n <UploaderInfo>\n <InfoText>{label}</InfoText>\n <UploaderActions>\n {actions.defaultAction && defaultAction}\n {(actions.altAction || showAltAction) && (\n <>\n {actions.defaultAction && <DividerVertical />}\n {altAction}\n </>\n )}\n </UploaderActions>\n </UploaderInfo>\n {!disabledAll && (\n <UploaderDragActive>\n <DragActiveIcon />\n {dragActiveInstructionalText}\n </UploaderDragActive>\n )}\n {!disabledAll && <input {...getInputProps()} />}\n </Uploader>\n {typeof acceptedTypesText === 'string' && <AcceptedTypes>{acceptedTypesText.toUpperCase()}</AcceptedTypes>}\n </UploaderWrapper>\n );\n};\n\nDSUploader.actions = {\n defaultAction: 'LOCAL DRIVE',\n altAction: 'DOCUMENTS',\n};\n\nDSUploader.propTypes = propTypes;\n\nconst UploaderWithSchema = describe(DSUploader);\nUploaderWithSchema.propTypes = propTypes;\n\nexport { UploaderWithSchema };\nexport default DSUploader;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/index.d.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.d.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export interface DSUploaderPropsT {\n containerProps?: Record<string, unknown>;\n label?: string;\n icon?: React.FC<{ size: string }>;\n defaultActionLabel?: string;\n dragActiveInstructionalText?: string;\n dragActiveIcon?: React.FC;\n altActionLabel?: string;\n acceptedTypesText?: string;\n disabledDefault?: boolean;\n disabledAlt?: boolean;\n onDefaultHandlerClick?: () => void | null;\n onAltHandlerClick?: () => void | null;\n actions?: Record<string, unknown>;\n showAltAction?: boolean;\n defaultActionTooltipText: string;\n altActionTooltipText: string;\n}\n\nexport interface ActionButtonPropsT {\n labelText: string;\n variant: undefined | 'variant-disabled';\n onClick: () => void | null;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { default, UploaderWithSchema } from './DSUploader';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA4C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/propTypes.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { PropTypes } from 'react-desc';\nimport { UploadFile } from '@elliemae/ds-icons';\n/** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */\n\nexport const propTypes = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.'),\n validator: PropTypes.func.description(\n \"Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not.\",\n ),\n maxFiles: PropTypes.number.description('Number of files accepted.'),\n minSize: PropTypes.number.description('Minimun file size accepted in bytes.'),\n maxSize: PropTypes.number.description('Maximum file size accepted in bytes.'),\n onDropRejected: PropTypes.func.description(\n 'Cb called when files are rejected using maxFiles, minSize or maxSize properties.',\n ),\n disabled: PropTypes.bool.description('Disables the DSUploader.'),\n multiple: PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),\n accept: PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),\n\n label: PropTypes.string.description('Uploader label.').defaultValue('Browse'),\n icon: PropTypes.element.description('Uploader left icon.').defaultValue(UploadFile),\n actions: PropTypes.shape({\n defaultAction: PropTypes.string,\n altAction: PropTypes.string,\n })\n .description('Uploader actions.')\n .defaultValue({ defaultAction: 'LOCAL DRIVE' }),\n defaultActionLabel: PropTypes.string.description('First action button label.'),\n showAltAction: PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),\n altActionLabel: PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),\n dragActiveInstructionalText: PropTypes.string\n .description('informative text when user drags a file over the uploader zone.')\n .defaultValue('DROP FILES HERE'),\n dragActiveIcon: PropTypes.string.description('Icon when user drags a file over the uploader zone.'),\n acceptedTypesText: PropTypes.string\n .description('Information text to show what types are supported.')\n .defaultValue('JPG, JPEG, PNG, PDF'),\n disabledDefault: PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),\n disabledAlt: PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),\n onDefaultHandlerClick: PropTypes.func.description('First action button click handler.'),\n onAltHandlerClick: PropTypes.func.description('Second action button click handler.'),\n defaultActionTooltipText: PropTypes.string.description('shows tooltip in default action button.'),\n altActionTooltipText: PropTypes.string.description('Shows tooltip in alternate action button.'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAC1B,sBAA2B;AAGpB,MAAM,YAAY;AAAA,EACvB,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAC7C,WAAW,4BAAU,KAAK,YACxB;AAAA,EAEF,UAAU,4BAAU,OAAO,YAAY;AAAA,EACvC,SAAS,4BAAU,OAAO,YAAY;AAAA,EACtC,SAAS,4BAAU,OAAO,YAAY;AAAA,EACtC,gBAAgB,4BAAU,KAAK,YAC7B;AAAA,EAEF,UAAU,4BAAU,KAAK,YAAY;AAAA,EACrC,UAAU,4BAAU,KAAK,YAAY;AAAA,EACrC,QAAQ,4BAAU,OAAO,YAAY;AAAA,EAErC,OAAO,4BAAU,OAAO,YAAY,mBAAmB,aAAa;AAAA,EACpE,MAAM,4BAAU,QAAQ,YAAY,uBAAuB,aAAa;AAAA,EACxE,SAAS,4BAAU,MAAM;AAAA,IACvB,eAAe,4BAAU;AAAA,IACzB,WAAW,4BAAU;AAAA,KAEpB,YAAY,qBACZ,aAAa,EAAE,eAAe;AAAA,EACjC,oBAAoB,4BAAU,OAAO,YAAY;AAAA,EACjD,eAAe,4BAAU,KAAK,YAAY,mDAAmD,aAAa;AAAA,EAC1G,gBAAgB,4BAAU,OAAO,YAAY,+BAA+B,aAAa;AAAA,EACzF,6BAA6B,4BAAU,OACpC,YAAY,mEACZ,aAAa;AAAA,EAChB,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAC7C,mBAAmB,4BAAU,OAC1B,YAAY,sDACZ,aAAa;AAAA,EAChB,iBAAiB,4BAAU,KAAK,YAAY,oDAAoD,aAAa;AAAA,EAC7G,aAAa,4BAAU,KAAK,YAAY,wDAAwD,aAAa;AAAA,EAC7G,uBAAuB,4BAAU,KAAK,YAAY;AAAA,EAClD,mBAAmB,4BAAU,KAAK,YAAY;AAAA,EAC9C,0BAA0B,4BAAU,OAAO,YAAY;AAAA,EACvD,sBAAsB,4BAAU,OAAO,YAAY;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/esm/DSUploader.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSUploader.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { UploadFile } from '@elliemae/ds-icons';\nimport DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';\nimport { useDropzone } from 'react-dropzone';\nimport DSTooltip from '@elliemae/ds-tooltip';\nimport { propTypes } from './propTypes';\nimport type { DSUploaderPropsT, ActionButtonPropsT } from './index.d';\n\nconst blockName = 'uploader';\nconst blockNameInfo = `${blockName}-info`;\nconst blockNameDragActive = `${blockName}-drag-active`;\nconst blockNameWrapper = `${blockName}-wrapper`;\n\nconst UploaderWrapper = aggregatedClasses('div')(blockNameWrapper, null, ({ disabled }) => ({ disabled }));\nconst Uploader = aggregatedClasses('div')(blockName, null, ({ isDragActive }) => ({ 'drag-active': isDragActive }));\nconst UploaderDragActive = aggregatedClasses('div')(blockNameDragActive);\nconst UploaderIconArea = aggregatedClasses('div')(`${blockName}-icon-wrapper`);\nconst UploaderInfo = aggregatedClasses('div')(blockNameInfo);\nconst InfoText = aggregatedClasses('span')(blockNameInfo, 'text');\nconst UploaderActions = aggregatedClasses('div')(blockNameInfo, 'actions');\nconst AcceptedTypes = aggregatedClasses('div')(blockNameWrapper, 'accepted-types');\n\nconst DividerVertical = aggregatedClasses('div')('divider', null, ({ vertical }) => ({ vertical }));\n\nfunction ActionButton({ labelText, ...otherProps }: ActionButtonPropsT): React.ReactElement {\n return <DSButton {...otherProps} buttonType=\"text\" labelText={labelText} />;\n}\n\nconst noop = () => null;\n\nconst DSUploader = ({\n containerProps = {},\n label = 'Browse', // todo: i18n\n icon: UploadFileIcon = UploadFile,\n defaultActionLabel = 'LOCAL DRIVE', // todo: i18n\n dragActiveInstructionalText = 'DROP FILES HERE',\n dragActiveIcon: DragActiveIcon = UploadFile,\n altActionLabel = 'DOCUMENTS', // todo: i18n\n acceptedTypesText = 'JPG, JPEG, PNG, PDF',\n disabledDefault = false,\n disabledAlt = false,\n onDefaultHandlerClick = noop,\n onAltHandlerClick = noop,\n actions = { defaultAction: 'LOCAL DRIVE', altAction: 'DOCUMENTS' },\n showAltAction = false,\n defaultActionTooltipText,\n altActionTooltipText,\n ...dropzoneProps\n}: DSUploaderPropsT): JSX.Element => {\n const { getRootProps, getInputProps, isDragActive } = useDropzone(dropzoneProps);\n const { onClick: onOpenFile, ...rootProps } = getRootProps();\n const disabledAll = disabledDefault && disabledAlt;\n\n const delfaultActionButton = (\n <ActionButton\n variant={disabledDefault && BUTTON_VARIANT.DISABLED}\n labelText={actions.defaultAction ? (actions.defaultAction as string) : defaultActionLabel}\n onClick={(...args) => {\n if (!disabledDefault) runAll(onDefaultHandlerClick, onOpenFile)(...args);\n }}\n />\n );\n\n const altActionButton = (\n <ActionButton\n variant={disabledAlt && BUTTON_VARIANT.DISABLED}\n labelText={actions.altAction ? (actions.altAction as string) : altActionLabel}\n onClick={(...args) => {\n if (!disabledAlt) onAltHandlerClick(...args);\n }}\n />\n );\n\n const defaultAction = !defaultActionTooltipText ? (\n delfaultActionButton\n ) : (\n <DSTooltip\n containerProps={{ id: 'default-action-tooltip' }}\n interactionType=\"hover\"\n title={defaultActionTooltipText}\n triggerComponent={delfaultActionButton}\n />\n );\n\n const altAction = !altActionTooltipText ? (\n altActionButton\n ) : (\n <DSTooltip\n containerProps={{ id: 'alt-action-tooltip' }}\n interactionType=\"hover\"\n title={altActionTooltipText}\n triggerComponent={altActionButton}\n />\n );\n\n return (\n <UploaderWrapper {...containerProps} classProps={{ disabled: disabledAll }}>\n <Uploader {...rootProps} classProps={{ isDragActive }}>\n <UploaderIconArea>\n <UploadFileIcon size=\"l\" />\n </UploaderIconArea>\n <DividerVertical />\n <UploaderInfo>\n <InfoText>{label}</InfoText>\n <UploaderActions>\n {actions.defaultAction && defaultAction}\n {(actions.altAction || showAltAction) && (\n <>\n {actions.defaultAction && <DividerVertical />}\n {altAction}\n </>\n )}\n </UploaderActions>\n </UploaderInfo>\n {!disabledAll && (\n <UploaderDragActive>\n <DragActiveIcon />\n {dragActiveInstructionalText}\n </UploaderDragActive>\n )}\n {!disabledAll && <input {...getInputProps()} />}\n </Uploader>\n {typeof acceptedTypesText === 'string' && <AcceptedTypes>{acceptedTypesText.toUpperCase()}</AcceptedTypes>}\n </UploaderWrapper>\n );\n};\n\nDSUploader.actions = {\n defaultAction: 'LOCAL DRIVE',\n altAction: 'DOCUMENTS',\n};\n\nDSUploader.propTypes = propTypes;\n\nconst UploaderWithSchema = describe(DSUploader);\nUploaderWithSchema.propTypes = propTypes;\n\nexport { UploaderWithSchema };\nexport default DSUploader;\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/esm/index.d.js.map
DELETED
package/esm/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, UploaderWithSchema } from './DSUploader';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/esm/propTypes.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { UploadFile } from '@elliemae/ds-icons';\n/** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */\n\nexport const propTypes = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.'),\n validator: PropTypes.func.description(\n \"Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not.\",\n ),\n maxFiles: PropTypes.number.description('Number of files accepted.'),\n minSize: PropTypes.number.description('Minimun file size accepted in bytes.'),\n maxSize: PropTypes.number.description('Maximum file size accepted in bytes.'),\n onDropRejected: PropTypes.func.description(\n 'Cb called when files are rejected using maxFiles, minSize or maxSize properties.',\n ),\n disabled: PropTypes.bool.description('Disables the DSUploader.'),\n multiple: PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),\n accept: PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),\n\n label: PropTypes.string.description('Uploader label.').defaultValue('Browse'),\n icon: PropTypes.element.description('Uploader left icon.').defaultValue(UploadFile),\n actions: PropTypes.shape({\n defaultAction: PropTypes.string,\n altAction: PropTypes.string,\n })\n .description('Uploader actions.')\n .defaultValue({ defaultAction: 'LOCAL DRIVE' }),\n defaultActionLabel: PropTypes.string.description('First action button label.'),\n showAltAction: PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),\n altActionLabel: PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),\n dragActiveInstructionalText: PropTypes.string\n .description('informative text when user drags a file over the uploader zone.')\n .defaultValue('DROP FILES HERE'),\n dragActiveIcon: PropTypes.string.description('Icon when user drags a file over the uploader zone.'),\n acceptedTypesText: PropTypes.string\n .description('Information text to show what types are supported.')\n .defaultValue('JPG, JPEG, PNG, PDF'),\n disabledDefault: PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),\n disabledAlt: PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),\n onDefaultHandlerClick: PropTypes.func.description('First action button click handler.'),\n onAltHandlerClick: PropTypes.func.description('Second action button click handler.'),\n defaultActionTooltipText: PropTypes.string.description('shows tooltip in default action button.'),\n altActionTooltipText: PropTypes.string.description('Shows tooltip in alternate action button.'),\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AAGO,MAAM,YAAY;AAAA,EACvB,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAC7C,WAAW,UAAU,KAAK,YACxB;AAAA,EAEF,UAAU,UAAU,OAAO,YAAY;AAAA,EACvC,SAAS,UAAU,OAAO,YAAY;AAAA,EACtC,SAAS,UAAU,OAAO,YAAY;AAAA,EACtC,gBAAgB,UAAU,KAAK,YAC7B;AAAA,EAEF,UAAU,UAAU,KAAK,YAAY;AAAA,EACrC,UAAU,UAAU,KAAK,YAAY;AAAA,EACrC,QAAQ,UAAU,OAAO,YAAY;AAAA,EAErC,OAAO,UAAU,OAAO,YAAY,mBAAmB,aAAa;AAAA,EACpE,MAAM,UAAU,QAAQ,YAAY,uBAAuB,aAAa;AAAA,EACxE,SAAS,UAAU,MAAM;AAAA,IACvB,eAAe,UAAU;AAAA,IACzB,WAAW,UAAU;AAAA,KAEpB,YAAY,qBACZ,aAAa,EAAE,eAAe;AAAA,EACjC,oBAAoB,UAAU,OAAO,YAAY;AAAA,EACjD,eAAe,UAAU,KAAK,YAAY,mDAAmD,aAAa;AAAA,EAC1G,gBAAgB,UAAU,OAAO,YAAY,+BAA+B,aAAa;AAAA,EACzF,6BAA6B,UAAU,OACpC,YAAY,mEACZ,aAAa;AAAA,EAChB,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAC7C,mBAAmB,UAAU,OAC1B,YAAY,sDACZ,aAAa;AAAA,EAChB,iBAAiB,UAAU,KAAK,YAAY,oDAAoD,aAAa;AAAA,EAC7G,aAAa,UAAU,KAAK,YAAY,wDAAwD,aAAa;AAAA,EAC7G,uBAAuB,UAAU,KAAK,YAAY;AAAA,EAClD,mBAAmB,UAAU,KAAK,YAAY;AAAA,EAC9C,0BAA0B,UAAU,OAAO,YAAY;AAAA,EACvD,sBAAsB,UAAU,OAAO,YAAY;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|