@m4l/components 0.0.23 → 0.0.24

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from './types';
3
+ export declare function Icon(props: IconProps): JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { styled } from "@mui/material";
2
+ import { jsx } from "react/jsx-runtime";
3
+ const MaskIcon = styled("div", {
4
+ shouldForwardProp: (props) => props !== "src" && props !== "width" && props !== "height" && props !== "bgColor"
5
+ })((props) => ({
6
+ WebkitMask: `url(${props.src}) no-repeat`,
7
+ mask: `url(${props.src}) no-repeat`,
8
+ width: props.width === void 0 ? "20px" : props.width,
9
+ height: props.height === void 0 ? "20px" : props.height,
10
+ backgroundColor: props.bgColor === "active" ? props.theme.palette.action.active : props.bgColor === "selected" ? props.theme.palette.primary.main : props.bgColor === "info" ? props.theme.palette.info.main : props.bgColor === "warning" ? props.theme.palette.warning.main : props.bgColor === "error" ? props.theme.palette.error.main : props.bgColor
11
+ }));
12
+ function Icon(props) {
13
+ const {
14
+ src = "https://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/commons/assets/icons/default.svg",
15
+ width = "20px",
16
+ height = "20px",
17
+ bgColor = "active"
18
+ } = props;
19
+ return /* @__PURE__ */ jsx(MaskIcon, {
20
+ src,
21
+ width,
22
+ height,
23
+ bgColor
24
+ });
25
+ }
26
+ export { Icon as I };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from './types';
3
+ export declare const MaskIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & IconProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,6 @@
1
+ export interface IconProps {
2
+ src: string;
3
+ width?: number | string;
4
+ height?: number | string;
5
+ bgColor?: string | 'info' | 'warning' | 'error' | 'active' | 'disabled';
6
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { MotionProps } from 'framer-motion';
3
+ import { BoxProps } from '@mui/material';
4
+ declare type IProps = BoxProps & MotionProps;
5
+ export interface Props extends IProps {
6
+ animate?: boolean;
7
+ action?: boolean;
8
+ }
9
+ export declare function MotionContainer({ animate, action, children, ...other }: Props): JSX.Element;
10
+ export {};
@@ -0,0 +1,31 @@
1
+ import { m } from "framer-motion";
2
+ import { Box } from "@mui/material";
3
+ import { v as varContainer } from "../variants/container.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ function MotionContainer({
6
+ animate,
7
+ action = false,
8
+ children,
9
+ ...other
10
+ }) {
11
+ if (action) {
12
+ return /* @__PURE__ */ jsx(Box, {
13
+ component: m.div,
14
+ initial: false,
15
+ animate: animate ? "animate" : "exit",
16
+ variants: varContainer(),
17
+ ...other,
18
+ children
19
+ });
20
+ }
21
+ return /* @__PURE__ */ jsx(Box, {
22
+ component: m.div,
23
+ initial: "initial",
24
+ animate: "animate",
25
+ exit: "exit",
26
+ variants: varContainer(),
27
+ ...other,
28
+ children
29
+ });
30
+ }
31
+ export { MotionContainer as M };
@@ -1,3 +1,4 @@
1
1
  export * from './variants';
2
2
  export { IconButtonAnimate } from './IconButtonAnimate';
3
+ export { MotionContainer } from './MotionContainer';
3
4
  export { MotionLazyContainer } from './MotionLazyContainer';
@@ -0,0 +1,19 @@
1
+ export declare type Props = {
2
+ staggerIn?: number;
3
+ delayIn?: number;
4
+ staggerOut?: number;
5
+ };
6
+ export declare const varContainer: (props?: Props | undefined) => {
7
+ animate: {
8
+ transition: {
9
+ staggerChildren: number;
10
+ delayChildren: number;
11
+ };
12
+ };
13
+ exit: {
14
+ transition: {
15
+ staggerChildren: number;
16
+ staggerDirection: number;
17
+ };
18
+ };
19
+ };
@@ -0,0 +1,20 @@
1
+ const varContainer = (props) => {
2
+ const staggerIn = props?.staggerIn || 0.05;
3
+ const delayIn = props?.staggerIn || 0.05;
4
+ const staggerOut = props?.staggerIn || 0.05;
5
+ return {
6
+ animate: {
7
+ transition: {
8
+ staggerChildren: staggerIn,
9
+ delayChildren: delayIn
10
+ }
11
+ },
12
+ exit: {
13
+ transition: {
14
+ staggerChildren: staggerOut,
15
+ staggerDirection: -1
16
+ }
17
+ }
18
+ };
19
+ };
20
+ export { varContainer as v };
@@ -1,2 +1,3 @@
1
1
  export * from './fade';
2
+ export * from './container';
2
3
  export * from './transition';
@@ -9,6 +9,7 @@ export type { RowKey } from '../components/DataGrid/types';
9
9
  export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
10
10
  export * from '../components/FormActions';
11
11
  export * from '../components/FormActions/dictionary';
12
+ export * from '../components/Icon';
12
13
  export * from '../components/Image';
13
14
  export * from '../components/LanguagePopover';
14
15
  export * from '../components/Loadable';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { I as IconButton, a as IconButtonAnimate } from "./components/mui_extended/IconButton/index.js";
2
2
  import "framer-motion";
3
+ import "@mui/material";
3
4
  import "react/jsx-runtime";
4
5
  import "react";
5
6
  import "react-hook-form";
@@ -7,7 +8,6 @@ export { F as FormProvider } from "./components/hook-form/FormProvider/index.js"
7
8
  import "react-router-dom";
8
9
  import "@m4l/core";
9
10
  import "@mui/lab";
10
- import "@mui/material";
11
11
  export { M as ModalContext, a as ModalProvider } from "./contexts/ModalContext/index.js";
12
12
  export { R as RHFAutocompleteAsync } from "./components/hook-form/RHFAutocompleteAsync/index.js";
13
13
  export { R as RHFCheckbox } from "./components/hook-form/RHFCheckbox/index.js";
@@ -27,6 +27,7 @@ import "react-dnd";
27
27
  import "react-dnd-html5-backend";
28
28
  import "date-fns";
29
29
  export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
30
+ export { I as Icon } from "./components/Icon/index.js";
30
31
  import "./react-draggable.js";
31
32
  export { M as ModalDialog, d as defaultModalDialogDictionary, g as getModalDialogComponentsDictionary } from "./components/ModalDialog/index.js";
32
33
  export { R as Resizeable } from "./components/Resizeable/index.js";
@@ -41,7 +42,9 @@ export { S as ScrollBar } from "./components/ScrollBar/index.js";
41
42
  import "./react-splitter-layout.js";
42
43
  export { S as SplitLayout } from "./components/SplitLayout/index.js";
43
44
  export { v as varFade } from "./components/animate/variants/fade.js";
45
+ export { v as varContainer } from "./components/animate/variants/container.js";
44
46
  export { v as varTranEnter, a as varTranExit, b as varTranHover } from "./components/animate/variants/transition.js";
47
+ export { M as MotionContainer } from "./components/animate/MotionContainer/index.js";
45
48
  export { M as MotionLazyContainer } from "./components/animate/MotionLazyContainer/index.js";
46
49
  export { R as RHFMultiCheckbox } from "./components/hook-form/RHFMultiCheckbox/index.js";
47
50
  export { R as RHFSelect } from "./components/hook-form/RHFSelect.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.23",
4
+ "version": "0.0.24",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "dev": "vite",