tp-react-elements 1.1.8 → 1.1.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/_virtual/index.esm12.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm14.js +2 -2
- package/dist/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/_virtual/index.esm6.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/components/FormComponents/Select/MultiSelectv1.esm.js +17 -11
- package/dist/components/SelectField/MultiSelectFieldComponent.esm.js +53 -40
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRangePicker/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/Month/index.esm.js +1 -1
- package/package.json +4 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateInput = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateInput as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Month = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Month as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var InputRangeField = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { InputRangeField as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRangePicker = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRangePicker as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DefinedRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DefinedRange as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Calendar = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Calendar as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRange as __exports };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, TextField, Tooltip } from '@mui/material';
|
|
3
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
2
|
+
import { Box, TextField, FormControlLabel, Checkbox, Tooltip } from '@mui/material';
|
|
4
3
|
import FormControl from '@mui/material/FormControl';
|
|
5
4
|
import InputLabel from '@mui/material/InputLabel';
|
|
6
5
|
import ListItemText from '@mui/material/ListItemText';
|
|
@@ -13,8 +12,8 @@ import FormBottomField from '../FormBottomField/FormBottomField.esm.js';
|
|
|
13
12
|
import 'dayjs';
|
|
14
13
|
import { renderLabel } from '../../../utils/Constants/FormConstants.esm.js';
|
|
15
14
|
|
|
16
|
-
const ITEM_HEIGHT =
|
|
17
|
-
const ITEM_PADDING_TOP =
|
|
15
|
+
const ITEM_HEIGHT = 36;
|
|
16
|
+
const ITEM_PADDING_TOP = 2;
|
|
18
17
|
const extractValuesToArray = (inputString) => {
|
|
19
18
|
if (!inputString)
|
|
20
19
|
return [];
|
|
@@ -76,7 +75,7 @@ function MultiSelectV1({ props, variant, }) {
|
|
|
76
75
|
disableAutoFocusItem: true,
|
|
77
76
|
}, children: [jsx(Box, { sx: { width: '100%', position: 'sticky', top: 0, padding: '7px', zIndex: 2, background: '#fff' }, children: jsx(TextField, { inputRef: textfieldRef, fullWidth: true, size: "small", placeholder: "Search...", value: searchText, onChange: (e) => setSearchText(e.target.value),
|
|
78
77
|
// Prevent space key from closing the select while typing in search
|
|
79
|
-
onKeyDown: (e) => e.key !== 'Escape' && e.stopPropagation() }) }),
|
|
78
|
+
onKeyDown: (e) => e.key !== 'Escape' && e.stopPropagation() }) }), jsx(MenuItem, { disabled: filterOptions.length === 0, sx: { py: 0, px: 2 }, children: jsx(FormControlLabel, { control: jsx(Checkbox, { id: `${props.item.name}-select-all`, size: "small", checked: selectAll, sx: { p: 1 }, onMouseDown: (e) => e.stopPropagation(), onChange: (e) => {
|
|
80
79
|
const currentValues = fieldValue?.split(',').filter(Boolean) || [];
|
|
81
80
|
const filteredIds = filterOptions.map((opt) => String(opt.value));
|
|
82
81
|
if (selectAll) {
|
|
@@ -85,20 +84,27 @@ function MultiSelectV1({ props, variant, }) {
|
|
|
85
84
|
else {
|
|
86
85
|
props.setValue(props.item.name, [...new Set([...currentValues, ...filteredIds])].join(','));
|
|
87
86
|
}
|
|
88
|
-
} }),
|
|
87
|
+
} }), label: "Select All", sx: {
|
|
88
|
+
width: '100%',
|
|
89
|
+
margin: 0,
|
|
90
|
+
// Remove pointerEvents: 'none' to allow label to trigger checkbox
|
|
91
|
+
'& .MuiFormControlLabel-label': { fontSize: '13px' }
|
|
92
|
+
} }) }), filterOptions.length !== 0 ? (filterOptions.map((option) => {
|
|
89
93
|
const selectedArray = fieldValue ? extractValuesToArray(fieldValue) : [];
|
|
90
94
|
const isChecked = selectedArray.includes(String(option.value));
|
|
91
95
|
return (jsxs(MenuItem, { value: `${option.value}`, sx: {
|
|
92
96
|
whiteSpace: 'normal',
|
|
93
97
|
wordBreak: 'break-all',
|
|
94
|
-
alignItems: '
|
|
95
|
-
py:
|
|
96
|
-
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
py: 0.5,
|
|
100
|
+
px: 2,
|
|
101
|
+
minHeight: ITEM_HEIGHT,
|
|
102
|
+
}, children: [jsx(Checkbox, { checked: isChecked, size: "small", sx: { p: 1, mr: 1, pointerEvents: 'none' } }), jsx(ListItemText, { primary: option.label, primaryTypographyProps: {
|
|
97
103
|
fontSize: '13px',
|
|
98
|
-
|
|
104
|
+
sx: {
|
|
99
105
|
whiteSpace: 'normal',
|
|
100
106
|
wordBreak: 'break-all',
|
|
101
|
-
lineHeight: '1.
|
|
107
|
+
lineHeight: '1.2'
|
|
102
108
|
}
|
|
103
109
|
} })] }, option.value));
|
|
104
110
|
})) : (jsx(MenuItem, { disabled: true, children: "No data Found" }))] }), jsx(FormBottomField, { ...props })] }) }, props.item.name));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, TextField, Tooltip } from '@mui/material';
|
|
2
|
+
import { Box, TextField, FormControlLabel, Tooltip } from '@mui/material';
|
|
3
3
|
import Checkbox from '@mui/material/Checkbox';
|
|
4
4
|
import FormControl from '@mui/material/FormControl';
|
|
5
5
|
import ListItemText from '@mui/material/ListItemText';
|
|
@@ -8,17 +8,8 @@ import Select from '@mui/material/Select';
|
|
|
8
8
|
import * as require$$0 from 'react';
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
|
|
11
|
-
const ITEM_HEIGHT =
|
|
12
|
-
const ITEM_PADDING_TOP =
|
|
13
|
-
const MenuProps = {
|
|
14
|
-
PaperProps: {
|
|
15
|
-
style: {
|
|
16
|
-
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
autoFocus: false,
|
|
20
|
-
disableAutoFocusItem: true,
|
|
21
|
-
};
|
|
11
|
+
const ITEM_HEIGHT = 36;
|
|
12
|
+
const ITEM_PADDING_TOP = 2;
|
|
22
13
|
const extractValuesToArray = (inputString) => {
|
|
23
14
|
const valuesArray = inputString?.split(',');
|
|
24
15
|
const trimmedArray = valuesArray?.map((value) => value.trim());
|
|
@@ -30,9 +21,8 @@ function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false
|
|
|
30
21
|
const [filterOptions, setFilterOptions] = useState(options);
|
|
31
22
|
const [selectAll, setSelectAll] = useState(false);
|
|
32
23
|
const textfieldRef = require$$0.useRef(null);
|
|
24
|
+
const containerRef = require$$0.useRef(null);
|
|
33
25
|
const fieldValue = value;
|
|
34
|
-
const mappedIds = filterOptions.map((item) => item.value);
|
|
35
|
-
const filterIds = filterOptions.map((item) => item.value);
|
|
36
26
|
require$$0.useEffect(() => {
|
|
37
27
|
if (searchText !== '') {
|
|
38
28
|
setFilterOptions(options.filter((item) => item.label.toLowerCase().includes(searchText.toLowerCase())));
|
|
@@ -41,17 +31,18 @@ function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false
|
|
|
41
31
|
setFilterOptions(options);
|
|
42
32
|
}
|
|
43
33
|
}, [options, searchText]);
|
|
44
|
-
function hasExactMatch(array, value) {
|
|
45
|
-
return array.some((item) => item === value);
|
|
46
|
-
}
|
|
47
34
|
require$$0.useEffect(() => {
|
|
48
|
-
|
|
35
|
+
const values = fieldValue ? fieldValue.split(',').filter(Boolean) : [];
|
|
36
|
+
const filterIdStrings = filterOptions.map((item) => String(item.value));
|
|
37
|
+
if (values.length === 0 || filterOptions.length === 0) {
|
|
49
38
|
setSelectAll(false);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (values.every((val) => filterIdStrings.includes(String(val)))) {
|
|
42
|
+
setSelectAll(true);
|
|
50
43
|
}
|
|
51
44
|
else {
|
|
52
|
-
|
|
53
|
-
setSelectAll(true);
|
|
54
|
-
}
|
|
45
|
+
setSelectAll(false);
|
|
55
46
|
}
|
|
56
47
|
}, [filterOptions, fieldValue]);
|
|
57
48
|
const handleChange = (event) => {
|
|
@@ -61,7 +52,7 @@ function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false
|
|
|
61
52
|
};
|
|
62
53
|
const selectedOptions = options.filter((item) => fieldValue?.split(',').some((value) => value === item.value));
|
|
63
54
|
const selectedValues = selectedOptions.map((item) => item.label).join(' , ');
|
|
64
|
-
return (jsx(Box, { children: jsx(FormControl, { fullWidth: true, sx: {
|
|
55
|
+
return (jsx(Box, { children: jsx(FormControl, { fullWidth: true, ref: containerRef, sx: {
|
|
65
56
|
'& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy': {
|
|
66
57
|
top: '-10px',
|
|
67
58
|
},
|
|
@@ -77,7 +68,24 @@ function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false
|
|
|
77
68
|
}, 0);
|
|
78
69
|
}, onClose: () => {
|
|
79
70
|
setSearchText('');
|
|
80
|
-
}, renderValue: () => (jsx(Tooltip, { title: selectedValues, children: jsx("span", { children: selectedOptions.length > 3 ? `${selectedOptions.length} Selected` : selectedValues }) })), MenuProps:
|
|
71
|
+
}, renderValue: () => (jsx(Tooltip, { title: selectedValues, children: jsx("span", { children: selectedOptions.length > 3 ? `${selectedOptions.length} Selected` : selectedValues }) })), MenuProps: {
|
|
72
|
+
PaperProps: {
|
|
73
|
+
style: {
|
|
74
|
+
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
75
|
+
width: containerRef.current ? containerRef.current.clientWidth : 250,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
autoFocus: false,
|
|
79
|
+
disableAutoFocusItem: true,
|
|
80
|
+
anchorOrigin: {
|
|
81
|
+
vertical: 'bottom',
|
|
82
|
+
horizontal: 'left',
|
|
83
|
+
},
|
|
84
|
+
transformOrigin: {
|
|
85
|
+
vertical: 'top',
|
|
86
|
+
horizontal: 'left',
|
|
87
|
+
},
|
|
88
|
+
}, autoFocus: false, children: [jsx(Box, { sx: {
|
|
81
89
|
width: '100%',
|
|
82
90
|
position: 'sticky',
|
|
83
91
|
top: '0px',
|
|
@@ -94,26 +102,31 @@ function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false
|
|
|
94
102
|
if (e.key !== 'Escape') {
|
|
95
103
|
e.stopPropagation();
|
|
96
104
|
}
|
|
97
|
-
} }) }),
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
onChangeFn('');
|
|
105
|
+
} }) }), jsx(MenuItem, { disabled: filterOptions.length === 0, sx: { py: 0.5, px: 2 }, onMouseDown: (e) => e.stopPropagation(), children: jsx(FormControlLabel, { control: jsx(Checkbox, { id: `${value}-select-all`, size: "small", checked: selectAll, onChange: () => {
|
|
106
|
+
const currentValues = fieldValue?.split(',').filter(Boolean) || [];
|
|
107
|
+
const filteredIds = filterOptions.map((opt) => String(opt.value));
|
|
108
|
+
if (selectAll) {
|
|
109
|
+
onChangeFn(currentValues.filter((v) => !filteredIds.includes(v)).join(','));
|
|
102
110
|
}
|
|
103
111
|
else {
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
onChangeFn([...new Set([...currentValues, ...filteredIds])].join(','));
|
|
113
|
+
}
|
|
114
|
+
} }), label: "Select All", sx: {
|
|
115
|
+
margin: 0,
|
|
116
|
+
width: '100%',
|
|
117
|
+
'& .MuiFormControlLabel-label': { fontSize: '13px' }
|
|
118
|
+
} }) }), filterOptions.length !== 0 ? (filterOptions.map((option) => (jsxs(MenuItem, { value: `${option.value}`, sx: {
|
|
119
|
+
zIndex: 0,
|
|
120
|
+
py: 0,
|
|
121
|
+
px: 2,
|
|
122
|
+
minHeight: ITEM_HEIGHT
|
|
123
|
+
}, children: [jsx(Checkbox, { checked: fieldValue?.split(',').some((val) => String(val) === String(option.value)), size: "small", sx: { p: 1, mr: 1, pointerEvents: 'none' } }), jsx(ListItemText, { primary: option.label, primaryTypographyProps: {
|
|
124
|
+
fontSize: '13px',
|
|
125
|
+
sx: {
|
|
126
|
+
whiteSpace: 'normal',
|
|
127
|
+
wordBreak: 'break-all',
|
|
128
|
+
lineHeight: '1.2'
|
|
106
129
|
}
|
|
107
|
-
} }), jsx(ListItemText, { primary: 'Select All', sx: {
|
|
108
|
-
fontSize: '5px !important',
|
|
109
|
-
'& span': {
|
|
110
|
-
fontSize: '12px !important',
|
|
111
|
-
},
|
|
112
|
-
} })] }), filterOptions.length !== 0 ? (filterOptions.map((option) => (jsxs(MenuItem, { value: `${option.value}`, sx: { zIndex: 0, fontSize: '11px !important' }, children: [jsx(Checkbox, { checked: fieldValue?.split(',').some((value) => value === option.value), size: "small" }), jsx(ListItemText, { primary: option.label, sx: {
|
|
113
|
-
fontSize: '5px !important',
|
|
114
|
-
'& span': {
|
|
115
|
-
fontSize: '12px !important',
|
|
116
|
-
},
|
|
117
130
|
} })] }, option.value)))) : (jsx(MenuItem, { disabled: true, value: 'NA', children: "No data Found" }, 'NA'))] }) }) }));
|
|
118
131
|
}
|
|
119
132
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Calendar } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Calendar } from '../../../../../_virtual/index.esm6.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDayCell } from '../DayCell/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateInput } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateInput } from '../../../../../_virtual/index.esm12.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateRange } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateRange } from '../../../../../_virtual/index.esm7.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireCalendar } from '../Calendar/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateRangePicker } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm4.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDateRange } from '../DateRange/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DefinedRange } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DefinedRange } from '../../../../../_virtual/index.esm5.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireStyles } from '../../styles.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as InputRangeField } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as InputRangeField } from '../../../../../_virtual/index.esm14.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Month } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Month } from '../../../../../_virtual/index.esm13.js';
|
|
2
2
|
import require$$0__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDayCell } from '../DayCell/index.esm.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tp-react-elements",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "React form components library built with React Hook Form and Yup",
|
|
@@ -72,6 +72,9 @@
|
|
|
72
72
|
"publish:prepare": "npm run build:lib && npm run type-check",
|
|
73
73
|
"publish:npm": "npm publish",
|
|
74
74
|
"publish:beta": "npm publish --tag beta",
|
|
75
|
+
"publish:patch": "npm version patch --no-git-tag-version && npm publish",
|
|
76
|
+
"publish:minor": "npm version minor --no-git-tag-version && npm publish",
|
|
77
|
+
"publish:major": "npm version major --no-git-tag-version && npm publish",
|
|
75
78
|
"publish:auto": "npm run publish:prepare && npm publish",
|
|
76
79
|
"install-peers": "install-tp-form-deps",
|
|
77
80
|
"package-build": "rollup -c --bundleConfigAsCjs",
|