Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-view-files

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-view-files - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

dist/App.js

98

dist/components/ContentViewer/index.js

@@ -11,2 +11,3 @@ "use strict";

var _ContentViewerModule = _interopRequireDefault(require("./ContentViewer.module.scss"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -74,44 +75,59 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

};
return /*#__PURE__*/_react["default"].createElement("div", {
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "".concat(_ContentViewerModule["default"]["container-viewer"], " ").concat(contentVisible ? _ContentViewerModule["default"]["container-viewer--show"] : null),
ref: containerRef
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ContentViewerModule["default"]["container-viewer__header"], " ").concat(!(loadFiles !== null && loadFiles !== void 0 && loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) ? _ContentViewerModule["default"]["container-viewer__header--dark"] : "")
}, fileExtension !== null && fileExtension !== void 0 && fileExtension.name ? /*#__PURE__*/_react["default"].createElement("div", {
className: "d-flex align-items-center"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["file__icon"]
}, /*#__PURE__*/_react["default"].createElement("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: file === null || file === void 0 ? void 0 : file.name
})), /*#__PURE__*/_react["default"].createElement("div", {
className: "pl-1"
}, file === null || file === void 0 ? void 0 : file.name, ".", fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name)) : /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["viewer-actions"]
}, (loadFiles === null || loadFiles === void 0 ? void 0 : loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) && /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["viewer-actions__link"],
onClick: function onClick() {
return downloadFile();
}
}, /*#__PURE__*/_react["default"].createElement(_md.MdOutlineFileDownload, null)), /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["viewer-actions__link"],
onClick: function onClick() {
resetOverflowY();
setContentVisible(false);
onClose === null || onClose === void 0 || onClose();
setFileExtension(null);
}
}, /*#__PURE__*/_react["default"].createElement(_md.MdOutlineClose, null)))), /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["container-viewer__content"],
id: "viewer-content"
}, children), !(loadFiles !== null && loadFiles !== void 0 && loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) && /*#__PURE__*/_react["default"].createElement("div", {
className: _ContentViewerModule["default"]["container-viewer__no-file"]
}, /*#__PURE__*/_react["default"].createElement("div", {
style: {
marginBottom: "20px"
}
}, /*#__PURE__*/_react["default"].createElement("img", {
src: require("../../img/corrupted-file.png"),
alt: "Corrupted File"
})), /*#__PURE__*/_react["default"].createElement("div", null, "Algo deu errado."), /*#__PURE__*/_react["default"].createElement("div", null, "N\xE3o foi poss\xEDvel gerar uma visualiza\xE7\xE3o para este arquivo.")));
ref: containerRef,
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "".concat(_ContentViewerModule["default"]["container-viewer__header"], " ").concat(!(loadFiles !== null && loadFiles !== void 0 && loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) ? _ContentViewerModule["default"]["container-viewer__header--dark"] : ""),
children: [fileExtension !== null && fileExtension !== void 0 && fileExtension.name ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "d-flex align-items-center",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: _ContentViewerModule["default"]["file__icon"],
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: file === null || file === void 0 ? void 0 : file.name
})
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "pl-1",
children: [file === null || file === void 0 ? void 0 : file.name, ".", fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name]
})]
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: _ContentViewerModule["default"]["viewer-actions"],
children: [(loadFiles === null || loadFiles === void 0 ? void 0 : loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: _ContentViewerModule["default"]["viewer-actions__link"],
onClick: function onClick() {
return downloadFile();
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineFileDownload, {})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: _ContentViewerModule["default"]["viewer-actions__link"],
onClick: function onClick() {
resetOverflowY();
setContentVisible(false);
onClose === null || onClose === void 0 || onClose();
setFileExtension(null);
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineClose, {})
})]
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: _ContentViewerModule["default"]["container-viewer__content"],
id: "viewer-content",
children: children
}), !(loadFiles !== null && loadFiles !== void 0 && loadFiles.includes(fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type)) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: _ContentViewerModule["default"]["container-viewer__no-file"],
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
style: {
marginBottom: "20px"
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src: require("../../img/corrupted-file.png"),
alt: "Corrupted File"
})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: "Algo deu errado."
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: "N\xE3o foi poss\xEDvel gerar uma visualiza\xE7\xE3o para este arquivo."
})]
})]
});
}

