@m4l/components 9.2.28 → 9.2.30

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.
Files changed (59) hide show
  1. package/@types/types.d.ts +8 -0
  2. package/components/Label/Label.js +5 -4
  3. package/components/Label/Label.styles.js +7 -44
  4. package/components/Label/test/Label.test.d.ts +1 -0
  5. package/components/Label/types.d.ts +6 -4
  6. package/components/MFIsolationApp/MFIsolationApp.js +4 -4
  7. package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
  8. package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
  9. package/components/hook-form/RHFSelect/RHFSelect.js +0 -2
  10. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
  11. package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +1 -1
  12. package/components/hook-form/RHFTimePicker/slots/RHFTimePickerEnum.d.ts +4 -1
  13. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.d.ts +7 -0
  14. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +74 -0
  15. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.styles.d.ts +2 -0
  16. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.styles.js +147 -0
  17. package/components/hook-form/RHFUpload/RHFUploadSingleFile/constants.d.ts +23 -0
  18. package/components/hook-form/RHFUpload/RHFUploadSingleFile/constants.js +34 -0
  19. package/components/hook-form/RHFUpload/RHFUploadSingleFile/dictionary.d.ts +15 -0
  20. package/components/hook-form/RHFUpload/RHFUploadSingleFile/dictionary.js +15 -0
  21. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/formatFileSize.d.ts +6 -0
  22. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/formatFileSize.js +16 -0
  23. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/getReadableFileType.d.ts +6 -0
  24. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/getReadableFileType.js +55 -0
  25. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/uploadReducer.d.ts +5 -0
  26. package/components/hook-form/RHFUpload/RHFUploadSingleFile/helpers/uploadReducer.js +17 -0
  27. package/components/hook-form/RHFUpload/RHFUploadSingleFile/index.d.ts +1 -0
  28. package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileEnum.d.ts +22 -0
  29. package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileEnum.js +26 -0
  30. package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +60 -0
  31. package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.js +110 -0
  32. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/BlockContent/BlockContent.d.ts +5 -0
  33. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/BlockContent/BlockContent.js +77 -0
  34. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/BlockContent/types.d.ts +5 -0
  35. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/Preview/Preview.d.ts +5 -0
  36. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/Preview/Preview.js +36 -0
  37. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/Preview/types.d.ts +6 -0
  38. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/UploadSingleFile/index.d.ts +5 -0
  39. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/UploadSingleFile/index.js +89 -0
  40. package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/UploadSingleFile/types.d.ts +38 -0
  41. package/components/hook-form/RHFUpload/RHFUploadSingleFile/test/RHFUploadsinglefile.test.d.ts +1 -0
  42. package/components/hook-form/RHFUpload/RHFUploadSingleFile/types.d.ts +42 -0
  43. package/components/hook-form/index.d.ts +1 -1
  44. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +1 -1
  45. package/components/mui_extended/Button/ButtonStyles.js +88 -59
  46. package/components/mui_extended/LinearProgress/index.js +1 -1
  47. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
  48. package/index.js +2 -2
  49. package/package.json +1 -1
  50. package/storybook/components/Label/Label.stories.d.ts +6 -4
  51. package/storybook/hook-form/RHFUploadSingleFile/RHFUploadSingleFile.stories.d.ts +11 -0
  52. package/components/MFIsolationApp/constants.js +0 -4
  53. package/components/hook-form/RHFUpload/RHFUploadFile/components/UploadSingleFile/index.d.ts +0 -13
  54. package/components/hook-form/RHFUpload/RHFUploadFile/components/UploadSingleFile/index.js +0 -84
  55. package/components/hook-form/RHFUpload/RHFUploadFile/index.d.ts +0 -9
  56. package/components/hook-form/RHFUpload/RHFUploadFile/index.js +0 -31
  57. package/components/hook-form/RHFUpload/components/UploadComponents/BlockContent.js +0 -36
  58. package/components/hook-form/RHFUpload/components/UploadComponents/RejectionFiles.js +0 -31
  59. package/storybook/hook-form/RHFUploadImage/RHFUploadFile.stories.d.ts +0 -6
@@ -10,7 +10,9 @@ import { Label } from '../../../src/components/Label/Label';
10
10
  declare const meta: Meta<typeof Label>;
11
11
  export default meta;
12
12
  type Story = StoryObj<typeof Label>;
