mui-design-system 0.0.39 → 0.0.40

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.
@@ -3,7 +3,7 @@ import { InputAdornment, TextField } from '@mui/material';
3
3
  import SvgCalendar from '../../icons/Calendar';
4
4
  const CustomComponent = ({ openCalendar, value, handleValueChange, disabled, error, readonly, variant, lang, placeholder, inputLabelMode, label, withoutHelperText, ...rest }) => {
5
5
  const { sx, helperText, ...props } = rest;
6
- return (_jsx(TextField, { placeholder: placeholder ?? lang === 'fa' ? 'انتخاب کنید' : 'Pick a date', error: Boolean(error), ...(inputLabelMode === 'static' && { hiddenLabel: true }), ...(inputLabelMode === 'relative' && { label: label }), fullWidth: true, variant: variant, sx: {
6
+ return (_jsx(TextField, { placeholder: 'انتخاب کنید', error: Boolean(error), ...(inputLabelMode === 'static' && { hiddenLabel: true }), ...(inputLabelMode === 'relative' && { label: label }), fullWidth: true, variant: variant, sx: {
7
7
  // ...(inputLabelMode === "static" && {
8
8
  // ".MuiFilledInput-input": {
9
9
  // py: "16px !important",
@@ -31,6 +31,6 @@ const CustomComponent = ({ openCalendar, value, handleValueChange, disabled, err
31
31
  ? `${theme.palette.text.disabled} !important`
32
32
  : 'text.primary',
33
33
  }, children: _jsx(SvgCalendar, { primarycolor: 'inherit' }) })),
34
- }, disabled: disabled, value: value, onFocus: openCalendar, onClick: openCalendar, onChange: handleValueChange, helperText: withoutHelperText ? undefined : error?.message ?? helperText ?? ' ', ...props }));
34
+ }, disabled: disabled, value: value, onFocus: openCalendar, onClick: openCalendar, onChange: handleValueChange, helperText: withoutHelperText ? undefined : (error?.message ?? helperText ?? ' '), ...props }));
35
35
  };
36
36
  export default CustomComponent;
@@ -13,12 +13,10 @@ const CustomDatePicker = ({ onChange, value, disabled, error, readOnly, textFiel
13
13
  onChange(convertDate);
14
14
  }
15
15
  };
16
- let lang = document.documentElement.lang;
17
16
  const { palette } = useTheme();
18
17
  const [portalTarget, setPortalTarget] = useState();
19
18
  useEffect(() => {
20
19
  setColors(palette);
21
- lang = document.documentElement.lang;
22
20
  }, [palette.mode, document.documentElement.lang]);
23
21
  useEffect(() => {
24
22
  const portalDiv = document.createElement("div");
@@ -32,11 +30,7 @@ const CustomDatePicker = ({ onChange, value, disabled, error, readOnly, textFiel
32
30
  };
33
31
  }, []);
34
32
  const defaultWeekDays = ["ش", "ی", "د", "س", "چ", "پ", "ج"];
35
- return (_jsx(DatePicker, { className: "custom-calender", value: value ? new Date(value) : null, portal: true, portalTarget: portalTarget, hideOnScroll: true, onChange: handleChange, ...(lang === "fa" && {
36
- weekDays: defaultWeekDays,
37
- calendar: persian,
38
- locale: persian_fa,
39
- }), calendarPosition: "bottom-left", editable: false, disabled: disabled, containerStyle: { width: "100%" }, ...rest, render: _jsx(CustomComponent, { lang: lang, error: error, disabled: disabled, readonly: readOnly, label: label, inputLabelMode: inputLabelMode, openCalendar: undefined, value: value, handleValueChange: undefined, withoutHelperText: withoutHelperText, ...textFieldProps }) }));
33
+ return (_jsx(DatePicker, { className: 'custom-calender', value: value ? new Date(value) : null, portal: true, portalTarget: portalTarget, hideOnScroll: true, onChange: handleChange, weekDays: defaultWeekDays, calendar: persian, locale: persian_fa, calendarPosition: 'bottom-left', editable: false, disabled: disabled, containerStyle: { width: '100%' }, ...rest, render: _jsx(CustomComponent, { lang: 'fa', error: error, disabled: disabled, readonly: readOnly, label: label, inputLabelMode: inputLabelMode, openCalendar: undefined, value: value, handleValueChange: undefined, withoutHelperText: withoutHelperText, ...textFieldProps }) }));
40
34
  };
