@m4l/components 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commonjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "react";
2
- import "prop-types";
3
2
  import "react-dom";
3
+ import "prop-types";
4
4
  import "clsx";
5
5
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6
6
  function getDefaultExportFromCjs(x) {
@@ -7,6 +7,7 @@ const ActionCancel = (props) => {
7
7
  } = useModuleDictionary();
8
8
  return /* @__PURE__ */ jsx(Button, {
9
9
  variant: "outlined",
10
+ color: "inherit",
10
11
  ...props,
11
12
  children: getLabel("common_actions.cancel")
12
13
  });
@@ -26,6 +26,7 @@ function ActionFormIntro(props) {
26
26
  return /* @__PURE__ */ jsx(LoadingButton, {
27
27
  variant: "contained",
28
28
  type: "submit",
29
+ color: "primary",
29
30
  loading: isSubmitting,
30
31
  ...props,
31
32
  children: getLabel("common_actions.intro")
@@ -1,16 +1,13 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useNavigate } from "react-router-dom";
3
- import { createContext, useCallback, useState, useMemo, forwardRef, useRef, useImperativeHandle, useEffect } from "react";
4
- import { useFormContext, useFormState } from "react-hook-form";
5
- import { useModuleDictionary, useFlagsPresent, useEnvironment } from "@m4l/core";
6
- import { LoadingButton } from "@mui/lab";
7
- import { Skeleton, Button, IconButton, Tooltip, MenuItem, Checkbox } from "@mui/material";
8
1
  import { styled } from "@mui/material/styles";
9
- import { u as useModal } from "../../../../hooks/useModal/index.js";
10
2
  import { I as IconButton$1 } from "../../../mui_extended/IconButton/index.js";
3
+ import { useEnvironment, useModuleDictionary } from "@m4l/core";
4
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
11
5
  import { u as useBase, a as useFilters, O as OriginalGridWrapperStyled } from "../../../DataGrid/index.js";
12
6
  import { P as Pager } from "../../../mui_extended/Pager/index.js";
7
+ import { IconButton, Tooltip, MenuItem, Skeleton, Checkbox } from "@mui/material";
8
+ import { useState, useMemo, forwardRef, useRef, useImperativeHandle, useEffect, useCallback } from "react";
13
9
  import { D as DataGrid$1 } from "../../../../react-data-grid.js";
10
+ import { u as useModal } from "../../../../hooks/useModal/index.js";
14
11
  import { A as ActionCancel } from "../ActionCancel/index.js";
15
12
  import { A as ActionIntro } from "../ActionIntro/index.js";
16
13
  import { M as MenuPopover } from "../../../mui_extended/MenuPopover/index.js";
@@ -18,150 +15,10 @@ import { I as Icon } from "../../../Icon/index.js";
18
15
  import { useResponsiveDesktop } from "@m4l/graphics";
19
16
  import "@mui/material/Button";
20
17
  import "../../../../vendor.js";
18
+ import "react-hook-form";
19
+ import "react-router-dom";
21
20
  import "../../../../contexts/ModalContext/index.js";
22
- const WrapperFormActions = styled("div")(({
23
- theme
24
- }) => ({
25
- paddingTop: theme.spacing(3),
26
- marginRight: theme.spacing(1.5),
27
- display: "flex",
28
- flexDirection: "row",
29
- justifyContent: "flex-end",
30
- "& > button": {
31
- marginLeft: "10px"
32
- },
33
- "& .MuiLoadingButton-root ": {
34
- minWidth: "80px"
35
- }
36
- }));
37
- const WrapperSKTFormActions = styled("div")(({
38
- theme
39
- }) => ({
40
- display: "grid",
41
- gridTemplateColumns: "auto auto",
42
- margin: "0px",
43
- gridGap: `${theme.spacing(3)}`,
44
- justifyContent: "flex-end",
45
- paddingTop: `${theme.spacing(3)}`,
46
- borderTop: `1px solid ${theme.palette.divider}`,
47
- [theme.breakpoints.up("sm")]: {
48
- margin: `0 ${theme.spacing(4.5)}`
49
- }
50
- }));
51
- const initialState = {
52
- variantColor: "primary"
53
- };
54
- const CommonActionsContext = createContext(initialState);
55
- function CommonActionsProvider(props) {
56
- const {
57
- children,
58
- variantColor
59
- } = props;
60
- return /* @__PURE__ */ jsx(CommonActionsContext.Provider, {
61
- value: {
62
- variantColor
63
- },
64
- children
65
- });
66
- }
67
- const WrapperStandarActions = styled("div")(({
68
- theme
69
- }) => ({
70
- paddingTop: theme.spacing(3),
71
- display: "flex",
72
- flexDirection: "row",
73
- justifyContent: "flex-end",
74
- "& > button": {
75
- marginLeft: "10px"
76
- }
77
- }));
78
- const Actions$1 = (props) => {
79
- const {
80
- children,
81
- variantColor = "primary"
82
- } = props;
83
- return /* @__PURE__ */ jsx(WrapperStandarActions, {
84
- id: "WrapperStandarActions",
85
- children: /* @__PURE__ */ jsx(CommonActionsProvider, {
86
- variantColor,
87
- children
88
- })
89
- });
90
- };
91
- function SKTFormActions() {
92
- return /* @__PURE__ */ jsxs(WrapperSKTFormActions, {
93
- children: [/* @__PURE__ */ jsx(Skeleton, {
94
- variant: "text",
95
- width: 57,
96
- height: 30
97
- }), /* @__PURE__ */ jsx(Skeleton, {
98
- variant: "text",
99
- width: 57,
100
- height: 30
101
- })]
102
- });
103
- }
104
- function FormActions(props) {
105
- const {
106
- withIntro,
107
- urlCancel
108
- } = props;
109
- const navigate = useNavigate();
110
- const {
111
- getLabel
112
- } = useModuleDictionary();
113
- const isSkeleton = !useFlagsPresent(["dictionary_loaded", "form_loaded"]);
114
- const {
115
- openModalConfirm
116
- } = useModal();
117
- const {
118
- control
119
- } = useFormContext();
120
- const {
121
- isDirty,
122
- isSubmitting
123
- } = useFormState({
124
- control
125
- });
126
- const onConfirmCancel = useCallback(() => {
127
- if (typeof urlCancel === "number") {
128
- navigate(urlCancel);
129
- }
130
- if (urlCancel && typeof urlCancel === "undefined") {
131
- navigate(urlCancel, {
132
- replace: false
133
- });
134
- }
135
- }, [navigate, urlCancel]);
136
- const onClickCancel = useCallback(() => {
137
- if (isDirty) {
138
- openModalConfirm({
139
- variant: "warning",
140
- title: getLabel("form_provider.confirm_quit_title"),
141
- msg: getLabel("form_provider.confirm_quit_msg"),
142
- onClickIntro: onConfirmCancel
143
- });
144
- } else {
145
- onConfirmCancel();
146
- }
147
- }, [getLabel, isDirty, onConfirmCancel, openModalConfirm]);
148
- if (isSkeleton) {
149
- return /* @__PURE__ */ jsx(SKTFormActions, {});
150
- }
151
- return /* @__PURE__ */ jsxs(WrapperFormActions, {
152
- children: [urlCancel && /* @__PURE__ */ jsx(Button, {
153
- variant: "outlined",
154
- color: "inherit",
155
- onClick: onClickCancel,
156
- children: getLabel("actions.action_cancel")
157
- }), withIntro && /* @__PURE__ */ jsx(LoadingButton, {
158
- variant: "contained",
159
- type: "submit",
160
- loading: isSubmitting,
161
- children: getLabel("actions.action_accept")
162
- })]
163
- });
164
- }
21
+ import "@mui/lab";
165
22
  const WrapperMenuActions = styled(IconButton)(() => ({}));
166
23
  const LabelMemuItem = styled("div")(({
167
24
  theme
@@ -719,6 +576,26 @@ const SKTWrapperColumnsSettings = styled("div")(({ theme }) => ({
719
576
  minWidth: theme.spacing(3.75),
720
577
  height: theme.spacing(3.75)
721
578
  }));
579
+ const WrapperStandarActions = styled("div")(({
580
+ theme
581
+ }) => ({
582
+ paddingTop: theme.spacing(3),
583
+ display: "flex",
584
+ flexDirection: "row",
585
+ justifyContent: "flex-end",
586
+ "& > button": {
587
+ marginLeft: "10px"
588
+ }
589
+ }));
590
+ const Actions$1 = (props) => {
591
+ const {
592
+ children
593
+ } = props;
594
+ return /* @__PURE__ */ jsx(WrapperStandarActions, {
595
+ id: "WrapperStandarActions",
596
+ children
597
+ });
598
+ };
722
599
  function Settings() {
723
600
  const {
724
601
  openModal,
@@ -977,4 +854,4 @@ const defaultActionsDictionary = {
977
854
  intro: "Intro"
978
855
  }
979
856
  };
980
- export { ActionsColumn as A, FormActions as F, LabelMemuItem as L, MenuActions as M, PagerActions as P, Actions as a, Actions$1 as b, defaultActionsDictionary as d, getStandardActionsDictionary as g };
857
+ export { ActionsColumn as A, LabelMemuItem as L, MenuActions as M, PagerActions as P, Actions as a, Actions$1 as b, defaultActionsDictionary as d, getStandardActionsDictionary as g };
@@ -1,6 +1,4 @@
1
1
  import { ReactNode } from 'react';
2
- import { VariantColor } from '../../../../utils/types';
3
2
  export interface StandardActionsProps {
4
3
  children: ReactNode;
5
- variantColor?: VariantColor;
6
4
  }
@@ -5,13 +5,9 @@ import { useModuleDictionary, useHostTools, useEnvironment, voidFunction, useFla
5
5
  import * as Yup from "yup";
6
6
  import { useFormContext, useWatch } from "react-hook-form";
7
7
  import { F as FormProvider } from "../hook-form/FormProvider/index.js";
8
- import "react-router-dom";
9
- import "@mui/lab";
10
- import { styled as styled$1, Skeleton, MenuItem, useTheme, Popper, Button } from "@mui/material";
11
- import { L as LabelMemuItem } from "../CommonActions/components/Actions/index.js";
12
- import "../../contexts/ModalContext/index.js";
13
8
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
14
9
  import { R as RHFAutocomplete } from "../../vendor.js";
10
+ import { styled as styled$1, Skeleton, MenuItem, useTheme, Popper, Button } from "@mui/material";
15
11
  import "../hook-form/RHFAutocompleteAsync/index.js";
16
12
  import "../hook-form/RHFCheckbox/index.js";
17
13
  import { R as RHFDateTime } from "../hook-form/RHFDateTime.js";
@@ -24,6 +20,7 @@ import "../hook-form/RHFUpload.js";
24
20
  import { I as IconButton } from "../mui_extended/IconButton/index.js";
25
21
  import { I as Icon } from "../Icon/index.js";
26
22
  import "../../simplebar.js";
23
+ import { L as LabelMemuItem } from "../CommonActions/components/Actions/index.js";
27
24
  import { M as MenuPopover } from "../mui_extended/MenuPopover/index.js";
28
25
  import { useResponsiveDesktop } from "@m4l/graphics";
29
26
  const WrapperApplyedFilters = styled("div")(({
@@ -1518,7 +1515,6 @@ const PopupEditFilter = () => {
1518
1515
  onSubmit,
1519
1516
  values,
1520
1517
  validationSchema: popupValidationSchema,
1521
- urlCancel: -1,
1522
1518
  children: /* @__PURE__ */ jsxs(WrapperPopupEditFilter, {
1523
1519
  children: [/* @__PURE__ */ jsxs(HeaderContainer, {
1524
1520
  children: [field?.urlIcon && /* @__PURE__ */ jsx(Icon, {
@@ -1533,12 +1529,12 @@ const PopupEditFilter = () => {
1533
1529
  variant: "outlined",
1534
1530
  color: "inherit",
1535
1531
  onClick: onClose,
1536
- children: `Cerrar`
1532
+ children: getLabel(`dyamic_filter.cancel`)
1537
1533
  }), /* @__PURE__ */ jsx(Button, {
1538
1534
  variant: "contained",
1539
1535
  color: "primary",
1540
1536
  type: "submit",
1541
- children: `Agregar ${filter.id}`
1537
+ children: getLabel(`dyamic_filter.intro`)
1542
1538
  })]
1543
1539
  })]
1544
1540
  })
@@ -2,8 +2,7 @@ import { useEffect } from "react";
2
2
  import { useForm, FormProvider as FormProvider$1 } from "react-hook-form";
3
3
  import { o } from "../../../node_modules.js";
4
4
  import { styled } from "@mui/material/styles";
5
- import { F as FormActions } from "../../CommonActions/components/Actions/index.js";
6
- import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { jsx } from "react/jsx-runtime";
7
6
  const WrapperFormProvider = styled("form")(() => ({
8
7
  display: "flex",
9
8
  flexDirection: "column",
@@ -15,9 +14,7 @@ function FormProvider(props) {
15
14
  children,
16
15
  onSubmit,
17
16
  values,
18
- validationSchema,
19
- withIntro,
20
- urlCancel = -1
17
+ validationSchema
21
18
  } = props;
22
19
  const methods = useForm({
23
20
  resolver: o(validationSchema),
@@ -38,13 +35,10 @@ function FormProvider(props) {
38
35
  }, [methods, values]);
39
36
  return /* @__PURE__ */ jsx(FormProvider$1, {
40
37
  ...methods,
41
- children: /* @__PURE__ */ jsxs(WrapperFormProvider, {
38
+ children: /* @__PURE__ */ jsx(WrapperFormProvider, {
42
39
  id: "formProvider",
43
40
  onSubmit: methods.handleSubmit(onSubmit),
44
- children: [children, withIntro && /* @__PURE__ */ jsx(FormActions, {
45
- withIntro,
46
- urlCancel
47
- })]
41
+ children
48
42
  })
49
43
  });
50
44
  }
@@ -5,6 +5,4 @@ export interface FormProviderProps {
5
5
  onSubmit: (data: FieldValues) => void;
6
6
  values: FieldValues;
7
7
  validationSchema: any;
8
- withIntro?: boolean;
9
- urlCancel?: string | number;
10
8
  }
package/dist/index.js CHANGED
@@ -57,15 +57,15 @@ import "react-hook-form";
57
57
  import "./node_modules.js";
58
58
  import "prop-types";
59
59
  import "@mui/material/styles";
60
- import "@mui/material/Button";
61
- import "react-router-dom";
62
- import "@mui/lab";
63
60
  import "@mui/x-date-pickers";
64
61
  import "./lodash.js";
65
62
  import "./commonjs.js";
66
63
  import "react-dom";
67
64
  import "clsx";
68
65
  import "./react-lazy-load-image-component.js";
66
+ import "react-router-dom";
67
+ import "@mui/lab";
68
+ import "@mui/material/Button";
69
69
  import "@m4l/graphics";
70
70
  import "react-dnd";
71
71
  import "react-dnd-html5-backend";
package/dist/vendor.js CHANGED
@@ -1,36 +1,36 @@
1
1
  import "./components/mui_extended/IconButton/index.js";
2
2
  import "framer-motion";
3
- import { styled, Skeleton, Autocomplete, TextField } from "@mui/material";
3
+ import { Skeleton, Autocomplete, TextField, styled as styled$1 } from "@mui/material";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
- import { useModuleSkeleton, useModuleDictionary } from "@m4l/core";
6
- import MuiButton from "@mui/material/Button";
7
5
  import "react";
8
6
  import { useFormContext, Controller } from "react-hook-form";
9
7
  import "./components/hook-form/FormProvider/index.js";
10
- import "react-router-dom";
11
- import "@mui/lab";
12
- import "./components/CommonActions/components/Actions/index.js";
13
- import "./contexts/ModalContext/index.js";
8
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
14
9
  import "./components/hook-form/RHFAutocompleteAsync/index.js";
15
10
  import "./components/hook-form/RHFCheckbox/index.js";
16
11
  import "./components/hook-form/RHFDateTime.js";
17
12
  import "@mui/x-date-pickers";
18
13
  import "./components/hook-form/RHFTextField/index.js";
19
14
  import "./lodash.js";
20
- import { styled as styled$1 } from "@mui/material/styles";
15
+ import { styled } from "@mui/material/styles";
21
16
  import "./react-lazy-load-image-component.js";
22
17
  import "./components/Image/index.js";
23
18
  import "./components/hook-form/RHFUpload.js";
24
19
  import "./components/Icon/index.js";
20
+ import "react-router-dom";
21
+ import "@mui/lab";
25
22
  import "./components/mui_extended/LoadingButton/index.js";
26
23
  import "./components/mui_extended/MenuPopover/index.js";
24
+ import "./components/CommonActions/components/Actions/index.js";
27
25
  import "./components/mui_extended/Pager/index.js";
28
26
  import "./components/mui_extended/Tab/index.js";
27
+ import MuiButton from "@mui/material/Button";
29
28
  import "@m4l/graphics";
30
29
  import "./components/CompanyLogo/index.js";
31
30
  import "./components/DataGrid/index.js";
32
31
  import "react-dnd";
33
32
  import "react-dnd-html5-backend";
33
+ import "./contexts/ModalContext/index.js";
34
34
  import "./components/ScrollBar/index.js";
35
35
  import "./components/DynamicFilter/index.js";
36
36
  import "./simplebar.js";
@@ -67,55 +67,12 @@ import "./components/CommonActions/components/ActionFormIntro/index.js";
67
67
  import "./components/LanguagePopover/index.js";
68
68
  import "./components/Loadable/index.js";
69
69
  import "./hooks/useModal/index.js";
70
- const getVariantColor = (variant) => {
71
- switch (variant) {
72
- case "warning":
73
- return "warning";
74
- case "delete":
75
- return "error";
76
- case "info":
77
- return "info";
78
- }
79
- return "primary";
80
- };
81
- const getThemeVariantColor = (theme, variant) => {
82
- switch (variant) {
83
- case "warning":
84
- theme.palette.warning.main;
85
- break;
86
- case "delete":
87
- theme.palette.error.main;
88
- break;
89
- case "info":
90
- theme.palette.info.main;
91
- break;
92
- }
93
- return theme.palette.text.primary;
94
- };
95
- const SKTButton = styled(Skeleton)(({
96
- theme
97
- }) => ({
98
- borderRadius: theme.spacing(0.5)
99
- }));
100
- const Button = (props) => {
101
- const isSkeleton = useModuleSkeleton();
102
- if (isSkeleton) {
103
- return /* @__PURE__ */ jsx(SKTButton, {
104
- variant: "rectangular",
105
- width: "100px",
106
- height: "36px"
107
- });
108
- }
109
- return /* @__PURE__ */ jsx(MuiButton, {
110
- ...props
111
- });
112
- };
113
- const SKTRHFAutocompleteWrapper = styled$1("div")(() => ({
70
+ const SKTRHFAutocompleteWrapper = styled("div")(() => ({
114
71
  display: "flex",
115
72
  width: "100%",
116
73
  flexDirection: "column"
117
74
  }));
118
- styled$1("div")(({
75
+ styled("div")(({
119
76
  theme
120
77
  }) => ({
121
78
  display: "flex",
@@ -125,7 +82,7 @@ styled$1("div")(({
125
82
  justifyContent: "flex-start"
126
83
  }
127
84
  }));
128
- const SKTInputText = styled$1("div")(({
85
+ const SKTInputText = styled("div")(({
129
86
  theme
130
87
  }) => ({
131
88
  width: "100%",
@@ -141,7 +98,7 @@ const SKTInputText = styled$1("div")(({
141
98
  width: "100%"
142
99
  }
143
100
  }));
144
- styled$1("div")(() => ({
101
+ styled("div")(() => ({
145
102
  display: "flex",
146
103
  width: "100%",
147
104
  "& .MuiAutocomplete-root": {
@@ -243,4 +200,47 @@ function RHFAutocomplete(props) {
243
200
  }
244
201
  });
245
202
  }
203
+ const getVariantColor = (variant) => {
204
+ switch (variant) {
205
+ case "warning":
206
+ return "warning";
207
+ case "delete":
208
+ return "error";
209
+ case "info":
210
+ return "info";
211
+ }
212
+ return "primary";
213
+ };
214
+ const getThemeVariantColor = (theme, variant) => {
215
+ switch (variant) {
216
+ case "warning":
217
+ theme.palette.warning.main;
218
+ break;
219
+ case "delete":
220
+ theme.palette.error.main;
221
+ break;
222
+ case "info":
223
+ theme.palette.info.main;
224
+ break;
225
+ }
226
+ return theme.palette.text.primary;
227
+ };
228
+ const SKTButton = styled$1(Skeleton)(({
229
+ theme
230
+ }) => ({
231
+ borderRadius: theme.spacing(0.5)
232
+ }));
233
+ const Button = (props) => {
234
+ const isSkeleton = useModuleSkeleton();
235
+ if (isSkeleton) {
236
+ return /* @__PURE__ */ jsx(SKTButton, {
237
+ variant: "rectangular",
238
+ width: "100px",
239
+ height: "36px"
240
+ });
241
+ }
242
+ return /* @__PURE__ */ jsx(MuiButton, {
243
+ ...props
244
+ });
245
+ };
246
246
  export { Button as B, RHFAutocomplete as R, getVariantColor as a, getThemeVariantColor as g };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.48",
4
+ "version": "0.0.49",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { CommonActionsContextProps, CommonActionsProviderProps } from './types';
3
- declare const CommonActionsContext: import("react").Context<CommonActionsContextProps>;
4
- declare function CommonActionsProvider(props: CommonActionsProviderProps): JSX.Element;
5
- export { CommonActionsProvider, CommonActionsContext };
@@ -1,9 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { VariantColor } from '../../../utils/types';
3
- export interface CommonActionsProviderProps {
4
- variantColor: VariantColor;
5
- children: ReactNode;
6
- }
7
- export interface CommonActionsContextProps {
8
- variantColor: VariantColor;
9
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { FormActionsProps } from './types';
3
- export declare function FormActions(props: FormActionsProps): JSX.Element;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function SKTFormActions(): JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const WrapperFormActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3
- export declare const WrapperSKTFormActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,4 +0,0 @@
1
- export interface FormActionsProps {
2
- withIntro?: boolean;
3
- urlCancel?: string | number;
4
- }