tp-react-elements-dev 1.12.31 → 1.12.33
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/assets/icons/flaticon_hvc.css +195 -195
- package/dist/assets/icons/flaticon_hvc.scss +243 -243
- package/dist/components/FileUpload/index.d.ts +1 -0
- package/dist/components/FileUpload/index.esm.js +1 -0
- package/dist/components/Form/FormRender.esm.js +4 -0
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.esm.js +19 -21
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.esm.js +1 -0
- package/dist/components/FormComponents/FileUpload/MultiFileWithPreview.d.ts +6 -0
- package/dist/components/FormComponents/FileUpload/MultiFileWithPreview.esm.js +187 -0
- package/dist/components/FormComponents/FileUpload/index.d.ts +3 -0
- package/dist/components/FormComponents/FileUpload/index.esm.js +3 -0
- package/dist/components/FormComponents/FormBottomField/FormBottomField.esm.js +4 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberField.esm.js +4 -0
- package/dist/components/FormComponents/FormTextField/FormTextField.esm.js +1 -1
- package/dist/components/FormComponents/HelperText/HelperText.esm.js +1 -1
- package/dist/components/FormComponents/Select/MultiSelectAutocomplete.esm.js +20 -8
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.esm.js +1 -1
- package/dist/components/FormComponents/index.esm.js +12 -1
- package/dist/components/Global.styles.esm.js +64 -64
- package/dist/utils/Interface/FormInterface.d.ts +7 -2
- package/package.json +1 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, Button, IconButton, Modal, Typography } from '@mui/material';
|
|
3
|
+
import { useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { useWatch } from 'react-hook-form';
|
|
5
|
+
import 'dayjs';
|
|
6
|
+
import { renderLabel } from '../../../utils/Constants/FormConstants.esm.js';
|
|
7
|
+
import FormBottomField from '../FormBottomField/FormBottomField.esm.js';
|
|
8
|
+
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
9
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
10
|
+
import NavigateBeforeIcon from '@mui/icons-material/NavigateBefore';
|
|
11
|
+
import NavigateNextIcon from '@mui/icons-material/NavigateNext';
|
|
12
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
13
|
+
import UploadFileIcon from '@mui/icons-material/UploadFile';
|
|
14
|
+
|
|
15
|
+
const MultiFileWithPreview = ({ props, variant, }) => {
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
const watched = useWatch({ control: props.control, name: props.item.name });
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
20
|
+
const [currentFileIndex, setCurrentFileIndex] = useState(0);
|
|
21
|
+
// Determine if this is single or multiple file mode
|
|
22
|
+
const isSingleFileMode = props.item.maxLength === 1;
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (watched === null || watched === undefined) {
|
|
25
|
+
if (inputRef.current)
|
|
26
|
+
inputRef.current.value = '';
|
|
27
|
+
}
|
|
28
|
+
// Handle preloaded files from backend (array of URLs)
|
|
29
|
+
if (Array.isArray(watched) && typeof watched[0] === 'string') {
|
|
30
|
+
setSelectedFiles(watched);
|
|
31
|
+
}
|
|
32
|
+
}, [watched]);
|
|
33
|
+
const isError = !!props.errors?.[props.item.name];
|
|
34
|
+
const handleFileChange = (event) => {
|
|
35
|
+
const files = event.target.files;
|
|
36
|
+
if (!files)
|
|
37
|
+
return;
|
|
38
|
+
const fileArray = Array.from(files);
|
|
39
|
+
const allowedExtensions = {
|
|
40
|
+
excel: ['xls', 'xlsx'],
|
|
41
|
+
pdf: ['pdf'],
|
|
42
|
+
image: ['jpg', 'jpeg', 'png'],
|
|
43
|
+
all: ['pdf', 'jpg', 'jpeg', 'png', 'xls', 'xlsx', 'doc', 'docx', 'zip']};
|
|
44
|
+
const validExtensions = props.item.fileType === 'excel'
|
|
45
|
+
? allowedExtensions.excel
|
|
46
|
+
: props.item.fileType === 'pdf'
|
|
47
|
+
? allowedExtensions.pdf
|
|
48
|
+
: props.item.fileType === 'image'
|
|
49
|
+
? allowedExtensions.image
|
|
50
|
+
: allowedExtensions.all;
|
|
51
|
+
const invalidFile = fileArray.find((file) => {
|
|
52
|
+
const ext = file.name.split('.').pop()?.toLowerCase();
|
|
53
|
+
return !ext || !validExtensions.includes(ext);
|
|
54
|
+
});
|
|
55
|
+
if (invalidFile) {
|
|
56
|
+
props.item?.handleFileError?.(`Please upload ${validExtensions.join(', ')} files only`);
|
|
57
|
+
event.target.value = '';
|
|
58
|
+
props.setValue(props.item.name, null);
|
|
59
|
+
props.setValue(props.item.name + 'File', []);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const largeFile = fileArray.find((file) => file.size > 20000000);
|
|
63
|
+
if (largeFile) {
|
|
64
|
+
props.item?.handleFileError?.('File size should be less than 20MB');
|
|
65
|
+
event.target.value = '';
|
|
66
|
+
props.setValue(props.item.name, null);
|
|
67
|
+
props.setValue(props.item.name + 'File', []);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Handle single vs multiple file mode
|
|
71
|
+
let combinedFiles;
|
|
72
|
+
if (isSingleFileMode) {
|
|
73
|
+
// In single file mode, replace the existing file
|
|
74
|
+
combinedFiles = fileArray;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// In multiple file mode, combine with existing files
|
|
78
|
+
combinedFiles = [...selectedFiles, ...fileArray];
|
|
79
|
+
// Check if maxLength is exceeded
|
|
80
|
+
if (props.item.maxLength && combinedFiles.length > props.item.maxLength) {
|
|
81
|
+
props.item?.handleFileError?.(`You can only upload up to ${props.item.maxLength} files`);
|
|
82
|
+
event.target.value = '';
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const combinedFileNames = combinedFiles
|
|
87
|
+
.map((f) => (f instanceof File ? f.name : f.split('/').pop()))
|
|
88
|
+
.join(',');
|
|
89
|
+
props.setValue(props.item.name, combinedFileNames);
|
|
90
|
+
props.setValue(props.item.name + 'File', combinedFiles);
|
|
91
|
+
setSelectedFiles(combinedFiles);
|
|
92
|
+
props.item.onChangeSetFileFn?.(combinedFiles);
|
|
93
|
+
};
|
|
94
|
+
const handlePreviewClick = () => {
|
|
95
|
+
setCurrentFileIndex(0);
|
|
96
|
+
setOpen(true);
|
|
97
|
+
};
|
|
98
|
+
const handleClose = () => setOpen(false);
|
|
99
|
+
const handlePrevious = () => {
|
|
100
|
+
setCurrentFileIndex((prev) => prev > 0 ? prev - 1 : selectedFiles.length - 1);
|
|
101
|
+
};
|
|
102
|
+
const handleNext = () => {
|
|
103
|
+
setCurrentFileIndex((prev) => prev < selectedFiles.length - 1 ? prev + 1 : 0);
|
|
104
|
+
};
|
|
105
|
+
const handleDeleteFile = (indexToDelete) => {
|
|
106
|
+
const updatedFiles = selectedFiles.filter((_, index) => index !== indexToDelete);
|
|
107
|
+
setSelectedFiles(updatedFiles);
|
|
108
|
+
if (inputRef.current) {
|
|
109
|
+
inputRef.current.value = '';
|
|
110
|
+
}
|
|
111
|
+
if (updatedFiles.length === 0) {
|
|
112
|
+
props.setValue(props.item.name, null);
|
|
113
|
+
props.setValue(props.item.name + 'File', []);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const fileNames = updatedFiles
|
|
117
|
+
.map((f) => (f instanceof File ? f.name : f.split('/').pop()))
|
|
118
|
+
.join(',');
|
|
119
|
+
props.setValue(props.item.name, fileNames);
|
|
120
|
+
props.setValue(props.item.name + 'File', updatedFiles);
|
|
121
|
+
}
|
|
122
|
+
if (currentFileIndex >= updatedFiles.length) {
|
|
123
|
+
setCurrentFileIndex(Math.max(0, updatedFiles.length - 1));
|
|
124
|
+
}
|
|
125
|
+
props.item.onChangeSetFileFn &&
|
|
126
|
+
props.item.onChangeSetFileFn(updatedFiles);
|
|
127
|
+
if (updatedFiles.length === 0) {
|
|
128
|
+
setOpen(false);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const isImageFile = (file) => {
|
|
132
|
+
const ext = typeof file === 'string'
|
|
133
|
+
? file.split('.').pop()?.toLowerCase()
|
|
134
|
+
: file.name.split('.').pop()?.toLowerCase();
|
|
135
|
+
return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(ext || '');
|
|
136
|
+
};
|
|
137
|
+
return (jsxs(Fragment, { children: [jsxs(Box, { paddingLeft: "4px", sx: { ...props.item.sx, position: 'relative' }, children: [props.item?.label && (jsx(Box, { sx: { fontSize: '10px' }, children: renderLabel(variant, props, true) })), jsxs(Box, { display: "flex", alignItems: "center", gap: 1, children: [jsxs(Button, { variant: "outlined", component: "label", startIcon: jsx(UploadFileIcon, {}), sx: { flex: 1, textTransform: 'none' }, color: isError ? 'error' : 'primary', children: [selectedFiles.length > 0
|
|
138
|
+
? isSingleFileMode
|
|
139
|
+
? '1 file selected'
|
|
140
|
+
: `${selectedFiles.length} file(s) selected`
|
|
141
|
+
: isSingleFileMode
|
|
142
|
+
? 'Upload File'
|
|
143
|
+
: 'Upload Files', jsx("input", { type: "file", hidden: true, multiple: !isSingleFileMode, accept: props.item.fileType === 'excel'
|
|
144
|
+
? '.xls,.xlsx'
|
|
145
|
+
: props.item.fileType === 'pdf'
|
|
146
|
+
? '.pdf'
|
|
147
|
+
: props.item.fileType === 'image'
|
|
148
|
+
? '.jpg,.jpeg,.png'
|
|
149
|
+
: props.item.fileType === 'all'
|
|
150
|
+
? '.pdf,.jpg,.jpeg,.png,.xls,.xlsx,.doc,.docx'
|
|
151
|
+
: '', ref: inputRef, onChange: handleFileChange })] }), props.item.showFileCarousel && selectedFiles.length > 0 && (jsx(IconButton, { onClick: handlePreviewClick, color: "primary", size: "small", sx: { mt: 0.5 }, children: jsx(VisibilityIcon, {}) }))] })] }), jsx(FormBottomField, { ...props }), jsx(Modal, { open: open, onClose: handleClose, children: jsxs(Box, { sx: {
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
top: '50%',
|
|
154
|
+
left: '50%',
|
|
155
|
+
transform: 'translate(-50%, -50%)',
|
|
156
|
+
width: 600,
|
|
157
|
+
bgcolor: 'background.paper',
|
|
158
|
+
borderRadius: 2,
|
|
159
|
+
boxShadow: 24,
|
|
160
|
+
p: 3,
|
|
161
|
+
}, children: [jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [jsx(Typography, { variant: "h6", children: "File Preview" }), jsxs(Box, { display: "flex", gap: 1, children: [jsx(IconButton, { onClick: () => handleDeleteFile(currentFileIndex), color: "error", title: "Delete current file", children: jsx(DeleteIcon, {}) }), jsx(IconButton, { onClick: handleClose, children: jsx(CloseIcon, {}) })] })] }), jsx(Box, { mt: 2, children: selectedFiles.length > 0 && (jsxs(Fragment, { children: [jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", gap: 2, children: [jsx(IconButton, { onClick: handlePrevious, disabled: selectedFiles.length <= 1, children: jsx(NavigateBeforeIcon, {}) }), jsx(Box, { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", sx: { p: 2, minHeight: '400px', width: '100%' }, children: (() => {
|
|
162
|
+
const currentFile = selectedFiles[currentFileIndex];
|
|
163
|
+
if (currentFile instanceof File) {
|
|
164
|
+
if (isImageFile(currentFile)) {
|
|
165
|
+
return (jsx("img", { alt: "Preview", src: URL.createObjectURL(currentFile), style: {
|
|
166
|
+
maxHeight: '400px',
|
|
167
|
+
maxWidth: '100%',
|
|
168
|
+
objectFit: 'contain',
|
|
169
|
+
borderRadius: 8,
|
|
170
|
+
} }));
|
|
171
|
+
}
|
|
172
|
+
return (jsx(Typography, { variant: "body1", children: currentFile.name }));
|
|
173
|
+
}
|
|
174
|
+
else if (typeof currentFile === 'string') {
|
|
175
|
+
const isImg = isImageFile(currentFile);
|
|
176
|
+
return isImg ? (jsx("img", { alt: "Preview", src: currentFile, style: {
|
|
177
|
+
maxHeight: '400px',
|
|
178
|
+
maxWidth: '100%',
|
|
179
|
+
objectFit: 'contain',
|
|
180
|
+
borderRadius: 8,
|
|
181
|
+
} })) : (jsx(Typography, { variant: "body1", children: currentFile.split('/').pop() }));
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
})() }), jsx(IconButton, { onClick: handleNext, disabled: selectedFiles.length <= 1, children: jsx(NavigateNextIcon, {}) })] }), selectedFiles.length > 1 && (jsx(Box, { display: "flex", justifyContent: "center", mt: 2, children: jsxs(Typography, { variant: "body2", color: "text.secondary", children: [currentFileIndex + 1, " of ", selectedFiles.length] }) }))] })) })] }) })] }));
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export { MultiFileWithPreview as default };
|
|
@@ -16,7 +16,10 @@ const FormBottomField = (props) => {
|
|
|
16
16
|
/**
|
|
17
17
|
* Renders helper text and error messages in a consistent layout
|
|
18
18
|
*/
|
|
19
|
-
return (jsxs(Fragment, { children: [jsx(HelperText, { ...props }),
|
|
19
|
+
return (jsxs(Fragment, { children: [jsx(HelperText, { ...props }), props?.item?.selectedFileName && (jsxs("span", { id: `${props.item.name}-selectedFileName`, className: "selectedText-v1", style: {
|
|
20
|
+
fontSize: '11px',
|
|
21
|
+
color: '#3651d3',
|
|
22
|
+
}, children: ["Selected File:", jsx("span", { className: "selectedFileName-v1", children: props?.item?.selectedFileName })] })), jsx(FormErrorField, { ...props })] }));
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
export { FormBottomField as default };
|
|
@@ -71,6 +71,9 @@ const FormNumberField = ({ props, variant }) => {
|
|
|
71
71
|
field.onChange(nextValue);
|
|
72
72
|
props?.item?.onChangeFn && props?.item?.onChangeFn(nextValue);
|
|
73
73
|
props?.clearErrors && props?.clearErrors(props.item.name);
|
|
74
|
+
if (nextValue && props.item.maxValue && parseInt(nextValue) > props.item.maxValue) {
|
|
75
|
+
field.onChange(props.item.maxValue);
|
|
76
|
+
}
|
|
74
77
|
},
|
|
75
78
|
/**
|
|
76
79
|
* Handles blur events
|
|
@@ -92,6 +95,7 @@ const FormNumberField = ({ props, variant }) => {
|
|
|
92
95
|
inputProps: {
|
|
93
96
|
pattern: '[0-9]*',
|
|
94
97
|
maxLength: props.item.maxLength || 20,
|
|
98
|
+
maxValue: props.item.maxValue || 9999999999,
|
|
95
99
|
'aria-labelledby': `${props.item.name}-label`,
|
|
96
100
|
'aria-describedby': `${props.item.name}-helper ${props.item.name}-error`,
|
|
97
101
|
'aria-required': props.item.required ? true : undefined,
|
|
@@ -88,7 +88,7 @@ const FormTextField = ({ props, variant }) => {
|
|
|
88
88
|
* Renders the text field component using react-hook-form's Controller
|
|
89
89
|
* for controlled form state management
|
|
90
90
|
*/
|
|
91
|
-
return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field, fieldState }) => (jsxs(Fragment, { children: [renderLabel(variant, props), jsx(FormTextFieldComponent, { ...field, fullWidth: true, error: !!fieldState.error, label: label, placeholder: props.item.placeholder || '', autoComplete: "off", sx: {
|
|
91
|
+
return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field, fieldState }) => (jsxs(Fragment, { children: [renderLabel(variant, props), jsx(FormTextFieldComponent, { ...field, fullWidth: true, autoFocus: props.item.autoFocus, error: !!fieldState.error, label: label, placeholder: props.item.placeholder || '', autoComplete: "off", sx: {
|
|
92
92
|
...props.item.sx,
|
|
93
93
|
}, value: field.value || '', size: "small", disabled: props.item.disable, onBlur: (e) => {
|
|
94
94
|
// Call custom onBlur handler if provided
|
|
@@ -14,7 +14,7 @@ const HelperText = (props) => {
|
|
|
14
14
|
* Conditionally renders helper text if it exists in the form item props
|
|
15
15
|
* Returns an empty fragment if no helper text is provided
|
|
16
16
|
*/
|
|
17
|
-
return props?.item?.helperText ? (jsx("span", { id: `${props.item.name}-helper`, style: {
|
|
17
|
+
return props?.item?.helperText ? (jsx("span", { id: `${props.item.name}-helper`, className: "helperText-v1", style: {
|
|
18
18
|
fontSize: '11px',
|
|
19
19
|
color: '#3651d3',
|
|
20
20
|
}, children: props?.item?.helperText })) : (jsx(Fragment, {}));
|
|
@@ -9,17 +9,29 @@ import { renderLabel } from '../../../utils/Constants/FormConstants.esm.js';
|
|
|
9
9
|
const MultiSelectAutocomplete = ({ props, variant, }) => {
|
|
10
10
|
const isError = !!props.errors?.[props.item.name];
|
|
11
11
|
const watchedValue = useWatch({ control: props.control, name: props.item.name });
|
|
12
|
-
const
|
|
12
|
+
const normalizeToStringArray = (value) => {
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
return value.map((v) => String(v));
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
return value
|
|
18
|
+
.split(',')
|
|
19
|
+
.map((v) => v.trim())
|
|
20
|
+
.filter((v) => v.length > 0);
|
|
21
|
+
}
|
|
22
|
+
if (value == null)
|
|
23
|
+
return [];
|
|
24
|
+
return [String(value)];
|
|
25
|
+
};
|
|
26
|
+
const normalizedSelectedValues = normalizeToStringArray(watchedValue);
|
|
27
|
+
const isShowBorderError = isError && normalizedSelectedValues.length === 0;
|
|
13
28
|
const options = (props.item.options || []);
|
|
14
29
|
const selectedOptions = useMemo(() => {
|
|
15
|
-
|
|
16
|
-
return [];
|
|
17
|
-
const values = typeof watchedValue === 'string' ? watchedValue.split(',') : [];
|
|
18
|
-
const valueSet = new Set(values);
|
|
30
|
+
const valueSet = new Set(normalizedSelectedValues.map((v) => String(v)));
|
|
19
31
|
return options.filter((opt) => valueSet.has(String(opt.value)));
|
|
20
|
-
}, [
|
|
21
|
-
return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxs(Fragment, { children: [renderLabel(variant, props), jsx(Autocomplete, { ...field, multiple: true, disableCloseOnSelect: true, id: `${props.item.name}-autocomplete-multi`, options: options, value: selectedOptions, getOptionLabel: (option) => String(option.label), isOptionEqualToValue: (option, value) => option.value === value.value, onChange: (_, newValue) => {
|
|
22
|
-
const joined = (newValue || []).map((o) => o.value).join(',');
|
|
32
|
+
}, [normalizedSelectedValues, options]);
|
|
33
|
+
return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxs(Fragment, { children: [renderLabel(variant, props), jsx(Autocomplete, { ...field, multiple: true, disableCloseOnSelect: true, id: `${props.item.name}-autocomplete-multi`, options: options, value: selectedOptions, getOptionLabel: (option) => String(option.label), isOptionEqualToValue: (option, value) => String(option.value) === String(value.value), onChange: (_, newValue) => {
|
|
34
|
+
const joined = (newValue || []).map((o) => String(o.value)).join(',');
|
|
23
35
|
props.setValue(props.item.name, joined);
|
|
24
36
|
props?.item?.onChangeFn && props?.item?.onChangeFn(joined);
|
|
25
37
|
props?.clearErrors && props?.clearErrors(props?.item?.name);
|
|
@@ -17,7 +17,7 @@ const SingleSelectNonAutoComplete = ({ props, variant, }) => {
|
|
|
17
17
|
'& .MuiInputLabel-shrink': {
|
|
18
18
|
top: 0,
|
|
19
19
|
},
|
|
20
|
-
}, children: [renderLabel(variant, props), variant !== 'standard' && (jsx(InputLabel, { error: isShowBorderError, id: `${props.item.name}-labelId`, children: props.item.label })), jsx(Select, { labelId: `${props.item.name}-labelId`, id: `${props.item.name}-select`, value: value, label: variant !== 'standard' ? `${props.item.label}${props.item.required ? ' *' : ''}` : '', onChange: (e) => props.setValue(props.item.name, e.target.value), onBlur: (e) => {
|
|
20
|
+
}, disabled: props.item.disable, children: [renderLabel(variant, props), variant !== 'standard' && (jsx(InputLabel, { error: isShowBorderError, id: `${props.item.name}-labelId`, children: props.item.label })), jsx(Select, { labelId: `${props.item.name}-labelId`, id: `${props.item.name}-select`, value: value, label: variant !== 'standard' ? `${props.item.label}${props.item.required ? ' *' : ''}` : '', disabled: props.item.disable, onChange: (e) => props.setValue(props.item.name, e.target.value), onBlur: (e) => {
|
|
21
21
|
props?.item?.onBlurFn && props?.item?.onBlurFn(e);
|
|
22
22
|
}, error: isShowBorderError, inputProps: {
|
|
23
23
|
'aria-labelledby': `${props.item.name}-label`,
|
|
@@ -17,8 +17,19 @@ export { default as YearPickerField } from './YearPickerField/YearPickerField.es
|
|
|
17
17
|
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
18
18
|
export { default as FormRenderFileUpload } from './FileUpload/FormRenderFileUpload.esm.js';
|
|
19
19
|
export { default as FormRenderMultiFileUpload } from './FileUpload/FormRenderMultiFileUpload.esm.js';
|
|
20
|
+
import 'react/jsx-runtime';
|
|
21
|
+
import '@mui/material';
|
|
22
|
+
import 'react';
|
|
23
|
+
import 'react-hook-form';
|
|
24
|
+
import 'dayjs';
|
|
25
|
+
export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
|
|
26
|
+
import '@mui/icons-material/Visibility';
|
|
27
|
+
import '@mui/icons-material/Close';
|
|
28
|
+
import '@mui/icons-material/NavigateBefore';
|
|
29
|
+
import '@mui/icons-material/NavigateNext';
|
|
30
|
+
import '@mui/icons-material/Delete';
|
|
31
|
+
import '@mui/icons-material/UploadFile';
|
|
20
32
|
export { default as RichTextEditor } from './RichTextEditor/RichTextEditor.esm.js';
|
|
21
33
|
export { default as RichTextEditorWrapper } from './RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
22
|
-
export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
|
|
23
34
|
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
24
35
|
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
import { styled } from '@mui/material/styles';
|
|
2
2
|
import { Button, Typography, Grid, Dialog, DialogTitle } from '@mui/material';
|
|
3
3
|
|
|
4
|
-
styled(Button) `
|
|
5
|
-
border: 0;
|
|
6
|
-
color: #fff;
|
|
7
|
-
position: absolute;
|
|
8
|
-
text-align: center;
|
|
9
|
-
padding: 5px 12px;
|
|
10
|
-
font-size: 13px;
|
|
11
|
-
height: 30px;
|
|
12
|
-
right: -38px;
|
|
13
|
-
text-transform: none;
|
|
14
|
-
z-index: 2;
|
|
15
|
-
border-radius: 10px 0px 0px 10px;
|
|
16
|
-
&:hover {
|
|
17
|
-
right: 0px;
|
|
18
|
-
}
|
|
4
|
+
styled(Button) `
|
|
5
|
+
border: 0;
|
|
6
|
+
color: #fff;
|
|
7
|
+
position: absolute;
|
|
8
|
+
text-align: center;
|
|
9
|
+
padding: 5px 12px;
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
height: 30px;
|
|
12
|
+
right: -38px;
|
|
13
|
+
text-transform: none;
|
|
14
|
+
z-index: 2;
|
|
15
|
+
border-radius: 10px 0px 0px 10px;
|
|
16
|
+
&:hover {
|
|
17
|
+
right: 0px;
|
|
18
|
+
}
|
|
19
19
|
`;
|
|
20
|
-
const SubmitButton = styled(Button) `
|
|
21
|
-
text-transform: none;
|
|
20
|
+
const SubmitButton = styled(Button) `
|
|
21
|
+
text-transform: none;
|
|
22
22
|
`;
|
|
23
|
-
const CancelButton = styled(Button) `
|
|
24
|
-
text-transform: none;
|
|
25
|
-
color: #000;
|
|
26
|
-
background: #ececee;
|
|
27
|
-
&:hover {
|
|
28
|
-
background: #0009;
|
|
29
|
-
color: #fff;
|
|
30
|
-
}
|
|
23
|
+
const CancelButton = styled(Button) `
|
|
24
|
+
text-transform: none;
|
|
25
|
+
color: #000;
|
|
26
|
+
background: #ececee;
|
|
27
|
+
&:hover {
|
|
28
|
+
background: #0009;
|
|
29
|
+
color: #fff;
|
|
30
|
+
}
|
|
31
31
|
`;
|
|
32
|
-
const SaveAsDraftButton = styled(Button) `
|
|
33
|
-
text-transform: none;
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
background: orange;
|
|
36
|
-
&:hover {
|
|
37
|
-
background: orange;
|
|
38
|
-
}
|
|
32
|
+
const SaveAsDraftButton = styled(Button) `
|
|
33
|
+
text-transform: none;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
background: orange;
|
|
36
|
+
&:hover {
|
|
37
|
+
background: orange;
|
|
38
|
+
}
|
|
39
39
|
`;
|
|
40
40
|
styled(Typography) ``;
|
|
41
41
|
styled(Grid, {
|
|
42
42
|
shouldForwardProp: (prop) => prop !== 'isActive' && prop !== 'noOfColumn',
|
|
43
|
-
}) `
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
margin-bottom: 8px;
|
|
46
|
-
min-width: 10%;
|
|
47
|
-
padding-left: 0px;
|
|
48
|
-
z-index: 2;
|
|
49
|
-
padding-right: 0px;
|
|
50
|
-
border: 1px solid #0003;
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
padding: 6px;
|
|
53
|
-
text-align: center;
|
|
54
|
-
&:hover {
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
}
|
|
43
|
+
}) `
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
margin-bottom: 8px;
|
|
46
|
+
min-width: 10%;
|
|
47
|
+
padding-left: 0px;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
padding-right: 0px;
|
|
50
|
+
border: 1px solid #0003;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
padding: 6px;
|
|
53
|
+
text-align: center;
|
|
54
|
+
&:hover {
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
57
|
`;
|
|
58
|
-
const DialogContainer = styled(Dialog) `
|
|
59
|
-
position: fixed;
|
|
60
|
-
top: -16px;
|
|
61
|
-
left: 0;
|
|
62
|
-
right: 0;
|
|
63
|
-
bottom: auto;
|
|
64
|
-
& .css-tlc64q-MuiPaper-root-MuiDialog-paper,
|
|
65
|
-
.css-mbdu2s {
|
|
66
|
-
max-width: 900px;
|
|
67
|
-
}
|
|
58
|
+
const DialogContainer = styled(Dialog) `
|
|
59
|
+
position: fixed;
|
|
60
|
+
top: -16px;
|
|
61
|
+
left: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
bottom: auto;
|
|
64
|
+
& .css-tlc64q-MuiPaper-root-MuiDialog-paper,
|
|
65
|
+
.css-mbdu2s {
|
|
66
|
+
max-width: 900px;
|
|
67
|
+
}
|
|
68
68
|
`;
|
|
69
|
-
const DialogTitleWrapper = styled(DialogTitle) `
|
|
70
|
-
padding: 8px 16px;
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: space-between;
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
cursor: move;
|
|
76
|
-
border-bottom: 1px solid rgb(229 231 235 / 1);
|
|
69
|
+
const DialogTitleWrapper = styled(DialogTitle) `
|
|
70
|
+
padding: 8px 16px;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
cursor: move;
|
|
76
|
+
border-bottom: 1px solid rgb(229 231 235 / 1);
|
|
77
77
|
`;
|
|
78
78
|
|
|
79
79
|
export { CancelButton, DialogContainer, DialogTitleWrapper, SaveAsDraftButton, SubmitButton };
|
|
@@ -10,7 +10,7 @@ export interface TextFieldInputProps {
|
|
|
10
10
|
export interface FormSectionPropsItem {
|
|
11
11
|
name: string;
|
|
12
12
|
label: string;
|
|
13
|
-
inputType: 'text' | 'password' | 'number' | 'select' | 'autocomplete-select' | 'autocomplete-multi-select' | 'datepicker' | 'multiselect' | 'select-v2' | 'basic-select' | 'decimal' | 'alpha-numerical' | 'yearpicker' | 'dateRangePicker' | 'monthpicker' | 'multiselect' | 'file' | 'multifile' | 'textarea' | 'phoneNumber' | 'pincode' | 'email' | 'toggleSwitch' | 'rich-text-editor' | 'multiEmail' | 'timepicker' | 'checkbox-group' | 'radio-group' | 'checkbox' | 'custom' | '';
|
|
13
|
+
inputType: 'text' | 'password' | 'number' | 'select' | 'autocomplete-select' | 'autocomplete-multi-select' | 'datepicker' | 'multiselect' | 'select-v2' | 'basic-select' | 'decimal' | 'alpha-numerical' | 'yearpicker' | 'dateRangePicker' | 'monthpicker' | 'multiselect' | 'file' | 'multifile' | 'multifile-with-preview' | 'textarea' | 'phoneNumber' | 'pincode' | 'email' | 'toggleSwitch' | 'rich-text-editor' | 'multiEmail' | 'timepicker' | 'checkbox-group' | 'radio-group' | 'checkbox' | 'custom' | '';
|
|
14
14
|
options?: OptionsProps[];
|
|
15
15
|
required?: boolean;
|
|
16
16
|
errorMessage?: string;
|
|
@@ -18,7 +18,11 @@ export interface FormSectionPropsItem {
|
|
|
18
18
|
disable?: boolean;
|
|
19
19
|
onChangeFn?: (e: string | number | undefined | null | boolean) => void;
|
|
20
20
|
onBlurFn?: (e: string | number | undefined | null | boolean) => void;
|
|
21
|
+
onChangeSetFileFn?: (e: File | File[]) => void;
|
|
22
|
+
showFileCarousel?: boolean;
|
|
21
23
|
maxLength?: number;
|
|
24
|
+
autoFocus?: boolean;
|
|
25
|
+
maxValue?: number;
|
|
22
26
|
minDate?: string;
|
|
23
27
|
maxDate?: string;
|
|
24
28
|
placeholder?: string;
|
|
@@ -37,11 +41,12 @@ export interface FormSectionPropsItem {
|
|
|
37
41
|
sx?: SxProps<Theme>;
|
|
38
42
|
donotAllowSpace?: boolean;
|
|
39
43
|
onInputProps?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
40
|
-
fileType?: 'excel' | 'pdf' | 'all' | 'zip' | 'image' | '';
|
|
44
|
+
fileType?: 'excel' | 'pdf' | 'all' | 'zip' | 'image' | 'document' | '';
|
|
41
45
|
handleFileError?: (message: string) => void;
|
|
42
46
|
onCloseMenu?: () => void;
|
|
43
47
|
doNotAllowPaste?: boolean;
|
|
44
48
|
removeButtons?: string;
|
|
49
|
+
selectedFileName?: string;
|
|
45
50
|
Fonts?: number[];
|
|
46
51
|
FontFamily?: any;
|
|
47
52
|
value1?: string | number | boolean;
|