nurseitaly-components 0.0.1
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/README.md +93 -0
- package/dist/basic/Avatar/Avatar.d.ts +12 -0
- package/dist/basic/Avatar/Avatar.js +24 -0
- package/dist/basic/Avatar/avatar.png +0 -0
- package/dist/basic/Avatar/index.d.ts +2 -0
- package/dist/basic/Avatar/index.js +2 -0
- package/dist/basic/Avatar/styles.scss +80 -0
- package/dist/basic/Badge/Badge.d.ts +13 -0
- package/dist/basic/Badge/Badge.js +17 -0
- package/dist/basic/Badge/index.d.ts +2 -0
- package/dist/basic/Badge/index.js +2 -0
- package/dist/basic/Badge/styles.scss +68 -0
- package/dist/basic/Button/Button.d.ts +25 -0
- package/dist/basic/Button/Button.js +42 -0
- package/dist/basic/Button/index.d.ts +2 -0
- package/dist/basic/Button/index.js +2 -0
- package/dist/basic/Button/logo-ud.png +0 -0
- package/dist/basic/Button/styles.scss +248 -0
- package/dist/basic/CheckboxField/CheckboxField.d.ts +10 -0
- package/dist/basic/CheckboxField/CheckboxField.js +9 -0
- package/dist/basic/CheckboxField/index.d.ts +2 -0
- package/dist/basic/CheckboxField/index.js +2 -0
- package/dist/basic/CheckboxField/style.scss +4 -0
- package/dist/basic/DatePickerField/DatePickerField.d.ts +26 -0
- package/dist/basic/DatePickerField/DatePickerField.js +90 -0
- package/dist/basic/DatePickerField/DatePickerTheme.d.ts +2 -0
- package/dist/basic/DatePickerField/DatePickerTheme.js +59 -0
- package/dist/basic/DatePickerField/index.d.ts +1 -0
- package/dist/basic/DatePickerField/index.js +1 -0
- package/dist/basic/DatePickerField/styles.scss +26 -0
- package/dist/basic/DropdownButton/DropdownButton.d.ts +18 -0
- package/dist/basic/DropdownButton/DropdownButton.js +44 -0
- package/dist/basic/DropdownButton/index.d.ts +2 -0
- package/dist/basic/DropdownButton/index.js +2 -0
- package/dist/basic/DropdownButton/styles.scss +172 -0
- package/dist/basic/DropdownList/DropdownItemList.d.ts +16 -0
- package/dist/basic/DropdownList/DropdownItemList.js +17 -0
- package/dist/basic/DropdownList/DropdownList.d.ts +9 -0
- package/dist/basic/DropdownList/DropdownList.js +10 -0
- package/dist/basic/DropdownList/index.d.ts +2 -0
- package/dist/basic/DropdownList/index.js +2 -0
- package/dist/basic/DropdownList/styles.scss +56 -0
- package/dist/basic/DropdownMenu/DropdownMenu.d.ts +13 -0
- package/dist/basic/DropdownMenu/DropdownMenu.js +12 -0
- package/dist/basic/DropdownMenu/index.d.ts +2 -0
- package/dist/basic/DropdownMenu/index.js +2 -0
- package/dist/basic/DropdownMenu/styles.scss +54 -0
- package/dist/basic/Dummy/Dummy.d.ts +9 -0
- package/dist/basic/Dummy/Dummy.js +8 -0
- package/dist/basic/Dummy/index.d.ts +2 -0
- package/dist/basic/Dummy/index.js +2 -0
- package/dist/basic/Dummy/styles.scss +4 -0
- package/dist/basic/FilterDropdown/FilterDropdown.d.ts +16 -0
- package/dist/basic/FilterDropdown/FilterDropdown.js +56 -0
- package/dist/basic/FilterDropdown/index.d.ts +2 -0
- package/dist/basic/FilterDropdown/index.js +2 -0
- package/dist/basic/FilterDropdown/styles.scss +97 -0
- package/dist/basic/Icon/Icon.d.ts +15 -0
- package/dist/basic/Icon/Icon.js +20 -0
- package/dist/basic/Icon/IconSizes.d.ts +10 -0
- package/dist/basic/Icon/IconSizes.js +11 -0
- package/dist/basic/Icon/index.d.ts +2 -0
- package/dist/basic/Icon/index.js +2 -0
- package/dist/basic/Icon/styles.scss +249 -0
- package/dist/basic/IconButton/IconButton.d.ts +24 -0
- package/dist/basic/IconButton/IconButton.js +42 -0
- package/dist/basic/IconButton/index.d.ts +2 -0
- package/dist/basic/IconButton/index.js +2 -0
- package/dist/basic/IconButton/styles.scss +192 -0
- package/dist/basic/Pill/Pill.d.ts +17 -0
- package/dist/basic/Pill/Pill.js +22 -0
- package/dist/basic/Pill/index.d.ts +2 -0
- package/dist/basic/Pill/index.js +2 -0
- package/dist/basic/Pill/styles.scss +70 -0
- package/dist/basic/SelectField/AsyncSelectField.d.ts +21 -0
- package/dist/basic/SelectField/AsyncSelectField.js +131 -0
- package/dist/basic/SelectField/SelectAutocompleteTheme.d.ts +2 -0
- package/dist/basic/SelectField/SelectAutocompleteTheme.js +78 -0
- package/dist/basic/SelectField/SelectField.d.ts +27 -0
- package/dist/basic/SelectField/SelectField.js +81 -0
- package/dist/basic/SelectField/SelectFieldTheme.d.ts +7 -0
- package/dist/basic/SelectField/SelectFieldTheme.js +57 -0
- package/dist/basic/SelectField/SelectMultipleField.d.ts +28 -0
- package/dist/basic/SelectField/SelectMultipleField.js +98 -0
- package/dist/basic/SelectField/index.d.ts +2 -0
- package/dist/basic/SelectField/index.js +2 -0
- package/dist/basic/SelectField/styles.scss +38 -0
- package/dist/basic/Spinner/Spinner.d.ts +14 -0
- package/dist/basic/Spinner/Spinner.js +37 -0
- package/dist/basic/Spinner/index.d.ts +2 -0
- package/dist/basic/Spinner/index.js +2 -0
- package/dist/basic/Spinner/styles.scss +37 -0
- package/dist/basic/SwitchField/SwitchField.d.ts +11 -0
- package/dist/basic/SwitchField/SwitchField.js +13 -0
- package/dist/basic/SwitchField/index.d.ts +2 -0
- package/dist/basic/SwitchField/index.js +2 -0
- package/dist/basic/SwitchField/style.scss +4 -0
- package/dist/basic/Tabs/Tabs.d.ts +17 -0
- package/dist/basic/Tabs/Tabs.js +9 -0
- package/dist/basic/Tabs/index.d.ts +2 -0
- package/dist/basic/Tabs/index.js +2 -0
- package/dist/basic/Tabs/styles.scss +51 -0
- package/dist/basic/Tag/Tag.d.ts +18 -0
- package/dist/basic/Tag/Tag.js +30 -0
- package/dist/basic/Tag/index.d.ts +2 -0
- package/dist/basic/Tag/index.js +2 -0
- package/dist/basic/Tag/styles.scss +101 -0
- package/dist/basic/TextField/TextField.d.ts +34 -0
- package/dist/basic/TextField/TextField.js +164 -0
- package/dist/basic/TextField/TextFieldTheme.d.ts +6 -0
- package/dist/basic/TextField/TextFieldTheme.js +70 -0
- package/dist/basic/TextField/index.d.ts +2 -0
- package/dist/basic/TextField/index.js +2 -0
- package/dist/basic/TextField/inputRefManager.d.ts +4 -0
- package/dist/basic/TextField/inputRefManager.js +18 -0
- package/dist/basic/TextField/styles.scss +44 -0
- package/dist/basic/Tooltip/Tooltip.d.ts +26 -0
- package/dist/basic/Tooltip/Tooltip.js +37 -0
- package/dist/basic/Tooltip/index.d.ts +2 -0
- package/dist/basic/Tooltip/index.js +2 -0
- package/dist/basic/Tooltip/styles.scss +73 -0
- package/dist/basic/VerticalButton/VerticalButton.d.ts +6 -0
- package/dist/basic/VerticalButton/VerticalButton.js +8 -0
- package/dist/basic/VerticalButton/index.d.ts +2 -0
- package/dist/basic/VerticalButton/index.js +2 -0
- package/dist/basic/VerticalButton/styles.scss +24 -0
- package/dist/basic/fonts/material-symbols-outlined.woff2 +0 -0
- package/dist/basic/fonts/work-sans-latin-ext.woff2 +0 -0
- package/dist/basic/fonts/work-sans-latin.woff2 +0 -0
- package/dist/basic/fonts/work-sans-vietnamese.woff2 +0 -0
- package/dist/basic/fonts.d.ts +1 -0
- package/dist/basic/fonts.js +111 -0
- package/dist/basic/index.d.ts +33 -0
- package/dist/basic/index.js +29 -0
- package/dist/common/AppAnalytics/AppAnalytics.d.ts +1 -0
- package/dist/common/AppAnalytics/AppAnalytics.js +25 -0
- package/dist/common/AppAnalytics/index.d.ts +2 -0
- package/dist/common/AppAnalytics/index.js +2 -0
- package/dist/common/AppCard/AppCard.d.ts +13 -0
- package/dist/common/AppCard/AppCard.js +7 -0
- package/dist/common/AppCard/index.d.ts +2 -0
- package/dist/common/AppCard/index.js +2 -0
- package/dist/common/AppCard/style.scss +33 -0
- package/dist/common/AppClipboard/AppClipboard.d.ts +7 -0
- package/dist/common/AppClipboard/AppClipboard.js +23 -0
- package/dist/common/AppClipboard/index.d.ts +2 -0
- package/dist/common/AppClipboard/index.js +2 -0
- package/dist/common/AppColorpicker/AppColorpicker.d.ts +9 -0
- package/dist/common/AppColorpicker/AppColorpicker.js +22 -0
- package/dist/common/AppColorpicker/index.d.ts +2 -0
- package/dist/common/AppColorpicker/index.js +2 -0
- package/dist/common/AppColorpicker/style.scss +26 -0
- package/dist/common/AppCopyText/AppCopyText.d.ts +11 -0
- package/dist/common/AppCopyText/AppCopyText.js +35 -0
- package/dist/common/AppCopyText/index.d.ts +2 -0
- package/dist/common/AppCopyText/index.js +2 -0
- package/dist/common/AppCopyText/styles.scss +55 -0
- package/dist/common/AppDropzone/AppDropzone.d.ts +19 -0
- package/dist/common/AppDropzone/AppDropzone.js +13 -0
- package/dist/common/AppDropzone/AppDropzoneBody.d.ts +22 -0
- package/dist/common/AppDropzone/AppDropzoneBody.js +74 -0
- package/dist/common/AppDropzone/UploadService.d.ts +6 -0
- package/dist/common/AppDropzone/UploadService.js +18 -0
- package/dist/common/AppDropzone/UploadedFile.d.ts +14 -0
- package/dist/common/AppDropzone/UploadedFile.js +1 -0
- package/dist/common/AppDropzone/index.d.ts +4 -0
- package/dist/common/AppDropzone/index.js +4 -0
- package/dist/common/AppDropzone/style.scss +42 -0
- package/dist/common/AppDropzoneLocal/AppDropzoneBodyLocal.d.ts +15 -0
- package/dist/common/AppDropzoneLocal/AppDropzoneBodyLocal.js +55 -0
- package/dist/common/AppDropzoneLocal/AppDropzoneLocal.d.ts +15 -0
- package/dist/common/AppDropzoneLocal/AppDropzoneLocal.js +13 -0
- package/dist/common/AppDropzoneLocal/UploadedFileLocal.d.ts +5 -0
- package/dist/common/AppDropzoneLocal/UploadedFileLocal.js +1 -0
- package/dist/common/AppDropzoneLocal/index.d.ts +5 -0
- package/dist/common/AppDropzoneLocal/index.js +4 -0
- package/dist/common/AppDropzoneLocal/style.scss +75 -0
- package/dist/common/AppForm/AppForm.d.ts +16 -0
- package/dist/common/AppForm/AppForm.js +67 -0
- package/dist/common/AppForm/AppFormField.d.ts +37 -0
- package/dist/common/AppForm/AppFormField.js +10 -0
- package/dist/common/AppForm/AppFormInfo.d.ts +9 -0
- package/dist/common/AppForm/AppFormInfo.js +45 -0
- package/dist/common/AppForm/FormColorField.d.ts +12 -0
- package/dist/common/AppForm/FormColorField.js +23 -0
- package/dist/common/AppForm/index.d.ts +2 -0
- package/dist/common/AppForm/index.js +2 -0
- package/dist/common/AppForm/style.scss +60 -0
- package/dist/common/AppLoading/AppLoading.d.ts +7 -0
- package/dist/common/AppLoading/AppLoading.js +8 -0
- package/dist/common/AppLoading/index.d.ts +2 -0
- package/dist/common/AppLoading/index.js +2 -0
- package/dist/common/AppLoading/style.scss +5 -0
- package/dist/common/AppModal/AppModal.d.ts +27 -0
- package/dist/common/AppModal/AppModal.js +42 -0
- package/dist/common/AppModal/AppModalConfirm.d.ts +15 -0
- package/dist/common/AppModal/AppModalConfirm.js +37 -0
- package/dist/common/AppModal/AppModalRemove.d.ts +22 -0
- package/dist/common/AppModal/AppModalRemove.js +35 -0
- package/dist/common/AppModal/AppModalUtils.d.ts +2 -0
- package/dist/common/AppModal/AppModalUtils.js +17 -0
- package/dist/common/AppModal/index.d.ts +2 -0
- package/dist/common/AppModal/index.js +2 -0
- package/dist/common/AppModal/style.scss +100 -0
- package/dist/common/AppPagination/AppPagination.d.ts +12 -0
- package/dist/common/AppPagination/AppPagination.js +212 -0
- package/dist/common/AppPagination/index.d.ts +2 -0
- package/dist/common/AppPagination/index.js +2 -0
- package/dist/common/AppPagination/styles.scss +230 -0
- package/dist/common/AppPicture/AppPicture.d.ts +10 -0
- package/dist/common/AppPicture/AppPicture.js +18 -0
- package/dist/common/AppPicture/index.d.ts +2 -0
- package/dist/common/AppPicture/index.js +2 -0
- package/dist/common/AppPicture/style.scss +0 -0
- package/dist/common/AppPlaceholder/AppPlaceholder.d.ts +12 -0
- package/dist/common/AppPlaceholder/AppPlaceholder.js +7 -0
- package/dist/common/AppPlaceholder/index.d.ts +2 -0
- package/dist/common/AppPlaceholder/index.js +2 -0
- package/dist/common/AppPlaceholder/style.scss +25 -0
- package/dist/common/AppSwitchGroup/AppSwitchGroup.d.ts +12 -0
- package/dist/common/AppSwitchGroup/AppSwitchGroup.js +8 -0
- package/dist/common/AppSwitchGroup/index.d.ts +2 -0
- package/dist/common/AppSwitchGroup/index.js +2 -0
- package/dist/common/AppSwitchGroup/style.scss +18 -0
- package/dist/common/AppTable/AppTable.d.ts +19 -0
- package/dist/common/AppTable/AppTable.js +62 -0
- package/dist/common/AppTable/AppTableList.d.ts +14 -0
- package/dist/common/AppTable/AppTableList.js +48 -0
- package/dist/common/AppTable/AppTableTheme.d.ts +1 -0
- package/dist/common/AppTable/AppTableTheme.js +45 -0
- package/dist/common/AppTable/AppTableUtils.d.ts +8 -0
- package/dist/common/AppTable/AppTableUtils.js +24 -0
- package/dist/common/AppTable/index.d.ts +2 -0
- package/dist/common/AppTable/index.js +2 -0
- package/dist/common/AppTable/styles.scss +65 -0
- package/dist/common/AppTable/types/AppPage.d.ts +29 -0
- package/dist/common/AppTable/types/AppPage.js +18 -0
- package/dist/common/AppTable/types/AppPageable.d.ts +15 -0
- package/dist/common/AppTable/types/AppPageable.js +19 -0
- package/dist/common/AppTextArea/AppTextArea.d.ts +11 -0
- package/dist/common/AppTextArea/AppTextArea.js +29 -0
- package/dist/common/AppTextArea/index.d.ts +1 -0
- package/dist/common/AppTextArea/index.js +1 -0
- package/dist/common/AppTextArea/style.scss +47 -0
- package/dist/common/AppToast/AppToast.d.ts +2 -0
- package/dist/common/AppToast/AppToast.js +81 -0
- package/dist/common/AppToast/ToastMessage.d.ts +8 -0
- package/dist/common/AppToast/ToastMessage.js +4 -0
- package/dist/common/AppToast/index.d.ts +2 -0
- package/dist/common/AppToast/index.js +2 -0
- package/dist/common/AppToast/style.scss +0 -0
- package/dist/common/index.d.ts +27 -0
- package/dist/common/index.js +23 -0
- package/dist/configs/CommonContext.d.ts +10 -0
- package/dist/configs/CommonContext.js +9 -0
- package/dist/configs/CookieStorage.d.ts +15 -0
- package/dist/configs/CookieStorage.js +45 -0
- package/dist/configs/Localization.d.ts +28 -0
- package/dist/configs/Localization.js +63 -0
- package/dist/configs/Storage.d.ts +9 -0
- package/dist/configs/Storage.js +16 -0
- package/dist/configs/api.d.ts +10 -0
- package/dist/configs/api.js +52 -0
- package/dist/configs/index.d.ts +8 -0
- package/dist/configs/index.js +7 -0
- package/dist/configs/localization/BaseTexts.d.ts +44 -0
- package/dist/configs/localization/BaseTexts.js +44 -0
- package/dist/configs/localization/CommentsTexts.d.ts +95 -0
- package/dist/configs/localization/CommentsTexts.js +95 -0
- package/dist/configs/localization/CommonTexts.d.ts +239 -0
- package/dist/configs/localization/CommonTexts.js +239 -0
- package/dist/configs/localization/ConsentTexts.d.ts +116 -0
- package/dist/configs/localization/ConsentTexts.js +203 -0
- package/dist/configs/localization/HeaderAppTexts.d.ts +106 -0
- package/dist/configs/localization/HeaderAppTexts.js +106 -0
- package/dist/configs/localization/HeaderTexts.d.ts +68 -0
- package/dist/configs/localization/HeaderTexts.js +68 -0
- package/dist/configs/localization/HelpTexts.d.ts +38 -0
- package/dist/configs/localization/HelpTexts.js +38 -0
- package/dist/configs/localization/HistoryTexts.d.ts +428 -0
- package/dist/configs/localization/HistoryTexts.js +428 -0
- package/dist/configs/localization/ParametersTexts.d.ts +137 -0
- package/dist/configs/localization/ParametersTexts.js +137 -0
- package/dist/configs/localization/SentenceTexts.d.ts +56 -0
- package/dist/configs/localization/SentenceTexts.js +56 -0
- package/dist/configs/localization/TreeTexts.d.ts +46 -0
- package/dist/configs/localization/TreeTexts.js +46 -0
- package/dist/configs/localization/UploadTexts.d.ts +23 -0
- package/dist/configs/localization/UploadTexts.js +23 -0
- package/dist/configs/services/ProfileService.d.ts +5 -0
- package/dist/configs/services/ProfileService.js +8 -0
- package/dist/configs/sessionTypes.d.ts +42 -0
- package/dist/configs/sessionTypes.js +63 -0
- package/dist/configs/useLoggedUtils.d.ts +7 -0
- package/dist/configs/useLoggedUtils.js +24 -0
- package/dist/configs/useMessageUtils.d.ts +22 -0
- package/dist/configs/useMessageUtils.js +71 -0
- package/dist/fonts/material-symbols-outlined.woff2 +0 -0
- package/dist/fonts/work-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/work-sans-latin.woff2 +0 -0
- package/dist/fonts/work-sans-vietnamese.woff2 +0 -0
- package/dist/functions/DateUtils.d.ts +15 -0
- package/dist/functions/DateUtils.js +52 -0
- package/dist/functions/FilterUtils.d.ts +13 -0
- package/dist/functions/FilterUtils.js +56 -0
- package/dist/functions/FormUtils.d.ts +13 -0
- package/dist/functions/FormUtils.js +58 -0
- package/dist/functions/ImageUtils.d.ts +5 -0
- package/dist/functions/ImageUtils.js +13 -0
- package/dist/functions/SecurityUtils.d.ts +6 -0
- package/dist/functions/SecurityUtils.js +28 -0
- package/dist/functions/UsabilityUtils.d.ts +10 -0
- package/dist/functions/UsabilityUtils.js +47 -0
- package/dist/functions/index.d.ts +6 -0
- package/dist/functions/index.js +6 -0
- package/dist/functions/logo-ud.png +0 -0
- package/dist/functions/placeholder-image.png +0 -0
- package/dist/functions/placeholder-person.png +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/styles/base/_borders.scss +30 -0
- package/dist/styles/base/_colors.scss +100 -0
- package/dist/styles/base/_displays.scss +207 -0
- package/dist/styles/base/_margins.css +174 -0
- package/dist/styles/base/_spacing.scss +26 -0
- package/dist/styles/base/_tokens.scss +330 -0
- package/dist/styles/base/_typographs.scss +376 -0
- package/dist/styles/font-googleapis.scss +222 -0
- package/dist/styles/main.scss +112 -0
- package/dist/vendor/index.d.ts +5 -0
- package/dist/vendor/index.js +4 -0
- package/package.json +118 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
3
|
+
import Dropzone from 'react-dropzone';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button } from '../../basic';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
function AppDropzoneBodyLocalInner({ onSuccess, onError, accept, onDrop, showConfirmButton = true, }, ref) {
|
|
8
|
+
const { t } = useTranslation('upload');
|
|
9
|
+
const [files, setFiles] = useState([]);
|
|
10
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
11
|
+
const filesRef = useRef([]);
|
|
12
|
+
filesRef.current = files;
|
|
13
|
+
const upload = async () => {
|
|
14
|
+
const currentFiles = filesRef.current;
|
|
15
|
+
if (currentFiles.length === 0 || isUploading)
|
|
16
|
+
return;
|
|
17
|
+
setIsUploading(true);
|
|
18
|
+
try {
|
|
19
|
+
const results = await Promise.all(currentFiles.map(async (file) => ({
|
|
20
|
+
name: file.name,
|
|
21
|
+
content: await file.text(),
|
|
22
|
+
})));
|
|
23
|
+
onSuccess(results);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
onError?.(err);
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
setIsUploading(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useImperativeHandle(ref, () => ({
|
|
33
|
+
upload,
|
|
34
|
+
}));
|
|
35
|
+
const handleDrop = (acceptedFiles) => {
|
|
36
|
+
if (acceptedFiles.length === 0)
|
|
37
|
+
return;
|
|
38
|
+
setFiles((prev) => [...prev, ...acceptedFiles]);
|
|
39
|
+
onDrop?.();
|
|
40
|
+
};
|
|
41
|
+
const clearFiles = () => setFiles([]);
|
|
42
|
+
const removeAt = (index) => {
|
|
43
|
+
setFiles((prev) => prev.filter((_, i) => i !== index));
|
|
44
|
+
};
|
|
45
|
+
return (_jsxs("div", { className: "dropzone-container-local", children: [files.length === 0 && (_jsx(Dropzone, { onDrop: handleDrop, accept: accept, multiple: true, children: ({ getRootProps, getInputProps }) => (_jsxs("div", { ...getRootProps(), className: "dropzone-local", children: [_jsx("input", { ...getInputProps() }), _jsx("span", { children: t('label.dropzone') })] })) })), files.length > 0 && (_jsxs("div", { className: "uploaded-message-local", children: [_jsx("b", { children: t('label.uploaded.file') }), _jsx("ul", { className: "uploaded-file-list-local", children: files.map((file, index) => (_jsxs("li", { children: [_jsx("span", { children: file.name }), _jsx("button", { type: "button", className: "uploaded-file-remove-local", onClick: (e) => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
removeAt(index);
|
|
48
|
+
}, "aria-label": t('common:button.remove', {
|
|
49
|
+
defaultValue: 'Remove',
|
|
50
|
+
}), children: "\u00D7" })] }, `${file.name}-${file.size}-${index}`))) }), _jsx("button", { type: "button", className: "uploaded-clear-all-local", onClick: clearFiles, children: t('label.clear.all', { defaultValue: 'Clear all' }) }), _jsx("b", { children: t('label.confirm') })] })), files.length > 0 && showConfirmButton && (_jsx(Button, { onClick: () => {
|
|
51
|
+
void upload();
|
|
52
|
+
}, text: t('common:button.confirm') }))] }));
|
|
53
|
+
}
|
|
54
|
+
const AppDropzoneBodyLocal = forwardRef(AppDropzoneBodyLocalInner);
|
|
55
|
+
export default AppDropzoneBodyLocal;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UploadedFileLocal } from './UploadedFileLocal';
|
|
2
|
+
type AppDropzoneLocalProps = {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onSuccess: (files: UploadedFileLocal[]) => void;
|
|
5
|
+
onError?: (err: unknown) => void;
|
|
6
|
+
accept: Record<string, string[]>;
|
|
7
|
+
onDrop?: () => void;
|
|
8
|
+
title?: string;
|
|
9
|
+
alternativeButton?: {
|
|
10
|
+
title: string;
|
|
11
|
+
action: () => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default function AppDropzoneLocal({ onClose, onSuccess, onError, accept, onDrop, title, alternativeButton, }: AppDropzoneLocalProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import AppModal from '../AppModal';
|
|
5
|
+
import AppDropzoneBodyLocal from './AppDropzoneBodyLocal';
|
|
6
|
+
export default function AppDropzoneLocal({ onClose, onSuccess, onError, accept, onDrop, title, alternativeButton, }) {
|
|
7
|
+
const { t } = useTranslation('upload');
|
|
8
|
+
const bodyRef = useRef(null);
|
|
9
|
+
const handleConfirm = () => {
|
|
10
|
+
void bodyRef.current?.upload();
|
|
11
|
+
};
|
|
12
|
+
return (_jsx(AppModal, { title: title || t('modal.title'), className: "modal-upload-local", close: onClose, confirm: handleConfirm, alternativeButton: alternativeButton, children: _jsx(AppDropzoneBodyLocal, { ref: bodyRef, onSuccess: onSuccess, onError: onError, accept: accept, onDrop: onDrop, showConfirmButton: false }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import AppDropzoneLocal from './AppDropzoneLocal';
|
|
2
|
+
import AppDropzoneBodyLocal, { type AppDropzoneBodyLocalProps, type AppDropzoneBodyLocalRef } from './AppDropzoneBodyLocal';
|
|
3
|
+
import type { UploadedFileLocal } from './UploadedFileLocal';
|
|
4
|
+
export default AppDropzoneLocal;
|
|
5
|
+
export { AppDropzoneBodyLocal, type AppDropzoneBodyLocalProps, type AppDropzoneBodyLocalRef, type UploadedFileLocal, };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.dropzone-container-local {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
|
|
6
|
+
.dropzone-local {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
text-align: center;
|
|
11
|
+
width: 100%;
|
|
12
|
+
padding: var(--spacing-700);
|
|
13
|
+
border-radius: var(--radius-100);
|
|
14
|
+
border: 2px dashed var(--border-subtle-3);
|
|
15
|
+
background-color: var(--layer-layer-2);
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.preview-local {
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
width: 400px;
|
|
22
|
+
height: 400px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.uploaded-message-local {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
width: 100%;
|
|
29
|
+
gap: 16px;
|
|
30
|
+
text-align: center;
|
|
31
|
+
border: 1px solid var(--border-subtle-3);
|
|
32
|
+
border-radius: var(--radius-100);
|
|
33
|
+
padding: 16px;
|
|
34
|
+
margin-top: var(--spacing-400);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.uploaded-file-list-local {
|
|
38
|
+
list-style: none;
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
text-align: left;
|
|
42
|
+
border: var(--border-default);
|
|
43
|
+
padding: 8px;
|
|
44
|
+
border-radius: var(--radius-100);
|
|
45
|
+
|
|
46
|
+
li {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
padding: 4px 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.uploaded-file-remove-local {
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
border: none;
|
|
58
|
+
background: transparent;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-size: 1.25rem;
|
|
61
|
+
line-height: 1;
|
|
62
|
+
padding: 0 4px;
|
|
63
|
+
color: var(--text-secondary, inherit);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.uploaded-clear-all-local {
|
|
67
|
+
align-self: center;
|
|
68
|
+
border: none;
|
|
69
|
+
background: transparent;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
text-decoration: underline;
|
|
72
|
+
font: inherit;
|
|
73
|
+
color: var(--text-link, inherit);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { SelectItem } from '../../basic';
|
|
3
|
+
import { AppFormField } from './AppFormField';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
|
|
6
|
+
fields: AppFormField[];
|
|
7
|
+
form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
onChangeFunctions?: Record<string, (v: string | number | boolean) => void>;
|
|
10
|
+
onBlurFunctions?: Record<string, () => void>;
|
|
11
|
+
runtimeOptions?: Record<string, any[]>;
|
|
12
|
+
runtimeLoadOptions?: Record<string, (query: string) => Promise<SelectItem[]>>;
|
|
13
|
+
twoColumns?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function AppForm<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>({ fields, form, prefix, onChangeFunctions, onBlurFunctions, runtimeOptions, runtimeLoadOptions, twoColumns, }: Props<TFieldValues, TContext, TTransformedValues>): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AsyncSelectField, CheckboxField, DatePickerField, SelectField, SelectMultipleField, SwitchField, TextField, } from '../../basic';
|
|
3
|
+
import FormColorField from './FormColorField';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
const convertList = (values, labelAttr, valueAttr) => {
|
|
6
|
+
if (!values)
|
|
7
|
+
return [];
|
|
8
|
+
let fields = [];
|
|
9
|
+
values.map((value) => {
|
|
10
|
+
fields = [...fields, { label: value[labelAttr], value: value[valueAttr] }];
|
|
11
|
+
});
|
|
12
|
+
return fields;
|
|
13
|
+
};
|
|
14
|
+
export default function AppForm({ fields, form, prefix, onChangeFunctions = {}, onBlurFunctions = {}, runtimeOptions = {}, runtimeLoadOptions = {}, twoColumns = false, }) {
|
|
15
|
+
const getOnChangeFn = (attr) => onChangeFunctions[attr];
|
|
16
|
+
const getOnBlurFn = (attr) => onBlurFunctions[attr];
|
|
17
|
+
const getOptions = (attr) => {
|
|
18
|
+
if (!runtimeOptions[attr])
|
|
19
|
+
return undefined;
|
|
20
|
+
return convertList(runtimeOptions[attr], 'name', 'uid');
|
|
21
|
+
};
|
|
22
|
+
return (_jsx("div", { className: `app-form-container ${twoColumns ? 'two-columns' : ''}`, children: fields.map((field) => {
|
|
23
|
+
const name = prefix ? `${prefix}.${field.attr}` : field.attr;
|
|
24
|
+
const handleChange = getOnChangeFn(field.attr);
|
|
25
|
+
if (field.type === 'autocomplete') {
|
|
26
|
+
const loadOptions = runtimeLoadOptions[field.attr];
|
|
27
|
+
if (!loadOptions)
|
|
28
|
+
return null;
|
|
29
|
+
return (_jsx(AsyncSelectField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, multiple: field.multiple, freeSolo: field.freeSolo, minQueryLength: field.minQueryLength, loadOptions: loadOptions, placeholder: field.title, noOptionsText: field.translation, onChange: (_attr, value) => handleChange?.(value) }, name));
|
|
30
|
+
}
|
|
31
|
+
if (field.type === 'select') {
|
|
32
|
+
const selectOptions = getOptions(field.attr) || field.options || [];
|
|
33
|
+
const selectProps = {
|
|
34
|
+
attr: name,
|
|
35
|
+
label: field.name,
|
|
36
|
+
createdForm: form,
|
|
37
|
+
options: selectOptions,
|
|
38
|
+
disabled: field.disabled,
|
|
39
|
+
required: field.required,
|
|
40
|
+
onChange: (value) => handleChange?.(value),
|
|
41
|
+
showEndAdornment: false,
|
|
42
|
+
};
|
|
43
|
+
if (field.multiple) {
|
|
44
|
+
return _jsx(SelectMultipleField, { ...selectProps }, name);
|
|
45
|
+
}
|
|
46
|
+
return _jsx(SelectField, { ...selectProps }, name);
|
|
47
|
+
}
|
|
48
|
+
if (field.type === 'check') {
|
|
49
|
+
return (_jsx(CheckboxField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled }, name));
|
|
50
|
+
}
|
|
51
|
+
if (field.type === 'switch') {
|
|
52
|
+
return (_jsx(SwitchField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => handleChange?.(value) }, name));
|
|
53
|
+
}
|
|
54
|
+
if (field.type === 'datepicker') {
|
|
55
|
+
const handleBlur = getOnBlurFn(field.attr);
|
|
56
|
+
return (_jsx(DatePickerField, { attr: name, label: field.size === 'small' ? undefined : field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (_attr, value) => handleChange?.(value), onBlur: handleBlur, height: field.size === 'small' ? '32px' : undefined }, name));
|
|
57
|
+
}
|
|
58
|
+
if (field.type === 'textarea') {
|
|
59
|
+
return (_jsx(TextField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), multiline: true, rows: field.rows, height: "100%", infoText: field.infoText, defaultEndAdornments: field.infoText ? ['info'] : ['close'] }, name));
|
|
60
|
+
}
|
|
61
|
+
if (field.type === 'color') {
|
|
62
|
+
return (_jsx(FormColorField, { attr: name, label: field.name, form: form, disabled: field.disabled, tooltipText: field.tooltipText, onChange: (value) => handleChange?.(value) }, name));
|
|
63
|
+
}
|
|
64
|
+
const handleBlur = getOnBlurFn(field.attr);
|
|
65
|
+
return (_jsx(TextField, { attr: name, label: field.size === 'small' ? undefined : field.name, placeholder: field.size === 'small' ? field.name : undefined, createdForm: form, mask: field.mask, blurMask: field.blurMask, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), height: field.size === 'small' ? '32px' : undefined, onBlur: handleBlur, infoText: field.infoText, defaultEndAdornments: field.infoText ? ['info'] : ['close'] }, name));
|
|
66
|
+
}) }));
|
|
67
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SelectItem } from '../../basic';
|
|
2
|
+
export type SwitchFieldLabels = {
|
|
3
|
+
trueLabel: string;
|
|
4
|
+
falseLabel: string;
|
|
5
|
+
notAvailable: string;
|
|
6
|
+
};
|
|
7
|
+
/** Renders switch (boolean) values for read-only display — no ternary chains. */
|
|
8
|
+
export declare function formatSwitchFieldValue(value: unknown, labels: SwitchFieldLabels): string;
|
|
9
|
+
export type DisplayFunction = (value: any) => string;
|
|
10
|
+
export type MaskFunction = (value: string, isBlur?: boolean) => string;
|
|
11
|
+
export type AppFormField = {
|
|
12
|
+
attr: string;
|
|
13
|
+
name: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
type: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
options?: SelectItem[];
|
|
19
|
+
tooltip?: boolean;
|
|
20
|
+
tooltipText?: string;
|
|
21
|
+
infoText?: string;
|
|
22
|
+
multiple?: boolean;
|
|
23
|
+
freeSolo?: boolean;
|
|
24
|
+
minQueryLength?: number;
|
|
25
|
+
default?: string | boolean | number;
|
|
26
|
+
role?: string;
|
|
27
|
+
fn?: (value: any) => string | number;
|
|
28
|
+
translation?: string;
|
|
29
|
+
mask?: MaskFunction;
|
|
30
|
+
blurMask?: MaskFunction;
|
|
31
|
+
pattern?: string;
|
|
32
|
+
rows?: number;
|
|
33
|
+
size?: 'medium' | 'small';
|
|
34
|
+
display?: DisplayFunction;
|
|
35
|
+
copyToClipboard?: boolean;
|
|
36
|
+
truncate?: number;
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Renders switch (boolean) values for read-only display — no ternary chains. */
|
|
2
|
+
export function formatSwitchFieldValue(value, labels) {
|
|
3
|
+
if (value === true) {
|
|
4
|
+
return labels.trueLabel;
|
|
5
|
+
}
|
|
6
|
+
if (value === false) {
|
|
7
|
+
return labels.falseLabel;
|
|
8
|
+
}
|
|
9
|
+
return labels.notAvailable;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppFormField } from './AppFormField';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
type Props = {
|
|
4
|
+
fields: AppFormField[];
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
};
|
|
8
|
+
export default function AppFormInfo({ fields, data }: Props): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { formatSwitchFieldValue } from './AppFormField';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
import { Icon } from '../../basic';
|
|
6
|
+
import UsabilityUtils from '../../functions/UsabilityUtils';
|
|
7
|
+
function truncateValue(value, truncate, t) {
|
|
8
|
+
if (!value) {
|
|
9
|
+
return t('label.notavailable');
|
|
10
|
+
}
|
|
11
|
+
if (value.length <= truncate) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
return `${value.slice(0, truncate)}…`;
|
|
15
|
+
}
|
|
16
|
+
function getFieldDisplayContent(field, raw, t) {
|
|
17
|
+
if (field.truncate) {
|
|
18
|
+
return truncateValue(raw, field.truncate, t);
|
|
19
|
+
}
|
|
20
|
+
if (field.display) {
|
|
21
|
+
return field.display(raw);
|
|
22
|
+
}
|
|
23
|
+
if (field.fn) {
|
|
24
|
+
return field.fn(raw);
|
|
25
|
+
}
|
|
26
|
+
if (field.type === 'switch') {
|
|
27
|
+
return formatSwitchFieldValue(raw, {
|
|
28
|
+
trueLabel: t('generic.boolean.true'),
|
|
29
|
+
falseLabel: t('generic.boolean.false'),
|
|
30
|
+
notAvailable: t('label.notavailable'),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (raw) {
|
|
34
|
+
return raw;
|
|
35
|
+
}
|
|
36
|
+
return t('label.notavailable');
|
|
37
|
+
}
|
|
38
|
+
export default function AppFormInfo({ fields, data }) {
|
|
39
|
+
const { t } = useTranslation('common');
|
|
40
|
+
return (_jsx("div", { className: "app-form-info-container", children: fields.map((field, idx) => {
|
|
41
|
+
return (_jsxs("div", { className: "item", ...(field.title && { title: field.title }), children: [_jsxs("span", { className: "label", children: [field.name, ":"] }), _jsx("span", { className: "value", children: getFieldDisplayContent(field, data[field.attr], t) }), field.copyToClipboard && (_jsx(Icon, { name: "content_copy", size: "small", className: "ds-copy-icon", filled: true, onClick: () => {
|
|
42
|
+
UsabilityUtils.copy(data[field.attr]);
|
|
43
|
+
} }))] }, idx));
|
|
44
|
+
}) }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import '../AppColorpicker/style.scss';
|
|
3
|
+
type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
|
|
4
|
+
attr: string;
|
|
5
|
+
label: string;
|
|
6
|
+
form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
tooltipText?: string;
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
};
|
|
11
|
+
export default function FormColorField<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>({ attr, label, form, disabled, tooltipText, onChange, }: Props<TFieldValues, TContext, TTransformedValues>): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { HexColorPicker } from 'react-colorful';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Icon, Tooltip } from '../../basic';
|
|
6
|
+
import '../AppColorpicker/style.scss';
|
|
7
|
+
const defaultColor = '#FFFFFF';
|
|
8
|
+
export default function FormColorField({ attr, label, form, disabled, tooltipText, onChange, }) {
|
|
9
|
+
const fieldName = attr;
|
|
10
|
+
const { t } = useTranslation('common');
|
|
11
|
+
const formValue = form.watch(fieldName);
|
|
12
|
+
const [openColor, setOpenColor] = useState(false);
|
|
13
|
+
const [color, setColor] = useState(defaultColor);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setColor(formValue || defaultColor);
|
|
16
|
+
}, [formValue]);
|
|
17
|
+
const handleConfirm = () => {
|
|
18
|
+
form.setValue(fieldName, color, { shouldDirty: true });
|
|
19
|
+
onChange?.(color);
|
|
20
|
+
setOpenColor(false);
|
|
21
|
+
};
|
|
22
|
+
return (_jsxs("div", { className: "form-color-field", children: [_jsxs("div", { className: "form-color-field-label", children: [_jsx("span", { children: label }), tooltipText && (_jsx(Tooltip, { title: tooltipText, children: _jsx("span", { children: _jsx(Icon, { name: "help", className: "info", size: "x-small" }) }) }))] }), _jsxs("div", { className: "color-picker-container", children: [_jsx("div", { className: "swatch", style: { backgroundColor: color }, onClick: () => !disabled && setOpenColor(!openColor), onKeyDown: () => !disabled && setOpenColor(!openColor), role: "link", "aria-label": "open color picker", tabIndex: disabled ? -1 : 0 }), openColor && !disabled && (_jsxs(_Fragment, { children: [_jsx(HexColorPicker, { color: color, onChange: setColor }), _jsxs("div", { className: "buttons", children: [_jsx(Button, { text: t('button.confirm'), onClick: handleConfirm, size: "x-small" }), _jsx(Button, { text: t('button.cancel'), onClick: () => setOpenColor(false), color: "danger", size: "x-small" })] })] }))] })] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.app-form-info-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 16px;
|
|
5
|
+
|
|
6
|
+
.item {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
|
|
11
|
+
&.full-width {
|
|
12
|
+
grid-column: 1 / -1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.label {
|
|
16
|
+
@include label-medium-2;
|
|
17
|
+
color: var(--text-primary);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.value {
|
|
21
|
+
@include body-medium-1;
|
|
22
|
+
color: var(--text-secondary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
> .ds-copy-icon {
|
|
26
|
+
color: var(--icon-primary);
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.app-form-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: 16px;
|
|
36
|
+
|
|
37
|
+
&.two-columns {
|
|
38
|
+
display: grid;
|
|
39
|
+
grid-template-columns: repeat(2, 1fr);
|
|
40
|
+
gap: 16px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.form-color-field {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--spacing-100);
|
|
48
|
+
|
|
49
|
+
.form-color-field-label {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--spacing-50);
|
|
53
|
+
@include label-medium-2;
|
|
54
|
+
color: var(--text-primary);
|
|
55
|
+
|
|
56
|
+
.info {
|
|
57
|
+
color: var(--icon-primary);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import ReactLoading from 'react-loading';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
export default function AppLoading({ className = '', pageLoading = false, }) {
|
|
6
|
+
const containerClassName = cx('loading-container', { 'page-loading': pageLoading }, className);
|
|
7
|
+
return (_jsx("div", { className: containerClassName, children: _jsx(ReactLoading, { type: "spinningBubbles", color: "blue", height: 50, width: 50 }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import './style.scss';
|
|
2
|
+
type Props = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
title: string;
|
|
5
|
+
close: () => void;
|
|
6
|
+
confirm?: () => void;
|
|
7
|
+
cancel?: () => void;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
disableConfirm?: boolean;
|
|
11
|
+
hideFooter?: boolean;
|
|
12
|
+
disableCancel?: boolean;
|
|
13
|
+
disableClose?: boolean;
|
|
14
|
+
disableEscapeClose?: boolean;
|
|
15
|
+
confirmLabel?: string;
|
|
16
|
+
closeLabel?: string;
|
|
17
|
+
onEntered?: () => void;
|
|
18
|
+
alternativeButton?: {
|
|
19
|
+
title: string;
|
|
20
|
+
action: () => void;
|
|
21
|
+
};
|
|
22
|
+
alternativeOptions?: React.ReactNode;
|
|
23
|
+
hideBackdrop?: boolean;
|
|
24
|
+
disableBackdropClose?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }: Props): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Fade, Modal } from '@mui/material';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Icon } from '../../basic';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
import { useEffect } from 'react';
|
|
8
|
+
import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
|
|
9
|
+
export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }) {
|
|
10
|
+
const { t } = useTranslation('common');
|
|
11
|
+
const getClassNames = cx('modal-container', className);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (disableEscapeClose)
|
|
14
|
+
return;
|
|
15
|
+
return attachCloseToEscape(close);
|
|
16
|
+
}, [close, disableEscapeClose]);
|
|
17
|
+
return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event, reason) => {
|
|
18
|
+
stopEventPropagation(event);
|
|
19
|
+
if (disableBackdropClose && reason === 'backdropClick')
|
|
20
|
+
return;
|
|
21
|
+
if (disableClose)
|
|
22
|
+
return;
|
|
23
|
+
close();
|
|
24
|
+
}, children: _jsx(Fade, { in: true, onEntered: () => onEntered && onEntered(), children: _jsxs(Box, { className: getClassNames, sx: style, children: [_jsxs("div", { className: "header", children: [_jsxs("div", { className: "titles", children: [_jsx("span", { className: "title", children: title }), subtitle && _jsx("span", { className: "subtitle", children: subtitle })] }), !disableClose && (_jsx(Icon, { name: "close", onClick: (e) => {
|
|
25
|
+
stopEventPropagation(e);
|
|
26
|
+
close();
|
|
27
|
+
}, className: "pointer" }))] }), _jsx("div", { className: "body", children: children }), !hideFooter ? (_jsxs("div", { className: "footer", children: [alternativeOptions && alternativeOptions, alternativeButton && (_jsx(Button, { className: "alternative", color: "white", onClick: alternativeButton.action, text: alternativeButton.title })), !disableCancel && (_jsx(Button, { onClick: (e) => {
|
|
28
|
+
stopEventPropagation(e);
|
|
29
|
+
(cancel || close)();
|
|
30
|
+
}, text: closeLabel || t('button.cancel'), mode: "tonal" })), confirm && (_jsx(Button, { onClick: confirm, disabled: disableConfirm, text: confirmLabel || t('button.confirm') }))] })) : null] }) }) }));
|
|
31
|
+
}
|
|
32
|
+
const style = {
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
top: '40%',
|
|
35
|
+
left: '50%',
|
|
36
|
+
transform: 'translate(-50%, -50%)',
|
|
37
|
+
width: '50%',
|
|
38
|
+
maxWidth: '1080px',
|
|
39
|
+
borderRadius: 'var(--radius-200)',
|
|
40
|
+
boxShadow: 24,
|
|
41
|
+
bgcolor: 'var(--background-default)',
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './style.scss';
|
|
2
|
+
type Props = {
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle: string | React.ReactNode;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
closeLabel?: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
disableClose?: boolean;
|
|
10
|
+
disableEscapeClose?: boolean;
|
|
11
|
+
disableBackdropClose?: boolean;
|
|
12
|
+
confirmDisabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, disableBackdropClose, }: Props): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Modal } from '@mui/material';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Icon } from '../../basic';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
|
|
8
|
+
export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, disableBackdropClose, }) {
|
|
9
|
+
const { t } = useTranslation('common');
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!onClose || disableEscapeClose)
|
|
12
|
+
return;
|
|
13
|
+
return attachCloseToEscape(onClose);
|
|
14
|
+
}, [onClose, disableEscapeClose]);
|
|
15
|
+
return (_jsx(Modal, { open: true, disableEscapeKeyDown: !onClose || !!disableEscapeClose, onClose: (event, reason) => {
|
|
16
|
+
stopEventPropagation(event);
|
|
17
|
+
if (!onClose || disableClose)
|
|
18
|
+
return;
|
|
19
|
+
if (disableBackdropClose && reason === 'backdropClick')
|
|
20
|
+
return;
|
|
21
|
+
onClose();
|
|
22
|
+
}, children: _jsxs(Box, { className: "modal-container modal-confirm", sx: style, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [onClose && (_jsx(Button, { onClick: (e) => {
|
|
23
|
+
stopEventPropagation(e);
|
|
24
|
+
onClose();
|
|
25
|
+
}, text: closeLabel || t('button.cancel'), mode: "tonal" })), _jsx(Button, { onClick: onConfirm, text: confirmLabel || t('button.confirm'), disabled: confirmDisabled })] })] }) }));
|
|
26
|
+
}
|
|
27
|
+
const style = {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: '40%',
|
|
30
|
+
left: '50%',
|
|
31
|
+
transform: 'translate(-50%, -50%)',
|
|
32
|
+
width: '30%',
|
|
33
|
+
maxWidth: '580px',
|
|
34
|
+
borderRadius: 'var(--radius-200)',
|
|
35
|
+
boxShadow: 24,
|
|
36
|
+
bgcolor: 'var(--background-default)',
|
|
37
|
+
};
|