41
35
  export default CustomDatePicker;
42
36
  const setColors = (colors) => {
@@ -5,17 +5,17 @@ import { TypographyProps } from "@mui/material/Typography";
5
5
  import { TFormSchema, TInputLabelMode } from "./type";
6
6
  import { TextFieldProps } from "@mui/material/TextField";
7
7
  export interface FormProps {
8
+ itemProps?: any;
9
+ disabled?: boolean;
8
10
  schema: TFormSchema;
9
- form: UseFormReturn<any, any, any>;
10
- gridContainerProps?: GridProps;
11
11
  gridItemProps?: GridProps;
12
- itemProps?: any;
13
- labelsProps?: Partial<TypographyProps<"label", {}>> | undefined;
14
12
  hideRequiredStar?: boolean;
13
+ withoutHelperText?: boolean;
14
+ gridContainerProps?: GridProps;
15
15
  inputLabelMode?: TInputLabelMode;
16
+ form: UseFormReturn<any, any, any>;
16
17
  inputVariants?: TextFieldProps["variant"];
17
- withoutHelperText?: boolean;
18
- disabled?: boolean;
18
+ labelsProps?: Partial<TypographyProps<"label", {}>> | undefined;
19
19
  }
20
20
  declare const Form: FC<FormProps>;
21
21
  export default Form;
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isValidElement } from "react";
3
+ //@3rd Party
4
+ import { get } from "react-hook-form";
3
5
  //------------------------------------------------------------------------
4
6
  //@Mui
5
7
  import Box from "@mui/material/Box";
@@ -9,10 +11,10 @@ import Typography from "@mui/material/Typography";
9
11
  import UseFormInput from "./UseFormInput";
10
12
  import { deepMerge, result } from "../../methods/general";
