@zydon/common 2.7.85 → 2.7.87

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/form/FileUpload/AvatarUpload.tsx","../../../../src/components/form/FileUpload/useFormFileUpload.ts","../../../../src/components/form/FileUpload/MultiFileUpload.tsx","../../../../src/components/form/FileUpload/MultiImageUpload.tsx","../../../../src/components/form/FileUpload/SingleFileUpload.tsx","../../../../src/components/form/FileUpload/SingleImageUpload.tsx"],"names":["Controller","useFormContext","useEffect","useMemo","useRef","useState","useSingleFileUpload","name","getFileQuery","setValue","watch","value","fileDetails","setFileDetails","file","useMultiFileUpload","watchedValue","currentValue","filesDetails","setFilesDetails","cacheRef","uniqueIds","cache","newIds","id","promises","fallback","results","files","updatedIds","oldIndex","newIndex","removed","jsx","AvatarUpload","rules","createFilesMutation","disableRemove","aspectRatio","enableCrop","maxSize","other","control","handleFileSelect","handleRemove","error","SingleImageUpload_default","AvatarUpload_default","MultiFileUpload","disableReorder","handleFilesSelect","handleReorder","MultipleFileUpload_default","MultiFileUpload_default","MultiImageUpload","MultipleImageUpload_default","MultiImageUpload_default","SingleFileUpload","SingleFileUpload_default","SingleImageUpload","hoverAlt"],"mappings":"8iBAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBCA3C,OAAS,aAAAC,EAAW,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QACrD,OAAS,kBAAAJ,MAAsB,kBASxB,IAAMK,EAAsB,CACjCC,EACAC,IACG,CACH,GAAM,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAAIT,EAAe,EACrCU,EAAQD,EAAMH,CAAI,EAClB,CAACK,EAAaC,CAAc,EAAIR,EAAkC,EAExE,OAAAH,EAAU,IAAM,CACd,GAAI,CAACS,EAAO,CACVE,EAAe,MAAS,EACxB,QAEgB,SAAY,CAC5B,GAAI,CACF,IAAMC,EAAO,MAAMN,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OAAsB,kBA+DnC,cAAAgC,MAAA,oBArBR,IAAM0B,GAAoB,CAAC,CACzB,KAAApD,EACA,MAAA4B,EACA,oBAAAC,EACA,aAAA5B,EACA,cAAA6B,EACA,SAAAuB,EACA,GAAGnB,CACL,IAAkC,CAChC,GAAM,CAAE,QAAAC,CAAQ,EAAIzC,GAAe,EAC7B,CAAE,YAAAW,EAAa,iBAAA+B,EAAkB,aAAAC,CAAa,EAAItC,EACtDC,EACAC,CACF,EAEA,OACEyB,EAACjC,EAAA,CACC,KAAMO,EACN,QAASmC,EACT,MAAOP,EACP,OAAQ,CAAC,CAAE,WAAY,CAAE,MAAAU,CAAM,CAAE,IAC/BZ,EAACa,EAAA,CACC,KAAMvC,EACN,YAAaK,EACb,oBAAqBwB,EACrB,aAAcO,EACd,SAAUN,EAAgB,OAAYO,EACtC,MAAOC,GAAO,QACd,SAAUe,EACT,GAAGnB,EACN,EAEJ,CAEJ,EAEOK,GAAQa","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleImageUploadComponent from 'components/FileUpload/SingleImageUpload';\n\nimport { FormSingleImageUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * AvatarUpload integrado ao React Hook Form\n * Componente especializado para upload de avatar (imagem circular de perfil)\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { AvatarUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation, useGetFileQuery } from 'services/filesApi';\n *\n * interface FormData {\n * avatar_id: string | null;\n * }\n *\n * const ProfileForm = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const getFileQuery = useGetFileQuery();\n * const methods = useForm<FormData>();\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <AvatarUpload\n * name=\"avatar_id\"\n * createFilesMutation={createFilesMutation}\n * getFileQuery={getFileQuery}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst AvatarUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n aspectRatio = 1,\n enableCrop = true,\n maxSize = 5242880,\n ...other\n}: FormSingleImageUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleImageUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n aspectRatio={aspectRatio}\n enableCrop={enableCrop}\n maxSize={maxSize}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default AvatarUpload;\n","import { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { FileDetails } from 'components/FileUpload/props';\n\nimport { LazyQueryTrigger } from './props';\n\n/**\n * Hook para gerenciar upload de arquivo único\n */\nexport const useSingleFileUpload = (\n name: string,\n getFileQuery: LazyQueryTrigger,\n) => {\n const { setValue, watch } = useFormContext();\n const value = watch(name);\n const [fileDetails, setFileDetails] = useState<FileDetails | undefined>();\n\n useEffect(() => {\n if (!value) {\n setFileDetails(undefined);\n return;\n }\n const fetchFile = async () => {\n try {\n const file = await getFileQuery(value).unwrap();\n setFileDetails({\n id: file.id,\n url: file.url,\n name: file.name,\n });\n } catch {\n setFileDetails({ id: value, url: '' });\n }\n };\n fetchFile();\n }, [value, getFileQuery]);\n\n const handleFileSelect = (file: FileDetails) => {\n setValue(name, file.id, { shouldValidate: true, shouldDirty: true });\n };\n\n const handleRemove = () => {\n setValue(name, null, { shouldValidate: true, shouldDirty: true });\n };\n\n return {\n fileDetails,\n handleFileSelect,\n handleRemove,\n };\n};\n\n/**\n * Hook para gerenciar upload de múltiplos arquivos\n */\nexport const useMultiFileUpload = (\n name: string,\n getFileQuery: LazyQueryTrigger,\n) => {\n const { setValue, watch } = useFormContext();\n const watchedValue = watch(name);\n const currentValue = useMemo(() => watchedValue || [], [watchedValue]);\n const [filesDetails, setFilesDetails] = useState<FileDetails[]>([]);\n const cacheRef = useRef<Map<string, FileDetails>>(new Map());\n\n useEffect(() => {\n if (!currentValue || currentValue.length === 0) {\n setFilesDetails([]);\n return;\n }\n const fetchFiles = async () => {\n try {\n // Remove duplicatas mantendo a ordem\n const uniqueIds = [...new Set(currentValue)] as string[];\n\n const cache = cacheRef.current;\n const newIds = uniqueIds.filter(id => !cache.has(id));\n\n if (newIds.length > 0) {\n const promises = newIds.map(async (id: string) => {\n try {\n const file = await getFileQuery(id).unwrap();\n const fileDetails = {\n id: file.id,\n url: file.url,\n name: file.name,\n };\n cache.set(id, fileDetails);\n return fileDetails;\n } catch {\n const fallback = { id, url: '' };\n cache.set(id, fallback);\n return fallback;\n }\n });\n await Promise.all(promises);\n }\n\n const results = uniqueIds.map(id => cache.get(id)!);\n setFilesDetails(results);\n } catch {\n setFilesDetails(currentValue.map((id: string) => ({ id, url: '' })));\n }\n };\n fetchFiles();\n }, [currentValue, getFileQuery]);\n\n const handleFilesSelect = (files: FileDetails[]) => {\n const newIds = files.map(file => file.id);\n const updatedIds = [...new Set([...currentValue, ...newIds])];\n setValue(name, updatedIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n const handleRemove = (file?: { id: string }) => {\n if (!file) return;\n const updatedIds = currentValue.filter((id: string) => id !== file.id);\n setValue(name, updatedIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n const handleReorder = (oldIndex: number, newIndex: number) => {\n const newIds = [...currentValue];\n const [removed] = newIds.splice(oldIndex, 1);\n newIds.splice(newIndex, 0, removed);\n setValue(name, newIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n return {\n currentValue,\n filesDetails,\n handleFilesSelect,\n handleRemove,\n handleReorder,\n };\n};\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport MultiFileUploadComponent from 'components/FileUpload/MultipleFileUpload';\n\nimport { FormMultiFileUploadProps } from './props';\nimport { useMultiFileUpload } from './useFormFileUpload';\n\n/**\n * MultiFileUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado dos arquivos e retorna array de resource_file_ids\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { MultiFileUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * document_ids: [],\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.document_ids); // Array de IDs\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <MultiFileUpload\n * name=\"document_ids\"\n * label=\"Documentos\"\n * createFilesMutation={createFilesMutation}\n * maxFiles={5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst MultiFileUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n disableReorder,\n ...other\n}: FormMultiFileUploadProps) => {\n const { control } = useFormContext();\n const { filesDetails, handleFilesSelect, handleRemove, handleReorder } =\n useMultiFileUpload(name, getFileQuery);\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <MultiFileUploadComponent\n name={name}\n filesDetails={filesDetails}\n createFilesMutation={createFilesMutation}\n onFilesSelect={handleFilesSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n onReorder={disableReorder ? undefined : handleReorder}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default MultiFileUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport MultiImageUploadComponent from 'components/FileUpload/MultipleImageUpload';\n\nimport { FormMultiImageUploadProps } from './props';\nimport { useMultiFileUpload } from './useFormFileUpload';\n\n/**\n * MultiImageUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado dos arquivos e retorna array de resource_file_ids\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { MultiImageUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * image_ids: [],\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.image_ids); // Array de IDs\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <MultiImageUpload\n * name=\"image_ids\"\n * label=\"Imagens\"\n * createFilesMutation={createFilesMutation}\n * maxFiles={5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst MultiImageUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n disableReorder,\n ...other\n}: FormMultiImageUploadProps) => {\n const { control } = useFormContext();\n const { filesDetails, handleFilesSelect, handleRemove, handleReorder } =\n useMultiFileUpload(name, getFileQuery);\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <MultiImageUploadComponent\n name={name}\n filesDetails={filesDetails}\n createFilesMutation={createFilesMutation}\n onFilesSelect={handleFilesSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n onReorder={disableReorder ? undefined : handleReorder}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default MultiImageUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleFileUploadComponent from 'components/FileUpload/SingleFileUpload';\n\nimport { FormSingleFileUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * SingleFileUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { SingleFileUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * document_id: null,\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.document_id); // ID do arquivo\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <SingleFileUpload\n * name=\"document_id\"\n * label=\"Documento\"\n * createFilesMutation={createFilesMutation}\n * maxSize={1024 * 1024 * 10}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst SingleFileUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n ...other\n}: FormSingleFileUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleFileUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default SingleFileUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleImageUploadComponent from 'components/FileUpload/SingleImageUpload';\n\nimport { FormSingleImageUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * SingleImageUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { SingleImageUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * resource_id: null,\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.resource_id); // ID do arquivo\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <SingleImageUpload\n * name=\"resource_id\"\n * label=\"Imagem\"\n * createFilesMutation={createFilesMutation}\n * maxSize={1024 * 1024 * 5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst SingleImageUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n hoverAlt,\n ...other\n}: FormSingleImageUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleImageUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n error={error?.message}\n hoverAlt={hoverAlt}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default SingleImageUpload;\n"]}
1
+ {"version":3,"sources":["../../../../src/components/form/FileUpload/AvatarUpload.tsx","../../../../src/components/form/FileUpload/useFormFileUpload.ts","../../../../src/components/form/FileUpload/MultiFileUpload.tsx","../../../../src/components/form/FileUpload/MultiImageUpload.tsx","../../../../src/components/form/FileUpload/SingleFileUpload.tsx","../../../../src/components/form/FileUpload/SingleImageUpload.tsx"],"names":["Controller","useFormContext","useEffect","useMemo","useRef","useState","useSingleFileUpload","name","getFileQuery","setValue","watch","value","fileDetails","setFileDetails","file","useMultiFileUpload","watchedValue","currentValue","filesDetails","setFilesDetails","cacheRef","uniqueIds","cache","newIds","id","promises","fallback","results","files","updatedIds","oldIndex","newIndex","removed","jsx","AvatarUpload","rules","createFilesMutation","disableRemove","aspectRatio","enableCrop","maxSize","other","control","handleFileSelect","handleRemove","error","SingleImageUpload_default","AvatarUpload_default","MultiFileUpload","disableReorder","handleFilesSelect","handleReorder","MultipleFileUpload_default","MultiFileUpload_default","MultiImageUpload","MultipleImageUpload_default","MultiImageUpload_default","SingleFileUpload","SingleFileUpload_default","SingleImageUpload","hoverAlt"],"mappings":"yiBAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBCA3C,OAAS,aAAAC,EAAW,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QACrD,OA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C,EAAA,CACC,KAAMO,EACN,QAASmC,EACT,MAAOP,EACP,OAAQ,CAAC,CAAE,WAAY,CAAE,MAAAU,CAAM,CAAE,IAC/BZ,EAACyB,EAAA,CACC,KAAMnD,EACN,YAAaK,EACb,oBAAqBwB,EACrB,aAAcO,EACd,SAAUN,EAAgB,OAAYO,EACtC,MAAOC,GAAO,QACb,GAAGJ,EACN,EAEJ,CAEJ,EAEOiB,EAAQD,EC5Ef,OAAS,cAAAzD,EAAY,kBAAAC,OAAsB,kBA+DnC,cAAAgC,MAAA,oBArBR,IAAM0B,GAAoB,CAAC,CACzB,KAAApD,EACA,MAAA4B,EACA,oBAAAC,EACA,aAAA5B,EACA,cAAA6B,EACA,SAAAuB,EACA,GAAGnB,CACL,IAAkC,CAChC,GAAM,CAAE,QAAAC,CAAQ,EAAIzC,GAAe,EAC7B,CAAE,YAAAW,EAAa,iBAAA+B,EAAkB,aAAAC,CAAa,EAAItC,EACtDC,EACAC,CACF,EAEA,OACEyB,EAACjC,EAAA,CACC,KAAMO,EACN,QAASmC,EACT,MAAOP,EACP,OAAQ,CAAC,CAAE,WAAY,CAAE,MAAAU,CAAM,CAAE,IAC/BZ,EAACa,EAAA,CACC,KAAMvC,EACN,YAAaK,EACb,oBAAqBwB,EACrB,aAAcO,EACd,SAAUN,EAAgB,OAAYO,EACtC,MAAOC,GAAO,QACd,SAAUe,EACT,GAAGnB,EACN,EAEJ,CAEJ,EAEOK,GAAQa","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleImageUploadComponent from 'components/FileUpload/SingleImageUpload';\n\nimport { FormSingleImageUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * AvatarUpload integrado ao React Hook Form\n * Componente especializado para upload de avatar (imagem circular de perfil)\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { AvatarUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation, useGetFileQuery } from 'services/filesApi';\n *\n * interface FormData {\n * avatar_id: string | null;\n * }\n *\n * const ProfileForm = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const getFileQuery = useGetFileQuery();\n * const methods = useForm<FormData>();\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <AvatarUpload\n * name=\"avatar_id\"\n * createFilesMutation={createFilesMutation}\n * getFileQuery={getFileQuery}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst AvatarUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n aspectRatio = 1,\n enableCrop = true,\n maxSize = 5242880,\n ...other\n}: FormSingleImageUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleImageUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n aspectRatio={aspectRatio}\n enableCrop={enableCrop}\n maxSize={maxSize}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default AvatarUpload;\n","import { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { FileDetails } from 'components/FileUpload/props';\n\nimport { LazyQueryTrigger } from './props';\n\n/**\n * Hook para gerenciar upload de arquivo único\n */\nexport const useSingleFileUpload = (\n name: string,\n getFileQuery: LazyQueryTrigger,\n) => {\n const { setValue, watch } = useFormContext();\n const value = watch(name);\n const [fileDetails, setFileDetails] = useState<FileDetails | undefined>();\n\n useEffect(() => {\n if (!value) {\n setFileDetails(undefined);\n return;\n }\n const fetchFile = async () => {\n try {\n const file = await getFileQuery(value).unwrap();\n setFileDetails({\n id: file.id,\n url: file.url,\n name: file.name,\n });\n } catch {\n setFileDetails({ id: value, url: '' });\n }\n };\n fetchFile();\n }, [value, getFileQuery]);\n\n const handleFileSelect = (file: FileDetails) => {\n setValue(name, file.id, { shouldValidate: true, shouldDirty: true });\n };\n\n const handleRemove = () => {\n setValue(name, null, { shouldValidate: true, shouldDirty: true });\n };\n\n return {\n fileDetails,\n handleFileSelect,\n handleRemove,\n };\n};\n\n/**\n * Hook para gerenciar upload de múltiplos arquivos\n */\nexport const useMultiFileUpload = (\n name: string,\n getFileQuery: LazyQueryTrigger,\n) => {\n const { setValue, watch } = useFormContext();\n const watchedValue = watch(name);\n const currentValue = useMemo(() => watchedValue || [], [watchedValue]);\n const [filesDetails, setFilesDetails] = useState<FileDetails[]>([]);\n const cacheRef = useRef<Map<string, FileDetails>>(new Map());\n\n useEffect(() => {\n if (!currentValue || currentValue.length === 0) {\n setFilesDetails([]);\n return;\n }\n const fetchFiles = async () => {\n try {\n // Remove duplicatas mantendo a ordem\n const uniqueIds = [...new Set(currentValue)] as string[];\n\n const cache = cacheRef.current;\n const newIds = uniqueIds.filter(id => !cache.has(id));\n\n if (newIds.length > 0) {\n const promises = newIds.map(async (id: string) => {\n try {\n const file = await getFileQuery(id).unwrap();\n const fileDetails = {\n id: file.id,\n url: file.url,\n name: file.name,\n };\n cache.set(id, fileDetails);\n return fileDetails;\n } catch {\n const fallback = { id, url: '' };\n cache.set(id, fallback);\n return fallback;\n }\n });\n await Promise.all(promises);\n }\n\n const results = uniqueIds.map(id => cache.get(id)!);\n setFilesDetails(results);\n } catch {\n setFilesDetails(currentValue.map((id: string) => ({ id, url: '' })));\n }\n };\n fetchFiles();\n }, [currentValue, getFileQuery]);\n\n const handleFilesSelect = (files: FileDetails[]) => {\n const newIds = files.map(file => file.id);\n const updatedIds = [...new Set([...currentValue, ...newIds])];\n setValue(name, updatedIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n const handleRemove = (file?: { id: string }) => {\n if (!file) return;\n const updatedIds = currentValue.filter((id: string) => id !== file.id);\n setValue(name, updatedIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n const handleReorder = (oldIndex: number, newIndex: number) => {\n const newIds = [...currentValue];\n const [removed] = newIds.splice(oldIndex, 1);\n newIds.splice(newIndex, 0, removed);\n setValue(name, newIds, {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n return {\n currentValue,\n filesDetails,\n handleFilesSelect,\n handleRemove,\n handleReorder,\n };\n};\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport MultiFileUploadComponent from 'components/FileUpload/MultipleFileUpload';\n\nimport { FormMultiFileUploadProps } from './props';\nimport { useMultiFileUpload } from './useFormFileUpload';\n\n/**\n * MultiFileUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado dos arquivos e retorna array de resource_file_ids\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { MultiFileUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * document_ids: [],\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.document_ids); // Array de IDs\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <MultiFileUpload\n * name=\"document_ids\"\n * label=\"Documentos\"\n * createFilesMutation={createFilesMutation}\n * maxFiles={5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst MultiFileUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n disableReorder,\n ...other\n}: FormMultiFileUploadProps) => {\n const { control } = useFormContext();\n const { filesDetails, handleFilesSelect, handleRemove, handleReorder } =\n useMultiFileUpload(name, getFileQuery);\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <MultiFileUploadComponent\n name={name}\n filesDetails={filesDetails}\n createFilesMutation={createFilesMutation}\n onFilesSelect={handleFilesSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n onReorder={disableReorder ? undefined : handleReorder}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default MultiFileUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport MultiImageUploadComponent from 'components/FileUpload/MultipleImageUpload';\n\nimport { FormMultiImageUploadProps } from './props';\nimport { useMultiFileUpload } from './useFormFileUpload';\n\n/**\n * MultiImageUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado dos arquivos e retorna array de resource_file_ids\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { MultiImageUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * image_ids: [],\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.image_ids); // Array de IDs\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <MultiImageUpload\n * name=\"image_ids\"\n * label=\"Imagens\"\n * createFilesMutation={createFilesMutation}\n * maxFiles={5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst MultiImageUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n disableReorder,\n ...other\n}: FormMultiImageUploadProps) => {\n const { control } = useFormContext();\n const { filesDetails, handleFilesSelect, handleRemove, handleReorder } =\n useMultiFileUpload(name, getFileQuery);\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <MultiImageUploadComponent\n name={name}\n filesDetails={filesDetails}\n createFilesMutation={createFilesMutation}\n onFilesSelect={handleFilesSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n onReorder={disableReorder ? undefined : handleReorder}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default MultiImageUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleFileUploadComponent from 'components/FileUpload/SingleFileUpload';\n\nimport { FormSingleFileUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * SingleFileUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { SingleFileUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * document_id: null,\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.document_id); // ID do arquivo\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <SingleFileUpload\n * name=\"document_id\"\n * label=\"Documento\"\n * createFilesMutation={createFilesMutation}\n * maxSize={1024 * 1024 * 10}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst SingleFileUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n ...other\n}: FormSingleFileUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleFileUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n error={error?.message}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default SingleFileUpload;\n","import { Controller, useFormContext } from 'react-hook-form';\n\nimport SingleImageUploadComponent from 'components/FileUpload/SingleImageUpload';\n\nimport { FormSingleImageUploadProps } from './props';\nimport { useSingleFileUpload } from './useFormFileUpload';\n\n/**\n * SingleImageUpload integrado ao React Hook Form\n * Gerencia automaticamente o estado do arquivo e retorna apenas o resource_file_id\n *\n * @example\n * ```tsx\n * import { Form } from 'components/form';\n * import { SingleImageUpload } from 'components/form/FileUpload';\n * import { useCreateFilesMutation } from 'services/filesApi';\n *\n * const FormExample = () => {\n * const createFilesMutation = useCreateFilesMutation();\n * const methods = useForm({\n * defaultValues: {\n * resource_id: null,\n * },\n * });\n *\n * const handleSubmit = (data: any) => {\n * console.log(data.resource_id); // ID do arquivo\n * };\n *\n * return (\n * <Form methods={methods} onSubmit={handleSubmit}>\n * <SingleImageUpload\n * name=\"resource_id\"\n * label=\"Imagem\"\n * createFilesMutation={createFilesMutation}\n * maxSize={1024 * 1024 * 5}\n * />\n * </Form>\n * );\n * };\n * ```\n */\nconst SingleImageUpload = ({\n name,\n rules,\n createFilesMutation,\n getFileQuery,\n disableRemove,\n hoverAlt,\n ...other\n}: FormSingleImageUploadProps) => {\n const { control } = useFormContext();\n const { fileDetails, handleFileSelect, handleRemove } = useSingleFileUpload(\n name,\n getFileQuery,\n );\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ fieldState: { error } }) => (\n <SingleImageUploadComponent\n name={name}\n fileDetails={fileDetails}\n createFilesMutation={createFilesMutation}\n onFileSelect={handleFileSelect}\n onRemove={disableRemove ? undefined : handleRemove}\n error={error?.message}\n hoverAlt={hoverAlt}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default SingleImageUpload;\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CustomShadows } from './index-c8f1e6e7.js';
2
- export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-c8f1e6e7.js';
1
+ import { C as CustomShadows } from './index-5a5e5dc8.js';
2
+ export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-5a5e5dc8.js';
3
3
  export { S as SettingsContextValue, _ as SettingsProvider, T as ThemeProviderProps, u as useSettingsContext } from './settings-provider-38d09283.js';
4
4
  export { THEME_CONFIG, default as ThemeProvider } from './theme/theme-provider.js';
5
5
  import { S as SettingsState } from './settings-583c107c.js';
@@ -1,4 +1,4 @@
1
- export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-c8f1e6e7.js';
1
+ export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-5a5e5dc8.js';
2
2
  import '@mui/lab/TimelineConnector';
3
3
  import '@mui/system';
4
4
  import '@mui/lab/TimelineDot';
@@ -173,7 +173,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
173
173
  float?: csstype.Property.Float | readonly NonNullable<csstype.Property.Float | undefined>[] | readonly csstype.Property.Float[] | undefined;
174
174
  floodColor?: readonly string[] | csstype.Property.FloodColor | readonly csstype.Property.FloodColor[] | undefined;
175
175
  floodOpacity?: readonly ((string & {}) | csstype.Globals)[] | csstype.Property.FloodOpacity | readonly NonNullable<csstype.Property.FloodOpacity | undefined>[] | undefined;
176
- fontFamily?: readonly string[] | csstype.Property.FontFamily | readonly csstype.Property.FontFamily[] | undefined;
176
+ fontFamily?: csstype.Property.FontFamily | readonly string[] | readonly csstype.Property.FontFamily[] | undefined;
177
177
  fontFeatureSettings?: readonly string[] | csstype.Property.FontFeatureSettings | readonly csstype.Property.FontFeatureSettings[] | undefined;
178
178
  fontKerning?: csstype.Property.FontKerning | readonly NonNullable<csstype.Property.FontKerning | undefined>[] | readonly csstype.Property.FontKerning[] | undefined;
179
179
  fontLanguageOverride?: readonly string[] | csstype.Property.FontLanguageOverride | readonly csstype.Property.FontLanguageOverride[] | undefined;
@@ -197,7 +197,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
197
197
  fontVariantNumeric?: readonly string[] | csstype.Property.FontVariantNumeric | readonly csstype.Property.FontVariantNumeric[] | undefined;
198
198
  fontVariantPosition?: csstype.Property.FontVariantPosition | readonly NonNullable<csstype.Property.FontVariantPosition | undefined>[] | readonly csstype.Property.FontVariantPosition[] | undefined;
199
199
  fontVariationSettings?: readonly string[] | csstype.Property.FontVariationSettings | readonly csstype.Property.FontVariationSettings[] | undefined;
200
- fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ("bold" | (string & {}) | csstype.Globals | "normal" | "bolder" | "lighter")[] | undefined;
200
+ fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ((string & {}) | csstype.Globals | "bold" | "normal" | "bolder" | "lighter")[] | undefined;
201
201
  fontWidth?: readonly string[] | csstype.Property.FontWidth | readonly csstype.Property.FontWidth[] | undefined;
202
202
  forcedColorAdjust?: csstype.Property.ForcedColorAdjust | readonly NonNullable<csstype.Property.ForcedColorAdjust | undefined>[] | readonly csstype.Property.ForcedColorAdjust[] | undefined;
203
203
  gridAutoColumns?: readonly (string | (string & {}))[] | csstype.Property.GridAutoColumns<string | number> | readonly NonNullable<csstype.Property.GridAutoColumns<string | number> | undefined>[] | undefined;
@@ -462,7 +462,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
462
462
  zIndex?: readonly ((string & {}) | csstype.Globals | "auto")[] | csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | undefined;
463
463
  zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
464
464
  all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
465
- animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
465
+ animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
466
466
  animationRange?: readonly (string | (string & {}))[] | csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | undefined;
467
467
  background?: readonly (string | (string & {}))[] | csstype.Property.Background<string | number> | readonly NonNullable<csstype.Property.Background<string | number> | undefined>[] | undefined;
468
468
  border?: readonly (string | (string & {}))[] | csstype.Property.Border<string | number> | readonly NonNullable<csstype.Property.Border<string | number> | undefined>[] | undefined;
@@ -474,7 +474,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
474
474
  borderBlockWidth?: readonly (string | (string & {}))[] | csstype.Property.BorderBlockWidth<string | number> | readonly NonNullable<csstype.Property.BorderBlockWidth<string | number> | undefined>[] | undefined;
475
475
  borderBottom?: readonly (string | (string & {}))[] | csstype.Property.BorderBottom<string | number> | readonly NonNullable<csstype.Property.BorderBottom<string | number> | undefined>[] | undefined;
476
476
  borderColor?: readonly string[] | csstype.Property.BorderColor | readonly csstype.Property.BorderColor[] | undefined;
477
- borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
477
+ borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
478
478
  borderInline?: readonly (string | (string & {}))[] | csstype.Property.BorderInline<string | number> | readonly NonNullable<csstype.Property.BorderInline<string | number> | undefined>[] | undefined;
479
479
  borderInlineColor?: readonly string[] | csstype.Property.BorderInlineColor | readonly csstype.Property.BorderInlineColor[] | undefined;
480
480
  borderInlineEnd?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineEnd<string | number> | readonly NonNullable<csstype.Property.BorderInlineEnd<string | number> | undefined>[] | undefined;
@@ -509,7 +509,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
509
509
  marginBlock?: readonly (string | (string & {}))[] | csstype.Property.MarginBlock<string | number> | readonly NonNullable<csstype.Property.MarginBlock<string | number> | undefined>[] | undefined;
510
510
  marginInline?: readonly (string | (string & {}))[] | csstype.Property.MarginInline<string | number> | readonly NonNullable<csstype.Property.MarginInline<string | number> | undefined>[] | undefined;
511
511
  mask?: readonly (string | (string & {}))[] | csstype.Property.Mask<string | number> | readonly NonNullable<csstype.Property.Mask<string | number> | undefined>[] | undefined;
512
- maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
512
+ maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
513
513
  motion?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
514
514
  offset?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
515
515
  outline?: readonly (string | (string & {}))[] | csstype.Property.Outline<string | number> | readonly NonNullable<csstype.Property.Outline<string | number> | undefined>[] | undefined;
@@ -758,8 +758,8 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
758
758
  WebkitUserModify?: csstype.Property.WebkitUserModify | readonly NonNullable<csstype.Property.WebkitUserModify | undefined>[] | readonly csstype.Property.WebkitUserModify[] | undefined;
759
759
  WebkitUserSelect?: csstype.Property.WebkitUserSelect | readonly NonNullable<csstype.Property.WebkitUserSelect | undefined>[] | readonly csstype.Property.WebkitUserSelect[] | undefined;
760
760
  WebkitWritingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
761
- MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
762
- MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
761
+ MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
762
+ MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
763
763
  MozColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
764
764
  MozColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
765
765
  MozOutlineRadius?: readonly (string | (string & {}))[] | csstype.Property.MozOutlineRadius<string | number> | readonly NonNullable<csstype.Property.MozOutlineRadius<string | number> | undefined>[] | undefined;
@@ -771,16 +771,16 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
771
771
  msScrollSnapX?: readonly string[] | csstype.Property.MsScrollSnapX | readonly csstype.Property.MsScrollSnapX[] | undefined;
772
772
  msScrollSnapY?: readonly string[] | csstype.Property.MsScrollSnapY | readonly csstype.Property.MsScrollSnapY[] | undefined;
773
773
  msTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
774
- WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
774
+ WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
775
775
  WebkitBorderBefore?: readonly (string | (string & {}))[] | csstype.Property.WebkitBorderBefore<string | number> | readonly NonNullable<csstype.Property.WebkitBorderBefore<string | number> | undefined>[] | undefined;
776
- WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
776
+ WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
777
777
  WebkitBorderRadius?: readonly (string | (string & {}))[] | csstype.Property.BorderRadius<string | number> | readonly NonNullable<csstype.Property.BorderRadius<string | number> | undefined>[] | undefined;
778
778
  WebkitColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
779
779
  WebkitColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
780
780
  WebkitFlex?: readonly (string | (string & {}))[] | csstype.Property.Flex<string | number> | readonly NonNullable<csstype.Property.Flex<string | number> | undefined>[] | undefined;
781
781
  WebkitFlexFlow?: readonly string[] | csstype.Property.FlexFlow | readonly csstype.Property.FlexFlow[] | undefined;
782
782
  WebkitMask?: readonly (string | (string & {}))[] | csstype.Property.WebkitMask<string | number> | readonly NonNullable<csstype.Property.WebkitMask<string | number> | undefined>[] | undefined;
783
- WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
783
+ WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
784
784
  WebkitTextEmphasis?: readonly string[] | csstype.Property.TextEmphasis | readonly csstype.Property.TextEmphasis[] | undefined;
785
785
  WebkitTextStroke?: readonly (string | (string & {}))[] | csstype.Property.WebkitTextStroke<string | number> | readonly NonNullable<csstype.Property.WebkitTextStroke<string | number> | undefined>[] | undefined;
786
786
  WebkitTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
@@ -861,7 +861,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
861
861
  MozUserFocus?: csstype.Property.MozUserFocus | readonly NonNullable<csstype.Property.MozUserFocus | undefined>[] | readonly csstype.Property.MozUserFocus[] | undefined;
862
862
  MozUserInput?: csstype.Property.MozUserInput | readonly NonNullable<csstype.Property.MozUserInput | undefined>[] | readonly csstype.Property.MozUserInput[] | undefined;
863
863
  msImeMode?: csstype.Property.ImeMode | readonly NonNullable<csstype.Property.ImeMode | undefined>[] | readonly csstype.Property.ImeMode[] | undefined;
864
- OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
864
+ OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
865
865
  OAnimationDelay?: readonly string[] | csstype.Property.AnimationDelay<string & {}> | readonly csstype.Property.AnimationDelay<string & {}>[] | undefined;
866
866
  OAnimationDirection?: readonly string[] | csstype.Property.AnimationDirection | readonly csstype.Property.AnimationDirection[] | undefined;
867
867
  OAnimationDuration?: readonly string[] | csstype.Property.AnimationDuration<string & {}> | readonly csstype.Property.AnimationDuration<string & {}>[] | undefined;
@@ -871,7 +871,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
871
871
  OAnimationPlayState?: readonly string[] | csstype.Property.AnimationPlayState | readonly csstype.Property.AnimationPlayState[] | undefined;
872
872
  OAnimationTimingFunction?: readonly string[] | csstype.Property.AnimationTimingFunction | readonly csstype.Property.AnimationTimingFunction[] | undefined;
873
873
  OBackgroundSize?: readonly (string | (string & {}))[] | csstype.Property.BackgroundSize<string | number> | readonly NonNullable<csstype.Property.BackgroundSize<string | number> | undefined>[] | undefined;
874
- OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
874
+ OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
875
875
  OObjectFit?: csstype.Property.ObjectFit | readonly NonNullable<csstype.Property.ObjectFit | undefined>[] | readonly csstype.Property.ObjectFit[] | undefined;
876
876
  OObjectPosition?: readonly (string | (string & {}))[] | csstype.Property.ObjectPosition<string | number> | readonly NonNullable<csstype.Property.ObjectPosition<string | number> | undefined>[] | undefined;
877
877
  OTabSize?: readonly (string | (string & {}))[] | csstype.Property.TabSize<string | number> | readonly NonNullable<csstype.Property.TabSize<string | number> | undefined>[] | undefined;
@@ -0,0 +1,3 @@
1
+ declare const isMobileDevice: () => boolean;
2
+
3
+ export { isMobileDevice };
@@ -0,0 +1,5 @@
1
+ var e=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
2
+
3
+ export { e as isMobileDevice };
4
+ //# sourceMappingURL=out.js.map
5
+ //# sourceMappingURL=mobile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/mobile.ts"],"names":["isMobileDevice"],"mappings":"AAIO,IAAMA,EAAiB,IAC5B,iEAAiE,KAC/D,UAAU,SACZ","sourcesContent":["/**\n * Verifica se o dispositivo atual é um dispositivo móvel\n * baseado no User Agent do navegador.\n */\nexport const isMobileDevice = (): boolean =>\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent,\n );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.7.85",
3
+ "version": "2.7.87",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",