@@ -12,2 +12,3 @@ "use strict";

require("./DropdownMenuOptions.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -88,37 +89,44 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

};
return /*#__PURE__*/_react["default"].createElement("div", {
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "dmc-dropdown-menu-container",
ref: dropdownRef
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "dropdown__header",
onClick: function onClick(event) {
return handleToggleDropdown(event);
}
}, /*#__PURE__*/_react["default"].createElement(_md.MdMoreVert, {
className: "dmc-dropdown-icon"
})), /*#__PURE__*/_react["default"].createElement("div", {
className: "dropdown__content ".concat(dropdownOpen ? "visible" : "", " ").concat(direction === "top" ? "reverse" : ""),
ref: dropdownContentRef,
style: {
top: position.top,
left: position.left
}
}, /*#__PURE__*/_react["default"].createElement("ul", {
ref: childRef
}, options === null || options === void 0 ? void 0 : options.map(function (option, index) {
return /*#__PURE__*/_react["default"].createElement("li", {
className: "dropdow__item",
key: index,
onClick: function onClick() {
handleNavigateItem(option === null || option === void 0 ? void 0 : option.url, option === null || option === void 0 ? void 0 : option.redirect);
onClicked === null || onClicked === void 0 || onClicked(option);
}
}, option.icon && /*#__PURE__*/_react["default"].createElement("span", {
ref: dropdownRef,
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "dropdown__header",
onClick: function onClick(event) {
return handleToggleDropdown(event);
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdMoreVert, {
className: "dmc-dropdown-icon"
})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "dropdown__content ".concat(dropdownOpen ? "visible" : "", " ").concat(direction === "top" ? "reverse" : ""),
ref: dropdownContentRef,
style: {
fontSize: "20px",
color: "#8995a7",
display: "flex"
}
}, option.icon), /*#__PURE__*/_react["default"].createElement("span", null, option.name));
}))));
top: position.top,
left: position.left
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
ref: childRef,
children: options === null || options === void 0 ? void 0 : options.map(function (option, index) {
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
className: "dropdow__item",
onClick: function onClick() {
handleNavigateItem(option === null || option === void 0 ? void 0 : option.url, option === null || option === void 0 ? void 0 : option.redirect);
onClicked === null || onClicked === void 0 || onClicked(option);
},
children: [option.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
style: {
fontSize: "20px",
color: "#8995a7",
display: "flex"
},
children: option.icon
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
children: option.name
})]
}, index);
})
})
})]
});
}

@@ -10,2 +10,3 @@ "use strict";

require("./Input.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -54,22 +55,24 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

};
return /*#__PURE__*/_react["default"].createElement("div", {
className: 'input__container'
}, /*#__PURE__*/_react["default"].createElement("label", {
htmlFor: inputRef,
className: 'label'
}, label), !money && /*#__PURE__*/_react["default"].createElement("input", {
type: type,
ref: inputRef,
value: input,
onChange: function onChange(event) {
_onChange === null || _onChange === void 0 || _onChange(event.target.value);
changeInput(event);
},
className: "input ".concat(className),
disabled: disabled || false,
placeholder: placeholder,
min: min,
max: max,
maxLength: maxLength
}), money && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null));
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: 'input__container',
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
htmlFor: inputRef,
className: 'label',
children: label
}), !money && /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
type: type,
ref: inputRef,
value: input,
onChange: function onChange(event) {
_onChange === null || _onChange === void 0 || _onChange(event.target.value);
changeInput(event);
},
className: "input ".concat(className),
disabled: disabled || false,
placeholder: placeholder,
min: min,
max: max,
maxLength: maxLength
}), money && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {})]
});
}

@@ -19,2 +19,3 @@ "use strict";

require("./MediaPreview.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -96,3 +97,3 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

name: translate("Visualizar"),
icon: /*#__PURE__*/_react["default"].createElement(_md.MdOutlineRemoveRedEye, null),
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineRemoveRedEye, {}),
redirect: false,

@@ -102,3 +103,3 @@ action: "view"

