@groupeactual/ui-kit 0.1.5 → 0.1.6
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/package.json +4 -3
- package/src/DesignSystemProvider.tsx +20 -0
- package/src/from-scratch-components/Tag/Tag.scss +23 -0
- package/src/from-scratch-components/Tag/Tag.tsx +19 -0
- package/src/from-scratch-components/Tag/index.ts +1 -0
- package/src/from-scratch-components/index.ts +1 -0
- package/src/index.ts +4 -0
- package/src/material-ui-components/Heading/Heading.tsx +32 -0
- package/src/material-ui-components/Heading/index.ts +1 -0
- package/src/material-ui-components/TextField/TextField.tsx +8 -0
- package/src/material-ui-components/TextField/index.ts +1 -0
- package/src/material-ui-components/index.ts +2 -0
- package/src/mui-base-components/Button/Button.tsx +44 -0
- package/src/mui-base-components/Button/index.ts +1 -0
- package/src/mui-base-components/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A simple template for a custom React component library",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rollup -c",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
"main": "dist/cjs/index.js",
|
|
34
34
|
"module": "dist/esm/index.js",
|
|
35
35
|
"files": [
|
|
36
|
-
"dist"
|
|
36
|
+
"dist",
|
|
37
|
+
"src"
|
|
37
38
|
],
|
|
38
39
|
"types": "dist/index.d.ts",
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@emotion/is-prop-valid": "^1.2.0",
|
|
41
42
|
"@emotion/react": "^11.10.0",
|
|
42
43
|
"@emotion/styled": "^11.10.0",
|
|
43
|
-
"@groupeactual/design-tokens": "workspace:^0.1.
|
|
44
|
+
"@groupeactual/design-tokens": "workspace:^0.1.3",
|
|
44
45
|
"@mui/base": "^5.0.0-alpha.92",
|
|
45
46
|
"@mui/material": "^5.10.0",
|
|
46
47
|
"@mui/system": "^5.9.3",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren, useState} from 'react';
|
|
2
|
+
import { DesignSystemContext } from '@groupeactual/design-tokens';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const DesignSystemProvider = ({children, name: themeName} : PropsWithChildren<Props>) => {
|
|
9
|
+
const [isDarkTheme, setIsDarkTheme] = useState(false);
|
|
10
|
+
|
|
11
|
+
const toggleDarkTheme = (): void => {
|
|
12
|
+
setIsDarkTheme(!isDarkTheme);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (<DesignSystemContext.Provider value={{ isDarkTheme, themeName, toggleDarkTheme}}>
|
|
16
|
+
{children}
|
|
17
|
+
</DesignSystemContext.Provider>);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default DesignSystemProvider;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.tag {
|
|
2
|
+
padding: 4px 8px;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
background: rgb(244, 244, 244);
|
|
5
|
+
color: black;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
font-family: sans-serif;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tag.red {
|
|
11
|
+
background: tomato;
|
|
12
|
+
color: white;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tag.blue {
|
|
16
|
+
background: blue;
|
|
17
|
+
color: white;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tag.green {
|
|
21
|
+
background: green;
|
|
22
|
+
color: white;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import "./Tag.scss";
|
|
4
|
+
|
|
5
|
+
export interface ActTagProps {
|
|
6
|
+
label?: string;
|
|
7
|
+
color?: 'red' | 'green' | 'blue'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ActTag = (props: ActTagProps) => {
|
|
11
|
+
return <span className={clsx({
|
|
12
|
+
tag: true,
|
|
13
|
+
red: props.color === 'red',
|
|
14
|
+
green: props.color === 'green',
|
|
15
|
+
blue: props.color === 'blue'
|
|
16
|
+
})}>{props.label}</span>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default ActTag;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Tag";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ActTag } from "./Tag";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { createTheme, ThemeProvider, Typography, TypographyProps } from "@mui/material";
|
|
3
|
+
import { useThemeTokens } from "@groupeactual/design-tokens";
|
|
4
|
+
|
|
5
|
+
interface Props
|
|
6
|
+
extends TypographyProps
|
|
7
|
+
{
|
|
8
|
+
variant: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ActHeading = ({ children, ...props }: PropsWithChildren<Props>) => {
|
|
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
|
+
};
|
|
31
|
+
|
|
32
|
+
export default ActHeading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Heading";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./TextField";
|
|
@@ -0,0 +1,44 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Button";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ActButton } from "./Button";
|