11
13
  const Form = ({ schema, form, gridItemProps, gridContainerProps, labelsProps, itemProps, hideRequiredStar = false, inputLabelMode = "static", inputVariants = "outlined", withoutHelperText, disabled, }) => {
12
- return (_jsx(Grid, { container: true, columnSpacing: 4, rowSpacing: 0, rowGap: 2, alignItems: "flex-start", ...gridContainerProps, children: schema?.map((inputProp) => (_jsxs(Grid, { item: true, xs: 4, width: "100%", height: "auto", position: "relative", ...deepMerge(gridItemProps, inputProp.gridItemProp), children: [inputLabelMode === "static" && inputProp.type !== "checkbox" && (_jsx(Box, { display: "flex", children: _jsx(Typography, { variant: "body-s-semibold", flexGrow: 1, width: 0, component: "label", display: "inline-block", mb: 2, htmlFor: inputProp.name, color: result(form?.formState?.errors, `${inputProp.name}`)
13
- ? "error"
14
- : "text.16", noWrap: true, title: !isValidElement(inputProp?.label)
15
- ? inputProp?.label?.toString() || ""
16
- : "", ...deepMerge(labelsProps, inputProp.labelProps), children: _jsxs(Stack, { direction: "row", children: [inputProp.label, inputProp.rules?.required && !hideRequiredStar && (_jsx(Typography, { component: "span", color: "error", fontSize: 12, children: "*" }))] }) }) })), _jsx(UseFormInput, { form: form, itemProps: itemProps, error: result(form?.formState?.errors, `${inputProp.name}`), inputLabelMode: inputLabelMode, inputVariants: inputVariants, withoutHelperText: withoutHelperText, disabled: disabled, ...inputProp })] }, inputProp.name))) }));
14
+ return (_jsx(Grid, { container: true, columnSpacing: 4, rowSpacing: 0, rowGap: 2, alignItems: 'flex-start', ...gridContainerProps, children: schema?.map((inputProp) => (_jsxs(Grid, { item: true, xs: 4, width: '100%', height: 'auto', position: 'relative', ...deepMerge(gridItemProps, inputProp.gridItemProp), children: [inputLabelMode === 'static' && inputProp.type !== 'checkbox' && (_jsx(Box, { display: 'flex', children: _jsx(Typography, { variant: 'body-s-semibold', flexGrow: 1, width: 0, component: 'label', display: 'inline-block', mb: 2, htmlFor: inputProp.name, color: result(form?.formState?.errors, `${inputProp.name}`)
15
+ ? 'error'
16
+ : 'text.16', noWrap: true, title: !isValidElement(inputProp?.label)
17
+ ? inputProp?.label?.toString() || ''
18
+ : '', ...deepMerge(labelsProps, inputProp.labelProps), children: _jsxs(Stack, { direction: 'row', children: [inputProp.label, inputProp.rules?.required && !hideRequiredStar && (_jsx(Typography, { component: 'span', color: 'error', fontSize: 12, children: "*" }))] }) }) })), _jsx(UseFormInput, { form: form, itemProps: itemProps, error: get(form?.formState?.errors, `${inputProp.name}`), inputLabelMode: inputLabelMode, inputVariants: inputVariants, withoutHelperText: withoutHelperText, disabled: disabled, ...inputProp })] }, inputProp.name))) }));
17
19
  };
18
20
  export default Form;
@@ -34,11 +34,7 @@ export const MuiSelect = {
34
34
  pointerEvents: 'none',
35
35
  backgroundColor: theme.palette.background[3],
36
36
  }),
37
- '&.Mui-disabled': {
38
- stroke: theme.palette.background['1'],
39
- color: theme.palette.text.disabled,
40
- backgroundColor: theme.palette.background['1'],
41
- },
37
+ '&.Mui-disabled': {},
42
38
  '&.Mui-error': {
43
39
  stroke: theme.palette.error[3],
44
40
  },
