@groupeactual/ui-kit 1.7.9 → 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}/Modal/modal.interface.d.ts +4 -1
- 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 +108 -153
- 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 +97 -69
- package/src/components/Modal/modal.interface.ts +4 -1
- 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}/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 } from 'react';
|
|
1
|
+
import React, { ReactNode, useId, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
faCheck,
|
|
@@ -6,21 +6,19 @@ import {
|
|
|
6
6
|
faSearch,
|
|
7
7
|
faTimes,
|
|
8
8
|
} from '@fortawesome/pro-regular-svg-icons';
|
|
9
|
-
import { AutoCompleteStyle } from '@groupeactual/design-tokens';
|
|
10
9
|
import {
|
|
11
10
|
Autocomplete,
|
|
12
11
|
type AutocompleteProps,
|
|
13
12
|
Box,
|
|
14
|
-
FormControl,
|
|
15
13
|
FormHelperText,
|
|
16
|
-
|
|
14
|
+
InputLabel,
|
|
15
|
+
ListSubheader,
|
|
17
16
|
TextField,
|
|
18
|
-
TextFieldProps,
|
|
19
|
-
styled,
|
|
20
|
-
useTheme,
|
|
21
17
|
} from '@mui/material';
|
|
22
18
|
|
|
23
19
|
import IconProvider from '@/components/IconProvider';
|
|
20
|
+
import MenuItem from '@/components/MenuItem';
|
|
21
|
+
import Text from '@/components/Text';
|
|
24
22
|
|
|
25
23
|
interface Props<T>
|
|
26
24
|
extends Omit<
|
|
@@ -32,41 +30,53 @@ interface Props<T>
|
|
|
32
30
|
| 'error'
|
|
33
31
|
| 'getOptionLabel'
|
|
34
32
|
> {
|
|
35
|
-
label
|
|
33
|
+
label?: ReactNode;
|
|
36
34
|
options: T[];
|
|
37
35
|
helperText?: string;
|
|
38
36
|
color?: 'success';
|
|
39
37
|
placeholder?: string;
|
|
40
|
-
// * Issue on MUI : MUI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string
|
|
41
|
-
getOptionLabel: (_option: T) => string | null | undefined;
|
|
42
|
-
onChange: (_value: T | null) => void;
|
|
43
38
|
value?: T | null;
|
|
44
39
|
width?: number | string;
|
|
45
40
|
error?: string;
|
|
46
41
|
searchIcon?: boolean;
|
|
42
|
+
icon?: ReactNode;
|
|
43
|
+
getOptionGroupLabel?: (_option: T) => string;
|
|
44
|
+
handleOptionChip?: (_option: T) => ReactNode | undefined;
|
|
45
|
+
// * Issue on MUI : MUI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string
|
|
46
|
+
getOptionLabel: (_option: T) => string | null | undefined;
|
|
47
|
+
onChange: (_value: T | null) => void;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
function fixedForwardRef<T, P = {}>(
|
|
51
|
+
render: (_props: P, _ref: React.Ref<T>) => React.ReactNode,
|
|
52
|
+
): (_props: P & React.RefAttributes<T>) => React.ReactNode {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
return React.forwardRef(render as any) as any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const AutoCompleteSingleComponent = <T,>(
|
|
58
|
+
{
|
|
59
|
+
value,
|
|
60
|
+
label,
|
|
61
|
+
placeholder = '',
|
|
62
|
+
options,
|
|
63
|
+
disabled,
|
|
64
|
+
width = '100%',
|
|
65
|
+
color,
|
|
66
|
+
helperText,
|
|
67
|
+
error,
|
|
68
|
+
searchIcon = false,
|
|
69
|
+
icon,
|
|
70
|
+
getOptionGroupLabel,
|
|
71
|
+
handleOptionChip,
|
|
72
|
+
getOptionLabel,
|
|
73
|
+
onChange,
|
|
74
|
+
...props
|
|
75
|
+
}: Props<T>,
|
|
76
|
+
ref: React.ForwardedRef<HTMLSelectElement>,
|
|
77
|
+
) => {
|
|
78
|
+
const generatedId = useId();
|
|
79
|
+
const inputId = `autocomplete-${generatedId}`;
|
|
70
80
|
|
|
71
81
|
const handleValueChange = (
|
|
72
82
|
_event: React.SyntheticEvent<Element, Event>,
|
|
@@ -93,26 +103,27 @@ const AutoCompleteSingle = <T,>({
|
|
|
93
103
|
[value, options, props?.isOptionEqualToValue],
|
|
94
104
|
);
|
|
95
105
|
|
|
96
|
-
const
|
|
106
|
+
const getTextFieldClassName = useMemo(() => {
|
|
97
107
|
const classNames = [
|
|
98
|
-
'DsAutoComplete',
|
|
99
|
-
isValueLabelNotEmpty && 'Mui-filled',
|
|
100
108
|
color === 'success' && 'Mui-success',
|
|
109
|
+
value && 'Mui-filled',
|
|
110
|
+
props.autoFocus && 'Mui-focused',
|
|
101
111
|
disabled && 'Mui-disabled',
|
|
112
|
+
props.className,
|
|
102
113
|
];
|
|
103
114
|
|
|
104
115
|
return classNames.filter(Boolean).join(' ');
|
|
105
|
-
}, [value, disabled,
|
|
116
|
+
}, [value, color, props.className, disabled, props.autoFocus]);
|
|
106
117
|
|
|
107
|
-
const
|
|
118
|
+
const getLabelAndPlaceholderClassName = useMemo(() => {
|
|
108
119
|
const classNames = [
|
|
109
|
-
(!placeholder && 'labelCustom') || 'labelClassic Mui-Input-filled',
|
|
110
120
|
color === 'success' && 'Mui-success',
|
|
111
|
-
|
|
121
|
+
(error || error) && 'Mui-error',
|
|
122
|
+
props.autoFocus && 'Mui-focused',
|
|
123
|
+
disabled && 'Mui-disabled',
|
|
112
124
|
];
|
|
113
|
-
|
|
114
125
|
return classNames.filter(Boolean).join(' ');
|
|
115
|
-
}, [color,
|
|
126
|
+
}, [color, error, props.autoFocus, disabled]);
|
|
116
127
|
|
|
117
128
|
const getPopupIcon = useMemo(() => {
|
|
118
129
|
if (color === 'success') {
|
|
@@ -125,103 +136,194 @@ const AutoCompleteSingle = <T,>({
|
|
|
125
136
|
}, [color, searchIcon]);
|
|
126
137
|
|
|
127
138
|
return (
|
|
128
|
-
<Box sx={{ width }}>
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
className=
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
fontSize: '14px',
|
|
153
|
-
marginTop: '4px',
|
|
154
|
-
boxShadow: '0px 2px 10px 0px #2727271F',
|
|
155
|
-
},
|
|
139
|
+
<Box sx={{ width }} data-testid="ds-autocomplete-single-container">
|
|
140
|
+
<Autocomplete
|
|
141
|
+
{...props}
|
|
142
|
+
ref={ref}
|
|
143
|
+
className="MuiTextField-root"
|
|
144
|
+
value={(isValueLabelNotEmpty && value) || null}
|
|
145
|
+
onChange={handleValueChange}
|
|
146
|
+
aria-placeholder={placeholder}
|
|
147
|
+
disabled={disabled}
|
|
148
|
+
options={options}
|
|
149
|
+
sx={{
|
|
150
|
+
...props.sx,
|
|
151
|
+
'.MuiOutlinedInput-input': {
|
|
152
|
+
marginTop: value ? '0px' : '2px',
|
|
153
|
+
},
|
|
154
|
+
'& .MuiAutocomplete-popupIndicator': { transform: 'none' },
|
|
155
|
+
}}
|
|
156
|
+
getOptionLabel={getOptionLabel as (_option: T) => string}
|
|
157
|
+
slotProps={{
|
|
158
|
+
paper: {
|
|
159
|
+
sx: {
|
|
160
|
+
fontSize: '14px',
|
|
161
|
+
marginTop: '4px',
|
|
162
|
+
boxShadow: '0px 2px 10px 0px #2727271F',
|
|
156
163
|
},
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
164
|
+
},
|
|
165
|
+
}}
|
|
166
|
+
renderOption={(menuProps, option: T) => (
|
|
167
|
+
<MenuItem
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
169
|
+
{...(menuProps as any)}
|
|
170
|
+
selected={
|
|
171
|
+
props?.isOptionEqualToValue
|
|
172
|
+
? props.isOptionEqualToValue(option, value as T)
|
|
173
|
+
: false
|
|
174
|
+
}
|
|
175
|
+
data-testid="ds-menu-item"
|
|
176
|
+
sx={{
|
|
177
|
+
wordBreak: 'break-word',
|
|
178
|
+
overflowWrap: 'break-word',
|
|
179
|
+
whiteSpace: 'normal',
|
|
180
|
+
hyphens: 'auto',
|
|
181
|
+
width: '100%',
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
<Text variant="body2">{getOptionLabel(option)}</Text>
|
|
185
|
+
{handleOptionChip && (
|
|
186
|
+
<Box sx={{ marginLeft: '8px' }}>{handleOptionChip(option)}</Box>
|
|
187
|
+
)}
|
|
188
|
+
</MenuItem>
|
|
189
|
+
)}
|
|
190
|
+
groupBy={getOptionGroupLabel}
|
|
191
|
+
renderGroup={(params) => (
|
|
192
|
+
<Box
|
|
193
|
+
key={params.key}
|
|
194
|
+
sx={{ padding: '0 !important' }}
|
|
195
|
+
data-testid="ds-select-grouped-options-group"
|
|
196
|
+
>
|
|
197
|
+
{params.group?.length !== 0 && (
|
|
198
|
+
<ListSubheader
|
|
199
|
+
component="div"
|
|
200
|
+
sx={{
|
|
201
|
+
color: '#808080',
|
|
202
|
+
width: '100%',
|
|
203
|
+
fontSize: '14px',
|
|
204
|
+
fontWeight: '700 !important',
|
|
205
|
+
lineHeight: '18px',
|
|
206
|
+
padding: '7.5px 8px 7.5px 8px',
|
|
207
|
+
height: '39px',
|
|
208
|
+
textTransform: 'uppercase',
|
|
209
|
+
display: 'flex',
|
|
210
|
+
alignItems: 'center',
|
|
211
|
+
pointerEvents: 'none !important',
|
|
212
|
+
}}
|
|
213
|
+
data-testid="ds-select-grouped-options-active-group"
|
|
214
|
+
>
|
|
215
|
+
{params.group}
|
|
216
|
+
</ListSubheader>
|
|
217
|
+
)}
|
|
218
|
+
<Box component="ul" sx={{ padding: '0 !important' }}>
|
|
219
|
+
{params.children}
|
|
220
|
+
</Box>
|
|
221
|
+
</Box>
|
|
222
|
+
)}
|
|
223
|
+
clearIcon={
|
|
224
|
+
<>
|
|
225
|
+
{!disabled && value && (
|
|
226
|
+
<Box
|
|
227
|
+
className="clear"
|
|
228
|
+
onClick={handleClearValue}
|
|
229
|
+
onMouseDown={preventEventPropagation}
|
|
230
|
+
data-testid="ds-clear-icon"
|
|
231
|
+
>
|
|
232
|
+
<IconProvider icon={faTimes} />
|
|
233
|
+
</Box>
|
|
234
|
+
)}
|
|
235
|
+
</>
|
|
236
|
+
}
|
|
237
|
+
popupIcon={
|
|
238
|
+
icon || (
|
|
193
239
|
<IconProvider
|
|
194
|
-
className={
|
|
240
|
+
className={getLabelAndPlaceholderClassName}
|
|
195
241
|
icon={getPopupIcon}
|
|
196
242
|
size="md"
|
|
243
|
+
data-testid="ds-popup-icon"
|
|
197
244
|
/>
|
|
198
|
-
|
|
199
|
-
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
renderInput={(params) => (
|
|
248
|
+
<Box data-testid="ds-render-input">
|
|
249
|
+
{label && (
|
|
250
|
+
<InputLabel
|
|
251
|
+
htmlFor={inputId}
|
|
252
|
+
className={getLabelAndPlaceholderClassName}
|
|
253
|
+
disabled={disabled}
|
|
254
|
+
data-testid="ds-input-label"
|
|
255
|
+
>
|
|
256
|
+
{label}
|
|
257
|
+
</InputLabel>
|
|
258
|
+
)}
|
|
200
259
|
<TextField
|
|
201
|
-
{...
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
260
|
+
{...params}
|
|
261
|
+
disabled={disabled}
|
|
262
|
+
className={getTextFieldClassName}
|
|
263
|
+
placeholder={placeholder}
|
|
264
|
+
helperText={undefined}
|
|
205
265
|
variant="outlined"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
266
|
+
error={!!error}
|
|
267
|
+
sx={{
|
|
268
|
+
'& .MuiFormHelperText-root': {
|
|
269
|
+
padding: '8px 0 0 8px',
|
|
270
|
+
margin: '0 !important',
|
|
271
|
+
color: error ? '#b80025' : '#545352',
|
|
272
|
+
},
|
|
273
|
+
'& .MuiAutocomplete-tag': {
|
|
274
|
+
borderRadius: '4px',
|
|
275
|
+
fontSize: '14px',
|
|
276
|
+
paddingLeft: '8px',
|
|
277
|
+
paddingRight: '8px',
|
|
278
|
+
height: '24px',
|
|
279
|
+
},
|
|
280
|
+
'& .MuiChip-deleteIcon': {
|
|
281
|
+
margin: '0 0 0 4px !important',
|
|
282
|
+
width: '12px',
|
|
283
|
+
height: '12px',
|
|
284
|
+
marginLeft: '8px',
|
|
285
|
+
marginRight: '2px',
|
|
286
|
+
color: 'primary.main !important',
|
|
287
|
+
},
|
|
288
|
+
'& .MuiChip-label': {
|
|
289
|
+
padding: '0',
|
|
290
|
+
lineHeight: '18px',
|
|
291
|
+
},
|
|
212
292
|
}}
|
|
213
|
-
|
|
293
|
+
data-testid="ds-text-field"
|
|
214
294
|
/>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
295
|
+
{(error || helperText) && (
|
|
296
|
+
<FormHelperText
|
|
297
|
+
component="span"
|
|
298
|
+
className={getLabelAndPlaceholderClassName}
|
|
299
|
+
sx={{
|
|
300
|
+
display: 'table',
|
|
301
|
+
width: '100%',
|
|
302
|
+
marginRight: '4px',
|
|
303
|
+
marginTop: '4px',
|
|
304
|
+
}}
|
|
305
|
+
data-testid="ds-form-helper-text"
|
|
306
|
+
>
|
|
307
|
+
{(error || helperText) && (
|
|
308
|
+
<div
|
|
309
|
+
style={{
|
|
310
|
+
float: 'left',
|
|
311
|
+
}}
|
|
312
|
+
>
|
|
313
|
+
{error || helperText}
|
|
314
|
+
</div>
|
|
315
|
+
)}
|
|
316
|
+
</FormHelperText>
|
|
317
|
+
)}
|
|
318
|
+
</Box>
|
|
221
319
|
)}
|
|
222
|
-
|
|
320
|
+
/>
|
|
223
321
|
</Box>
|
|
224
322
|
);
|
|
225
323
|
};
|
|
226
324
|
|
|
325
|
+
AutoCompleteSingleComponent.displayName = 'AutoCompleteSingle';
|
|
326
|
+
|
|
327
|
+
const AutoCompleteSingle = fixedForwardRef(AutoCompleteSingleComponent);
|
|
328
|
+
|
|
227
329
|
export default AutoCompleteSingle;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import React, { ReactNode
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { faSquare, faSquareMinus } from '@fortawesome/pro-regular-svg-icons';
|
|
4
|
+
import { faCheckSquare } from '@fortawesome/pro-solid-svg-icons';
|
|
5
5
|
import {
|
|
6
6
|
Box,
|
|
7
7
|
Checkbox as CheckboxMUI,
|
|
8
8
|
CheckboxProps,
|
|
9
9
|
FormControl,
|
|
10
10
|
FormControlLabel,
|
|
11
|
-
FormHelperText,
|
|
12
|
-
styled,
|
|
13
|
-
useTheme,
|
|
14
11
|
} from '@mui/material';
|
|
15
12
|
|
|
16
13
|
import IconProvider from '@/components/IconProvider';
|
|
17
14
|
import Text from '@/components/Text';
|
|
18
|
-
import Tooltip from '@/components/Tooltip';
|
|
19
15
|
|
|
20
16
|
interface Props {
|
|
21
17
|
name: string;
|
|
@@ -28,104 +24,50 @@ interface Props {
|
|
|
28
24
|
) => void;
|
|
29
25
|
helperText?: string;
|
|
30
26
|
error?: string;
|
|
31
|
-
infoBubbleContent?: string;
|
|
32
|
-
infoBubblePosition?:
|
|
33
|
-
| 'top'
|
|
34
|
-
| 'right'
|
|
35
|
-
| 'bottom'
|
|
36
|
-
| 'left'
|
|
37
|
-
| 'bottom-end'
|
|
38
|
-
| 'bottom-start'
|
|
39
|
-
| 'left-end'
|
|
40
|
-
| 'left-start'
|
|
41
|
-
| 'right-end'
|
|
42
|
-
| 'right-start'
|
|
43
|
-
| 'top-end'
|
|
44
|
-
| 'top-start'
|
|
45
|
-
| undefined;
|
|
46
27
|
}
|
|
47
28
|
|
|
48
|
-
const Checkbox = (
|
|
49
|
-
name,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
infoBubblePosition = 'right',
|
|
56
|
-
onChange,
|
|
57
|
-
disabled,
|
|
58
|
-
...props
|
|
59
|
-
}: CheckboxProps & Props) => {
|
|
60
|
-
const theme = useTheme();
|
|
61
|
-
const StyledCheckboxForm = useMemo(
|
|
62
|
-
() => styled(FormControl)(CheckboxStyle(theme)),
|
|
63
|
-
[theme],
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const getComponentClassName = useMemo(() => {
|
|
67
|
-
const classNames: string[] = ['DsCheckbox'];
|
|
68
|
-
if (disabled) classNames.push('Mui-disabled');
|
|
69
|
-
|
|
70
|
-
return classNames.join(' ');
|
|
71
|
-
}, [disabled]);
|
|
72
|
-
|
|
73
|
-
const getLabelClassName = useMemo(() => {
|
|
74
|
-
const classNames: string[] = ['DsCheckbox-label'];
|
|
75
|
-
if (disabled) classNames.push('Mui-disabled');
|
|
76
|
-
|
|
77
|
-
return classNames.join(' ');
|
|
78
|
-
}, [disabled]);
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<StyledCheckboxForm className={getComponentClassName}>
|
|
82
|
-
<FormControlLabel
|
|
83
|
-
disabled={disabled}
|
|
84
|
-
control={
|
|
85
|
-
<Box>
|
|
29
|
+
const Checkbox = React.forwardRef<HTMLDivElement, CheckboxProps & Props>(
|
|
30
|
+
({ name, value, label, onChange, disabled, ...props }, ref) => {
|
|
31
|
+
return (
|
|
32
|
+
<FormControl ref={ref} data-testid="ds-checkbox-form-control">
|
|
33
|
+
<FormControlLabel
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
control={
|
|
86
36
|
<CheckboxMUI
|
|
87
|
-
|
|
37
|
+
indeterminateIcon={
|
|
38
|
+
<IconProvider icon={faSquareMinus} size={14} color="inherit" />
|
|
39
|
+
}
|
|
40
|
+
icon={<IconProvider icon={faSquare} size={14} color="inherit" />}
|
|
41
|
+
checkedIcon={
|
|
42
|
+
<IconProvider icon={faCheckSquare} size={14} color="inherit" />
|
|
43
|
+
}
|
|
44
|
+
color="primary"
|
|
45
|
+
{...props}
|
|
88
46
|
disabled={disabled}
|
|
89
|
-
sx={{ marginTop: '-2px' }}
|
|
90
47
|
checked={value}
|
|
91
|
-
color="primary"
|
|
92
48
|
onChange={(e) => {
|
|
93
49
|
onChange?.(name, e.target.checked, true);
|
|
94
50
|
}}
|
|
95
|
-
|
|
51
|
+
data-testid="ds-checkbox"
|
|
96
52
|
/>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
variant="body1"
|
|
104
|
-
className={getLabelClassName}
|
|
53
|
+
}
|
|
54
|
+
label={
|
|
55
|
+
<Box
|
|
56
|
+
display="flex"
|
|
57
|
+
alignItems="center"
|
|
58
|
+
data-testid="ds-checkbox-label"
|
|
105
59
|
>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)}
|
|
119
|
-
</Box>
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
122
|
-
{(error || helperText) && (
|
|
123
|
-
<FormHelperText component="span" className={error ? 'Mui-error' : ''}>
|
|
124
|
-
{error || helperText}
|
|
125
|
-
</FormHelperText>
|
|
126
|
-
)}
|
|
127
|
-
</StyledCheckboxForm>
|
|
128
|
-
);
|
|
129
|
-
};
|
|
60
|
+
<Text component="span" variant="body1">
|
|
61
|
+
{label}
|
|
62
|
+
</Text>
|
|
63
|
+
</Box>
|
|
64
|
+
}
|
|
65
|
+
/>
|
|
66
|
+
</FormControl>
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
Checkbox.displayName = 'Checkbox';
|
|
130
72
|
|
|
131
73
|
export default Checkbox;
|