@bigbinary/neeto-molecules 3.6.0-beta-1 → 3.6.0-beta-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/dist/Builder.js +1 -1
- package/dist/FileUpload.js +115 -86
- package/dist/FileUpload.js.map +1 -1
- package/dist/FloatingActionMenu.js +31 -18
- package/dist/FloatingActionMenu.js.map +1 -1
- package/dist/Onboarding.js +1 -1
- package/dist/Onboarding.js.map +1 -1
- package/dist/ProductEmbed.js +10 -7
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/SessionEnvironment.js +2 -2
- package/dist/SessionEnvironment.js.map +1 -1
- package/dist/cjs/Builder.js +1 -1
- package/dist/cjs/FileUpload.js +116 -87
- package/dist/cjs/FileUpload.js.map +1 -1
- package/dist/cjs/FloatingActionMenu.js +29 -16
- package/dist/cjs/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/Onboarding.js +1 -1
- package/dist/cjs/Onboarding.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +10 -7
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/dist/cjs/SessionEnvironment.js +2 -2
- package/dist/cjs/SessionEnvironment.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +1 -0
- package/types/FileUpload.d.ts +0 -2
package/dist/Builder.js
CHANGED
|
@@ -27,7 +27,7 @@ import '@bigbinary/neeto-icons/MenuHorizontal';
|
|
|
27
27
|
import '@bigbinary/neeto-icons/MenuVertical';
|
|
28
28
|
import '@bigbinary/neetoui/Dropdown';
|
|
29
29
|
|
|
30
|
-
var css = ":root{--neeto-molecule-builder-left-sidebar-width:288px;--neeto-molecule-builder-left-sidebar-width-lg:360px;--neeto-molecule-builder-left-sidebar-header-height:70px;--neeto-molecule-builder-left-sidebar-search-height:40px;--neeto-molecule-builder-right-sidebar-width:420px}.neeto-molecules-builder-elements-list-panel__wrapper{height:100%;min-width:360px;min-width:var(--neeto-molecule-builder-left-sidebar-width-lg);position:relative;transition:all .15s;width:360px;width:var(--neeto-molecule-builder-left-sidebar-width-lg);z-index:101}@media screen and (min-width:768px) and (max-width:1279px){.neeto-molecules-builder-elements-list-panel__wrapper{min-width:288px;min-width:var(--neeto-molecule-builder-left-sidebar-width);width:288px;width:var(--neeto-molecule-builder-left-sidebar-width)}}@media screen and (max-width:767px){.neeto-molecules-builder-elements-list-panel__wrapper{left:0;position:fixed;top:0;transition:none}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__wrapper{height:100%;max-width:100%;min-width:0;width:100%}}.neeto-molecules-builder-elements-list-panel__wrapper--collapsed{max-width:0;min-width:0;width:0}.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{transform:scale(-1)}@media screen and (max-width:767px){.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{top:109px}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{left:8px;right:auto}}.neeto-molecules-builder-elements-list-panel__container{height:100%;overflow:hidden;width:100%}.neeto-molecules-builder-elements-list-panel{border-right:1px solid rgb(var(--neeto-ui-gray-200));height:100%;min-width:360px;min-width:var(--neeto-molecule-builder-left-sidebar-width-lg);width:360px;width:var(--neeto-molecule-builder-left-sidebar-width-lg)}@media screen and (min-width:768px) and (max-width:1279px){.neeto-molecules-builder-elements-list-panel{min-width:288px;min-width:var(--neeto-molecule-builder-left-sidebar-width);width:288px;width:var(--neeto-molecule-builder-left-sidebar-width)}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel{padding-top:24px;width:100%}}.neeto-molecules-builder-elements-list-panel__toggler{flex-shrink:0;left:calc(100% + 8px);position:absolute;top:8px;transition:color .3s ease-in-out}@media screen and (min-width:1024px){.neeto-molecules-builder-elements-list-panel__toggler{opacity:0;pointer-events:none}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__toggler{left:24px}}.neeto-molecules-builder-questions-list-panel__scroll{height:calc(100% - 70px);height:calc(100% - var(--neeto-molecule-builder-left-sidebar-header-height));overflow-y:auto;padding:8px 24px;width:100%}.neeto-molecules-builder-questions-list-panel__scroll.neeto-molecules-builder-questions-list-panel__scroll--small{height:calc(100% - 110px);height:calc(100% - var(--neeto-molecule-builder-left-sidebar-header-height) - var(--neeto-molecule-builder-left-sidebar-search-height))}.neeto-molecules-builder-element-properties-panel__wrapper{border-left:1px solid rgb(var(--neeto-ui-gray-200));height:100%;min-width:420px;min-width:var(--neeto-molecule-builder-right-sidebar-width);position:relative;transition:all .15s;width:420px;width:var(--neeto-molecule-builder-right-sidebar-width);z-index:101}.neeto-molecules-builder-element-properties-panel__wrapper .neeto-molecules-builder-properties-panel__close{opacity:0;pointer-events:none;position:absolute;right:8px;top:8px}@media screen and (max-width:1279px){.neeto-molecules-builder-element-properties-panel__wrapper .neeto-molecules-builder-properties-panel__close{opacity:1;pointer-events:all}.neeto-molecules-builder-element-properties-panel__wrapper{position:fixed;right:0;top:0;transition:none}}@media screen and (max-width:576px){.neeto-molecules-builder-element-properties-panel__wrapper{height:100%;max-width:100%;min-width:0;width:100%}}.neeto-molecules-builder-element-properties-panel__wrapper--collapsed{max-width:0;min-width:0;width:0}.neeto-molecules-builder-element-properties-panel{display:flex;flex-direction:column;height:100%;min-width:0;overflow-y:auto;padding-left:24px;padding-top:24px;width:100%}.neeto-molecules-builder-element-properties-panel--collapsed{max-width:0;min-width:0;padding:0;width:0}@media screen and (max-width:1279px){.neeto-molecules-builder-element-properties-panel{padding-top:48px}}.neeto-molecules-builder-element--active{border-color:rgb(var(--neeto-ui-primary-500))!important;box-shadow:0 0 0 1px rgb(var(--neeto-ui-primary-500))!important}.neeto-molecules-builder-panel__backdrop{background-color:rgba(var(--neeto-ui-black),.4);display:none;height:100%;left:0;position:fixed;top:0;visibility:hidden;width:100%;z-index:101}@media screen and (max-width:767px){.neeto-molecules-builder-panel__backdrop{display:block;visibility:visible}}@media screen and (max-width:1279px){.neeto-molecules-builder-panel__backdrop--extended{display:block;visibility:visible}}";
|
|
30
|
+
var css = ":root{--neeto-molecule-builder-left-sidebar-width:288px;--neeto-molecule-builder-left-sidebar-width-lg:360px;--neeto-molecule-builder-left-sidebar-header-height:70px;--neeto-molecule-builder-left-sidebar-search-height:40px;--neeto-molecule-builder-right-sidebar-width:420px}.neeto-molecules-builder-elements-list-panel__wrapper{height:100%;min-width:360px;min-width:var(--neeto-molecule-builder-left-sidebar-width-lg);position:relative;transition:all .15s;width:360px;width:var(--neeto-molecule-builder-left-sidebar-width-lg);z-index:101}@media screen and (min-width:768px) and (max-width:1279px){.neeto-molecules-builder-elements-list-panel__wrapper{min-width:288px;min-width:var(--neeto-molecule-builder-left-sidebar-width);width:288px;width:var(--neeto-molecule-builder-left-sidebar-width)}}@media screen and (max-width:767px){.neeto-molecules-builder-elements-list-panel__wrapper{left:0;position:fixed;top:0;transition:none}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__wrapper{height:100%;max-width:100%;min-width:0;width:100%}}.neeto-molecules-builder-elements-list-panel__wrapper--collapsed{max-width:0;min-width:0;width:0}.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{transform:scale(-1)}@media screen and (max-width:767px){.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{top:109px}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__wrapper--collapsed .neeto-molecules-builder-elements-list-panel__toggler{left:8px;right:auto}}.neeto-molecules-builder-elements-list-panel__container{height:100%;overflow:hidden;width:100%}.neeto-molecules-builder-elements-list-panel{border-right:1px solid rgb(var(--neeto-ui-gray-200));height:100%;min-width:360px;min-width:var(--neeto-molecule-builder-left-sidebar-width-lg);width:360px;width:var(--neeto-molecule-builder-left-sidebar-width-lg)}@media screen and (min-width:768px) and (max-width:1279px){.neeto-molecules-builder-elements-list-panel{min-width:288px;min-width:var(--neeto-molecule-builder-left-sidebar-width);width:288px;width:var(--neeto-molecule-builder-left-sidebar-width)}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel{min-width:0;padding-top:24px;width:100%}}.neeto-molecules-builder-elements-list-panel__toggler{flex-shrink:0;left:calc(100% + 8px);position:absolute;top:8px;transition:color .3s ease-in-out}@media screen and (min-width:1024px){.neeto-molecules-builder-elements-list-panel__toggler{opacity:0;pointer-events:none}}@media screen and (max-width:576px){.neeto-molecules-builder-elements-list-panel__toggler{left:24px}}.neeto-molecules-builder-questions-list-panel__scroll{height:calc(100% - 70px);height:calc(100% - var(--neeto-molecule-builder-left-sidebar-header-height));overflow-y:auto;padding:8px 24px;width:100%}.neeto-molecules-builder-questions-list-panel__scroll.neeto-molecules-builder-questions-list-panel__scroll--small{height:calc(100% - 110px);height:calc(100% - var(--neeto-molecule-builder-left-sidebar-header-height) - var(--neeto-molecule-builder-left-sidebar-search-height))}.neeto-molecules-builder-element-properties-panel__wrapper{border-left:1px solid rgb(var(--neeto-ui-gray-200));height:100%;min-width:420px;min-width:var(--neeto-molecule-builder-right-sidebar-width);position:relative;transition:all .15s;width:420px;width:var(--neeto-molecule-builder-right-sidebar-width);z-index:101}.neeto-molecules-builder-element-properties-panel__wrapper .neeto-molecules-builder-properties-panel__close{opacity:0;pointer-events:none;position:absolute;right:8px;top:8px}@media screen and (max-width:1279px){.neeto-molecules-builder-element-properties-panel__wrapper .neeto-molecules-builder-properties-panel__close{opacity:1;pointer-events:all}.neeto-molecules-builder-element-properties-panel__wrapper{position:fixed;right:0;top:0;transition:none}}@media screen and (max-width:576px){.neeto-molecules-builder-element-properties-panel__wrapper{height:100%;max-width:100%;min-width:0;width:100%}}.neeto-molecules-builder-element-properties-panel__wrapper--collapsed{max-width:0;min-width:0;width:0}.neeto-molecules-builder-element-properties-panel{display:flex;flex-direction:column;height:100%;min-width:0;overflow-y:auto;padding-left:24px;padding-top:24px;width:100%}.neeto-molecules-builder-element-properties-panel--collapsed{max-width:0;min-width:0;padding:0;width:0}@media screen and (max-width:1279px){.neeto-molecules-builder-element-properties-panel{padding-top:48px}}.neeto-molecules-builder-element--active{border-color:rgb(var(--neeto-ui-primary-500))!important;box-shadow:0 0 0 1px rgb(var(--neeto-ui-primary-500))!important}.neeto-molecules-builder-panel__backdrop{background-color:rgba(var(--neeto-ui-black),.4);display:none;height:100%;left:0;position:fixed;top:0;visibility:hidden;width:100%;z-index:101}@media screen and (max-width:767px){.neeto-molecules-builder-panel__backdrop{display:block;visibility:visible}}@media screen and (max-width:1279px){.neeto-molecules-builder-panel__backdrop--extended{display:block;visibility:visible}}";
|
|
31
31
|
n(css,{});
|
|
32
32
|
|
|
33
33
|
var _excluded$2 = ["size"];
|
package/dist/FileUpload.js
CHANGED
|
@@ -5,13 +5,13 @@ import classnames from 'classnames';
|
|
|
5
5
|
import FileUpload$1 from '@bigbinary/neeto-icons/FileUpload';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import { t } from 'i18next';
|
|
8
10
|
import { n } from './inject-css-c86de496.js';
|
|
9
11
|
import FileGeneric from '@bigbinary/neeto-icons/FileGeneric';
|
|
10
12
|
import Check from '@bigbinary/neeto-icons/Check';
|
|
11
13
|
import Close from '@bigbinary/neeto-icons/Close';
|
|
12
14
|
import { motion } from 'framer-motion';
|
|
13
|
-
import path from 'path';
|
|
14
|
-
import { t } from 'i18next';
|
|
15
15
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
16
16
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
17
17
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
@@ -84,6 +84,116 @@ var DropZone = function DropZone(_ref) {
|
|
|
84
84
|
}));
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
var FILE_MIME_TYPES = {
|
|
88
|
+
pdf: ["application/pdf"],
|
|
89
|
+
doc: ["application/msword", "application/wps-writer"],
|
|
90
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
91
|
+
xls: ["application/vnd.ms-excel"],
|
|
92
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
93
|
+
csv: ["text/csv"],
|
|
94
|
+
txt: ["text/plain"],
|
|
95
|
+
rtf: ["application/rtf", "text/rtf"],
|
|
96
|
+
html: ["text/html"],
|
|
97
|
+
htm: ["text/html"],
|
|
98
|
+
md: ["text/markdown", "text/x-markdown"],
|
|
99
|
+
zip: ["application/zip"],
|
|
100
|
+
mp3: ["audio/mpeg"],
|
|
101
|
+
wma: ["audio/x-ms-wma", "video/x-ms-asf"],
|
|
102
|
+
mp4: ["video/mp4"],
|
|
103
|
+
mpg: ["video/mpeg"],
|
|
104
|
+
mpeg: ["video/mpeg"],
|
|
105
|
+
flv: ["video/x-flv"],
|
|
106
|
+
avi: ["video/x-msvideo"],
|
|
107
|
+
jpg: ["image/jpeg"],
|
|
108
|
+
jpeg: ["image/jpeg"],
|
|
109
|
+
png: ["image/png"],
|
|
110
|
+
gif: ["image/gif"]
|
|
111
|
+
};
|
|
112
|
+
var ERROR_CODES = {
|
|
113
|
+
FILE_TOO_LARGE: "file-too-large",
|
|
114
|
+
FILE_INVALID_TYPE: "file-invalid-type",
|
|
115
|
+
TOO_MANY_FILES: "too-many-files"
|
|
116
|
+
};
|
|
117
|
+
var DIRECT_UPLOAD_URL = "/api/direct_uploads";
|
|
118
|
+
|
|
119
|
+
var getAcceptedFileTypes = function getAcceptedFileTypes(allowedFileTypes) {
|
|
120
|
+
var accepted = {};
|
|
121
|
+
allowedFileTypes.split(", ").forEach(function (type) {
|
|
122
|
+
var mimeTypes = FILE_MIME_TYPES[type];
|
|
123
|
+
var extension = ".".concat(type);
|
|
124
|
+
if (isNotPresent(type) || isNotPresent(mimeTypes)) return;
|
|
125
|
+
mimeTypes.forEach(function (mimeType) {
|
|
126
|
+
if (accepted[mimeType]) accepted[mimeType].push(extension);else accepted[mimeType] = [extension];
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
return accepted;
|
|
130
|
+
};
|
|
131
|
+
var convertBytesToMb = function convertBytesToMb(bytes) {
|
|
132
|
+
return ((bytes - 10) / (1028 * 1024)).toFixed(2);
|
|
133
|
+
};
|
|
134
|
+
var renderErrorMessage = function renderErrorMessage(errorObject, maxFileSize, isMultiple) {
|
|
135
|
+
var error = errorObject.errors[0];
|
|
136
|
+
var file = errorObject.file;
|
|
137
|
+
if (error) {
|
|
138
|
+
var code = error.code;
|
|
139
|
+
if (code === ERROR_CODES.FILE_TOO_LARGE) {
|
|
140
|
+
return t("neetoMolecules.fileUpload.filesDropzone.errors.fileTooLarge", {
|
|
141
|
+
fileName: file.name,
|
|
142
|
+
maxSize: "".concat(Math.round(maxFileSize / 1048576), "MB")
|
|
143
|
+
});
|
|
144
|
+
} else if (code === ERROR_CODES.FILE_INVALID_TYPE) {
|
|
145
|
+
return t("neetoMolecules.fileUpload.filesDropzone.errors.fileInvalidType", {
|
|
146
|
+
fileType: path.extname(file.name)
|
|
147
|
+
});
|
|
148
|
+
} else if (code === ERROR_CODES.TOO_MANY_FILES && !isMultiple) {
|
|
149
|
+
return t("neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles", {
|
|
150
|
+
maxFiles: 1
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return t("neetoMolecules.fileUpload.filesDropzone.errors.defaultError", {
|
|
155
|
+
fileName: file.name
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
var convertMbToBytes = function convertMbToBytes(mb) {
|
|
159
|
+
return mb * 1028 * 1024 + 10;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var ErrorMessages = function ErrorMessages(_ref) {
|
|
163
|
+
var fileRejections = _ref.fileRejections,
|
|
164
|
+
maxFileSizeInBytes = _ref.maxFileSizeInBytes;
|
|
165
|
+
var _useTranslation = useTranslation(),
|
|
166
|
+
t = _useTranslation.t;
|
|
167
|
+
var hasMultipleFileErrors = fileRejections.some(function (_ref2) {
|
|
168
|
+
var errors = _ref2.errors;
|
|
169
|
+
return errors[0].code === ERROR_CODES.TOO_MANY_FILES;
|
|
170
|
+
});
|
|
171
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
172
|
+
children: [hasMultipleFileErrors && /*#__PURE__*/jsx("p", {
|
|
173
|
+
className: "neeto-molecules-input__error-text",
|
|
174
|
+
"data-cy": "form-file-upload-input-error",
|
|
175
|
+
children: /*#__PURE__*/jsx("span", {
|
|
176
|
+
className: "neeto-molecules-input__error-text-style-handle",
|
|
177
|
+
children: t("neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles", {
|
|
178
|
+
maxFiles: 1
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
}), fileRejections.filter(function (_ref3) {
|
|
182
|
+
var errors = _ref3.errors;
|
|
183
|
+
return errors[0].code !== ERROR_CODES.TOO_MANY_FILES;
|
|
184
|
+
}).map(function (file, index) {
|
|
185
|
+
return /*#__PURE__*/jsx("p", {
|
|
186
|
+
className: "neeto-molecules-input__error-text",
|
|
187
|
+
"data-cy": "form-file-upload-input-error",
|
|
188
|
+
children: /*#__PURE__*/jsx("span", {
|
|
189
|
+
className: "neeto-molecules-input__error-text-style-handle",
|
|
190
|
+
children: renderErrorMessage(file, maxFileSizeInBytes, false)
|
|
191
|
+
})
|
|
192
|
+
}, index);
|
|
193
|
+
})]
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
|
|
87
197
|
var css = ":root{--neeto-molecules-file-upload-dropzone-color:var(--neeto-ui-gray-800),1;--neeto-molecules-file-upload-dropzone-help-text-color:var(--neeto-ui-gray-700),1;--neeto-molecules-file-upload-dropzone-icon-color:var(--neeto-ui-primary-500),1;--neeto-molecules-file-upload-dropzone-background-color:var(--neeto-ui-white),1;--neeto-molecules-file-upload-dropzone-hover-background-color:var(--neeto-ui-gray-100,1);--neeto-molecules-file-upload-dropzone-border-color:var(--neeto-ui-gray-400),1;--neeto-molecules-file-upload-border-radius:var(--neeto-ui-rounded-md);--neeto-molecules-file-upload-transition:var(--neeto-ui-transition);--neeto-molecules-file-upload-list-item-border-color:var(--neeto-ui-gray-400),1;--neeto-molecules-file-upload-list-item-background-color:var(--neeto-ui-white),1;--neeto-molecules-file-upload-preview-icon-color:var(--neeto-ui-gray-400),1;--neeto-molecules-file-upload-progress-ring-background-color:var(--neeto-ui-primary-500),1;--neeto-molecules-file-upload-success-background-color:var(--neeto-ui-primary-500),1;--neeto-molecules-file-upload-success-color:var(--neeto-ui-white),1;--neeto-molecules-file-upload-cancel-background-color:var(--neeto-ui-error-500),1;--neeto-molecules-file-upload-cancel-color:var(--neeto-ui-white),1;--neeto-molecules-file-upload-error-color:var(--neeto-ui-error-500),1;--neeto-molecules-file-upload-error-background-color:var(--neeto-ui-white),1}.neeto-molecules-file-upload__dropzone{background-color:rgba(var(--neeto-ui-white),1);background-color:rgba(var(--neeto-molecules-file-upload-dropzone-background-color));border:2px dashed rgba(var(--neeto-molecules-file-upload-dropzone-border-color));border-radius:var(--neeto-ui-rounded-md);border-radius:var(--neeto-molecules-file-upload-border-radius);color:rgba(var(--neeto-ui-gray-800),1);color:rgba(var(--neeto-molecules-file-upload-dropzone-color));padding:1.5em;transition:var(--neeto-ui-transition);transition:var(--neeto-molecules-file-upload-transition)}.neeto-molecules-file-upload__dropzone:hover{background-color:rgba(1);background-color:rgba(var(--neeto-molecules-file-upload-dropzone-hover-background-color))}.neeto-molecules-file-upload__dropzone-inner{text-align:center}.neeto-molecules-file-upload__upload-icon{color:rgba(var(--neeto-ui-primary-500),1);color:rgba(var(--neeto-molecules-file-upload-dropzone-icon-color));display:block;margin-bottom:1.25em;margin-left:auto;margin-right:auto}.neeto-molecules-file-upload__upload-label{display:flex;font-size:1rem;gap:.3125em;justify-content:center}.neeto-molecules-file-upload__choose-file{font-weight:500}.neeto-molecules-file-upload__dropzone-helper-block{margin-top:.5em}.neeto-molecules-file-upload__dropzone-helper-text{color:rgba(var(--neeto-ui-gray-700),1);color:rgba(var(--neeto-molecules-file-upload-dropzone-help-text-color));display:block;font-size:.75rem;line-height:1.2;margin-bottom:.5rem}.neeto-molecules-file-upload__uploaded-list{list-style:none;margin:1.25em 0;padding:0}.neeto-molecules-file-upload__uploaded-list-item{align-items:center;background-color:rgba(var(--neeto-ui-white),1);background-color:rgba(var(--neeto-molecules-file-upload-list-item-background-color));border:1px solid rgba(var(--neeto-molecules-file-upload-list-item-border-color));display:flex;gap:.75em;list-style:none;margin-bottom:-1px;padding:.5em .75em}.neeto-molecules-file-upload__uploaded-list-item:first-of-type{border-top-left-radius:var(--neeto-ui-rounded-md);border-top-left-radius:var(--neeto-molecules-file-upload-border-radius);border-top-right-radius:var(--neeto-ui-rounded-md);border-top-right-radius:var(--neeto-molecules-file-upload-border-radius)}.neeto-molecules-file-upload__uploaded-list-item:last-of-type{border-bottom-left-radius:var(--neeto-ui-rounded-md);border-bottom-left-radius:var(--neeto-molecules-file-upload-border-radius);border-bottom-right-radius:var(--neeto-ui-rounded-md);border-bottom-right-radius:var(--neeto-molecules-file-upload-border-radius)}.neeto-molecules-file-upload__file-preview{color:rgba(var(--neeto-ui-gray-400),1);color:rgba(var(--neeto-molecules-file-upload-preview-icon-color));position:relative}.neeto-molecules-file-upload__file-preview .neeto-molecules-progress{align-items:center;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}.neeto-molecules-file-upload__file-preview .neeto-molecules-progress__circle-wrapper{color:rgba(var(--neeto-ui-primary-500),1);color:rgba(var(--neeto-molecules-file-upload-progress-ring-background-color));position:relative}.neeto-molecules-file-upload__file-info{word-wrap:break-word;display:flex;flex-direction:column;flex-grow:1;min-width:0;overflow-wrap:break-word}.neeto-molecules-file-upload__file-info-name{font-size:.875em;margin-bottom:.3125em}.neeto-molecules-file-upload__file-info-size{color:rgba(var(--neeto-ui-gray-700),1);color:rgba(var(--neeto-molecules-file-upload-dropzone-help-text-color));font-size:.75em}.neeto-molecules-file-upload__actions{flex-shrink:0;margin-left:auto;position:relative}.neeto-molecules-file-upload__success-indicator{align-items:center;border-radius:100%;display:inline-flex;height:1.75em;justify-content:center;width:1.75em}.neeto-molecules-file-upload__success-indicator.neeto-molecules-file-upload__success-indicator--active{background-color:rgba(var(--neeto-ui-primary-500),1);background-color:rgba(var(--neeto-molecules-file-upload-success-background-color));color:rgba(var(--neeto-ui-white),1);color:rgba(var(--neeto-molecules-file-upload-success-color))}.neeto-molecules-file-upload__button--red{align-items:center;background-color:rgba(var(--neeto-ui-error-500),1);background-color:rgba(var(--neeto-molecules-file-upload-cancel-background-color));border-radius:100%;color:rgba(var(--neeto-ui-white),1);color:rgba(var(--neeto-molecules-file-upload-cancel-color));display:inline-flex;height:1.75em;justify-content:center;width:1.75em}.neeto-molecules-file-upload__remove-button{left:0;opacity:0;position:absolute;top:0;transition:var(--neeto-ui-transition);transition:var(--neeto-molecules-file-upload-transition);visibility:hidden}.neeto-molecules-file-upload__actions:hover .neeto-molecules-file-upload__remove-button{opacity:1;visibility:visible}.neeto-molecules-invisible{visibility:hidden}.neeto-molecules-input__error-text{font-size:.875rem;line-height:1.2;margin-top:.5em}.neeto-molecules-input__error-text-style-handle{background-color:rgba(var(--neeto-ui-white),1);background-color:rgba(var(--neeto-molecules-file-upload-error-background-color));border-radius:3px;color:rgba(var(--neeto-ui-error-500),1);color:rgba(var(--neeto-molecules-file-upload-error-color));display:inline-block;font-size:.875rem;line-height:1.2;padding:3px 6px}";
|
|
88
198
|
n(css,{});
|
|
89
199
|
|
|
@@ -171,81 +281,6 @@ var Progress = function Progress(_ref) {
|
|
|
171
281
|
});
|
|
172
282
|
};
|
|
173
283
|
|
|
174
|
-
var FILE_MIME_TYPES = {
|
|
175
|
-
pdf: ["application/pdf"],
|
|
176
|
-
doc: ["application/msword", "application/wps-writer"],
|
|
177
|
-
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
178
|
-
xls: ["application/vnd.ms-excel"],
|
|
179
|
-
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
180
|
-
csv: ["text/csv"],
|
|
181
|
-
txt: ["text/plain"],
|
|
182
|
-
rtf: ["application/rtf", "text/rtf"],
|
|
183
|
-
html: ["text/html"],
|
|
184
|
-
htm: ["text/html"],
|
|
185
|
-
md: ["text/markdown", "text/x-markdown"],
|
|
186
|
-
zip: ["application/zip"],
|
|
187
|
-
mp3: ["audio/mpeg"],
|
|
188
|
-
wma: ["audio/x-ms-wma", "video/x-ms-asf"],
|
|
189
|
-
mp4: ["video/mp4"],
|
|
190
|
-
mpg: ["video/mpeg"],
|
|
191
|
-
mpeg: ["video/mpeg"],
|
|
192
|
-
flv: ["video/x-flv"],
|
|
193
|
-
avi: ["video/x-msvideo"],
|
|
194
|
-
jpg: ["image/jpeg"],
|
|
195
|
-
jpeg: ["image/jpeg"],
|
|
196
|
-
png: ["image/png"],
|
|
197
|
-
gif: ["image/gif"]
|
|
198
|
-
};
|
|
199
|
-
var ERROR_CODES = {
|
|
200
|
-
FILE_TOO_LARGE: "file-too-large",
|
|
201
|
-
FILE_INVALID_TYPE: "file-invalid-type",
|
|
202
|
-
TOO_MANY_FILES: "too-many-files"
|
|
203
|
-
};
|
|
204
|
-
var DIRECT_UPLOAD_URL = "/api/direct_uploads";
|
|
205
|
-
|
|
206
|
-
var getAcceptedFileTypes = function getAcceptedFileTypes(allowedFileTypes) {
|
|
207
|
-
var accepted = {};
|
|
208
|
-
allowedFileTypes.split(", ").forEach(function (type) {
|
|
209
|
-
var mimeTypes = FILE_MIME_TYPES[type];
|
|
210
|
-
var extension = ".".concat(type);
|
|
211
|
-
if (isNotPresent(type) || isNotPresent(mimeTypes)) return;
|
|
212
|
-
mimeTypes.forEach(function (mimeType) {
|
|
213
|
-
if (accepted[mimeType]) accepted[mimeType].push(extension);else accepted[mimeType] = [extension];
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
return accepted;
|
|
217
|
-
};
|
|
218
|
-
var convertBytesToMb = function convertBytesToMb(bytes) {
|
|
219
|
-
return ((bytes - 10) / (1028 * 1024)).toFixed(2);
|
|
220
|
-
};
|
|
221
|
-
var renderErrorMessage = function renderErrorMessage(errorObject, maxFileSize, isMultiple) {
|
|
222
|
-
var error = errorObject.errors[0];
|
|
223
|
-
var file = errorObject.file;
|
|
224
|
-
if (error) {
|
|
225
|
-
var code = error.code;
|
|
226
|
-
if (code === ERROR_CODES.FILE_TOO_LARGE) {
|
|
227
|
-
return t("neetoMolecules.fileUpload.filesDropzone.errors.fileTooLarge", {
|
|
228
|
-
fileName: file.name,
|
|
229
|
-
maxSize: "".concat(Math.round(maxFileSize / 1048576), "MB")
|
|
230
|
-
});
|
|
231
|
-
} else if (code === ERROR_CODES.FILE_INVALID_TYPE) {
|
|
232
|
-
return t("neetoMolecules.fileUpload.filesDropzone.errors.fileInvalidType", {
|
|
233
|
-
fileType: path.extname(file.name)
|
|
234
|
-
});
|
|
235
|
-
} else if (code === ERROR_CODES.TOO_MANY_FILES && !isMultiple) {
|
|
236
|
-
return t("neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles", {
|
|
237
|
-
maxFiles: 1
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return t("neetoMolecules.fileUpload.filesDropzone.errors.defaultError", {
|
|
242
|
-
fileName: file.name
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
var convertMbToBytes = function convertMbToBytes(mb) {
|
|
246
|
-
return mb * 1028 * 1024 + 10;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
284
|
var FilePreview = function FilePreview(_ref) {
|
|
250
285
|
var file = _ref.file,
|
|
251
286
|
isUploading = _ref.isUploading,
|
|
@@ -501,15 +536,9 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
501
536
|
progress: progress[file.name]
|
|
502
537
|
});
|
|
503
538
|
})
|
|
504
|
-
}), isNotEmpty(fileRejections) &&
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
"data-cy": "form-file-upload-input-error",
|
|
508
|
-
children: /*#__PURE__*/jsx("span", {
|
|
509
|
-
className: "neeto-molecules-input__error-text-style-handle",
|
|
510
|
-
children: renderErrorMessage(file, maxFileSizeInBytes, false)
|
|
511
|
-
})
|
|
512
|
-
}, index);
|
|
539
|
+
}), isNotEmpty(fileRejections) && /*#__PURE__*/jsx(ErrorMessages, {
|
|
540
|
+
fileRejections: fileRejections,
|
|
541
|
+
maxFileSizeInBytes: maxFileSizeInBytes
|
|
513
542
|
}), shouldShowError && /*#__PURE__*/jsx("p", {
|
|
514
543
|
className: "neeto-molecules-input__error-text",
|
|
515
544
|
"data-cy": "form-file-upload-input-error",
|
package/dist/FileUpload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/DropZone.jsx","../src/components/FileUpload/Progress.jsx","../src/components/FileUpload/constants.js","../src/components/FileUpload/utils.js","../src/components/FileUpload/FilePreview.jsx","../src/components/FileUpload/hooks/useFileUpload.js","../src/components/FileUpload/FileUpload.jsx","../src/components/FileUpload/FormikFileUpload.jsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { FileUpload } from \"neetoicons\";\nimport { useTranslation } from \"react-i18next\";\n\nconst DropZone = ({\n isDragActive,\n getRootProps,\n getInputProps,\n multipleFilesAllowed,\n maxFileSize,\n allowedFileTypes,\n}) => {\n const { t } = useTranslation();\n\n const shouldAllowSingleFileUpload = !multipleFilesAllowed;\n const shouldShowFileSizeLimit = maxFileSize;\n\n return (\n <div\n {...getRootProps({\n className: classnames([\"neeto-molecules-file-upload__dropzone\"], {\n \"neeto-molecules-file-upload__dropzone--drag-active\": isDragActive,\n }),\n })}\n >\n <div\n className=\"neeto-molecules-file-upload__dropzone-inner\"\n data-cy=\"file-upload-body\"\n data-testid=\"file-upload-body\"\n >\n <FileUpload\n className=\"neeto-molecules-file-upload__upload-icon\"\n size=\"36\"\n />\n <div className=\"neeto-molecules-file-upload__dropzone-content\">\n <label\n className=\"neeto-molecules-file-upload__upload-label\"\n htmlFor=\"file-upload\"\n >\n <span className=\"neeto-molecules-file-upload__choose-file\">\n {t(\n \"neetoMolecules.fileUpload.filesDropzone.chooseFileOrDragHere\"\n )}\n </span>\n <input {...getInputProps()} data-cy=\"image-browse-button\" />\n </label>\n <div className=\"neeto-molecules-file-upload__dropzone-helper-block\">\n {shouldAllowSingleFileUpload && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"upload-only-one-file-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.oneFileAllowed\")}\n </p>\n )}\n {shouldShowFileSizeLimit && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"maximum-allowed-size-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.maxFileSize\", {\n size: maxFileSize,\n unit: \"MB\",\n })}\n </p>\n )}\n {allowedFileTypes && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"allowed-files-types-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.allowedFileTypes\", {\n types: allowedFileTypes,\n })}\n </p>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default DropZone;\n","import { motion } from \"framer-motion\";\n\nconst Progress = ({\n percents,\n stroke = \"currentColor\",\n emptyStroke = stroke,\n emptyStrokeOpacity = 0.25,\n duration = 0.5,\n delay = 0,\n size = 100,\n strokeWidth = 12,\n}) => {\n const radius = 45;\n const circumference = Math.ceil(2 * Math.PI * radius);\n const fillPercents = Math.abs(\n Math.ceil((circumference / 100) * (percents - 100))\n );\n\n const transition = { duration, delay };\n\n const variants = {\n hidden: { strokeDashoffset: circumference, transition },\n show: { strokeDashoffset: fillPercents, transition },\n };\n\n return (\n <div className=\"neeto-molecules-progress__circle\">\n <div\n className=\"neeto-molecules-progress__circle-wrapper\"\n style={{ height: size }}\n >\n <svg\n height={size}\n version=\"1.1\"\n viewBox=\"0 0 100 100\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n {...{ strokeWidth }}\n className=\"circle\"\n cx=\"50\"\n cy=\"50\"\n fill=\"transparent\"\n r={radius}\n stroke={emptyStroke}\n strokeOpacity={emptyStrokeOpacity}\n />\n </svg>\n <svg\n height={size}\n viewBox=\"0 0 100 100\"\n width={size}\n style={{\n position: \"absolute\",\n transform: \"rotate(-90deg)\",\n overflow: \"visible\",\n top: 0,\n }}\n >\n <motion.circle\n {...{ stroke, strokeWidth, variants }}\n animate=\"show\"\n cx=\"50\"\n cy=\"50\"\n fill=\"transparent\"\n initial=\"hidden\"\n r={radius}\n strokeDasharray={circumference}\n strokeDashoffset={fillPercents}\n />\n </svg>\n </div>\n </div>\n );\n};\n\nexport default Progress;\n","export const FILE_MIME_TYPES = {\n pdf: [\"application/pdf\"],\n doc: [\"application/msword\", \"application/wps-writer\"],\n docx: [\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n ],\n xls: [\"application/vnd.ms-excel\"],\n xlsx: [\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"],\n csv: [\"text/csv\"],\n txt: [\"text/plain\"],\n rtf: [\"application/rtf\", \"text/rtf\"],\n html: [\"text/html\"],\n htm: [\"text/html\"],\n md: [\"text/markdown\", \"text/x-markdown\"],\n zip: [\"application/zip\"],\n mp3: [\"audio/mpeg\"],\n wma: [\"audio/x-ms-wma\", \"video/x-ms-asf\"],\n mp4: [\"video/mp4\"],\n mpg: [\"video/mpeg\"],\n mpeg: [\"video/mpeg\"],\n flv: [\"video/x-flv\"],\n avi: [\"video/x-msvideo\"],\n jpg: [\"image/jpeg\"],\n jpeg: [\"image/jpeg\"],\n png: [\"image/png\"],\n gif: [\"image/gif\"],\n};\n\nexport const ERROR_CODES = {\n FILE_TOO_LARGE: \"file-too-large\",\n FILE_INVALID_TYPE: \"file-invalid-type\",\n TOO_MANY_FILES: \"too-many-files\",\n};\n\nexport const DIRECT_UPLOAD_URL = \"/api/direct_uploads\";\n","import path from \"path\";\n\nimport { t } from \"i18next\";\nimport { isNotPresent } from \"neetocist\";\n\nimport { FILE_MIME_TYPES, ERROR_CODES } from \"./constants\";\n\nexport const getAcceptedFileTypes = allowedFileTypes => {\n const accepted = {};\n\n allowedFileTypes.split(\", \").forEach(type => {\n const mimeTypes = FILE_MIME_TYPES[type];\n const extension = `.${type}`;\n\n if (isNotPresent(type) || isNotPresent(mimeTypes)) return;\n\n mimeTypes.forEach(mimeType => {\n if (accepted[mimeType]) accepted[mimeType].push(extension);\n else accepted[mimeType] = [extension];\n });\n });\n\n return accepted;\n};\n\nexport const convertBytesToMb = bytes =>\n ((bytes - 10) / (1028 * 1024)).toFixed(2);\n\nexport const renderErrorMessage = (errorObject, maxFileSize, isMultiple) => {\n const error = errorObject.errors[0];\n const file = errorObject.file;\n if (error) {\n const { code } = error;\n if (code === ERROR_CODES.FILE_TOO_LARGE) {\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.fileTooLarge\", {\n fileName: file.name,\n maxSize: `${Math.round(maxFileSize / 1048576)}MB`,\n });\n } else if (code === ERROR_CODES.FILE_INVALID_TYPE) {\n return t(\n \"neetoMolecules.fileUpload.filesDropzone.errors.fileInvalidType\",\n { fileType: path.extname(file.name) }\n );\n } else if (code === ERROR_CODES.TOO_MANY_FILES && !isMultiple) {\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles\", {\n maxFiles: 1,\n });\n }\n }\n\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.defaultError\", {\n fileName: file.name,\n });\n};\n\nexport const convertMbToBytes = mb => mb * 1028 * 1024 + 10;\n","import classnames from \"classnames\";\nimport { FileGeneric, Check, Close } from \"neetoicons\";\n\nimport Progress from \"./Progress\";\nimport { convertBytesToMb } from \"./utils\";\n\nconst FilePreview = ({ file, isUploading, cancel, progress }) => (\n <li\n className=\"neeto-molecules-file-upload__uploaded-list-item\"\n key={file.url}\n >\n <div className=\"neeto-molecules-file-upload__file-preview\">\n <a\n className={classnames({ \"neeto-molecules-invisible\": isUploading })}\n href={file.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n <FileGeneric />\n </a>\n {isUploading && (\n <div className=\"neeto-molecules-progress\">\n <Progress percents={progress || 0} size={20} />\n </div>\n )}\n </div>\n <div className=\"neeto-molecules-file-upload__file-info\">\n <span\n className=\"neeto-molecules-file-upload__file-info-name\"\n data-cy=\"file-name\"\n >\n {file.name}\n </span>\n <span className=\"neeto-molecules-file-upload__file-info-size\">\n {file.size ? `${convertBytesToMb(file.size)} MB` : \"\"}\n </span>\n </div>\n <div className=\"neeto-molecules-file-upload__actions\">\n <span\n className={classnames(\n \"neeto-molecules-file-upload__success-indicator\",\n { \"neeto-molecules-file-upload__success-indicator--active\": file.url }\n )}\n >\n {file.url && <Check data-cy=\"file-upload-success\" />}\n </span>\n <button\n className=\"neeto-molecules-file-upload__button--red neeto-molecules-file-upload__remove-button\"\n type=\"button\"\n onClick={cancel}\n >\n <Close />\n </button>\n </div>\n </li>\n);\n\nexport default FilePreview;\n","import { useState, useCallback, useEffect, useRef } from \"react\";\n\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { findBy } from \"neetocist\";\nimport { assoc } from \"ramda\";\nimport { useDropzone } from \"react-dropzone\";\n\nimport { DIRECT_UPLOAD_URL } from \"../constants\";\nimport { convertMbToBytes, renderErrorMessage } from \"../utils\";\n\nconst useFileUpload = ({\n disabled,\n accept,\n multiple,\n maxFileSize,\n minFileSize,\n files,\n onChange,\n setError,\n setTouched,\n}) => {\n const [uploadProgress, setUploadProgress] = useState({});\n const [uploadError, setUploadError] = useState(\"\");\n\n const filesRef = useRef(files);\n filesRef.current = files;\n\n const cancel = useCallback(\n index => () => {\n setUploadProgress(assoc(files[index].name, null));\n const newFiles = files?.filter((_, idx) => idx !== index);\n onChange(newFiles);\n },\n [files]\n );\n\n useEffect(() => {\n uploadError && setError(uploadError);\n }, [uploadError]);\n\n const onDropAccepted = async acceptedFiles => {\n setTouched(false);\n setUploadError(\"\");\n const initialFiles = acceptedFiles.map(file => ({\n name: file.name,\n size: file.size,\n }));\n\n const updatedFiles = multiple\n ? [...(files || []), ...initialFiles]\n : initialFiles;\n onChange(updatedFiles);\n const newFiles = await new Promise(resolve => {\n const files = [];\n\n acceptedFiles.forEach(file => {\n setUploadProgress(assoc(file.name, 0));\n\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL, {\n directUploadWillStoreFileWithXHR: xhr => {\n xhr.upload.addEventListener(\"progress\", event => {\n const percentComplete = Math.round(\n (event.loaded / event.total) * 100\n );\n setUploadProgress(assoc(file.name, percentComplete));\n });\n\n xhr.upload.addEventListener(\"load\", () => {\n setUploadProgress(assoc(file.name, undefined));\n });\n },\n });\n\n upload.create((error, blob) => {\n if (error) {\n return setUploadError(error);\n }\n\n files.push({\n url: blob.blob_url,\n name: blob.filename,\n signedId: blob.signed_id,\n });\n\n const isUploadCompleted = multiple\n ? acceptedFiles.length === files.length\n : files.length === 1;\n\n if (isUploadCompleted) {\n return resolve(files);\n }\n\n return \"\";\n });\n });\n\n return files;\n });\n\n if (multiple) {\n const updatedFiles = filesRef.current.map(file => {\n const uploadedFile = findBy({ name: file.name }, newFiles);\n\n return { ...file, ...uploadedFile };\n });\n onChange(updatedFiles);\n } else {\n onChange(newFiles);\n }\n };\n\n const onDropRejected = fileRejections => {\n fileRejections.forEach(fileObject => {\n setTouched(true);\n if (fileObject.errors[0].code === \"too-many-files\") {\n setUploadError(renderErrorMessage(fileObject, maxFileSize, multiple));\n } else {\n setUploadError(renderErrorMessage(fileObject, maxFileSize, multiple));\n }\n });\n };\n\n const { getRootProps, getInputProps, isDragActive, fileRejections } =\n useDropzone({\n disabled,\n accept,\n multiple,\n minSize: convertMbToBytes(minFileSize),\n onDropAccepted,\n onDropRejected,\n ...(maxFileSize && { maxSize: convertMbToBytes(maxFileSize) }),\n });\n\n return {\n progress: uploadProgress,\n cancel,\n getRootProps,\n getInputProps,\n isDragActive,\n fileRejections,\n };\n};\n\nexport default useFileUpload;\n","import { isNotEmpty, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty, isNotNil } from \"ramda\";\n\nimport DropZone from \"./DropZone\";\nimport \"./file-upload.scss\";\nimport FilePreview from \"./FilePreview\";\nimport useFileUpload from \"./hooks/useFileUpload\";\nimport { getAcceptedFileTypes, renderErrorMessage } from \"./utils\";\n\nconst FileUpload = ({\n allowedFileTypes = \"\",\n multipleFilesAllowed = true,\n maxFileSize = 1,\n isPreview = false,\n minFileSize = 0,\n files = [],\n onChange = noop,\n error,\n setError = noop,\n setTouched = noop,\n}) => {\n const {\n progress,\n cancel,\n getRootProps,\n getInputProps,\n isDragActive,\n fileRejections,\n } = useFileUpload({\n disabled: isPreview,\n accept: getAcceptedFileTypes(allowedFileTypes),\n multiple: multipleFilesAllowed,\n maxFileSize,\n minFileSize,\n files,\n onChange,\n setError,\n setTouched,\n });\n\n const maxFileSizeInBytes = maxFileSize * 1000000;\n\n const isUploadingFile = file =>\n isNotNil(progress[file.name]) && (progress[file.name] !== 100 || !file.url);\n\n const shouldShowError = error && isEmpty(fileRejections);\n\n return (\n <>\n <DropZone\n {...{\n allowedFileTypes,\n getInputProps,\n getRootProps,\n isDragActive,\n maxFileSize,\n multipleFilesAllowed,\n }}\n />\n {!isEmpty(files) && (\n <ul className=\"neeto-molecules-file-upload__uploaded-list\">\n {files?.map((file, idx) => (\n <FilePreview\n {...{ file }}\n cancel={cancel(idx)}\n isUploading={isUploadingFile(file)}\n key={idx}\n progress={progress[file.name]}\n />\n ))}\n </ul>\n )}\n {isNotEmpty(fileRejections) &&\n fileRejections.map((file, index) => (\n <p\n className=\"neeto-molecules-input__error-text\"\n data-cy=\"form-file-upload-input-error\"\n key={index}\n >\n <span className=\"neeto-molecules-input__error-text-style-handle\">\n {renderErrorMessage(file, maxFileSizeInBytes, false)}\n </span>\n </p>\n ))}\n {shouldShowError && (\n <p\n className=\"neeto-molecules-input__error-text\"\n data-cy=\"form-file-upload-input-error\"\n >\n <span className=\"neeto-molecules-input__error-text-style-handle\">\n {error}\n </span>\n </p>\n )}\n </>\n );\n};\n\nFileUpload.propTypes = {\n /**\n * Allowed file types for the file upload component.\n */\n allowedFileTypes: PropTypes.string,\n /**\n * Boolean to allow multiple files to be uploaded.\n */\n multipleFilesAllowed: PropTypes.bool,\n /**\n * Maximum file size allowed for the file upload component(MB).\n */\n maxFileSize: PropTypes.number,\n /**\n * Boolean to use component as a preview component.\n */\n isPreview: PropTypes.bool,\n /**\n * Minimum file size allowed for the file upload component(MB).\n */\n minFileSize: PropTypes.number,\n /**\n * Uploaded files.\n */\n files: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n size: PropTypes.number,\n url: PropTypes.string,\n })\n ),\n /**\n * Function to be called on file upload, with the updated files array.\n */\n onChange: PropTypes.func,\n /**\n * Error message to be displayed.\n */\n error: PropTypes.string,\n /**\n * Function to set error message.\n */\n setError: PropTypes.func,\n};\n\nexport default FileUpload;\n","import { useField } from \"formik\";\n\nimport FileUpload from \"./FileUpload\";\n\nconst FormikFileUpload = ({ name, ...props }) => {\n const [_, { value, touched, error }, { setValue, setTouched, setError }] =\n useField(name);\n\n const errorToDisplay = touched && error ? error : \"\";\n\n return (\n <FileUpload\n {...{ ...props, setError, setTouched }}\n error={errorToDisplay}\n files={value}\n onChange={setValue}\n />\n );\n};\n\nexport default FormikFileUpload;\n"],"names":["DropZone","_ref","isDragActive","getRootProps","getInputProps","multipleFilesAllowed","maxFileSize","allowedFileTypes","_useTranslation","useTranslation","t","shouldAllowSingleFileUpload","shouldShowFileSizeLimit","_jsx","_objectSpread","className","classnames","children","_jsxs","FileUpload","size","htmlFor","unit","types","Progress","percents","_ref$stroke","stroke","_ref$emptyStroke","emptyStroke","_ref$emptyStrokeOpaci","emptyStrokeOpacity","_ref$duration","duration","_ref$delay","delay","_ref$size","_ref$strokeWidth","strokeWidth","radius","circumference","Math","ceil","PI","fillPercents","abs","transition","variants","hidden","strokeDashoffset","show","style","height","version","viewBox","width","xmlns","cx","cy","fill","r","strokeOpacity","position","transform","overflow","top","motion","circle","animate","initial","strokeDasharray","FILE_MIME_TYPES","pdf","doc","docx","xls","xlsx","csv","txt","rtf","html","htm","md","zip","mp3","wma","mp4","mpg","mpeg","flv","avi","jpg","jpeg","png","gif","ERROR_CODES","FILE_TOO_LARGE","FILE_INVALID_TYPE","TOO_MANY_FILES","DIRECT_UPLOAD_URL","getAcceptedFileTypes","accepted","split","forEach","type","mimeTypes","extension","concat","isNotPresent","mimeType","push","convertBytesToMb","bytes","toFixed","renderErrorMessage","errorObject","isMultiple","error","errors","file","code","fileName","name","maxSize","round","fileType","path","extname","maxFiles","convertMbToBytes","mb","FilePreview","isUploading","cancel","progress","href","url","rel","target","FileGeneric","Check","onClick","Close","useFileUpload","disabled","accept","multiple","minFileSize","files","onChange","setError","setTouched","_useState","useState","_useState2","_slicedToArray","uploadProgress","setUploadProgress","_useState3","_useState4","uploadError","setUploadError","filesRef","useRef","current","useCallback","index","assoc","newFiles","filter","_","idx","useEffect","onDropAccepted","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","acceptedFiles","initialFiles","updatedFiles","_updatedFiles","wrap","_callee$","_context","prev","next","map","_toConsumableArray","Promise","resolve","upload","DirectUpload","directUploadWillStoreFileWithXHR","xhr","addEventListener","event","percentComplete","loaded","total","undefined","create","blob","blob_url","filename","signedId","signed_id","isUploadCompleted","length","sent","uploadedFile","findBy","stop","_x","apply","arguments","onDropRejected","fileRejections","fileObject","_useDropzone","useDropzone","minSize","_ref$allowedFileTypes","_ref$multipleFilesAll","_ref$maxFileSize","_ref$isPreview","isPreview","_ref$minFileSize","_ref$files","_ref$onChange","noop","_ref$setError","_ref$setTouched","_useFileUpload","maxFileSizeInBytes","isUploadingFile","isNotNil","shouldShowError","isEmpty","_Fragment","_createElement","key","isNotEmpty","FormikFileUpload","props","_objectWithoutProperties","_excluded","_useField","useField","_useField2","_useField2$","value","touched","_useField2$2","setValue","errorToDisplay"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAOR;AAAA,EAAA,IANJC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IACZC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,aAAa,GAAAH,IAAA,CAAbG,aAAa;IACbC,oBAAoB,GAAAJ,IAAA,CAApBI,oBAAoB;IACpBC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,gBAAgB,GAAAN,IAAA,CAAhBM,gBAAgB,CAAA;AAEhB,EAAA,IAAAC,eAAA,GAAcC,cAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC,CAAA;EAET,IAAMC,2BAA2B,GAAG,CAACN,oBAAoB,CAAA;EACzD,IAAMO,uBAAuB,GAAGN,WAAW,CAAA;AAE3C,EAAA,oBACEO,GAAA,CAAAC,KAAAA,EAAAA,eAAA,CAAAA,eAAA,CAAA,EAAA,EACMX,YAAY,CAAC;AACfY,IAAAA,SAAS,EAAEC,UAAU,CAAC,CAAC,uCAAuC,CAAC,EAAE;AAC/D,MAAA,oDAAoD,EAAEd,YAAAA;KACvD,CAAA;AACH,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAe,IAAAA,QAAA,eAEFC,IAAA,CAAA,KAAA,EAAA;AACEH,MAAAA,SAAS,EAAC,6CAA6C;AACvD,MAAA,SAAA,EAAQ,kBAAkB;AAC1B,MAAA,aAAA,EAAY,kBAAkB;MAAAE,QAAA,EAAA,cAE9BJ,GAAA,CAACM,YAAU,EAAA;AACTJ,QAAAA,SAAS,EAAC,0CAA0C;AACpDK,QAAAA,IAAI,EAAC,IAAA;OACN,CAAC,eACFF,IAAA,CAAA,KAAA,EAAA;AAAKH,QAAAA,SAAS,EAAC,+CAA+C;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CAAA6F,SAAA,EAAA,CAAA,CAAA,CAAA;AADT9E,IAACgF,UAAA,CAAA,CAAA,CAAA,CAAA;AAAAC,QAAAA,WAAA,GAAAD,UAAA,CAAA,CAAA,CAAA,CAAA;IAAIE,KAAK,GAAAD,WAAA,CAALC,KAAK,CAAA;IAAEC,OAAO,GAAAF,WAAA,CAAPE,OAAO,CAAA;IAAExI,KAAK,GAAAsI,WAAA,CAALtI,KAAK,CAAA;AAAAyI,IAAAA,YAAA,GAAAJ,UAAA,CAAA,CAAA,CAAA,CAAA;IAAMK,QAAQ,GAAAD,YAAA,CAARC,QAAQ,CAAA;IAAExG,UAAU,GAAAuG,YAAA,CAAVvG,UAAU,CAAA;IAAED,QAAQ,GAAAwG,YAAA,CAARxG,SAAQ;EAGrE,IAAM0G,cAAc,GAAGH,OAAO,IAAIxI,KAAK,GAAGA,KAAK,GAAG,EAAE,CAAA;AAEpD,EAAA,oBACExG,GAAA,CAACM,UAAU,EAAAL,aAAA,CAAAA,aAAA,CAAA,EAAA,EAAAA,aAAA,CAAAA,aAAA,CAAA,EAAA,EACAuO,KAAK,CAAA,EAAA,EAAA,EAAA;AAAE/F,IAAAA,QAAQ,EAARA,QAAQ;AAAEC,IAAAA,UAAU,EAAVA,UAAAA;AAAU,GAAA,CAAA,CAAA,EAAA,EAAA,EAAA;AACpClC,IAAAA,KAAK,EAAE2I,cAAe;AACtB5G,IAAAA,KAAK,EAAEwG,KAAM;AACbvG,IAAAA,QAAQ,EAAE0G,QAAAA;AAAS,GAAA,CACpB,CAAC,CAAA;AAEN;;;;"}
|
|
1
|
+
{"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/DropZone.jsx","../src/components/FileUpload/constants.js","../src/components/FileUpload/utils.js","../src/components/FileUpload/ErrorMessages.jsx","../src/components/FileUpload/Progress.jsx","../src/components/FileUpload/FilePreview.jsx","../src/components/FileUpload/hooks/useFileUpload.js","../src/components/FileUpload/FileUpload.jsx","../src/components/FileUpload/FormikFileUpload.jsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { FileUpload } from \"neetoicons\";\nimport { useTranslation } from \"react-i18next\";\n\nconst DropZone = ({\n isDragActive,\n getRootProps,\n getInputProps,\n multipleFilesAllowed,\n maxFileSize,\n allowedFileTypes,\n}) => {\n const { t } = useTranslation();\n\n const shouldAllowSingleFileUpload = !multipleFilesAllowed;\n const shouldShowFileSizeLimit = maxFileSize;\n\n return (\n <div\n {...getRootProps({\n className: classnames([\"neeto-molecules-file-upload__dropzone\"], {\n \"neeto-molecules-file-upload__dropzone--drag-active\": isDragActive,\n }),\n })}\n >\n <div\n className=\"neeto-molecules-file-upload__dropzone-inner\"\n data-cy=\"file-upload-body\"\n data-testid=\"file-upload-body\"\n >\n <FileUpload\n className=\"neeto-molecules-file-upload__upload-icon\"\n size=\"36\"\n />\n <div className=\"neeto-molecules-file-upload__dropzone-content\">\n <label\n className=\"neeto-molecules-file-upload__upload-label\"\n htmlFor=\"file-upload\"\n >\n <span className=\"neeto-molecules-file-upload__choose-file\">\n {t(\n \"neetoMolecules.fileUpload.filesDropzone.chooseFileOrDragHere\"\n )}\n </span>\n <input {...getInputProps()} data-cy=\"image-browse-button\" />\n </label>\n <div className=\"neeto-molecules-file-upload__dropzone-helper-block\">\n {shouldAllowSingleFileUpload && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"upload-only-one-file-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.oneFileAllowed\")}\n </p>\n )}\n {shouldShowFileSizeLimit && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"maximum-allowed-size-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.maxFileSize\", {\n size: maxFileSize,\n unit: \"MB\",\n })}\n </p>\n )}\n {allowedFileTypes && (\n <p\n className=\"neeto-molecules-file-upload__dropzone-helper-text\"\n data-cy=\"allowed-files-types-text\"\n >\n {t(\"neetoMolecules.fileUpload.filesDropzone.allowedFileTypes\", {\n types: allowedFileTypes,\n })}\n </p>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default DropZone;\n","export const FILE_MIME_TYPES = {\n pdf: [\"application/pdf\"],\n doc: [\"application/msword\", \"application/wps-writer\"],\n docx: [\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n ],\n xls: [\"application/vnd.ms-excel\"],\n xlsx: [\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"],\n csv: [\"text/csv\"],\n txt: [\"text/plain\"],\n rtf: [\"application/rtf\", \"text/rtf\"],\n html: [\"text/html\"],\n htm: [\"text/html\"],\n md: [\"text/markdown\", \"text/x-markdown\"],\n zip: [\"application/zip\"],\n mp3: [\"audio/mpeg\"],\n wma: [\"audio/x-ms-wma\", \"video/x-ms-asf\"],\n mp4: [\"video/mp4\"],\n mpg: [\"video/mpeg\"],\n mpeg: [\"video/mpeg\"],\n flv: [\"video/x-flv\"],\n avi: [\"video/x-msvideo\"],\n jpg: [\"image/jpeg\"],\n jpeg: [\"image/jpeg\"],\n png: [\"image/png\"],\n gif: [\"image/gif\"],\n};\n\nexport const ERROR_CODES = {\n FILE_TOO_LARGE: \"file-too-large\",\n FILE_INVALID_TYPE: \"file-invalid-type\",\n TOO_MANY_FILES: \"too-many-files\",\n};\n\nexport const DIRECT_UPLOAD_URL = \"/api/direct_uploads\";\n","import path from \"path\";\n\nimport { t } from \"i18next\";\nimport { isNotPresent } from \"neetocist\";\n\nimport { FILE_MIME_TYPES, ERROR_CODES } from \"./constants\";\n\nexport const getAcceptedFileTypes = allowedFileTypes => {\n const accepted = {};\n\n allowedFileTypes.split(\", \").forEach(type => {\n const mimeTypes = FILE_MIME_TYPES[type];\n const extension = `.${type}`;\n\n if (isNotPresent(type) || isNotPresent(mimeTypes)) return;\n\n mimeTypes.forEach(mimeType => {\n if (accepted[mimeType]) accepted[mimeType].push(extension);\n else accepted[mimeType] = [extension];\n });\n });\n\n return accepted;\n};\n\nexport const convertBytesToMb = bytes =>\n ((bytes - 10) / (1028 * 1024)).toFixed(2);\n\nexport const renderErrorMessage = (errorObject, maxFileSize, isMultiple) => {\n const error = errorObject.errors[0];\n const file = errorObject.file;\n if (error) {\n const { code } = error;\n if (code === ERROR_CODES.FILE_TOO_LARGE) {\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.fileTooLarge\", {\n fileName: file.name,\n maxSize: `${Math.round(maxFileSize / 1048576)}MB`,\n });\n } else if (code === ERROR_CODES.FILE_INVALID_TYPE) {\n return t(\n \"neetoMolecules.fileUpload.filesDropzone.errors.fileInvalidType\",\n { fileType: path.extname(file.name) }\n );\n } else if (code === ERROR_CODES.TOO_MANY_FILES && !isMultiple) {\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles\", {\n maxFiles: 1,\n });\n }\n }\n\n return t(\"neetoMolecules.fileUpload.filesDropzone.errors.defaultError\", {\n fileName: file.name,\n });\n};\n\nexport const convertMbToBytes = mb => mb * 1028 * 1024 + 10;\n","import { useTranslation } from \"react-i18next\";\n\nimport { ERROR_CODES } from \"./constants\";\nimport { renderErrorMessage } from \"./utils\";\n\nconst ErrorMessages = ({ fileRejections, maxFileSizeInBytes }) => {\n const { t } = useTranslation();\n\n const hasMultipleFileErrors = fileRejections.some(\n ({ errors }) => errors[0].code === ERROR_CODES.TOO_MANY_FILES\n );\n\n return (\n <>\n {hasMultipleFileErrors && (\n <p\n className=\"neeto-molecules-input__error-text\"\n data-cy=\"form-file-upload-input-error\"\n >\n <span className=\"neeto-molecules-input__error-text-style-handle\">\n {t(\"neetoMolecules.fileUpload.filesDropzone.errors.tooManyFiles\", {\n maxFiles: 1,\n })}\n </span>\n </p>\n )}\n {fileRejections\n .filter(({ errors }) => errors[0].code !== ERROR_CODES.TOO_MANY_FILES)\n .map((file, index) => (\n <p\n className=\"neeto-molecules-input__error-text\"\n data-cy=\"form-file-upload-input-error\"\n key={index}\n >\n <span className=\"neeto-molecules-input__error-text-style-handle\">\n {renderErrorMessage(file, maxFileSizeInBytes, false)}\n </span>\n </p>\n ))}\n </>\n );\n};\n\nexport default ErrorMessages;\n","import { motion } from \"framer-motion\";\n\nconst Progress = ({\n percents,\n stroke = \"currentColor\",\n emptyStroke = stroke,\n emptyStrokeOpacity = 0.25,\n duration = 0.5,\n delay = 0,\n size = 100,\n strokeWidth = 12,\n}) => {\n const radius = 45;\n const circumference = Math.ceil(2 * Math.PI * radius);\n const fillPercents = Math.abs(\n Math.ceil((circumference / 100) * (percents - 100))\n );\n\n const transition = { duration, delay };\n\n const variants = {\n hidden: { strokeDashoffset: circumference, transition },\n show: { strokeDashoffset: fillPercents, transition },\n };\n\n return (\n <div className=\"neeto-molecules-progress__circle\">\n <div\n className=\"neeto-molecules-progress__circle-wrapper\"\n style={{ height: size }}\n >\n <svg\n height={size}\n version=\"1.1\"\n viewBox=\"0 0 100 100\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n {...{ strokeWidth }}\n className=\"circle\"\n cx=\"50\"\n cy=\"50\"\n fill=\"transparent\"\n r={radius}\n stroke={emptyStroke}\n strokeOpacity={emptyStrokeOpacity}\n />\n </svg>\n <svg\n height={size}\n viewBox=\"0 0 100 100\"\n width={size}\n style={{\n position: \"absolute\",\n transform: \"rotate(-90deg)\",\n overflow: \"visible\",\n top: 0,\n }}\n >\n <motion.circle\n {...{ stroke, strokeWidth, variants }}\n animate=\"show\"\n cx=\"50\"\n cy=\"50\"\n fill=\"transparent\"\n initial=\"hidden\"\n r={radius}\n strokeDasharray={circumference}\n strokeDashoffset={fillPercents}\n />\n </svg>\n </div>\n </div>\n );\n};\n\nexport default Progress;\n","import classnames from \"classnames\";\nimport { FileGeneric, Check, Close } from \"neetoicons\";\n\nimport Progress from \"./Progress\";\nimport { convertBytesToMb } from \"./utils\";\n\nconst FilePreview = ({ file, isUploading, cancel, progress }) => (\n <li\n className=\"neeto-molecules-file-upload__uploaded-list-item\"\n key={file.url}\n >\n <div className=\"neeto-molecules-file-upload__file-preview\">\n <a\n className={classnames({ \"neeto-molecules-invisible\": isUploading })}\n href={file.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n <FileGeneric />\n </a>\n {isUploading && (\n <div className=\"neeto-molecules-progress\">\n <Progress percents={progress || 0} size={20} />\n </div>\n )}\n </div>\n <div className=\"neeto-molecules-file-upload__file-info\">\n <span\n className=\"neeto-molecules-file-upload__file-info-name\"\n data-cy=\"file-name\"\n >\n {file.name}\n </span>\n <span className=\"neeto-molecules-file-upload__file-info-size\">\n {file.size ? `${convertBytesToMb(file.size)} MB` : \"\"}\n </span>\n </div>\n <div className=\"neeto-molecules-file-upload__actions\">\n <span\n className={classnames(\n \"neeto-molecules-file-upload__success-indicator\",\n { \"neeto-molecules-file-upload__success-indicator--active\": file.url }\n )}\n >\n {file.url && <Check data-cy=\"file-upload-success\" />}\n </span>\n <button\n className=\"neeto-molecules-file-upload__button--red neeto-molecules-file-upload__remove-button\"\n type=\"button\"\n onClick={cancel}\n >\n <Close />\n </button>\n </div>\n </li>\n);\n\nexport default FilePreview;\n","import { useState, useCallback, useEffect, useRef } from \"react\";\n\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { findBy } from \"neetocist\";\nimport { assoc } from \"ramda\";\nimport { useDropzone } from \"react-dropzone\";\n\nimport { DIRECT_UPLOAD_URL } from \"../constants\";\nimport { convertMbToBytes, renderErrorMessage } from \"../utils\";\n\nconst useFileUpload = ({\n disabled,\n accept,\n multiple,\n maxFileSize,\n minFileSize,\n files,\n onChange,\n setError,\n setTouched,\n}) => {\n const [uploadProgress, setUploadProgress] = useState({});\n const [uploadError, setUploadError] = useState(\"\");\n\n const filesRef = useRef(files);\n filesRef.current = files;\n\n const cancel = useCallback(\n index => () => {\n setUploadProgress(assoc(files[index].name, null));\n const newFiles = files?.filter((_, idx) => idx !== index);\n onChange(newFiles);\n },\n [files]\n );\n\n useEffect(() => {\n uploadError && setError(uploadError);\n }, [uploadError]);\n\n const onDropAccepted = async acceptedFiles => {\n setTouched(false);\n setUploadError(\"\");\n const initialFiles = acceptedFiles.map(file => ({\n name: file.name,\n size: file.size,\n }));\n\n const updatedFiles = multiple\n ? [...(files || []), ...initialFiles]\n : initialFiles;\n onChange(updatedFiles);\n const newFiles = await new Promise(resolve => {\n const files = [];\n\n acceptedFiles.forEach(file => {\n setUploadProgress(assoc(file.name, 0));\n\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL, {\n directUploadWillStoreFileWithXHR: xhr => {\n xhr.upload.addEventListener(\"progress\", event => {\n const percentComplete = Math.round(\n (event.loaded / event.total) * 100\n );\n setUploadProgress(assoc(file.name, percentComplete));\n });\n\n xhr.upload.addEventListener(\"load\", () => {\n setUploadProgress(assoc(file.name, undefined));\n });\n },\n });\n\n upload.create((error, blob) => {\n if (error) {\n return setUploadError(error);\n }\n\n files.push({\n url: blob.blob_url,\n name: blob.filename,\n signedId: blob.signed_id,\n });\n\n const isUploadCompleted = multiple\n ? acceptedFiles.length === files.length\n : files.length === 1;\n\n if (isUploadCompleted) {\n return resolve(files);\n }\n\n return \"\";\n });\n });\n\n return files;\n });\n\n if (multiple) {\n const updatedFiles = filesRef.current.map(file => {\n const uploadedFile = findBy({ name: file.name }, newFiles);\n\n return { ...file, ...uploadedFile };\n });\n onChange(updatedFiles);\n } else {\n onChange(newFiles);\n }\n };\n\n const onDropRejected = fileRejections => {\n fileRejections.forEach(fileObject => {\n setTouched(true);\n if (fileObject.errors[0].code === \"too-many-files\") {\n setUploadError(renderErrorMessage(fileObject, maxFileSize, multiple));\n } else {\n setUploadError(renderErrorMessage(fileObject, maxFileSize, multiple));\n }\n });\n };\n\n const { getRootProps, getInputProps, isDragActive, fileRejections } =\n useDropzone({\n disabled,\n accept,\n multiple,\n minSize: convertMbToBytes(minFileSize),\n onDropAccepted,\n onDropRejected,\n ...(maxFileSize && { maxSize: convertMbToBytes(maxFileSize) }),\n });\n\n return {\n progress: uploadProgress,\n cancel,\n getRootProps,\n getInputProps,\n isDragActive,\n fileRejections,\n };\n};\n\nexport default useFileUpload;\n","import { isNotEmpty, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty, isNotNil } from \"ramda\";\n\nimport DropZone from \"./DropZone\";\nimport ErrorMessages from \"./ErrorMessages\";\nimport \"./file-upload.scss\";\nimport FilePreview from \"./FilePreview\";\nimport useFileUpload from \"./hooks/useFileUpload\";\nimport { getAcceptedFileTypes } from \"./utils\";\n\nconst FileUpload = ({\n allowedFileTypes = \"\",\n multipleFilesAllowed = true,\n maxFileSize = 1,\n isPreview = false,\n minFileSize = 0,\n files = [],\n onChange = noop,\n error,\n setError = noop,\n setTouched = noop,\n}) => {\n const {\n progress,\n cancel,\n getRootProps,\n getInputProps,\n isDragActive,\n fileRejections,\n } = useFileUpload({\n disabled: isPreview,\n accept: getAcceptedFileTypes(allowedFileTypes),\n multiple: multipleFilesAllowed,\n maxFileSize,\n minFileSize,\n files,\n onChange,\n setError,\n setTouched,\n });\n\n const maxFileSizeInBytes = maxFileSize * 1000000;\n\n const isUploadingFile = file =>\n isNotNil(progress[file.name]) && (progress[file.name] !== 100 || !file.url);\n\n const shouldShowError = error && isEmpty(fileRejections);\n\n return (\n <>\n <DropZone\n {...{\n allowedFileTypes,\n getInputProps,\n getRootProps,\n isDragActive,\n maxFileSize,\n multipleFilesAllowed,\n }}\n />\n {!isEmpty(files) && (\n <ul className=\"neeto-molecules-file-upload__uploaded-list\">\n {files?.map((file, idx) => (\n <FilePreview\n {...{ file }}\n cancel={cancel(idx)}\n isUploading={isUploadingFile(file)}\n key={idx}\n progress={progress[file.name]}\n />\n ))}\n </ul>\n )}\n {isNotEmpty(fileRejections) && (\n <ErrorMessages {...{ fileRejections, maxFileSizeInBytes }} />\n )}\n {shouldShowError && (\n <p\n className=\"neeto-molecules-input__error-text\"\n data-cy=\"form-file-upload-input-error\"\n >\n <span className=\"neeto-molecules-input__error-text-style-handle\">\n {error}\n </span>\n </p>\n )}\n </>\n );\n};\n\nFileUpload.propTypes = {\n /**\n * Allowed file types for the file upload component.\n */\n allowedFileTypes: PropTypes.string,\n /**\n * Boolean to allow multiple files to be uploaded.\n */\n multipleFilesAllowed: PropTypes.bool,\n /**\n * Maximum file size allowed for the file upload component(MB).\n */\n maxFileSize: PropTypes.number,\n /**\n * Boolean to use component as a preview component.\n */\n isPreview: PropTypes.bool,\n /**\n * Minimum file size allowed for the file upload component(MB).\n */\n minFileSize: PropTypes.number,\n /**\n * Uploaded files.\n */\n files: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n size: PropTypes.number,\n url: PropTypes.string,\n })\n ),\n /**\n * Function to be called on file upload, with the updated files array.\n */\n onChange: PropTypes.func,\n /**\n * Error message to be displayed.\n */\n error: PropTypes.string,\n /**\n * Function to set error message.\n */\n setError: PropTypes.func,\n};\n\nexport default FileUpload;\n","import { useField } from \"formik\";\n\nimport FileUpload from \"./FileUpload\";\n\nconst FormikFileUpload = ({ name, ...props }) => {\n const [_, { value, touched, error }, { setValue, setTouched, setError }] =\n useField(name);\n\n const errorToDisplay = touched && error ? error : \"\";\n\n return (\n <FileUpload\n {...{ ...props, setError, setTouched }}\n error={errorToDisplay}\n files={value}\n onChange={setValue}\n />\n );\n};\n\nexport default FormikFileUpload;\n"],"names":["DropZone","_ref","isDragActive","getRootProps","getInputProps","multipleFilesAllowed","maxFileSize","allowedFileTypes","_useTranslation","useTranslation","t","shouldAllowSingleFileUpload","shouldShowFileSizeLimit","_jsx","_objectSpread","className","classnames","children","_jsxs","FileUpload","size","htmlFor","unit","types","FILE_MIME_TYPES","pdf","doc","docx","xls","xlsx","csv","txt","rtf","html","htm","md","zip","mp3","wma","mp4","mpg","mpeg","flv","avi","jpg","jpeg","png","gif","ERROR_CODES","FILE_TOO_LARGE","FILE_INVALID_TYPE","TOO_MANY_FILES","DIRECT_UPLOAD_URL","getAcceptedFileTypes","accepted","split","forEach","type","mimeTypes","extension","concat","isNotPresent","mimeType","push","convertBytesToMb","bytes","toFixed","renderErrorMessage","errorObject","isMultiple","error","errors","file","code","fileName","name","maxSize","Math","round","fileType","path","extname","maxFiles","convertMbToBytes","mb","ErrorMessages","fileRejections","maxFileSizeInBytes","hasMultipleFileErrors","some","_ref2","_Fragment","filter","_ref3","map","index","Progress","percents","_ref$stroke","stroke","_ref$emptyStroke","emptyStroke","_ref$emptyStrokeOpaci","emptyStrokeOpacity","_ref$duration","duration","_ref$delay","delay","_ref$size","_ref$strokeWidth","strokeWidth","radius","circumference","ceil","PI","fillPercents","abs","transition","variants","hidden","strokeDashoffset","show","style","height","version","viewBox","width","xmlns","cx","cy","fill","r","strokeOpacity","position","transform","overflow","top","motion","circle","animate","initial","strokeDasharray","FilePreview","isUploading","cancel","progress","href","url","rel","target","FileGeneric","Check","onClick","Close","useFileUpload","disabled","accept","multiple","minFileSize","files","onChange","setError","setTouched","_useState","useState","_useState2","_slicedToArray","uploadProgress","setUploadProgress","_useState3","_useState4","uploadError","setUploadError","filesRef","useRef","current","useCallback","assoc","newFiles","_","idx","useEffect","onDropAccepted","_asyncToGenerator","_regeneratorRuntime","mark","_callee","acceptedFiles","initialFiles","updatedFiles","_updatedFiles","wrap","_callee$","_context","prev","next","_toConsumableArray","Promise","resolve","upload","DirectUpload","directUploadWillStoreFileWithXHR","xhr","addEventListener","event","percentComplete","loaded","total","undefined","create","blob","blob_url","filename","signedId","signed_id","isUploadCompleted","length","sent","uploadedFile","findBy","stop","_x","apply","arguments","onDropRejected","fileObject","_useDropzone","useDropzone","minSize","_ref$allowedFileTypes","_ref$multipleFilesAll","_ref$maxFileSize","_ref$isPreview","isPreview","_ref$minFileSize","_ref$files","_ref$onChange","noop","_ref$setError","_ref$setTouched","_useFileUpload","isUploadingFile","isNotNil","shouldShowError","isEmpty","_createElement","key","isNotEmpty","FormikFileUpload","props","_objectWithoutProperties","_excluded","_useField","useField","_useField2","_useField2$","value","touched","_useField2$2","setValue","errorToDisplay"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,QAAQ,GAAG,SAAX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AAA,WAAA,GAAAD,UAAA,CAAA,CAAA,CAAA,CAAA;IAAIE,KAAK,GAAAD,WAAA,CAALC,KAAK,CAAA;IAAEC,OAAO,GAAAF,WAAA,CAAPE,OAAO,CAAA;IAAE3L,KAAK,GAAAyL,WAAA,CAALzL,KAAK,CAAA;AAAA4L,IAAAA,YAAA,GAAAJ,UAAA,CAAA,CAAA,CAAA,CAAA;IAAMK,QAAQ,GAAAD,YAAA,CAARC,QAAQ,CAAA;IAAEjG,UAAU,GAAAgG,YAAA,CAAVhG,UAAU,CAAA;IAAED,QAAQ,GAAAiG,YAAA,CAARjG,SAAQ;EAGrE,IAAMmG,cAAc,GAAGH,OAAO,IAAI3L,KAAK,GAAGA,KAAK,GAAG,EAAE,CAAA;AAEpD,EAAA,oBACEzD,GAAA,CAACM,UAAU,EAAAL,aAAA,CAAAA,aAAA,CAAA,EAAA,EAAAA,aAAA,CAAAA,aAAA,CAAA,EAAA,EACA2O,KAAK,CAAA,EAAA,EAAA,EAAA;AAAExF,IAAAA,QAAQ,EAARA,QAAQ;AAAEC,IAAAA,UAAU,EAAVA,UAAAA;AAAU,GAAA,CAAA,CAAA,EAAA,EAAA,EAAA;AACpC5F,IAAAA,KAAK,EAAE8L,cAAe;AACtBrG,IAAAA,KAAK,EAAEiG,KAAM;AACbhG,IAAAA,QAAQ,EAAEmG,QAAAA;AAAS,GAAA,CACpB,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import { memo, useState, useEffect, forwardRef } from 'react';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
|
-
import { isNotPresent, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
|
|
6
|
+
import { isNotPresent, isPresent, truncate, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
7
7
|
import useFetchNeetoApps from '@bigbinary/neeto-commons-frontend/react-utils/useFetchNeetoApps';
|
|
8
8
|
import Help from '@bigbinary/neeto-icons/Help';
|
|
9
9
|
import { Profile } from '@bigbinary/neeto-team-members-frontend';
|
|
@@ -21,7 +21,7 @@ import { n } from './inject-css-c86de496.js';
|
|
|
21
21
|
import Neeto from '@bigbinary/neeto-icons/typeface-logos/Neeto';
|
|
22
22
|
import * as AppIcons from '@bigbinary/neeto-icons/typeface-logos';
|
|
23
23
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
24
|
-
import { toLower, omit, mergeDeepLeft } from 'ramda';
|
|
24
|
+
import { toLower, omit, prop, mergeDeepLeft } from 'ramda';
|
|
25
25
|
import { t } from 'i18next';
|
|
26
26
|
import Book from '@bigbinary/neeto-icons/Book';
|
|
27
27
|
import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
|
|
@@ -368,24 +368,26 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
|
368
368
|
var user = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || ((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.phoneNumber);
|
|
369
369
|
return "sidebarState-".concat(user);
|
|
370
370
|
};
|
|
371
|
-
var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen) {
|
|
371
|
+
var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen, isAuthenticated) {
|
|
372
372
|
return [{
|
|
373
373
|
label: t("neetoMolecules.sidebar.myProfile"),
|
|
374
374
|
onClick: function onClick() {
|
|
375
375
|
return setIsProfilePaneOpen(true);
|
|
376
376
|
},
|
|
377
377
|
"data-cy": "my-profile-button",
|
|
378
|
-
"data-testid": "my-profile-button"
|
|
379
|
-
|
|
378
|
+
"data-testid": "my-profile-button",
|
|
379
|
+
isEnabled: isAuthenticated
|
|
380
|
+
}, {
|
|
380
381
|
label: t("neetoMolecules.sidebar.myWorkspace"),
|
|
381
382
|
onClick: function onClick() {
|
|
382
383
|
return window.open(MY_ORGANIZATION_URL, "_self");
|
|
383
384
|
},
|
|
384
|
-
"data-cy": "profile-organization-settings-button"
|
|
385
|
-
|
|
385
|
+
"data-cy": "profile-organization-settings-button",
|
|
386
|
+
isEnabled: isAuthenticated && isOwner
|
|
387
|
+
}].filter(prop("isEnabled"));
|
|
386
388
|
};
|
|
387
|
-
var getDefaultBottomLinks = function getDefaultBottomLinks() {
|
|
388
|
-
return [{
|
|
389
|
+
var getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated) {
|
|
390
|
+
return [isAuthenticated ? {
|
|
389
391
|
label: t("neetoMolecules.sidebar.logout"),
|
|
390
392
|
onClick: function onClick() {
|
|
391
393
|
resetAuthTokens();
|
|
@@ -394,14 +396,22 @@ var getDefaultBottomLinks = function getDefaultBottomLinks() {
|
|
|
394
396
|
window.location.href = "/logout";
|
|
395
397
|
},
|
|
396
398
|
"data-cy": "profile-logout-button"
|
|
399
|
+
} : {
|
|
400
|
+
label: t("neetoMolecules.sidebar.login"),
|
|
401
|
+
onClick: function onClick() {
|
|
402
|
+
// eslint-disable-next-line xss/no-location-href-assign
|
|
403
|
+
window.location.href = "/login";
|
|
404
|
+
},
|
|
405
|
+
"data-cy": "profile-login-button"
|
|
397
406
|
}];
|
|
398
407
|
};
|
|
399
408
|
var getProfileInfo = function getProfileInfo(profileInfoOverrides) {
|
|
400
|
-
var _globalProps$user3, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
|
|
409
|
+
var _globalProps$user$fir, _globalProps$user3, _globalProps$user$las, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
|
|
401
410
|
return mergeDeepLeft(profileInfoOverrides, {
|
|
402
|
-
name: "".concat((_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName, " ").concat((_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName),
|
|
403
|
-
imageUrl: (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl,
|
|
404
|
-
email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber)
|
|
411
|
+
name: "".concat((_globalProps$user$fir = (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName) !== null && _globalProps$user$fir !== void 0 ? _globalProps$user$fir : "", " ").concat((_globalProps$user$las = (_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName) !== null && _globalProps$user$las !== void 0 ? _globalProps$user$las : ""),
|
|
412
|
+
imageUrl: globalProps.authenticated ? (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl : "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
|
|
413
|
+
email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber),
|
|
414
|
+
isAuthenticated: globalProps.authenticated
|
|
405
415
|
});
|
|
406
416
|
};
|
|
407
417
|
|
|
@@ -507,19 +517,22 @@ var ProfileMenu = function ProfileMenu(_ref) {
|
|
|
507
517
|
var Menu = Dropdown$1.Menu,
|
|
508
518
|
MenuItem = Dropdown$1.MenuItem,
|
|
509
519
|
Divider = Dropdown$1.Divider;
|
|
520
|
+
var isAuthenticated = profileInfo.isAuthenticated;
|
|
510
521
|
return /*#__PURE__*/jsxs(Menu, {
|
|
511
522
|
className: "pb-1",
|
|
512
523
|
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
513
524
|
className: "neeto-molecules-profile-popup mb-1",
|
|
514
525
|
"data-cy": "profile-popup",
|
|
515
526
|
"data-testid": "profile-popup",
|
|
516
|
-
children: /*#__PURE__*/jsx(ProfileHeader, {
|
|
527
|
+
children: isAuthenticated && /*#__PURE__*/jsx(ProfileHeader, {
|
|
517
528
|
profileInfo: profileInfo
|
|
518
529
|
})
|
|
519
530
|
}), showProductSwitcher && /*#__PURE__*/jsx(ProductSwitcher, {
|
|
520
531
|
toggleModal: toggleModal
|
|
521
|
-
}), isThemeSwitcherEnabled && /*#__PURE__*/jsx(ThemeSwitcher, {}),
|
|
522
|
-
|
|
532
|
+
}), isThemeSwitcherEnabled && /*#__PURE__*/jsx(ThemeSwitcher, {}), isNotEmpty(topLinks) && /*#__PURE__*/jsxs(Fragment, {
|
|
533
|
+
children: [/*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsx(LinkSection, {
|
|
534
|
+
links: topLinks
|
|
535
|
+
})]
|
|
523
536
|
}), isPresent(customContent) && /*#__PURE__*/jsxs(Fragment, {
|
|
524
537
|
children: [/*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsx(MenuItem, {
|
|
525
538
|
className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content",
|
|
@@ -580,8 +593,8 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
580
593
|
if (!isStale) return;
|
|
581
594
|
refetch();
|
|
582
595
|
}, [isStale]);
|
|
583
|
-
var newTopLinks = globalProps.appName.toLowerCase() !== "neetoauth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen)), _toConsumableArray(topLinks)) : topLinks;
|
|
584
|
-
var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks()), _toConsumableArray(bottomLinks));
|
|
596
|
+
var newTopLinks = globalProps.appName.toLowerCase() !== "neetoauth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen, profileInfo.isAuthenticated)), _toConsumableArray(topLinks)) : topLinks;
|
|
597
|
+
var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks(profileInfo.isAuthenticated)), _toConsumableArray(bottomLinks));
|
|
585
598
|
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
|
|
586
599
|
return _objectSpread$1({}, DEFAULT_HELP_LINK_PROPS[key]);
|
|
587
600
|
}).filter(function (_ref2) {
|