dhanasekar-ui 1.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 +13 -0
- package/dist/chunk-3C5H757K.js +2 -0
- package/dist/chunk-3C5H757K.js.map +1 -0
- package/dist/chunk-547MQ4FI.mjs +2 -0
- package/dist/chunk-547MQ4FI.mjs.map +1 -0
- package/dist/chunk-6CTAGKRH.js +2 -0
- package/dist/chunk-6CTAGKRH.js.map +1 -0
- package/dist/chunk-6HZRTYPC.mjs +2 -0
- package/dist/chunk-6HZRTYPC.mjs.map +1 -0
- package/dist/chunk-6S5MGYMQ.mjs +2 -0
- package/dist/chunk-6S5MGYMQ.mjs.map +1 -0
- package/dist/chunk-ATGFNC6B.mjs +2 -0
- package/dist/chunk-ATGFNC6B.mjs.map +1 -0
- package/dist/chunk-B3QF3KQL.js +2 -0
- package/dist/chunk-B3QF3KQL.js.map +1 -0
- package/dist/chunk-CBHX2QZA.mjs +2 -0
- package/dist/chunk-CBHX2QZA.mjs.map +1 -0
- package/dist/chunk-DDGBDWFC.js +2 -0
- package/dist/chunk-DDGBDWFC.js.map +1 -0
- package/dist/chunk-DVU5JMBP.js +2 -0
- package/dist/chunk-DVU5JMBP.js.map +1 -0
- package/dist/chunk-HGGQDBDD.js +2 -0
- package/dist/chunk-HGGQDBDD.js.map +1 -0
- package/dist/chunk-HNKQZLUA.mjs +2 -0
- package/dist/chunk-HNKQZLUA.mjs.map +1 -0
- package/dist/chunk-HVFBE6G7.js +2 -0
- package/dist/chunk-HVFBE6G7.js.map +1 -0
- package/dist/chunk-IBYEAKM2.mjs +2 -0
- package/dist/chunk-IBYEAKM2.mjs.map +1 -0
- package/dist/chunk-KB5KRUMU.mjs +2 -0
- package/dist/chunk-KB5KRUMU.mjs.map +1 -0
- package/dist/chunk-KEJ7FTQQ.js +48 -0
- package/dist/chunk-KEJ7FTQQ.js.map +1 -0
- package/dist/chunk-MYC7PW6C.js +2 -0
- package/dist/chunk-MYC7PW6C.js.map +1 -0
- package/dist/chunk-OTDTXBFF.mjs +2 -0
- package/dist/chunk-OTDTXBFF.mjs.map +1 -0
- package/dist/chunk-OWY3CS2U.mjs +48 -0
- package/dist/chunk-OWY3CS2U.mjs.map +1 -0
- package/dist/chunk-RRZTNQ5T.mjs +2 -0
- package/dist/chunk-RRZTNQ5T.mjs.map +1 -0
- package/dist/chunk-S4VNQWZ7.js +2 -0
- package/dist/chunk-S4VNQWZ7.js.map +1 -0
- package/dist/chunk-VIUZPAJZ.js +2 -0
- package/dist/chunk-VIUZPAJZ.js.map +1 -0
- package/dist/chunk-WGPJEQGU.mjs +2 -0
- package/dist/chunk-WGPJEQGU.mjs.map +1 -0
- package/dist/chunk-X7EUJD7E.js +2 -0
- package/dist/chunk-X7EUJD7E.js.map +1 -0
- package/dist/components/Avatar/index.d.mts +12 -0
- package/dist/components/Avatar/index.d.ts +12 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/index.js.map +1 -0
- package/dist/components/Avatar/index.mjs +2 -0
- package/dist/components/Avatar/index.mjs.map +1 -0
- package/dist/components/Badge/index.d.mts +12 -0
- package/dist/components/Badge/index.d.ts +12 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Badge/index.mjs +2 -0
- package/dist/components/Badge/index.mjs.map +1 -0
- package/dist/components/Button/index.d.mts +12 -0
- package/dist/components/Button/index.d.ts +12 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/index.mjs +2 -0
- package/dist/components/Button/index.mjs.map +1 -0
- package/dist/components/Card/index.d.mts +12 -0
- package/dist/components/Card/index.d.ts +12 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/Card/index.js.map +1 -0
- package/dist/components/Card/index.mjs +2 -0
- package/dist/components/Card/index.mjs.map +1 -0
- package/dist/components/Checkbox/index.d.mts +12 -0
- package/dist/components/Checkbox/index.d.ts +12 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Checkbox/index.mjs +2 -0
- package/dist/components/Checkbox/index.mjs.map +1 -0
- package/dist/components/FileUploadField/index.d.mts +56 -0
- package/dist/components/FileUploadField/index.d.ts +56 -0
- package/dist/components/FileUploadField/index.js +2 -0
- package/dist/components/FileUploadField/index.js.map +1 -0
- package/dist/components/FileUploadField/index.mjs +2 -0
- package/dist/components/FileUploadField/index.mjs.map +1 -0
- package/dist/components/IdleTimer/index.d.mts +49 -0
- package/dist/components/IdleTimer/index.d.ts +49 -0
- package/dist/components/IdleTimer/index.js +2 -0
- package/dist/components/IdleTimer/index.js.map +1 -0
- package/dist/components/IdleTimer/index.mjs +2 -0
- package/dist/components/IdleTimer/index.mjs.map +1 -0
- package/dist/components/Input/index.d.mts +12 -0
- package/dist/components/Input/index.d.ts +12 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/index.js.map +1 -0
- package/dist/components/Input/index.mjs +2 -0
- package/dist/components/Input/index.mjs.map +1 -0
- package/dist/components/Loader/index.d.mts +43 -0
- package/dist/components/Loader/index.d.ts +43 -0
- package/dist/components/Loader/index.js +2 -0
- package/dist/components/Loader/index.js.map +1 -0
- package/dist/components/Loader/index.mjs +2 -0
- package/dist/components/Loader/index.mjs.map +1 -0
- package/dist/components/Modal/index.d.mts +12 -0
- package/dist/components/Modal/index.d.ts +12 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/index.mjs +2 -0
- package/dist/components/Modal/index.mjs.map +1 -0
- package/dist/components/Switch/index.d.mts +12 -0
- package/dist/components/Switch/index.d.ts +12 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Switch/index.mjs +2 -0
- package/dist/components/Switch/index.mjs.map +1 -0
- package/dist/components/Tooltip/index.d.mts +12 -0
- package/dist/components/Tooltip/index.d.ts +12 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tooltip/index.mjs +2 -0
- package/dist/components/Tooltip/index.mjs.map +1 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CheckboxBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type CheckboxProps<T extends ElementType = 'div'> = CheckboxBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof CheckboxBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Checkbox, type CheckboxBaseProps, type CheckboxProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CheckboxBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type CheckboxProps<T extends ElementType = 'div'> = CheckboxBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof CheckboxBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Checkbox, type CheckboxBaseProps, type CheckboxProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
type FileUploadType = 'image' | 'file';
|
|
5
|
+
interface FileUploadFieldBaseProps {
|
|
6
|
+
/** Label for the field */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Marks the field as required (adds * to label) */
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** Error message to display below the field */
|
|
11
|
+
error?: string;
|
|
12
|
+
/** Accepted file extensions/mimes e.g. ".pdf,.doc,.docx" or "image/*" */
|
|
13
|
+
accept?: string;
|
|
14
|
+
/** Max file size in MB. Defaults to 10MB */
|
|
15
|
+
maxSizeMB?: number;
|
|
16
|
+
/** Disables the entire field */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Whether the field is in edit mode (allows upload/delete). Defaults to true if not disabled */
|
|
19
|
+
editMode?: boolean;
|
|
20
|
+
/** Whether the field is in view-only mode (hides upload area and delete buttons) */
|
|
21
|
+
viewMode?: boolean;
|
|
22
|
+
/** Object URL or base64 for local preview (single file) */
|
|
23
|
+
previewUrl?: string;
|
|
24
|
+
/** Array of object URLs or base64 for local previews (multiple files) */
|
|
25
|
+
previewUrls?: string[];
|
|
26
|
+
/** Existing file URL(s) for edit mode */
|
|
27
|
+
existingFileUrl?: string | string[];
|
|
28
|
+
/** Existing file name(s) for display */
|
|
29
|
+
existingFileName?: string | string[];
|
|
30
|
+
/** MUI SxProps for styling the root element */
|
|
31
|
+
sx?: SxProps<Theme>;
|
|
32
|
+
/** Whether to allow multiple file selection */
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/** Callback called when user removes a file. Index provided if multiple */
|
|
35
|
+
onDelete?: (index?: number) => void;
|
|
36
|
+
}
|
|
37
|
+
interface FileSingleProps extends FileUploadFieldBaseProps {
|
|
38
|
+
uploadType: FileUploadType;
|
|
39
|
+
multiple?: false;
|
|
40
|
+
value?: File | null;
|
|
41
|
+
onChange?: (file: File | null) => void;
|
|
42
|
+
}
|
|
43
|
+
interface FileMultipleProps extends FileUploadFieldBaseProps {
|
|
44
|
+
uploadType: FileUploadType;
|
|
45
|
+
multiple: true;
|
|
46
|
+
value?: File[] | null;
|
|
47
|
+
onChange?: (files: File[] | null) => void;
|
|
48
|
+
}
|
|
49
|
+
type FileUploadFieldProps = FileSingleProps | FileMultipleProps;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* FileUploadField component for single or multiple file uploads with preview support.
|
|
53
|
+
*/
|
|
54
|
+
declare const FileUploadField: react__default.ForwardRefExoticComponent<FileUploadFieldProps & react__default.RefAttributes<HTMLInputElement>>;
|
|
55
|
+
|
|
56
|
+
export { type FileMultipleProps, type FileSingleProps, FileUploadField, type FileUploadFieldBaseProps, type FileUploadFieldProps, type FileUploadType };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
type FileUploadType = 'image' | 'file';
|
|
5
|
+
interface FileUploadFieldBaseProps {
|
|
6
|
+
/** Label for the field */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Marks the field as required (adds * to label) */
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** Error message to display below the field */
|
|
11
|
+
error?: string;
|
|
12
|
+
/** Accepted file extensions/mimes e.g. ".pdf,.doc,.docx" or "image/*" */
|
|
13
|
+
accept?: string;
|
|
14
|
+
/** Max file size in MB. Defaults to 10MB */
|
|
15
|
+
maxSizeMB?: number;
|
|
16
|
+
/** Disables the entire field */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Whether the field is in edit mode (allows upload/delete). Defaults to true if not disabled */
|
|
19
|
+
editMode?: boolean;
|
|
20
|
+
/** Whether the field is in view-only mode (hides upload area and delete buttons) */
|
|
21
|
+
viewMode?: boolean;
|
|
22
|
+
/** Object URL or base64 for local preview (single file) */
|
|
23
|
+
previewUrl?: string;
|
|
24
|
+
/** Array of object URLs or base64 for local previews (multiple files) */
|
|
25
|
+
previewUrls?: string[];
|
|
26
|
+
/** Existing file URL(s) for edit mode */
|
|
27
|
+
existingFileUrl?: string | string[];
|
|
28
|
+
/** Existing file name(s) for display */
|
|
29
|
+
existingFileName?: string | string[];
|
|
30
|
+
/** MUI SxProps for styling the root element */
|
|
31
|
+
sx?: SxProps<Theme>;
|
|
32
|
+
/** Whether to allow multiple file selection */
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/** Callback called when user removes a file. Index provided if multiple */
|
|
35
|
+
onDelete?: (index?: number) => void;
|
|
36
|
+
}
|
|
37
|
+
interface FileSingleProps extends FileUploadFieldBaseProps {
|
|
38
|
+
uploadType: FileUploadType;
|
|
39
|
+
multiple?: false;
|
|
40
|
+
value?: File | null;
|
|
41
|
+
onChange?: (file: File | null) => void;
|
|
42
|
+
}
|
|
43
|
+
interface FileMultipleProps extends FileUploadFieldBaseProps {
|
|
44
|
+
uploadType: FileUploadType;
|
|
45
|
+
multiple: true;
|
|
46
|
+
value?: File[] | null;
|
|
47
|
+
onChange?: (files: File[] | null) => void;
|
|
48
|
+
}
|
|
49
|
+
type FileUploadFieldProps = FileSingleProps | FileMultipleProps;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* FileUploadField component for single or multiple file uploads with preview support.
|
|
53
|
+
*/
|
|
54
|
+
declare const FileUploadField: react__default.ForwardRefExoticComponent<FileUploadFieldProps & react__default.RefAttributes<HTMLInputElement>>;
|
|
55
|
+
|
|
56
|
+
export { type FileMultipleProps, type FileSingleProps, FileUploadField, type FileUploadFieldBaseProps, type FileUploadFieldProps, type FileUploadType };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),material=require('@mui/material'),iconsMaterial=require('@mui/icons-material'),reactToastify=require('react-toastify'),jsxRuntime=require('react/jsx-runtime');var oe=material.styled("input")({display:"none"}),ie=material.styled(material.Paper,{shouldForwardProp:o=>o!=="isError"})(({theme:o,isError:m})=>({border:`2px dashed ${m?o.palette.error.main:"#90caf9"}`,textAlign:"center",padding:o.spacing(4),cursor:"pointer",borderRadius:o.spacing(1.5),transition:"border-color 0.2s ease-in-out, background-color 0.2s ease-in-out","&:hover":{borderColor:m?o.palette.error.dark:"#42a5f5",backgroundColor:"rgba(144, 202, 249, 0.04)"}})),ne=material.styled(material.Paper)(({theme:o})=>({padding:o.spacing(2),borderRadius:o.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:o.spacing(1)})),se=material.styled("img")({height:"40px",width:"40px",objectFit:"cover",borderRadius:"4px"}),ae=react.forwardRef((o,m)=>{let{label:P,required:z,error:u,accept:A=".pdf,.doc,.docx",maxSizeMB:L=10,disabled:d,uploadType:B,multiple:y,value:a,onChange:b,onDelete:T,previewUrl:W,previewUrls:S,existingFileUrl:v,existingFileName:U,editMode:M=true,viewMode:D=false,sx:O}=o,g=Array.isArray(v)?v:v?[v]:[],$=Array.isArray(a)?a:a?[a]:[],I=[...g,...$],h=d||D||!M,k=react.useRef(null);react.useImperativeHandle(m,()=>k.current);let[l,F]=react.useState([]);react.useEffect(()=>()=>{l.forEach(e=>{e.startsWith("blob:")&&URL.revokeObjectURL(e);});},[l]);let H=e=>{if(h)return;let i=e.target.files;if(!i||i.length===0)return;let c=Array.from(i),r=[],n=[];for(let s of c){if(s.size>L*1024*1024){reactToastify.toast.error(`File "${s.name}" exceeds the maximum size of ${L}MB`);continue}r.push(s),n.push(URL.createObjectURL(s));}if(r.length===0){e.target.value="";return}if(y){F(w=>[...w,...n]);let x=[...Array.isArray(a)?a:[],...r];b?.(x);}else l[0]?.startsWith("blob:")&&URL.revokeObjectURL(l[0]),F(n),b?.(r[0]);e.target.value="";},N=e=>{if(h)return;if(e<g.length){T?.(e);return}let c=e-g.length;if(y){let r=Array.isArray(a)?[...a]:[];r.splice(c,1),b?.(r.length>0?r:null);let n=[...l];n[c]?.startsWith("blob:")&&URL.revokeObjectURL(n[c]),n.splice(c,1),F(n);}else b?.(null),l[0]?.startsWith("blob:")&&URL.revokeObjectURL(l[0]),F([]);T?.(e);},V=(e,i)=>{i<g.length;let r=typeof e=="string"?(Array.isArray(U)?U[i]:U)||"Uploaded Document":e.name,n=i-g.length,s=typeof e=="string"?e:l[n]||(Array.isArray(S)?S[n]:W),x=r.toLowerCase().endsWith(".pdf")||typeof e!="string"&&e.type==="application/pdf",w=B==="image"||r.toLowerCase().match(/\.(jpg|jpeg|png|gif|webp)$/i);return jsxRuntime.jsxs(ne,{elevation:1,children:[jsxRuntime.jsxs(material.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[w&&s?jsxRuntime.jsx(se,{src:s,alt:r}):x?jsxRuntime.jsx(iconsMaterial.PictureAsPdf,{color:"error"}):jsxRuntime.jsx(iconsMaterial.InsertDriveFile,{color:"primary"}),jsxRuntime.jsx(material.Typography,{variant:"body2",noWrap:true,sx:{maxWidth:200},children:r})]}),jsxRuntime.jsxs(material.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(x||w)&&s&&jsxRuntime.jsx(material.IconButton,{color:"primary",size:"small",onClick:()=>window.open(s,"_blank"),title:"View",children:jsxRuntime.jsx(iconsMaterial.Visibility,{fontSize:"small"})}),!h&&jsxRuntime.jsx(material.IconButton,{color:"error",size:"small",onClick:()=>N(i),title:"Remove",children:jsxRuntime.jsx(iconsMaterial.Close,{fontSize:"small"})})]})]},`${r}-${i}`)};return jsxRuntime.jsxs(material.Box,{sx:O,children:[P&&jsxRuntime.jsxs(material.Typography,{variant:"caption",sx:{color:u?"error.main":"text.secondary",fontWeight:500,display:"block"},gutterBottom:true,children:[P," ",z&&"*"]}),(!I.length||y)&&!h&&jsxRuntime.jsxs(ie,{variant:"outlined",isError:!!u,onClick:()=>!d&&k.current?.click(),sx:{cursor:d?"not-allowed":"pointer",opacity:d?.7:1},children:[jsxRuntime.jsx(iconsMaterial.CloudUpload,{sx:{fontSize:40,color:u?"error.main":"#42a5f5",mb:1}}),jsxRuntime.jsx(material.Typography,{variant:"body1",color:"textSecondary",children:d?"Upload disabled":"Click to upload"}),jsxRuntime.jsxs(material.Typography,{variant:"caption",color:"textSecondary",children:["(Supported formats: ",A.replace(/\./g,"").toUpperCase(),")"]}),jsxRuntime.jsx(oe,{type:"file",ref:k,onChange:H,accept:A,disabled:d,multiple:y})]}),jsxRuntime.jsx(material.Stack,{spacing:1,sx:{mt:I.length?1:0},children:I.map((e,i)=>V(e,i))}),u&&jsxRuntime.jsx(material.Typography,{variant:"caption",color:"error",sx:{mt:.5,display:"block"},children:u})]})});ae.displayName="FileUploadField";exports.FileUploadField=ae;//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FileUploadField/FileUploadField.tsx"],"names":["HiddenInput","styled","DropZonePaper","Paper","prop","theme","isError","PreviewPaper","Thumbnail","FileUploadField","forwardRef","props","ref","label","required","error","accept","maxSizeMB","disabled","uploadType","multiple","value","onChange","onDelete","previewUrl","previewUrls","existingFileUrl","existingFileName","editMode","viewMode","sx","existingFiles","currentFiles","filesToRender","isReadOnly","inputRef","useRef","useImperativeHandle","internalPreviews","setInternalPreviews","useState","useEffect","url","handleFileChange","files","fileList","validFiles","newPreviews","file","toast","prev","updatedFiles","handleRemove","index","currentFileIndex","currentPreviews","renderFileRow","fileName","fileUrl","isPdf","isImage","jsxs","Stack","jsx","PictureAsPdfIcon","InsertDriveFileIcon","Typography","IconButton","VisibilityIcon","CloseIcon","Box","CloudUploadIcon","idx"],"mappings":"2MAqBMA,EAAAA,CAAcC,eAAAA,CAAO,OAAO,CAAA,CAAE,CAClC,OAAA,CAAS,MACX,CAAC,CAAA,CAEKC,EAAAA,CAAgBD,eAAA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A,CAAcR,CAAAA,CAAMwB,CAAG,CAAC,CAAA,CAC5D,CAAA,CAECzD,CAAAA,EACCgD,cAAAA,CAACG,mBAAAA,CAAA,CAAW,OAAA,CAAQ,SAAA,CAAU,KAAA,CAAM,OAAA,CAAQ,EAAA,CAAI,CAAE,GAAI,EAAA,CAAK,OAAA,CAAS,OAAQ,CAAA,CACzE,QAAA,CAAAnD,CAAAA,CACH,GAEJ,CAEJ,CAAC,EAEDN,EAAAA,CAAgB,WAAA,CAAc,iBAAA","file":"index.js","sourcesContent":["'use client';\n\nimport React, { forwardRef, useCallback, useImperativeHandle, useRef, useState, useEffect } from 'react';\nimport {\n Paper,\n Typography,\n IconButton,\n Stack,\n Box,\n styled,\n} from '@mui/material';\nimport {\n CloudUpload as CloudUploadIcon,\n PictureAsPdf as PictureAsPdfIcon,\n InsertDriveFile as InsertDriveFileIcon,\n Visibility as VisibilityIcon,\n Close as CloseIcon,\n} from '@mui/icons-material';\nimport { toast } from 'react-toastify';\nimport { FileUploadFieldProps } from './FileUploadField.types';\n\nconst HiddenInput = styled('input')({\n display: 'none',\n});\n\nconst DropZonePaper = styled(Paper, {\n shouldForwardProp: (prop) => prop !== 'isError',\n})<{ isError?: boolean }>(({ theme, isError }) => ({\n border: `2px dashed ${isError ? theme.palette.error.main : '#90caf9'}`,\n textAlign: 'center',\n padding: theme.spacing(4),\n cursor: 'pointer',\n borderRadius: theme.spacing(1.5),\n transition: 'border-color 0.2s ease-in-out, background-color 0.2s ease-in-out',\n '&:hover': {\n borderColor: isError ? theme.palette.error.dark : '#42a5f5',\n backgroundColor: 'rgba(144, 202, 249, 0.04)',\n },\n}));\n\nconst PreviewPaper = styled(Paper)(({ theme }) => ({\n padding: theme.spacing(2),\n borderRadius: theme.spacing(1.5),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n marginTop: theme.spacing(1),\n}));\n\nconst Thumbnail = styled('img')({\n height: '40px',\n width: '40px',\n objectFit: 'cover',\n borderRadius: '4px',\n});\n\n/**\n * FileUploadField component for single or multiple file uploads with preview support.\n */\nexport const FileUploadField = forwardRef<HTMLInputElement, FileUploadFieldProps>((props, ref) => {\n const {\n label,\n required,\n error,\n accept = '.pdf,.doc,.docx',\n maxSizeMB = 10,\n disabled,\n uploadType,\n multiple,\n value,\n onChange,\n onDelete,\n previewUrl,\n previewUrls,\n existingFileUrl,\n existingFileName,\n editMode = true,\n viewMode = false,\n sx,\n } = props;\n\n const existingFiles = Array.isArray(existingFileUrl) \n ? existingFileUrl \n : existingFileUrl ? [existingFileUrl] : [];\n\n const currentFiles = Array.isArray(value) \n ? value \n : value ? [value] : [];\n\n const filesToRender = [...existingFiles, ...currentFiles];\n\n const isReadOnly = disabled || viewMode || !editMode;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current!);\n\n const [internalPreviews, setInternalPreviews] = useState<string[]>([]);\n\n // Cleanup object URLs on unmount\n useEffect(() => {\n return () => {\n internalPreviews.forEach((url) => {\n if (url.startsWith('blob:')) {\n URL.revokeObjectURL(url);\n }\n });\n };\n }, [internalPreviews]);\n\n const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isReadOnly) return;\n const files = e.target.files;\n if (!files || files.length === 0) return;\n\n const fileList = Array.from(files);\n const validFiles: File[] = [];\n const newPreviews: string[] = [];\n\n for (const file of fileList) {\n if (file.size > maxSizeMB * 1024 * 1024) {\n toast.error(`File \"${file.name}\" exceeds the maximum size of ${maxSizeMB}MB`);\n continue;\n }\n validFiles.push(file);\n newPreviews.push(URL.createObjectURL(file));\n }\n\n if (validFiles.length === 0) {\n e.target.value = '';\n return;\n }\n\n if (multiple) {\n setInternalPreviews((prev) => [...prev, ...newPreviews]);\n const currentFiles = Array.isArray(value) ? value : [];\n const updatedFiles = [...currentFiles, ...validFiles];\n (onChange as (files: File[] | null) => void)?.(updatedFiles);\n } else {\n // Revoke old single preview if it exists\n if (internalPreviews[0]?.startsWith('blob:')) {\n URL.revokeObjectURL(internalPreviews[0]);\n }\n setInternalPreviews(newPreviews);\n (onChange as (file: File | null) => void)?.(validFiles[0]);\n }\n \n // Reset input so the same file can be selected again\n e.target.value = '';\n };\n\n const handleRemove = (index: number) => {\n if (isReadOnly) return;\n\n const isExisting = index < existingFiles.length;\n\n if (isExisting) {\n onDelete?.(index);\n return;\n }\n\n const currentFileIndex = index - existingFiles.length;\n\n if (multiple) {\n const currentFiles = Array.isArray(value) ? [...value] : [];\n currentFiles.splice(currentFileIndex, 1);\n (onChange as (files: File[] | null) => void)?.(currentFiles.length > 0 ? currentFiles : null);\n \n const currentPreviews = [...internalPreviews];\n if (currentPreviews[currentFileIndex]?.startsWith('blob:')) {\n URL.revokeObjectURL(currentPreviews[currentFileIndex]);\n }\n currentPreviews.splice(currentFileIndex, 1);\n setInternalPreviews(currentPreviews);\n } else {\n (onChange as (file: File | null) => void)?.(null);\n if (internalPreviews[0]?.startsWith('blob:')) {\n URL.revokeObjectURL(internalPreviews[0]);\n }\n setInternalPreviews([]);\n }\n onDelete?.(index);\n };\n\n const renderFileRow = (file: File | string, index: number) => {\n const isExisting = index < existingFiles.length;\n const fileName = typeof file === 'string' \n ? (Array.isArray(existingFileName) ? existingFileName[index] : existingFileName) || 'Uploaded Document'\n : file.name;\n \n const currentFileIndex = index - existingFiles.length;\n const fileUrl = typeof file === 'string' \n ? file \n : internalPreviews[currentFileIndex] || (Array.isArray(previewUrls) ? previewUrls[currentFileIndex] : previewUrl);\n \n const isPdf = fileName.toLowerCase().endsWith('.pdf') || (typeof file !== 'string' && file.type === 'application/pdf');\n const isImage = uploadType === 'image' || fileName.toLowerCase().match(/\\.(jpg|jpeg|png|gif|webp)$/i);\n\n return (\n <PreviewPaper key={`${fileName}-${index}`} elevation={1}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n {isImage && fileUrl ? (\n <Thumbnail src={fileUrl} alt={fileName} />\n ) : isPdf ? (\n <PictureAsPdfIcon color=\"error\" />\n ) : (\n <InsertDriveFileIcon color=\"primary\" />\n )}\n <Typography variant=\"body2\" noWrap sx={{ maxWidth: 200 }}>\n {fileName}\n </Typography>\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n {(isPdf || isImage) && fileUrl && (\n <IconButton\n color=\"primary\"\n size=\"small\"\n onClick={() => window.open(fileUrl, '_blank')}\n title=\"View\"\n >\n <VisibilityIcon fontSize=\"small\" />\n </IconButton>\n )}\n {!isReadOnly && (\n <IconButton\n color=\"error\"\n size=\"small\"\n onClick={() => handleRemove(index)}\n title=\"Remove\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n )}\n </Stack>\n </PreviewPaper>\n );\n };\n\n\n\n\n\n return (\n <Box sx={sx}>\n {label && (\n <Typography\n variant=\"caption\"\n sx={{ color: error ? 'error.main' : 'text.secondary', fontWeight: 500, display: 'block' }}\n gutterBottom\n >\n {label} {required && '*'}\n </Typography>\n )}\n\n {(!filesToRender.length || multiple) && !isReadOnly && (\n <DropZonePaper\n variant=\"outlined\"\n isError={!!error}\n onClick={() => !disabled && inputRef.current?.click()}\n sx={{ cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.7 : 1 }}\n >\n <CloudUploadIcon sx={{ fontSize: 40, color: error ? 'error.main' : '#42a5f5', mb: 1 }} />\n <Typography variant=\"body1\" color=\"textSecondary\">\n {disabled ? 'Upload disabled' : 'Click to upload'}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n (Supported formats: {accept.replace(/\\./g, '').toUpperCase()})\n </Typography>\n <HiddenInput\n type=\"file\"\n ref={inputRef}\n onChange={handleFileChange}\n accept={accept}\n disabled={disabled}\n multiple={multiple}\n />\n </DropZonePaper>\n )}\n\n <Stack spacing={1} sx={{ mt: filesToRender.length ? 1 : 0 }}>\n {filesToRender.map((file, idx) => renderFileRow(file, idx))}\n </Stack>\n\n {error && (\n <Typography variant=\"caption\" color=\"error\" sx={{ mt: 0.5, display: 'block' }}>\n {error}\n </Typography>\n )}\n </Box>\n );\n});\n\nFileUploadField.displayName = 'FileUploadField';\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useRef,useImperativeHandle,useState,useEffect}from'react';import {styled,Paper,Box,Typography,Stack,IconButton}from'@mui/material';import {CloudUpload,PictureAsPdf,InsertDriveFile,Visibility,Close}from'@mui/icons-material';import {toast}from'react-toastify';import {jsxs,jsx}from'react/jsx-runtime';var oe=styled("input")({display:"none"}),ie=styled(Paper,{shouldForwardProp:o=>o!=="isError"})(({theme:o,isError:m})=>({border:`2px dashed ${m?o.palette.error.main:"#90caf9"}`,textAlign:"center",padding:o.spacing(4),cursor:"pointer",borderRadius:o.spacing(1.5),transition:"border-color 0.2s ease-in-out, background-color 0.2s ease-in-out","&:hover":{borderColor:m?o.palette.error.dark:"#42a5f5",backgroundColor:"rgba(144, 202, 249, 0.04)"}})),ne=styled(Paper)(({theme:o})=>({padding:o.spacing(2),borderRadius:o.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:o.spacing(1)})),se=styled("img")({height:"40px",width:"40px",objectFit:"cover",borderRadius:"4px"}),ae=forwardRef((o,m)=>{let{label:P,required:z,error:u,accept:A=".pdf,.doc,.docx",maxSizeMB:L=10,disabled:d,uploadType:B,multiple:y,value:a,onChange:b,onDelete:T,previewUrl:W,previewUrls:S,existingFileUrl:v,existingFileName:U,editMode:M=true,viewMode:D=false,sx:O}=o,g=Array.isArray(v)?v:v?[v]:[],$=Array.isArray(a)?a:a?[a]:[],I=[...g,...$],h=d||D||!M,k=useRef(null);useImperativeHandle(m,()=>k.current);let[l,F]=useState([]);useEffect(()=>()=>{l.forEach(e=>{e.startsWith("blob:")&&URL.revokeObjectURL(e);});},[l]);let H=e=>{if(h)return;let i=e.target.files;if(!i||i.length===0)return;let c=Array.from(i),r=[],n=[];for(let s of c){if(s.size>L*1024*1024){toast.error(`File "${s.name}" exceeds the maximum size of ${L}MB`);continue}r.push(s),n.push(URL.createObjectURL(s));}if(r.length===0){e.target.value="";return}if(y){F(w=>[...w,...n]);let x=[...Array.isArray(a)?a:[],...r];b?.(x);}else l[0]?.startsWith("blob:")&&URL.revokeObjectURL(l[0]),F(n),b?.(r[0]);e.target.value="";},N=e=>{if(h)return;if(e<g.length){T?.(e);return}let c=e-g.length;if(y){let r=Array.isArray(a)?[...a]:[];r.splice(c,1),b?.(r.length>0?r:null);let n=[...l];n[c]?.startsWith("blob:")&&URL.revokeObjectURL(n[c]),n.splice(c,1),F(n);}else b?.(null),l[0]?.startsWith("blob:")&&URL.revokeObjectURL(l[0]),F([]);T?.(e);},V=(e,i)=>{i<g.length;let r=typeof e=="string"?(Array.isArray(U)?U[i]:U)||"Uploaded Document":e.name,n=i-g.length,s=typeof e=="string"?e:l[n]||(Array.isArray(S)?S[n]:W),x=r.toLowerCase().endsWith(".pdf")||typeof e!="string"&&e.type==="application/pdf",w=B==="image"||r.toLowerCase().match(/\.(jpg|jpeg|png|gif|webp)$/i);return jsxs(ne,{elevation:1,children:[jsxs(Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[w&&s?jsx(se,{src:s,alt:r}):x?jsx(PictureAsPdf,{color:"error"}):jsx(InsertDriveFile,{color:"primary"}),jsx(Typography,{variant:"body2",noWrap:true,sx:{maxWidth:200},children:r})]}),jsxs(Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(x||w)&&s&&jsx(IconButton,{color:"primary",size:"small",onClick:()=>window.open(s,"_blank"),title:"View",children:jsx(Visibility,{fontSize:"small"})}),!h&&jsx(IconButton,{color:"error",size:"small",onClick:()=>N(i),title:"Remove",children:jsx(Close,{fontSize:"small"})})]})]},`${r}-${i}`)};return jsxs(Box,{sx:O,children:[P&&jsxs(Typography,{variant:"caption",sx:{color:u?"error.main":"text.secondary",fontWeight:500,display:"block"},gutterBottom:true,children:[P," ",z&&"*"]}),(!I.length||y)&&!h&&jsxs(ie,{variant:"outlined",isError:!!u,onClick:()=>!d&&k.current?.click(),sx:{cursor:d?"not-allowed":"pointer",opacity:d?.7:1},children:[jsx(CloudUpload,{sx:{fontSize:40,color:u?"error.main":"#42a5f5",mb:1}}),jsx(Typography,{variant:"body1",color:"textSecondary",children:d?"Upload disabled":"Click to upload"}),jsxs(Typography,{variant:"caption",color:"textSecondary",children:["(Supported formats: ",A.replace(/\./g,"").toUpperCase(),")"]}),jsx(oe,{type:"file",ref:k,onChange:H,accept:A,disabled:d,multiple:y})]}),jsx(Stack,{spacing:1,sx:{mt:I.length?1:0},children:I.map((e,i)=>V(e,i))}),u&&jsx(Typography,{variant:"caption",color:"error",sx:{mt:.5,display:"block"},children:u})]})});ae.displayName="FileUploadField";export{ae as FileUploadField};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FileUploadField/FileUploadField.tsx"],"names":["HiddenInput","styled","DropZonePaper","Paper","prop","theme","isError","PreviewPaper","Thumbnail","FileUploadField","forwardRef","props","ref","label","required","error","accept","maxSizeMB","disabled","uploadType","multiple","value","onChange","onDelete","previewUrl","previewUrls","existingFileUrl","existingFileName","editMode","viewMode","sx","existingFiles","currentFiles","filesToRender","isReadOnly","inputRef","useRef","useImperativeHandle","internalPreviews","setInternalPreviews","useState","useEffect","url","handleFileChange","files","fileList","validFiles","newPreviews","file","toast","prev","updatedFiles","handleRemove","index","currentFileIndex","currentPreviews","renderFileRow","fileName","fileUrl","isPdf","isImage","jsxs","Stack","jsx","PictureAsPdfIcon","InsertDriveFileIcon","Typography","IconButton","VisibilityIcon","CloseIcon","Box","CloudUploadIcon","idx"],"mappings":"kUAqBMA,EAAAA,CAAcC,MAAAA,CAAO,OAAO,CAAA,CAAE,CAClC,OAAA,CAAS,MACX,CAAC,CAAA,CAEKC,EAAAA,CAAgBD,MAAAA,CAAOE,KAAAA,CAAO,CAClC,kBAAoBC,CAAAA,EAASA,CAAAA,GAAS,SACxC,CAAC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AAAA,CAAA,CAAW,OAAA,CAAQ,SAAA,CAAU,KAAA,CAAM,OAAA,CAAQ,EAAA,CAAI,CAAE,GAAI,EAAA,CAAK,OAAA,CAAS,OAAQ,CAAA,CACzE,QAAA,CAAAnD,CAAAA,CACH,GAEJ,CAEJ,CAAC,EAEDN,EAAAA,CAAgB,WAAA,CAAc,iBAAA","file":"index.mjs","sourcesContent":["'use client';\n\nimport React, { forwardRef, useCallback, useImperativeHandle, useRef, useState, useEffect } from 'react';\nimport {\n Paper,\n Typography,\n IconButton,\n Stack,\n Box,\n styled,\n} from '@mui/material';\nimport {\n CloudUpload as CloudUploadIcon,\n PictureAsPdf as PictureAsPdfIcon,\n InsertDriveFile as InsertDriveFileIcon,\n Visibility as VisibilityIcon,\n Close as CloseIcon,\n} from '@mui/icons-material';\nimport { toast } from 'react-toastify';\nimport { FileUploadFieldProps } from './FileUploadField.types';\n\nconst HiddenInput = styled('input')({\n display: 'none',\n});\n\nconst DropZonePaper = styled(Paper, {\n shouldForwardProp: (prop) => prop !== 'isError',\n})<{ isError?: boolean }>(({ theme, isError }) => ({\n border: `2px dashed ${isError ? theme.palette.error.main : '#90caf9'}`,\n textAlign: 'center',\n padding: theme.spacing(4),\n cursor: 'pointer',\n borderRadius: theme.spacing(1.5),\n transition: 'border-color 0.2s ease-in-out, background-color 0.2s ease-in-out',\n '&:hover': {\n borderColor: isError ? theme.palette.error.dark : '#42a5f5',\n backgroundColor: 'rgba(144, 202, 249, 0.04)',\n },\n}));\n\nconst PreviewPaper = styled(Paper)(({ theme }) => ({\n padding: theme.spacing(2),\n borderRadius: theme.spacing(1.5),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n marginTop: theme.spacing(1),\n}));\n\nconst Thumbnail = styled('img')({\n height: '40px',\n width: '40px',\n objectFit: 'cover',\n borderRadius: '4px',\n});\n\n/**\n * FileUploadField component for single or multiple file uploads with preview support.\n */\nexport const FileUploadField = forwardRef<HTMLInputElement, FileUploadFieldProps>((props, ref) => {\n const {\n label,\n required,\n error,\n accept = '.pdf,.doc,.docx',\n maxSizeMB = 10,\n disabled,\n uploadType,\n multiple,\n value,\n onChange,\n onDelete,\n previewUrl,\n previewUrls,\n existingFileUrl,\n existingFileName,\n editMode = true,\n viewMode = false,\n sx,\n } = props;\n\n const existingFiles = Array.isArray(existingFileUrl) \n ? existingFileUrl \n : existingFileUrl ? [existingFileUrl] : [];\n\n const currentFiles = Array.isArray(value) \n ? value \n : value ? [value] : [];\n\n const filesToRender = [...existingFiles, ...currentFiles];\n\n const isReadOnly = disabled || viewMode || !editMode;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current!);\n\n const [internalPreviews, setInternalPreviews] = useState<string[]>([]);\n\n // Cleanup object URLs on unmount\n useEffect(() => {\n return () => {\n internalPreviews.forEach((url) => {\n if (url.startsWith('blob:')) {\n URL.revokeObjectURL(url);\n }\n });\n };\n }, [internalPreviews]);\n\n const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isReadOnly) return;\n const files = e.target.files;\n if (!files || files.length === 0) return;\n\n const fileList = Array.from(files);\n const validFiles: File[] = [];\n const newPreviews: string[] = [];\n\n for (const file of fileList) {\n if (file.size > maxSizeMB * 1024 * 1024) {\n toast.error(`File \"${file.name}\" exceeds the maximum size of ${maxSizeMB}MB`);\n continue;\n }\n validFiles.push(file);\n newPreviews.push(URL.createObjectURL(file));\n }\n\n if (validFiles.length === 0) {\n e.target.value = '';\n return;\n }\n\n if (multiple) {\n setInternalPreviews((prev) => [...prev, ...newPreviews]);\n const currentFiles = Array.isArray(value) ? value : [];\n const updatedFiles = [...currentFiles, ...validFiles];\n (onChange as (files: File[] | null) => void)?.(updatedFiles);\n } else {\n // Revoke old single preview if it exists\n if (internalPreviews[0]?.startsWith('blob:')) {\n URL.revokeObjectURL(internalPreviews[0]);\n }\n setInternalPreviews(newPreviews);\n (onChange as (file: File | null) => void)?.(validFiles[0]);\n }\n \n // Reset input so the same file can be selected again\n e.target.value = '';\n };\n\n const handleRemove = (index: number) => {\n if (isReadOnly) return;\n\n const isExisting = index < existingFiles.length;\n\n if (isExisting) {\n onDelete?.(index);\n return;\n }\n\n const currentFileIndex = index - existingFiles.length;\n\n if (multiple) {\n const currentFiles = Array.isArray(value) ? [...value] : [];\n currentFiles.splice(currentFileIndex, 1);\n (onChange as (files: File[] | null) => void)?.(currentFiles.length > 0 ? currentFiles : null);\n \n const currentPreviews = [...internalPreviews];\n if (currentPreviews[currentFileIndex]?.startsWith('blob:')) {\n URL.revokeObjectURL(currentPreviews[currentFileIndex]);\n }\n currentPreviews.splice(currentFileIndex, 1);\n setInternalPreviews(currentPreviews);\n } else {\n (onChange as (file: File | null) => void)?.(null);\n if (internalPreviews[0]?.startsWith('blob:')) {\n URL.revokeObjectURL(internalPreviews[0]);\n }\n setInternalPreviews([]);\n }\n onDelete?.(index);\n };\n\n const renderFileRow = (file: File | string, index: number) => {\n const isExisting = index < existingFiles.length;\n const fileName = typeof file === 'string' \n ? (Array.isArray(existingFileName) ? existingFileName[index] : existingFileName) || 'Uploaded Document'\n : file.name;\n \n const currentFileIndex = index - existingFiles.length;\n const fileUrl = typeof file === 'string' \n ? file \n : internalPreviews[currentFileIndex] || (Array.isArray(previewUrls) ? previewUrls[currentFileIndex] : previewUrl);\n \n const isPdf = fileName.toLowerCase().endsWith('.pdf') || (typeof file !== 'string' && file.type === 'application/pdf');\n const isImage = uploadType === 'image' || fileName.toLowerCase().match(/\\.(jpg|jpeg|png|gif|webp)$/i);\n\n return (\n <PreviewPaper key={`${fileName}-${index}`} elevation={1}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n {isImage && fileUrl ? (\n <Thumbnail src={fileUrl} alt={fileName} />\n ) : isPdf ? (\n <PictureAsPdfIcon color=\"error\" />\n ) : (\n <InsertDriveFileIcon color=\"primary\" />\n )}\n <Typography variant=\"body2\" noWrap sx={{ maxWidth: 200 }}>\n {fileName}\n </Typography>\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n {(isPdf || isImage) && fileUrl && (\n <IconButton\n color=\"primary\"\n size=\"small\"\n onClick={() => window.open(fileUrl, '_blank')}\n title=\"View\"\n >\n <VisibilityIcon fontSize=\"small\" />\n </IconButton>\n )}\n {!isReadOnly && (\n <IconButton\n color=\"error\"\n size=\"small\"\n onClick={() => handleRemove(index)}\n title=\"Remove\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n )}\n </Stack>\n </PreviewPaper>\n );\n };\n\n\n\n\n\n return (\n <Box sx={sx}>\n {label && (\n <Typography\n variant=\"caption\"\n sx={{ color: error ? 'error.main' : 'text.secondary', fontWeight: 500, display: 'block' }}\n gutterBottom\n >\n {label} {required && '*'}\n </Typography>\n )}\n\n {(!filesToRender.length || multiple) && !isReadOnly && (\n <DropZonePaper\n variant=\"outlined\"\n isError={!!error}\n onClick={() => !disabled && inputRef.current?.click()}\n sx={{ cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.7 : 1 }}\n >\n <CloudUploadIcon sx={{ fontSize: 40, color: error ? 'error.main' : '#42a5f5', mb: 1 }} />\n <Typography variant=\"body1\" color=\"textSecondary\">\n {disabled ? 'Upload disabled' : 'Click to upload'}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n (Supported formats: {accept.replace(/\\./g, '').toUpperCase()})\n </Typography>\n <HiddenInput\n type=\"file\"\n ref={inputRef}\n onChange={handleFileChange}\n accept={accept}\n disabled={disabled}\n multiple={multiple}\n />\n </DropZonePaper>\n )}\n\n <Stack spacing={1} sx={{ mt: filesToRender.length ? 1 : 0 }}>\n {filesToRender.map((file, idx) => renderFileRow(file, idx))}\n </Stack>\n\n {error && (\n <Typography variant=\"caption\" color=\"error\" sx={{ mt: 0.5, display: 'block' }}>\n {error}\n </Typography>\n )}\n </Box>\n );\n});\n\nFileUploadField.displayName = 'FileUploadField';\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ElementType, ReactNode, ComponentPropsWithRef, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
interface IdleTimerProps<T extends ElementType = 'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* The element to render as. Defaults to 'div'.
|
|
6
|
+
*/
|
|
7
|
+
as?: T;
|
|
8
|
+
/**
|
|
9
|
+
* Time in milliseconds before the idle dialog appears.
|
|
10
|
+
* @default 7200000 (2 hours)
|
|
11
|
+
*/
|
|
12
|
+
idleTimeLimit?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Callback function when the user clicks the logout button.
|
|
15
|
+
*/
|
|
16
|
+
onLogout: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Title of the session expired dialog.
|
|
19
|
+
* @default 'Session Expired'
|
|
20
|
+
*/
|
|
21
|
+
dialogTitle?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Message shown in the dialog.
|
|
24
|
+
* @default 'Your current session has expired. Please proceed with logout and re-login.'
|
|
25
|
+
*/
|
|
26
|
+
dialogMessage?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Text for the logout button.
|
|
29
|
+
* @default 'Logout'
|
|
30
|
+
*/
|
|
31
|
+
logoutButtonText?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom class names for the dialog container.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
type IdleTimerComponentProps<T extends ElementType> = IdleTimerProps<T> & Omit<ComponentPropsWithRef<T>, keyof IdleTimerProps<T>>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* IdleTimer component that monitors user activity and prompts for logout after a period of inactivity.
|
|
41
|
+
* Built with Tailwind CSS for zero runtime dependencies (except React).
|
|
42
|
+
*/
|
|
43
|
+
declare const IdleTimer: (<T extends ElementType = "div">(props: IdleTimerComponentProps<T> & {
|
|
44
|
+
ref?: any;
|
|
45
|
+
}) => ReactElement | null) & {
|
|
46
|
+
displayName?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { IdleTimer, type IdleTimerComponentProps, type IdleTimerProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ElementType, ReactNode, ComponentPropsWithRef, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
interface IdleTimerProps<T extends ElementType = 'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* The element to render as. Defaults to 'div'.
|
|
6
|
+
*/
|
|
7
|
+
as?: T;
|
|
8
|
+
/**
|
|
9
|
+
* Time in milliseconds before the idle dialog appears.
|
|
10
|
+
* @default 7200000 (2 hours)
|
|
11
|
+
*/
|
|
12
|
+
idleTimeLimit?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Callback function when the user clicks the logout button.
|
|
15
|
+
*/
|
|
16
|
+
onLogout: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Title of the session expired dialog.
|
|
19
|
+
* @default 'Session Expired'
|
|
20
|
+
*/
|
|
21
|
+
dialogTitle?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Message shown in the dialog.
|
|
24
|
+
* @default 'Your current session has expired. Please proceed with logout and re-login.'
|
|
25
|
+
*/
|
|
26
|
+
dialogMessage?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Text for the logout button.
|
|
29
|
+
* @default 'Logout'
|
|
30
|
+
*/
|
|
31
|
+
logoutButtonText?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom class names for the dialog container.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
type IdleTimerComponentProps<T extends ElementType> = IdleTimerProps<T> & Omit<ComponentPropsWithRef<T>, keyof IdleTimerProps<T>>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* IdleTimer component that monitors user activity and prompts for logout after a period of inactivity.
|
|
41
|
+
* Built with Tailwind CSS for zero runtime dependencies (except React).
|
|
42
|
+
*/
|
|
43
|
+
declare const IdleTimer: (<T extends ElementType = "div">(props: IdleTimerComponentProps<T> & {
|
|
44
|
+
ref?: any;
|
|
45
|
+
}) => ReactElement | null) & {
|
|
46
|
+
displayName?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { IdleTimer, type IdleTimerComponentProps, type IdleTimerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface InputBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type InputProps<T extends ElementType = 'div'> = InputBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof InputBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Input: react.ForwardRefExoticComponent<Omit<InputProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Input, type InputBaseProps, type InputProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface InputBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type InputProps<T extends ElementType = 'div'> = InputBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof InputBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Input: react.ForwardRefExoticComponent<Omit<InputProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Input, type InputBaseProps, type InputProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface LoaderBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* The underlying element to render.
|
|
7
|
+
* @default 'div'
|
|
8
|
+
*/
|
|
9
|
+
as?: T;
|
|
10
|
+
/**
|
|
11
|
+
* Custom class names for the overlay container.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the loader is visible.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The text to display.
|
|
21
|
+
* @default 'LOADING'
|
|
22
|
+
*/
|
|
23
|
+
text?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The primary color of the loader.
|
|
26
|
+
* @default '#3f4379'
|
|
27
|
+
*/
|
|
28
|
+
primaryColor?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The secondary color of the loader.
|
|
31
|
+
* @default '#8c91df'
|
|
32
|
+
*/
|
|
33
|
+
secondaryColor?: string;
|
|
34
|
+
}
|
|
35
|
+
type LoaderProps<T extends ElementType = 'div'> = LoaderBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof LoaderBaseProps<T>>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Loader component with flying file animations and flipping text.
|
|
39
|
+
* Ported from a custom React implementation with full CSS-in-JS style management.
|
|
40
|
+
*/
|
|
41
|
+
declare const Loader: react.ForwardRefExoticComponent<Omit<LoaderProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
42
|
+
|
|
43
|
+
export { Loader, type LoaderBaseProps, type LoaderProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface LoaderBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* The underlying element to render.
|
|
7
|
+
* @default 'div'
|
|
8
|
+
*/
|
|
9
|
+
as?: T;
|
|
10
|
+
/**
|
|
11
|
+
* Custom class names for the overlay container.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the loader is visible.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The text to display.
|
|
21
|
+
* @default 'LOADING'
|
|
22
|
+
*/
|
|
23
|
+
text?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The primary color of the loader.
|
|
26
|
+
* @default '#3f4379'
|
|
27
|
+
*/
|
|
28
|
+
primaryColor?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The secondary color of the loader.
|
|
31
|
+
* @default '#8c91df'
|
|
32
|
+
*/
|
|
33
|
+
secondaryColor?: string;
|
|
34
|
+
}
|
|
35
|
+
type LoaderProps<T extends ElementType = 'div'> = LoaderBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof LoaderBaseProps<T>>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Loader component with flying file animations and flipping text.
|
|
39
|
+
* Ported from a custom React implementation with full CSS-in-JS style management.
|
|
40
|
+
*/
|
|
41
|
+
declare const Loader: react.ForwardRefExoticComponent<Omit<LoaderProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
42
|
+
|
|
43
|
+
export { Loader, type LoaderBaseProps, type LoaderProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ModalBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type ModalProps<T extends ElementType = 'div'> = ModalBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof ModalBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Modal: react.ForwardRefExoticComponent<Omit<ModalProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Modal, type ModalBaseProps, type ModalProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ModalBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type ModalProps<T extends ElementType = 'div'> = ModalBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof ModalBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Modal: react.ForwardRefExoticComponent<Omit<ModalProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Modal, type ModalBaseProps, type ModalProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SwitchBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type SwitchProps<T extends ElementType = 'div'> = SwitchBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SwitchBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Switch: react.ForwardRefExoticComponent<Omit<SwitchProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Switch, type SwitchBaseProps, type SwitchProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SwitchBaseProps<T extends ElementType = 'div'> {
|
|
5
|
+
as?: T;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
type SwitchProps<T extends ElementType = 'div'> = SwitchBaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SwitchBaseProps<T>>;
|
|
9
|
+
|
|
10
|
+
declare const Switch: react.ForwardRefExoticComponent<Omit<SwitchProps<ElementType>, "ref"> & react.RefAttributes<unknown>>;
|
|
11
|
+
|
|
12
|
+
export { Switch, type SwitchBaseProps, type SwitchProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|