name: translate("Renomear"),
icon: /*#__PURE__*/_react["default"].createElement(_md.MdOutlineDriveFileRenameOutline, null),
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineDriveFileRenameOutline, {}),
redirect: false,

@@ -108,3 +109,3 @@ action: "rename"

name: translate("Download"),
icon: /*#__PURE__*/_react["default"].createElement(_md.MdOutlineFileDownload, null),
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineFileDownload, {}),
redirect: false,

@@ -114,3 +115,3 @@ action: "download"

name: translate("Remover"),
icon: /*#__PURE__*/_react["default"].createElement(_md.MdDeleteOutline, null),
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdDeleteOutline, {}),
redirect: false,

@@ -450,115 +451,145 @@ action: "delete"

};
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
className: "media-preview-container",
onDoubleClick: function onDoubleClick() {
return onClick === null || onClick === void 0 ? void 0 : onClick(selectedFile, fileExtension);
},
ref: containerRef
}, (thumbnail || !(allExtensions !== null && allExtensions !== void 0 && allExtensions.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type))) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
id: "viewer-thumbnail",
className: "viewer-thumbnail",
style: _objectSpread(_objectSpread(_objectSpread({
backgroundImage: "url(".concat(thumbnail, ")"),
width: (style === null || style === void 0 ? void 0 : style.width) || "100%",
height: (style === null || style === void 0 ? void 0 : style.height) || "200px",
backgroundSize: style !== null && style !== void 0 && style.backgroundSize ? style === null || style === void 0 ? void 0 : style.backgroundSize : "cover",
backgroundPosition: "top"
}, (fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type) === "txt" && {
backgroundSize: "250px",
backgroundPosition: "center 10px"
}), (fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type) === "word" && {
backgroundSize: "580px",
backgroundPosition: "center -30px"
}), {}, {
backgroundRepeat: "no-repeat"
}),
ref: mediaPreviewRef
}), displayFooter && /*#__PURE__*/_react["default"].createElement("div", {
className: "viewer-thumbnail__footer"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "d-flex align-items-center",
style: {
overflow: "hidden"
}
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "file__icon"
}, /*#__PURE__*/_react["default"].createElement("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
})), /*#__PURE__*/_react["default"].createElement("div", {
className: "d-flex align-items-center ml-2",
style: {
overflow: "hidden"
}
}, /*#__PURE__*/_react["default"].createElement("p", {
style: {
textOverflow: "ellipsis",
overflow: "hidden",
whiteSpace: "nowrap"
},
title: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
}, selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name), ".", /*#__PURE__*/_react["default"].createElement("p", null, fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name))), !hideDropdown && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_DropdownMenuOptions["default"], {
options: dropdownOptions,
onClicked: function onClicked(value) {
return handleDropdownSelection(value);
}
}))), cover && /*#__PURE__*/_react["default"].createElement("div", {
className: "cover__preview"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "cover__preview__name"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "file__icon"
}, /*#__PURE__*/_react["default"].createElement("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
})), /*#__PURE__*/_react["default"].createElement("span", null, selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name, ".", fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name)), /*#__PURE__*/_react["default"].createElement("div", {
className: "file__size"
}, (selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.size) || fileSize), /*#__PURE__*/_react["default"].createElement("div", {
className: "w-100 d-flex justify-content-center"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "file__download",
onClick: function onClick() {
return downloadFile();
}
}, /*#__PURE__*/_react["default"].createElement(_md.MdDownload, null))))), !thumbnail && (allExtensions === null || allExtensions === void 0 ? void 0 : allExtensions.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type)) && /*#__PURE__*/_react["default"].createElement("div", {
className: "loading-preview",
ref: loadRef,
style: {
minWidthidth: (style === null || style === void 0 ? void 0 : style.width) || "100%",
width: (style === null || style === void 0 ? void 0 : style.width) || "100%",
minHeight: (style === null || style === void 0 ? void 0 : style.height) || "200px",
height: (style === null || style === void 0 ? void 0 : style.height) || "200px"
}
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "loader"
}))), /*#__PURE__*/_react["default"].createElement(_Modal.Modal, {
show: activeRename,
alignment: "center",
content: "small"
}, /*#__PURE__*/_react["default"].createElement(_Modal.ModalBody, null, /*#__PURE__*/_react["default"].createElement("span", {
className: "mb-3"
}, "Renomear"), /*#__PURE__*/_react["default"].createElement(_Input["default"], {
type: "text",
className: "mpc-container__input-rename",
value: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name,
onFocused: true,
onChange: function onChange(value) {
return setChangeFilename(value);
}
}), /*#__PURE__*/_react["default"].createElement("div", {
className: "d-flex align-items-center justify-content-end gap-1 mt-3"
}, /*#__PURE__*/_react["default"].createElement("button", {
onClick: function onClick() {
return setActiveRename(false);
},
className: "media-preview-button media-preview-button__cancel"
}, "Cancelar"), /*#__PURE__*/_react["default"].createElement("button", {
onClick: function onClick() {
setSelectedFile(_objectSpread(_objectSpread({}, selectedFile), {}, {
name: changeFilename
}));
setActiveRename(false);
},
className: "media-preview-button media-preview-button__save"
}, "Salvar")))));
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "media-preview-container",
onDoubleClick: function onDoubleClick() {
return onClick === null || onClick === void 0 ? void 0 : onClick(selectedFile, fileExtension);
},
ref: containerRef,
children: [(thumbnail || !(allExtensions !== null && allExtensions !== void 0 && allExtensions.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type))) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
id: "viewer-thumbnail",
className: "viewer-thumbnail",
style: _objectSpread(_objectSpread(_objectSpread({
backgroundImage: "url(".concat(thumbnail, ")"),
width: (style === null || style === void 0 ? void 0 : style.width) || "100%",
height: (style === null || style === void 0 ? void 0 : style.height) || "200px",
backgroundSize: style !== null && style !== void 0 && style.backgroundSize ? style === null || style === void 0 ? void 0 : style.backgroundSize : "cover",
backgroundPosition: "top"
}, (fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type) === "txt" && {
backgroundSize: "250px",
backgroundPosition: "center 10px"
}), (fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type) === "word" && {
backgroundSize: "580px",
backgroundPosition: "center -30px"
}), {}, {
backgroundRepeat: "no-repeat"
}),
ref: mediaPreviewRef
}), displayFooter && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "viewer-thumbnail__footer",
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "d-flex align-items-center",
style: {
overflow: "hidden"
},
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "file__icon",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
})
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "d-flex align-items-center ml-2",
style: {
overflow: "hidden"
},
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
style: {
textOverflow: "ellipsis",
overflow: "hidden",
whiteSpace: "nowrap"
},
title: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name,
children: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
}), ".", /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
children: fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name
})]
})]
}), !hideDropdown && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DropdownMenuOptions["default"], {
options: dropdownOptions,
onClicked: function onClicked(value) {
return handleDropdownSelection(value);
}
})
})]
}), cover && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "cover__preview",
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "cover__preview__name",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "file__icon",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src: icons[fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.type],
alt: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name
})
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
children: [selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name, ".", fileExtension === null || fileExtension === void 0 ? void 0 : fileExtension.name]
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "file__size",
children: (selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.size) || fileSize
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "w-100 d-flex justify-content-center",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "file__download",
onClick: function onClick() {
return downloadFile();
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdDownload, {})
})
})]
})]
}), !thumbnail && (allExtensions === null || allExtensions === void 0 ? void 0 : allExtensions.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type)) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "loading-preview",
ref: loadRef,
style: {
minWidthidth: (style === null || style === void 0 ? void 0 : style.width) || "100%",
width: (style === null || style === void 0 ? void 0 : style.width) || "100%",
minHeight: (style === null || style === void 0 ? void 0 : style.height) || "200px",
height: (style === null || style === void 0 ? void 0 : style.height) || "200px"
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "loader"
})
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
show: activeRename,
alignment: "center",
content: "small",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Modal.ModalBody, {
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
className: "mb-3",
children: "Renomear"
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Input["default"], {
type: "text",
className: "mpc-container__input-rename",
value: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name,
onFocused: true,
onChange: function onChange(value) {
return setChangeFilename(value);
}
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "d-flex align-items-center justify-content-end gap-1 mt-3",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
onClick: function onClick() {
return setActiveRename(false);
},
className: "media-preview-button media-preview-button__cancel",
children: "Cancelar"
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
onClick: function onClick() {
setSelectedFile(_objectSpread(_objectSpread({}, selectedFile), {}, {
name: changeFilename
}));
setActiveRename(false);
},
className: "media-preview-button media-preview-button__save",
children: "Salvar"
})]
})]
})
})]
});
};

