@m4l/components 9.1.107 → 9.1.108

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.
@@ -70,7 +70,7 @@ function LanguagePopover(props) {
70
70
  height: 28,
71
71
  ...open && { bgcolor: "action.selected" }
72
72
  },
73
- src: currentLocale?.url_icon || "",
73
+ src: currentLocale?.urlIcon || "",
74
74
  width: "24px",
75
75
  dataTestId
76
76
  }
@@ -121,7 +121,7 @@ function LanguagePopover(props) {
121
121
  Image,
122
122
  {
123
123
  alt: option.name,
124
- src: option.url_icon
124
+ src: option.urlIcon
125
125
  }
126
126
  ) }),
127
127
  /* @__PURE__ */ jsx(
@@ -1,3 +1,4 @@
1
+ import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
1
2
  import { g as getHeightSizeStyles } from "../../utils/getHeightSizeStyles.js";
2
3
  const numberInputStyles = {
3
4
  /**
@@ -64,7 +65,13 @@ const numberInputStyles = {
64
65
  width: "100%",
65
66
  ...ownerState.focusError && {
66
67
  color: theme.vars.palette.error.main
67
- }
68
+ },
69
+ ...getTypographyStyles(
70
+ theme.generalSettings.isMobile,
71
+ ownerState.size || "small",
72
+ "body"
73
+ ),
74
+ fontFamily: theme.typography.fontFamily
68
75
  }),
69
76
  /**
70
77
  * Estilos para envoltorio de boton y endAdornment
@@ -0,0 +1,5 @@
1
+ import { UploadMultiFileProps } from '../../types';
2
+ /**
3
+ * todo: document this component
4
+ */
5
+ export default function UploadMultiFile({ error, showPreview, files, onRemove, onRemoveAll, helperText, sx, ...other }: UploadMultiFileProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { UploadMultiFileProps } from './types';
2
+ export interface RHFUploadMultiFileProps extends Omit<UploadMultiFileProps, 'files'> {
3
+ name: string;
4
+ }
5
+ /**
6
+ * todo: document this component
7
+ */
8
+ export declare function RHFUploadMultiFile({ name, ...other }: RHFUploadMultiFileProps): import("react/jsx-runtime").JSX.Element;
@@ -2,9 +2,10 @@ import { ReactNode } from 'react';
2
2
  import { DropzoneOptions } from 'react-dropzone';
3
3
  import { SxProps } from '@mui/material';
4
4
  import { Theme } from '@mui/material/styles';
5
+ import { CustomFile } from '../components/UploadComponents/types';
5
6
  export interface UploadMultiFileProps extends DropzoneOptions {
6
7
  error?: boolean;
7
- files: (File | string)[];
8
+ files: CustomFile[];
8
9
  showPreview: boolean;
9
10
  onRemove: (file: File | string) => void;
10
11
  onRemoveAll: VoidFunction;
@@ -0,0 +1,13 @@
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 {};
@@ -0,0 +1,84 @@
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.main",
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
+ };
@@ -0,0 +1,9 @@
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 {};
@@ -0,0 +1,31 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * todo: document this component
3
+ */
4
+ export default function BlockContent(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
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.main", textDecoration: "underline" },
24
+ children: "browse"
25
+ }
26
+ ),
27
+ " thorough your machine"
28
+ ] })
29
+ ] })
30
+ ]
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ BlockContent as B
36
+ };
@@ -0,0 +1,5 @@
1
+ import { UploadMultiFileProps } from './types';
2
+ /**
3
+ * todo: document this component
4
+ */
5
+ export default function MultiFilePreview({ showPreview, files, onRemove, onRemoveAll, }: UploadMultiFileProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { FileRejection } from 'react-dropzone';
2
+ type Props = {
3
+ fileRejections: readonly FileRejection[];
4
+ };
5
+ /**
6
+ * todo: document this component
7
+ */
8
+ export default function RejectionFiles({ fileRejections }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,31 @@
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.main, 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
+ };
@@ -0,0 +1,10 @@
1
+ export type CustomFile = File & {
2
+ path?: string;
3
+ preview?: string;
4
+ };
5
+ export interface UploadMultiFileProps {
6
+ showPreview?: boolean;
7
+ files: CustomFile[];
8
+ onRemove: (file: CustomFile | string) => void;
9
+ onRemoveAll: () => void;
10
+ }
@@ -13,4 +13,5 @@ export * from './RHFTextFieldPassword';
13
13
  export * from './RHFPeriod';
14
14
  export { RHFRadioGroup } from './RHFRadioGroup';
15
15
  export { RHFNumberInput } from './RHFNumberInput/RHFNumberInput';
16
+ export { RHFUploadFile } from './RHFUpload/RHFUploadFile';
16
17
  export * from './RHFUpload';
package/index.js CHANGED
@@ -35,17 +35,18 @@ import { R as R5 } from "./components/hook-form/RHFSelect/RHFSelect.js";
35
35
  import { R as R6 } from "./components/hook-form/RHFHelperError/index.js";
36
36
  import { R as R7 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
37
37
  import { R as R8 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
38
- import { R as R9 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js";
39
- import { R as R10 } from "./components/hook-form/RHFCheckbox/RHFCheckbox.js";
40
- import { R as R11 } from "./components/hook-form/RHFTextField/RHFTextField.js";
41
- import { R as R12 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
38
+ import { R as R9 } from "./components/hook-form/RHFUpload/RHFUploadFile/index.js";
39
+ import { R as R10 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js";
40
+ import { R as R11 } from "./components/hook-form/RHFCheckbox/RHFCheckbox.js";
41
+ import { R as R12 } from "./components/hook-form/RHFTextField/RHFTextField.js";
42
+ import { R as R13 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
42
43
  import { g as g6 } from "./components/hook-form/RHFPeriod/subcomponents/Period/dictionary.js";
43
44
  import { r } from "./components/hook-form/RHFPeriod/RHFPeriod.styles.js";
44
- import { R as R13 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
45
- import { R as R14 } from "./components/hook-form/RHFPeriod/constants.js";
46
- import { R as R15 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
47
- import { P as P2, R as R16, S as S2, T as T2 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js";
48
- import { R as R17 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
45
+ import { R as R14 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
46
+ import { R as R15 } from "./components/hook-form/RHFPeriod/constants.js";
47
+ import { R as R16 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
48
+ import { P as P2, R as R17, S as S2, T as T2 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js";
49
+ import { R as R18 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
49
50
  import { B } from "./components/formatters/BooleanFormatter/BooleanFormatter.js";
50
51
  import { D as D2, u as u4 } from "./components/formatters/DateFormatter/DateFormatter.js";
51
52
  import { U, g as g7 } from "./components/formatters/UncertaintyFormatter/UncertaintyFormatter.js";
@@ -78,7 +79,7 @@ import { D as D5, d, g as g13 } from "./components/CommonActions/dictionary.js";
78
79
  import { D as D6 } from "./components/DragResizeWindow/DragResizeWindow.js";
79
80
  import { d as d2 } from "./components/DragResizeWindow/classes/index.js";
80
81
  import { G } from "./components/GridLayout/GridLayout.js";
81
- import { R as R18 } from "./components/GridLayout/subcomponents/Responsive/index.js";
82
+ import { R as R19 } from "./components/GridLayout/subcomponents/Responsive/index.js";
82
83
  import { c as c3, d as d3, e } from "./components/GridLayout/subcomponents/Responsive/responsiveUtils.js";
83
84
  import { i, k } from "./components/GridLayout/utils.js";
84
85
  import { w } from "./components/GridLayout/subcomponents/withSizeProvider/index.js";
@@ -130,8 +131,8 @@ import { H as H4 } from "./components/HelmetPage/index.js";
130
131
  import { P as P11 } from "./components/PropertyValue/PropertyValue.js";
131
132
  import { a as a9 } from "./components/MenuActions/dictionary.js";
132
133
  import { a as a10, M as M11 } from "./components/MenuActions/MenuActions.js";
133
- import { R as R19 } from "./components/extended/React-Resizable/Resizable/Resizable.js";
134
- import { R as R20 } from "./components/extended/React-Resizable/ResizableBox/ResizableBox.js";
134
+ import { R as R20 } from "./components/extended/React-Resizable/Resizable/Resizable.js";
135
+ import { R as R21 } from "./components/extended/React-Resizable/ResizableBox/ResizableBox.js";
135
136
  import { S as S4 } from "./components/ScrollBar/ScrollBar.js";
136
137
  import { S as S5 } from "./components/extended/React-Splitter/SplitLayout/SplitLayout.js";
137
138
  import { T as T4 } from "./components/ToastContainer/ToastContainer.js";
@@ -185,12 +186,12 @@ import { T as T18 } from "./components/mui_extended/ToggleIconButton/constants.j
185
186
  import { T as T19 } from "./components/mui_extended/ToggleIconButton/slots/ToggleIconButtonEnum.js";
186
187
  import { T as T20 } from "./components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.js";
187
188
  import { a as a13, D as D7, M as M13 } from "./components/areas/contexts/DynamicMFParmsContext/index.js";
188
- import { F, R as R21, u as u9 } from "./components/hook-form/RHFormContext/index.js";
189
+ import { F, R as R22, u as u9 } from "./components/hook-form/RHFormContext/index.js";
189
190
  import { g as g25 } from "./components/hook-form/RHFormContext/dictionary.js";
190
191
  import { u as u10 } from "./contexts/AppearanceComponentContext/useAppearanceComponentStore.js";
191
192
  import { A as A16 } from "./contexts/AppearanceComponentContext/AppearanceComponentContext.js";
192
193
  import { a as a14, M as M14 } from "./contexts/ModalContext/index.js";
193
- import { a as a15, R as R22 } from "./contexts/RealTimeContext/RealTimeContext.js";
194
+ import { a as a15, R as R23 } from "./contexts/RealTimeContext/RealTimeContext.js";
194
195
  import { u as u11 } from "./hooks/useFormAddEdit/index.js";
195
196
  import { u as u12 } from "./hooks/useModal/index.js";
196
197
  import { u as u13 } from "./hooks/useTab/index.js";
@@ -314,27 +315,28 @@ export {
314
315
  P11 as PropertyValue,
315
316
  R as RHFAutocomplete,
316
317
  R2 as RHFAutocompleteAsync,
317
- R10 as RHFCheckbox,
318
- R9 as RHFColorPicker,
318
+ R11 as RHFCheckbox,
319
+ R10 as RHFColorPicker,
319
320
  R3 as RHFDateTime,
320
321
  R6 as RHFHelperError,
321
322
  R4 as RHFMultiCheckbox,
322
323
  R8 as RHFNumberInput,
323
- R13 as RHFPeriod,
324
- R16 as RHFPeriodRootStyled,
325
- R15 as RHFPeriodSlots,
324
+ R14 as RHFPeriod,
325
+ R17 as RHFPeriodRootStyled,
326
+ R16 as RHFPeriodSlots,
326
327
  R7 as RHFRadioGroup,
327
328
  R5 as RHFSelect,
328
- R11 as RHFTextField,
329
- R12 as RHFTextFieldPassword,
330
- R17 as RHFUploadImage,
331
- R14 as RHF_PERIOD_KEY_COMPONENT,
332
- R21 as RHFormProvider,
329
+ R12 as RHFTextField,
330
+ R13 as RHFTextFieldPassword,
331
+ R9 as RHFUploadFile,
332
+ R18 as RHFUploadImage,
333
+ R15 as RHF_PERIOD_KEY_COMPONENT,
334
+ R22 as RHFormProvider,
333
335
  a15 as RealTimeContext,
334
- R22 as RealTimeProvider,
335
- R19 as Resizable,
336
- R20 as ResizableBox,
337
- R18 as Responsive,
336
+ R23 as RealTimeProvider,
337
+ R20 as Resizable,
338
+ R21 as ResizableBox,
339
+ R19 as Responsive,
338
340
  S4 as ScrollBar,
339
341
  S as ScrollToTop,
340
342
  S7 as SectionCommercial,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.107",
3
+ "version": "9.1.108",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"