hrm_ui_lib 1.6.14 → 1.6.16
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/{Button-cc4207a0.js → Alert-ca805215.js} +350 -8
- package/components/Alert/Alert.js +22 -63
- package/components/Alert/index.js +13 -3
- package/components/Avatar/Avatar.js +21 -11
- package/components/Avatar/AvatarGroup.js +12 -2
- package/components/Avatar/index.js +15 -5
- package/components/Button/Button.js +19 -6
- package/components/Button/index.js +19 -6
- package/components/CardBody/CardBody.js +14 -1
- package/components/CardBody/index.js +14 -1
- package/components/CardSelect/CardSelect.js +15 -2
- package/components/CardSelect/CardSelectGroup.js +15 -2
- package/components/CardSelect/components/CardInput.js +15 -2
- package/components/CardSelect/components/index.js +15 -2
- package/components/CardSelect/index.js +15 -2
- package/components/Checkbox/Checkbox.js +17 -4
- package/components/Checkbox/index.js +19 -6
- package/components/Copy/Copy.js +18 -5
- package/components/Copy/index.js +18 -5
- package/components/Counter/Counter.js +15 -2
- package/components/Counter/index.js +15 -2
- package/components/DatePicker/CustomHeader/CustomHeader.js +71 -42
- package/components/DatePicker/RangeDatePicker/RangeDatePicker.js +50 -24
- package/components/DatePicker/RangeDatePicker/RangeDatePickerDesktop.js +19 -5
- package/components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js +52 -26
- package/components/DatePicker/RangeDatePicker/index.js +50 -24
- package/components/DatePicker/SimpleDatePicker/SimpleDatePicker.d.ts +2 -2
- package/components/DatePicker/SimpleDatePicker/SimpleDatePicker.js +54 -24
- package/components/DatePicker/SimpleDatePicker/SimpleDatePickerDesktop.js +50 -22
- package/components/DatePicker/SimpleDatePicker/SimpleDatePickerMobile.js +50 -22
- package/components/DatePicker/SimpleDatePicker/index.js +49 -21
- package/components/DatePicker/TimePicker/MobileModalContent.js +17 -4
- package/components/DatePicker/TimePicker/TimePicker.js +16 -4
- package/components/DatePicker/TimePicker/TimePickerDesktop.js +16 -4
- package/components/DatePicker/TimePicker/TimePickerMobile.js +16 -3
- package/components/DatePicker/TimePicker/index.js +16 -4
- package/components/DatePicker/index.js +48 -23
- package/components/Empty/Empty.js +14 -1
- package/components/Empty/index.js +14 -1
- package/components/FileUpload/DropzoneFileUpload/DropzoneFileUpload.d.ts +2 -2
- package/components/FileUpload/DropzoneFileUpload/DropzoneFileUpload.js +18 -144
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.js +15 -35
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +18 -72
- package/components/FileUpload/DropzoneFileUpload/helpers.js +16 -89
- package/components/FileUpload/DropzoneFileUpload/index.js +14 -19
- package/components/FileUpload/FileUpload.js +17 -7
- package/components/FileUpload/UploadItems.js +17 -5
- package/components/FileUpload/index.js +26 -31
- package/components/FormContainer/FormContainer.js +15 -2
- package/components/FormContainer/index.js +15 -2
- package/components/FormField/FormField.js +16 -3
- package/components/FormField/index.js +16 -3
- package/components/Input/Input.js +16 -3
- package/components/Input/index.js +15 -2
- package/components/ItemSelect/ItemSelect.js +16 -3
- package/components/ItemSelect/ItemSelectGroup.js +16 -3
- package/components/ItemSelect/index.js +16 -3
- package/components/Menu/Menu.js +14 -4
- package/components/Menu/NestedMenu.js +12 -2
- package/components/Menu/index.js +14 -4
- package/components/Modal/Modal.js +16 -3
- package/components/Modal/ModalConfirmation.js +14 -1
- package/components/Modal/ModalContent.js +14 -1
- package/components/Modal/index.js +19 -6
- package/components/More/More.js +14 -1
- package/components/More/index.js +14 -1
- package/components/Popover/Popover.js +16 -3
- package/components/Popover/PopoverMobile.js +17 -4
- package/components/Popover/index.js +19 -6
- package/components/Radio/RadioGroup.js +16 -3
- package/components/Radio/index.js +16 -3
- package/components/Select/ButtonSelect/ButtonSelect.js +13 -4
- package/components/Select/FilterSelect/FilterDropdown.js +14 -4
- package/components/Select/FilterSelect/FilterGroupDropdown.js +14 -4
- package/components/Select/FilterSelect/FilterSelect.js +13 -4
- package/components/Select/MultiSelect/MobileWrapper.js +19 -6
- package/components/Select/MultiSelect/MultiBase/MultiBase.js +13 -4
- package/components/Select/MultiSelect/MultiSelect.d.ts +2 -2
- package/components/Select/MultiSelect/MultiSelect.js +23 -13
- package/components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js +13 -4
- package/components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js +13 -4
- package/components/Select/MultiSelect/OptionsWrapper.js +17 -8
- package/components/Select/NestedSelect/NestedSelect.js +15 -5
- package/components/Select/Select/Select.d.ts +2 -2
- package/components/Select/Select/Select.js +18 -8
- package/components/Select/Select/SelectDesktop/index.js +13 -4
- package/components/Select/Select/SelectMobile/MobileTopContent.js +14 -2
- package/components/Select/Select/SelectMobile/index.js +13 -4
- package/components/Select/SharedComponents/Actions.js +17 -7
- package/components/Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js +14 -1
- package/components/Select/SharedComponents/ContentTop.js +13 -4
- package/components/Select/SharedComponents/Footer.js +17 -4
- package/components/Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js +17 -4
- package/components/Select/SharedComponents/index.js +17 -8
- package/components/Select/index.js +12 -3
- package/components/SideSheet/Footer/Footer.js +18 -5
- package/components/SideSheet/SideSheet.js +13 -1
- package/components/SideSheet/index.js +16 -4
- package/components/Snackbar/Snackbar.js +16 -3
- package/components/Snackbar/index.js +14 -1
- package/components/Switcher/Switcher.js +16 -3
- package/components/Switcher/index.js +16 -3
- package/components/Table/Header.js +13 -1
- package/components/Table/IndeterminateCheckbox.js +18 -5
- package/components/Table/Row.js +16 -4
- package/components/Table/Table.js +16 -4
- package/components/Table/index.js +17 -5
- package/components/Table/utils.js +17 -5
- package/components/Textarea/Textarea.js +21 -6
- package/components/Textarea/index.js +15 -2
- package/helperComponents/GoToWebPage/GoToWebPage.js +14 -1
- package/helperComponents/OptionItem/OptionItem.js +13 -3
- package/helperComponents/OptionItem/index.js +15 -5
- package/helperComponents/index.js +12 -2
- package/helpers/check-authorization.js +11 -1
- package/helpers/index.js +10 -1
- package/index.js +35 -40
- package/package.json +1 -1
- package/stories/Select.stories.d.ts +1 -1
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { _ as _extends } from './extends-7ebf6528.js';
|
|
2
|
+
import React, { useMemo, forwardRef, useState, useCallback, useId, useEffect, useRef } from 'react';
|
|
3
|
+
import { ICONS_MAPPING, TYPE_MAPPING } from './components/Alert/consts.js';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { Text } from './components/Text/Text.js';
|
|
2
6
|
import { _ as _defineProperty } from './defineProperty-cd2759b8.js';
|
|
3
7
|
import { _ as _objectWithoutProperties } from './objectWithoutProperties-162f125b.js';
|
|
4
|
-
import React, { useState, useId, useEffect, forwardRef, useRef, useMemo } from 'react';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
8
|
import 'dayjs';
|
|
7
9
|
import { Loader } from './helperComponents/Loader/Loader.js';
|
|
8
|
-
import './consts/index.js';
|
|
10
|
+
import { FILE_ACCEPT_TYPE } from './consts/index.js';
|
|
9
11
|
import './hooks/useScreenSize.js';
|
|
10
12
|
import 'react-hook-form';
|
|
11
|
-
import '
|
|
12
|
-
import 'react-toastify';
|
|
13
|
+
import { _ as _toConsumableArray } from './toConsumableArray-38890490.js';
|
|
13
14
|
import { _ as _slicedToArray } from './slicedToArray-7fbc5104.js';
|
|
15
|
+
import { ErrorCode, useDropzone } from 'react-dropzone';
|
|
16
|
+
import { IconUpload } from './components/SVGIcons/IconUpload.js';
|
|
17
|
+
import { FileTypeEnum } from './type/file-upload.js';
|
|
18
|
+
import { FileUploadMode } from './components/FileUpload/types.js';
|
|
19
|
+
import { getTranslationLocale } from './helpers/locale.js';
|
|
20
|
+
import 'react-toastify';
|
|
14
21
|
import { useIsMobile } from './hooks/useGetIsMobile.js';
|
|
15
22
|
import { motion } from 'framer-motion';
|
|
16
23
|
import { AnimatePresenceWrapper } from './helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
@@ -18,16 +25,301 @@ import { useOnOutsideClick } from './hooks/useOnOutsideClick.js';
|
|
|
18
25
|
import { useHideBodyScroll } from './hooks/useHideBodyScroll.js';
|
|
19
26
|
import { IconDismiss } from './components/SVGIcons/IconDismiss.js';
|
|
20
27
|
import { Positions } from './components/Tooltip/types.js';
|
|
21
|
-
import { Text } from './components/Text/Text.js';
|
|
22
28
|
import { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
23
|
-
import { noop } from './utils/helpers.js';
|
|
29
|
+
import { uniqueFiles, noop } from './utils/helpers.js';
|
|
24
30
|
import 'react-syntax-highlighter';
|
|
25
31
|
import { Link } from './components/Link/Link.js';
|
|
26
32
|
import { PopoverDesktop } from './components/Popover/PopoverDesktop.js';
|
|
27
33
|
import { IconInfo } from './components/SVGIcons/IconInfo.js';
|
|
28
34
|
import { IconDynamicComponent } from './helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
35
|
+
import { IconDismissFilled } from './components/SVGIcons/IconDismissFilled.js';
|
|
36
|
+
import { IconDelete } from './components/SVGIcons/IconDelete.js';
|
|
37
|
+
import { FilePreview } from './components/FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
38
|
+
import { IconArrowDownloadFilled } from './components/SVGIcons/IconArrowDownloadFilled.js';
|
|
39
|
+
import { downloadFile } from './helpers/download-file.js';
|
|
29
40
|
import { LITE_LOADER_TYPES, ICON_SIZE_MAPPING, ICON_TYPE_MAPPING } from './components/Button/consts.js';
|
|
30
41
|
|
|
42
|
+
var shortenFileName = function shortenFileName(fileName, maxLength) {
|
|
43
|
+
// Regular expression to split the name into three parts: start, middle, and extension
|
|
44
|
+
var regex = /^(.{10}).*?(.{10}\.[^.]*)$/;
|
|
45
|
+
|
|
46
|
+
// If the file name length exceeds maxLength, shorten it
|
|
47
|
+
if (fileName.length > maxLength) {
|
|
48
|
+
return fileName.replace(regex, '$1...$2');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// If it's short enough, return as is
|
|
52
|
+
return fileName;
|
|
53
|
+
};
|
|
54
|
+
var formatFileSize = function formatFileSize(sizeInBytes) {
|
|
55
|
+
var fractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
56
|
+
if (sizeInBytes < 1024) {
|
|
57
|
+
return "".concat(sizeInBytes, " B"); // Bytes
|
|
58
|
+
} else if (sizeInBytes < 1024 * 1024) {
|
|
59
|
+
return "".concat((sizeInBytes / 1024).toFixed(fractionDigits), " KB"); // Kilobytes
|
|
60
|
+
} else if (sizeInBytes < 1024 * 1024 * 1024) {
|
|
61
|
+
return "".concat((sizeInBytes / (1024 * 1024)).toFixed(fractionDigits), " MB"); // Megabytes
|
|
62
|
+
} else {
|
|
63
|
+
return "".concat((sizeInBytes / (1024 * 1024 * 1024)).toFixed(fractionDigits), " GB"); // Gigabytes
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var generateAreaContent = function generateAreaContent(_ref) {
|
|
67
|
+
var accept = _ref.accept,
|
|
68
|
+
maxSize = _ref.maxSize,
|
|
69
|
+
locale = _ref.locale;
|
|
70
|
+
var acceptTypes = accept.map(function (type) {
|
|
71
|
+
return FILE_ACCEPT_TYPE[type];
|
|
72
|
+
}).flat();
|
|
73
|
+
var translation = getDropzoneLocale(locale);
|
|
74
|
+
var acceptTypesMessage = accept.length === 1 ? accept[0] : accept.reduce(function (acc, currentValue, _index, _arr) {
|
|
75
|
+
if (_index === _arr.length - 1) {
|
|
76
|
+
return "".concat(acc, " ").concat(translation.or, " ").concat(currentValue);
|
|
77
|
+
}
|
|
78
|
+
return acc ? "".concat(acc, ", ").concat(currentValue) : currentValue;
|
|
79
|
+
}, '');
|
|
80
|
+
return {
|
|
81
|
+
acceptTypes: acceptTypes,
|
|
82
|
+
maxSizeFormatted: formatFileSize(maxSize),
|
|
83
|
+
acceptTypesMessage: acceptTypesMessage
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var getDropzoneLocale = function getDropzoneLocale(lang) {
|
|
87
|
+
var locale = lang || getTranslationLocale();
|
|
88
|
+
var translation = {
|
|
89
|
+
en: {
|
|
90
|
+
title: 'Choose a file or drop it here',
|
|
91
|
+
format: 'format',
|
|
92
|
+
formats: 'formats',
|
|
93
|
+
maxSize: 'Maximum size up to $1.',
|
|
94
|
+
fileInvalidType: 'The file type should be $1',
|
|
95
|
+
fileTooLarge: 'The file is too large (Max $1)',
|
|
96
|
+
tooManyFiles: 'Too many files. Please select one file.',
|
|
97
|
+
or: 'or'
|
|
98
|
+
},
|
|
99
|
+
ru: {
|
|
100
|
+
title: 'Выберите файл или перетащите его сюда',
|
|
101
|
+
format: 'формат',
|
|
102
|
+
formats: 'форматы',
|
|
103
|
+
maxSize: 'Максимальный размер до $1',
|
|
104
|
+
fileInvalidType: 'Тип файла должен быть $1',
|
|
105
|
+
fileTooLarge: 'Файл слишком большой (Максимум $1)',
|
|
106
|
+
tooManyFiles: 'Слишком много файлов. Пожалуйста, выберите один файл.',
|
|
107
|
+
or: 'или'
|
|
108
|
+
},
|
|
109
|
+
hy: {
|
|
110
|
+
title: 'Ընտրեք ֆայլ կամ քաշեք այն այստեղ',
|
|
111
|
+
format: 'ֆորմատ',
|
|
112
|
+
formats: 'ֆորմատներ',
|
|
113
|
+
maxSize: 'Առավելագույն չափը՝ մինչև $1',
|
|
114
|
+
fileInvalidType: 'Ֆայլի տեսակը պետք է լինի $1',
|
|
115
|
+
fileTooLarge: 'Ֆայլը չափազանց մեծ է (Առավելագույնը $1)',
|
|
116
|
+
tooManyFiles: 'Չափազանց շատ ֆայլեր։ Խնդրում ենք ընտրել միայն մեկ ֆայլ։',
|
|
117
|
+
or: 'կամ'
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return translation[locale] || translation.en;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
var ErrorItem = function ErrorItem(_ref) {
|
|
124
|
+
var code = _ref.code,
|
|
125
|
+
onRemove = _ref.onRemove,
|
|
126
|
+
areaContent = _ref.areaContent,
|
|
127
|
+
locale = _ref.locale;
|
|
128
|
+
var errorMessage = useMemo(function () {
|
|
129
|
+
var translation = getDropzoneLocale(locale);
|
|
130
|
+
if (code === ErrorCode.FileInvalidType) {
|
|
131
|
+
return translation.fileInvalidType.replace('$1', areaContent.acceptTypesMessage);
|
|
132
|
+
} else if (code === ErrorCode.FileTooLarge) {
|
|
133
|
+
return translation.fileTooLarge.replace('$1', areaContent.maxSizeFormatted);
|
|
134
|
+
} else if (code === ErrorCode.TooManyFiles) {
|
|
135
|
+
return translation.tooManyFiles;
|
|
136
|
+
}
|
|
137
|
+
return '';
|
|
138
|
+
}, [code]);
|
|
139
|
+
return errorMessage ? /*#__PURE__*/React.createElement(Alert, {
|
|
140
|
+
type: "error",
|
|
141
|
+
text: errorMessage,
|
|
142
|
+
closeIcon: true,
|
|
143
|
+
onClose: onRemove
|
|
144
|
+
}) : null;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
var PreviewItem = function PreviewItem(_ref) {
|
|
148
|
+
var file = _ref.file,
|
|
149
|
+
onRemove = _ref.onRemove,
|
|
150
|
+
mode = _ref.mode;
|
|
151
|
+
var type = file.type.split('/')[0];
|
|
152
|
+
var preview = useMemo(function () {
|
|
153
|
+
return URL.createObjectURL(file);
|
|
154
|
+
}, [file.name]);
|
|
155
|
+
var handleItemClick = function handleItemClick() {
|
|
156
|
+
if (mode === FileUploadMode.view) {
|
|
157
|
+
window.open(preview, '_blank');
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
var onFileDownload = function onFileDownload(event) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
downloadFile(preview, file.name);
|
|
164
|
+
};
|
|
165
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: classNames('dz-file-upload__files--item', {
|
|
167
|
+
'dz-file-upload__files--item--view': mode === FileUploadMode.view
|
|
168
|
+
}),
|
|
169
|
+
onClick: handleItemClick
|
|
170
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: 'dz-file-upload__files--item__preview'
|
|
172
|
+
}, /*#__PURE__*/React.createElement(FilePreview, {
|
|
173
|
+
preview: preview,
|
|
174
|
+
type: type
|
|
175
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: 'dz-file-upload__files--item__info'
|
|
177
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: "dz-file-upload__files--item__info-title"
|
|
179
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
180
|
+
weight: "semibold"
|
|
181
|
+
}, shortenFileName(file.name, 40)), mode === FileUploadMode.attach && /*#__PURE__*/React.createElement(Button, {
|
|
182
|
+
size: "small",
|
|
183
|
+
type: "tertiary",
|
|
184
|
+
onClick: onRemove,
|
|
185
|
+
iconProps: {
|
|
186
|
+
Component: IconDelete
|
|
187
|
+
}
|
|
188
|
+
}), mode === FileUploadMode.view && /*#__PURE__*/React.createElement(Button, {
|
|
189
|
+
size: "small",
|
|
190
|
+
type: "tertiary",
|
|
191
|
+
onClick: onFileDownload,
|
|
192
|
+
iconProps: {
|
|
193
|
+
Component: IconArrowDownloadFilled
|
|
194
|
+
}
|
|
195
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: "dz-file-upload__files--item__info-size"
|
|
197
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
198
|
+
size: "small"
|
|
199
|
+
}, formatFileSize(file.size)))));
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
var DropzoneFileUpload = /*#__PURE__*/forwardRef(function (_ref2, _ref) {
|
|
203
|
+
var _ref2$maxSize = _ref2.maxSize,
|
|
204
|
+
maxSize = _ref2$maxSize === void 0 ? 10 * 1024 * 1024 : _ref2$maxSize,
|
|
205
|
+
_ref2$accept = _ref2.accept,
|
|
206
|
+
accept = _ref2$accept === void 0 ? [FileTypeEnum.IMAGE, FileTypeEnum.PDF, FileTypeEnum.DOC] : _ref2$accept,
|
|
207
|
+
name = _ref2.name,
|
|
208
|
+
setFiles = _ref2.setFiles,
|
|
209
|
+
setFieldValue = _ref2.setFieldValue,
|
|
210
|
+
value = _ref2.value,
|
|
211
|
+
selectedFiles = _ref2.selectedFiles,
|
|
212
|
+
_ref2$maxFiles = _ref2.maxFiles,
|
|
213
|
+
maxFiles = _ref2$maxFiles === void 0 ? 1 : _ref2$maxFiles,
|
|
214
|
+
_ref2$mode = _ref2.mode,
|
|
215
|
+
mode = _ref2$mode === void 0 ? FileUploadMode.attach : _ref2$mode,
|
|
216
|
+
locale = _ref2.locale,
|
|
217
|
+
_ref2$multiple = _ref2.multiple,
|
|
218
|
+
multiple = _ref2$multiple === void 0 ? false : _ref2$multiple;
|
|
219
|
+
var initialFiles = value || selectedFiles || [];
|
|
220
|
+
var initialMaxFiles = initialFiles.length >= maxFiles ? 0 : maxFiles - initialFiles.length;
|
|
221
|
+
var _useState = useState([]),
|
|
222
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
223
|
+
errors = _useState2[0],
|
|
224
|
+
setErrors = _useState2[1];
|
|
225
|
+
var areaContent = generateAreaContent({
|
|
226
|
+
accept: accept,
|
|
227
|
+
maxSize: maxSize
|
|
228
|
+
});
|
|
229
|
+
var translation = getDropzoneLocale(locale);
|
|
230
|
+
var onDrop = function onDrop(fileAccepted, fileRejections) {
|
|
231
|
+
if (initialMaxFiles === 0 && !multiple) {
|
|
232
|
+
setErrors([{
|
|
233
|
+
code: ErrorCode.TooManyFiles,
|
|
234
|
+
message: ''
|
|
235
|
+
}]);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
var newFiles = uniqueFiles([].concat(_toConsumableArray(initialFiles), _toConsumableArray(fileAccepted)));
|
|
239
|
+
var errors = fileRejections.map(function (fileRejection) {
|
|
240
|
+
return fileRejection.errors;
|
|
241
|
+
}).flat();
|
|
242
|
+
setFiles === null || setFiles === void 0 || setFiles(newFiles);
|
|
243
|
+
updateInForm(newFiles);
|
|
244
|
+
setErrors(errors);
|
|
245
|
+
};
|
|
246
|
+
var _useDropzone = useDropzone({
|
|
247
|
+
onDrop: onDrop,
|
|
248
|
+
accept: areaContent.acceptTypes,
|
|
249
|
+
maxSize: maxSize,
|
|
250
|
+
maxFiles: multiple ? 0 : initialMaxFiles,
|
|
251
|
+
multiple: multiple
|
|
252
|
+
}),
|
|
253
|
+
getRootProps = _useDropzone.getRootProps,
|
|
254
|
+
getInputProps = _useDropzone.getInputProps,
|
|
255
|
+
isFocused = _useDropzone.isFocused,
|
|
256
|
+
isDragActive = _useDropzone.isDragActive;
|
|
257
|
+
var removeFile = function removeFile(fileName) {
|
|
258
|
+
var newFiles = initialFiles.filter(function (file) {
|
|
259
|
+
return file.name !== fileName;
|
|
260
|
+
});
|
|
261
|
+
if (newFiles.length === 0) {
|
|
262
|
+
setErrors([]);
|
|
263
|
+
}
|
|
264
|
+
setFiles === null || setFiles === void 0 || setFiles(newFiles);
|
|
265
|
+
updateInForm(newFiles);
|
|
266
|
+
};
|
|
267
|
+
var removeError = function removeError(index) {
|
|
268
|
+
setErrors(function (prevErrors) {
|
|
269
|
+
return prevErrors.filter(function (_error, i) {
|
|
270
|
+
return i !== index;
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
var updateInForm = useCallback(function (values) {
|
|
275
|
+
if (name && setFieldValue) {
|
|
276
|
+
setFieldValue(name, values);
|
|
277
|
+
}
|
|
278
|
+
}, [name, setFieldValue]);
|
|
279
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
280
|
+
className: "dz-file-upload"
|
|
281
|
+
}, mode !== FileUploadMode.view ? /*#__PURE__*/React.createElement("div", _extends({}, getRootProps(), {
|
|
282
|
+
className: classNames('dz-file-upload__area', {
|
|
283
|
+
'dz-file-upload__area--focused': isFocused,
|
|
284
|
+
'dz-file-upload__area--active': isDragActive
|
|
285
|
+
})
|
|
286
|
+
}), /*#__PURE__*/React.createElement(IconUpload, {
|
|
287
|
+
className: "mb-20",
|
|
288
|
+
size: "xlarge"
|
|
289
|
+
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
290
|
+
name: name
|
|
291
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
292
|
+
type: "primary",
|
|
293
|
+
weight: "semibold",
|
|
294
|
+
className: "mb-6"
|
|
295
|
+
}, translation.title), /*#__PURE__*/React.createElement(Text, {
|
|
296
|
+
size: "small"
|
|
297
|
+
}, "".concat(areaContent.acceptTypesMessage, " ").concat(areaContent.acceptTypes.length === 1 ? translation.format : translation.formats, ", ").concat(translation.maxSize.replace('$1', areaContent.maxSizeFormatted)))) : null, /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: "dz-file-upload__files"
|
|
299
|
+
}, errors.map(function (_ref3, index) {
|
|
300
|
+
var code = _ref3.code;
|
|
301
|
+
return /*#__PURE__*/React.createElement(ErrorItem, {
|
|
302
|
+
key: index,
|
|
303
|
+
code: code,
|
|
304
|
+
areaContent: areaContent,
|
|
305
|
+
onRemove: function onRemove() {
|
|
306
|
+
return removeError(index);
|
|
307
|
+
},
|
|
308
|
+
locale: locale
|
|
309
|
+
});
|
|
310
|
+
}), initialFiles.map(function (file, index) {
|
|
311
|
+
return /*#__PURE__*/React.createElement(PreviewItem, {
|
|
312
|
+
key: index,
|
|
313
|
+
file: file,
|
|
314
|
+
onRemove: function onRemove() {
|
|
315
|
+
return removeFile(file.name);
|
|
316
|
+
},
|
|
317
|
+
mode: mode
|
|
318
|
+
});
|
|
319
|
+
})));
|
|
320
|
+
});
|
|
321
|
+
DropzoneFileUpload.displayName = 'DropzoneFileUpload';
|
|
322
|
+
|
|
31
323
|
var ModalContent = function ModalContent(_ref) {
|
|
32
324
|
var title = _ref.title,
|
|
33
325
|
subtitle = _ref.subtitle,
|
|
@@ -404,4 +696,54 @@ var Button = function Button(props) {
|
|
|
404
696
|
}, buttonText || children) : null));
|
|
405
697
|
};
|
|
406
698
|
|
|
407
|
-
|
|
699
|
+
var Alert = function Alert(props) {
|
|
700
|
+
var buttonProps = props.buttonProps,
|
|
701
|
+
_props$type = props.type,
|
|
702
|
+
type = _props$type === void 0 ? 'information' : _props$type,
|
|
703
|
+
_props$position = props.position,
|
|
704
|
+
position = _props$position === void 0 ? 'inline' : _props$position,
|
|
705
|
+
text = props.text,
|
|
706
|
+
subtext = props.subtext,
|
|
707
|
+
closeIcon = props.closeIcon,
|
|
708
|
+
onClose = props.onClose,
|
|
709
|
+
_props$className = props.className,
|
|
710
|
+
className = _props$className === void 0 ? '' : _props$className;
|
|
711
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
712
|
+
className: classNames('alert', "alert--".concat(type, " alert--").concat(position), className)
|
|
713
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
714
|
+
className: "alert__content"
|
|
715
|
+
}, /*#__PURE__*/React.createElement(IconDynamicComponent, {
|
|
716
|
+
componentName: ICONS_MAPPING[type],
|
|
717
|
+
size: "small",
|
|
718
|
+
type: TYPE_MAPPING[type]
|
|
719
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
720
|
+
className: "alert__text pl-8"
|
|
721
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
722
|
+
type: "primary",
|
|
723
|
+
size: "standard",
|
|
724
|
+
weight: "regular",
|
|
725
|
+
lineHeight: "large"
|
|
726
|
+
}, text), subtext ? /*#__PURE__*/React.createElement(Text, {
|
|
727
|
+
className: 'mt-4',
|
|
728
|
+
type: "secondary",
|
|
729
|
+
size: "small",
|
|
730
|
+
weight: "regular",
|
|
731
|
+
lineHeight: "large"
|
|
732
|
+
}, subtext) : null), buttonProps ? /*#__PURE__*/React.createElement("div", {
|
|
733
|
+
className: "alert__actions"
|
|
734
|
+
}, buttonProps.confirm && /*#__PURE__*/React.createElement(Button, _extends({
|
|
735
|
+
size: "medium",
|
|
736
|
+
type: "secondary"
|
|
737
|
+
}, buttonProps.confirm)), buttonProps.cancel && /*#__PURE__*/React.createElement(Button, _extends({
|
|
738
|
+
size: "medium",
|
|
739
|
+
type: "tertiary",
|
|
740
|
+
className: "ml-12"
|
|
741
|
+
}, buttonProps.cancel))) : null), closeIcon ? /*#__PURE__*/React.createElement(IconDismissFilled, {
|
|
742
|
+
type: TYPE_MAPPING[type],
|
|
743
|
+
size: "xsmall",
|
|
744
|
+
className: "ml-12 pointer",
|
|
745
|
+
onClick: onClose
|
|
746
|
+
}) : null));
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
export { Alert as A, Button as B, Checkbox as C, DropzoneFileUpload as D, ErrorItem as E, Modal as M, Popover as P, MOBILE_ANIMATION as a, getDropzoneLocale as b, PreviewItem as c, ModalContent as d, PopoverMobile as e, formatFileSize as f, generateAreaContent as g, shortenFileName as s };
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import '../../extends-7ebf6528.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import './consts.js';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import '../Text/Text.js';
|
|
6
|
+
export { A as Alert } from '../../Alert-ca805215.js';
|
|
7
|
+
import '../SVGIcons/IconDismissFilled.js';
|
|
8
|
+
import '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
9
9
|
import 'dayjs';
|
|
10
10
|
import '../../consts/index.js';
|
|
11
11
|
import '../../hooks/useScreenSize.js';
|
|
12
12
|
import 'react-hook-form';
|
|
13
|
-
import 'react-dropzone';
|
|
14
|
-
import 'react-toastify';
|
|
15
13
|
import 'react-syntax-highlighter';
|
|
16
14
|
import '../../utils/helpers.js';
|
|
17
15
|
import '../../defineProperty-cd2759b8.js';
|
|
18
16
|
import '../../typeof-2c59c5c4.js';
|
|
19
17
|
import '../../objectWithoutProperties-162f125b.js';
|
|
20
18
|
import '../../helperComponents/Loader/Loader.js';
|
|
19
|
+
import '../../toConsumableArray-38890490.js';
|
|
21
20
|
import '../../slicedToArray-7fbc5104.js';
|
|
21
|
+
import 'react-dropzone';
|
|
22
|
+
import '../SVGIcons/IconUpload.js';
|
|
23
|
+
import '../../type/file-upload.js';
|
|
24
|
+
import '../FileUpload/types.js';
|
|
25
|
+
import '../../helpers/locale.js';
|
|
26
|
+
import '../../type/locale.js';
|
|
27
|
+
import '../../helpers/storage.js';
|
|
28
|
+
import 'react-toastify';
|
|
22
29
|
import '../../hooks/useGetIsMobile.js';
|
|
23
30
|
import 'framer-motion';
|
|
24
31
|
import '../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
@@ -35,58 +42,10 @@ import '../../hooks/useHideOnScroll.js';
|
|
|
35
42
|
import '../Link/Link.js';
|
|
36
43
|
import '../Popover/PopoverDesktop.js';
|
|
37
44
|
import '../SVGIcons/IconInfo.js';
|
|
45
|
+
import '../SVGIcons/IconDelete.js';
|
|
46
|
+
import '../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
47
|
+
import '../Progress/Progress.js';
|
|
48
|
+
import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
49
|
+
import '../../helpers/download-file.js';
|
|
38
50
|
import '../Button/consts.js';
|
|
39
51
|
import '../../helperComponents/IconDynamicComponent/constants.js';
|
|
40
|
-
import '../../type/file-upload.js';
|
|
41
|
-
|
|
42
|
-
var Alert = function Alert(props) {
|
|
43
|
-
var buttonProps = props.buttonProps,
|
|
44
|
-
_props$type = props.type,
|
|
45
|
-
type = _props$type === void 0 ? 'information' : _props$type,
|
|
46
|
-
_props$position = props.position,
|
|
47
|
-
position = _props$position === void 0 ? 'inline' : _props$position,
|
|
48
|
-
text = props.text,
|
|
49
|
-
subtext = props.subtext,
|
|
50
|
-
closeIcon = props.closeIcon,
|
|
51
|
-
onClose = props.onClose,
|
|
52
|
-
_props$className = props.className,
|
|
53
|
-
className = _props$className === void 0 ? '' : _props$className;
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: classNames('alert', "alert--".concat(type, " alert--").concat(position), className)
|
|
56
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
-
className: "alert__content"
|
|
58
|
-
}, /*#__PURE__*/React.createElement(IconDynamicComponent, {
|
|
59
|
-
componentName: ICONS_MAPPING[type],
|
|
60
|
-
size: "small",
|
|
61
|
-
type: TYPE_MAPPING[type]
|
|
62
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: "alert__text pl-8"
|
|
64
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
65
|
-
type: "primary",
|
|
66
|
-
size: "standard",
|
|
67
|
-
weight: "regular",
|
|
68
|
-
lineHeight: "large"
|
|
69
|
-
}, text), subtext ? /*#__PURE__*/React.createElement(Text, {
|
|
70
|
-
className: 'mt-4',
|
|
71
|
-
type: "secondary",
|
|
72
|
-
size: "small",
|
|
73
|
-
weight: "regular",
|
|
74
|
-
lineHeight: "large"
|
|
75
|
-
}, subtext) : null), buttonProps ? /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: "alert__actions"
|
|
77
|
-
}, buttonProps.confirm && /*#__PURE__*/React.createElement(Button, _extends({
|
|
78
|
-
size: "medium",
|
|
79
|
-
type: "secondary"
|
|
80
|
-
}, buttonProps.confirm)), buttonProps.cancel && /*#__PURE__*/React.createElement(Button, _extends({
|
|
81
|
-
size: "medium",
|
|
82
|
-
type: "tertiary",
|
|
83
|
-
className: "ml-12"
|
|
84
|
-
}, buttonProps.cancel))) : null), closeIcon ? /*#__PURE__*/React.createElement(IconDismissFilled, {
|
|
85
|
-
type: TYPE_MAPPING[type],
|
|
86
|
-
size: "xsmall",
|
|
87
|
-
className: "ml-12 pointer",
|
|
88
|
-
onClick: onClose
|
|
89
|
-
}) : null));
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export { Alert };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Alert } from '
|
|
1
|
+
export { A as Alert } from '../../Alert-ca805215.js';
|
|
2
2
|
import '../../extends-7ebf6528.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './consts.js';
|
|
@@ -6,7 +6,6 @@ import 'classnames';
|
|
|
6
6
|
import '../Text/Text.js';
|
|
7
7
|
import '../../utils/helpers.js';
|
|
8
8
|
import 'dayjs';
|
|
9
|
-
import '../../Button-cc4207a0.js';
|
|
10
9
|
import '../../defineProperty-cd2759b8.js';
|
|
11
10
|
import '../../typeof-2c59c5c4.js';
|
|
12
11
|
import '../../objectWithoutProperties-162f125b.js';
|
|
@@ -16,7 +15,13 @@ import '../../type/file-upload.js';
|
|
|
16
15
|
import '../../hooks/useScreenSize.js';
|
|
17
16
|
import '../../slicedToArray-7fbc5104.js';
|
|
18
17
|
import 'react-hook-form';
|
|
18
|
+
import '../../toConsumableArray-38890490.js';
|
|
19
19
|
import 'react-dropzone';
|
|
20
|
+
import '../SVGIcons/IconUpload.js';
|
|
21
|
+
import '../FileUpload/types.js';
|
|
22
|
+
import '../../helpers/locale.js';
|
|
23
|
+
import '../../type/locale.js';
|
|
24
|
+
import '../../helpers/storage.js';
|
|
20
25
|
import 'react-toastify';
|
|
21
26
|
import '../../hooks/useGetIsMobile.js';
|
|
22
27
|
import 'framer-motion';
|
|
@@ -37,5 +42,10 @@ import '../Popover/PopoverDesktop.js';
|
|
|
37
42
|
import '../SVGIcons/IconInfo.js';
|
|
38
43
|
import '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
39
44
|
import '../../helperComponents/IconDynamicComponent/constants.js';
|
|
40
|
-
import '../Button/consts.js';
|
|
41
45
|
import '../SVGIcons/IconDismissFilled.js';
|
|
46
|
+
import '../SVGIcons/IconDelete.js';
|
|
47
|
+
import '../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
48
|
+
import '../Progress/Progress.js';
|
|
49
|
+
import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
50
|
+
import '../../helpers/download-file.js';
|
|
51
|
+
import '../Button/consts.js';
|
|
@@ -2,19 +2,20 @@ import { _ as _slicedToArray } from '../../slicedToArray-7fbc5104.js';
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { FileUpload } from '../FileUpload/FileUpload.js';
|
|
5
|
-
import '
|
|
6
|
-
import 'dayjs';
|
|
5
|
+
import '../../Alert-ca805215.js';
|
|
7
6
|
import { FileUploadMode } from '../FileUpload/types.js';
|
|
8
|
-
import '../../consts/index.js';
|
|
9
|
-
import 'react-toastify';
|
|
10
|
-
import '../../hooks/useScreenSize.js';
|
|
11
|
-
import 'react-hook-form';
|
|
12
|
-
import '../../Button-cc4207a0.js';
|
|
13
|
-
import 'react-syntax-highlighter';
|
|
14
7
|
import '../../toConsumableArray-38890490.js';
|
|
15
8
|
import '../../helperComponents/Label/Label.js';
|
|
16
9
|
import '../Text/Text.js';
|
|
17
10
|
import '../../utils/helpers.js';
|
|
11
|
+
import 'dayjs';
|
|
12
|
+
import '../../consts/index.js';
|
|
13
|
+
import '../../defineProperty-cd2759b8.js';
|
|
14
|
+
import '../../typeof-2c59c5c4.js';
|
|
15
|
+
import '../../type/file-upload.js';
|
|
16
|
+
import '../../hooks/useScreenSize.js';
|
|
17
|
+
import 'react-hook-form';
|
|
18
|
+
import 'react-syntax-highlighter';
|
|
18
19
|
import '../FileUpload/UploadItems.js';
|
|
19
20
|
import '../../hooks/useFormProps.js';
|
|
20
21
|
import '../../context/types.js';
|
|
@@ -22,15 +23,19 @@ import '../../helperComponents/ErrorMessage/ErrorMessage.js';
|
|
|
22
23
|
import '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
23
24
|
import '../../helperComponents/IconDynamicComponent/constants.js';
|
|
24
25
|
import '../SVGIcons/IconDelete.js';
|
|
25
|
-
import '../../defineProperty-cd2759b8.js';
|
|
26
|
-
import '../../typeof-2c59c5c4.js';
|
|
27
26
|
import '../SVGIcons/IconEditFilled.js';
|
|
28
27
|
import '../SVGIcons/IconEdit.js';
|
|
29
28
|
import '../SVGIcons/IconAttach.js';
|
|
30
|
-
import '../../type/file-upload.js';
|
|
31
29
|
import '../../extends-7ebf6528.js';
|
|
30
|
+
import '../Alert/consts.js';
|
|
32
31
|
import '../../objectWithoutProperties-162f125b.js';
|
|
33
32
|
import '../../helperComponents/Loader/Loader.js';
|
|
33
|
+
import 'react-dropzone';
|
|
34
|
+
import '../SVGIcons/IconUpload.js';
|
|
35
|
+
import '../../helpers/locale.js';
|
|
36
|
+
import '../../type/locale.js';
|
|
37
|
+
import '../../helpers/storage.js';
|
|
38
|
+
import 'react-toastify';
|
|
34
39
|
import '../../hooks/useGetIsMobile.js';
|
|
35
40
|
import 'framer-motion';
|
|
36
41
|
import '../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
@@ -47,6 +52,11 @@ import '../../hooks/useHideOnScroll.js';
|
|
|
47
52
|
import '../Link/Link.js';
|
|
48
53
|
import '../Popover/PopoverDesktop.js';
|
|
49
54
|
import '../SVGIcons/IconInfo.js';
|
|
55
|
+
import '../SVGIcons/IconDismissFilled.js';
|
|
56
|
+
import '../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
57
|
+
import '../Progress/Progress.js';
|
|
58
|
+
import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
59
|
+
import '../../helpers/download-file.js';
|
|
50
60
|
import '../Button/consts.js';
|
|
51
61
|
|
|
52
62
|
var Avatar = function Avatar(_ref) {
|
|
@@ -22,11 +22,16 @@ import '../../type/file-upload.js';
|
|
|
22
22
|
import '../FileUpload/FileUpload.js';
|
|
23
23
|
import '../../toConsumableArray-38890490.js';
|
|
24
24
|
import '../FileUpload/types.js';
|
|
25
|
-
import '../../
|
|
25
|
+
import '../../Alert-ca805215.js';
|
|
26
26
|
import '../../extends-7ebf6528.js';
|
|
27
|
+
import '../Alert/consts.js';
|
|
27
28
|
import '../../objectWithoutProperties-162f125b.js';
|
|
28
29
|
import '../../helperComponents/Loader/Loader.js';
|
|
29
30
|
import 'react-dropzone';
|
|
31
|
+
import '../SVGIcons/IconUpload.js';
|
|
32
|
+
import '../../helpers/locale.js';
|
|
33
|
+
import '../../type/locale.js';
|
|
34
|
+
import '../../helpers/storage.js';
|
|
30
35
|
import 'react-toastify';
|
|
31
36
|
import '../../hooks/useGetIsMobile.js';
|
|
32
37
|
import 'framer-motion';
|
|
@@ -40,13 +45,18 @@ import '../Popover/PopoverDesktop.js';
|
|
|
40
45
|
import '../SVGIcons/IconInfo.js';
|
|
41
46
|
import '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
42
47
|
import '../../helperComponents/IconDynamicComponent/constants.js';
|
|
48
|
+
import '../SVGIcons/IconDismissFilled.js';
|
|
49
|
+
import '../SVGIcons/IconDelete.js';
|
|
50
|
+
import '../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
51
|
+
import '../Progress/Progress.js';
|
|
52
|
+
import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
53
|
+
import '../../helpers/download-file.js';
|
|
43
54
|
import '../Button/consts.js';
|
|
44
55
|
import '../../helperComponents/Label/Label.js';
|
|
45
56
|
import '../FileUpload/UploadItems.js';
|
|
46
57
|
import '../../hooks/useFormProps.js';
|
|
47
58
|
import '../../context/types.js';
|
|
48
59
|
import '../../helperComponents/ErrorMessage/ErrorMessage.js';
|
|
49
|
-
import '../SVGIcons/IconDelete.js';
|
|
50
60
|
import '../SVGIcons/IconEditFilled.js';
|
|
51
61
|
import '../SVGIcons/IconEdit.js';
|
|
52
62
|
import '../SVGIcons/IconAttach.js';
|