@m4l/components 0.0.1 → 0.0.4

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 (39) hide show
  1. package/dist/commonjs.js +5 -0
  2. package/dist/components/FormActions/dictionary.d.ts +3 -0
  3. package/dist/components/FormActions/index.d.ts +3 -0
  4. package/dist/components/FormActions/index.js +44 -0
  5. package/dist/components/FormActions/styles.d.ts +2 -0
  6. package/dist/components/FormActions/types.d.ts +7 -0
  7. package/dist/components/ModalDialog/components/Header/index.d.ts +3 -0
  8. package/dist/components/ModalDialog/components/Header/types.d.ts +9 -0
  9. package/dist/components/ModalDialog/dictionary.d.ts +3 -0
  10. package/dist/components/ModalDialog/index.d.ts +2 -0
  11. package/dist/components/ModalDialog/index.js +180 -0
  12. package/dist/components/ModalDialog/styles.d.ts +9 -0
  13. package/dist/components/ModalDialog/types.d.ts +5 -0
  14. package/dist/components/Resizeable/index.d.ts +3 -0
  15. package/dist/components/Resizeable/index.js +92 -0
  16. package/dist/components/Resizeable/styles.d.ts +5 -0
  17. package/dist/components/Resizeable/types.d.ts +8 -0
  18. package/dist/components/index.d.ts +5 -0
  19. package/dist/components/mui_extended/MenuActions/styles.d.ts +2 -2
  20. package/dist/components/mui_extended/index.d.ts +1 -1
  21. package/dist/contexts/ModalContext/components/ContentConfirm/index.d.ts +3 -0
  22. package/dist/contexts/ModalContext/components/ContentConfirm/styles.d.ts +6 -0
  23. package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +8 -0
  24. package/dist/contexts/ModalContext/index.d.ts +5 -0
  25. package/dist/contexts/ModalContext/index.js +162 -0
  26. package/dist/contexts/ModalContext/types.d.ts +42 -0
  27. package/dist/contexts/index.d.ts +2 -0
  28. package/dist/hooks/useModal/index.d.ts +1 -0
  29. package/dist/hooks/useModal/index.js +4 -0
  30. package/dist/hooks/useResponsive.d.ts +8 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +14 -2
  33. package/dist/prop-types.js +1 -0
  34. package/dist/react-draggable.js +1435 -0
  35. package/dist/react-resizable.js +594 -0
  36. package/dist/react-splitter-layout.js +4 -4
  37. package/dist/react.js +2 -0
  38. package/dist/vendor.js +31 -4
  39. package/package.json +7 -2
