mui-design-system 0.0.21 → 0.0.22
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.
- package/package.json +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +0 -93
- package/dist/colors/type.d.ts +0 -5
- package/dist/colors/type.js +0 -1
- package/dist/components/checkbox-list/CheckboxList.d.ts +0 -21
- package/dist/components/checkbox-list/CheckboxList.js +0 -31
- package/dist/components/custom-auto-complete/CustomAutoComplete.d.ts +0 -27
- package/dist/components/custom-auto-complete/CustomAutoComplete.js +0 -75
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +0 -21
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.js +0 -29
- package/dist/components/custom-auto-complete/components/ListBox.d.ts +0 -5
- package/dist/components/custom-auto-complete/components/ListBox.js +0 -62
- package/dist/components/custom-auto-complete/components/ListRow.d.ts +0 -2
- package/dist/components/custom-auto-complete/components/ListRow.js +0 -21
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.d.ts +0 -28
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.js +0 -92
- package/dist/components/custom-auto-complete-advanced/components/ListBox.d.ts +0 -6
- package/dist/components/custom-auto-complete-advanced/components/ListBox.js +0 -76
- package/dist/components/custom-auto-complete-advanced/components/ListRow.d.ts +0 -2
- package/dist/components/custom-auto-complete-advanced/components/ListRow.js +0 -17
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.d.ts +0 -23
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.js +0 -51
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.d.ts +0 -9
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.js +0 -22
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.d.ts +0 -17
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.js +0 -11
- package/dist/components/custom-card/CustomHorizontalCard.d.ts +0 -3
- package/dist/components/custom-card/CustomHorizontalCard.js +0 -9
- package/dist/components/custom-card/CustomVerticalCard.d.ts +0 -3
- package/dist/components/custom-card/CustomVerticalCard.js +0 -9
- package/dist/components/custom-chip/CustomChip.d.ts +0 -12
- package/dist/components/custom-chip/CustomChip.js +0 -10
- package/dist/components/custom-date-picker/CustomComponent.d.ts +0 -17
- package/dist/components/custom-date-picker/CustomComponent.js +0 -36
- package/dist/components/custom-date-picker/CustomDatePicker.d.ts +0 -14
- package/dist/components/custom-date-picker/CustomDatePicker.js +0 -55
- package/dist/components/custom-dialog/CustomDialog.d.ts +0 -41
- package/dist/components/custom-dialog/CustomDialog.js +0 -38
- package/dist/components/custom-input/CustomNumericInput.d.ts +0 -9
- package/dist/components/custom-input/CustomNumericInput.js +0 -32
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.d.ts +0 -9
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.js +0 -29
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.d.ts +0 -19
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.js +0 -98
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.d.ts +0 -19
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.js +0 -40
- package/dist/components/custom-mobile-date-picker/ItemPicker.d.ts +0 -10
- package/dist/components/custom-mobile-date-picker/ItemPicker.js +0 -72
- package/dist/components/custom-modal/CustomModal.d.ts +0 -21
- package/dist/components/custom-modal/CustomModal.js +0 -38
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +0 -9
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.js +0 -13
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +0 -20
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.js +0 -33
- package/dist/components/custom-progress/LinearBufferProgress.d.ts +0 -6
- package/dist/components/custom-progress/LinearBufferProgress.js +0 -14
- package/dist/components/custom-stepper/CustomStepper.d.ts +0 -31
- package/dist/components/custom-stepper/CustomStepper.js +0 -170
- package/dist/components/custom-table/CustomTable.d.ts +0 -55
- package/dist/components/custom-table/CustomTable.js +0 -50
- package/dist/components/custom-table/components/CustomTableBody.d.ts +0 -21
- package/dist/components/custom-table/components/CustomTableBody.js +0 -11
- package/dist/components/custom-table/components/CustomTableCell.d.ts +0 -8
- package/dist/components/custom-table/components/CustomTableCell.js +0 -23
- package/dist/components/custom-table/components/CustomTableHead.d.ts +0 -17
- package/dist/components/custom-table/components/CustomTableHead.js +0 -63
- package/dist/components/custom-table/components/CustomTableRow.d.ts +0 -26
- package/dist/components/custom-table/components/CustomTableRow.js +0 -102
- package/dist/components/custom-table/components/useTable.d.ts +0 -24
- package/dist/components/custom-table/components/useTable.js +0 -77
- package/dist/components/custom-tabs/CustomTabs.d.ts +0 -22
- package/dist/components/custom-tabs/CustomTabs.js +0 -70
- package/dist/components/custom-uploader/CustomUploader.d.ts +0 -23
- package/dist/components/custom-uploader/CustomUploader.js +0 -68
- package/dist/components/error boundary/ErrorComponent.d.ts +0 -7
- package/dist/components/error boundary/ErrorComponent.js +0 -6
- package/dist/components/error boundary/withErrorBoundary.d.ts +0 -7
- package/dist/components/error boundary/withErrorBoundary.js +0 -10
- package/dist/components/index.d.ts +0 -183
- package/dist/components/index.js +0 -70
- package/dist/components/input-list/Form.d.ts +0 -21
- package/dist/components/input-list/Form.js +0 -19
- package/dist/components/input-list/InputListWithUseForm.d.ts +0 -22
- package/dist/components/input-list/InputListWithUseForm.js +0 -22
- package/dist/components/input-list/UseFormInput.d.ts +0 -11
- package/dist/components/input-list/UseFormInput.js +0 -50
- package/dist/components/input-list/checkbox-list/CheckboxList.d.ts +0 -19
- package/dist/components/input-list/checkbox-list/CheckboxList.js +0 -30
- package/dist/components/input-list/components/UFAutoComplete.d.ts +0 -9
- package/dist/components/input-list/components/UFAutoComplete.js +0 -41
- package/dist/components/input-list/components/UFCheckbox.d.ts +0 -19
- package/dist/components/input-list/components/UFCheckbox.js +0 -21
- package/dist/components/input-list/components/UFCurrency.d.ts +0 -9
- package/dist/components/input-list/components/UFCurrency.js +0 -47
- package/dist/components/input-list/components/UFDatePicker.d.ts +0 -9
- package/dist/components/input-list/components/UFDatePicker.js +0 -17
- package/dist/components/input-list/components/UFDatePickerMobile.d.ts +0 -9
- package/dist/components/input-list/components/UFDatePickerMobile.js +0 -6
- package/dist/components/input-list/components/UFMultiCheckbox.d.ts +0 -9
- package/dist/components/input-list/components/UFMultiCheckbox.js +0 -17
- package/dist/components/input-list/components/UFMultiSelect.d.ts +0 -9
- package/dist/components/input-list/components/UFMultiSelect.js +0 -56
- package/dist/components/input-list/components/UFRadio.d.ts +0 -9
- package/dist/components/input-list/components/UFRadio.js +0 -19
- package/dist/components/input-list/components/UFSelect.d.ts +0 -9
- package/dist/components/input-list/components/UFSelect.js +0 -19
- package/dist/components/input-list/components/UFSwitch.d.ts +0 -19
- package/dist/components/input-list/components/UFSwitch.js +0 -99
- package/dist/components/input-list/components/UFTextArea.d.ts +0 -9
- package/dist/components/input-list/components/UFTextArea.js +0 -12
- package/dist/components/input-list/components/UFTextField.d.ts +0 -11
- package/dist/components/input-list/components/UFTextField.js +0 -29
- package/dist/components/input-list/components/UFTime.d.ts +0 -10
- package/dist/components/input-list/components/UFTime.js +0 -93
- package/dist/components/input-list/components/UFUploader.d.ts +0 -9
- package/dist/components/input-list/components/UFUploader.js +0 -41
- package/dist/components/input-list/type.d.ts +0 -165
- package/dist/components/input-list/type.js +0 -1
- package/dist/components/otp-input/OTPInput.d.ts +0 -19
- package/dist/components/otp-input/OTPInput.js +0 -161
- package/dist/components/rich-tooltip/RichTooltip.d.ts +0 -18
- package/dist/components/rich-tooltip/RichTooltip.js +0 -32
- package/dist/context/FormContext.d.ts +0 -16
- package/dist/context/FormContext.js +0 -8
- package/dist/icons/Add.d.ts +0 -7
- package/dist/icons/Add.js +0 -3
- package/dist/icons/ArrowDown.d.ts +0 -7
- package/dist/icons/ArrowDown.js +0 -3
- package/dist/icons/ArrowLeft1.d.ts +0 -7
- package/dist/icons/ArrowLeft1.js +0 -3
- package/dist/icons/ArrowRight1.d.ts +0 -7
- package/dist/icons/ArrowRight1.js +0 -3
- package/dist/icons/Calendar.d.ts +0 -7
- package/dist/icons/Calendar.js +0 -3
- package/dist/icons/CloseCircle.d.ts +0 -7
- package/dist/icons/CloseCircle.js +0 -3
- package/dist/icons/DocumentDownload.d.ts +0 -7
- package/dist/icons/DocumentDownload.js +0 -3
- package/dist/icons/Eye.d.ts +0 -7
- package/dist/icons/Eye.js +0 -3
- package/dist/icons/EyeSlash.d.ts +0 -7
- package/dist/icons/EyeSlash.js +0 -3
- package/dist/icons/FolderAdd.d.ts +0 -7
- package/dist/icons/FolderAdd.js +0 -3
- package/dist/icons/InfoCircle.d.ts +0 -7
- package/dist/icons/InfoCircle.js +0 -3
- package/dist/icons/Tick.d.ts +0 -7
- package/dist/icons/Tick.js +0 -3
- package/dist/icons/Trash.d.ts +0 -7
- package/dist/icons/Trash.js +0 -3
- package/dist/icons/Union.d.ts +0 -7
- package/dist/icons/Union.js +0 -3
- package/dist/icons/Warning2.d.ts +0 -7
- package/dist/icons/Warning2.js +0 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/methods/debounce.d.ts +0 -3
- package/dist/methods/debounce.js +0 -20
- package/dist/methods/general.d.ts +0 -2
- package/dist/methods/general.js +0 -32
- package/dist/mui/Alert/Alert.d.ts +0 -2
- package/dist/mui/Alert/Alert.js +0 -13
- package/dist/mui/AutoComplete/MuiAutoComplete.d.ts +0 -2
- package/dist/mui/AutoComplete/MuiAutoComplete.js +0 -27
- package/dist/mui/BreadCrumbs/MuiBreadCrumbs.d.ts +0 -2
- package/dist/mui/BreadCrumbs/MuiBreadCrumbs.js +0 -31
- package/dist/mui/Button/MuiButton.d.ts +0 -7
- package/dist/mui/Button/MuiButton.js +0 -185
- package/dist/mui/Card/MuiCard.d.ts +0 -2
- package/dist/mui/Card/MuiCard.js +0 -7
- package/dist/mui/Checkbox/Checkbox.d.ts +0 -2
- package/dist/mui/Checkbox/Checkbox.js +0 -31
- package/dist/mui/Checkbox/assets/CheckedIcon.d.ts +0 -8
- package/dist/mui/Checkbox/assets/CheckedIcon.js +0 -12
- package/dist/mui/Checkbox/assets/IntermediateIcon.d.ts +0 -8
- package/dist/mui/Checkbox/assets/IntermediateIcon.js +0 -10
- package/dist/mui/Checkbox/assets/UnChekedIcon.d.ts +0 -7
- package/dist/mui/Checkbox/assets/UnChekedIcon.js +0 -9
- package/dist/mui/Chip/MuiChip.d.ts +0 -10
- package/dist/mui/Chip/MuiChip.js +0 -35
- package/dist/mui/Dialog/MuiDialog.d.ts +0 -7
- package/dist/mui/Dialog/MuiDialog.js +0 -22
- package/dist/mui/FormControl/MuiFormControlLabel.d.ts +0 -2
- package/dist/mui/FormControl/MuiFormControlLabel.js +0 -13
- package/dist/mui/IconButton/MuiIconButon.d.ts +0 -2
- package/dist/mui/IconButton/MuiIconButon.js +0 -7
- package/dist/mui/InputAdornment/MuiInputAdornment.d.ts +0 -2
- package/dist/mui/InputAdornment/MuiInputAdornment.js +0 -6
- package/dist/mui/InputLabel/MuiInputLabel.d.ts +0 -2
- package/dist/mui/InputLabel/MuiInputLabel.js +0 -43
- package/dist/mui/Pagination/MuiPagination.d.ts +0 -2
- package/dist/mui/Pagination/MuiPagination.js +0 -15
- package/dist/mui/Pagination/MuiPaginationItem.d.ts +0 -2
- package/dist/mui/Pagination/MuiPaginationItem.js +0 -15
- package/dist/mui/Radio/MuiRadio.d.ts +0 -2
- package/dist/mui/Radio/MuiRadio.js +0 -17
- package/dist/mui/Select/MuiSelect.d.ts +0 -2
- package/dist/mui/Select/MuiSelect.js +0 -47
- package/dist/mui/Switch/MuiSwitch.d.ts +0 -2
- package/dist/mui/Switch/MuiSwitch.js +0 -83
- package/dist/mui/Tabs/MuiTabs.d.ts +0 -2
- package/dist/mui/Tabs/MuiTabs.js +0 -21
- package/dist/mui/Tabs/Tab/MuiTab.d.ts +0 -2
- package/dist/mui/Tabs/Tab/MuiTab.js +0 -26
- package/dist/mui/TextField/MuiFilledInput.d.ts +0 -2
- package/dist/mui/TextField/MuiFilledInput.js +0 -91
- package/dist/mui/TextField/MuiOutlinedInput.d.ts +0 -2
- package/dist/mui/TextField/MuiOutlinedInput.js +0 -66
- package/dist/mui/TextField/TextField.d.ts +0 -2
- package/dist/mui/TextField/TextField.js +0 -78
- package/dist/mui/Tooltip/MuiTooltip.d.ts +0 -2
- package/dist/mui/Tooltip/MuiTooltip.js +0 -26
- package/dist/mui/Typography/MuiTypography.d.ts +0 -2
- package/dist/mui/Typography/MuiTypography.js +0 -9
- package/dist/mui/Typography/index.d.ts +0 -2
- package/dist/mui/Typography/index.js +0 -138
- package/dist/mui/accordion/MuiAccodrion.d.ts +0 -2
- package/dist/mui/accordion/MuiAccodrion.js +0 -13
- package/dist/mui/breakpoints/index.d.ts +0 -9
- package/dist/mui/breakpoints/index.js +0 -9
- package/dist/mui/menu/MuiMenu.d.ts +0 -2
- package/dist/mui/menu/MuiMenu.js +0 -8
- package/dist/mui/menu/MuiMenuItem.d.ts +0 -2
- package/dist/mui/menu/MuiMenuItem.js +0 -14
- package/dist/mui/mui-css-baseline/index.d.ts +0 -3
- package/dist/mui/mui-css-baseline/index.js +0 -37
- package/dist/mui/palette/dark/darkPalette.d.ts +0 -2
- package/dist/mui/palette/dark/darkPalette.js +0 -135
- package/dist/mui/palette/light/lightPalette.d.ts +0 -2
- package/dist/mui/palette/light/lightPalette.js +0 -135
- package/dist/nextjs/NextCacheProvider.d.ts +0 -7
- package/dist/nextjs/NextCacheProvider.js +0 -13
- package/dist/react/ReactCacheProvider.d.ts +0 -7
- package/dist/react/ReactCacheProvider.js +0 -15
- package/dist/theme/theme.d.ts +0 -3
- package/dist/theme/theme.js +0 -75
- package/dist/types/palette.d.ts +0 -60
- package/dist/types/palette.js +0 -1
- package/dist/types/types.d.ts +0 -102
- package/dist/types/types.js +0 -4
- package/dist/types/typography.d.ts +0 -71
- package/dist/types/typography.js +0 -1
package/package.json
CHANGED
package/dist/colors/index.d.ts
DELETED
package/dist/colors/index.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const yellow = {
|
|
2
|
-
50: "#fffbeb",
|
|
3
|
-
100: "#fef3c0",
|
|
4
|
-
200: "#feeda2",
|
|
5
|
-
300: "#fee578",
|
|
6
|
-
400: "#fde05d",
|
|
7
|
-
500: "#fdd835",
|
|
8
|
-
600: "#e6c530",
|
|
9
|
-
700: "#b49926",
|
|
10
|
-
800: "#8b771d",
|
|
11
|
-
900: "#6a5b16"
|
|
12
|
-
};
|
|
13
|
-
const blue = {
|
|
14
|
-
50: "#e9f3fc",
|
|
15
|
-
100: "#b9daf7",
|
|
16
|
-
200: "#98c8f3",
|
|
17
|
-
300: "#68afee",
|
|
18
|
-
400: "#4ba0ea",
|
|
19
|
-
500: "#1e88e5",
|
|
20
|
-
600: "#1b7cd0",
|
|
21
|
-
700: "#1561a3",
|
|
22
|
-
800: "#114b7e",
|
|
23
|
-
900: "#0d3960"
|
|
24
|
-
};
|
|
25
|
-
const green = {
|
|
26
|
-
50: "#ecf6ed",
|
|
27
|
-
100: "#c5e2c6",
|
|
28
|
-
200: "#a9d3aa",
|
|
29
|
-
300: "#81bf84",
|
|
30
|
-
400: "#69b36c",
|
|
31
|
-
500: "#43a047",
|
|
32
|
-
600: "#3d9241",
|
|
33
|
-
700: "#307232",
|
|
34
|
-
800: "#255827",
|
|
35
|
-
900: "#1c431e"
|
|
36
|
-
};
|
|
37
|
-
const orange = {
|
|
38
|
-
50: "#fff4e6",
|
|
39
|
-
100: "#fedbb0",
|
|
40
|
-
200: "#fdca8a",
|
|
41
|
-
300: "#fcb254",
|
|
42
|
-
400: "#fca333",
|
|
43
|
-
500: "#fb8c00",
|
|
44
|
-
600: "#e47f00",
|
|
45
|
-
700: "#b26300",
|
|
46
|
-
800: "#8a4d00",
|
|
47
|
-
900: "#693b00"
|
|
48
|
-
};
|
|
49
|
-
const red = {
|
|
50
|
-
50: "#fcebeb",
|
|
51
|
-
100: "#f7c2c0",
|
|
52
|
-
200: "#f3a4a2",
|
|
53
|
-
300: "#ee7a78",
|
|
54
|
-
400: "#ea615d",
|
|
55
|
-
500: "#e53935",
|
|
56
|
-
600: "#d03430",
|
|
57
|
-
700: "#a32826",
|
|
58
|
-
800: "#7e1f1d",
|
|
59
|
-
900: "#601816"
|
|
60
|
-
};
|
|
61
|
-
const purple = {
|
|
62
|
-
50: "#f4e9f7",
|
|
63
|
-
100: "#dcbbe5",
|
|
64
|
-
200: "#cb9ad8",
|
|
65
|
-
300: "#b36cc6",
|
|
66
|
-
400: "#a550bb",
|
|
67
|
-
500: "#8e24aa",
|
|
68
|
-
600: "#81219b",
|
|
69
|
-
700: "#651a79",
|
|
70
|
-
800: "#4e145e",
|
|
71
|
-
900: "#3c0f47"
|
|
72
|
-
};
|
|
73
|
-
const grey = {
|
|
74
|
-
50: "#f1f1f1",
|
|
75
|
-
100: "#d4d4d4",
|
|
76
|
-
200: "#c0c0c0",
|
|
77
|
-
300: "#a3a3a3",
|
|
78
|
-
400: "#919191",
|
|
79
|
-
500: "#757575",
|
|
80
|
-
600: "#6a6a6a",
|
|
81
|
-
700: "#535353",
|
|
82
|
-
800: "#404040",
|
|
83
|
-
900: "#313131"
|
|
84
|
-
};
|
|
85
|
-
export const colors = {
|
|
86
|
-
yellow,
|
|
87
|
-
blue,
|
|
88
|
-
green,
|
|
89
|
-
orange,
|
|
90
|
-
red,
|
|
91
|
-
purple,
|
|
92
|
-
grey
|
|
93
|
-
};
|
package/dist/colors/type.d.ts
DELETED
package/dist/colors/type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { CheckboxProps, StackProps } from '@mui/material';
|
|
3
|
-
import { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
4
|
-
import { IFormOption } from '../input-list/type';
|
|
5
|
-
export interface ICheckboxValue {
|
|
6
|
-
label: string;
|
|
7
|
-
value: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface CheckboxListProps {
|
|
10
|
-
options: IFormOption[];
|
|
11
|
-
value?: ICheckboxValue[];
|
|
12
|
-
defaultValue?: ICheckboxValue[];
|
|
13
|
-
onChange: (values: ICheckboxValue[]) => void;
|
|
14
|
-
multiple?: boolean;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
stackProps?: StackProps;
|
|
17
|
-
checkboxProps?: CheckboxProps;
|
|
18
|
-
formControlLabelProps?: Omit<FormControlLabelProps, 'label' | 'control'>;
|
|
19
|
-
}
|
|
20
|
-
declare const CheckboxList: FC<CheckboxListProps>;
|
|
21
|
-
export default CheckboxList;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControlLabel, Stack, } from '@mui/material';
|
|
3
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
4
|
-
const CheckboxList = ({ options = [], value = [], onChange, multiple, readonly, checkboxProps, stackProps, formControlLabelProps, }) => {
|
|
5
|
-
const handleChange = (event, changedValue) => {
|
|
6
|
-
const newValues = [...value];
|
|
7
|
-
if (multiple) {
|
|
8
|
-
if (event.target.checked) {
|
|
9
|
-
newValues.push(changedValue);
|
|
10
|
-
onChange(newValues);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
const index = newValues.findIndex((v) => v.value === changedValue.value);
|
|
14
|
-
newValues.splice(index, 1);
|
|
15
|
-
onChange(newValues);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
if (event.target.checked) {
|
|
20
|
-
onChange([changedValue]);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
onChange([]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return (_jsx(Stack, { ...stackProps, children: options.map((option) => (_jsx(FormControlLabel, { "aria-readonly": readonly, ...(readonly && {
|
|
28
|
-
sx: { pointerEvents: 'none', userSelect: 'none' },
|
|
29
|
-
}), control: _jsx(Checkbox, { ...checkboxProps, readOnly: readonly, checked: value?.findIndex((v) => v?.value === option?.value) > -1, onChange: (e) => handleChange(e, option) }), label: option.label, slotProps: { typography: option?.labelProp }, ...formControlLabelProps }, option.value))) }));
|
|
30
|
-
};
|
|
31
|
-
export default CheckboxList;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
|
-
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { TextFieldVariants } from '@mui/material';
|
|
5
|
-
import { TInputLabelMode } from '../input-list/type';
|
|
6
|
-
export interface CustomAutocompleteProps extends Omit<AutocompleteProps<any, boolean, boolean, undefined>, 'renderInput'> {
|
|
7
|
-
label?: string | ReactNode;
|
|
8
|
-
width?: number | string;
|
|
9
|
-
renderInput?: (params: TextFieldProps) => ReactNode;
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
variant?: TextFieldVariants;
|
|
12
|
-
showSelectedCount?: boolean;
|
|
13
|
-
selectedOptions?: any[];
|
|
14
|
-
helperText?: string;
|
|
15
|
-
inputMaxHeight?: string;
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
inputLabelMode?: TInputLabelMode;
|
|
18
|
-
hideLabel?: boolean;
|
|
19
|
-
textFieldProps?: TextFieldProps;
|
|
20
|
-
validation?: {
|
|
21
|
-
isInvalid: boolean;
|
|
22
|
-
message: string;
|
|
23
|
-
};
|
|
24
|
-
onReachEnd?: () => void;
|
|
25
|
-
}
|
|
26
|
-
declare const CustomAutoComplete: FC<CustomAutocompleteProps>;
|
|
27
|
-
export default CustomAutoComplete;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import Box from '@mui/material/Box';
|
|
4
|
-
import InputLabel from '@mui/material/InputLabel';
|
|
5
|
-
import Typography from '@mui/material/Typography';
|
|
6
|
-
import Paper from '@mui/material/Paper';
|
|
7
|
-
import Autocomplete from '@mui/material/Autocomplete';
|
|
8
|
-
import { styled } from '@mui/material/styles';
|
|
9
|
-
import CustomChip from '../custom-chip/CustomChip';
|
|
10
|
-
import { ListBox } from './components/ListBox';
|
|
11
|
-
import AutoCompleteInput from './components/AutoCompleteInput';
|
|
12
|
-
const AutoCompletePaper = styled(Paper)(({ theme }) => ({
|
|
13
|
-
direction: 'ltr',
|
|
14
|
-
backgroundColor: theme.palette.background.paper,
|
|
15
|
-
'.MuiAutocomplete-option': {
|
|
16
|
-
borderBottom: '1px solid',
|
|
17
|
-
borderColor: theme.palette.divider,
|
|
18
|
-
'&:last-child': {
|
|
19
|
-
borderBottom: 'none',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
const CustomAutoComplete = ({ label, helperText, options, multiple, disabled, validation, selectedOptions, showSelectedCount, isLoading, inputMaxHeight, width, placeholder, variant, hideLabel = false, inputLabelMode, textFieldProps, onReachEnd, ...rest }) => {
|
|
24
|
-
const loading = isLoading;
|
|
25
|
-
return (_jsxs(Box, { sx: { width }, children: [_jsx(InputLabel, { sx: {
|
|
26
|
-
fontSize: 12,
|
|
27
|
-
color: disabled ? 'text.1' : 'text.primary',
|
|
28
|
-
}, children: inputLabelMode === 'static' && !hideLabel && (_jsx(Typography, { variant: 'caption2', children: label })) }), _jsx(Autocomplete, { loading: loading, limitTags: 2, multiple: multiple, disabled: disabled, options: options || [], disableCloseOnSelect: multiple, disablePortal: Boolean(rest.limitTags), value: rest.value,
|
|
29
|
-
// defaultValue={rest?.defaultValue}
|
|
30
|
-
id: 'virtualize-demo', disableListWrap: true, isOptionEqualToValue: (option, value) => {
|
|
31
|
-
return option?.value === value?.value;
|
|
32
|
-
}, renderOption: (props, option, state) => ({
|
|
33
|
-
props,
|
|
34
|
-
option,
|
|
35
|
-
index: state.index,
|
|
36
|
-
multiple,
|
|
37
|
-
selected: state.selected,
|
|
38
|
-
}), ListboxProps: { onReachEnd }, ListboxComponent: ListBox, renderGroup: (params) => params, noOptionsText: _jsx(Typography, { variant: 'caption2', sx: { color: 'text.primary' }, children: "\u0646\u062A\u06CC\u062C\u0647 \u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F" }), loadingText: _jsx(Typography, { variant: 'caption2', sx: { color: 'text.primary' }, children: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0632\u0627\u0631\u06CC..." }), sx: {
|
|
39
|
-
padding: 0,
|
|
40
|
-
width: '100%',
|
|
41
|
-
...(disabled && { opacity: 0.7, cursor: 'not-allowed' }),
|
|
42
|
-
}, renderTags: (tagValue, getTagProps) => {
|
|
43
|
-
return tagValue.map((option, index) => {
|
|
44
|
-
// Ensure that the option is an object with both label and value properties
|
|
45
|
-
if (typeof option === 'object' && option.label && option.value) {
|
|
46
|
-
return (_createElement(CustomChip, { ...getTagProps({ index }), key: index, label: option.label, labelProps: { sx: {} }, chipProps: {
|
|
47
|
-
sx: {
|
|
48
|
-
height: 24,
|
|
49
|
-
px: 1,
|
|
50
|
-
'& .MuiChip-deleteIcon': { width: 12 },
|
|
51
|
-
'& .MuiChip-label': {
|
|
52
|
-
px: 0,
|
|
53
|
-
'& .MuiTypography-root': { fontSize: 10 },
|
|
54
|
-
},
|
|
55
|
-
...rest.ChipProps?.sx,
|
|
56
|
-
},
|
|
57
|
-
rounded: true,
|
|
58
|
-
size: 'small',
|
|
59
|
-
...rest.ChipProps,
|
|
60
|
-
} }));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return null; // Handle invalid cases gracefully
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}, getOptionDisabled: (option) => !!option?.disabled, renderInput: (params) => (_jsx(AutoCompleteInput, { params: params, helperText: helperText, variant: variant, placeholder: placeholder, label: label, isLoading: loading, inputLabelMode: inputLabelMode, inputMaxHeight: inputMaxHeight, textFieldProps: textFieldProps, validation: validation })), PaperComponent: (props) => (_jsx(AutoCompletePaper, { elevation: 1, ...props })), ...rest }), _jsx(Box, { sx: {
|
|
67
|
-
display: 'flex',
|
|
68
|
-
alignItems: 'center',
|
|
69
|
-
justifyContent: 'space-between',
|
|
70
|
-
}, children: multiple &&
|
|
71
|
-
selectedOptions &&
|
|
72
|
-
selectedOptions?.length > 0 &&
|
|
73
|
-
showSelectedCount && (_jsxs(Typography, { variant: 'caption3', sx: { color: 'text.4', mt: 1 }, children: [selectedOptions?.length, " item", selectedOptions?.length > 1 && "'s", " selected"] })) })] }));
|
|
74
|
-
};
|
|
75
|
-
export default CustomAutoComplete;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { AutocompleteRenderInputParams, TextFieldVariants } from '@mui/material';
|
|
3
|
-
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { TInputLabelMode } from '../../input-list/type';
|
|
5
|
-
interface Props {
|
|
6
|
-
params: AutocompleteRenderInputParams;
|
|
7
|
-
variant?: TextFieldVariants;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
validation?: {
|
|
10
|
-
isInvalid: boolean;
|
|
11
|
-
message: string;
|
|
12
|
-
};
|
|
13
|
-
inputLabelMode?: TInputLabelMode;
|
|
14
|
-
label?: string | ReactNode;
|
|
15
|
-
helperText?: string;
|
|
16
|
-
isLoading?: boolean;
|
|
17
|
-
textFieldProps?: TextFieldProps;
|
|
18
|
-
inputMaxHeight?: string;
|
|
19
|
-
}
|
|
20
|
-
declare const AutoCompleteInput: FC<Props>;
|
|
21
|
-
export default AutoCompleteInput;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { InputAdornment, useTheme, } from '@mui/material';
|
|
3
|
-
import InfoCircle from '../../../icons/InfoCircle';
|
|
4
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
|
-
import TextField from '@mui/material/TextField';
|
|
6
|
-
const AutoCompleteInput = ({ params, variant, validation, placeholder, label, helperText, isLoading, inputLabelMode, textFieldProps, inputMaxHeight }) => {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
return (_jsx(TextField, { variant: variant, placeholder: placeholder, error: validation?.isInvalid, ...(inputLabelMode === 'relative' && { label: label }), ...params, helperText: validation?.message
|
|
9
|
-
? validation?.message ?? helperText ?? ' '
|
|
10
|
-
: undefined, InputProps: {
|
|
11
|
-
...params.InputProps,
|
|
12
|
-
...(validation?.isInvalid && {
|
|
13
|
-
startAdornment: (_jsx(InputAdornment, { sx: { pl: 2 }, position: 'start', children: _jsx(InfoCircle, { primarycolor: theme.palette.error.main }) })),
|
|
14
|
-
}),
|
|
15
|
-
endAdornment: (_jsxs(InputAdornment, { position: 'end', children: [isLoading && _jsx(CircularProgress, { color: 'inherit', size: 20 }), params.InputProps.endAdornment] })),
|
|
16
|
-
}, ...textFieldProps, sx: {
|
|
17
|
-
minWidth: 0,
|
|
18
|
-
height: '100%',
|
|
19
|
-
overflow: 'auto',
|
|
20
|
-
'& .MuiFilledInput-root': {
|
|
21
|
-
...(inputLabelMode === 'relative' && {
|
|
22
|
-
alignItems: 'flex-end',
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
maxHeight: inputMaxHeight ?? 'unset',
|
|
26
|
-
...textFieldProps?.sx,
|
|
27
|
-
} }));
|
|
28
|
-
};
|
|
29
|
-
export default AutoCompleteInput;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Adapter for react-window
|
|
3
|
-
import { useTheme } from '@mui/material';
|
|
4
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { VariableSizeList } from 'react-window';
|
|
7
|
-
import { ListRow } from './ListRow';
|
|
8
|
-
import debounce from '../../../methods/debounce';
|
|
9
|
-
export const LISTBOX_PADDING = 8; // px
|
|
10
|
-
export const ListBox = React.forwardRef(function ListBox(props, ref) {
|
|
11
|
-
const { children, onReachEnd, ...other } = props;
|
|
12
|
-
const itemData = [];
|
|
13
|
-
children.forEach((item) => {
|
|
14
|
-
itemData.push(item);
|
|
15
|
-
itemData.push(...(item.children || []));
|
|
16
|
-
});
|
|
17
|
-
const theme = useTheme();
|
|
18
|
-
const smUp = useMediaQuery(theme.breakpoints.up('sm'), {
|
|
19
|
-
noSsr: true,
|
|
20
|
-
});
|
|
21
|
-
const itemCount = itemData.length;
|
|
22
|
-
const itemSize = smUp ? 36 : 48;
|
|
23
|
-
const getHeight = () => {
|
|
24
|
-
if (itemCount > 8) {
|
|
25
|
-
return 8 * itemSize;
|
|
26
|
-
}
|
|
27
|
-
return itemData.map(() => itemSize).reduce((a, b) => a + b, 0);
|
|
28
|
-
};
|
|
29
|
-
const OuterElementContext = React.createContext({});
|
|
30
|
-
const OuterElementType = React.forwardRef((props, ref) => {
|
|
31
|
-
const outerProps = React.useContext(OuterElementContext);
|
|
32
|
-
return _jsx("div", { ref: ref, ...props, ...outerProps });
|
|
33
|
-
});
|
|
34
|
-
function useResetCache(data) {
|
|
35
|
-
const ref = React.useRef(null);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
if (ref.current != null) {
|
|
38
|
-
ref.current.resetAfterIndex(0, true);
|
|
39
|
-
}
|
|
40
|
-
}, [data]);
|
|
41
|
-
return ref;
|
|
42
|
-
}
|
|
43
|
-
const gridRef = useResetCache(itemCount);
|
|
44
|
-
const handleReachEnd = () => {
|
|
45
|
-
if (onReachEnd) {
|
|
46
|
-
onReachEnd();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const debouncedReachEnd = debounce(handleReachEnd, 10);
|
|
50
|
-
const handleScroll = ({ scrollDirection, scrollOffset, scrollUpdateWasRequested, }) => {
|
|
51
|
-
if (!scrollUpdateWasRequested &&
|
|
52
|
-
scrollDirection === 'forward' &&
|
|
53
|
-
gridRef?.current) {
|
|
54
|
-
const listHeight = +gridRef.current.props.height;
|
|
55
|
-
const totalHeight = gridRef.current.props?.itemSize(1) * itemCount;
|
|
56
|
-
if (scrollOffset + listHeight >= totalHeight) {
|
|
57
|
-
debouncedReachEnd();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return (_jsx("div", { ref: ref, children: _jsx(OuterElementContext.Provider, { value: other, children: _jsx(VariableSizeList, { itemData: itemData, height: getHeight() + 2 * LISTBOX_PADDING, width: '100%', ref: gridRef, outerElementType: OuterElementType, innerElementType: 'ul', itemSize: (index) => itemSize, overscanCount: 5, itemCount: itemCount, style: { direction: 'inherit' }, onScroll: handleScroll, children: ListRow }) }) }));
|
|
62
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import Typography from '@mui/material/Typography';
|
|
4
|
-
import { LISTBOX_PADDING } from './ListBox';
|
|
5
|
-
import { Checkbox } from '@mui/material';
|
|
6
|
-
export function ListRow(props) {
|
|
7
|
-
const { data, index, style } = props;
|
|
8
|
-
const dataSet = data[index];
|
|
9
|
-
const inlineStyle = {
|
|
10
|
-
...style,
|
|
11
|
-
top: style.top + LISTBOX_PADDING,
|
|
12
|
-
};
|
|
13
|
-
const { props: optionProps, option, multiple, selected } = dataSet || {};
|
|
14
|
-
return (_createElement("li", { ...optionProps, key: option.value, style: inlineStyle },
|
|
15
|
-
multiple && _jsx(Checkbox, { checked: selected, sx: { opacity: 'inherit' } }),
|
|
16
|
-
_jsx(Typography, { variant: 'caption3', children: option?.label }))
|
|
17
|
-
// <Typography key={key} component="li" {...optionProps} noWrap style={inlineStyle}>
|
|
18
|
-
// {option?.label}
|
|
19
|
-
// </Typography>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
|
-
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { TextFieldVariants } from '@mui/material';
|
|
5
|
-
import { TInputLabelMode } from '../input-list/type';
|
|
6
|
-
export interface CustomAutocompleteAdvancedProps extends Omit<AutocompleteProps<any, boolean, boolean, boolean>, 'renderInput'> {
|
|
7
|
-
label?: string | ReactNode;
|
|
8
|
-
width?: number | string;
|
|
9
|
-
renderInput?: (params: TextFieldProps) => ReactNode;
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
variant?: TextFieldVariants;
|
|
12
|
-
showSelectedCount?: boolean;
|
|
13
|
-
selectedOptions?: any[];
|
|
14
|
-
helperText?: string;
|
|
15
|
-
inputMaxHeight?: string;
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
inputLabelMode?: TInputLabelMode;
|
|
18
|
-
hideLabel?: boolean;
|
|
19
|
-
textFieldProps?: TextFieldProps;
|
|
20
|
-
validation?: {
|
|
21
|
-
isInvalid: boolean;
|
|
22
|
-
message: string;
|
|
23
|
-
};
|
|
24
|
-
onReachEnd?: () => void;
|
|
25
|
-
onSearch?: (e: any) => void;
|
|
26
|
-
}
|
|
27
|
-
declare const CustomAutoCompleteAdvanced: FC<CustomAutocompleteAdvancedProps>;
|
|
28
|
-
export default CustomAutoCompleteAdvanced;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useRef, useState } from 'react';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import InputLabel from '@mui/material/InputLabel';
|
|
6
|
-
import Typography from '@mui/material/Typography';
|
|
7
|
-
import Paper from '@mui/material/Paper';
|
|
8
|
-
import Autocomplete from '@mui/material/Autocomplete';
|
|
9
|
-
import { styled } from '@mui/material/styles';
|
|
10
|
-
import { ListBox } from './components/ListBox';
|
|
11
|
-
import RenderInput from './components/RenderInput';
|
|
12
|
-
import RenderTags from './components/RenderTags';
|
|
13
|
-
import SvgAdd from '../../icons/Add';
|
|
14
|
-
const AutoCompletePaper = styled(Paper)(({ theme }) => ({
|
|
15
|
-
direction: 'ltr',
|
|
16
|
-
boxShadow: '0px 0px 10px rgba(94, 129, 233, 0.2)',
|
|
17
|
-
marginTop: 8,
|
|
18
|
-
backgroundColor: theme.palette.background.paper,
|
|
19
|
-
'.MuiAutocomplete-option': {
|
|
20
|
-
borderBottom: '1px solid',
|
|
21
|
-
borderColor: theme.palette.divider,
|
|
22
|
-
paddingLeft: '0 !important',
|
|
23
|
-
'&:last-child': {
|
|
24
|
-
borderBottom: 'none',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}));
|
|
28
|
-
const LimitedTagsCount = (more, size) => {
|
|
29
|
-
return (_jsxs(Typography, { variant: 'caption2.medium', sx: {
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
right: 64,
|
|
32
|
-
top: size === 'medium' ? 12 : 8,
|
|
33
|
-
backgroundColor: 'background.default',
|
|
34
|
-
borderRadius: '100%',
|
|
35
|
-
minWidth: 24,
|
|
36
|
-
textAlign: 'center',
|
|
37
|
-
}, children: [String(more), "+"] }));
|
|
38
|
-
};
|
|
39
|
-
const CustomAutoCompleteAdvanced = ({ label, helperText, options, multiple, disabled, limitTags, validation, selectedOptions, showSelectedCount, isLoading, inputMaxHeight, placeholder, variant, hideLabel = false, inputLabelMode = 'static', textFieldProps, onReachEnd, onSearch, sx, ...rest }) => {
|
|
40
|
-
//Keeping the value controlled by state helps to track free solo stage for search
|
|
41
|
-
const [value, setValue] = useState('');
|
|
42
|
-
const onChangeValue = (newValue) => {
|
|
43
|
-
setValue(newValue || '');
|
|
44
|
-
};
|
|
45
|
-
//_______________________________________________________________________________
|
|
46
|
-
//Cache result options for search and integration across the pages
|
|
47
|
-
const cachedOptionsRef = useRef([]);
|
|
48
|
-
const cachedOptions = useMemo(() => {
|
|
49
|
-
options.forEach((option) => {
|
|
50
|
-
if (!cachedOptionsRef.current.find((opt) => opt.value === option?.value)
|
|
51
|
-
?.value) {
|
|
52
|
-
cachedOptionsRef.current.push(option);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return cachedOptionsRef.current;
|
|
56
|
-
}, [options.length]);
|
|
57
|
-
//_______________________________________________________________________________
|
|
58
|
-
const lang = document.documentElement.lang;
|
|
59
|
-
return (_jsxs(_Fragment, { children: [_jsx(InputLabel, { sx: {
|
|
60
|
-
fontSize: 12,
|
|
61
|
-
color: disabled ? 'text.1' : 'text.primary',
|
|
62
|
-
}, children: inputLabelMode === 'static' && !hideLabel && (_jsx(Typography, { variant: 'caption2', children: label })) }), _jsx(Autocomplete, { loading: isLoading, limitTags: limitTags, multiple: multiple, id: 'ideep-auto-complete', options: cachedOptions || [], disabled: disabled, "aria-disabled": disabled, disableCloseOnSelect: multiple, value: rest.value, disableListWrap: true, isOptionEqualToValue: (option, value) => {
|
|
63
|
-
return option?.value === value?.value;
|
|
64
|
-
}, freeSolo: Boolean(onSearch) && Boolean(value), renderOption: (props, option, state) => ({
|
|
65
|
-
props,
|
|
66
|
-
option,
|
|
67
|
-
index: state.index,
|
|
68
|
-
multiple,
|
|
69
|
-
selected: state.selected,
|
|
70
|
-
}), ListboxProps: { onReachEnd, isLoading }, ListboxComponent: ListBox, noOptionsText: _jsx(Typography, { variant: 'caption2', sx: { color: 'text.primary' }, children: lang.includes('fa') ? 'نتیجه ای یافت نشد' : 'No results found.' }), loadingText: _jsx(Typography, { variant: 'caption2', sx: { color: 'text.primary' }, children: lang.includes('fa') ? 'در حال بارگزاری...' : 'Loading...' }), renderTags: (value, getTagProps) => RenderTags(value, getTagProps, variant !== 'standard' ? variant : 'filled', rest.size), getOptionDisabled: (option) => !!option?.disabled, renderInput: (params) => (_createElement(RenderInput, { params: params, ...(inputLabelMode === 'relative' && {
|
|
71
|
-
label,
|
|
72
|
-
}), loading: isLoading, key: 'render-input-' + label, helperText: helperText, variant: variant, placeholder: (selectedOptions?.length || 0) < 0 ? placeholder : undefined, inputMaxHeight: inputMaxHeight, disabled: disabled, label: label, textFieldProps: textFieldProps, validation: validation, handleSearch: onSearch, handleChange: onChangeValue, value: value })), clearIcon: _jsx(SvgAdd, { style: { transform: 'rotate(45deg)' }, primarycolor: 'inherit' }), getLimitTagsText: (more) => LimitedTagsCount(more, rest.size), sx: [
|
|
73
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
74
|
-
{
|
|
75
|
-
padding: 0,
|
|
76
|
-
width: '100%',
|
|
77
|
-
'& .MuiAutocomplete-popupIndicator': {
|
|
78
|
-
width: '100%',
|
|
79
|
-
maxWidth: 27,
|
|
80
|
-
},
|
|
81
|
-
...(disabled && { cursor: 'not-allowed' }),
|
|
82
|
-
},
|
|
83
|
-
], PaperComponent: (props) => (_jsx(AutoCompletePaper, { elevation: 0, ...props })), ...rest }), _jsx(Box, { sx: {
|
|
84
|
-
display: 'flex',
|
|
85
|
-
alignItems: 'center',
|
|
86
|
-
justifyContent: 'space-between',
|
|
87
|
-
}, children: multiple &&
|
|
88
|
-
selectedOptions &&
|
|
89
|
-
selectedOptions?.length > 0 &&
|
|
90
|
-
showSelectedCount && (_jsxs(Typography, { variant: 'caption3', sx: { mt: 1 }, children: [selectedOptions?.length, " ", lang.includes('fa') ? 'گزینه' : 'item', selectedOptions?.length > 1 && !lang.includes('fa') && 's', ' ', lang.includes('fa') ? 'انتخاب شده' : ' selected'] })) })] }));
|
|
91
|
-
};
|
|
92
|
-
export default CustomAutoCompleteAdvanced;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const LISTBOX_PADDING = 8;
|
|
3
|
-
export declare const ListBox: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
4
|
-
onReachEnd?: (() => void) | undefined;
|
|
5
|
-
isLoading?: boolean | undefined;
|
|
6
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Adapter for react-window
|
|
3
|
-
import { LinearProgress, useTheme } from '@mui/material';
|
|
4
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { VariableSizeList } from 'react-window';
|
|
7
|
-
import { ListRow } from './ListRow';
|
|
8
|
-
import { useRef } from 'react';
|
|
9
|
-
import debounce from '../../../methods/debounce';
|
|
10
|
-
export const LISTBOX_PADDING = 8; // px
|
|
11
|
-
export const ListBox = React.forwardRef(function ListBox(props, ref) {
|
|
12
|
-
const { children, onReachEnd, isLoading, ...other } = props;
|
|
13
|
-
const itemData = [];
|
|
14
|
-
children.forEach((item) => {
|
|
15
|
-
itemData.push(item);
|
|
16
|
-
itemData.push(...(item.children || []));
|
|
17
|
-
});
|
|
18
|
-
const prevItemCount = useRef(undefined);
|
|
19
|
-
const theme = useTheme();
|
|
20
|
-
const smUp = useMediaQuery(theme.breakpoints.up('sm'), {
|
|
21
|
-
noSsr: true,
|
|
22
|
-
});
|
|
23
|
-
const itemCount = itemData.length;
|
|
24
|
-
const itemSize = smUp ? 36 : 48;
|
|
25
|
-
const getHeight = () => {
|
|
26
|
-
if (itemCount > 8) {
|
|
27
|
-
return 8 * itemSize;
|
|
28
|
-
}
|
|
29
|
-
return itemData.map(() => itemSize).reduce((a, b) => a + b, 0);
|
|
30
|
-
};
|
|
31
|
-
const OuterElementContext = React.createContext({});
|
|
32
|
-
const OuterElementType = React.forwardRef((props, ref) => {
|
|
33
|
-
const outerProps = React.useContext(OuterElementContext);
|
|
34
|
-
return _jsx("div", { ref: ref, ...props, ...outerProps });
|
|
35
|
-
});
|
|
36
|
-
OuterElementType.displayName = 'OuterElementType';
|
|
37
|
-
function useResetCache(data) {
|
|
38
|
-
const ref = React.useRef(null);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
if (ref.current != null) {
|
|
41
|
-
ref.current.resetAfterIndex(itemCount, true);
|
|
42
|
-
gridRef.current?.scrollToItem(prevItemCount.current || 0, 'start');
|
|
43
|
-
prevItemCount.current = itemCount;
|
|
44
|
-
}
|
|
45
|
-
}, [data]);
|
|
46
|
-
return ref;
|
|
47
|
-
}
|
|
48
|
-
const gridRef = useResetCache(itemCount);
|
|
49
|
-
const handleReachEnd = () => {
|
|
50
|
-
if (onReachEnd) {
|
|
51
|
-
onReachEnd();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const debouncedReachEnd = debounce(handleReachEnd, 10);
|
|
55
|
-
const handleScroll = ({ scrollDirection, scrollOffset, scrollUpdateWasRequested, }) => {
|
|
56
|
-
if (!scrollUpdateWasRequested &&
|
|
57
|
-
scrollDirection === 'forward' &&
|
|
58
|
-
gridRef?.current) {
|
|
59
|
-
const listHeight = +gridRef.current.props.height;
|
|
60
|
-
const totalHeight = gridRef.current.props?.itemSize(1) * itemCount;
|
|
61
|
-
if (scrollOffset + listHeight >= totalHeight) {
|
|
62
|
-
debouncedReachEnd();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
return (_jsxs("div", { ref: ref, style: { position: 'relative', width: '100%', height: '100%' }, children: [isLoading && (_jsx(_Fragment, { children: _jsx(LinearProgress, { sx: {
|
|
67
|
-
position: 'absolute',
|
|
68
|
-
top: 0,
|
|
69
|
-
left: 0,
|
|
70
|
-
width: '100%',
|
|
71
|
-
} }) })), _jsx(OuterElementContext.Provider, { value: other, children: _jsx(VariableSizeList, { itemData: itemData, height: getHeight() + 2 * LISTBOX_PADDING, width: '100%', ref: gridRef, outerElementType: OuterElementType, innerElementType: 'ul', itemSize: (index) => itemSize, overscanCount: 5, itemCount: itemCount, style: {
|
|
72
|
-
direction: 'inherit',
|
|
73
|
-
transition: '0.3s ease all',
|
|
74
|
-
filter: isLoading ? 'brightness(92%) blur(2px)' : 'none',
|
|
75
|
-
}, onScroll: handleScroll, initialScrollOffset: (itemCount - itemSize) * itemSize, children: ListRow }) })] }));
|
|
76
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import Typography from '@mui/material/Typography';
|
|
4
|
-
import { LISTBOX_PADDING } from './ListBox';
|
|
5
|
-
import { Checkbox } from '@mui/material';
|
|
6
|
-
export function ListRow(props) {
|
|
7
|
-
const { data, index, style } = props;
|
|
8
|
-
const dataSet = data[index];
|
|
9
|
-
const inlineStyle = {
|
|
10
|
-
...style,
|
|
11
|
-
top: style.top + LISTBOX_PADDING,
|
|
12
|
-
};
|
|
13
|
-
const { props: optionProps, option, multiple, selected } = dataSet || {};
|
|
14
|
-
return (_createElement("li", { ...optionProps, key: option?.value, style: inlineStyle },
|
|
15
|
-
multiple && _jsx(Checkbox, { checked: selected, sx: { opacity: 'inherit' } }),
|
|
16
|
-
_jsx(Typography, { variant: 'caption3', children: option?.label })));
|
|
17
|
-
}
|