@groupeactual/ui-kit 1.7.10 → 2.0.0-beta.1
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 +15095 -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 +88 -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple template for a custom React component library",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -11,35 +11,38 @@
|
|
|
11
11
|
"src"
|
|
12
12
|
],
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@types/google.picker": "^0.0.
|
|
14
|
+
"@types/google.picker": "^0.0.50",
|
|
15
15
|
"@types/styled-components": "^5.1.34",
|
|
16
|
-
"framer-motion": "^
|
|
17
|
-
"eslint": "^9.
|
|
18
|
-
"eslint-config-prettier": "^
|
|
16
|
+
"framer-motion": "^12.6.3",
|
|
17
|
+
"eslint": "^9.24.0",
|
|
18
|
+
"eslint-config-prettier": "^10.1.2",
|
|
19
19
|
"eslint-plugin-import": "^2.31.0",
|
|
20
|
-
"eslint-plugin-jest": "^28.
|
|
20
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
21
21
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
22
|
-
"eslint-plugin-n": "^17.
|
|
23
|
-
"eslint-plugin-prettier": "^5.2.
|
|
22
|
+
"eslint-plugin-n": "^17.17.0",
|
|
23
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
24
24
|
"eslint-plugin-promise": "^7.2.1",
|
|
25
|
-
"eslint-plugin-react": "^7.37.
|
|
26
|
-
"eslint-plugin-react-hooks": "^5.
|
|
27
|
-
"prettier": "^3.
|
|
25
|
+
"eslint-plugin-react": "^7.37.5",
|
|
26
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
27
|
+
"prettier": "^3.5.3",
|
|
28
|
+
"typescript": "5.7.3"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@mui/material": "
|
|
31
|
-
"@mui/system": "
|
|
32
|
-
"@mui/styled-engine": "
|
|
31
|
+
"@mui/material": "7.0.2",
|
|
32
|
+
"@mui/system": "7.0.2",
|
|
33
|
+
"@mui/styled-engine": "7.0.2",
|
|
33
34
|
"@mui/x-date-pickers": "7.15.0",
|
|
34
35
|
"@mui/x-date-pickers-pro": "7.15.0",
|
|
35
|
-
"styled-components": "^6.1.
|
|
36
|
-
"@groupeactual/design-tokens": "
|
|
36
|
+
"styled-components": "^6.1.17",
|
|
37
|
+
"@groupeactual/design-tokens": "2.0.0-beta.1"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"build": "rollup -c",
|
|
40
41
|
"build:watch": "rollup --bundleConfigAsCjs -c -w",
|
|
41
42
|
"dev": "npm run build:watch",
|
|
42
43
|
"eslint": "eslint --config \"eslint.config.js\" --color \".\" --max-warnings=0",
|
|
43
|
-
"lint": "npm run eslint"
|
|
44
|
+
"lint": "npm run eslint",
|
|
45
|
+
"prettier:check": "prettier --check .",
|
|
46
|
+
"prettier:format": "prettier --write ."
|
|
44
47
|
}
|
|
45
48
|
}
|
|
@@ -1,60 +1,45 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
PropsWithChildren,
|
|
3
|
-
createContext,
|
|
4
|
-
useContext,
|
|
5
|
-
useState,
|
|
6
|
-
} from 'react';
|
|
1
|
+
import React, { PropsWithChildren, createContext, useContext } from 'react';
|
|
7
2
|
|
|
8
|
-
import {
|
|
9
|
-
import { ThemeProvider, createTheme } from '@mui/material';
|
|
10
|
-
|
|
11
|
-
// Deux themes pour le moment :
|
|
12
|
-
// Default = Theme backoffice Material
|
|
13
|
-
// Ep = Espace personnel
|
|
14
|
-
type Theme = 'Default' | 'Ep';
|
|
3
|
+
import { Theme, theme } from '@groupeactual/design-tokens';
|
|
4
|
+
import { PaletteMode, ThemeProvider, createTheme } from '@mui/material';
|
|
15
5
|
|
|
16
6
|
export interface DesignSystemContextValues {
|
|
17
|
-
isDarkTheme: boolean;
|
|
18
7
|
themeName: Theme;
|
|
19
|
-
|
|
8
|
+
mode: PaletteMode;
|
|
20
9
|
}
|
|
21
10
|
|
|
22
11
|
export const DesignSystemContext = createContext<DesignSystemContextValues>({
|
|
23
|
-
|
|
24
|
-
themeName: '
|
|
25
|
-
toggleDarkTheme: () => {
|
|
26
|
-
return;
|
|
27
|
-
},
|
|
12
|
+
mode: 'light',
|
|
13
|
+
themeName: 'Interne',
|
|
28
14
|
});
|
|
29
15
|
|
|
30
16
|
interface Props {
|
|
31
|
-
|
|
17
|
+
themeName?: Theme;
|
|
18
|
+
mode?: PaletteMode;
|
|
32
19
|
}
|
|
33
20
|
|
|
34
21
|
const MaterialThemeProvider = ({ children }: PropsWithChildren<unknown>) => {
|
|
35
|
-
const { themeName } =
|
|
22
|
+
const { themeName, mode } =
|
|
36
23
|
useContext<DesignSystemContextValues>(DesignSystemContext);
|
|
37
|
-
const { muiTokens } = useMaterialThemeTokens(themeName);
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
const theme = createTheme(muiTokens as any);
|
|
40
24
|
|
|
41
|
-
|
|
25
|
+
const designSystemTheme = theme(themeName, mode);
|
|
26
|
+
const muiTheme = createTheme({
|
|
27
|
+
cssVariables: {
|
|
28
|
+
disableCssColorScheme: true,
|
|
29
|
+
},
|
|
30
|
+
...designSystemTheme,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return <ThemeProvider theme={muiTheme}>{children}</ThemeProvider>;
|
|
42
34
|
};
|
|
43
35
|
|
|
44
36
|
const DesignSystemProvider = ({
|
|
45
37
|
children,
|
|
46
|
-
|
|
38
|
+
themeName = 'Interne',
|
|
39
|
+
mode = 'light',
|
|
47
40
|
}: PropsWithChildren<Props>) => {
|
|
48
|
-
const [isDarkTheme, setIsDarkTheme] = useState(false);
|
|
49
|
-
|
|
50
|
-
const toggleDarkTheme = (): void => {
|
|
51
|
-
setIsDarkTheme(!isDarkTheme);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
41
|
return (
|
|
55
|
-
<DesignSystemContext.Provider
|
|
56
|
-
value={{ isDarkTheme, themeName, toggleDarkTheme }}
|
|
57
|
-
>
|
|
42
|
+
<DesignSystemContext.Provider value={{ themeName, mode }}>
|
|
58
43
|
<MaterialThemeProvider>{children}</MaterialThemeProvider>
|
|
59
44
|
</DesignSystemContext.Provider>
|
|
60
45
|
);
|
|
@@ -2,22 +2,19 @@ import React, {
|
|
|
2
2
|
MouseEventHandler,
|
|
3
3
|
ReactNode,
|
|
4
4
|
useEffect,
|
|
5
|
-
useMemo,
|
|
6
5
|
useState,
|
|
7
6
|
} from 'react';
|
|
8
7
|
|
|
9
8
|
import { faChevronDown } from '@fortawesome/pro-regular-svg-icons';
|
|
10
|
-
import { AccordionStyle } from '@groupeactual/design-tokens';
|
|
11
9
|
import {
|
|
12
10
|
AccordionDetails,
|
|
13
11
|
Accordion as AccordionMui,
|
|
14
12
|
AccordionProps,
|
|
15
13
|
AccordionSummary,
|
|
16
|
-
styled,
|
|
17
|
-
useTheme,
|
|
18
14
|
} from '@mui/material';
|
|
19
15
|
|
|
20
16
|
import IconButton from '@/components/IconButton';
|
|
17
|
+
import Text from '@/components/Text';
|
|
21
18
|
|
|
22
19
|
interface Props extends AccordionProps {
|
|
23
20
|
title?: string;
|
|
@@ -28,65 +25,50 @@ interface Props extends AccordionProps {
|
|
|
28
25
|
onClick?: MouseEventHandler;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
const Accordion = (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...props
|
|
38
|
-
}: Props) => {
|
|
39
|
-
const theme = useTheme();
|
|
40
|
-
const StyledAccordion = useMemo(
|
|
41
|
-
() => styled(AccordionMui)(AccordionStyle(theme)),
|
|
42
|
-
[theme],
|
|
43
|
-
);
|
|
28
|
+
const Accordion = React.forwardRef<HTMLDivElement, Props>(
|
|
29
|
+
(
|
|
30
|
+
{ title, summaryHeight, expanded = false, children, onClick, ...props },
|
|
31
|
+
ref,
|
|
32
|
+
) => {
|
|
33
|
+
const [internalExpanded, setInternalExpanded] = useState(expanded);
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (expanded !== internalExpanded) {
|
|
37
|
+
setInternalExpanded(expanded);
|
|
38
|
+
}
|
|
39
|
+
}, [expanded]);
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
setInternalExpanded(!internalExpanded);
|
|
59
|
-
if (onClick) {
|
|
60
|
-
onClick(e);
|
|
41
|
+
return (
|
|
42
|
+
<AccordionMui
|
|
43
|
+
ref={ref}
|
|
44
|
+
data-testid="ds-accordion"
|
|
45
|
+
expanded={internalExpanded}
|
|
46
|
+
onClick={(e) => {
|
|
47
|
+
if (!props.disabled) {
|
|
48
|
+
setInternalExpanded(!internalExpanded);
|
|
49
|
+
if (onClick) {
|
|
50
|
+
onClick(e);
|
|
51
|
+
}
|
|
61
52
|
}
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
{...props}
|
|
65
|
-
>
|
|
66
|
-
<AccordionSummary
|
|
67
|
-
expandIcon={
|
|
68
|
-
<IconButton variant="table" size="medium" icon={faChevronDown} />
|
|
69
|
-
}
|
|
70
|
-
sx={{
|
|
71
|
-
fontWeight: 500,
|
|
72
|
-
fontSize: 18,
|
|
73
|
-
lineHeight: 21,
|
|
74
|
-
height: summaryHeight || 60,
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
{title}
|
|
78
|
-
</AccordionSummary>
|
|
79
|
-
<AccordionDetails
|
|
80
|
-
sx={{
|
|
81
|
-
backgroundColor: theme.palette.greyXLight,
|
|
82
|
-
borderTop: '1px solid',
|
|
83
|
-
borderColor: theme.palette.greyLightDefaultBorder,
|
|
84
53
|
}}
|
|
54
|
+
{...props}
|
|
85
55
|
>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
56
|
+
<AccordionSummary
|
|
57
|
+
expandIcon={
|
|
58
|
+
<IconButton variant="plain" size="medium" icon={faChevronDown} />
|
|
59
|
+
}
|
|
60
|
+
sx={{
|
|
61
|
+
height: summaryHeight || 60,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Text variant="h4">{title}</Text>
|
|
65
|
+
</AccordionSummary>
|
|
66
|
+
<AccordionDetails>{children}</AccordionDetails>
|
|
67
|
+
</AccordionMui>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
Accordion.displayName = 'Accordion';
|
|
91
73
|
|
|
92
74
|
export default Accordion;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { faBell, faTimes } from '@fortawesome/pro-solid-svg-icons';
|
|
4
|
-
import {
|
|
5
|
-
import { Alert, AlertProps, styled, useTheme } from '@mui/material';
|
|
4
|
+
import { Alert, AlertProps } from '@mui/material';
|
|
6
5
|
|
|
7
6
|
import IconProvider from '@/components/IconProvider';
|
|
8
7
|
|
|
@@ -11,23 +10,23 @@ interface Props extends AlertProps {
|
|
|
11
10
|
onClose?: () => void;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const BannerNotification =
|
|
15
|
-
|
|
13
|
+
const BannerNotification = React.forwardRef<HTMLDivElement, Props>(
|
|
14
|
+
({ text, severity, onClose }, ref) => {
|
|
15
|
+
return (
|
|
16
|
+
<Alert
|
|
17
|
+
ref={ref}
|
|
18
|
+
data-testid="ds-banner-notification"
|
|
19
|
+
className="MuiAlertBannerNotification"
|
|
20
|
+
severity={severity}
|
|
21
|
+
icon={<IconProvider icon={faBell} />}
|
|
22
|
+
action={onClose && <IconProvider icon={faTimes} onClick={onClose} />}
|
|
23
|
+
>
|
|
24
|
+
{text}
|
|
25
|
+
</Alert>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
);
|
|
16
29
|
|
|
17
|
-
|
|
18
|
-
() => styled(Alert)(BannerNotificationStyle(theme)),
|
|
19
|
-
[],
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<StyledBannerNotification
|
|
24
|
-
severity={severity}
|
|
25
|
-
icon={<IconProvider icon={faBell} />}
|
|
26
|
-
action={onClose && <IconProvider icon={faTimes} onClick={onClose} />}
|
|
27
|
-
>
|
|
28
|
-
{text}
|
|
29
|
-
</StyledBannerNotification>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
30
|
+
BannerNotification.displayName = 'BannerNotification';
|
|
32
31
|
|
|
33
32
|
export default BannerNotification;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
Breadcrumbs as BreadcrumbsMui,
|
|
6
|
-
BreadcrumbsProps,
|
|
7
|
-
styled,
|
|
8
|
-
useTheme,
|
|
9
|
-
} from '@mui/material';
|
|
3
|
+
import { Breadcrumbs as BreadcrumbsMui, BreadcrumbsProps } from '@mui/material';
|
|
10
4
|
|
|
11
5
|
import Link from '@/components/Link';
|
|
12
6
|
import Text from '@/components/Text';
|
|
@@ -17,29 +11,39 @@ interface LinkItem {
|
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
interface Props extends BreadcrumbsProps {
|
|
20
|
-
|
|
14
|
+
currentPage: string;
|
|
21
15
|
links?: LinkItem[];
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
const Breadcrumbs =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const Breadcrumbs = React.forwardRef<HTMLDivElement, Props>(
|
|
19
|
+
({ currentPage, links, ...props }, ref) => {
|
|
20
|
+
return (
|
|
21
|
+
<BreadcrumbsMui
|
|
22
|
+
aria-label="breadcrumb"
|
|
23
|
+
{...props}
|
|
24
|
+
ref={ref}
|
|
25
|
+
data-testid="ds-breadcrumbs"
|
|
26
|
+
>
|
|
27
|
+
{links?.map((link, index) => (
|
|
28
|
+
<div key={index} data-testid={`ds-breadcrumb-link-${index}`}>
|
|
29
|
+
<Link
|
|
30
|
+
key={index}
|
|
31
|
+
href={link.link}
|
|
32
|
+
variant="link1"
|
|
33
|
+
data-testid={`ds-link-${index}`}
|
|
34
|
+
>
|
|
35
|
+
{link.title}
|
|
36
|
+
</Link>
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
<Text variant="body1" data-testid="ds-current-page">
|
|
40
|
+
{currentPage}
|
|
41
|
+
</Text>
|
|
42
|
+
</BreadcrumbsMui>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
30
46
|
|
|
31
|
-
|
|
32
|
-
<StyledBreadcrumbs aria-label="breadcrumb" {...props}>
|
|
33
|
-
{links?.map((link, index) => (
|
|
34
|
-
<div key={index}>
|
|
35
|
-
<Link key={index} href={link.link} variant="link1">
|
|
36
|
-
{link.title}
|
|
37
|
-
</Link>
|
|
38
|
-
</div>
|
|
39
|
-
))}
|
|
40
|
-
<Text variant="body1">{PageName}</Text>
|
|
41
|
-
</StyledBreadcrumbs>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
47
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
44
48
|
|
|
45
49
|
export default Breadcrumbs;
|
|
@@ -1,30 +1,83 @@
|
|
|
1
|
-
import React, { ReactNode
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import { ButtonStyle } from '@groupeactual/design-tokens';
|
|
4
3
|
import {
|
|
5
4
|
Button as ButtonMUI,
|
|
6
5
|
ButtonProps,
|
|
7
|
-
|
|
8
|
-
useTheme,
|
|
6
|
+
CircularProgress,
|
|
9
7
|
} from '@mui/material';
|
|
10
8
|
|
|
9
|
+
type Variant = 'contained' | 'outlined' | 'tertiary' | 'text';
|
|
10
|
+
type Color = 'primary' | 'secondary';
|
|
11
|
+
|
|
11
12
|
interface Props extends Omit<ButtonProps, 'variant' | 'children'> {
|
|
12
|
-
variant?: 'primary' | 'secondary';
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'destructive';
|
|
13
14
|
children?: ReactNode;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const isDisableRipple = (variant: Props['variant']): boolean => {
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case 'primary':
|
|
20
|
+
case 'secondary':
|
|
21
|
+
case 'tertiary':
|
|
22
|
+
case 'destructive':
|
|
23
|
+
return false;
|
|
24
|
+
default:
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const getVariant = (variant: Props['variant']): Variant => {
|
|
30
|
+
switch (variant) {
|
|
31
|
+
case 'primary':
|
|
32
|
+
return 'contained';
|
|
33
|
+
case 'secondary':
|
|
34
|
+
return 'outlined';
|
|
35
|
+
case 'tertiary':
|
|
36
|
+
return 'tertiary';
|
|
37
|
+
case 'destructive':
|
|
38
|
+
return 'contained';
|
|
39
|
+
default:
|
|
40
|
+
return 'contained';
|
|
41
|
+
}
|
|
28
42
|
};
|
|
29
43
|
|
|
44
|
+
const getColor = (variant: Props['variant']): Color => {
|
|
45
|
+
switch (variant) {
|
|
46
|
+
case 'destructive':
|
|
47
|
+
return 'secondary';
|
|
48
|
+
default:
|
|
49
|
+
return 'primary';
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const Button = React.forwardRef<HTMLButtonElement, Props>(
|
|
54
|
+
({ variant, children, ...props }, ref) => {
|
|
55
|
+
return (
|
|
56
|
+
<ButtonMUI
|
|
57
|
+
variant={getVariant(variant)}
|
|
58
|
+
color={getColor(variant)}
|
|
59
|
+
disableRipple={isDisableRipple(variant)}
|
|
60
|
+
ref={ref}
|
|
61
|
+
{...props}
|
|
62
|
+
loadingPosition="start"
|
|
63
|
+
loadingIndicator={
|
|
64
|
+
<CircularProgress
|
|
65
|
+
sx={{
|
|
66
|
+
ml: '2px',
|
|
67
|
+
}}
|
|
68
|
+
color="inherit"
|
|
69
|
+
size={14}
|
|
70
|
+
thickness={4}
|
|
71
|
+
/>
|
|
72
|
+
}
|
|
73
|
+
data-testid="ds-button"
|
|
74
|
+
>
|
|
75
|
+
{children}
|
|
76
|
+
</ButtonMUI>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
Button.displayName = 'Button';
|
|
82
|
+
|
|
30
83
|
export default Button;
|