mui-design-system 0.0.8 → 0.0.11
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/dist/components/{form/checkbox-list → checkbox-list}/CheckboxList.d.ts +3 -1
- package/dist/components/{form/checkbox-list → checkbox-list}/CheckboxList.js +4 -3
- package/dist/components/custom-auto-complete/CustomAutoComplete.d.ts +1 -1
- package/dist/components/custom-auto-complete/CustomAutoComplete.js +20 -6
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +1 -1
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.js +1 -1
- package/dist/components/custom-auto-complete/components/ListBox.js +3 -3
- package/dist/components/custom-auto-complete/components/ListRow.js +1 -1
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.d.ts +28 -0
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.js +92 -0
- package/dist/components/custom-auto-complete-advanced/components/ListBox.d.ts +6 -0
- package/dist/components/custom-auto-complete-advanced/components/ListBox.js +76 -0
- package/dist/components/custom-auto-complete-advanced/components/ListRow.d.ts +2 -0
- package/dist/components/custom-auto-complete-advanced/components/ListRow.js +17 -0
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.d.ts +23 -0
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.js +51 -0
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.d.ts +9 -0
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.js +22 -0
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.d.ts +17 -0
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.js +11 -0
- package/dist/components/custom-card/CustomHorizontalCard.d.ts +3 -0
- package/dist/components/custom-card/CustomHorizontalCard.js +9 -0
- package/dist/components/custom-card/CustomVerticalCard.d.ts +3 -0
- package/dist/components/custom-card/CustomVerticalCard.js +9 -0
- package/dist/components/custom-chip/CustomChip.d.ts +12 -0
- package/dist/components/custom-chip/CustomChip.js +10 -0
- package/dist/components/custom-date-picker/CustomComponent.d.ts +4 -4
- package/dist/components/custom-date-picker/CustomComponent.js +23 -13
- package/dist/components/custom-date-picker/CustomDatePicker.d.ts +2 -1
- package/dist/components/custom-date-picker/CustomDatePicker.js +24 -9
- package/dist/components/custom-dialog/CustomDialog.d.ts +41 -0
- package/dist/components/custom-dialog/CustomDialog.js +38 -0
- package/dist/components/{custom-numeric-input → custom-input}/CustomNumericInput.d.ts +3 -3
- package/dist/components/{custom-numeric-input → custom-input}/CustomNumericInput.js +6 -6
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.d.ts +9 -0
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.js +29 -0
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.d.ts +19 -0
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.js +101 -0
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.d.ts +19 -0
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.js +40 -0
- package/dist/components/custom-mobile-date-picker/ItemPicker.d.ts +10 -0
- package/dist/components/custom-mobile-date-picker/ItemPicker.js +72 -0
- package/dist/components/custom-modal/CustomModal.d.ts +21 -0
- package/dist/components/custom-modal/CustomModal.js +38 -0
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +8 -3
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.js +5 -23
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +1 -1
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.js +5 -3
- package/dist/components/custom-stepper/CustomStepper.d.ts +31 -0
- package/dist/components/custom-stepper/CustomStepper.js +170 -0
- package/dist/components/custom-table/CustomTable.d.ts +53 -2
- package/dist/components/custom-table/CustomTable.js +13 -7
- package/dist/components/custom-table/components/CustomTableBody.d.ts +4 -5
- package/dist/components/custom-table/components/CustomTableBody.js +4 -22
- package/dist/components/custom-table/components/CustomTableCell.d.ts +2 -2
- package/dist/components/custom-table/components/CustomTableCell.js +14 -16
- package/dist/components/custom-table/components/CustomTableHead.d.ts +3 -5
- package/dist/components/custom-table/components/CustomTableHead.js +13 -14
- package/dist/components/custom-table/components/CustomTableRow.d.ts +9 -5
- package/dist/components/custom-table/components/CustomTableRow.js +14 -17
- package/dist/components/custom-table/components/useTable.d.ts +16 -4
- package/dist/components/custom-table/components/useTable.js +5 -5
- package/dist/components/custom-tabs/CustomTabs.d.ts +22 -0
- package/dist/components/custom-tabs/CustomTabs.js +70 -0
- package/dist/components/custom-uploader/CustomUploader.js +16 -23
- package/dist/components/index.d.ts +105 -30
- package/dist/components/index.js +66 -46
- package/dist/components/input-list/InputListWithUseForm.d.ts +22 -0
- package/dist/components/input-list/InputListWithUseForm.js +22 -0
- package/dist/components/{form → input-list}/UseFormInput.d.ts +2 -2
- package/dist/components/{form → input-list}/UseFormInput.js +21 -12
- package/dist/components/input-list/components/UFAutoComplete.js +52 -0
- package/dist/components/input-list/components/UFCheckbox.d.ts +19 -0
- package/dist/components/input-list/components/UFCheckbox.js +24 -0
- package/dist/components/{form → input-list}/components/UFCurrency.d.ts +3 -3
- package/dist/components/input-list/components/UFCurrency.js +50 -0
- package/dist/components/{form → input-list}/components/UFDatePicker.js +4 -7
- package/dist/components/input-list/components/UFDatePickerMobile.d.ts +9 -0
- package/dist/components/input-list/components/UFDatePickerMobile.js +6 -0
- package/dist/components/{form → input-list}/components/UFMultiCheckbox.d.ts +3 -3
- package/dist/components/input-list/components/UFMultiCheckbox.js +13 -0
- package/dist/components/{form → input-list}/components/UFMultiSelect.d.ts +3 -3
- package/dist/components/input-list/components/UFMultiSelect.js +43 -0
- package/dist/components/input-list/components/UFRadio.d.ts +9 -0
- package/dist/components/input-list/components/UFRadio.js +16 -0
- package/dist/components/{form → input-list}/components/UFSelect.d.ts +2 -2
- package/dist/components/input-list/components/UFSelect.js +27 -0
- package/dist/components/input-list/components/UFSwitch.d.ts +19 -0
- package/dist/components/input-list/components/UFSwitch.js +99 -0
- package/dist/components/{form → input-list}/components/UFTextArea.js +2 -5
- package/dist/components/{form → input-list}/components/UFTextField.d.ts +0 -2
- package/dist/components/input-list/components/UFTextField.js +52 -0
- package/dist/components/input-list/components/UFTime.d.ts +10 -0
- package/dist/components/input-list/components/UFTime.js +93 -0
- package/dist/components/{form → input-list}/components/UFUploader.d.ts +3 -3
- package/dist/components/input-list/components/UFUploader.js +39 -0
- package/dist/components/otp-input/OTPInput.d.ts +19 -0
- package/dist/components/otp-input/OTPInput.js +161 -0
- package/dist/components/rich-tooltip/RichTooltip.d.ts +18 -0
- package/dist/components/rich-tooltip/RichTooltip.js +32 -0
- package/dist/icons/Add.d.ts +7 -0
- package/dist/icons/Add.js +3 -0
- package/dist/icons/ArrowDown.d.ts +7 -0
- package/dist/icons/ArrowDown.js +3 -0
- package/dist/icons/ArrowLeft1.d.ts +7 -0
- package/dist/icons/ArrowLeft1.js +3 -0
- package/dist/{assets/icons/ChevronDown.d.ts → icons/ArrowRight1.d.ts} +3 -3
- package/dist/icons/ArrowRight1.js +3 -0
- package/dist/icons/CloseCircle.d.ts +7 -0
- package/dist/icons/CloseCircle.js +3 -0
- package/dist/icons/Eye.d.ts +7 -0
- package/dist/icons/Eye.js +3 -0
- package/dist/icons/EyeSlash.d.ts +7 -0
- package/dist/icons/EyeSlash.js +3 -0
- package/dist/icons/Tick.d.ts +7 -0
- package/dist/icons/Tick.js +3 -0
- package/dist/{assets/icons → icons}/Union.js +1 -1
- package/dist/icons/Warning2.d.ts +7 -0
- package/dist/icons/Warning2.js +3 -0
- package/dist/mui/Alert/Alert.js +9 -42
- package/dist/mui/AutoComplete/MuiAutoComplete.js +15 -30
- package/dist/mui/BreadCrumbs/MuiBreadCrumbs.js +2 -2
- package/dist/mui/Button/MuiButton.d.ts +7 -2
- package/dist/mui/Button/MuiButton.js +175 -67
- package/dist/mui/Checkbox/Checkbox.js +13 -18
- package/dist/mui/Checkbox/assets/CheckedIcon.d.ts +3 -3
- package/dist/mui/Checkbox/assets/CheckedIcon.js +8 -2
- package/dist/mui/Checkbox/assets/IntermediateIcon.d.ts +1 -2
- package/dist/mui/Checkbox/assets/IntermediateIcon.js +7 -2
- package/dist/mui/Checkbox/assets/UnChekedIcon.js +3 -2
- package/dist/mui/Chip/MuiChip.d.ts +9 -1
- package/dist/mui/Chip/MuiChip.js +29 -110
- package/dist/mui/Dialog/MuiDialog.d.ts +7 -2
- package/dist/mui/Dialog/MuiDialog.js +14 -18
- package/dist/mui/FormControl/MuiFormControlLabel.js +1 -1
- package/dist/mui/IconButton/MuiIconButon.d.ts +1 -1
- package/dist/mui/IconButton/MuiIconButon.js +2 -165
- package/dist/mui/InputAdornment/MuiInputAdornment.d.ts +1 -1
- package/dist/mui/InputAdornment/MuiInputAdornment.js +1 -1
- package/dist/mui/InputLabel/MuiInputLabel.js +34 -1
- package/dist/mui/Pagination/MuiPagination.js +4 -4
- package/dist/mui/Pagination/MuiPaginationItem.d.ts +1 -1
- package/dist/mui/Pagination/MuiPaginationItem.js +8 -10
- package/dist/mui/Radio/MuiRadio.js +7 -8
- package/dist/mui/Select/MuiSelect.js +11 -10
- package/dist/mui/Switch/MuiSwitch.d.ts +1 -1
- package/dist/mui/Switch/MuiSwitch.js +71 -42
- package/dist/mui/Tabs/MuiTabs.d.ts +1 -1
- package/dist/mui/Tabs/MuiTabs.js +17 -92
- package/dist/mui/Tabs/Tab/MuiTab.d.ts +1 -1
- package/dist/mui/Tabs/Tab/MuiTab.js +22 -47
- package/dist/mui/TextField/MuiFilledInput.js +21 -26
- package/dist/mui/TextField/MuiOutlinedInput.js +28 -15
- package/dist/mui/TextField/TextField.js +69 -49
- package/dist/mui/Tooltip/MuiTooltip.js +1 -1
- package/dist/mui/breakpoints/index.d.ts +9 -2
- package/dist/mui/breakpoints/index.js +2 -2
- package/dist/mui/menu/MuiMenuItem.js +3 -3
- package/dist/mui/palette/dark/darkPalette.js +113 -50
- package/dist/mui/palette/light/lightPalette.js +119 -48
- package/dist/styles/datePicker.css +113 -0
- package/dist/theme/theme.js +0 -14
- package/dist/types/palette.d.ts +39 -33
- package/dist/types/typography.d.ts +57 -22
- package/package.json +2 -2
- package/dist/assets/icons/AlertCircle.d.ts +0 -7
- package/dist/assets/icons/AlertCircle.js +0 -3
- package/dist/assets/icons/ChevronDown.js +0 -3
- package/dist/assets/icons/InfoSquare.d.ts +0 -7
- package/dist/assets/icons/InfoSquare.js +0 -3
- package/dist/assets/icons/SuccessSquare.d.ts +0 -7
- package/dist/assets/icons/SuccessSquare.js +0 -3
- package/dist/assets/icons/Warning.d.ts +0 -7
- package/dist/assets/icons/Warning.js +0 -3
- package/dist/components/custom-pagination/custom-pagination-1/types.d.ts +0 -6
- package/dist/components/custom-pagination/custom-pagination-1/types.js +0 -1
- package/dist/components/custom-table/types.d.ts +0 -77
- package/dist/components/custom-table/types.js +0 -1
- package/dist/components/form/Form.d.ts +0 -21
- package/dist/components/form/Form.js +0 -18
- package/dist/components/form/components/UFAutoComplete.js +0 -41
- package/dist/components/form/components/UFCheckbox.d.ts +0 -19
- package/dist/components/form/components/UFCheckbox.js +0 -21
- package/dist/components/form/components/UFCurrency.js +0 -47
- package/dist/components/form/components/UFMultiCheckbox.js +0 -17
- package/dist/components/form/components/UFMultiSelect.js +0 -56
- package/dist/components/form/components/UFRadio.d.ts +0 -9
- package/dist/components/form/components/UFRadio.js +0 -19
- package/dist/components/form/components/UFSelect.js +0 -23
- package/dist/components/form/components/UFTextField.js +0 -37
- package/dist/components/form/components/UFUploader.js +0 -41
- package/dist/components/form/type.d.ts +0 -150
- package/dist/components/form/type.js +0 -1
- package/dist/context/FormContext.d.ts +0 -16
- package/dist/context/FormContext.js +0 -8
- package/dist/mui/Badge/MuiBadge.d.ts +0 -2
- package/dist/mui/Badge/MuiBadge.js +0 -68
- package/dist/mui/BottomNavigation/MuiBottomNavigation.d.ts +0 -2
- package/dist/mui/BottomNavigation/MuiBottomNavigation.js +0 -12
- package/dist/mui/BottomNavigation/MuiBottomNavigationAction.d.ts +0 -2
- package/dist/mui/BottomNavigation/MuiBottomNavigationAction.js +0 -35
- package/dist/mui/Button/containedButton.d.ts +0 -2
- package/dist/mui/Button/containedButton.js +0 -32
- package/dist/mui/Button/elevatedButton.d.ts +0 -2
- package/dist/mui/Button/elevatedButton.js +0 -25
- package/dist/mui/Button/outlinedButton.d.ts +0 -2
- package/dist/mui/Button/outlinedButton.js +0 -36
- package/dist/mui/Button/textButton.d.ts +0 -2
- package/dist/mui/Button/textButton.js +0 -32
- package/dist/mui/Button/utils.d.ts +0 -23
- package/dist/mui/Button/utils.js +0 -42
- package/dist/mui/ButtonGroup/ButtonGroup.d.ts +0 -2
- package/dist/mui/ButtonGroup/ButtonGroup.js +0 -47
- package/dist/mui/Container/MuiContainer.d.ts +0 -2
- package/dist/mui/Container/MuiContainer.js +0 -19
- package/dist/mui/Dialog/MuiActions.d.ts +0 -2
- package/dist/mui/Dialog/MuiActions.js +0 -8
- package/dist/mui/Dialog/MuiTitle.d.ts +0 -2
- package/dist/mui/Dialog/MuiTitle.js +0 -16
- /package/dist/components/{form → input-list}/components/UFAutoComplete.d.ts +0 -0
- /package/dist/components/{form → input-list}/components/UFDatePicker.d.ts +0 -0
- /package/dist/components/{form → input-list}/components/UFTextArea.d.ts +0 -0
- /package/dist/{assets/icons → icons}/Calendar.d.ts +0 -0
- /package/dist/{assets/icons → icons}/Calendar.js +0 -0
- /package/dist/{assets/icons → icons}/DocumentDownload.d.ts +0 -0
- /package/dist/{assets/icons → icons}/DocumentDownload.js +0 -0
- /package/dist/{assets/icons → icons}/FolderAdd.d.ts +0 -0
- /package/dist/{assets/icons → icons}/FolderAdd.js +0 -0
- /package/dist/{assets/icons → icons}/InfoCircle.d.ts +0 -0
- /package/dist/{assets/icons → icons}/InfoCircle.js +0 -0
- /package/dist/{assets/icons → icons}/Trash.d.ts +0 -0
- /package/dist/{assets/icons → icons}/Trash.js +0 -0
- /package/dist/{assets/icons → icons}/Union.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { CheckboxProps, StackProps } from '@mui/material';
|
|
3
3
|
import { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
4
|
-
import { IFormOption } from '../type';
|
|
4
|
+
import { IFormOption } from '../input-list/type';
|
|
5
5
|
export interface ICheckboxValue {
|
|
6
6
|
label: string;
|
|
7
7
|
value: string | number;
|
|
@@ -9,8 +9,10 @@ export interface ICheckboxValue {
|
|
|
9
9
|
export interface CheckboxListProps {
|
|
10
10
|
options: IFormOption[];
|
|
11
11
|
value?: ICheckboxValue[];
|
|
12
|
+
defaultValue?: ICheckboxValue[];
|
|
12
13
|
onChange: (values: ICheckboxValue[]) => void;
|
|
13
14
|
multiple?: boolean;
|
|
15
|
+
readonly?: boolean;
|
|
14
16
|
stackProps?: StackProps;
|
|
15
17
|
checkboxProps?: CheckboxProps;
|
|
16
18
|
formControlLabelProps?: Omit<FormControlLabelProps, 'label' | 'control'>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FormControlLabel, Stack, } from '@mui/material';
|
|
3
3
|
import Checkbox from '@mui/material/Checkbox';
|
|
4
|
-
const CheckboxList = ({ options = [], value = [], onChange, multiple, checkboxProps, stackProps, formControlLabelProps, }) => {
|
|
5
|
-
// console.log('values', values)
|
|
4
|
+
const CheckboxList = ({ options = [], value = [], onChange, multiple, readonly, checkboxProps, stackProps, formControlLabelProps, }) => {
|
|
6
5
|
const handleChange = (event, changedValue) => {
|
|
7
6
|
const newValues = [...value];
|
|
8
7
|
if (multiple) {
|
|
@@ -25,6 +24,8 @@ const CheckboxList = ({ options = [], value = [], onChange, multiple, checkboxPr
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
return (_jsx(Stack, { ...stackProps, children: options.map((option) => (_jsx(FormControlLabel, {
|
|
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))) }));
|
|
29
30
|
};
|
|
30
31
|
export default CheckboxList;
|
|
@@ -2,7 +2,7 @@ import { FC, ReactNode } from 'react';
|
|
|
2
2
|
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
3
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
4
|
import { TextFieldVariants } from '@mui/material';
|
|
5
|
-
import { TInputLabelMode } from '../
|
|
5
|
+
import { TInputLabelMode } from '../input-list/type';
|
|
6
6
|
export interface CustomAutocompleteProps extends Omit<AutocompleteProps<any, boolean, boolean, undefined>, 'renderInput'> {
|
|
7
7
|
label?: string | ReactNode;
|
|
8
8
|
width?: number | string;
|
|
@@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import Paper from '@mui/material/Paper';
|
|
7
7
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import
|
|
9
|
+
import CustomChip from '../custom-chip/CustomChip';
|
|
10
10
|
import { ListBox } from './components/ListBox';
|
|
11
11
|
import AutoCompleteInput from './components/AutoCompleteInput';
|
|
12
12
|
const AutoCompletePaper = styled(Paper)(({ theme }) => ({
|
|
@@ -25,7 +25,7 @@ const CustomAutoComplete = ({ label, helperText, options, multiple, disabled, va
|
|
|
25
25
|
return (_jsxs(Box, { sx: { width }, children: [_jsx(InputLabel, { sx: {
|
|
26
26
|
fontSize: 12,
|
|
27
27
|
color: disabled ? 'text.1' : 'text.primary',
|
|
28
|
-
}, children: inputLabelMode === 'static' && !hideLabel && (_jsx(Typography, { children: label })) }), _jsx(Autocomplete, { loading: loading, limitTags: 2, multiple: multiple, disabled: disabled, options: options || [], disableCloseOnSelect: multiple, disablePortal: Boolean(rest.limitTags), value: rest.value,
|
|
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
29
|
// defaultValue={rest?.defaultValue}
|
|
30
30
|
id: 'virtualize-demo', disableListWrap: true, isOptionEqualToValue: (option, value) => {
|
|
31
31
|
return option?.value === value?.value;
|
|
@@ -35,7 +35,7 @@ const CustomAutoComplete = ({ label, helperText, options, multiple, disabled, va
|
|
|
35
35
|
index: state.index,
|
|
36
36
|
multiple,
|
|
37
37
|
selected: state.selected,
|
|
38
|
-
}), ListboxProps: { onReachEnd }, ListboxComponent: ListBox, renderGroup: (params) => params, noOptionsText: _jsx(Typography, { sx: { color: 'text.primary' }, children: "\u0646\u062A\u06CC\u062C\u0647 \u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F" }), loadingText: _jsx(Typography, { sx: { color: 'text.primary' }, children: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0632\u0627\u0631\u06CC..." }), sx: {
|
|
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
39
|
padding: 0,
|
|
40
40
|
width: '100%',
|
|
41
41
|
...(disabled && { opacity: 0.7, cursor: 'not-allowed' }),
|
|
@@ -43,7 +43,21 @@ const CustomAutoComplete = ({ label, helperText, options, multiple, disabled, va
|
|
|
43
43
|
return tagValue.map((option, index) => {
|
|
44
44
|
// Ensure that the option is an object with both label and value properties
|
|
45
45
|
if (typeof option === 'object' && option.label && option.value) {
|
|
46
|
-
return (_createElement(
|
|
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
|
+
} }));
|
|
47
61
|
}
|
|
48
62
|
else {
|
|
49
63
|
return null; // Handle invalid cases gracefully
|
|
@@ -55,7 +69,7 @@ const CustomAutoComplete = ({ label, helperText, options, multiple, disabled, va
|
|
|
55
69
|
justifyContent: 'space-between',
|
|
56
70
|
}, children: multiple &&
|
|
57
71
|
selectedOptions &&
|
|
58
|
-
selectedOptions
|
|
59
|
-
showSelectedCount && (_jsxs(Typography, { sx: { mt: 1 }, children: [selectedOptions?.length, " item", selectedOptions?.length > 1 && "'s", " selected"] })) })] }));
|
|
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"] })) })] }));
|
|
60
74
|
};
|
|
61
75
|
export default CustomAutoComplete;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { AutocompleteRenderInputParams, TextFieldVariants } from '@mui/material';
|
|
3
3
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { TInputLabelMode } from '../../
|
|
4
|
+
import { TInputLabelMode } from '../../input-list/type';
|
|
5
5
|
interface Props {
|
|
6
6
|
params: AutocompleteRenderInputParams;
|
|
7
7
|
variant?: TextFieldVariants;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { InputAdornment, useTheme, } from '@mui/material';
|
|
3
|
+
import InfoCircle from '../../../icons/InfoCircle';
|
|
3
4
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
4
5
|
import TextField from '@mui/material/TextField';
|
|
5
|
-
import InfoCircle from "../../../assets/icons/InfoCircle";
|
|
6
6
|
const AutoCompleteInput = ({ params, variant, validation, placeholder, label, helperText, isLoading, inputLabelMode, textFieldProps, inputMaxHeight }) => {
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
return (_jsx(TextField, { variant: variant, placeholder: placeholder, error: validation?.isInvalid, ...(inputLabelMode === 'relative' && { label: label }), ...params, helperText: validation?.message
|
|
@@ -5,7 +5,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { VariableSizeList } from 'react-window';
|
|
7
7
|
import { ListRow } from './ListRow';
|
|
8
|
-
import debounce from "
|
|
8
|
+
import { debounce } from "lodash";
|
|
9
9
|
export const LISTBOX_PADDING = 8; // px
|
|
10
10
|
export const ListBox = React.forwardRef(function ListBox(props, ref) {
|
|
11
11
|
const { children, onReachEnd, ...other } = props;
|
|
@@ -46,7 +46,7 @@ export const ListBox = React.forwardRef(function ListBox(props, ref) {
|
|
|
46
46
|
onReachEnd();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const debouncedReachEnd = debounce(handleReachEnd,
|
|
49
|
+
const debouncedReachEnd = debounce(handleReachEnd, 10);
|
|
50
50
|
const handleScroll = ({ scrollDirection, scrollOffset, scrollUpdateWasRequested, }) => {
|
|
51
51
|
if (!scrollUpdateWasRequested &&
|
|
52
52
|
scrollDirection === 'forward' &&
|
|
@@ -58,5 +58,5 @@ export const ListBox = React.forwardRef(function ListBox(props, ref) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
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: () => itemSize, overscanCount: 5, itemCount: itemCount, style: { direction: 'inherit' }, onScroll: handleScroll, children: ListRow }) }) }));
|
|
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
62
|
});
|
|
@@ -13,7 +13,7 @@ export function ListRow(props) {
|
|
|
13
13
|
const { props: optionProps, option, multiple, selected } = dataSet || {};
|
|
14
14
|
return (_createElement("li", { ...optionProps, key: option.value, style: inlineStyle },
|
|
15
15
|
multiple && _jsx(Checkbox, { checked: selected, sx: { opacity: 'inherit' } }),
|
|
16
|
-
_jsx(Typography, { children: option?.label }))
|
|
16
|
+
_jsx(Typography, { variant: 'caption3', children: option?.label }))
|
|
17
17
|
// <Typography key={key} component="li" {...optionProps} noWrap style={inlineStyle}>
|
|
18
18
|
// {option?.label}
|
|
19
19
|
// </Typography>
|
|
@@ -0,0 +1,28 @@
|
|
|
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;
|
|
@@ -0,0 +1,92 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AutocompleteRenderInputParams, TextFieldVariants } from '@mui/material';
|
|
3
|
+
import { TextFieldProps } from '@mui/material';
|
|
4
|
+
import { TInputLabelMode } from '../../input-list/type';
|
|
5
|
+
interface IRenderInputProps extends Omit<TextFieldProps, 'label'> {
|
|
6
|
+
params: AutocompleteRenderInputParams;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
loading: boolean | undefined;
|
|
9
|
+
inputMaxHeight?: string | number;
|
|
10
|
+
variant?: TextFieldVariants;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
validation?: {
|
|
13
|
+
isInvalid: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
inputLabelMode?: TInputLabelMode;
|
|
17
|
+
helperText?: string;
|
|
18
|
+
textFieldProps?: TextFieldProps;
|
|
19
|
+
handleSearch?: (e: any) => void;
|
|
20
|
+
handleChange?: (e: string) => void;
|
|
21
|
+
}
|
|
22
|
+
declare const RenderInput: FC<IRenderInputProps>;
|
|
23
|
+
export default RenderInput;
|
|
@@ -0,0 +1,51 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ChipProps } from "@mui/material";
|
|
3
|
+
import { TypographyProps } from "@mui/material/Typography";
|
|
4
|
+
export interface ICustomChipProps {
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
endIcon?: ReactNode;
|
|
7
|
+
startIcon?: ReactNode;
|
|
8
|
+
labelProps?: TypographyProps;
|
|
9
|
+
chipProps?: ChipProps;
|
|
10
|
+
}
|
|
11
|
+
declare const CustomChip: FC<ICustomChipProps>;
|
|
12
|
+
export default CustomChip;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Chip from "@mui/material/Chip";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import Typography from "@mui/material/Typography";
|
|
5
|
+
const CustomChip = ({ label, endIcon, startIcon, labelProps, chipProps }) => {
|
|
6
|
+
const isLarge = chipProps?.size === 'large';
|
|
7
|
+
const { sx, ...props } = chipProps || {};
|
|
8
|
+
return (_jsx(Chip, { sx: { ...(chipProps?.rounded && { borderRadius: '9999px' }), ...sx }, color: props.color, label: _jsxs(Box, { display: "flex", gap: 2, alignItems: 'center', children: [_jsx(Box, { display: 'flex', id: "custom-chip__start-icon", children: startIcon }), _jsx(Typography, { id: "custom-chip__label", lineHeight: props.size === 'small' ? '24px' : 'normal', variant: isLarge ? 'caption2.medium' : 'caption3', color: "#ffffff", ...labelProps, children: label }), _jsx(Box, { display: 'flex', id: "custom-chip__start-icon", children: endIcon })] }), ...props }));
|
|
9
|
+
};
|
|
10
|
+
export default CustomChip;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { TextFieldVariants } from
|
|
3
|
-
import { BaseTextFieldProps } from
|
|
4
|
-
import { TInputLabelMode } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TextFieldVariants } from '@mui/material';
|
|
3
|
+
import { BaseTextFieldProps } from '@mui/material/TextField/TextField';
|
|
4
|
+
import { TInputLabelMode } from '../input-list/type';
|
|
5
5
|
interface Props extends BaseTextFieldProps {
|
|
6
6
|
openCalendar: any;
|
|
7
7
|
value?: any;
|