@@ -1,64 +1,53 @@
1
1
  export const MuiOutlinedInput = {
2
2
  styleOverrides: {
3
3
  root: ({ ownerState, theme }) => ({
4
- stroke: theme.palette.text.primary,
5
4
  borderRadius: theme.spacing(2),
6
5
  minWidth: 80,
7
- ...theme.typography?.["body-s-medium"],
6
+ height: ownerState.size === 'small' ? 40 : ownerState.multiline ? 'auto' : 48,
7
+ ...theme.typography['body-s-medium'],
8
8
  lineHeight: '100%',
9
- height: ownerState.size === 'small'
10
- ? '40px'
11
- : ownerState.multiline
12
- ? 'auto'
13
- : '48px',
9
+ paddingRight: 10,
10
+ // Input text
14
11
  '& .MuiOutlinedInput-input': {
15
12
  display: 'flex',
16
13
  alignItems: 'center',
17
- color: `${theme.palette.text.primary} !important`,
14
+ color: theme.palette.text.primary + ' !important',
18
15
  ...(ownerState.readOnly && {
19
16
  pointerEvents: 'none',
20
- backgroundColor: 'shadow.2',
21
- color: 'text.disabled',
17
+ color: theme.palette.text.disabled,
22
18
  }),
23
19
  },
24
- //Temporary Added
25
- paddingRight: 10,
26
- //Disable state
20
+ // Disabled state
27
21
  '&.Mui-disabled': {
28
22
  pointerEvents: 'none',
23
+ backgroundColor: theme.palette.text[4],
29
24
  '& .MuiInputAdornment-root': {
30
25
  stroke: theme.palette.text[8],
31
26
  },
32
- backgroundColor: theme.palette.text[4],
33
27
  },
34
- //Label that goes on the border of component
28
+ // Normal outline
35
29
  '& .MuiOutlinedInput-notchedOutline': {
36
30
  transition: 'border-color 0.2s ease',
37
- ...theme.typography?.["body-s-medium"],
38
- ...(ownerState.disabled && {
39
- border: 'none',
40
- }),
41
31
  },
42
- //Main border color on hover
32
+ // ❗ FIX: Prevent hover border color change
43
33
  '&:hover .MuiOutlinedInput-notchedOutline': {
44
- borderColor: theme.palette.text.primary,
34
+ borderColor: theme.palette.text[6],
45
35
  },
46
- //Focused State
47
- '&.Mui-focused ': {
48
- '& .MuiOutlinedInput-notchedOutline': {
49
- borderColor: theme.palette[ownerState.color ?? 'primary'].main,
50
- borderWidth: 1,
51
- },
36
+ // Focused
37
+ '&.Mui-focused .MuiOutlinedInput-notchedOutline': {
38
+ borderColor: theme.palette[ownerState.color ?? 'primary'].main,
39
+ borderWidth: 1,
52
40
  },
53
- //Error State
54
- '&.Mui-error ': {
55
- stroke: theme.palette.error[3],
41
+ }),
42
+ error: ({ theme }) => ({
43
+ // Error
44
+ '&.Mui-error': {
56
45
  '& .MuiOutlinedInput-notchedOutline': {
57
- borderColor: theme.palette.error['3'],
46
+ borderColor: theme.palette.error.main,
58
47
  borderWidth: 1,
59
48
  },
60
49
  '& .MuiInputAdornment-root': {
61
- stroke: theme.palette.error['2'],
50
+ stroke: theme.palette.error.dark,
62
51
  },
63
52
  },
64
53
  }),
@@ -8,7 +8,6 @@ export const MuiMenuItem = {
8
8
  backgroundColor: theme.palette.primary[1]
9
9
  },
10
10
  color: theme.palette.text.primary,
11
- ...theme.typography['body-2xs'],
12
11
  })
13
12
  },
14
13
  };
