@groupeactual/ui-kit 0.1.7 → 0.1.9
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/DesignSystemProvider.d.ts +8 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +40081 -39158
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/material-ui-components/Button/Button.d.ts +5 -0
- package/dist/cjs/material-ui-components/Button/index.d.ts +1 -0
- package/dist/cjs/material-ui-components/Form/Checkbox/Checkbox.d.ts +12 -0
- package/dist/cjs/material-ui-components/Form/Checkbox/index.d.ts +1 -0
- package/dist/cjs/material-ui-components/Form/TextInput/TextInput.d.ts +15 -0
- package/dist/cjs/material-ui-components/Form/TextInput/index.d.ts +1 -0
- package/dist/cjs/material-ui-components/Heading/Heading.d.ts +6 -5
- package/dist/cjs/material-ui-components/Text/Text.d.ts +8 -0
- package/dist/cjs/material-ui-components/Text/index.d.ts +1 -0
- package/dist/cjs/material-ui-components/index.d.ts +5 -2
- package/dist/cjs/mui-base-components/index.d.ts +2 -1
- package/dist/esm/DesignSystemProvider.d.ts +8 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +40079 -39159
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/material-ui-components/Button/Button.d.ts +5 -0
- package/dist/esm/material-ui-components/Button/index.d.ts +1 -0
- package/dist/esm/material-ui-components/Form/Checkbox/Checkbox.d.ts +12 -0
- package/dist/esm/material-ui-components/Form/Checkbox/index.d.ts +1 -0
- package/dist/esm/material-ui-components/Form/TextInput/TextInput.d.ts +15 -0
- package/dist/esm/material-ui-components/Form/TextInput/index.d.ts +1 -0
- package/dist/esm/material-ui-components/Heading/Heading.d.ts +6 -5
- package/dist/esm/material-ui-components/Text/Text.d.ts +8 -0
- package/dist/esm/material-ui-components/Text/index.d.ts +1 -0
- package/dist/esm/material-ui-components/index.d.ts +5 -2
- package/dist/esm/mui-base-components/index.d.ts +2 -1
- package/dist/index.d.ts +46 -12
- package/package.json +15 -1
- package/src/DesignSystemProvider.tsx +49 -9
- package/src/index.ts +5 -1
- package/src/material-ui-components/Button/Button.tsx +16 -0
- package/src/material-ui-components/Button/index.ts +1 -0
- package/src/material-ui-components/Form/Checkbox/Checkbox.tsx +62 -0
- package/src/material-ui-components/Form/Checkbox/index.ts +1 -0
- package/src/material-ui-components/Form/TextInput/TextInput.tsx +66 -0
- package/src/material-ui-components/Form/TextInput/index.ts +1 -0
- package/src/material-ui-components/Heading/Heading.tsx +6 -28
- package/src/material-ui-components/Text/Text.tsx +10 -0
- package/src/material-ui-components/Text/index.ts +1 -0
- package/src/material-ui-components/index.ts +5 -2
- package/src/mui-base-components/index.ts +1 -1
- package/dist/cjs/material-ui-components/TextField/TextField.d.ts +0 -4
- package/dist/cjs/material-ui-components/TextField/index.d.ts +0 -1
- package/dist/cjs/mui-base-components/Button/Button.d.ts +0 -6
- package/dist/cjs/mui-base-components/Button/index.d.ts +0 -1
- package/dist/esm/material-ui-components/TextField/TextField.d.ts +0 -4
- package/dist/esm/material-ui-components/TextField/index.d.ts +0 -1
- package/dist/esm/mui-base-components/Button/Button.d.ts +0 -6
- package/dist/esm/mui-base-components/Button/index.d.ts +0 -1
- package/src/material-ui-components/TextField/TextField.tsx +0 -8
- package/src/material-ui-components/TextField/index.ts +0 -1
- package/src/mui-base-components/Button/Button.tsx +0 -44
- package/src/mui-base-components/Button/index.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Button';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SxProps, Theme } from '@mui/system';
|
|
3
|
+
interface Props {
|
|
4
|
+
error?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
onChange: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
|
|
9
|
+
sx: SxProps<Theme>;
|
|
10
|
+
}
|
|
11
|
+
declare const Checkbox: ({ name, value, error, label, onChange, sx }: Props) => JSX.Element;
|
|
12
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Checkbox';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChangeEventHandler, FocusEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
interface Props {
|
|
4
|
+
error?: string;
|
|
5
|
+
onBlur: FocusEventHandler<unknown>;
|
|
6
|
+
onChange: ChangeEventHandler<unknown>;
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
name: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
endAdornment?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const TextInput: ({ name, value, error, onBlur, onChange, label, disabled, endAdornment, placeholder, ...props }: Omit<TextFieldProps, 'error'> & Props) => JSX.Element;
|
|
15
|
+
export default TextInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextInput';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { TypographyProps } from
|
|
3
|
-
interface Props extends TypographyProps {
|
|
4
|
-
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
interface Props extends Omit<TypographyProps, 'paragraph'> {
|
|
4
|
+
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2';
|
|
5
|
+
component?: string;
|
|
5
6
|
}
|
|
6
|
-
declare const ActHeading: (
|
|
7
|
+
declare const ActHeading: (props: Props) => JSX.Element;
|
|
7
8
|
export default ActHeading;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
interface Props extends TypographyProps {
|
|
4
|
+
variant?: 'body1' | 'body2' | 'caption';
|
|
5
|
+
component?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ActText: (props: Props) => JSX.Element;
|
|
8
|
+
export default ActText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Text';
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as ActHeading } from
|
|
1
|
+
export { default as ActText } from './Text';
|
|
2
|
+
export { default as ActHeading } from './Heading';
|
|
3
|
+
export { default as ActButton } from './Button';
|
|
4
|
+
export { default as ActTextInput } from './Form/TextInput';
|
|
5
|
+
export { default as ActCheckbox } from './Form/Checkbox';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TypographyProps, ButtonProps } from '@mui/material';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { FocusEventHandler, ChangeEventHandler, ReactNode, PropsWithChildren } from 'react';
|
|
2
5
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
import
|
|
4
|
-
import { TypographyProps } from '@mui/material';
|
|
6
|
+
import { SxProps, Theme } from '@mui/system';
|
|
5
7
|
|
|
6
8
|
interface ActTagProps {
|
|
7
9
|
label?: string;
|
|
@@ -9,21 +11,53 @@ interface ActTagProps {
|
|
|
9
11
|
}
|
|
10
12
|
declare const ActTag: (props: ActTagProps) => JSX.Element;
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
interface Props$4 extends TypographyProps {
|
|
15
|
+
variant?: 'body1' | 'body2' | 'caption';
|
|
16
|
+
component?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const ActText: (props: Props$4) => JSX.Element;
|
|
13
19
|
|
|
14
|
-
interface Props$
|
|
15
|
-
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
20
|
+
interface Props$3 extends Omit<TypographyProps, 'paragraph'> {
|
|
21
|
+
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2';
|
|
22
|
+
component?: string;
|
|
16
23
|
}
|
|
17
|
-
declare const ActHeading: (
|
|
24
|
+
declare const ActHeading: (props: Props$3) => JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare type ActButtonType = (props: ButtonProps) => JSX.Element | null;
|
|
27
|
+
declare const ActButton: ActButtonType;
|
|
18
28
|
|
|
19
|
-
interface
|
|
20
|
-
|
|
29
|
+
interface Props$2 {
|
|
30
|
+
error?: string;
|
|
31
|
+
onBlur: FocusEventHandler<unknown>;
|
|
32
|
+
onChange: ChangeEventHandler<unknown>;
|
|
33
|
+
label: string;
|
|
34
|
+
value: string;
|
|
35
|
+
name: string;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
endAdornment?: ReactNode;
|
|
21
39
|
}
|
|
22
|
-
declare const
|
|
40
|
+
declare const TextInput: ({ name, value, error, onBlur, onChange, label, disabled, endAdornment, placeholder, ...props }: Omit<TextFieldProps, 'error'> & Props$2) => JSX.Element;
|
|
23
41
|
|
|
24
|
-
interface Props {
|
|
42
|
+
interface Props$1 {
|
|
43
|
+
error?: string;
|
|
44
|
+
label: string;
|
|
45
|
+
value: boolean;
|
|
25
46
|
name: string;
|
|
47
|
+
onChange: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
|
|
48
|
+
sx: SxProps<Theme>;
|
|
49
|
+
}
|
|
50
|
+
declare const Checkbox: ({ name, value, error, label, onChange, sx }: Props$1) => JSX.Element;
|
|
51
|
+
|
|
52
|
+
interface DesignSystemContextValues {
|
|
53
|
+
isDarkTheme: boolean;
|
|
54
|
+
themeName: 'default' | 'lucie';
|
|
55
|
+
toggleDarkTheme(): void;
|
|
56
|
+
}
|
|
57
|
+
declare const DesignSystemContext: react.Context<DesignSystemContextValues>;
|
|
58
|
+
interface Props {
|
|
59
|
+
name?: DesignSystemContextValues['themeName'];
|
|
26
60
|
}
|
|
27
|
-
declare const DesignSystemProvider: ({ children, name
|
|
61
|
+
declare const DesignSystemProvider: ({ children, name }: PropsWithChildren<Props>) => JSX.Element;
|
|
28
62
|
|
|
29
|
-
export { ActButton, ActHeading, ActTag,
|
|
63
|
+
export { ActButton, Checkbox as ActCheckbox, ActHeading, ActTag, ActText, TextInput as ActTextInput, DesignSystemContext, DesignSystemContextValues, DesignSystemProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "A simple template for a custom React component library",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rollup -c",
|
|
@@ -17,11 +17,24 @@
|
|
|
17
17
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
18
18
|
"@rollup/plugin-typescript": "^8.3.4",
|
|
19
19
|
"@types/react": "^18.0.15",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
21
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
20
22
|
"babel-loader": "^8.2.5",
|
|
21
23
|
"clsx": "^1.2.1",
|
|
22
24
|
"css-loader": "^6.7.1",
|
|
25
|
+
"eslint": "^8.0.1",
|
|
26
|
+
"eslint-config-prettier": "^8.5.0",
|
|
27
|
+
"eslint-config-standard-with-typescript": "^23.0.0",
|
|
28
|
+
"eslint-plugin-import": "^2.25.2",
|
|
29
|
+
"eslint-plugin-jest": "^27.0.4",
|
|
30
|
+
"eslint-plugin-n": "^15.0.0",
|
|
31
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
32
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
33
|
+
"eslint-plugin-react": "^7.31.8",
|
|
34
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
23
35
|
"html-webpack-plugin": "^5.5.0",
|
|
24
36
|
"identity-obj-proxy": "^3.0.0",
|
|
37
|
+
"prettier": "^2.7.1",
|
|
25
38
|
"rollup": "^2.77.2",
|
|
26
39
|
"rollup-plugin-dts": "^4.2.2",
|
|
27
40
|
"rollup-plugin-postcss": "^4.0.2",
|
|
@@ -46,6 +59,7 @@
|
|
|
46
59
|
"@mui/material": "^5.10.0",
|
|
47
60
|
"@mui/system": "^5.9.3",
|
|
48
61
|
"@types/styled-components": "^5.1.25",
|
|
62
|
+
"formik": "^2.2.9",
|
|
49
63
|
"framer-motion": "^6.5.1",
|
|
50
64
|
"postcss": "^8.4.14",
|
|
51
65
|
"styled-components": "^5.3.5",
|
|
@@ -1,20 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
PropsWithChildren,
|
|
3
|
+
useMemo,
|
|
4
|
+
useState,
|
|
5
|
+
createContext,
|
|
6
|
+
useContext
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { useThemeTokens } from '@groupeactual/design-tokens';
|
|
9
|
+
import { ThemeProvider } from '@emotion/react';
|
|
10
|
+
import { createTheme } from '@mui/material';
|
|
11
|
+
|
|
12
|
+
export interface DesignSystemContextValues {
|
|
13
|
+
isDarkTheme: boolean;
|
|
14
|
+
themeName: 'default' | 'lucie';
|
|
15
|
+
toggleDarkTheme(): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const DesignSystemContext = createContext<DesignSystemContextValues>({
|
|
19
|
+
isDarkTheme: false,
|
|
20
|
+
themeName: 'default',
|
|
21
|
+
toggleDarkTheme: () => {}
|
|
22
|
+
});
|
|
3
23
|
|
|
4
24
|
interface Props {
|
|
5
|
-
name
|
|
25
|
+
name?: DesignSystemContextValues['themeName'];
|
|
6
26
|
}
|
|
7
27
|
|
|
8
|
-
const
|
|
28
|
+
const MaterialThemeProvider = ({ children }: PropsWithChildren<unknown>) => {
|
|
29
|
+
const { themeName } =
|
|
30
|
+
useContext<DesignSystemContextValues>(DesignSystemContext);
|
|
31
|
+
const { materialUIThemeTokens } = useThemeTokens(themeName);
|
|
32
|
+
|
|
33
|
+
const theme = useMemo(
|
|
34
|
+
() => createTheme(materialUIThemeTokens),
|
|
35
|
+
[materialUIThemeTokens]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const DesignSystemProvider = ({
|
|
42
|
+
children,
|
|
43
|
+
name: themeName = 'default'
|
|
44
|
+
}: PropsWithChildren<Props>) => {
|
|
9
45
|
const [isDarkTheme, setIsDarkTheme] = useState(false);
|
|
10
46
|
|
|
11
47
|
const toggleDarkTheme = (): void => {
|
|
12
48
|
setIsDarkTheme(!isDarkTheme);
|
|
13
|
-
}
|
|
49
|
+
};
|
|
14
50
|
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
return (
|
|
52
|
+
<DesignSystemContext.Provider
|
|
53
|
+
value={{ isDarkTheme, themeName, toggleDarkTheme }}
|
|
54
|
+
>
|
|
55
|
+
<MaterialThemeProvider>{children}</MaterialThemeProvider>
|
|
56
|
+
</DesignSystemContext.Provider>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
19
59
|
|
|
20
60
|
export default DesignSystemProvider;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './from-scratch-components';
|
|
2
2
|
export * from './material-ui-components';
|
|
3
3
|
export * from './mui-base-components';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
default as DesignSystemProvider,
|
|
6
|
+
DesignSystemContext,
|
|
7
|
+
type DesignSystemContextValues
|
|
8
|
+
} from './DesignSystemProvider';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Button, ButtonProps } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
type ActButtonType = (props: ButtonProps) => JSX.Element | null;
|
|
5
|
+
|
|
6
|
+
const ActButton: ActButtonType = styled(Button)<ButtonProps>(({ theme }) => ({
|
|
7
|
+
color: theme.palette.blueClickable,
|
|
8
|
+
border: `1px solid ${theme.palette.greyLightBorder}`,
|
|
9
|
+
borderRadius: 4,
|
|
10
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
11
|
+
lineHeight: '18px',
|
|
12
|
+
textTransform: 'unset',
|
|
13
|
+
fontSize: 14
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
export default ActButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Button';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Checkbox as CheckboxMUI,
|
|
5
|
+
FormControl,
|
|
6
|
+
FormControlLabel,
|
|
7
|
+
Typography
|
|
8
|
+
} from '@mui/material';
|
|
9
|
+
import { Box, SxProps, Theme } from '@mui/system';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
error?: string;
|
|
13
|
+
label: string;
|
|
14
|
+
value: boolean;
|
|
15
|
+
name: string;
|
|
16
|
+
onChange: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
|
|
17
|
+
sx: SxProps<Theme>;
|
|
18
|
+
}
|
|
19
|
+
const Checkbox = ({ name, value, error, label, onChange, sx }: Props): JSX.Element => {
|
|
20
|
+
const [internalValue, setInternalValue] = useState(value);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (value !== internalValue) {
|
|
24
|
+
setInternalValue(value);
|
|
25
|
+
}
|
|
26
|
+
}, [value]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<FormControl fullWidth>
|
|
30
|
+
<FormControlLabel
|
|
31
|
+
sx={{ display: 'table' }}
|
|
32
|
+
control={
|
|
33
|
+
<Box sx={{ display: 'table-cell' }}>
|
|
34
|
+
<CheckboxMUI
|
|
35
|
+
name={name}
|
|
36
|
+
sx={{ marginTop: -0.5 }}
|
|
37
|
+
checked={internalValue}
|
|
38
|
+
color="primary"
|
|
39
|
+
onChange={(e) => {
|
|
40
|
+
setInternalValue(e.target.checked);
|
|
41
|
+
onChange(name, e.target.checked, true);
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
</Box>
|
|
45
|
+
}
|
|
46
|
+
label={<Typography sx={sx}>{label}</Typography>}
|
|
47
|
+
/>
|
|
48
|
+
{error && (
|
|
49
|
+
<Typography sx={{
|
|
50
|
+
marginTop: -1,
|
|
51
|
+
color: "#B80025",
|
|
52
|
+
fontWeight: 400,
|
|
53
|
+
fontSize: "10px"
|
|
54
|
+
}}>
|
|
55
|
+
{error}
|
|
56
|
+
</Typography>
|
|
57
|
+
)}
|
|
58
|
+
</FormControl>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Checkbox';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ChangeEventHandler,
|
|
3
|
+
FocusEventHandler,
|
|
4
|
+
ReactNode,
|
|
5
|
+
useEffect,
|
|
6
|
+
useState
|
|
7
|
+
} from 'react';
|
|
8
|
+
|
|
9
|
+
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
error?: string;
|
|
13
|
+
onBlur: FocusEventHandler<unknown>;
|
|
14
|
+
onChange: ChangeEventHandler<unknown>;
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
name: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
endAdornment?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
const TextInput = ({
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
error,
|
|
26
|
+
onBlur,
|
|
27
|
+
onChange,
|
|
28
|
+
label,
|
|
29
|
+
disabled,
|
|
30
|
+
endAdornment,
|
|
31
|
+
placeholder = '',
|
|
32
|
+
...props
|
|
33
|
+
}: Omit<TextFieldProps, 'error'> & Props): JSX.Element => {
|
|
34
|
+
const [internalValue, setInternalValue] = useState(value);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (value !== internalValue) {
|
|
37
|
+
setInternalValue(value);
|
|
38
|
+
}
|
|
39
|
+
}, [value]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TextField
|
|
43
|
+
variant="standard"
|
|
44
|
+
name={name}
|
|
45
|
+
label={label}
|
|
46
|
+
value={internalValue}
|
|
47
|
+
onClick={(e) => e.stopPropagation()}
|
|
48
|
+
InputProps={{
|
|
49
|
+
endAdornment
|
|
50
|
+
}}
|
|
51
|
+
onChange={(e) => {
|
|
52
|
+
setInternalValue(e.currentTarget.value);
|
|
53
|
+
onChange(e);
|
|
54
|
+
}}
|
|
55
|
+
onBlur={(e) => {
|
|
56
|
+
onBlur(e);
|
|
57
|
+
}}
|
|
58
|
+
error={!!error}
|
|
59
|
+
helperText={error ?? ''}
|
|
60
|
+
disabled={disabled}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default TextInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextInput';
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createTheme, ThemeProvider, Typography, TypographyProps } from "@mui/material";
|
|
3
|
-
import { useThemeTokens } from "@groupeactual/design-tokens";
|
|
1
|
+
import { Typography, TypographyProps } from '@mui/material';
|
|
4
2
|
|
|
5
|
-
interface Props
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
interface Props extends Omit<TypographyProps, 'paragraph'> {
|
|
4
|
+
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2';
|
|
5
|
+
component?: string;
|
|
6
|
+
}
|
|
10
7
|
|
|
11
|
-
const ActHeading = (
|
|
12
|
-
const {themeName, tokens} = useThemeTokens()
|
|
13
|
-
|
|
14
|
-
const variants = {
|
|
15
|
-
h3 : {
|
|
16
|
-
fontSize: tokens.fontSizes.h3,
|
|
17
|
-
fontWeight: tokens.fontWeight.bold,
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const theme = createTheme({
|
|
22
|
-
typography: {
|
|
23
|
-
...variants
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return <ThemeProvider theme={theme}>
|
|
28
|
-
<Typography {...props}>Theme : {themeName} {children}</Typography>
|
|
29
|
-
</ThemeProvider>;
|
|
30
|
-
};
|
|
8
|
+
const ActHeading = (props: Props) => <Typography {...props} />;
|
|
31
9
|
|
|
32
10
|
export default ActHeading;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Typography, TypographyProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
interface Props extends TypographyProps {
|
|
4
|
+
variant?: 'body1' | 'body2' | 'caption';
|
|
5
|
+
component?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const ActText = (props: Props) => <Typography {...props} />;
|
|
9
|
+
|
|
10
|
+
export default ActText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Text';
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as ActHeading } from
|
|
1
|
+
export { default as ActText } from './Text';
|
|
2
|
+
export { default as ActHeading } from './Heading';
|
|
3
|
+
export { default as ActButton } from './Button';
|
|
4
|
+
export { default as ActTextInput } from './Form/TextInput';
|
|
5
|
+
export { default as ActCheckbox } from './Form/Checkbox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./TextField";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Button";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./TextField";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Button";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./TextField";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ButtonUnstyled, { buttonUnstyledClasses } from '@mui/base/ButtonUnstyled';
|
|
3
|
-
import { styled } from '@mui/system';
|
|
4
|
-
|
|
5
|
-
const ButtonStyled = styled(ButtonUnstyled)`
|
|
6
|
-
font-family: sans-serif;
|
|
7
|
-
font-weight: bold;
|
|
8
|
-
font-size: 0.875rem;
|
|
9
|
-
background-color: tomato;
|
|
10
|
-
padding: 12px 24px;
|
|
11
|
-
border-radius: 8px;
|
|
12
|
-
color: white;
|
|
13
|
-
transition: all 150ms ease;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
border: none;
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
background-color: red;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.${buttonUnstyledClasses.active} {
|
|
22
|
-
background-color: rgb(86, 0, 0);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.${buttonUnstyledClasses.focusVisible} {
|
|
26
|
-
box-shadow: 0 4px 20px 0 rgba(61, 71, 82, 0.1), 0 0 0 5px rgba(0, 127, 255, 0.5);
|
|
27
|
-
outline: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&.${buttonUnstyledClasses.disabled} {
|
|
31
|
-
opacity: 0.5;
|
|
32
|
-
cursor: not-allowed;
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
export interface ActButtonProps {
|
|
37
|
-
children: React.ReactNode
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const ActButton = ({ children, ...props }: ActButtonProps) => {
|
|
41
|
-
return <ButtonStyled {...props}>{children}</ButtonStyled>;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default ActButton;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Button";
|