@groupeactual/ui-kit 1.7.0-beta.0 → 1.7.0-beta.3
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 +9 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.ts +176 -163
- package/dist/es/index.js +8 -18
- package/dist/es/index.js.map +1 -1
- package/dist/es/src/components/Accordion/Accordion.d.ts +1 -4
- package/dist/es/src/components/BannerNotification/BannerNotification.d.ts +1 -4
- package/dist/es/src/components/Breadcrumbs/Breadcrumbs.d.ts +1 -4
- package/dist/es/src/components/Button/Button.d.ts +1 -4
- package/dist/es/src/components/Chip/Chip.d.ts +2 -5
- package/dist/es/src/components/Datatable/Datatable.d.ts +1 -1
- package/dist/es/src/components/Datatable/datatable.interface.d.ts +5 -4
- package/dist/es/src/components/EmbbededNotification/EmbeddedNotification.d.ts +1 -4
- package/dist/es/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +7 -6
- package/dist/es/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.d.ts +5 -7
- package/dist/es/src/components/Form/Checkbox/Checkbox.d.ts +4 -7
- package/dist/es/src/components/Form/CheckboxGroup/CheckboxGroup.d.ts +4 -12
- package/dist/es/src/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +8 -0
- package/dist/es/src/components/Form/DatePicker/DatePicker.d.ts +1 -1
- package/dist/es/src/components/Form/MultiSelect/MultiSelect.d.ts +4 -7
- package/dist/es/src/components/Form/RadioGroup/RadioGroup.d.ts +2 -5
- package/dist/es/src/components/Form/Select/Select.d.ts +5 -7
- package/dist/es/src/components/Form/Switch/Switch.d.ts +1 -4
- package/dist/es/src/components/Form/TextField/TextField.d.ts +5 -6
- package/dist/es/src/components/Form/TimePicker/TimePicker.d.ts +20 -0
- package/dist/es/src/components/Form/TimePicker/index.d.ts +1 -0
- package/dist/es/src/components/IconButton/IconButton.d.ts +5 -7
- package/dist/es/src/components/IconProvider/IconProvider.d.ts +1 -4
- package/dist/es/src/components/Link/Link.d.ts +1 -4
- package/dist/es/src/components/MenuItem/MenuItem.d.ts +7 -10
- package/dist/es/src/components/Navigation/Stepper/Step.d.ts +1 -1
- package/dist/es/src/components/Navigation/Stepper/Stepper.d.ts +1 -1
- package/dist/es/src/components/Pagination/Pagination.d.ts +3 -6
- package/dist/es/src/components/Snackbar/Snackbar.d.ts +1 -4
- package/dist/es/src/components/Text/Text.d.ts +1 -4
- package/dist/es/src/components/Tooltip/Tooltip.d.ts +5 -7
- package/dist/es/src/components/UploadDocument/FileUploaderSingle.d.ts +55 -8
- package/dist/es/src/components/UploadDocument/fileuploadersingle.interface.d.ts +5 -0
- package/dist/es/src/components/index.d.ts +2 -0
- package/dist/es/src/helpers/GooglePickerWrapper.d.ts +2 -1
- package/dist/es/src/hooks/useGooleDrivePicker.d.ts +1 -1
- package/package.json +20 -20
- package/src/components/Accordion/Accordion.tsx +4 -4
- package/src/components/BannerNotification/BannerNotification.tsx +0 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -2
- package/src/components/Button/Button.tsx +0 -2
- package/src/components/Chip/Chip.tsx +1 -3
- package/src/components/Datatable/Datatable.tsx +27 -6
- package/src/components/Datatable/DatatableCellRender.tsx +2 -1
- package/src/components/Datatable/datatable.interface.ts +5 -4
- package/src/components/Datatable/use-pagination-props.hook.ts +2 -2
- package/src/components/EmbbededNotification/EmbeddedNotification.tsx +0 -2
- package/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.tsx +24 -9
- package/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.tsx +15 -10
- package/src/components/Form/Checkbox/Checkbox.tsx +22 -25
- package/src/components/Form/CheckboxGroup/CheckboxGroup.tsx +8 -25
- package/src/components/Form/CheckboxGroup/checkboxgroup.interface.ts +22 -0
- package/src/components/Form/DatePicker/DatePicker.tsx +15 -3
- package/src/components/Form/MultiSelect/MultiSelect.tsx +33 -7
- package/src/components/Form/RadioGroup/RadioGroup.tsx +18 -23
- package/src/components/Form/Select/Select.tsx +34 -6
- package/src/components/Form/Switch/Switch.tsx +0 -2
- package/src/components/Form/TextField/TextField.tsx +120 -107
- package/src/components/Form/TimePicker/TimePicker.tsx +228 -0
- package/src/components/Form/TimePicker/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +12 -6
- package/src/components/IconProvider/IconProvider.tsx +3 -4
- package/src/components/Link/Link.tsx +0 -2
- package/src/components/MenuItem/MenuItem.tsx +10 -39
- package/src/components/Navigation/Stepper/Step.tsx +1 -1
- package/src/components/Navigation/Stepper/Stepper.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +4 -5
- package/src/components/Snackbar/Snackbar.tsx +0 -2
- package/src/components/Text/Text.tsx +0 -2
- package/src/components/Tooltip/Tooltip.tsx +41 -32
- package/src/components/UploadDocument/FileUploaderSingle.tsx +156 -86
- package/src/components/UploadDocument/fileuploadersingle.interface.ts +5 -0
- package/src/components/index.ts +2 -0
- package/src/helpers/GooglePickerWrapper.tsx +2 -2
- package/src/hooks/useGooleDrivePicker.ts +8 -6
- package/src/types/global.d.ts +6 -4
- package/src/types/googleDrive.ts +1 -0
- package/dist/es/src/helpers/dataGetValue.d.ts +0 -2
- package/src/helpers/dataGetValue.ts +0 -22
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple template for a custom React component library",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@babel/core": "^7.
|
|
8
|
-
"@babel/preset-env": "^7.
|
|
9
|
-
"@babel/preset-react": "^7.
|
|
10
|
-
"@babel/preset-typescript": "^7.
|
|
11
|
-
"@groupeactual/code-quality-front": "^1.
|
|
12
|
-
"@mdx-js/react": "^3.0
|
|
13
|
-
"@types/google.picker": "^0.0.
|
|
14
|
-
"@types/lodash": "^4.17.
|
|
7
|
+
"@babel/core": "^7.26.0",
|
|
8
|
+
"@babel/preset-env": "^7.26.0",
|
|
9
|
+
"@babel/preset-react": "^7.25.9",
|
|
10
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
11
|
+
"@groupeactual/code-quality-front": "^1.3.0",
|
|
12
|
+
"@mdx-js/react": "^3.1.0",
|
|
13
|
+
"@types/google.picker": "^0.0.46",
|
|
14
|
+
"@types/lodash": "^4.17.13",
|
|
15
15
|
"@types/react": "^18.3.12",
|
|
16
16
|
"@types/styled-components": "^5.1.34",
|
|
17
|
-
"babel-loader": "^9.1
|
|
17
|
+
"babel-loader": "^9.2.1",
|
|
18
18
|
"clsx": "^2.1.1",
|
|
19
19
|
"css-loader": "^7.1.2",
|
|
20
|
-
"framer-motion": "^11.
|
|
20
|
+
"framer-motion": "^11.11.17",
|
|
21
21
|
"identity-obj-proxy": "^3.0.0",
|
|
22
22
|
"lodash": "^4.17.21",
|
|
23
|
-
"postcss": "^8.4.
|
|
23
|
+
"postcss": "^8.4.49",
|
|
24
24
|
"prettier": "^3.3.3",
|
|
25
25
|
"prop-types": "^15.8.1",
|
|
26
|
-
"sass": "^1.
|
|
27
|
-
"sass-loader": "^16.0.
|
|
26
|
+
"sass": "^1.81.0",
|
|
27
|
+
"sass-loader": "^16.0.3",
|
|
28
28
|
"style-loader": "^4.0.0",
|
|
29
29
|
"styled-components": "^6.1.13",
|
|
30
|
-
"tslib": "^2.
|
|
31
|
-
"typescript": "^5.
|
|
30
|
+
"tslib": "^2.8.1",
|
|
31
|
+
"typescript": "^5.6.3"
|
|
32
32
|
},
|
|
33
33
|
"main": "dist/cjs/index.js",
|
|
34
34
|
"module": "dist/es/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@emotion/react": "^11.13.3",
|
|
43
43
|
"@emotion/serialize": "^1.3.2",
|
|
44
44
|
"@emotion/styled": "^11.13.0",
|
|
45
|
-
"@fortawesome/fontawesome-svg-core": "
|
|
46
|
-
"@fortawesome/free-brands-svg-icons": "
|
|
45
|
+
"@fortawesome/fontawesome-svg-core": "6.6.0",
|
|
46
|
+
"@fortawesome/free-brands-svg-icons": "6.6.0",
|
|
47
47
|
"@fortawesome/pro-regular-svg-icons": "git+https://github.com/actualtysoft/pro-regular-svg-icons.git#6.4.2",
|
|
48
48
|
"@fortawesome/pro-solid-svg-icons": "git+https://github.com/actualtysoft/pro-solid-svg-icons.git#6.4.2",
|
|
49
49
|
"@mui/material": "^5.16.7",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"react": "^18.3.1",
|
|
57
57
|
"react-dom": "^18.3.1",
|
|
58
58
|
"react-google-picker": "^0.1.0",
|
|
59
|
-
"@groupeactual/design-tokens": "1.7.0-beta.
|
|
59
|
+
"@groupeactual/design-tokens": "1.7.0-beta.3"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "rollup -c",
|
|
63
63
|
"build:watch": "rollup --bundleConfigAsCjs -c -w",
|
|
64
64
|
"dev": "npm run build:watch",
|
|
65
|
-
"eslint": "eslint
|
|
65
|
+
"eslint": "eslint --config \"eslint.config.js\" --color \".\"",
|
|
66
66
|
"lint": "npm run eslint"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
useTheme,
|
|
18
18
|
} from '@mui/material';
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import IconButton from '@/components/IconButton';
|
|
21
21
|
|
|
22
22
|
interface Props extends AccordionProps {
|
|
23
23
|
title?: string;
|
|
@@ -64,7 +64,9 @@ const Accordion = ({
|
|
|
64
64
|
{...props}
|
|
65
65
|
>
|
|
66
66
|
<AccordionSummary
|
|
67
|
-
expandIcon={
|
|
67
|
+
expandIcon={
|
|
68
|
+
<IconButton variant="table" size="medium" icon={faChevronDown} />
|
|
69
|
+
}
|
|
68
70
|
sx={{
|
|
69
71
|
fontWeight: 500,
|
|
70
72
|
fontSize: 18,
|
|
@@ -87,6 +89,4 @@ const Accordion = ({
|
|
|
87
89
|
);
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
Accordion.displayName = 'Accordion';
|
|
91
|
-
|
|
92
92
|
export default Accordion;
|
|
@@ -22,7 +22,7 @@ interface Props
|
|
|
22
22
|
label: string;
|
|
23
23
|
prefixIcon?: IconDefinition;
|
|
24
24
|
suffixIcon?: IconDefinition;
|
|
25
|
-
suffixAction?: (
|
|
25
|
+
suffixAction?: (_e: MouseEvent) => void;
|
|
26
26
|
suffixTooltip?: string;
|
|
27
27
|
tooltip?: string;
|
|
28
28
|
maxWidth?: string | number;
|
|
@@ -145,6 +145,4 @@ const Chip = ({
|
|
|
145
145
|
);
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
Chip.displayName = 'Chip';
|
|
149
|
-
|
|
150
148
|
export default Chip;
|
|
@@ -32,6 +32,7 @@ const Datatable = <T extends object>({
|
|
|
32
32
|
withHeader = false,
|
|
33
33
|
withPagination,
|
|
34
34
|
columns,
|
|
35
|
+
isTableLayoutFixed = false,
|
|
35
36
|
...props
|
|
36
37
|
}: Props<T>) => {
|
|
37
38
|
const { trans, limits, withTopPagination, setPage, setLimit } =
|
|
@@ -84,8 +85,14 @@ const Datatable = <T extends object>({
|
|
|
84
85
|
return (
|
|
85
86
|
<StyledDatatable>
|
|
86
87
|
{withTopPagination && <SyncedPagination />}
|
|
87
|
-
<TableContainer
|
|
88
|
-
|
|
88
|
+
<TableContainer
|
|
89
|
+
sx={{ display: 'flex', maxWidth: '100%', overflow: 'auto' }}
|
|
90
|
+
>
|
|
91
|
+
<Table
|
|
92
|
+
sx={{
|
|
93
|
+
tableLayout: isTableLayoutFixed ? 'fixed' : 'auto',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
89
96
|
{withHeader && (
|
|
90
97
|
<TableHead>
|
|
91
98
|
<TableRow data-testid="datatable-head-row">
|
|
@@ -104,8 +111,9 @@ const Datatable = <T extends object>({
|
|
|
104
111
|
key={name}
|
|
105
112
|
variant="head"
|
|
106
113
|
sx={{
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
textOverflow: 'ellipsis',
|
|
107
116
|
width: width,
|
|
108
|
-
maxWidth: width,
|
|
109
117
|
height: hasTopTitle ? '55px' : 'inherit',
|
|
110
118
|
}}
|
|
111
119
|
>
|
|
@@ -171,8 +179,10 @@ const Datatable = <T extends object>({
|
|
|
171
179
|
key={name}
|
|
172
180
|
variant="body"
|
|
173
181
|
sx={{
|
|
182
|
+
overflow: 'hidden',
|
|
183
|
+
textOverflow: 'ellipsis',
|
|
184
|
+
borderColor: 'greyLightDefaultBorder',
|
|
174
185
|
width: width,
|
|
175
|
-
maxWidth: width,
|
|
176
186
|
border:
|
|
177
187
|
'details' in record && record.details
|
|
178
188
|
? '0px'
|
|
@@ -184,8 +194,19 @@ const Datatable = <T extends object>({
|
|
|
184
194
|
))}
|
|
185
195
|
</TableRow>
|
|
186
196
|
{'details' in record && record.details && (
|
|
187
|
-
<TableRow
|
|
188
|
-
|
|
197
|
+
<TableRow
|
|
198
|
+
sx={{
|
|
199
|
+
borderBottom: '1px solid',
|
|
200
|
+
width: record.width,
|
|
201
|
+
borderColor: 'greyLightDefaultBorder',
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
<TableCell
|
|
205
|
+
sx={{
|
|
206
|
+
columnSpan: columns.length,
|
|
207
|
+
borderBottom: 'none',
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
189
210
|
{record.details}
|
|
190
211
|
</TableCell>
|
|
191
212
|
</TableRow>
|
|
@@ -9,8 +9,9 @@ const DatatableCellRender = ({ data }: { data: string }): JSX.Element => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<Tooltip title={data} placement="
|
|
12
|
+
<Tooltip title={data} placement="bottom-start">
|
|
13
13
|
<Text
|
|
14
|
+
variant="body2Regular"
|
|
14
15
|
style={{
|
|
15
16
|
whiteSpace: 'nowrap',
|
|
16
17
|
overflow: 'hidden',
|
|
@@ -14,7 +14,7 @@ export interface PaginationTrans {
|
|
|
14
14
|
|
|
15
15
|
export type ColumnDatatable<T> = {
|
|
16
16
|
name: string;
|
|
17
|
-
render: (
|
|
17
|
+
render: (_record: T) => JSX.Element;
|
|
18
18
|
title?: string;
|
|
19
19
|
topTitle?: string;
|
|
20
20
|
width?: string;
|
|
@@ -30,7 +30,8 @@ type BaseProps<T> = {
|
|
|
30
30
|
withPagination: boolean;
|
|
31
31
|
withHeader?: boolean;
|
|
32
32
|
sortInfo?: SortInfo | null;
|
|
33
|
-
|
|
33
|
+
isTableLayoutFixed?: boolean;
|
|
34
|
+
onSort?: (_info: SortInfo | null) => void;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
type WithoutPaginationProps = {
|
|
@@ -39,8 +40,8 @@ type WithoutPaginationProps = {
|
|
|
39
40
|
|
|
40
41
|
export type PaginationProps = {
|
|
41
42
|
withPagination: true;
|
|
42
|
-
setPage: (
|
|
43
|
-
setLimit: (
|
|
43
|
+
setPage: (_page: number) => void;
|
|
44
|
+
setLimit: (_limit: number) => void;
|
|
44
45
|
trans: PaginationTrans;
|
|
45
46
|
withTopPagination?: boolean;
|
|
46
47
|
limits?: number[];
|
|
@@ -7,8 +7,8 @@ const usePaginationProps = <T extends object>(
|
|
|
7
7
|
let trans = {} as PaginationTrans;
|
|
8
8
|
let limits: number[] = [3, 5, 10, 20];
|
|
9
9
|
let withTopPagination = false;
|
|
10
|
-
let setPage: (
|
|
11
|
-
let setLimit: (
|
|
10
|
+
let setPage: (_page: number) => void = () => {};
|
|
11
|
+
let setLimit: (_limit: number) => void = () => {};
|
|
12
12
|
|
|
13
13
|
if ('trans' in props && props.trans) {
|
|
14
14
|
trans = props.trans;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
faCheck,
|
|
5
|
+
faChevronDown,
|
|
6
|
+
faSearch,
|
|
7
|
+
faTimes,
|
|
8
|
+
} from '@fortawesome/pro-regular-svg-icons';
|
|
9
|
+
import { faCircleX } from '@fortawesome/pro-solid-svg-icons';
|
|
5
10
|
import { AutoCompleteStyle } from '@groupeactual/design-tokens';
|
|
6
11
|
import {
|
|
7
12
|
type AutocompleteProps,
|
|
@@ -21,20 +26,27 @@ import IconProvider from '@/components/IconProvider';
|
|
|
21
26
|
interface AutocompleteMultipleSelectProps<T>
|
|
22
27
|
extends Omit<
|
|
23
28
|
AutocompleteProps<T, true, true, false>,
|
|
24
|
-
|
|
29
|
+
| 'onChange'
|
|
30
|
+
| 'value'
|
|
31
|
+
| 'options'
|
|
32
|
+
| 'renderInput'
|
|
33
|
+
| 'error'
|
|
34
|
+
| 'autocomplete'
|
|
35
|
+
| 'searchIcon'
|
|
25
36
|
> {
|
|
26
37
|
value: T[] | undefined;
|
|
27
38
|
label?: string;
|
|
28
39
|
helperText?: string;
|
|
29
40
|
placeholder?: string;
|
|
30
41
|
options: T[];
|
|
31
|
-
getOptionLabel: (
|
|
32
|
-
getKeyValue: (
|
|
33
|
-
onChange: (
|
|
34
|
-
getOptionDisabled?: (
|
|
42
|
+
getOptionLabel: (_option: T) => string;
|
|
43
|
+
getKeyValue: (_option: T) => string;
|
|
44
|
+
onChange: (_value: T[]) => void;
|
|
45
|
+
getOptionDisabled?: (_option: T) => boolean;
|
|
35
46
|
color?: 'success';
|
|
36
47
|
width?: number | string;
|
|
37
48
|
error?: string;
|
|
49
|
+
searchIcon?: boolean;
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
const AutocompleteMultipleSelect = <T,>({
|
|
@@ -51,6 +63,7 @@ const AutocompleteMultipleSelect = <T,>({
|
|
|
51
63
|
color,
|
|
52
64
|
helperText,
|
|
53
65
|
error,
|
|
66
|
+
searchIcon = false,
|
|
54
67
|
...props
|
|
55
68
|
}: AutocompleteMultipleSelectProps<T>) => {
|
|
56
69
|
const theme = useTheme();
|
|
@@ -104,10 +117,12 @@ const AutocompleteMultipleSelect = <T,>({
|
|
|
104
117
|
const getPopupIcon = useMemo(() => {
|
|
105
118
|
if (color === 'success') {
|
|
106
119
|
return faCheck;
|
|
120
|
+
} else if (searchIcon) {
|
|
121
|
+
return faSearch;
|
|
107
122
|
}
|
|
108
123
|
|
|
109
|
-
return
|
|
110
|
-
}, [color]);
|
|
124
|
+
return faChevronDown;
|
|
125
|
+
}, [color, searchIcon]);
|
|
111
126
|
|
|
112
127
|
const withPlaceholder = !value?.length && !!placeholder;
|
|
113
128
|
const boxRef = useRef<HTMLHeadingElement>(null);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
faCheck,
|
|
5
|
+
faChevronDown,
|
|
6
|
+
faSearch,
|
|
7
|
+
faTimes,
|
|
8
|
+
} from '@fortawesome/pro-regular-svg-icons';
|
|
5
9
|
import { AutoCompleteStyle } from '@groupeactual/design-tokens';
|
|
6
10
|
import {
|
|
7
11
|
Autocomplete,
|
|
@@ -27,7 +31,6 @@ interface Props<T>
|
|
|
27
31
|
| 'renderInput'
|
|
28
32
|
| 'error'
|
|
29
33
|
| 'getOptionLabel'
|
|
30
|
-
| 'autocomplete'
|
|
31
34
|
> {
|
|
32
35
|
label: string;
|
|
33
36
|
options: T[];
|
|
@@ -35,11 +38,12 @@ interface Props<T>
|
|
|
35
38
|
color?: 'success';
|
|
36
39
|
placeholder?: string;
|
|
37
40
|
// * Issue on MUI : MUI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string
|
|
38
|
-
getOptionLabel: (
|
|
39
|
-
onChange: (
|
|
41
|
+
getOptionLabel: (_option: T) => string | null | undefined;
|
|
42
|
+
onChange: (_value: T | null) => void;
|
|
40
43
|
value?: T | null;
|
|
41
44
|
width?: number | string;
|
|
42
45
|
error?: string;
|
|
46
|
+
searchIcon?: boolean;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
const AutoCompleteSingle = <T,>({
|
|
@@ -54,6 +58,7 @@ const AutoCompleteSingle = <T,>({
|
|
|
54
58
|
color,
|
|
55
59
|
helperText,
|
|
56
60
|
error,
|
|
61
|
+
searchIcon = false,
|
|
57
62
|
...props
|
|
58
63
|
}: Props<T>) => {
|
|
59
64
|
const theme = useTheme();
|
|
@@ -112,10 +117,12 @@ const AutoCompleteSingle = <T,>({
|
|
|
112
117
|
const getPopupIcon = useMemo(() => {
|
|
113
118
|
if (color === 'success') {
|
|
114
119
|
return faCheck;
|
|
120
|
+
} else if (searchIcon) {
|
|
121
|
+
return faSearch;
|
|
115
122
|
}
|
|
116
123
|
|
|
117
|
-
return
|
|
118
|
-
}, [color]);
|
|
124
|
+
return faChevronDown;
|
|
125
|
+
}, [color, searchIcon]);
|
|
119
126
|
|
|
120
127
|
return (
|
|
121
128
|
<Box sx={{ width }}>
|
|
@@ -138,7 +145,7 @@ const AutoCompleteSingle = <T,>({
|
|
|
138
145
|
},
|
|
139
146
|
'& .MuiAutocomplete-popupIndicator': { transform: 'none' },
|
|
140
147
|
}}
|
|
141
|
-
getOptionLabel={getOptionLabel as (
|
|
148
|
+
getOptionLabel={getOptionLabel as (_option: T) => string}
|
|
142
149
|
slotProps={{
|
|
143
150
|
paper: {
|
|
144
151
|
sx: {
|
|
@@ -217,6 +224,4 @@ const AutoCompleteSingle = <T,>({
|
|
|
217
224
|
);
|
|
218
225
|
};
|
|
219
226
|
|
|
220
|
-
AutoCompleteSingle.displayName = 'AutocompleteSingle';
|
|
221
|
-
|
|
222
227
|
export default AutoCompleteSingle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { ReactNode, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { faInfoCircle } from '@fortawesome/pro-solid-svg-icons';
|
|
4
4
|
import { CheckboxStyle } from '@groupeactual/design-tokens';
|
|
@@ -9,22 +9,22 @@ import {
|
|
|
9
9
|
FormControl,
|
|
10
10
|
FormControlLabel,
|
|
11
11
|
FormHelperText,
|
|
12
|
-
Typography,
|
|
13
12
|
styled,
|
|
14
13
|
useTheme,
|
|
15
14
|
} from '@mui/material';
|
|
16
15
|
|
|
17
16
|
import IconProvider from '@/components/IconProvider';
|
|
17
|
+
import Text from '@/components/Text';
|
|
18
18
|
import Tooltip from '@/components/Tooltip';
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
name: string;
|
|
22
22
|
value: boolean;
|
|
23
|
-
label:
|
|
23
|
+
label: ReactNode;
|
|
24
24
|
onChange?: (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
_field: string,
|
|
26
|
+
_value: boolean,
|
|
27
|
+
_shouldValidate?: boolean | undefined,
|
|
28
28
|
) => void;
|
|
29
29
|
helperText?: string;
|
|
30
30
|
error?: string;
|
|
@@ -97,25 +97,24 @@ const Checkbox = ({
|
|
|
97
97
|
</Box>
|
|
98
98
|
}
|
|
99
99
|
label={
|
|
100
|
-
<Box
|
|
101
|
-
<
|
|
100
|
+
<Box>
|
|
101
|
+
<Text
|
|
102
|
+
component="span"
|
|
103
|
+
variant="body1"
|
|
104
|
+
className={getLabelClassName}
|
|
105
|
+
>
|
|
102
106
|
{label}
|
|
103
|
-
</
|
|
107
|
+
</Text>
|
|
104
108
|
{infoBubbleContent && (
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
color="#1d91c3"
|
|
115
|
-
/>
|
|
116
|
-
</Box>
|
|
117
|
-
</Tooltip>
|
|
118
|
-
</Box>
|
|
109
|
+
<Tooltip
|
|
110
|
+
title={infoBubbleContent}
|
|
111
|
+
placement={infoBubblePosition}
|
|
112
|
+
sx={{
|
|
113
|
+
ml: '6px',
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<IconProvider icon={faInfoCircle} size="sm" color="blueInfo" />
|
|
117
|
+
</Tooltip>
|
|
119
118
|
)}
|
|
120
119
|
</Box>
|
|
121
120
|
}
|
|
@@ -129,6 +128,4 @@ const Checkbox = ({
|
|
|
129
128
|
);
|
|
130
129
|
};
|
|
131
130
|
|
|
132
|
-
Checkbox.displayName = 'Checkbox';
|
|
133
|
-
|
|
134
131
|
export default Checkbox;
|
|
@@ -12,33 +12,15 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import Checkbox from '@/components/Form/Checkbox';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
label: string;
|
|
17
|
-
value: boolean;
|
|
18
|
-
name: string;
|
|
19
|
-
infoBubbleContent?: string;
|
|
20
|
-
infoBubblePosition?:
|
|
21
|
-
| 'right'
|
|
22
|
-
| 'bottom'
|
|
23
|
-
| 'left'
|
|
24
|
-
| 'top'
|
|
25
|
-
| 'bottom-end'
|
|
26
|
-
| 'bottom-start'
|
|
27
|
-
| 'left-end'
|
|
28
|
-
| 'left-start'
|
|
29
|
-
| 'right-end'
|
|
30
|
-
| 'right-start'
|
|
31
|
-
| 'top-end'
|
|
32
|
-
| 'top-start'
|
|
33
|
-
| undefined;
|
|
34
|
-
}
|
|
15
|
+
import { CheckboxItemType } from './checkboxgroup.interface';
|
|
35
16
|
|
|
36
17
|
interface CheckboxGroupProps {
|
|
37
18
|
label: string;
|
|
38
|
-
options:
|
|
19
|
+
options: CheckboxItemType[];
|
|
39
20
|
disabled?: boolean;
|
|
40
21
|
error?: string;
|
|
41
22
|
helperText?: string;
|
|
23
|
+
onChange?: (_selectedOptions: Record<string, boolean>) => void;
|
|
42
24
|
}
|
|
43
25
|
|
|
44
26
|
const CheckboxGroup = ({
|
|
@@ -47,6 +29,7 @@ const CheckboxGroup = ({
|
|
|
47
29
|
disabled,
|
|
48
30
|
error,
|
|
49
31
|
helperText,
|
|
32
|
+
onChange,
|
|
50
33
|
}: CheckboxGroupProps) => {
|
|
51
34
|
const theme = useTheme();
|
|
52
35
|
const StyledCheckboxGroupForm = useMemo(
|
|
@@ -56,10 +39,12 @@ const CheckboxGroup = ({
|
|
|
56
39
|
const [selectedOptions, setSelectedOptions] = useState({});
|
|
57
40
|
|
|
58
41
|
const handleChange = (label: string, isChecked: boolean) => {
|
|
59
|
-
|
|
42
|
+
const updatedOptions = {
|
|
60
43
|
...selectedOptions,
|
|
61
44
|
[label]: isChecked,
|
|
62
|
-
}
|
|
45
|
+
};
|
|
46
|
+
setSelectedOptions(updatedOptions);
|
|
47
|
+
onChange?.(updatedOptions);
|
|
63
48
|
};
|
|
64
49
|
|
|
65
50
|
const getLegendClassName = useMemo(() => {
|
|
@@ -97,6 +82,4 @@ const CheckboxGroup = ({
|
|
|
97
82
|
);
|
|
98
83
|
};
|
|
99
84
|
|
|
100
|
-
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
101
|
-
|
|
102
85
|
export default CheckboxGroup;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface CheckboxItemType {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: boolean;
|
|
6
|
+
name: string;
|
|
7
|
+
infoBubbleContent?: string;
|
|
8
|
+
infoBubblePosition?:
|
|
9
|
+
| 'right'
|
|
10
|
+
| 'bottom'
|
|
11
|
+
| 'left'
|
|
12
|
+
| 'top'
|
|
13
|
+
| 'bottom-end'
|
|
14
|
+
| 'bottom-start'
|
|
15
|
+
| 'left-end'
|
|
16
|
+
| 'left-start'
|
|
17
|
+
| 'right-end'
|
|
18
|
+
| 'right-start'
|
|
19
|
+
| 'top-end'
|
|
20
|
+
| 'top-start'
|
|
21
|
+
| undefined;
|
|
22
|
+
}
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
faAngleLeft,
|
|
5
5
|
faAngleRight,
|
|
6
6
|
faCalendarDay,
|
|
7
|
+
faCheck,
|
|
7
8
|
} from '@fortawesome/pro-regular-svg-icons';
|
|
8
|
-
import { faCaretDown
|
|
9
|
+
import { faCaretDown } from '@fortawesome/pro-solid-svg-icons';
|
|
9
10
|
import { DatePickerStyle } from '@groupeactual/design-tokens';
|
|
10
11
|
import {
|
|
11
12
|
Box,
|
|
@@ -29,7 +30,7 @@ import IconProvider from '@/components/IconProvider';
|
|
|
29
30
|
interface Props<T extends Dayjs>
|
|
30
31
|
extends Omit<DatePickerProps<T>, 'onChange' | 'width'> {
|
|
31
32
|
value: T | null | undefined;
|
|
32
|
-
onChange: (
|
|
33
|
+
onChange: (_value: T | null | undefined) => void;
|
|
33
34
|
error?: string;
|
|
34
35
|
success?: boolean;
|
|
35
36
|
helperText?: string;
|
|
@@ -114,6 +115,11 @@ const DatePicker = <T extends Dayjs>({
|
|
|
114
115
|
),
|
|
115
116
|
}}
|
|
116
117
|
slotProps={{
|
|
118
|
+
desktopPaper: {
|
|
119
|
+
sx: {
|
|
120
|
+
boxShadow: '0px 2px 10px 0px #2727271F',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
117
123
|
textField: {
|
|
118
124
|
variant: 'outlined',
|
|
119
125
|
error: !!error,
|
|
@@ -133,7 +139,13 @@ const DatePicker = <T extends Dayjs>({
|
|
|
133
139
|
},
|
|
134
140
|
clearButton: {
|
|
135
141
|
disableRipple: true,
|
|
136
|
-
sx: {
|
|
142
|
+
sx: {
|
|
143
|
+
px: 0,
|
|
144
|
+
'.MuiSvgIcon-root': {
|
|
145
|
+
width: 18,
|
|
146
|
+
height: 18,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
137
149
|
},
|
|
138
150
|
}}
|
|
139
151
|
{...props}
|