13
- /** Label component Props Comunes */
14
- export declare const LabelDefault: Story;
15
- /** Label component mode Skeleton With props `helperMessage` */
16
- export declare const LabelDefaultSkeleton: Story;
13
+ /** Label component con helperMessage como string */
14
+ export declare const LabelWithTooltip: Story;
15
+ /** Label component sin tooltip de ayuda */
16
+ export declare const LabelWithoutHelper: Story;
17
+ /** Label component mode Skeleton With props `helperMessage` */
18
+ export declare const Skeleton: Story;
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { RHFUploadSingleFile } from '../../../src/components/hook-form/RHFUpload/RHFUploadSingleFile';
3
+ declare const meta: Meta<typeof RHFUploadSingleFile>;
4
+ type Story = StoryObj<typeof RHFUploadSingleFile>;
5
+ export declare const RHFUploadSingleFileDefault: Story;
6
+ export declare const RHFUploadSingleFileError: Story;
7
+ /**
8
+ * Skeleton State
9
+ */
10
+ export declare const RHFUploadSingleFileSkeleton: Story;
11
+ export default meta;
@@ -1,4 +0,0 @@
1
- const TOAST_CONTAINER_ID = "toast-host";
2
- export {
3
- TOAST_CONTAINER_ID as T
4
- };
@@ -1,13 +0,0 @@
1
- import { DropzoneProps } from 'react-dropzone';
2
- interface UploadProps extends DropzoneProps {
3
- error?: boolean;
4
- file: any;
5
- helperText?: React.ReactNode;
6
- sx?: any;
7
- onChange?: (...event: any[]) => void;
8
- }
9
- /**
10
- * todo: document this component
11
- */
12
- export default function UploadSingleFile({ error, file, helperText, sx, accept, onChange, ...other }: UploadProps): import("react/jsx-runtime").JSX.Element;
13
- export {};
@@ -1,84 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import isString from "lodash-es/isString";
3
- import { useDropzone } from "react-dropzone";
4
- import { useState, useEffect } from "react";
5
- import { styled } from "@mui/material/styles";
6
- import { Box } from "@mui/material";
7
- import { B as BlockContent } from "../../../components/UploadComponents/BlockContent.js";
8
- import { R as RejectionFiles } from "../../../components/UploadComponents/RejectionFiles.js";
9
- import { I as Image } from "../../../../../Image/Image.js";
10
- const DropZoneStyle = styled("div")(({ theme }) => ({
11
- outline: "none",
12
- overflow: "hidden",
13
- position: "relative",
14
- padding: theme.spacing(5, 1),
15
- borderRadius: theme.shape.borderRadius,
16
- transition: theme.transitions.create("padding"),
17
- backgroundColor: theme.vars.palette.background.neutral,
18
- border: `1px dashed ${theme.vars.palette.grey[50032]}`,
19
- "&:hover": { opacity: 0.72, cursor: "pointer" }
20
- }));
21
- function UploadSingleFile({
22
- error = false,
23
- file,
24
- helperText,
25
- sx,
26
- accept,
27
- onChange,
28
- ...other
29
- }) {
30
- const { getRootProps, getInputProps, isDragActive, isDragReject, fileRejections } = useDropzone({
31
- multiple: false,
32
- accept,
33
- /**
34
- * todo: document this component
35
- */
36
- onDrop: (acceptedFiles) => {
37
- if (acceptedFiles.length > 0) {
38
- onChange?.(acceptedFiles[0]);
39
- }
40
- },
41
- ...other
42
- });
43
- const [preview, setPreview] = useState(null);
44
- useEffect(() => {
45
- if (file instanceof File) {
46
- const objectUrl = URL.createObjectURL(file);
47
- setPreview(objectUrl);
48
- return () => URL.revokeObjectURL(objectUrl);
49
- } else if (isString(file)) {
50
- setPreview(file);
51
- } else {
52
- setPreview(null);
53
- }
54
- }, [file]);
55
- return /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", ...sx }, children: [
56
- /* @__PURE__ */ jsxs(
57
- DropZoneStyle,
58
- {
59
- ...getRootProps(),
60
- sx: {
61
- ...isDragActive && { opacity: 0.72 },
62
- ...(isDragReject || error) && {
63
- color: "error.enabled",
64
- borderColor: "error.light",
65
- bgcolor: "error.lighter"
66
- },
67
- ...file && {
68
- padding: "12% 0"
69
- }
70
- },
71
- children: [
72
- !preview && /* @__PURE__ */ jsx(BlockContent, {}),
73
- /* @__PURE__ */ jsx("input", { ...getInputProps() }),
74
- preview && /* @__PURE__ */ jsx(Image, { alt: "file preview", src: preview })
75
- ]
76
- }
77
- ),
78
- fileRejections.length > 0 && /* @__PURE__ */ jsx(RejectionFiles, { fileRejections }),
79
- helperText && helperText
80
- ] });
81
- }
82
- export {
83
- UploadSingleFile as U
84
- };
@@ -1,9 +0,0 @@
1
- interface Props {
2
- name: string;
3
- [key: string]: any;
4
- }
5
- /**
6
- * todo: document this component
7
- */
8
- export declare function RHFUploadFile({ name, ...other }: Props): import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,31 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useFormContext, Controller } from "react-hook-form";
3
- import { U as UploadSingleFile } from "./components/UploadSingleFile/index.js";
4
- import { FormHelperText } from "@mui/material";
5
- function RHFUploadFile({ name, ...other }) {
6
- const { control } = useFormContext();
7
- return /* @__PURE__ */ jsx(
8
- Controller,
9
- {
10
- name,
11
- control,
12
- render: ({ field: { value, onChange }, fieldState: { error } }) => {
13
- const checkError = !!error && !value;
14
- return /* @__PURE__ */ jsx(
15
- UploadSingleFile,
16
- {
17
- accept: { "image/png": [".png"] },
18
- file: value,
19
- error: checkError,
20
- onChange,
21
- helperText: checkError && /* @__PURE__ */ jsx(FormHelperText, { error: true, sx: { px: 2 }, children: error.message }),
22
- ...other
23
- }
24
- );
25
- }
26
- }
27
- );
28
- }
29
- export {
30
- RHFUploadFile as R
31
- };
@@ -1,36 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { Stack, Box, Typography } from "@mui/material";
3
- function BlockContent() {
4
- return /* @__PURE__ */ jsxs(
5
- Stack,
6
- {
7
- spacing: 2,
8
- alignItems: "center",
9
- justifyContent: "center",
10
- direction: { xs: "column", md: "row" },
11
- sx: { width: 1, textAlign: { xs: "center", md: "left" } },
12
- children: [
13
- /* @__PURE__ */ jsx("img", { src: "\nhttps://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/sidebar/assets/icons/arrow_right.svg", alt: "upload" }),
14
- /* @__PURE__ */ jsxs(Box, { sx: { p: 3 }, children: [
15
- /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h5", children: "Drop or Select file" }),
16
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
17
- "Drop files here or click ",
18
- /* @__PURE__ */ jsx(
19
- Typography,
20
- {
21
- variant: "body2",
22
- component: "span",
23
- sx: { color: "primary.enabled", textDecoration: "underline" },
24
- children: "browse"
25
- }
26
- ),
27
- " thorough your machine"
28
- ] })
29
- ] })
30
- ]
31
- }
32
- );
33
- }
34
- export {
35
- BlockContent as B
36
- };
@@ -1,31 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { alpha } from "@mui/material/styles";
3
- import { Paper, Box, Typography } from "@mui/material";
4
- function RejectionFiles({ fileRejections }) {
5
- return /* @__PURE__ */ jsx(
6
- Paper,
7
- {
8
- variant: "outlined",
9
- sx: {
10
- py: 1,
11
- px: 2,
12
- mt: 3,
13
- borderColor: "error.light",
14
- bgcolor: (theme) => alpha(theme.colorSchemes.finalTheme.palette.error.enabled, 0.08)
15
- },
16
- children: fileRejections.map(({ file, errors }) => {
17
- const { path } = file;
18
- return /* @__PURE__ */ jsxs(Box, { sx: { my: 1 }, children: [
19
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", noWrap: true, children: path }),
20
- errors.map((error) => /* @__PURE__ */ jsxs(Typography, { variant: "caption", component: "p", children: [
21
- "- ",
22
- error.message
23
- ] }, error.code))
24
- ] }, path);
25
- })
26
- }
27
- );
28
- }
29
- export {
30
- RejectionFiles as R
31
- };
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { RHFUploadFile } from '../../../src/components/hook-form/RHFUpload/RHFUploadFile';
3
- declare const meta: Meta<typeof RHFUploadFile>;
4
- type Story = StoryObj<typeof RHFUploadFile>;
5
- export declare const RHFUploadFileDefault: Story;
6
- export default meta;