@@ -565,0 +596,0 @@ MediaPreview.propTypes = {

@@ -19,2 +19,3 @@ "use strict";

var _extensions = require("../../extensions");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -65,42 +66,44 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

};
return /*#__PURE__*/_react["default"].createElement("div", {
id: "media-view-container"
}, /*#__PURE__*/_react["default"].createElement(_MediaPreview.MediaPreview, {
file: selectedFile,
displayFooter: true,
onClick: function onClick(value, extension) {
return handleView(value, extension);
}
}), visible && /*#__PURE__*/_react["default"].createElement(_ContentViewer["default"], {
file: selectedFile,
type: fileExtension,
visible: visible,
onClose: function onClose() {
return closedContent();
}
}, word.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewDocx["default"], {
file: selectedFile
}), pdf.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewPDF["default"], {
file: selectedFile
}), image.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewImage["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), video.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewVideo["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), audio.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewAudio["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), txt.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/_react["default"].createElement(_MediaViewTXT["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
})));
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
id: "media-view-container",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaPreview.MediaPreview, {
file: selectedFile,
displayFooter: true,
onClick: function onClick(value, extension) {
return handleView(value, extension);
}
}), visible && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ContentViewer["default"], {
file: selectedFile,
type: fileExtension,
visible: visible,
onClose: function onClose() {
return closedContent();
},
children: [word.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewDocx["default"], {
file: selectedFile
}), pdf.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewPDF["default"], {
file: selectedFile
}), image.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewImage["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), video.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewVideo["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), audio.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewAudio["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
}), txt.includes(selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaViewTXT["default"], {
file: selectedFile,
onLink: function onLink(value) {
return setChildrenLink(value);
}
})]
})]
});
};

