mui-design-system 0.0.21 → 0.0.23

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 (113) hide show
  1. package/dist/components/custom-auto-complete/CustomAutoComplete.d.ts +1 -1
  2. package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +1 -1
  3. package/dist/components/custom-date-picker/CustomComponent.d.ts +1 -1
  4. package/dist/components/custom-date-picker/CustomDatePicker.d.ts +1 -1
  5. package/dist/components/custom-date-picker/CustomDatePicker.js +16 -11
  6. package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +1 -1
  7. package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +1 -1
  8. package/dist/components/custom-table/CustomTable.d.ts +2 -53
  9. package/dist/components/custom-table/CustomTable.js +7 -13
  10. package/dist/components/custom-table/components/CustomTableBody.d.ts +5 -4
  11. package/dist/components/custom-table/components/CustomTableBody.js +22 -4
  12. package/dist/components/custom-table/components/CustomTableCell.d.ts +2 -2
  13. package/dist/components/custom-table/components/CustomTableCell.js +16 -14
  14. package/dist/components/custom-table/components/CustomTableHead.d.ts +5 -3
  15. package/dist/components/custom-table/components/CustomTableHead.js +14 -13
  16. package/dist/components/custom-table/components/CustomTableRow.d.ts +5 -9
  17. package/dist/components/custom-table/components/CustomTableRow.js +17 -14
  18. package/dist/components/custom-table/components/useTable.d.ts +4 -16
  19. package/dist/components/custom-table/components/useTable.js +5 -5
  20. package/dist/components/custom-table/types.d.ts +77 -0
  21. package/dist/components/{input-list → form}/UseFormInput.js +1 -4
  22. package/dist/components/{input-list → form}/type.d.ts +1 -5
  23. package/dist/components/form/type.js +1 -0
  24. package/dist/components/index.d.ts +42 -98
  25. package/dist/components/index.js +55 -69
  26. package/dist/context/FormContext.d.ts +1 -1
  27. package/dist/mui/Button/MuiButton.js +13 -12
  28. package/dist/mui/Typography/index.js +13 -13
  29. package/dist/mui/palette/dark/darkPalette.js +47 -86
  30. package/dist/mui/palette/light/lightPalette.js +48 -87
  31. package/package.json +1 -1
  32. package/dist/components/checkbox-list/CheckboxList.d.ts +0 -21
  33. package/dist/components/checkbox-list/CheckboxList.js +0 -31
  34. package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.d.ts +0 -28
  35. package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.js +0 -92
  36. package/dist/components/custom-auto-complete-advanced/components/ListBox.d.ts +0 -6
  37. package/dist/components/custom-auto-complete-advanced/components/ListBox.js +0 -76
  38. package/dist/components/custom-auto-complete-advanced/components/ListRow.d.ts +0 -2
  39. package/dist/components/custom-auto-complete-advanced/components/ListRow.js +0 -17
  40. package/dist/components/custom-auto-complete-advanced/components/RenderInput.d.ts +0 -23
  41. package/dist/components/custom-auto-complete-advanced/components/RenderInput.js +0 -51
  42. package/dist/components/custom-auto-complete-advanced/components/RenderTags.d.ts +0 -9
  43. package/dist/components/custom-auto-complete-advanced/components/RenderTags.js +0 -22
  44. package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.d.ts +0 -17
  45. package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.js +0 -11
  46. package/dist/components/custom-card/CustomHorizontalCard.d.ts +0 -3
  47. package/dist/components/custom-card/CustomHorizontalCard.js +0 -9
  48. package/dist/components/custom-card/CustomVerticalCard.d.ts +0 -3
  49. package/dist/components/custom-card/CustomVerticalCard.js +0 -9
  50. package/dist/components/custom-dialog/CustomDialog.d.ts +0 -41
  51. package/dist/components/custom-dialog/CustomDialog.js +0 -38
  52. package/dist/components/custom-mobile-date-picker/CustomBottomSheet.d.ts +0 -9
  53. package/dist/components/custom-mobile-date-picker/CustomBottomSheet.js +0 -29
  54. package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.d.ts +0 -19
  55. package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.js +0 -98
  56. package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.d.ts +0 -19
  57. package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.js +0 -40
  58. package/dist/components/custom-mobile-date-picker/ItemPicker.d.ts +0 -10
  59. package/dist/components/custom-mobile-date-picker/ItemPicker.js +0 -72
  60. package/dist/components/custom-modal/CustomModal.d.ts +0 -21
  61. package/dist/components/custom-modal/CustomModal.js +0 -38
  62. package/dist/components/custom-stepper/CustomStepper.d.ts +0 -31
  63. package/dist/components/custom-stepper/CustomStepper.js +0 -170
  64. package/dist/components/custom-tabs/CustomTabs.d.ts +0 -22
  65. package/dist/components/custom-tabs/CustomTabs.js +0 -70
  66. package/dist/components/input-list/InputListWithUseForm.d.ts +0 -22
  67. package/dist/components/input-list/InputListWithUseForm.js +0 -22
  68. package/dist/components/input-list/components/UFDatePickerMobile.d.ts +0 -9
  69. package/dist/components/input-list/components/UFDatePickerMobile.js +0 -6
  70. package/dist/components/otp-input/OTPInput.d.ts +0 -19
  71. package/dist/components/otp-input/OTPInput.js +0 -161
  72. package/dist/components/rich-tooltip/RichTooltip.d.ts +0 -18
  73. package/dist/components/rich-tooltip/RichTooltip.js +0 -32
  74. package/dist/icons/Add.d.ts +0 -7
  75. package/dist/icons/Add.js +0 -3
  76. package/dist/icons/EyeSlash.d.ts +0 -7
  77. package/dist/icons/EyeSlash.js +0 -3
  78. package/dist/icons/Tick.d.ts +0 -7
  79. package/dist/icons/Tick.js +0 -3
  80. package/dist/icons/Warning2.d.ts +0 -7
  81. package/dist/icons/Warning2.js +0 -3
  82. /package/dist/components/{input-list/type.js → custom-table/types.js} +0 -0
  83. /package/dist/components/{input-list → form}/Form.d.ts +0 -0
  84. /package/dist/components/{input-list → form}/Form.js +0 -0
  85. /package/dist/components/{input-list → form}/UseFormInput.d.ts +0 -0
  86. /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.d.ts +0 -0
  87. /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.js +0 -0
  88. /package/dist/components/{input-list → form}/components/UFAutoComplete.d.ts +0 -0
  89. /package/dist/components/{input-list → form}/components/UFAutoComplete.js +0 -0
  90. /package/dist/components/{input-list → form}/components/UFCheckbox.d.ts +0 -0
  91. /package/dist/components/{input-list → form}/components/UFCheckbox.js +0 -0
  92. /package/dist/components/{input-list → form}/components/UFCurrency.d.ts +0 -0
  93. /package/dist/components/{input-list → form}/components/UFCurrency.js +0 -0
  94. /package/dist/components/{input-list → form}/components/UFDatePicker.d.ts +0 -0
  95. /package/dist/components/{input-list → form}/components/UFDatePicker.js +0 -0
  96. /package/dist/components/{input-list → form}/components/UFMultiCheckbox.d.ts +0 -0
  97. /package/dist/components/{input-list → form}/components/UFMultiCheckbox.js +0 -0
  98. /package/dist/components/{input-list → form}/components/UFMultiSelect.d.ts +0 -0
  99. /package/dist/components/{input-list → form}/components/UFMultiSelect.js +0 -0
  100. /package/dist/components/{input-list → form}/components/UFRadio.d.ts +0 -0
  101. /package/dist/components/{input-list → form}/components/UFRadio.js +0 -0
  102. /package/dist/components/{input-list → form}/components/UFSelect.d.ts +0 -0
  103. /package/dist/components/{input-list → form}/components/UFSelect.js +0 -0
  104. /package/dist/components/{input-list → form}/components/UFSwitch.d.ts +0 -0
  105. /package/dist/components/{input-list → form}/components/UFSwitch.js +0 -0
  106. /package/dist/components/{input-list → form}/components/UFTextArea.d.ts +0 -0
  107. /package/dist/components/{input-list → form}/components/UFTextArea.js +0 -0
  108. /package/dist/components/{input-list → form}/components/UFTextField.d.ts +0 -0
  109. /package/dist/components/{input-list → form}/components/UFTextField.js +0 -0
  110. /package/dist/components/{input-list → form}/components/UFTime.d.ts +0 -0
  111. /package/dist/components/{input-list → form}/components/UFTime.js +0 -0
  112. /package/dist/components/{input-list → form}/components/UFUploader.d.ts +0 -0
  113. /package/dist/components/{input-list → form}/components/UFUploader.js +0 -0
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback } from 'react';
3
- import { CircularProgress, InputAdornment, TextField, } from '@mui/material';
4
- import debounce from '../../../methods/debounce';
5
- import InfoCircle from '../../../icons/InfoCircle';
6
- const RenderInput = (props) => {
7
- const { params, inputMaxHeight, sx, label, loading, helperText, variant, placeholder, disabled, validation, inputLabelMode, textFieldProps, handleSearch, handleChange, } = props;
8
- const debouncedSearch = useCallback(debounce((e) => {
9
- if (handleSearch) {
10
- handleSearch(e);
11
- }
12
- }, 500), [handleSearch]);
13
- return (_jsx(TextField, { ...params, variant: variant, ...(inputLabelMode === 'relative' && { label: label }), helperText: validation?.message
14
- ? validation?.message ?? helperText ?? ' '
15
- : undefined, error: validation?.isInvalid, placeholder: placeholder, disabled: disabled, InputProps: {
16
- ...params.InputProps,
17
- ...(validation?.isInvalid && {
18
- startAdornment: (_jsx(InputAdornment, { sx: { pl: 2, stroke: ({ palette }) => palette.error.main }, position: 'start', children: _jsx(InfoCircle, { primarycolor: 'inherit' }) })),
19
- }),
20
- endAdornment: (_jsxs(InputAdornment, { position: 'end', children: [loading ? _jsx(CircularProgress, { color: 'inherit', size: 20 }) : null, params.InputProps.endAdornment] })),
21
- }, ...textFieldProps, onChange: (e) => {
22
- debouncedSearch(e.target.value);
23
- handleChange?.(e.target.value);
24
- }, sx: [
25
- ...(Array.isArray(sx) ? sx : [sx]),
26
- {
27
- ...(inputMaxHeight && {
28
- minHeight: 0,
29
- maxHeight: inputMaxHeight ?? 'unset',
30
- }),
31
- minWidth: 0,
32
- height: '100%',
33
- overflow: 'auto',
34
- '& .MuiFilledInput-root': {
35
- ...(inputLabelMode === 'relative' && {
36
- alignItems: 'flex-end',
37
- }),
38
- },
39
- '.MuiAutocomplete-input': {
40
- padding: '0',
41
- },
42
- '.MuiOutlinedInput-root': {
43
- paddingY: '4px !important',
44
- },
45
- '.MuiAutocomplete-popupIndicator': {
46
- transition: '0.3s ease all',
47
- },
48
- },
49
- ] }));
50
- };
51
- export default RenderInput;
@@ -1,9 +0,0 @@
1
- import { TextFieldProps, AutocompleteRenderGetTagProps } from '@mui/material';
2
- interface IRenderTagsProps extends Omit<TextFieldProps, 'label'> {
3
- getTagProps: AutocompleteRenderGetTagProps;
4
- value: any[];
5
- variant: 'filled' | 'outlined';
6
- size: 'small' | 'medium';
7
- }
8
- declare const RenderTags: (value: IRenderTagsProps['value'], getTagProps: IRenderTagsProps['getTagProps'], variant?: IRenderTagsProps['variant'], size?: IRenderTagsProps['size']) => import("react/jsx-runtime").JSX.Element[];
9
- export default RenderTags;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Chip, } from '@mui/material';
3
- import SvgAdd from '../../../icons/Add';
4
- const RenderTags = (value, getTagProps, variant = 'filled', size = 'medium') => value.map((option, index) => {
5
- const { key, ...tagProps } = getTagProps({ index });
6
- return (_jsx(Chip, { variant: variant, label: option.label, size: size, ...tagProps, deleteIcon: _jsx(SvgAdd, { style: { transform: 'rotate(45deg)' }, primarycolor: 'inherit' }), sx: {
7
- border: 'none',
8
- backgroundColor: 'primary.3',
9
- ':hover': {
10
- backgroundColor: 'primary.4',
11
- cursor: 'default',
12
- },
13
- py: '0 !important',
14
- maxHeight: size === 'small' ? 28 : 32,
15
- color: 'text.primary',
16
- stroke: ({ palette }) => palette.text.primary,
17
- borderRadius: '999px',
18
- fontSize: ({ typography }) => typography['caption3.medium'].fontSize,
19
- fontWeight: ({ typography }) => typography['caption3.medium'].fontWeight,
20
- } }, key));
21
- });
22
- export default RenderTags;
@@ -1,17 +0,0 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
2
- import { BreadcrumbsProps, LinkOwnProps } from '@mui/material';
3
- export interface ICustomBreadcrumbsProps {
4
- separator?: ReactNode | string;
5
- collapse?: boolean;
6
- items: {
7
- title: ReactNode | string;
8
- href: string;
9
- }[];
10
- itemProps?: {
11
- linkProps?: LinkOwnProps;
12
- textProps?: HTMLAttributes<HTMLDivElement>;
13
- };
14
- breadCrumbProps?: BreadcrumbsProps;
15
- }
16
- declare const CustomBreadcrumbs: ({ separator, collapse, items, itemProps, breadCrumbProps, }: ICustomBreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
17
- export default CustomBreadcrumbs;
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Breadcrumbs, Link, } from '@mui/material';
3
- const CustomBreadcrumbs = ({ separator, collapse, items, itemProps, breadCrumbProps, }) => {
4
- return (_jsx(Breadcrumbs, { maxItems: collapse ? 2 : undefined, separator: separator, ...breadCrumbProps, children: items.map((item, index) => (_jsx(Link, { underline: 'none', color: 'inherit', href: item.href, ...itemProps?.linkProps, children: _jsx("div", { style: {
5
- display: 'flex',
6
- alignItems: 'center',
7
- fontSize: 14,
8
- fontWeight: 400,
9
- }, ...itemProps?.textProps, children: item.title }) }, index))) }));
10
- };
11
- export default CustomBreadcrumbs;
@@ -1,3 +0,0 @@
1
- import { CustomCardProps } from "./types";
2
- declare function CustomHorizontalCard({ Image, Title, Subtitle, Date, Actions, ...restProps }: CustomCardProps): import("react/jsx-runtime").JSX.Element;
3
- export default CustomHorizontalCard;
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Box from "@mui/material/Box";
3
- import { useTheme } from "@mui/material";
4
- function CustomHorizontalCard({ Image, Title, Subtitle, Date, Actions, ...restProps }) {
5
- const theme = useTheme();
6
- const { sx, ...props } = restProps;
7
- return (_jsx(Box, { sx: { width: 350, border: `1px solid ${theme.palette.mode === "light" ? theme.palette.text[7] : theme.palette.grey[6]}`, borderRadius: 2, backgroundColor: theme.palette.background.default, overflow: 'hidden', ...restProps.sx }, ...props, children: _jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(Box, { children: Image }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', width: '100%', padding: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', justifyContent: 'space-between' }, children: [_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column' }, children: [Title, Subtitle] }), Date] }), Actions] })] }) }));
8
- }
9
- export default CustomHorizontalCard;
@@ -1,3 +0,0 @@
1
- import { CustomCardProps } from "./types";
2
- declare function CustomVerticalCard({ Image, Title, Subtitle, Date, Description, Chip, Actions, ...restProps }: CustomCardProps): import("react/jsx-runtime").JSX.Element;
3
- export default CustomVerticalCard;
@@ -1,9 +0,0 @@
1
- import { jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- import Box from "@mui/material/Box";
4
- function CustomVerticalCard({ Image, Title, Subtitle, Date, Description, Chip, Actions, ...restProps }) {
5
- const theme = useTheme();
6
- const { sx, ...props } = restProps;
7
- return (_jsxs(Box, { sx: { width: 350, border: `1px solid ${theme.palette.mode === "light" ? theme.palette.text[7] : theme.palette.grey[6]}`, borderRadius: 2, backgroundColor: theme.palette.background.default, overflow: 'hidden', p: 2, ...restProps.sx }, ...props, children: [Image, _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [Title, Chip] }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column' }, children: [Subtitle, Date] }), Description, Actions] }));
8
- }
9
- export default CustomVerticalCard;
@@ -1,41 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { ButtonProps, DialogActionsProps, DialogContentProps, DialogProps, DialogTitleProps } from "@mui/material";
3
- import { StackProps } from "@mui/material/Stack";
4
- export interface IDialogButton extends ButtonProps {
5
- label: ReactNode;
6
- isLoading?: ButtonProps["isLoading"];
7
- }
8
- export interface IDialogHeader {
9
- component?: ReactNode;
10
- title: string | ReactNode;
11
- withoutButton?: boolean;
12
- headerProps?: StackProps;
13
- titleProps?: DialogTitleProps;
14
- button?: {
15
- icon?: ReactNode;
16
- props?: ButtonProps;
17
- label?: string | ReactNode;
18
- };
19
- }
20
- export interface ICustomDialog extends DialogProps {
21
- header?: IDialogHeader;
22
- withoutHeader?: boolean;
23
- withoutBoxShadow?: boolean;
24
- dialogContent?: {
25
- props?: DialogContentProps;
26
- image?: ReactNode;
27
- body?: {
28
- title?: string | ReactNode;
29
- content?: string | ReactNode;
30
- props?: StackProps;
31
- };
32
- };
33
- dialogActions?: {
34
- actionButtons?: IDialogButton[];
35
- actionComponent?: ReactNode | string;
36
- props?: DialogActionsProps;
37
- };
38
- onClose?: () => void;
39
- }
40
- declare const CustomDialog: ({ withoutHeader, withoutBoxShadow, dialogContent, children, header, dialogActions, onClose, PaperProps, ...rest }: ICustomDialog) => import("react/jsx-runtime").JSX.Element;
41
- export default CustomDialog;
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Dialog, DialogActions, DialogContent, DialogTitle, useTheme, } from "@mui/material";
3
- import Stack from "@mui/material/Stack";
4
- import Box from "@mui/material/Box";
5
- import Typography from "@mui/material/Typography";
6
- import CloseCircle from "../../icons/CloseCircle";
7
- const CustomDialog = ({ withoutHeader = false, withoutBoxShadow = false, dialogContent, children, header, dialogActions, onClose, PaperProps, ...rest }) => {
8
- const { direction } = useTheme();
9
- return (_jsxs(Dialog, { keepMounted: true, dir: direction, onClose: onClose, ...rest, withoutBoxShadow: withoutBoxShadow, children: [!withoutHeader &&
10
- (header?.component ?? (_jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", ...header?.headerProps, children: [_jsx(DialogTitle, { sx: { padding: "0px" }, variant: "caption1", ...header?.titleProps, children: header?.title ?? "Title" }), !header?.withoutButton && (_jsxs(Button, { onClick: onClose, variant: "text", sx: {
11
- padding: "0px",
12
- minWidth: "max-content",
13
- minHeight: "max-content",
14
- transition: "transform 0.1s ease",
15
- stroke: (theme) => theme.palette.text.primary,
16
- ":hover": { backgroundColor: "background.main" },
17
- ":active": {
18
- transform: "scale(90%)",
19
- },
20
- }, ...header?.button?.props, children: [header?.button?.label, header?.button?.icon ?? (_jsx(CloseCircle, { primarycolor: "inherit" }))] }))] }))), _jsxs(DialogContent, { ...dialogContent?.props, children: [!!dialogContent?.image && (_jsx(Box, { width: "max-content", minHeight: "80px", mx: "auto", children: dialogContent?.image })), !!dialogContent?.body && (_jsxs(Stack, { maxWidth: "490px", ...dialogContent?.body?.props, children: [_jsx(Typography, { variant: typeof dialogContent?.body?.title === "string"
21
- ? "caption1.bold"
22
- : "inherit", component: typeof dialogContent?.body?.title === "string" ? "span" : "div", children: dialogContent?.body?.title }), _jsx(Typography, { variant: typeof dialogContent?.body?.content === "string"
23
- ? "caption2"
24
- : "inherit", textAlign: "justify", component: typeof dialogContent?.body?.content === "string"
25
- ? "span"
26
- : "div", children: dialogContent?.body?.content })] })), children] }), dialogActions && (_jsxs(DialogActions, { sx: {
27
- display: "flex",
28
- width: "100%",
29
- gap: 4,
30
- p: 0,
31
- justifyContent: "space-between",
32
- alignItems: "flex-end",
33
- }, ...dialogActions?.props, children: [dialogActions?.actionButtons?.map((actionButton, idx) => (_jsx(Button, { ...actionButton, sx: {
34
- stroke: (theme) => theme.palette.text.primary,
35
- ...actionButton.sx,
36
- }, children: actionButton?.label }, idx))), dialogActions?.actionComponent] }))] }));
37
- };
38
- export default CustomDialog;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { DialogProps } from '@mui/material';
3
- interface ICustomBottomSheet extends DialogProps {
4
- children?: React.ReactNode;
5
- handleClose: (event?: object | undefined, reason?: string | undefined) => void;
6
- withoutCloseButton?: boolean;
7
- }
8
- declare const CustomBottomSheet: ({ children, handleClose, open, sx, title, withoutCloseButton, ...dialogProps }: ICustomBottomSheet) => import("react/jsx-runtime").JSX.Element;
9
- export default CustomBottomSheet;
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import Slide from '@mui/material/Slide';
4
- import { Box, Dialog, IconButton, Stack, styled, Typography, } from '@mui/material';
5
- import SvgAdd from '../../icons/Add';
6
- const CustomBottomSheet = ({ children, handleClose, open, sx, title, withoutCloseButton, ...dialogProps }) => {
7
- return (_jsxs(Dialog, { fullScreen: true, open: open, onClose: handleClose, TransitionComponent: Transition, keepMounted: true, sx: [style, ...(Array.isArray(sx) ? sx : [sx])], ...dialogProps, children: [_jsxs(DialogHeader, { children: [_jsx(Typography, { variant: 'body3.bold', children: title }), !withoutCloseButton && (_jsx(IconButton, { "aria-label": 'close', onClick: handleClose, children: _jsx(SvgAdd, { style: { transform: 'rotate(45deg) scale(150%)' } }) }))] }), _jsx(Stack, { p: 6, gap: 8, children: children })] }));
8
- };
9
- export default CustomBottomSheet;
10
- const Transition = React.forwardRef(function Transition(props, ref) {
11
- return (_jsx(Slide, { direction: 'up', ref: ref, ...props, style: { transitionDuration: '0.4s' } }));
12
- });
13
- const style = {
14
- '.MuiDialog-paper': {
15
- minWidth: '0px',
16
- maxHeight: '80%',
17
- minHeight: '60%',
18
- height: 'max-content',
19
- padding: 0,
20
- transform: 'translateY(40%)',
21
- maxWidth: 360,
22
- },
23
- };
24
- const DialogHeader = styled(Box)({
25
- width: '100%',
26
- display: 'flex',
27
- justifyContent: 'space-between',
28
- padding: 12,
29
- });
@@ -1,19 +0,0 @@
1
- /// <reference types="react-date-object" />
2
- import { FC } from 'react';
3
- import { UseFormReturn } from 'react-hook-form';
4
- import { IDatePickerMobileForm } from '../input-list/type';
5
- type Props = IDatePickerMobileForm & {
6
- form: UseFormReturn<any>;
7
- error?: any;
8
- };
9
- export type TSelectedDate = {
10
- month: number | null;
11
- day: number | null;
12
- year: number | null;
13
- };
14
- export declare const PERSIAN_CALENDARS: {
15
- calendar: Omit<import("react-date-object").Calendar, "leapsLength">;
16
- locale: import("react-date-object").Locale;
17
- };
18
- declare const MobileDatePicker: FC<Props>;
19
- export default MobileDatePicker;
@@ -1,98 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Controller } from 'react-hook-form';
4
- import { TextField, InputAdornment } from '@mui/material';
5
- import SvgCalendar from '../../icons/Calendar';
6
- import persian from 'react-date-object/calendars/persian';
7
- import persian_fa from 'react-date-object/locales/persian_fa';
8
- import { DateObject } from 'react-multi-date-picker';
9
- import DatePickerBottomSheet from './DatePickerBottomSheet';
10
- export const PERSIAN_CALENDARS = {
11
- calendar: persian,
12
- locale: persian_fa,
13
- };
14
- const calculateDaysInMonth = (isLeap) => [
15
- 31,
16
- 31,
17
- 31,
18
- 31,
19
- 31,
20
- 31,
21
- 30,
22
- 30,
23
- 30,
24
- 30,
25
- 30,
26
- isLeap ? 30 : 29,
27
- ];
28
- const createDateObject = (date, lang) => {
29
- if (date)
30
- return new DateObject({
31
- date: new Date(date),
32
- ...(lang.includes('fa') && {
33
- calendar: persian,
34
- locale: persian_fa,
35
- }),
36
- });
37
- };
38
- const MobileDatePicker = ({ form, name, defaultValue, label, rules, readonly, disabled, placeholder, error, itemProps, props, helperText, variant = 'outlined', withoutHelperText, inputLabelMode, }) => {
39
- const lang = document.documentElement.lang;
40
- const [open, setOpen] = useState(false);
41
- const defaultValueDate = defaultValue
42
- ? createDateObject(new Date(defaultValue), lang)
43
- : form.getValues(name)
44
- ? createDateObject(new Date(form.getValues(name)), lang)
45
- : //Returns undefined because if Date Object bug for showing undefined year as -1 value
46
- undefined;
47
- const [value, setValue] = useState({
48
- day: defaultValueDate?.day ?? null,
49
- month: defaultValueDate?.month?.number ?? null,
50
- year: defaultValueDate?.year && defaultValueDate.year > 1
51
- ? defaultValueDate.year
52
- : null,
53
- });
54
- const selectedDate = new DateObject({
55
- ...(lang.includes('fa') && PERSIAN_CALENDARS),
56
- date: `${value?.year}/${value?.month}/${value?.day}`,
57
- });
58
- const handleChange = () => {
59
- form.setValue(name, selectedDate.toDate() || defaultValueDate?.toDate());
60
- setOpen(false);
61
- };
62
- const getHelperText = () => {
63
- if (withoutHelperText)
64
- return undefined;
65
- return error?.message ?? helperText ?? ' ';
66
- };
67
- const handleTextFieldClick = (e) => {
68
- e.preventDefault();
69
- setOpen(true);
70
- };
71
- const dayOptions = calculateDaysInMonth(selectedDate.isLeap)?.[(value?.month || 1) - 1];
72
- const monthOptions = [{ name: '' }, ...selectedDate.months, { name: '' }];
73
- return (_jsxs(_Fragment, { children: [_jsx(Controller, { control: form?.control, name: name, rules: { ...rules }, defaultValue: selectedDate.isValid ? selectedDate?.toDate() : undefined, render: ({ field }) => (_jsx(TextField, { ...(inputLabelMode === 'static' && { hiddenLabel: true }), ...(inputLabelMode === 'relative' && { label: label }), ...(defaultValue && {
74
- defaultValue: defaultValueDate,
75
- }), onChange: () => {
76
- form
77
- .register(name, { ...rules })
78
- .onChange({ target: { current: selectedDate.toDate() } });
79
- }, onBlur: () => {
80
- form
81
- .register(name, { ...rules })
82
- .onBlur({ target: { current: selectedDate.toDate() } });
83
- }, value: selectedDate?.format('YYYY/MM/DD'), defaultValue: selectedDate?.format('YYYY/MM/DD'), variant: variant, fullWidth: true, id: field?.name, error: !!error, onClick: !(disabled || readonly) && handleTextFieldClick, onTouchEnd: !(disabled || readonly) && handleTextFieldClick, placeholder: placeholder, helperText: getHelperText(), "aria-readonly": readonly, disabled: disabled, inputProps: { readOnly: readonly }, InputProps: {
84
- endAdornment: (_jsx(InputAdornment, { position: 'end', sx: {
85
- '& .MuiInputAdornment-positionStart': {
86
- marginTop: '0 important',
87
- backgroundColor: 'red',
88
- },
89
- stroke: ({ palette }) => disabled || readonly
90
- ? palette.text.disabled
91
- : error
92
- ? palette.error.main
93
- : palette.text.primary,
94
- }, children: _jsx(SvgCalendar, { primarycolor: 'inherit' }) })),
95
- ...itemProps?.InputProps,
96
- }, ...itemProps, ...props })) }), _jsx(DatePickerBottomSheet, { dayOptions: dayOptions, defaultValue: defaultValueDate, handleChange: setValue, handleClose: handleChange, handleSubmit: handleChange, label: String(label), monthOptions: monthOptions, open: open, value: value }, 'date-picker-bottom-sheet')] }));
97
- };
98
- export default MobileDatePicker;
@@ -1,19 +0,0 @@
1
- import { Dispatch, FC, SetStateAction } from 'react';
2
- import { Month } from 'react-date-object';
3
- import { DateObject } from 'react-multi-date-picker';
4
- import { TSelectedDate } from './CustomMobileDatePicker';
5
- type TDatePickerBottomSheetProps = {
6
- open: boolean;
7
- handleClose: () => void;
8
- label: string;
9
- handleChange: Dispatch<SetStateAction<TSelectedDate>>;
10
- monthOptions: Month[] | {
11
- name: string;
12
- }[];
13
- dayOptions: number;
14
- value: TSelectedDate;
15
- handleSubmit: () => void;
16
- defaultValue: DateObject | undefined;
17
- };
18
- declare const DatePickerBottomSheet: FC<TDatePickerBottomSheetProps>;
19
- export default DatePickerBottomSheet;
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Box } from '@mui/material';
3
- import BottomSheet from './CustomBottomSheet';
4
- import ItemPicker from './ItemPicker';
5
- import { DateObject } from 'react-multi-date-picker';
6
- import { PERSIAN_CALENDARS } from './CustomMobileDatePicker';
7
- const MAX_YEAR = 3000;
8
- const DatePickerBottomSheet = ({ open, handleClose, label, dayOptions, handleChange, monthOptions, value, handleSubmit, defaultValue, }) => {
9
- const lang = document.documentElement.lang;
10
- const currentDate = new DateObject({
11
- ...(lang.includes('fa') && PERSIAN_CALENDARS),
12
- date: new Date(Date.now()),
13
- });
14
- return (_jsxs(BottomSheet, { open: open, handleClose: handleClose, title: String(label), children: [_jsxs(Box, { display: 'flex', position: 'relative', children: [_jsx(ItemPicker, { getSelectedItem: (selectedDay) => handleChange((prev) => ({
15
- month: prev?.month || null,
16
- day: selectedDay,
17
- year: prev?.year || null,
18
- })), open: open, totalItems: dayOptions + 2, getRowItem: (idx) => idx === 0 || idx === dayOptions + 1 ? '' : String(idx), defaultValue: value?.day || defaultValue?.day || currentDate.day }, 'day-picker'), _jsx(ItemPicker, { getSelectedItem: (selectedMonth) => handleChange((prev) => ({
19
- month: selectedMonth || null,
20
- day: prev?.day || null,
21
- year: prev?.year || null,
22
- })), open: open, totalItems: monthOptions.length, getRowItem: (idx) => String(monthOptions[idx]?.name), defaultValue: value?.month ||
23
- defaultValue?.month.number ||
24
- currentDate.month.number }, 'month-picker'), _jsx(ItemPicker, { getSelectedItem: (selectedYear) => handleChange((prev) => ({
25
- month: prev?.month || null,
26
- day: prev?.day || null,
27
- year: selectedYear ? selectedYear : null,
28
- })), open: open, totalItems: MAX_YEAR, getRowItem: (idx) => String(idx), defaultValue: value?.year || defaultValue?.year || currentDate.year }, 'year-picker'), _jsx(Box, { sx: {
29
- position: 'absolute',
30
- top: 'calc(50% - 20px)',
31
- left: 0,
32
- width: '100%',
33
- height: 40,
34
- backgroundColor: 'primary.main',
35
- borderRadius: '8px',
36
- opacity: 0.1,
37
- zIndex: -1,
38
- } })] }), _jsx(Button, { fullWidth: true, onClick: handleSubmit, children: lang.includes('fa') ? 'تایید' : 'OK' })] }));
39
- };
40
- export default DatePickerBottomSheet;
@@ -1,10 +0,0 @@
1
- import { FC } from 'react';
2
- type TItemPickerProps = {
3
- getSelectedItem: (item: number) => void;
4
- totalItems: number;
5
- getRowItem: (idx: number) => string;
6
- defaultValue?: number | null;
7
- open: boolean;
8
- };
9
- declare const ItemPicker: FC<TItemPickerProps>;
10
- export default ItemPicker;
@@ -1,72 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Stack, Typography } from '@mui/material';
3
- import { createRef, useEffect, useRef, useState, } from 'react';
4
- import { FixedSizeList as List } from 'react-window';
5
- const ITEM_HEIGHT = 40;
6
- const ItemPicker = ({ getSelectedItem, totalItems, getRowItem, defaultValue, open, }) => {
7
- const listRef = createRef();
8
- const [isScrolling, setIsScrolling] = useState(false);
9
- const selectedItemRef = useRef(defaultValue || 0);
10
- const handleScrollToItem = (isScrolling) => {
11
- if (!isScrolling) {
12
- if (selectedItemRef.current !== 2) {
13
- listRef.current?.scrollToItem(selectedItemRef.current, selectedItemRef.current >= totalItems - 2 ? 'auto' : 'center');
14
- }
15
- else {
16
- //Because of react window bug for index "2"
17
- listRef.current?.scrollTo(ITEM_HEIGHT);
18
- }
19
- setIsScrolling(false);
20
- }
21
- else {
22
- setIsScrolling(true);
23
- }
24
- };
25
- useEffect(() => {
26
- if (!isScrolling && selectedItemRef.current > 0 && open) {
27
- getSelectedItem(selectedItemRef.current);
28
- }
29
- }, [isScrolling, open]);
30
- const Row = ({ index, isScrolling = false, style, }) => {
31
- handleScrollToItem(isScrolling);
32
- return (_jsx(Typography, { textAlign: 'inherit', sx: {
33
- display: 'flex',
34
- alignItems: 'center',
35
- justifyContent: 'center',
36
- width: '100%',
37
- height: '100%',
38
- userSelect: 'none',
39
- transition: '0.3s ease all',
40
- filter: selectedItemRef.current === index ? 'none' : 'blur(0.5px)',
41
- fontSize: selectedItemRef.current === index ? 16 : 14,
42
- ...style,
43
- }, variant: selectedItemRef.current === index ? 'caption2.bold' : 'caption2', children: getRowItem(index) }));
44
- };
45
- return (_jsxs(Stack, { sx: {
46
- overflowY: 'hidden',
47
- height: 120,
48
- flexBasis: '33%',
49
- }, children: [_jsx(Stack, { sx: {
50
- width: '100%',
51
- }, children: _jsx(List, { className: 'item-picker', height: ITEM_HEIGHT * 3, itemCount: totalItems, itemSize: ITEM_HEIGHT, width: '100%',
52
- // -1 is because options array is zero based index
53
- initialScrollOffset: (selectedItemRef.current - 1) * ITEM_HEIGHT, onScroll: (e) => {
54
- // +1 is because item being in center of selector
55
- selectedItemRef.current =
56
- Math.round(e.scrollOffset / ITEM_HEIGHT) + 1;
57
- }, style: {
58
- textAlign: 'center',
59
- transition: 'all ease 1s',
60
- }, ref: listRef, useIsScrolling: true, children: Row }) }), _jsx("style", { children: css })] }));
61
- };
62
- export default ItemPicker;
63
- const css = `
64
- .item-picker::-webkit-scrollbar {
65
- display: none;
66
- }
67
- .item-picker {
68
- -ms-overflow-style: none;
69
- scrollbar-width: none;
70
- scroll-behavior: smooth;
71
- }
72
- `;
@@ -1,21 +0,0 @@
1
- import { FC, ReactNode } from 'react';
2
- import { BoxProps, ModalProps } from "@mui/material";
3
- export interface CustomModalProps {
4
- open: boolean;
5
- onClose?: () => void;
6
- title?: string;
7
- children?: ReactNode;
8
- modalProps: Omit<ModalProps, "open">;
9
- boxProps?: BoxProps;
10
- leftTitle?: React.ReactNode;
11
- withoutDivider?: boolean;
12
- withoutHeader?: boolean;
13
- scrollableProps?: BoxProps;
14
- preventClose?: boolean;
15
- onClickTopLeftBtn?: () => void;
16
- topLeftBtnTitle?: string;
17
- maxHeight?: string | number;
18
- height?: string | number;
19
- }
20
- declare const CustomModal: FC<CustomModalProps>;
21
- export default CustomModal;
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- //@Mui
3
- import Box from "@mui/material/Box";
4
- import Stack from "@mui/material/Stack";
5
- import Modal from "@mui/material/Modal";
6
- import Divider from "@mui/material/Divider";
7
- import Typography from "@mui/material/Typography";
8
- import IconButton from "@mui/material/IconButton";
9
- const CustomModal = ({ modalProps, open, children, boxProps, onClose, title, leftTitle, withoutDivider, withoutHeader, scrollableProps, preventClose, onClickTopLeftBtn, topLeftBtnTitle, maxHeight, height, }) => {
10
- return (_jsx(Modal, { "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", open: open, sx: {
11
- direction: "ltr",
12
- backdropFilter: "blur(5px)",
13
- "& .MuiBackdrop-root ": {
14
- backgroundColor: "rgba(27, 38, 44, 0.1)",
15
- },
16
- }, onClose: () => {
17
- if (onClose && !preventClose) {
18
- onClose();
19
- }
20
- }, ...modalProps, children: _jsxs(Stack, { sx: {
21
- width: { xs: "90%", md: "auto" },
22
- minWidth: 300,
23
- position: "absolute",
24
- top: "50%",
25
- left: "50%",
26
- transform: "translate(-50%, -50%)",
27
- backgroundColor: "background.4",
28
- borderRadius: "10px",
29
- py: 5,
30
- px: { xs: 2, lg: 7 },
31
- outline: "none",
32
- ...boxProps,
33
- }, children: [!withoutHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, { display: "flex", gap: 3, alignItems: "center", justifyContent: "space-between", mb: 2, children: [_jsxs(Box, { display: "flex", gap: 3, alignItems: "center", children: [_jsx(IconButton, { onClick: () => (onClose ? onClose() : ""), "data-cy": "close-modal", children: "x" }), _jsx(Typography, { fontWeight: 500, fontSize: 12, children: title })] }), _jsx(Box, { children: leftTitle }), topLeftBtnTitle && (_jsx(Box, { sx: { color: "primary.main", cursor: "pointer" }, onClick: onClickTopLeftBtn, children: topLeftBtnTitle }))] }), !withoutDivider && (_jsx(Divider, { sx: {
34
- mb: 4,
35
- borderColor: "background.1",
36
- } }))] })), _jsx(Stack, { height: height || "100%", maxHeight: maxHeight || "73vh", children: children })] }) }));
37
- };
38
- export default CustomModal;
@@ -1,31 +0,0 @@
1
- import { ButtonProps, StepConnectorProps, StepIconProps, StepLabelProps, StepperProps, TypographyProps } from "@mui/material";
2
- import { MouseEvent } from "react";
3
- type step = {
4
- label?: string;
5
- error?: {
6
- hasError?: boolean;
7
- errorMessage?: string;
8
- };
9
- canSkipping?: boolean;
10
- completed?: boolean;
11
- };
12
- export interface ICustomStepper {
13
- steps: step[];
14
- activeStep: number;
15
- orientation?: "vertical" | "horizontal";
16
- alternativeLabel?: boolean;
17
- stepperProps?: StepperProps;
18
- stepConnectorProps?: StepConnectorProps;
19
- stepLabelProps?: StepLabelProps;
20
- errorTypographyProps?: TypographyProps;
21
- stepButtonProps?: ButtonProps;
22
- nonLinear?: boolean;
23
- clickableItem?: boolean;
24
- onClickItem?: (index: number, e?: MouseEvent<HTMLButtonElement>) => void;
25
- completedIconComponent?: (props: StepIconProps) => JSX.Element;
26
- activeIconComponent?: (props: StepIconProps) => JSX.Element;
27
- errorIconComponent?: (props: StepIconProps) => JSX.Element;
28
- defaultIconComponent?: (props: StepIconProps) => JSX.Element;
29
- }
30
- declare const CustomStepper: ({ steps, activeStep, orientation, alternativeLabel, nonLinear, clickableItem, errorTypographyProps, completedIconComponent, activeIconComponent, errorIconComponent, defaultIconComponent, stepperProps, stepConnectorProps, stepLabelProps, stepButtonProps, onClickItem, }: ICustomStepper) => import("react/jsx-runtime").JSX.Element;
31
- export default CustomStepper;