mui-design-system 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/components/custom-auto-complete/CustomAutoComplete.d.ts +1 -1
  2. package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +1 -1
  3. package/dist/components/custom-date-picker/CustomComponent.d.ts +1 -1
  4. package/dist/components/custom-date-picker/CustomDatePicker.d.ts +1 -1
  5. package/dist/components/custom-date-picker/CustomDatePicker.js +16 -11
  6. package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +1 -1
  7. package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +1 -1
  8. package/dist/components/custom-table/CustomTable.d.ts +2 -53
  9. package/dist/components/custom-table/CustomTable.js +7 -13
  10. package/dist/components/custom-table/components/CustomTableBody.d.ts +5 -4
  11. package/dist/components/custom-table/components/CustomTableBody.js +22 -4
  12. package/dist/components/custom-table/components/CustomTableCell.d.ts +2 -2
  13. package/dist/components/custom-table/components/CustomTableCell.js +16 -14
  14. package/dist/components/custom-table/components/CustomTableHead.d.ts +5 -3
  15. package/dist/components/custom-table/components/CustomTableHead.js +14 -13
  16. package/dist/components/custom-table/components/CustomTableRow.d.ts +5 -9
  17. package/dist/components/custom-table/components/CustomTableRow.js +17 -14
  18. package/dist/components/custom-table/components/useTable.d.ts +4 -16
  19. package/dist/components/custom-table/components/useTable.js +5 -5
  20. package/dist/components/custom-table/types.d.ts +77 -0
  21. package/dist/components/{input-list → form}/UseFormInput.js +1 -4
  22. package/dist/components/{input-list → form}/type.d.ts +1 -5
  23. package/dist/components/form/type.js +1 -0
  24. package/dist/components/index.d.ts +42 -98
  25. package/dist/components/index.js +55 -69
  26. package/dist/context/FormContext.d.ts +1 -1
  27. package/dist/mui/Button/MuiButton.js +13 -12
  28. package/dist/mui/Typography/index.js +13 -13
  29. package/dist/mui/palette/dark/darkPalette.js +47 -86
  30. package/dist/mui/palette/light/lightPalette.js +48 -87
  31. package/package.json +1 -1
  32. package/dist/components/checkbox-list/CheckboxList.d.ts +0 -21
  33. package/dist/components/checkbox-list/CheckboxList.js +0 -31
  34. package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.d.ts +0 -28
  35. package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.js +0 -92
  36. package/dist/components/custom-auto-complete-advanced/components/ListBox.d.ts +0 -6
  37. package/dist/components/custom-auto-complete-advanced/components/ListBox.js +0 -76
  38. package/dist/components/custom-auto-complete-advanced/components/ListRow.d.ts +0 -2
  39. package/dist/components/custom-auto-complete-advanced/components/ListRow.js +0 -17
  40. package/dist/components/custom-auto-complete-advanced/components/RenderInput.d.ts +0 -23
  41. package/dist/components/custom-auto-complete-advanced/components/RenderInput.js +0 -51
  42. package/dist/components/custom-auto-complete-advanced/components/RenderTags.d.ts +0 -9
  43. package/dist/components/custom-auto-complete-advanced/components/RenderTags.js +0 -22
  44. package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.d.ts +0 -17
  45. package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.js +0 -11
  46. package/dist/components/custom-card/CustomHorizontalCard.d.ts +0 -3
  47. package/dist/components/custom-card/CustomHorizontalCard.js +0 -9
  48. package/dist/components/custom-card/CustomVerticalCard.d.ts +0 -3
  49. package/dist/components/custom-card/CustomVerticalCard.js +0 -9
  50. package/dist/components/custom-dialog/CustomDialog.d.ts +0 -41
  51. package/dist/components/custom-dialog/CustomDialog.js +0 -38
  52. package/dist/components/custom-mobile-date-picker/CustomBottomSheet.d.ts +0 -9
  53. package/dist/components/custom-mobile-date-picker/CustomBottomSheet.js +0 -29
  54. package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.d.ts +0 -19
  55. package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.js +0 -98
  56. package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.d.ts +0 -19
  57. package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.js +0 -40
  58. package/dist/components/custom-mobile-date-picker/ItemPicker.d.ts +0 -10
  59. package/dist/components/custom-mobile-date-picker/ItemPicker.js +0 -72
  60. package/dist/components/custom-modal/CustomModal.d.ts +0 -21
  61. package/dist/components/custom-modal/CustomModal.js +0 -38
  62. package/dist/components/custom-stepper/CustomStepper.d.ts +0 -31
  63. package/dist/components/custom-stepper/CustomStepper.js +0 -170
  64. package/dist/components/custom-tabs/CustomTabs.d.ts +0 -22
  65. package/dist/components/custom-tabs/CustomTabs.js +0 -70
  66. package/dist/components/input-list/InputListWithUseForm.d.ts +0 -22
  67. package/dist/components/input-list/InputListWithUseForm.js +0 -22
  68. package/dist/components/input-list/components/UFDatePickerMobile.d.ts +0 -9
  69. package/dist/components/input-list/components/UFDatePickerMobile.js +0 -6
  70. package/dist/components/otp-input/OTPInput.d.ts +0 -19
  71. package/dist/components/otp-input/OTPInput.js +0 -161
  72. package/dist/components/rich-tooltip/RichTooltip.d.ts +0 -18
  73. package/dist/components/rich-tooltip/RichTooltip.js +0 -32
  74. package/dist/icons/Add.d.ts +0 -7
  75. package/dist/icons/Add.js +0 -3
  76. package/dist/icons/EyeSlash.d.ts +0 -7
  77. package/dist/icons/EyeSlash.js +0 -3
  78. package/dist/icons/Tick.d.ts +0 -7
  79. package/dist/icons/Tick.js +0 -3
  80. package/dist/icons/Warning2.d.ts +0 -7
  81. package/dist/icons/Warning2.js +0 -3
  82. /package/dist/components/{input-list/type.js → custom-table/types.js} +0 -0
  83. /package/dist/components/{input-list → form}/Form.d.ts +0 -0
  84. /package/dist/components/{input-list → form}/Form.js +0 -0
  85. /package/dist/components/{input-list → form}/UseFormInput.d.ts +0 -0
  86. /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.d.ts +0 -0
  87. /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.js +0 -0
  88. /package/dist/components/{input-list → form}/components/UFAutoComplete.d.ts +0 -0
  89. /package/dist/components/{input-list → form}/components/UFAutoComplete.js +0 -0
  90. /package/dist/components/{input-list → form}/components/UFCheckbox.d.ts +0 -0
  91. /package/dist/components/{input-list → form}/components/UFCheckbox.js +0 -0
  92. /package/dist/components/{input-list → form}/components/UFCurrency.d.ts +0 -0
  93. /package/dist/components/{input-list → form}/components/UFCurrency.js +0 -0
  94. /package/dist/components/{input-list → form}/components/UFDatePicker.d.ts +0 -0
  95. /package/dist/components/{input-list → form}/components/UFDatePicker.js +0 -0
  96. /package/dist/components/{input-list → form}/components/UFMultiCheckbox.d.ts +0 -0
  97. /package/dist/components/{input-list → form}/components/UFMultiCheckbox.js +0 -0
  98. /package/dist/components/{input-list → form}/components/UFMultiSelect.d.ts +0 -0
  99. /package/dist/components/{input-list → form}/components/UFMultiSelect.js +0 -0
  100. /package/dist/components/{input-list → form}/components/UFRadio.d.ts +0 -0
  101. /package/dist/components/{input-list → form}/components/UFRadio.js +0 -0
  102. /package/dist/components/{input-list → form}/components/UFSelect.d.ts +0 -0
  103. /package/dist/components/{input-list → form}/components/UFSelect.js +0 -0
  104. /package/dist/components/{input-list → form}/components/UFSwitch.d.ts +0 -0
  105. /package/dist/components/{input-list → form}/components/UFSwitch.js +0 -0
  106. /package/dist/components/{input-list → form}/components/UFTextArea.d.ts +0 -0
  107. /package/dist/components/{input-list → form}/components/UFTextArea.js +0 -0
  108. /package/dist/components/{input-list → form}/components/UFTextField.d.ts +0 -0
  109. /package/dist/components/{input-list → form}/components/UFTextField.js +0 -0
  110. /package/dist/components/{input-list → form}/components/UFTime.d.ts +0 -0
  111. /package/dist/components/{input-list → form}/components/UFTime.js +0 -0
  112. /package/dist/components/{input-list → form}/components/UFUploader.d.ts +0 -0
  113. /package/dist/components/{input-list → form}/components/UFUploader.js +0 -0