@@ -107,0 +110,0 @@ MediaView.propTypes = {

@@ -10,2 +10,3 @@ "use strict";

require("./style.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -42,12 +43,13 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

};
return /*#__PURE__*/_react["default"].createElement("div", {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "d-flex align-items-center",
style: {
marginTop: '50%'
}
}, /*#__PURE__*/_react["default"].createElement("audio", {
src: link,
type: file === null || file === void 0 ? void 0 : file.type,
controls: true
}));
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("audio", {
src: link,
type: file === null || file === void 0 ? void 0 : file.type,
controls: true
})
});
}

@@ -9,2 +9,3 @@ "use strict";

var _react = _interopRequireWildcard(require("react"));
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -67,5 +68,5 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

}
return /*#__PURE__*/_react["default"].createElement("div", {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
id: "media-view-docx"
});
}

@@ -10,2 +10,3 @@ "use strict";

require("./style.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -42,8 +43,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

};
return /*#__PURE__*/_react["default"].createElement("div", {
className: "view__image"
}, /*#__PURE__*/_react["default"].createElement("img", {
src: link,
alt: file === null || file === void 0 ? void 0 : file.name
}));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "view__image",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src: link,
alt: file === null || file === void 0 ? void 0 : file.name
})
});
}

@@ -11,2 +11,3 @@ "use strict";

require("react-pdf/dist/esm/Page/AnnotationLayer.css");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -30,13 +31,19 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

}
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("center", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactPdf.Document, {
file: file,
onLoadSuccess: onDocumentLoadSuccess
}, Array.from(new Array(numPages), function (el, index) {
return /*#__PURE__*/_react["default"].createElement(_reactPdf.Page, {
key: "page_".concat(index + 1),
pageNumber: index + 1,
renderTextLayer: false,
className: "mb-3"
});
})))));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("center", {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
file: file,
onLoadSuccess: onDocumentLoadSuccess,
children: Array.from(new Array(numPages), function (el, index) {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
pageNumber: index + 1,
renderTextLayer: false,
className: "mb-3"
}, "page_".concat(index + 1));
})
})
})
})
});
}