@@ -0,0 +1,5 @@
1
+ import "clsx";
2
+ function getDefaultExportFromCjs(x) {
3
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4
+ }
5
+ export { getDefaultExportFromCjs as g };
@@ -0,0 +1,3 @@
1
+ import type { Dictionary } from '@m4l/core';
2
+ export declare function getActionnsComponentsDictionary(): string[];
3
+ export declare const defaultActionsDictionary: Dictionary;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { ActionsProps } from './types';
3
+ export declare const FormActions: (props: ActionsProps) => JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { useModuleDictionary } from "@m4l/core";
2
+ import { Button } from "@mui/material";
3
+ import { styled } from "@mui/material/styles";
4
+ import { jsxs, jsx } from "react/jsx-runtime";
5
+ const WrapperActions = styled("div")(({
6
+ theme
7
+ }) => ({
8
+ paddingTop: theme.spacing(3),
9
+ display: "flex",
10
+ flexDirection: "row",
11
+ justifyContent: "flex-end",
12
+ "& > button": {
13
+ marginLeft: "10px"
14
+ }
15
+ }));
16
+ const FormActions = (props) => {
17
+ const {
18
+ variant,
19
+ standardActions,
20
+ actionComponents,
21
+ onCloseModal
22
+ } = props;
23
+ const {
24
+ getLabel
25
+ } = useModuleDictionary();
26
+ return /* @__PURE__ */ jsxs(WrapperActions, {
27
+ children: [actionComponents && actionComponents.map((action) => action), standardActions && standardActions.withCancel && /* @__PURE__ */ jsx(Button, {
28
+ variant: "outlined",
29
+ color: variant !== void 0 ? "inherit" : variant,
30
+ onClick: onCloseModal,
31
+ children: getLabel("actions.action_cancel")
32
+ }), standardActions && standardActions.onClickIntro && /* @__PURE__ */ jsx(Button, {
33
+ variant: "contained",
34
+ onClick: standardActions.onClickIntro,
35
+ type: "submit",
36
+ color: variant === "warning" ? "warning" : variant === "error" ? "error" : "info",
37
+ children: getLabel("actions.action_accept")
38
+ })]
39
+ });
40
+ };
41
+ function getActionnsComponentsDictionary() {
42
+ return ["actions"];
43
+ }
44
+ export { FormActions as F, getActionnsComponentsDictionary as g };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const WrapperActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,7 @@
1
+ import { ModalOpenOptions } from "src/contexts/ModalContext/types";
2
+ declare type ImodalOpt = Pick<ModalOpenOptions, 'actionComponents' | 'standardActions'>;
3
+ export interface ActionsProps extends ImodalOpt {
4
+ variant?: string | undefined;
5
+ onCloseModal?: () => void | undefined;
6
+ }
7
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { HeaderProps } from './types';
3
+ export declare const Header: (props: HeaderProps) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { VariantModal } from 'src/contexts/ModalContext/types';
3
+ export interface HeaderProps {
4
+ variant?: VariantModal;
5
+ title: string;
6
+ iconComponent?: ReactNode;
7
+ withClose?: boolean;
8
+ onCloseModal?: () => void;
9
+ }
@@ -0,0 +1,3 @@
1
+ import { Dictionary } from "@m4l/core";
2
+ export declare function getModalDialogComponentsDictionary(): string[];
3
+ export declare const defaultModalDialogDictionary: Dictionary;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ModalDialog: () => JSX.Element;
@@ -0,0 +1,180 @@
1
+ import { Dialog, IconButton, Paper } from "@mui/material";
2
+ import { D as Draggable } from "../../react-draggable.js";
3
+ import { u as useModal } from "../../hooks/useModal/index.js";
4
+ import { styled } from "@mui/material/styles";
5
+ import { R as Resizeable } from "../Resizeable/index.js";
6
+ import { u as useResponsiveDesktop } from "../../vendor.js";
7
+ import { useEnvironment } from "@m4l/core";
8
+ import { B as BoxIcon } from "../mui_extended/BoxIcon/index.js";
9
+ import "../mui_extended/MenuPopover/index.js";
10
+ import "react";
11
+ import "react-router-dom";
12
+ import { jsxs, jsx } from "react/jsx-runtime";
13
+ import "../mui_extended/MenuActions/index.js";
14
+ import { F as FormActions, g as getActionnsComponentsDictionary } from "../FormActions/index.js";
15
+ const WrapperDialog = styled(Dialog)(() => ({}));
16
+ const Container = styled("div")(({ theme }) => ({
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ height: "100%",
20
+ overflow: "hidden",
21
+ padding: theme.spacing(3)
22
+ }));
23
+ const Header$1 = styled("div")(({ theme }) => ({
24
+ display: "flex",
25
+ flexDirection: "row",
26
+ alignItems: "center",
27
+ height: theme.spacing(5),
28
+ borderBottom: `1px solid ${theme.palette.divider}`,
29
+ overflow: "hidden"
30
+ }));
31
+ const IconTitleContainer = styled("div")(({ theme }) => ({
32
+ display: "flex",
33
+ flexDirection: "row",
34
+ flexGrow: 1,
35
+ alignItems: "center",
36
+ cursor: "move",
37
+ ...theme.typography.subtitle1,
38
+ color: theme.palette.text.primary
39
+ }));
40
+ const IconHeader = styled("div")(({ theme, variant }) => ({
41
+ display: "flex",
42
+ alignItems: "center",
43
+ justifyContent: "center",
44
+ marginRight: theme.spacing(1.5),
45
+ "& > span": {
46
+ background: variant === "warning" ? theme.palette.warning.main : variant === "error" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : theme.palette.text.primary
47
+ }
48
+ }));
49
+ const Content = styled("div")(() => ({
50
+ flexGrow: 1,
51
+ position: "relative"
52
+ }));
53
+ const ModalTitle = styled("div")(({ theme, variant }) => ({
54
+ ...theme.typography.subtitle1,
55
+ color: variant === "warning" ? theme.palette.warning.main : variant === "error" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : theme.palette.text.primary
56
+ }));
57
+ const Header = (props) => {
58
+ const {
59
+ host_static_assets,
60
+ environment
61
+ } = useEnvironment();
62
+ const {
63
+ variant,
64
+ title,
65
+ iconComponent,
66
+ withClose,
67
+ onCloseModal
68
+ } = props;
69
+ const iconSrcWarning = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/warning.svg`;
70
+ const iconSrcError = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/error.svg`;
71
+ const iconSrcInfo = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/info.svg`;
72
+ const iconDefault = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/icon_bar_tittle.svg`;
73
+ return /* @__PURE__ */ jsxs(Header$1, {
74
+ id: "Header",
75
+ children: [/* @__PURE__ */ jsxs(IconTitleContainer, {
76
+ className: "draggable-dialog-title",
77
+ children: [/* @__PURE__ */ jsx(IconHeader, {
78
+ variant,
79
+ children: !iconComponent ? /* @__PURE__ */ jsx(BoxIcon, {
80
+ src: variant === "warning" ? iconSrcWarning : variant === "delete" ? iconSrcError : variant === "info" ? iconSrcInfo : iconDefault
81
+ }) : iconComponent
82
+ }), /* @__PURE__ */ jsx(ModalTitle, {
83
+ variant,
84
+ children: title
85
+ })]
86
+ }), withClose && /* @__PURE__ */ jsx(IconButton, {
87
+ onClick: onCloseModal,
88
+ "aria-label": "click",
89
+ children: /* @__PURE__ */ jsx(BoxIcon, {
90
+ src: `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/close.svg`
91
+ })
92
+ })]
93
+ });
94
+ };
95
+ const DragabblePaperComponent = (props) => {
96
+ return /* @__PURE__ */ jsx(Draggable, {
97
+ handle: ".draggable-dialog-title",
98
+ cancel: '[class*="MuiDialogContent-root"]',
99
+ children: /* @__PURE__ */ jsx(Paper, {
100
+ sx: {
101
+ maxHeight: "unset",
102
+ maxWidth: "unset"
103
+ },
104
+ ...props
105
+ })
106
+ });
107
+ };
108
+ function PaperComponent(props) {
109
+ return /* @__PURE__ */ jsx(Paper, {
110
+ sx: {
111
+ maxHeight: "unset",
112
+ maxWidth: "unset",
113
+ height: "100%"
114
+ },
115
+ ...props
116
+ });
117
+ }
118
+ const ModalDialog = () => {
119
+ const {
120
+ open,
121
+ initialWidth = 600,
122
+ initialHeigth = 400,
123
+ maxWidth,
124
+ maxHeigth,
125
+ withClose = true,
126
+ onQueryClose,
127
+ contentComponent,
128
+ title,
129
+ closeModal,
130
+ iconComponent,
131
+ standardActions,
132
+ actionComponents,
133
+ variant
134
+ } = useModal();
135
+ const isDesktop = useResponsiveDesktop();
136
+ const onCloseModal = () => {
137
+ closeModal();
138
+ };
139
+ const contentComnponent = /* @__PURE__ */ jsxs(Container, {
140
+ id: "Container",
141
+ children: [/* @__PURE__ */ jsx(Header, {
142
+ variant,
143
+ title,
144
+ iconComponent,
145
+ withClose,
146
+ onCloseModal
147
+ }), /* @__PURE__ */ jsx(Content, {
148
+ id: "Content",
149
+ children: typeof contentComponent === "function" ? contentComponent() : contentComponent
150
+ }), (standardActions || actionComponents) && /* @__PURE__ */ jsx(FormActions, {
151
+ variant,
152
+ standardActions,
153
+ actionComponents,
154
+ onCloseModal
155
+ })]
156
+ });
157
+ return /* @__PURE__ */ jsxs(WrapperDialog, {
158
+ open,
159
+ onClose: onQueryClose,
160
+ "aria-labelledby": "child-modal-title",
161
+ "aria-describedby": "child-modal-description",
162
+ PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
163
+ maxWidth: false,
164
+ fullWidth: !isDesktop,
165
+ children: [isDesktop && /* @__PURE__ */ jsx(Resizeable, {
166
+ width: initialWidth,
167
+ height: initialHeigth,
168
+ maxWidth,
169
+ maxHeigth,
170
+ children: contentComnponent
171
+ }), !isDesktop && contentComnponent]
172
+ });
173
+ };
174
+ function getModalDialogComponentsDictionary() {
175
+ return ["modal_dialog"].concat(getActionnsComponentsDictionary());
176
+ }
177
+ const defaultModalDialogDictionary = {
178
+ modal_dialog: {}
179
+ };
180
+ export { ModalDialog as M, defaultModalDialogDictionary as d, getModalDialogComponentsDictionary as g };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { VariantProps } from './types';
3
+ export declare const WrapperDialog: import("@emotion/styled").StyledComponent<import("@mui/material").DialogProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ export declare const Header: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const IconTitleContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
+ export declare const IconHeader: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & VariantProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
+ export declare const Content: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export declare const ModalTitle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & VariantProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,5 @@
1
+ export interface ModalDialogProps {
2
+ }
3
+ export interface VariantProps {
4
+ variant?: string | undefined;
5
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ResizeableProps } from './types';
3
+ export declare function Resizeable(props: ResizeableProps): JSX.Element;
@@ -0,0 +1,92 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { R as ResizableBox } from "../../react-resizable.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const WrapperResizeable = styled(ResizableBox)(({
5
+ theme
6
+ }) => ({
7
+ "&.react-resizable": {
8
+ position: "relative",
9
+ width: "100%",
10
+ height: "100%"
11
+ },
12
+ "& .react-resizable-handle": {
13
+ position: "absolute",
14
+ width: "20px",
15
+ height: "20px",
16
+ margin: "4px",
17
+ backgroundRepeat: "no-repeat",
18
+ backgroundOrigin: "content-box",
19
+ boxSizing: "border-box",
20
+ backgroundColor: theme.palette.action.active,
21
+ mask: `url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 26.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Capa_1' focusable='false' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 24 24' style='enable-background:new 0 0 24 24;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:none;%7D%0A%3C/style%3E%3Cg id='Grupo_5256'%3E%3C/g%3E%3Cpath class='st0' d='z'/%3E%3Cg%3E%3Cpolygon points='21.9,21.9 15.8,21.9 15.8,19.9 19.9,19.9 19.9,15.9 21.9,15.9 '/%3E%3C/g%3E%3C/svg%3E%0A")`,
22
+ backgroundImage: `url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 26.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Capa_1' focusable='false' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 24 24' style='enable-background:new 0 0 24 24;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:none;%7D%0A%3C/style%3E%3Cg id='Grupo_5256'%3E%3C/g%3E%3Cpath class='st0' d='z'/%3E%3Cg%3E%3Cpolygon points='21.9,21.9 15.8,21.9 15.8,19.9 19.9,19.9 19.9,15.9 21.9,15.9 '/%3E%3C/g%3E%3C/svg%3E%0A")`,
23
+ backgroundPosition: "bottom right",
24
+ padding: "0 3px 3px 0"
25
+ },
26
+ "& .react-resizable-handle-sw": {
27
+ bottom: "0",
28
+ left: "0",
29
+ cursor: "sw-resize",
30
+ transform: "rotate(90deg)"
31
+ },
32
+ ".react-resizable-handle-se": {
33
+ bottom: "0",
34
+ right: "0",
35
+ cursor: "se-resize"
36
+ },
37
+ "& .react-resizable-handle-nw": {
38
+ top: "0",
39
+ left: "0",
40
+ cursor: "nw-resize",
41
+ transform: "rotate(180deg)"
42
+ },
43
+ "& .react-resizable-handle-ne": {
44
+ top: "0",
45
+ right: "0",
46
+ cursor: "ne-resize",
47
+ transform: "rotate(270deg)"
48
+ },
49
+ "& .react-resizable-handle-w, .react-resizable-handle-e": {
50
+ top: "50%",
51
+ marginTop: "-10px",
52
+ cursor: "ew-resize"
53
+ },
54
+ "& .react-resizable-handle-w": {
55
+ left: "0",
56
+ transform: "rotate(135deg)"
57
+ },
58
+ "& .react-resizable-handle-e": {
59
+ right: "0",
60
+ transform: "rotate(315deg) "
61
+ },
62
+ "& .react-resizable-handle-n,.react-resizable-handle-s": {
63
+ left: "50%",
64
+ marginLeft: "-10px",
65
+ cursor: "ns-resize"
66
+ },
67
+ "& .react-resizable-handle-n": {
68
+ top: "0",
69
+ transform: "rotate(225deg)"
70
+ },
71
+ "& .react-resizable-handle-s": {
72
+ bottom: "0",
73
+ transform: "rotate(45deg)"
74
+ }
75
+ }));
76
+ function Resizeable(props) {
77
+ const {
78
+ children,
79
+ width,
80
+ height,
81
+ maxHeigth,
82
+ maxWidth
83
+ } = props;
84
+ return /* @__PURE__ */ jsx(WrapperResizeable, {
85
+ width,
86
+ height,
87
+ maxConstraints: maxHeigth && maxWidth ? [maxWidth, maxHeigth] : void 0,
88
+ resizeHandles: ["se", "nw"],
89
+ children
90
+ });
91
+ }
92
+ export { Resizeable as R };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ResizableBox } from 'react-resizable';
3
+ export declare const WrapperResizeable: import("@emotion/styled").StyledComponent<import("react-resizable").ResizableProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {
4
+ ref?: import("react").Ref<ResizableBox> | undefined;
5
+ }>;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ResizeableProps {
3
+ children: ReactNode;
4
+ width: number;
5
+ height: number;
6
+ maxWidth?: number;
7
+ maxHeigth?: number;
8
+ }
@@ -1,2 +1,7 @@
1
1
  export * from '../components/mui_extended';