@@ -1,29 +1,11 @@
1
1
  export const darkPalette = {
2
2
  primary: {
3
- main: '#23AD80',
4
- 10: '#03110C',
5
- 9: '#0A3325',
6
- 8: '#11553E',
7
- 7: '#15664B',
8
- 6: '#1C8A66',
9
- 5: '#23AD80',
10
- 4: '#2ACB95',
11
- 3: '#56DCAF',
12
- 2: '#88E7C7',
13
- 1: '#BBF1DF',
3
+ main: '#6950f3',
4
+ contrastText: "#fff"
14
5
  },
15
6
  secondary: {
16
- main: '#FFB833',
17
- 10: '#291B00',
18
- 9: '#664400',
19
- 8: '#A36D00',
20
- 7: '#CC8800',
21
- 6: '#F8A300',
22
- 5: '#FFB833',
23
- 4: '#FFC65C',
24
- 3: '#FFD485',
25
- 2: '#FFE2AD',
26
- 1: '#FFF1D6',
7
+ main: '#0d1619',
8
+ contrastText: "#fff"
27
9
  },
28
10
  divider: '#D4D4D4',
29
11
  background: {
@@ -36,38 +18,18 @@ export const darkPalette = {
36
18
  },
37
19
  success: {
38
20
  main: '#77FE7A',
39
- 5: '#118715',
40
- 4: '#20CF27',
41
- 3: '#77FE7A',
42
- 2: '#BBFEBE',
43
- 1: '#E4FFE5',
44
21
  },
45
22
  warning: {
46
23
  main: '#F7DF00',
47
- 5: '#998A00',
48
- 4: '#E1CB00',
49
- 3: '#F7DF00',
50
- 2: '#FFEF9D',
51
- 1: '#FFF8DB',
52
24
  },
53
25
  error: {
54
26
  main: '#EF4D2F',
55
- 5: '#5F1507',
56
- 4: '#B5260B',
57
- 3: '#EF4D2F',
58
- 2: '#FEE2E1',
59
- 1: '#FFF6F6',
60
27
  },
61
28
  info: {
62
29
  main: '#51C0FF',
63
- 5: '#00527C',
64
- 4: '#007CB4',
65
- 3: '#51C0FF',
66
- 2: '#D5EBFF',
67
- 1: '#F2F9FF',
68
30
  },
69
31
  text: {
70
- primary: '#F3F3F3',
32
+ primary: '#e83535',
71
33
  secondary: '#4A4A4A',
72
34
  disabled: '#8A8A8A',
73
35
  16: '#FFFFFF',
@@ -87,49 +49,48 @@ export const darkPalette = {
87
49
  2: '#414141',
88
50
  1: '#383838',
89
51
  },
90
- grey: {
91
- main: '#d4d4d4',
92
- 1: '#ffffff',
93
- 2: '#c8c8c8',
94
- 3: '#afafaf',
95
- 4: '#969696',
96
- 5: '#7d7d7d',
97
- 6: '#646464',
98
- 7: '#4b4b4b',
99
- 8: '#323232',
100
- 9: '#191919',
101
- 10: '#000000',
102
- },
103
- default: {
104
- light: "#212EBB",
105
- dark: "#7B9EFE",
106
- contrastText: "#FAFAFA",
107
- main: "#3440C1",
108
- 10: "#212EBB",
109
- 9: "#3440C1",
110
- 8: "#4D59D7",
111
- 7: "#646FED",
112
- 6: "#727CF4",
113
- 5: "#7984FF",
114
- 4: "#6B91FB",
115
- 3: "#7B9EFE",
116
- 2: "#98B3FE",
117
- 1: "#cddbff",
118
- },
119
52
  inherit: {
120
- light: "#212EBB",
121
- dark: "#7B9EFE",
122
- contrastText: "#FAFAFA",
123
- main: "#3440C1",
124
- 10: "#212EBB",
125
- 9: "#3440C1",
126
- 8: "#4D59D7",
127
- 7: "#646FED",
128
- 6: "#727CF4",
129
- 5: "#7984FF",
130
- 4: "#6B91FB",
131
- 3: "#7B9EFE",
132
- 2: "#98B3FE",
133
- 1: "#cddbff",
53
+ light: "inherit",
54
+ dark: "inherit",
55
+ contrastText: "inherit",
56
+ main: "#1A1A1A",
57
+ 16: 'inherit',
58
+ 15: 'inherit',
59
+ 14: 'inherit',
60
+ 13: 'inherit',
61
+ 12: 'inherit',
62
+ 11: 'inherit',
63
+ 10: 'inherit',
64
+ 9: 'inherit',
65
+ 8: 'inherit',
66
+ 7: 'inherit',
67
+ 6: 'inherit',
68
+ 5: 'inherit',
69
+ 4: 'inherit',
70
+ 3: 'inherit',
71
+ 2: 'inherit',
72
+ 1: 'inherit',
134
73
  },
74
+ default: {
75
+ light: "#616161",
76
+ dark: "#616161",
77
+ contrastText: "#616161",
78
+ main: "#1A1A1A",
79
+ 16: '#1A1A1A',
80
+ 15: '#303030',
81
+ 14: '#4A4A4A',
82
+ 13: '#616161',
83
+ 12: '#8A8A8A',
84
+ 11: '#B5B5B5',
85
+ 10: '#CCCCCC',
86
+ 9: '#D4D4D4',
87
+ 8: '#E3E3E3',
88
+ 7: '#EBEBEB',
89
+ 6: '#F1F1F1',
90
+ 5: '#F3F3F3',
91
+ 4: '#F7F7F7',
92
+ 3: '#FAFAFA',
93
+ 2: '#FDFDFD',
94
+ 1: '#FFFFFF',
95
+ }
135
96
  };
@@ -1,70 +1,32 @@
1
1
  export const lightPalette = {
2
2
  primary: {
3
- main: '#1C8A66',
4
- 10: '#03110C',
5
- 9: '#0A3325',
6
- 8: '#11553E',
7
- 7: '#15664B',
8
- 6: '#1C8A66',
9
- 5: '#23AD80',
10
- 4: '#2ACB95',
11
- 3: '#56DCAF',
12
- 2: '#88E7C7',
13
- 1: '#BBF1DF',
3
+ main: '#6950f3',
4
+ contrastText: "#fff"
14
5
  },
15
6
  secondary: {
16
- main: '#F8A300',
17
- 10: '#291B00',
18
- 9: '#664400',
19
- 8: '#A36D00',
20
- 7: '#CC8800',
21
- 6: '#F8A300',
22
- 5: '#FFB833',
23
- 4: '#FFC65C',
24
- 3: '#FFD485',
25
- 2: '#FFE2AD',
26
- 1: '#FFF1D6',
7
+ main: '#0d1619',
8
+ contrastText: "#fff"
27
9
  },
28
10
  divider: '#D4D4D4',
29
11
  background: {
30
- main: '#FDFDFD',
12
+ main: '#f9f9f9',
31
13
  default: '#fff',
32
14
  paper: '#fff',
33
15
  1: '#FAFAFA',
34
- 2: '#F7F7F7',
16
+ 2: '#f9f9f9',
35
17
  3: '#F3F3F3',
36
18
  },
37
19
  success: {
38
20
  main: '#20CF27',
39
- 5: '#118715',
40
- 4: '#20CF27',
41
- 3: '#77FE7A',
42
- 2: '#BBFEBE',
43
- 1: '#E4FFE5',
44
21
  },
45
22
  warning: {
46
23
  main: '#E1CB00',
47
- 5: '#998A00',
48
- 4: '#E1CB00',
49
- 3: '#F7DF00',
50
- 2: '#FFEF9D',
51
- 1: '#FFF8DB',
52
24
  },
53
25
  error: {
54
26
  main: '#B5260B',
55
- 5: '#5F1507',
56
- 4: '#B5260B',
57
- 3: '#EF4D2F',
58
- 2: '#FEE2E1',
59
- 1: '#FFF6F6',
60
27
  },
61
28
  info: {
62
29
  main: '#007CB4',
63
- 5: '#00527C',
64
- 4: '#007CB4',
65
- 3: '#51C0FF',
66
- 2: '#D5EBFF',
67
- 1: '#F2F9FF',
68
30
  },
69
31
  text: {
70
32
  primary: '#4A4A4A',
@@ -87,49 +49,48 @@ export const lightPalette = {
87
49
  2: '#FDFDFD',
88
50
  1: '#FFFFFF',
89
51
  },
90
- grey: {
91
- main: '#d4d4d4',
92
- 1: '#ffffff',
93
- 2: '#c8c8c8',
94
- 3: '#afafaf',
95
- 4: '#969696',
96
- 5: '#7d7d7d',
97
- 6: '#646464',
98
- 7: '#4b4b4b',
99
- 8: '#323232',
100
- 9: '#191919',
101
- 10: '#000000',
102
- },
103
- default: {
104
- light: "#212EBB",
105
- dark: "#7B9EFE",
106
- contrastText: "#FAFAFA",
107
- main: "#3440C1",
108
- 10: "#212EBB",
109
- 9: "#3440C1",
110
- 8: "#4D59D7",
111
- 7: "#646FED",
112
- 6: "#727CF4",
113
- 5: "#7984FF",
114
- 4: "#6B91FB",
115
- 3: "#7B9EFE",
116
- 2: "#98B3FE",
117
- 1: "#cddbff",
118
- },
119
52
  inherit: {
120
- light: "#212EBB",
121
- dark: "#7B9EFE",
122
- contrastText: "#FAFAFA",
123
- main: "#3440C1",
124
- 10: "#212EBB",
125
- 9: "#3440C1",
126
- 8: "#4D59D7",
127
- 7: "#646FED",
128
- 6: "#727CF4",
129
- 5: "#7984FF",
130
- 4: "#6B91FB",
131
- 3: "#7B9EFE",
132
- 2: "#98B3FE",
133
- 1: "#cddbff",
53
+ light: "inherit",
54
+ dark: "inherit",
55
+ contrastText: "inherit",
56
+ main: "#1A1A1A",
57
+ 16: 'inherit',
58
+ 15: 'inherit',
59
+ 14: 'inherit',
60
+ 13: 'inherit',
61
+ 12: 'inherit',
62
+ 11: 'inherit',
63
+ 10: 'inherit',
64
+ 9: 'inherit',
65
+ 8: 'inherit',
66
+ 7: 'inherit',
67
+ 6: 'inherit',
68
+ 5: 'inherit',
69
+ 4: 'inherit',
70
+ 3: 'inherit',
71
+ 2: 'inherit',
72
+ 1: 'inherit',
134
73
  },
74
+ default: {
75
+ light: "#616161",
76
+ dark: "#616161",
77
+ contrastText: "#616161",
78
+ main: "#1A1A1A",
79
+ 16: '#1A1A1A',
80
+ 15: '#303030',
81
+ 14: '#4A4A4A',
82
+ 13: '#616161',
83
+ 12: '#8A8A8A',
84
+ 11: '#B5B5B5',
85
+ 10: '#CCCCCC',
86
+ 9: '#D4D4D4',
87
+ 8: '#E3E3E3',
88
+ 7: '#EBEBEB',
89
+ 6: '#F1F1F1',
90
+ 5: '#F3F3F3',
91
+ 4: '#F7F7F7',
92
+ 3: '#FAFAFA',
93
+ 2: '#FDFDFD',
94
+ 1: '#FFFFFF',
95
+ }
135
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mui-design-system",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -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,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,2 +0,0 @@
1
- import { ListChildComponentProps } from 'react-window';
2
- export declare function ListRow(props: ListChildComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -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
- }
@@ -1,23 +0,0 @@
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;