@luminati-io/uikit 3.6.10 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -35177,12 +35177,16 @@ var FileUploader = function FileUploader(props) {
|
|
35177
35177
|
flex_direction: "column",
|
35178
35178
|
gap: "03"
|
35179
35179
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_upload_base__WEBPACK_IMPORTED_MODULE_3__.UploadBase, {
|
35180
|
-
label: label
|
35180
|
+
label: label,
|
35181
|
+
onFileUpload: onFileUpload,
|
35182
|
+
multi: multi,
|
35183
|
+
accept: accept
|
35181
35184
|
}), files.map(function (file) {
|
35182
35185
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_upload_item__WEBPACK_IMPORTED_MODULE_4__.UploadItem, _extends({
|
35183
35186
|
key: file.name + file.size,
|
35184
35187
|
fileInfoFormatter: fileInfoFormatter,
|
35185
|
-
antiVirusScanText: antiVirusScanText
|
35188
|
+
antiVirusScanText: antiVirusScanText,
|
35189
|
+
onFileDelete: onFileDelete
|
35186
35190
|
}, file));
|
35187
35191
|
}));
|
35188
35192
|
};
|
@@ -35267,6 +35271,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
35267
35271
|
|
35268
35272
|
|
35269
35273
|
/*jslint react:true*/
|
35274
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
35275
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
35276
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
35277
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
35278
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
35279
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
35270
35280
|
|
35271
35281
|
|
35272
35282
|
|
@@ -35280,10 +35290,62 @@ var border = function border(color) {
|
|
35280
35290
|
var UploadBaseContainer = styled_components__WEBPACK_IMPORTED_MODULE_1___default().div.withConfig({
|
35281
35291
|
displayName: "UploadBaseContainer",
|
35282
35292
|
componentId: "sc-1e3miai-0"
|
35283
|
-
})(["background-image:", ";&:hover{
|
35293
|
+
})(["background-image:", ";&:hover{cursor:pointer;}border-radius:4px;"], function (_ref) {
|
35294
|
+
var $isHovered = _ref.$isHovered;
|
35295
|
+
return border($isHovered ? _theme__WEBPACK_IMPORTED_MODULE_5__["default"].color.blue_11 : _theme__WEBPACK_IMPORTED_MODULE_5__["default"].color.gray_6);
|
35296
|
+
});
|
35284
35297
|
var UploadBase = function UploadBase(props) {
|
35285
|
-
var label = props.label
|
35286
|
-
|
35298
|
+
var label = props.label,
|
35299
|
+
onFileUpload = props.onFileUpload,
|
35300
|
+
multi = props.multi,
|
35301
|
+
accept = props.accept;
|
35302
|
+
var inputRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);
|
35303
|
+
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false),
|
35304
|
+
_useState2 = _slicedToArray(_useState, 2),
|
35305
|
+
isHovered = _useState2[0],
|
35306
|
+
setIsHovered = _useState2[1];
|
35307
|
+
var setHovered = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {
|
35308
|
+
return setIsHovered(true);
|
35309
|
+
}, [setIsHovered]);
|
35310
|
+
var setNotHovered = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {
|
35311
|
+
return setIsHovered(false);
|
35312
|
+
}, [setIsHovered]);
|
35313
|
+
var onDragOver = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (e) {
|
35314
|
+
e.preventDefault();
|
35315
|
+
setHovered();
|
35316
|
+
}, [setHovered]);
|
35317
|
+
var onDrop = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (e) {
|
35318
|
+
e.preventDefault();
|
35319
|
+
var files = e.dataTransfer.files;
|
35320
|
+
for (var i = 0; i < files.length; i++) onFileUpload(files[i]);
|
35321
|
+
}, [onFileUpload]);
|
35322
|
+
var onClick = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (e) {
|
35323
|
+
var _inputRef$current;
|
35324
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.click();
|
35325
|
+
}, [inputRef]);
|
35326
|
+
var onFileChange = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (e) {
|
35327
|
+
e.preventDefault();
|
35328
|
+
var files = e.target.files;
|
35329
|
+
for (var i = 0; i < files.length; i++) onFileUpload(files[i]);
|
35330
|
+
}, [onFileUpload]);
|
35331
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(UploadBaseContainer, {
|
35332
|
+
onDragOver: onDragOver,
|
35333
|
+
onDragLeave: setNotHovered,
|
35334
|
+
onMouseEnter: setHovered,
|
35335
|
+
onMouseLeave: setNotHovered,
|
35336
|
+
onDrop: onDrop,
|
35337
|
+
onClick: onClick,
|
35338
|
+
$isHovered: isHovered
|
35339
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement("input", {
|
35340
|
+
ref: inputRef,
|
35341
|
+
type: "file",
|
35342
|
+
accept: accept,
|
35343
|
+
multiple: multi,
|
35344
|
+
style: {
|
35345
|
+
display: 'none'
|
35346
|
+
},
|
35347
|
+
onChange: onFileChange
|
35348
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_3__.Flex, {
|
35287
35349
|
flex_direction: "column",
|
35288
35350
|
align_items: "center",
|
35289
35351
|
gap: "03",
|
@@ -35308,7 +35370,10 @@ var UploadBase = function UploadBase(props) {
|
|
35308
35370
|
};
|
35309
35371
|
UploadBase.displayName = 'UploadBase';
|
35310
35372
|
UploadBase.propTypes = {
|
35311
|
-
|
35373
|
+
onFileUpload: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
|
35374
|
+
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
|
35375
|
+
multi: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
|
35376
|
+
accept: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
|
35312
35377
|
};
|
35313
35378
|
|
35314
35379
|
/***/ }),
|
@@ -35389,7 +35454,11 @@ var UploadItem = function UploadItem(props) {
|
|
35389
35454
|
progress = props.progress,
|
35390
35455
|
icon = props.icon,
|
35391
35456
|
fileInfoFormatter = props.fileInfoFormatter,
|
35392
|
-
antiVirusScanText = props.antiVirusScanText
|
35457
|
+
antiVirusScanText = props.antiVirusScanText,
|
35458
|
+
onFileDelete = props.onFileDelete;
|
35459
|
+
var onDelete = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {
|
35460
|
+
onFileDelete(id);
|
35461
|
+
}, [id, onFileDelete]);
|
35393
35462
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(UploadItemContainer, {
|
35394
35463
|
$error: status == _constants__WEBPACK_IMPORTED_MODULE_9__.FILE_STATUS.ERROR
|
35395
35464
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(UploadItemBody, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_upload_item_icon__WEBPACK_IMPORTED_MODULE_7__.UploadItemIcon, {
|
@@ -35405,9 +35474,10 @@ var UploadItem = function UploadItem(props) {
|
|
35405
35474
|
progress: progress,
|
35406
35475
|
error: error
|
35407
35476
|
}))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_icon_button__WEBPACK_IMPORTED_MODULE_6__.IconButton, {
|
35408
|
-
icon: "
|
35477
|
+
icon: "Trash",
|
35409
35478
|
variant: "icon",
|
35410
|
-
size: "md"
|
35479
|
+
size: "md",
|
35480
|
+
onClick: onDelete
|
35411
35481
|
}));
|
35412
35482
|
};
|
35413
35483
|
UploadItem.displayName = 'UploadItem';
|