@@ -10,2 +10,3 @@ "use strict";

var _MediaViewTXTModule = _interopRequireDefault(require("./MediaViewTXT.module.scss"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -78,7 +79,8 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

};
return /*#__PURE__*/_react["default"].createElement("div", {
className: _MediaViewTXTModule["default"]['mvtc-media-view-txt-container']
}, /*#__PURE__*/_react["default"].createElement("pre", {
id: "fileContent"
}));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: _MediaViewTXTModule["default"]['mvtc-media-view-txt-container'],
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
id: "fileContent"
})
});
}

@@ -10,2 +10,3 @@ "use strict";

require("./style.scss");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }

@@ -42,9 +43,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }

};
return /*#__PURE__*/_react["default"].createElement("div", {
className: "view__video"
}, /*#__PURE__*/_react["default"].createElement("video", {
src: link,
type: file === null || file === void 0 ? void 0 : file.type,
controls: true
}));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "view__video",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("video", {
src: link,
type: file === null || file === void 0 ? void 0 : file.type,
controls: true
})
});
}

@@ -9,5 +9,6 @@ "use strict";

var _ModalModule = _interopRequireDefault(require("./Modal.module.scss"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var ModalOverlay = function ModalOverlay() {
return /*#__PURE__*/_react["default"].createElement("div", {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['modal-overlay'])

@@ -20,7 +21,9 @@ });

var size = options.size;
return /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['dialog'])
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['content'], " ").concat(size ? _ModalModule["default"][size] : _ModalModule["default"]['small'])
}, children));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['dialog']),
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['content'], " ").concat(size ? _ModalModule["default"][size] : _ModalModule["default"]['small']),
children: children
})
});
};

@@ -34,9 +37,11 @@ var Modal = exports.Modal = function Modal(_ref2, props) {

if (show) {
return /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['modal-container'], " ").concat(alignment ? _ModalModule["default"]["flex-".concat(alignment)] : _ModalModule["default"]['flex-center'], " ").concat(content ? _ModalModule["default"]["content-".concat(content)] : '', " ").concat(_ModalModule["default"][theme])
}, /*#__PURE__*/_react["default"].createElement(ModalOverlay, null), /*#__PURE__*/_react["default"].createElement(ModalDialogContent, {
options: props
}, children));
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "".concat(_ModalModule["default"]['modal-container'], " ").concat(alignment ? _ModalModule["default"]["flex-".concat(alignment)] : _ModalModule["default"]['flex-center'], " ").concat(content ? _ModalModule["default"]["content-".concat(content)] : '', " ").concat(_ModalModule["default"][theme]),
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ModalOverlay, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalDialogContent, {
options: props,
children: children
})]
});
}
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
};

@@ -47,24 +52,30 @@ var ModalHeader = exports.ModalHeader = function ModalHeader(_ref3) {

onClose = _ref3.onClose;
return /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['header__modal'])
}, /*#__PURE__*/_react["default"].createElement("h4", {
className: "".concat(_ModalModule["default"]['modal__title'])
}, children), closeButton && /*#__PURE__*/_react["default"].createElement("span", {
className: "material-icons ".concat(_ModalModule["default"]['close__modal']),
onClick: onClose
}, "close"));
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "".concat(_ModalModule["default"]['header__modal']),
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h4", {
className: "".concat(_ModalModule["default"]['modal__title']),
children: children
}), closeButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
className: "material-icons ".concat(_ModalModule["default"]['close__modal']),
onClick: onClose,
children: "close"
})]
});
};
var ModalBody = exports.ModalBody = function ModalBody(_ref4) {
var children = _ref4.children;
return /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['body'])
}, children);
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['body']),
children: children
});
};
var ModalFooter = exports.ModalFooter = function ModalFooter(_ref5) {
var children = _ref5.children;
return /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['footer-modal'])
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "".concat(_ModalModule["default"]['footer-modal__buttons'])
}, children));
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['footer-modal']),
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "".concat(_ModalModule["default"]['footer-modal__buttons']),
children: children
})
});
};
{
"name": "react-view-files",
"version": "1.0.6",
"version": "1.0.7",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc