mui-design-system 0.0.40 → 0.0.41

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.
@@ -17,7 +17,7 @@ const UFCheckbox = ({ form, name, label, rules, error, helperText, withoutHelper
17
17
  typography: {
18
18
  ...props?.slotProps?.typography,
19
19
  },
20
- }, control: _jsx(Checkbox, { color: "primary", checked: value, onChange: onChange, disabled: disabled, name: name, ...deepMerge(theme?.checkbox?.checkboxProps, itemProps, propsForCheckbox) }), label: label }), !withoutHelperText && (_jsx(Typography, { sx: {
20
+ }, control: _jsx(Checkbox, { name: name, color: "primary", checked: value, onChange: onChange, disabled: disabled, ...deepMerge(theme?.checkbox?.checkboxProps, itemProps, propsForCheckbox) }), label: label }), !withoutHelperText && (_jsx(Typography, { sx: {
21
21
  height: 23,
22
22
  width: "max-content",
23
23
  color: error ? "error.4" : "text.primary",
@@ -1,31 +1,77 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { keyframes } from '@mui/material/styles';
2
3
  import UnCheckedIcon from './assets/UnChekedIcon';
3
4
  import CheckedIcon from './assets/CheckedIcon';
4
5
  import IntermediateIcon from './assets/IntermediateIcon';
6
+ const checkboxIconSize = {
7
+ small: 20,
8
+ medium: 24,
9
+ large: 32,
10
+ };
11
+ const checkboxRootSize = {
12
+ small: 34,
13
+ medium: 42,
14
+ large: 50,
15
+ };
16
+ const checkboxPop = keyframes `
17
+ 0% { transform: scale(0.82); opacity: 0.4; }
18
+ 65% { transform: scale(1.08); opacity: 1; }
19
+ 100% { transform: scale(1); opacity: 1; }
20
+ `;
21
+ const drawCheckmark = keyframes `
22
+ from { stroke-dashoffset: 13; }
23
+ to { stroke-dashoffset: 0; }
24
+ `;
25
+ const drawIndeterminate = keyframes `
26
+ from { stroke-dashoffset: 8; }
27
+ to { stroke-dashoffset: 0; }
28
+ `;
5
29
  export const MuiCheckbox = {
6
30
  defaultProps: {
31
+ size: 'medium',
7
32
  icon: _jsx(UnCheckedIcon, {}),
8
33
  checkedIcon: _jsx(CheckedIcon, {}),
9
34
  indeterminateIcon: _jsx(IntermediateIcon, {}),
10
35
  },
11
36
  styleOverrides: {
12
- root: ({ theme, ownerState }) => ({
13
- transition: 'transform 0.5s ease',
14
- width: ownerState.size === 'small' ? '34px' : '42px',
15
- height: ownerState.size === 'small' ? '34px' : '42px',
16
- ':active': {
17
- transform: 'scale(85%)',
18
- },
19
- '&.Mui-checked': {
20
- fill: theme.palette[ownerState?.color ?? 'primary'].main,
21
- stroke: theme.palette.text.primary,
22
- },
23
- }),
24
- checked: ({ theme, ownerState }) => ({
25
- fill: theme.palette[ownerState?.color ?? 'primary'].main,
26
- }),
27
- indeterminate: ({ theme, ownerState }) => ({
28
- fill: theme.palette[ownerState?.color ?? 'primary'].main,
29
- }),
37
+ root: ({ theme, ownerState }) => {
38
+ const size = ownerState.size ?? 'medium';
39
+ const iconSize = checkboxIconSize[size];
40
+ const rootSize = checkboxRootSize[size];
41
+ return {
42
+ color: theme.palette.divider,
43
+ padding: size === 'small' ? '7px' : '9px',
44
+ transition: 'transform 150ms ease',
45
+ width: rootSize,
46
+ height: rootSize,
47
+ '& svg': {
48
+ width: iconSize,
49
+ height: iconSize,
50
+ },
51
+ ':active': {
52
+ transform: 'scale(85%)',
53
+ },
54
+ '&.Mui-checked, &.MuiCheckbox-indeterminate': {
55
+ color: theme.palette[ownerState.color ?? 'primary'].main,
56
+ },
57
+ '&.Mui-checked svg, &.MuiCheckbox-indeterminate svg': {
58
+ animation: `${checkboxPop} 180ms cubic-bezier(0.2, 0, 0, 1)`,
59
+ },
60
+ '&.Mui-checked svg path': {
61
+ strokeDasharray: 13,
62
+ animation: `${drawCheckmark} 220ms 40ms ease-out both`,
63
+ },
64
+ '&.MuiCheckbox-indeterminate svg path': {
65
+ strokeDasharray: 8,
66
+ animation: `${drawIndeterminate} 180ms 40ms ease-out both`,
67
+ },
68
+ '@media (prefers-reduced-motion: reduce)': {
69
+ transition: 'none',
70
+ '& svg, & svg path': {
71
+ animation: 'none',
72
+ },
73
+ },
74
+ };
75
+ },
30
76
  },
31
77
  };
@@ -1,8 +1,3 @@
1
- import { type SVGProps } from "react";
2
- type ColorTypes = "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
3
- interface Props extends SVGProps<any> {
4
- backgroundColor?: ColorTypes;
5
- borderColor?: string;
6
- }
7
- declare const CheckedIcon: ({ borderColor, backgroundColor, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
1
+ import { type SVGProps } from 'react';
2
+ declare const CheckedIcon: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
8
3
  export default CheckedIcon;
@@ -1,12 +1,3 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- const CheckedIcon = ({ borderColor, backgroundColor, ...props }) => {
4
- const theme = useTheme();
5
- const svgBackgroundColor = backgroundColor
6
- ? theme.palette[backgroundColor ?? "primary"].main
7
- : "inherit";
8
- const svgBorderColor = borderColor ?? "inherit";
9
- const svgInnerElementColor = theme.palette.grey[1];
10
- return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, fill: svgBackgroundColor || "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: svgBorderColor || "#1A1A1A", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7" }), _jsx("path", { stroke: svgInnerElementColor || "#1A1A1A", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "m7.75 12 2.83 2.83 5.67-5.66" })] }));
11
- };
2
+ const CheckedIcon = (props) => (_jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: 24, height: 24, viewBox: '0 0 24 24', fill: 'none', ...props, children: [_jsx("rect", { width: 20, height: 20, x: 2, y: 2, rx: 3.5, fill: 'currentColor' }), _jsx("path", { d: 'm7.5 12 3 3 6-6', stroke: '#fff', strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: 2 })] }));
12
3
  export default CheckedIcon;
@@ -1,8 +1,3 @@
1
1
  import { type SVGProps } from 'react';
2
- type ColorTypes = 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
3
- interface Props extends SVGProps<any> {
4
- backgroundColor?: ColorTypes;
5
- borderColor?: string;
6
- }
7
- declare const IntermediateIcon: ({ borderColor, backgroundColor, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
2
+ declare const IntermediateIcon: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
8
3
  export default IntermediateIcon;
@@ -1,10 +1,3 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- const IntermediateIcon = ({ borderColor, backgroundColor, ...props }) => {
4
- const theme = useTheme();
5
- const svgInnerElementColor = theme.palette.background.paper;
6
- const svgBorderColor = borderColor ?? theme.palette.text.primary;
7
- const svgBackgroundColor = theme.palette[backgroundColor ?? 'primary'].main;
8
- return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, fill: svgBackgroundColor || "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: svgBorderColor || "#1A1A1A", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7" }), _jsx("path", { stroke: svgInnerElementColor || "#1A1A1A", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h8M9 0" })] }));
9
- };
2
+ const IntermediateIcon = (props) => (_jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: 24, height: 24, viewBox: '0 0 24 24', fill: 'none', ...props, children: [_jsx("rect", { width: 20, height: 20, x: 2, y: 2, rx: 3.5, fill: 'currentColor' }), _jsx("path", { d: 'M8 12h8', stroke: '#fff', strokeLinecap: 'round', strokeWidth: 2 })] }));
10
3
  export default IntermediateIcon;
@@ -1,7 +1,3 @@
1
1
  import { type SVGProps } from 'react';
2
- interface Props extends SVGProps<any> {
3
- backgroundColor?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
4
- borderColor?: string;
5
- }
6
- declare const UnCheckedIcon: ({ backgroundColor, borderColor, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
2
+ declare const UnCheckedIcon: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
7
3
  export default UnCheckedIcon;
@@ -1,9 +1,3 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- const UnCheckedIcon = ({ backgroundColor, borderColor, ...props }) => {
4
- const theme = useTheme();
5
- const svgBackgroundColor = backgroundColor ? theme.palette[backgroundColor ?? 'primary'].main : undefined;
6
- const svgBorderColor = borderColor ?? theme.palette.text.primary;
7
- return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, fill: svgBackgroundColor || "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: svgBorderColor || "#1A1A1A", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9.3 21h5.4c4.5 0 6.3-1.8 6.3-6.3V9.3C21 4.8 19.2 3 14.7 3H9.3C4.8 3 3 4.8 3 9.3v5.4C3 19.2 4.8 21 9.3 21" }) }));
8
- };
2
+ const UnCheckedIcon = (props) => (_jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: 24, height: 24, viewBox: '0 0 24 24', fill: 'none', ...props, children: _jsx("rect", { width: 19, height: 19, x: 2.5, y: 2.5, rx: 3.5, stroke: 'currentColor', strokeWidth: 1 }) }));
9
3
  export default UnCheckedIcon;
@@ -27,6 +27,7 @@ import { MuiBreadcrumbs } from '../mui/BreadCrumbs/MuiBreadCrumbs';
27
27
  import { MuiDialog } from '../mui/Dialog/MuiDialog';
28
28
  import { breakpoints } from '../mui/breakpoints';
29
29
  import { MuiMenuItem } from '../mui/menu/MuiMenuItem';
30
+ import { MuiCheckbox } from '../mui/Checkbox/Checkbox';
30
31
  const getDesignTokens = (mode) => ({
31
32
  mode,
32
33
  ...(mode === 'light' ? lightPalette : darkPalette),
@@ -49,6 +50,7 @@ export const themeOptions = (mode, isRtl) => ({
49
50
  MuiSwitch,
50
51
  MuiTooltip,
51
52
  MuiMenuItem,
53
+ MuiCheckbox,
52
54
  MuiTextField,
53
55
  MuiAccordion,
54
56
  MuiInputLabel,
@@ -34,6 +34,9 @@ declare module '@mui/material/Checkbox/Checkbox' {
34
34
  interface CheckboxProps {
35
35
  customColor?: string;
36
36
  }
37
+ interface CheckboxPropsSizeOverrides {
38
+ large: true;
39
+ }
37
40
  }
38
41
  declare module '@mui/material/Chip' {
39
42
  interface ChipOwnProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mui-design-system",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "MUI-based design system with theme, form components, and utilities",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -69,4 +69,4 @@
69
69
  "bugs": {
70
70
  "url": "https://github.com/MohammadPj/design-system/issues"
71
71
  }
72
- }
72
+ }