@groupeactual/ui-kit 1.7.10 → 2.0.0-beta.0
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/cjs/index.js +15097 -66
- package/dist/es/{src/DesignSystemProvider.d.ts → DesignSystemProvider.d.ts} +6 -5
- package/dist/es/{src/components → components}/Accordion/Accordion.d.ts +1 -1
- package/dist/es/{src/components → components}/BannerNotification/BannerNotification.d.ts +1 -1
- package/dist/es/{src/components → components}/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/es/{src/components → components}/Button/Button.d.ts +2 -2
- package/dist/es/{src/components → components}/Chip/Chip.d.ts +1 -1
- package/dist/es/components/Datatable/Datatable.d.ts +4 -0
- package/dist/es/{src/components → components}/EmbbededNotification/EmbeddedNotification.d.ts +1 -1
- package/dist/es/{src/components/UploadDocument → components/FileUploader}/FileUploader.d.ts +1 -1
- package/dist/es/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +23 -0
- package/dist/es/{src/components → components}/Form/AutoCompleteSingle/AutoCompleteSingle.d.ts +8 -5
- package/dist/es/components/Form/Checkbox/Checkbox.d.ts +12 -0
- package/dist/es/components/Form/CheckboxGroup/CheckboxGroup.d.ts +12 -0
- package/dist/es/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +6 -0
- package/dist/es/{src/components → components}/Form/DatePicker/DatePicker.d.ts +6 -4
- package/dist/es/{src/components → components}/Form/MultiSelect/MultiSelect.d.ts +3 -3
- package/dist/es/components/Form/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/es/{src/components → components}/Form/Select/Select.d.ts +3 -3
- package/dist/es/components/Form/Switch/Switch.d.ts +11 -0
- package/dist/es/{src/components → components}/Form/TextField/TextField.d.ts +6 -5
- package/dist/es/{src/components → components}/Form/TimePicker/TimePicker.d.ts +3 -3
- package/dist/es/{src/components → components}/IconButton/IconButton.d.ts +3 -3
- package/dist/es/components/IconProvider/IconProvider.d.ts +24 -0
- package/dist/es/{src/components → components}/Link/Link.d.ts +1 -2
- package/dist/es/components/MenuItem/MenuItem.d.ts +9 -0
- package/dist/es/components/Modal/Dialog/Dialog.d.ts +4 -0
- package/dist/es/components/Modal/Drawer/Drawer.d.ts +4 -0
- package/dist/es/{src/components → components}/Navigation/Stepper/Stepper.d.ts +1 -1
- package/dist/es/{src/components → components}/Pagination/Pagination.d.ts +2 -1
- package/dist/es/{src/components → components}/Snackbar/Snackbar.d.ts +1 -1
- package/dist/es/components/TabsPanel/TabsPanel.d.ts +4 -0
- package/dist/es/components/TabsPanel/index.d.ts +1 -0
- package/dist/es/components/TabsPanel/tab.interface.d.ts +17 -0
- package/dist/es/components/Text/Text.d.ts +8 -0
- package/dist/es/{src/components → components}/Tooltip/Tooltip.d.ts +1 -1
- package/dist/es/{src/components → components}/index.d.ts +3 -2
- package/dist/es/index.d.ts +104 -152
- package/dist/es/index.js +37 -79
- package/package.json +20 -17
- package/src/DesignSystemProvider.tsx +21 -36
- package/src/components/Accordion/Accordion.tsx +41 -59
- package/src/components/BannerNotification/BannerNotification.tsx +19 -20
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +32 -28
- package/src/components/Button/Button.tsx +70 -17
- package/src/components/Chip/Chip.tsx +88 -117
- package/src/components/Datatable/Datatable.tsx +49 -37
- package/src/components/Datatable/DatatableCellRender.tsx +1 -1
- package/src/components/EmbbededNotification/EmbeddedNotification.tsx +78 -69
- package/src/components/FileUploader/FileUploader.tsx +767 -0
- package/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.tsx +289 -172
- package/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.tsx +228 -126
- package/src/components/Form/Checkbox/Checkbox.tsx +38 -96
- package/src/components/Form/CheckboxGroup/CheckboxGroup.tsx +86 -60
- package/src/components/Form/CheckboxGroup/checkboxgroup.interface.ts +0 -15
- package/src/components/Form/DatePicker/DatePicker.tsx +88 -40
- package/src/components/Form/MultiSelect/MultiSelect.tsx +196 -171
- package/src/components/Form/RadioGroup/RadioGroup.tsx +76 -82
- package/src/components/Form/Select/Select.tsx +156 -136
- package/src/components/Form/Switch/Switch.tsx +87 -47
- package/src/components/Form/TextField/TextField.tsx +125 -76
- package/src/components/Form/TimePicker/TimePicker.tsx +26 -7
- package/src/components/IconButton/IconButton.tsx +64 -39
- package/src/components/IconProvider/IconProvider.tsx +90 -69
- package/src/components/Link/Link.tsx +6 -10
- package/src/components/MenuItem/MenuItem.tsx +35 -23
- package/src/components/Modal/Dialog/Dialog.tsx +17 -14
- package/src/components/Modal/Drawer/Drawer.tsx +95 -74
- package/src/components/Navigation/Stepper/Step.tsx +7 -6
- package/src/components/Navigation/Stepper/Stepper.tsx +24 -23
- package/src/components/NotistackAdapter/NotistackAdapter.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +131 -118
- package/src/components/Snackbar/Snackbar.tsx +29 -29
- package/src/components/TabsPanel/TabsPanel.tsx +151 -0
- package/src/components/TabsPanel/index.ts +1 -0
- package/src/components/TabsPanel/tab.interface.ts +20 -0
- package/src/components/Text/Text.tsx +25 -12
- package/src/components/Tooltip/Tooltip.tsx +54 -51
- package/src/components/index.ts +3 -2
- package/src/index.ts +0 -1
- package/dist/es/src/components/Datatable/Datatable.d.ts +0 -4
- package/dist/es/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +0 -19
- package/dist/es/src/components/Form/Checkbox/Checkbox.d.ts +0 -14
- package/dist/es/src/components/Form/CheckboxGroup/CheckboxGroup.d.ts +0 -12
- package/dist/es/src/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +0 -8
- package/dist/es/src/components/Form/RadioGroup/RadioGroup.d.ts +0 -18
- package/dist/es/src/components/Form/Switch/Switch.d.ts +0 -10
- package/dist/es/src/components/IconProvider/IconProvider.d.ts +0 -19
- package/dist/es/src/components/MenuItem/MenuItem.d.ts +0 -10
- package/dist/es/src/components/Modal/Dialog/Dialog.d.ts +0 -4
- package/dist/es/src/components/Modal/Drawer/Drawer.d.ts +0 -4
- package/dist/es/src/components/Text/Text.d.ts +0 -8
- package/dist/es/src/index.d.ts +0 -5
- package/dist/es/src/interfaces/theme.d.ts +0 -51
- package/src/components/UploadDocument/FileUploader.tsx +0 -728
- package/src/interfaces/theme.ts +0 -51
- /package/dist/es/{src/components → components}/Accordion/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/BannerNotification/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Breadcrumbs/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Button/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Chip/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Datatable/DatatableCellRender.d.ts +0 -0
- /package/dist/es/{src/components → components}/Datatable/datatable.interface.d.ts +0 -0
- /package/dist/es/{src/components → components}/Datatable/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Datatable/use-pagination-props.hook.d.ts +0 -0
- /package/dist/es/{src/components → components}/EmbbededNotification/index.d.ts +0 -0
- /package/dist/es/{src/components/UploadDocument → components/FileUploader}/fileuploader.interface.d.ts +0 -0
- /package/dist/es/{src/components/UploadDocument → components/FileUploader}/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/AutoCompleteMulti/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/AutoCompleteSingle/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/Checkbox/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/CheckboxGroup/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/DatePicker/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/MultiSelect/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/RadioGroup/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/Select/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/Switch/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/TextField/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Form/TimePicker/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/IconButton/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/IconProvider/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Link/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/MenuItem/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Modal/Dialog/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Modal/Drawer/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Modal/modal.interface.d.ts +0 -0
- /package/dist/es/{src/components → components}/Navigation/Stepper/Step.d.ts +0 -0
- /package/dist/es/{src/components → components}/Navigation/Stepper/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Navigation/Stepper/stepper.helper.d.ts +0 -0
- /package/dist/es/{src/components → components}/Navigation/Stepper/stepper.interface.d.ts +0 -0
- /package/dist/es/{src/components → components}/NotistackAdapter/NotistackAdapter.d.ts +0 -0
- /package/dist/es/{src/components → components}/NotistackAdapter/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Pagination/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Pagination/pagination.helper.d.ts +0 -0
- /package/dist/es/{src/components → components}/Snackbar/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Text/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Tooltip/index.d.ts +0 -0
- /package/dist/es/{src/components → components}/Tooltip/tooltip.interface.d.ts +0 -0
- /package/dist/es/{src/helpers → helpers}/GooglePickerWrapper.d.ts +0 -0
- /package/dist/es/{src/hooks → hooks}/useGooleDrivePicker.d.ts +0 -0
- /package/dist/es/{src/types → types}/googleDrive.d.ts +0 -0
- /package/src/components/{UploadDocument → FileUploader}/fileuploader.interface.ts +0 -0
- /package/src/components/{UploadDocument → FileUploader}/index.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useRef } from 'react';
|
|
1
|
+
import React, { ReactNode, useId, useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
faCheck,
|
|
@@ -7,23 +7,22 @@ import {
|
|
|
7
7
|
faTimes,
|
|
8
8
|
} from '@fortawesome/pro-regular-svg-icons';
|
|
9
9
|
import { faCircleX } from '@fortawesome/pro-solid-svg-icons';
|
|
10
|
-
import { AutoCompleteStyle } from '@groupeactual/design-tokens';
|
|
11
10
|
import {
|
|
12
11
|
type AutocompleteProps,
|
|
13
|
-
|
|
12
|
+
Box,
|
|
14
13
|
FormHelperText,
|
|
14
|
+
InputLabel,
|
|
15
|
+
ListSubheader,
|
|
15
16
|
MenuItem,
|
|
16
|
-
|
|
17
|
-
useTheme,
|
|
17
|
+
TextField,
|
|
18
18
|
} from '@mui/material';
|
|
19
|
-
import Autocomplete from '@mui/material
|
|
20
|
-
import Box from '@mui/material/Box';
|
|
21
|
-
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
|
19
|
+
import { Autocomplete } from '@mui/material';
|
|
22
20
|
|
|
23
21
|
import Chip from '@/components/Chip';
|
|
24
22
|
import IconProvider from '@/components/IconProvider';
|
|
23
|
+
import Text from '@/components/Text';
|
|
25
24
|
|
|
26
|
-
interface
|
|
25
|
+
interface Props<T>
|
|
27
26
|
extends Omit<
|
|
28
27
|
AutocompleteProps<T, true, true, false>,
|
|
29
28
|
| 'onChange'
|
|
@@ -35,42 +34,57 @@ interface AutocompleteMultipleSelectProps<T>
|
|
|
35
34
|
| 'searchIcon'
|
|
36
35
|
> {
|
|
37
36
|
value: T[] | undefined;
|
|
38
|
-
label?:
|
|
37
|
+
label?: ReactNode;
|
|
39
38
|
helperText?: string;
|
|
40
39
|
placeholder?: string;
|
|
41
40
|
options: T[];
|
|
42
|
-
getOptionLabel: (_option: T) => string;
|
|
43
|
-
getKeyValue: (_option: T) => string;
|
|
44
|
-
onChange: (_value: T[]) => void;
|
|
45
|
-
getOptionDisabled?: (_option: T) => boolean;
|
|
46
41
|
color?: 'success';
|
|
47
42
|
width?: number | string;
|
|
48
43
|
error?: string;
|
|
49
44
|
searchIcon?: boolean;
|
|
45
|
+
icon?: ReactNode;
|
|
46
|
+
isOptionEqualToValue?: (_option: T, _value: T) => boolean;
|
|
47
|
+
getOptionLabel: (_option: T) => string;
|
|
48
|
+
getKeyValue: (_option: T) => string;
|
|
49
|
+
onChange: (_value: T[]) => void;
|
|
50
|
+
getOptionDisabled?: (_option: T) => boolean;
|
|
51
|
+
getOptionGroupLabel?: (_option: T) => string;
|
|
52
|
+
handleOptionChip?: (_option: T) => ReactNode | undefined;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
function fixedForwardRef<T, P = {}>(
|
|
56
|
+
render: (_props: P, _ref: React.Ref<T>) => React.ReactNode,
|
|
57
|
+
): (_props: P & React.RefAttributes<T>) => React.ReactNode {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
return React.forwardRef(render as any) as any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const AutocompleteMultipleSelectComponent = <T,>(
|
|
63
|
+
{
|
|
64
|
+
value,
|
|
65
|
+
label,
|
|
66
|
+
placeholder,
|
|
67
|
+
options,
|
|
68
|
+
disabled,
|
|
69
|
+
width = '100%',
|
|
70
|
+
color,
|
|
71
|
+
helperText,
|
|
72
|
+
error,
|
|
73
|
+
searchIcon = false,
|
|
74
|
+
icon,
|
|
75
|
+
getOptionLabel,
|
|
76
|
+
getKeyValue,
|
|
77
|
+
isOptionEqualToValue,
|
|
78
|
+
onChange,
|
|
79
|
+
getOptionDisabled,
|
|
80
|
+
getOptionGroupLabel,
|
|
81
|
+
handleOptionChip,
|
|
82
|
+
...props
|
|
83
|
+
}: Props<T>,
|
|
84
|
+
ref: React.ForwardedRef<HTMLSelectElement>,
|
|
85
|
+
) => {
|
|
86
|
+
const generatedId = useId();
|
|
87
|
+
const inputId = `autocomplete-multi-${generatedId}`;
|
|
74
88
|
|
|
75
89
|
const handleValueChange = (
|
|
76
90
|
_event: React.SyntheticEvent<Element, Event>,
|
|
@@ -92,27 +106,27 @@ const AutocompleteMultipleSelect = <T,>({
|
|
|
92
106
|
event.stopPropagation();
|
|
93
107
|
};
|
|
94
108
|
|
|
95
|
-
const
|
|
109
|
+
const getTextFieldClassName = useMemo(() => {
|
|
96
110
|
const classNames = [
|
|
97
|
-
'DsAutoComplete',
|
|
98
|
-
value && value.length > 0 && 'Mui-filled',
|
|
99
111
|
color === 'success' && 'Mui-success',
|
|
112
|
+
value && 'Mui-filled',
|
|
113
|
+
props.autoFocus && 'Mui-focused',
|
|
100
114
|
disabled && 'Mui-disabled',
|
|
115
|
+
props.className,
|
|
101
116
|
];
|
|
102
117
|
|
|
103
118
|
return classNames.filter(Boolean).join(' ');
|
|
104
|
-
}, [value]);
|
|
119
|
+
}, [value, color, props.className, disabled, props.autoFocus]);
|
|
105
120
|
|
|
106
|
-
const
|
|
121
|
+
const getLabelAndPlaceholderClassName = useMemo(() => {
|
|
107
122
|
const classNames = [
|
|
108
|
-
(!placeholder && 'labelCustom') || 'labelClassic Mui-Input-filled',
|
|
109
|
-
error && 'Mui-error',
|
|
110
123
|
color === 'success' && 'Mui-success',
|
|
111
|
-
|
|
124
|
+
(error || error) && 'Mui-error',
|
|
125
|
+
props.autoFocus && 'Mui-focused',
|
|
126
|
+
disabled && 'Mui-disabled',
|
|
112
127
|
];
|
|
113
|
-
|
|
114
128
|
return classNames.filter(Boolean).join(' ');
|
|
115
|
-
}, [error,
|
|
129
|
+
}, [color, error, props.autoFocus, disabled]);
|
|
116
130
|
|
|
117
131
|
const getPopupIcon = useMemo(() => {
|
|
118
132
|
if (color === 'success') {
|
|
@@ -128,145 +142,248 @@ const AutocompleteMultipleSelect = <T,>({
|
|
|
128
142
|
const boxRef = useRef<HTMLHeadingElement>(null);
|
|
129
143
|
|
|
130
144
|
return (
|
|
131
|
-
<Box
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
<Box
|
|
146
|
+
sx={{ width }}
|
|
147
|
+
ref={boxRef}
|
|
148
|
+
data-testid="ds-autocomplete-multi-container"
|
|
149
|
+
>
|
|
150
|
+
<Autocomplete
|
|
151
|
+
{...props}
|
|
152
|
+
ref={ref}
|
|
153
|
+
value={value}
|
|
154
|
+
className="MuiTextField-root MuiAutocomplete-multi"
|
|
155
|
+
onChange={handleValueChange}
|
|
156
|
+
aria-placeholder={(withPlaceholder && placeholder) || ''}
|
|
157
|
+
disableCloseOnSelect
|
|
158
|
+
multiple
|
|
159
|
+
sx={{
|
|
160
|
+
...props.sx,
|
|
161
|
+
'.MuiInputBase-root': {
|
|
162
|
+
height: 'auto !important',
|
|
163
|
+
minHeight: '44px',
|
|
164
|
+
padding: '4px 65px 4px 4px !important',
|
|
165
|
+
},
|
|
166
|
+
'.MuiOutlinedInput-input': {
|
|
167
|
+
marginTop: value ? '0px' : '2px',
|
|
168
|
+
},
|
|
169
|
+
'& .MuiAutocomplete-popupIndicator': { transform: 'none' },
|
|
170
|
+
}}
|
|
171
|
+
disabled={disabled}
|
|
172
|
+
options={options}
|
|
173
|
+
slotProps={{
|
|
174
|
+
paper: {
|
|
175
|
+
sx: {
|
|
176
|
+
fontSize: '14px',
|
|
177
|
+
marginTop: '4px',
|
|
178
|
+
boxShadow: '0px 2px 10px 0px #2727271F',
|
|
157
179
|
},
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
},
|
|
181
|
+
}}
|
|
182
|
+
clearIcon={
|
|
183
|
+
<>
|
|
184
|
+
{!disabled && value && (
|
|
185
|
+
<Box
|
|
186
|
+
className="clear"
|
|
187
|
+
onClick={() => handleClearValue()}
|
|
188
|
+
onMouseDown={preventEventPropagation}
|
|
189
|
+
data-testid="ds-clear-icon"
|
|
190
|
+
>
|
|
191
|
+
<IconProvider icon={faTimes} />
|
|
192
|
+
</Box>
|
|
193
|
+
)}
|
|
194
|
+
</>
|
|
195
|
+
}
|
|
196
|
+
popupIcon={
|
|
197
|
+
icon || (
|
|
173
198
|
<IconProvider
|
|
174
|
-
className={
|
|
199
|
+
className={getLabelAndPlaceholderClassName}
|
|
175
200
|
icon={getPopupIcon}
|
|
176
201
|
size="md"
|
|
202
|
+
data-testid="ds-popup-icon"
|
|
177
203
|
/>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
groupBy={getOptionGroupLabel}
|
|
207
|
+
renderGroup={(params) => (
|
|
208
|
+
<Box
|
|
209
|
+
key={params.key}
|
|
210
|
+
sx={{ padding: '0 !important' }}
|
|
211
|
+
data-testid="ds-select-grouped-options-group"
|
|
212
|
+
>
|
|
213
|
+
{params.group?.length !== 0 && (
|
|
214
|
+
<ListSubheader
|
|
215
|
+
component="div"
|
|
216
|
+
sx={{
|
|
217
|
+
color: '#808080',
|
|
218
|
+
width: '100%',
|
|
219
|
+
fontSize: '14px',
|
|
220
|
+
fontWeight: '700 !important',
|
|
221
|
+
lineHeight: '18px',
|
|
222
|
+
padding: '7.5px 8px 7.5px 8px',
|
|
223
|
+
height: '39px',
|
|
224
|
+
textTransform: 'uppercase',
|
|
225
|
+
display: 'flex',
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
pointerEvents: 'none !important',
|
|
228
|
+
}}
|
|
229
|
+
data-testid="ds-select-grouped-options-active-group"
|
|
230
|
+
>
|
|
231
|
+
{params.group}
|
|
232
|
+
</ListSubheader>
|
|
233
|
+
)}
|
|
234
|
+
<Box component="ul" sx={{ padding: '0 !important' }}>
|
|
235
|
+
{params.children}
|
|
236
|
+
</Box>
|
|
237
|
+
</Box>
|
|
238
|
+
)}
|
|
239
|
+
renderTags={(tag: T[]) => {
|
|
240
|
+
return (
|
|
241
|
+
<>
|
|
242
|
+
{tag.map((selectedOption: T, _index: number) => {
|
|
243
|
+
const optionLabel = getOptionLabel(selectedOption);
|
|
244
|
+
const isOptionLabelNotEmpty =
|
|
245
|
+
optionLabel !== null &&
|
|
246
|
+
optionLabel !== undefined &&
|
|
247
|
+
optionLabel !== '';
|
|
188
248
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
>
|
|
249
|
+
return (
|
|
250
|
+
isOptionLabelNotEmpty && (
|
|
251
|
+
<Chip
|
|
252
|
+
key={getKeyValue(selectedOption)}
|
|
253
|
+
variant={disabled ? 'outlined' : 'filled'}
|
|
254
|
+
color="default"
|
|
255
|
+
label={optionLabel}
|
|
256
|
+
onMouseDown={preventEventPropagation}
|
|
257
|
+
disabled={disabled}
|
|
258
|
+
suffixIcon={faCircleX}
|
|
259
|
+
suffixAction={() =>
|
|
260
|
+
!disabled && handleDeleteChip(selectedOption)
|
|
261
|
+
}
|
|
262
|
+
data-testid="ds-chip-option"
|
|
263
|
+
sx={{
|
|
264
|
+
margin: '3px',
|
|
265
|
+
maxWidth: boxRef?.current
|
|
266
|
+
? parseFloat(
|
|
267
|
+
String(boxRef.current?.offsetWidth).replace(
|
|
268
|
+
'px',
|
|
269
|
+
'',
|
|
270
|
+
),
|
|
271
|
+
) - 80
|
|
272
|
+
: width,
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
)
|
|
276
|
+
);
|
|
277
|
+
})}
|
|
278
|
+
</>
|
|
279
|
+
);
|
|
280
|
+
}}
|
|
281
|
+
getOptionLabel={getOptionLabel}
|
|
282
|
+
renderOption={(props, option: T) => (
|
|
283
|
+
<MenuItem
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
+
{...(props as any)}
|
|
286
|
+
disabled={getOptionDisabled?.(option)}
|
|
287
|
+
selected={value?.some((val) =>
|
|
288
|
+
isOptionEqualToValue ? isOptionEqualToValue(option, val) : false,
|
|
289
|
+
)}
|
|
290
|
+
data-testid="ds-menu-item"
|
|
291
|
+
sx={{
|
|
292
|
+
wordBreak: 'break-word',
|
|
293
|
+
overflowWrap: 'break-word',
|
|
294
|
+
whiteSpace: 'normal',
|
|
295
|
+
hyphens: 'auto',
|
|
296
|
+
width: '100%',
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<Text variant="body2" sx={{ wordBreak: 'break-word' }}>
|
|
241
300
|
{getOptionLabel(option)}
|
|
242
|
-
</
|
|
243
|
-
|
|
244
|
-
|
|
301
|
+
</Text>
|
|
302
|
+
{handleOptionChip && (
|
|
303
|
+
<Box sx={{ marginLeft: '8px' }}>{handleOptionChip(option)}</Box>
|
|
304
|
+
)}
|
|
305
|
+
</MenuItem>
|
|
306
|
+
)}
|
|
307
|
+
renderInput={(params) => (
|
|
308
|
+
<Box data-testid="ds-render-input">
|
|
309
|
+
{label && (
|
|
310
|
+
<InputLabel
|
|
311
|
+
htmlFor={inputId}
|
|
312
|
+
className={getLabelAndPlaceholderClassName}
|
|
313
|
+
disabled={disabled}
|
|
314
|
+
data-testid="ds-input-label"
|
|
315
|
+
>
|
|
316
|
+
{label}
|
|
317
|
+
</InputLabel>
|
|
318
|
+
)}
|
|
245
319
|
<TextField
|
|
246
|
-
{...
|
|
247
|
-
|
|
320
|
+
{...params}
|
|
321
|
+
disabled={disabled}
|
|
322
|
+
className={getTextFieldClassName}
|
|
323
|
+
placeholder={placeholder}
|
|
324
|
+
helperText={undefined}
|
|
325
|
+
variant="outlined"
|
|
248
326
|
error={!!error}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
327
|
+
sx={{
|
|
328
|
+
'& .MuiFormHelperText-root': {
|
|
329
|
+
padding: '8px 0 0 8px',
|
|
330
|
+
margin: '0 !important',
|
|
331
|
+
color: error ? '#b80025' : '#545352',
|
|
332
|
+
},
|
|
333
|
+
'& .MuiAutocomplete-tag': {
|
|
334
|
+
borderRadius: '4px',
|
|
335
|
+
fontSize: '14px',
|
|
336
|
+
paddingLeft: '8px',
|
|
337
|
+
paddingRight: '8px',
|
|
338
|
+
height: '24px',
|
|
339
|
+
},
|
|
340
|
+
'& .MuiChip-deleteIcon': {
|
|
341
|
+
margin: '0 0 0 4px !important',
|
|
342
|
+
width: '12px',
|
|
343
|
+
height: '12px',
|
|
344
|
+
marginLeft: '8px',
|
|
345
|
+
marginRight: '2px',
|
|
346
|
+
color: 'primary.main !important',
|
|
347
|
+
},
|
|
348
|
+
'& .MuiChip-label': {
|
|
349
|
+
padding: '0',
|
|
350
|
+
lineHeight: '18px',
|
|
351
|
+
},
|
|
257
352
|
}}
|
|
258
|
-
|
|
353
|
+
data-testid="ds-text-field"
|
|
259
354
|
/>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
355
|
+
{(error || helperText) && (
|
|
356
|
+
<FormHelperText
|
|
357
|
+
component="span"
|
|
358
|
+
className={getLabelAndPlaceholderClassName}
|
|
359
|
+
sx={{
|
|
360
|
+
display: 'table',
|
|
361
|
+
width: '100%',
|
|
362
|
+
marginRight: '4px',
|
|
363
|
+
marginTop: '4px',
|
|
364
|
+
}}
|
|
365
|
+
data-testid="ds-form-helper-text"
|
|
366
|
+
>
|
|
367
|
+
{(error || helperText) && (
|
|
368
|
+
<div
|
|
369
|
+
style={{
|
|
370
|
+
float: 'left',
|
|
371
|
+
}}
|
|
372
|
+
>
|
|
373
|
+
{error || helperText}
|
|
374
|
+
</div>
|
|
375
|
+
)}
|
|
376
|
+
</FormHelperText>
|
|
377
|
+
)}
|
|
378
|
+
</Box>
|
|
266
379
|
)}
|
|
267
|
-
|
|
380
|
+
/>
|
|
268
381
|
</Box>
|
|
269
382
|
);
|
|
270
383
|
};
|
|
271
384
|
|
|
272
|
-
|
|
385
|
+
AutocompleteMultipleSelectComponent.displayName = 'AutocompleteMultipleSelect';
|
|
386
|
+
|
|
387
|
+
const AutoCompleteMulti = fixedForwardRef(AutocompleteMultipleSelectComponent);
|
|
388
|
+
|
|
389
|
+
export default AutoCompleteMulti;
|