@@ -1,11 +1,11 @@
1
1
  export const darkPalette = {
2
2
  primary: {
3
3
  main: '#6950f3',
4
- contrastText: "#fff"
4
+ contrastText: '#fff',
5
5
  },
6
6
  secondary: {
7
7
  main: '#0d1619',
8
- contrastText: "#fff"
8
+ contrastText: '#fff',
9
9
  },
10
10
  divider: '#D4D4D4',
11
11
  background: {
@@ -32,50 +32,34 @@ export const darkPalette = {
32
32
  primary: '#FFFFFF',
33
33
  secondary: '#FDFDFD',
34
34
  disabled: '#F7F7F7',
35
- "16": "rgb(255,255,255)",
36
- "15": "rgb(238,238,238)",
37
- "14": "rgb(221,221,221)",
38
- "13": "rgb(204,204,204)",
39
- "12": "rgb(187,187,187)",
40
- "11": "rgb(170,170,170)",
41
- "10": "rgb(153,153,153)",
42
- "8": "rgb(119,119,119)",
43
- "9": "rgb(136,136,136)",
44
- "7": "rgb(102,102,102)",
45
- "6": "rgb(85,85,85)",
46
- "5": "rgb(68,68,68)",
47
- "4": "rgb(51,51,51)",
48
- "3": "rgb(34,34,34)",
49
- "2": "rgb(17,17,17)",
50
- "1": "#0d1619",
35
+ '16': 'rgb(255,255,255)',
36
+ '15': 'rgb(238,238,238)',
37
+ '14': 'rgb(221,221,221)',
38
+ '13': 'rgb(204,204,204)',
39
+ '12': 'rgb(187,187,187)',
40
+ '11': 'rgb(170,170,170)',
41
+ '10': 'rgb(153,153,153)',
42
+ '8': 'rgb(119,119,119)',
43
+ '9': 'rgb(136,136,136)',
44
+ '7': 'rgb(102,102,102)',
45
+ '6': 'rgb(85,85,85)',
46
+ '5': 'rgb(68,68,68)',
47
+ '4': 'rgb(51,51,51)',
48
+ '3': 'rgb(34,34,34)',
49
+ '2': 'rgb(17,17,17)',
50
+ '1': '#0d1619',
51
51
  },
52
52
  inherit: {
53
- light: "inherit",
54
- dark: "inherit",
55
- contrastText: "inherit",
56
- main: "#1A1A1A",
57
- 16: 'inherit',
58
- 15: 'inherit',
59
- 14: 'inherit',
60
- 13: 'inherit',
61
- 12: 'inherit',
62
- 11: 'inherit',
63
- 10: 'inherit',
64
- 9: 'inherit',
65
- 8: 'inherit',
66
- 7: 'inherit',
67
- 6: 'inherit',
68
- 5: 'inherit',
69
- 4: 'inherit',
70
- 3: 'inherit',
71
- 2: 'inherit',
72
- 1: 'inherit',
53
+ light: 'rgb(51,51,51)',
54
+ dark: 'rgb(17,17,17)',
55
+ contrastText: '#0d1619',
56
+ main: '#FDFDFD',
73
57
  },
74
58
  default: {
75
- light: "#616161",
76
- dark: "#616161",
77
- contrastText: "#616161",
78
- main: "#1A1A1A",
59
+ light: '#616161',
60
+ dark: '#616161',
61
+ contrastText: '#616161',
62
+ main: '#1A1A1A',
79
63
  16: '#1A1A1A',
80
64
  15: '#303030',
81
65
  14: '#4A4A4A',
@@ -92,5 +76,5 @@ export const darkPalette = {
92
76
  3: '#FAFAFA',
93
77
  2: '#FDFDFD',
94
78
  1: '#FFFFFF',
95
- }
79
+ },
96
80
  };
@@ -1,11 +1,11 @@
1
1
  export const lightPalette = {
2
2
  primary: {
3
3
  main: '#6950f3',
4
- contrastText: "#fff"
4
+ contrastText: '#fff',
5
5
  },
6
6
  secondary: {
7
7
  main: '#0d1619',
8
- contrastText: "#fff"
8
+ contrastText: '#fff',
9
9
  },
10
10
  divider: '#D4D4D4',
11
11
  background: {
@@ -23,7 +23,9 @@ export const lightPalette = {
23
23
  main: '#E1CB00',
24
24
  },
25
25
  error: {
26
- main: '#B5260B',
26
+ main: '#d4163a',
27
+ light: '#f81a43',
28
+ dark: '#9a112c',
27
29
  },
28
30
  info: {
29
31
  main: '#007CB4',
@@ -32,50 +34,34 @@ export const lightPalette = {
32
34
  primary: '#0d1619',
33
35
  secondary: '#141414',
34
36
  disabled: '#303030',
35
- "16": "#0d1619",
36
- "15": "rgb(17,17,17)",
37
- "14": "rgb(34,34,34)",
38
- "13": "rgb(51,51,51)",
39
- "12": "rgb(68,68,68)",
40
- "11": "rgb(85,85,85)",
41
- "10": "rgb(102,102,102)",
42
- "9": "rgb(119,119,119)",
43
- "8": "rgb(136,136,136)",
44
- "7": "rgb(153,153,153)",
45
- "6": "rgb(170,170,170)",
46
- "5": "rgb(187,187,187)",
47
- "4": "rgb(204,204,204)",
48
- "3": "rgb(221,221,221)",
49
- "2": "rgb(238,238,238)",
50
- "1": "rgb(255,255,255)",
37
+ '16': '#0d1619',
38
+ '15': 'rgb(17,17,17)',
39
+ '14': 'rgb(34,34,34)',
40
+ '13': 'rgb(51,51,51)',
41
+ '12': 'rgb(68,68,68)',
42
+ '11': 'rgb(85,85,85)',
43
+ '10': 'rgb(102,102,102)',
44
+ '9': 'rgb(119,119,119)',
45
+ '8': 'rgb(136,136,136)',
46
+ '7': 'rgb(153,153,153)',
47
+ '6': 'rgb(170,170,170)',
48
+ '5': 'rgb(187,187,187)',
49
+ '4': 'rgb(204,204,204)',
50
+ '3': 'rgb(221,221,221)',
51
+ '2': 'rgb(238,238,238)',
52
+ '1': 'rgb(255,255,255)',
51
53
  },
52
54
  inherit: {
53
- light: "inherit",
54
- dark: "inherit",
55
- contrastText: "inherit",
56
- main: "#1A1A1A",
57
- 16: 'inherit',
58
- 15: 'inherit',
59
- 14: 'inherit',
60
- 13: 'inherit',
61
- 12: 'inherit',
62
- 11: 'inherit',
63
- 10: 'inherit',
64
- 9: 'inherit',
65
- 8: 'inherit',
66
- 7: 'inherit',
67
- 6: 'inherit',
68
- 5: 'inherit',
69
- 4: 'inherit',
70
- 3: 'inherit',
71
- 2: 'inherit',
72
- 1: 'inherit',
55
+ light: 'rgb(238,238,238)',
56
+ dark: 'rgb(204,204,204)',
57
+ contrastText: '#FDFDFD',
58
+ main: '#0d1619',
73
59
  },
74
60
  default: {
75
- light: "#616161",
76
- dark: "#616161",
77
- contrastText: "#616161",
78
- main: "#1A1A1A",
61
+ light: '#616161',
62
+ dark: '#616161',
63
+ contrastText: '#616161',
64
+ main: '#1A1A1A',
79
65
  16: '#1A1A1A',
80
66
  15: '#303030',
81
67
  14: '#4A4A4A',
@@ -92,5 +78,5 @@ export const lightPalette = {
92
78
  3: '#FAFAFA',
93
79
  2: '#FDFDFD',
94
80
  1: '#FFFFFF',
95
- }
81
+ },
96
82
  };
@@ -38,30 +38,30 @@ export const themeOptions = (mode, isRtl) => ({
38
38
  typography,
39
39
  breakpoints,
40
40
  components: {
41
- MuiCssBaseline,
42
- MuiAccordion,
43
- MuiAlert,
44
41
  MuiChip,
45
- MuiPagination,
46
- MuiPaginationItem,
47
- MuiSelect,
48
- MuiIconButton,
49
42
  MuiMenu,
50
43
  MuiCard,
51
- MuiTypography,
52
- MuiInputLabel,
53
- MuiTooltip,
54
- MuiFormControlLabel,
55
- MuiInputAdornment,
56
- MuiAutocomplete,
57
- MuiBreadcrumbs,
44
+ MuiRadio,
45
+ MuiAlert,
58
46
  MuiDialog,
47
+ MuiSelect,
48
+ MuiButton,
49
+ MuiSwitch,
50
+ MuiTooltip,
59
51
  MuiMenuItem,
60
52
  MuiTextField,
61
- MuiOutlinedInput,
53
+ MuiAccordion,
54
+ MuiInputLabel,
55
+ MuiIconButton,
56
+ MuiTypography,
57
+ MuiPagination,
58
+ MuiCssBaseline,
62
59
  MuiFilledInput,
63
- MuiButton,
64
- MuiSwitch,
65
- MuiRadio,
60
+ MuiBreadcrumbs,
61
+ MuiAutocomplete,
62
+ MuiOutlinedInput,
63
+ MuiPaginationItem,
64
+ MuiInputAdornment,
65
+ MuiFormControlLabel,
66
66
  },
67
67
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mui-design-system",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
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",