2
+ export * from '../components/FormActions';
3
+ export * from '../components/ModalDialog';
4
+ export * from '../components/ModalDialog/dictionary';
5
+ export * from '../components/Resizeable';
2
6
  export * from '../components/SplitLayout';
7
+ export type { SplitPosition } from '../components/SplitLayout/types';
@@ -2,7 +2,7 @@
2
2
  export declare const WrapperMenuActions: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
5
- color?: "inherit" | "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning" | undefined;
5
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | "default" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
@@ -26,5 +26,5 @@ export declare const WrapperMenuActions: import("@emotion/styled").StyledCompone
26
26
  touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
27
27
  }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
28
28
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
29
- }, "color" | "sx" | "children" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "disabled" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
29
+ }, "color" | "sx" | "children" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
30
30
  export declare const LabelMemuItem: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -3,7 +3,7 @@ export { default as MenuPopover } from './MenuPopover';
3
3
  export { default as Breadcrumbs } from './Breadcrumbs';
4
4
  export type { TLink } from './Breadcrumbs/types';
5
5
  export { default as MenuActions } from './MenuActions';
6
- export type { MenuAction } from './MenuActions/types';
6
+ export type { MenuAction, ComponentActionProps } from './MenuActions/types';
7
7
  declare module '@mui/material/styles/createPalette' {
8
8
  interface TypeBackground {
9
9
  neutral: string;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ModalConfirmProps } from './types';
3
+ export declare const ContentConfirm: (props: ModalConfirmProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { VariantProps } from './types';
3
+ export declare const WrapperContentConfirm: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
+ export declare const ModalContent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ export declare const IllustrationContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & VariantProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const MessageContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & VariantProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,8 @@
1
+ import { VariantModal } from '../../types';
2
+ export interface ModalConfirmProps {
3
+ variant?: VariantModal;
4
+ msg?: string;
5
+ }
6
+ export interface VariantProps {
7
+ variant?: VariantModal;
8
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ModalContextProps, TProps } from './types';
3
+ declare const ModalContext: import("react").Context<ModalContextProps>;
4
+ declare function ModalProvider({ children }: TProps): JSX.Element;
5
+ export { ModalProvider, ModalContext };
@@ -0,0 +1,162 @@
1
+ import { createContext, useState } from "react";
2
+ import { useEnvironment, voidFunction } from "@m4l/core";
3
+ import Typography from "@mui/material/Typography";
4
+ import { styled } from "@mui/material/styles";
5
+ import { B as BoxIcon } from "../../components/mui_extended/BoxIcon/index.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { M as ModalDialog } from "../../components/ModalDialog/index.js";
8
+ const WrapperContentConfirm = styled("div")(() => ({
9
+ display: "flex",
10
+ flexDirection: "column",
11
+ height: "100%"
12
+ }));
13
+ const ModalContent = styled("div")(({
14
+ theme
15
+ }) => ({
16
+ display: "flex",
17
+ flexDirection: "column",
18
+ justifyContent: "center",
19
+ alignItems: "center",
20
+ gridGap: theme.spacing(5),
21
+ flexGrow: 1,
22
+ [theme.breakpoints.up("sm")]: {
23
+ display: "grid",
24
+ flexDirection: "row",
25
+ gridTemplateColumns: "1fr 1fr"
26
+ }
27
+ }));
28
+ const IllustrationContainer = styled("div")(({
29
+ theme,
30
+ variant
31
+ }) => ({
32
+ display: "flex",
33
+ justifyContent: "center",
34
+ alignItems: "center",
35
+ "& > span": {
36
+ background: variant === "warning" ? theme.palette.warning.main : variant === "delete" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : "theme.palette.text.primary"
37
+ }
38
+ }));
39
+ const MessageContainer = styled("div")(() => ({
40
+ display: "flex",
41
+ alignItems: "center"
42
+ }));
43
+ const ContentConfirm = (props) => {
44
+ const {
45
+ variant = "info",
46
+ msg = "Are you sure you want to perform this action? Once complete, the information will be deleted."
47
+ } = props;
48
+ const {
49
+ host_static_assets,
50
+ environment
51
+ } = useEnvironment();
52
+ const illustrationWarning = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`;
53
+ const illustrationError = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`;
54
+ const illustrationInfo = `${host_static_assets}/${environment}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
55
+ return /* @__PURE__ */ jsx(WrapperContentConfirm, {
56
+ children: /* @__PURE__ */ jsxs(ModalContent, {
57
+ children: [/* @__PURE__ */ jsx(IllustrationContainer, {
58
+ variant,
59
+ children: /* @__PURE__ */ jsx(BoxIcon, {
60
+ src: variant === "warning" ? illustrationWarning : variant === "delete" ? illustrationError : illustrationInfo,
61
+ sx: {
62
+ width: "230px",
63
+ height: "194px"
64
+ }
65
+ })
66
+ }), /* @__PURE__ */ jsx(MessageContainer, {
67
+ children: /* @__PURE__ */ jsx(Typography, {
68
+ variant: "body1",
69
+ children: msg
70
+ })
71
+ })]
72
+ })
73
+ });
74
+ };
75
+ const initialState = {
76
+ initialWidth: 600,
77
+ initialHeigth: 400,
78
+ open: false,
79
+ withClose: true,
80
+ onQueryClose: voidFunction,
81
+ iconComponent: void 0,
82
+ contentComponent: void 0,
83
+ actionComponents: void 0,
84
+ openModal: voidFunction,
85
+ openModalConfirm: voidFunction,
86
+ closeModal: voidFunction,
87
+ hasChanges: false,
88
+ setChanges: voidFunction,
89
+ title: ""
90
+ };
91
+ const ModalContext = createContext(initialState);
92
+ function ModalProvider({
93
+ children
94
+ }) {
95
+ const [modalOptions, setModalOptions] = useState({
96
+ open: initialState.open,
97
+ withClose: true,
98
+ onQueryClose: voidFunction,
99
+ title: "",
100
+ iconComponent: void 0,
101
+ contentComponent: void 0,
102
+ actionComponents: void 0,
103
+ standardActions: void 0,
104
+ variant: void 0
105
+ });
106
+ const [hasChanges, setHasChanges] = useState(false);
107
+ const openModal = (modalOpenProps) => {
108
+ setModalOptions({
109
+ open: true,
110
+ ...modalOpenProps
111
+ });
112
+ };
113
+ const openModalConfirm = (modalOpenConfirmProps) => {
114
+ const {
115
+ variant = "warning",
116
+ title,
117
+ msg,
118
+ onClickIntro,
119
+ onClickCancel
120
+ } = modalOpenConfirmProps;
121
+ const onClickIntroClose = () => {
122
+ onClickIntro && onClickIntro();
123
+ closeModal();
124
+ };
125
+ setModalOptions({
126
+ open: true,
127
+ title,
128
+ variant,
129
+ contentComponent: /* @__PURE__ */ jsx(ContentConfirm, {
130
+ variant,
131
+ msg
132
+ }),
133
+ standardActions: {
134
+ withCancel: true,
135
+ onClickIntro: onClickIntroClose,
136
+ onClickCancel
137
+ }
138
+ });
139
+ };
140
+ const closeModal = () => {
141
+ setModalOptions((last) => ({
142
+ ...last,
143
+ open: false
144
+ }));
145
+ setHasChanges(false);
146
+ };
147
+ const setChanges = () => {
148
+ setHasChanges(true);
149
+ };
150
+ return /* @__PURE__ */ jsxs(ModalContext.Provider, {
151
+ value: {
152
+ ...modalOptions,
153
+ openModal,
154
+ openModalConfirm,
155
+ closeModal,
156
+ hasChanges,
157
+ setChanges
158
+ },
159
+ children: [children, /* @__PURE__ */ jsx(ModalDialog, {})]
160
+ });
161
+ }
162
+ export { ModalContext as M, ModalProvider as a };