@veritone-ce/design-system 0.9.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/.github/workflows/chromatic.yml +21 -0
- package/.storybook/main.js +21 -0
- package/.storybook/preview.js +22 -0
- package/CHANGELOG.md +7 -0
- package/README.md +42 -0
- package/package.json +114 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +42 -0
- package/public/manifest.json +15 -0
- package/public/robots.txt +3 -0
- package/src/Intro.stories.mdx +7 -0
- package/src/assets/theme.tsx +345 -0
- package/src/components/Button/Button.stories.tsx +56 -0
- package/src/components/Button/index.tsx +53 -0
- package/src/components/ThemeProvider/index.tsx +12 -0
- package/src/index.tsx +2 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/setupTests.ts +5 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Name of our action
|
|
2
|
+
name: "Chromatic"
|
|
3
|
+
# The event that will trigger the action
|
|
4
|
+
on: push
|
|
5
|
+
|
|
6
|
+
# What the action will do
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
# The operating system it will run on
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
# The list of steps that the action will go through
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v1
|
|
14
|
+
- run: yarn
|
|
15
|
+
#👇 Adds Chromatic as a step in the workflow
|
|
16
|
+
- uses: chromaui/action@v1
|
|
17
|
+
# Options required for Chromatic's GitHub Action
|
|
18
|
+
with:
|
|
19
|
+
#👇 Chromatic projectToken, see https://storybook.js.org/tutorials/design-systems-for-developers/react/en/review/ to obtain it
|
|
20
|
+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
|
21
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
stories: [
|
|
3
|
+
'../src/Intro.stories.mdx',
|
|
4
|
+
'../src/**/*.stories.mdx',
|
|
5
|
+
'../src/**/*.stories.@(js|jsx|ts|tsx)'
|
|
6
|
+
],
|
|
7
|
+
addons: [
|
|
8
|
+
'@storybook/addon-links',
|
|
9
|
+
'@storybook/addon-essentials',
|
|
10
|
+
'@storybook/addon-interactions',
|
|
11
|
+
'@storybook/preset-create-react-app',
|
|
12
|
+
'@storybook/addon-a11y',
|
|
13
|
+
],
|
|
14
|
+
framework: '@storybook/react',
|
|
15
|
+
core: {
|
|
16
|
+
builder: '@storybook/builder-webpack5'
|
|
17
|
+
},
|
|
18
|
+
features: {
|
|
19
|
+
interactionsDebugger: true,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ThemeProvider} from '@mui/system'
|
|
3
|
+
import theme from '../src/assets/theme'
|
|
4
|
+
|
|
5
|
+
export const decorators = [
|
|
6
|
+
(Story) => (
|
|
7
|
+
<ThemeProvider theme={theme}>
|
|
8
|
+
<Story />
|
|
9
|
+
</ThemeProvider>
|
|
10
|
+
|
|
11
|
+
),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
export const parameters = {
|
|
15
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
16
|
+
controls: {
|
|
17
|
+
matchers: {
|
|
18
|
+
color: /(background|color)$/i,
|
|
19
|
+
date: /Date$/,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Veritone CE Design System
|
|
2
|
+
|
|
3
|
+
This project uses [Storybook](https://storybook.js.org/) to preview components.
|
|
4
|
+
|
|
5
|
+
## Available Scripts
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### `yarn start`
|
|
10
|
+
|
|
11
|
+
Runs storybook in development mode. Opens storybook in a new browser tab.
|
|
12
|
+
|
|
13
|
+
### `yarn test`
|
|
14
|
+
|
|
15
|
+
Launches the test runner.
|
|
16
|
+
See the section about [running tests](https://storybook.js.org/tutorials/design-systems-for-developers/react/en/test/) for more information.
|
|
17
|
+
|
|
18
|
+
### `yarn build`
|
|
19
|
+
|
|
20
|
+
Builds the for production to the `` folder.\
|
|
21
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
22
|
+
|
|
23
|
+
The build is minified and the filenames include the hashes.\
|
|
24
|
+
Your app is ready to be deployed!
|
|
25
|
+
|
|
26
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
27
|
+
|
|
28
|
+
### `yarn build-docs`
|
|
29
|
+
|
|
30
|
+
Builds the documentation for production to the `storybook-static` folder.\
|
|
31
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
32
|
+
|
|
33
|
+
The build is minified and the filenames include the hashes.\
|
|
34
|
+
Your app is ready to be deployed!
|
|
35
|
+
|
|
36
|
+
See the section about [documentation](https://storybook.js.org/tutorials/design-systems-for-developers/react/en/document/) for more information.
|
|
37
|
+
|
|
38
|
+
## Learn More
|
|
39
|
+
|
|
40
|
+
You can learn more in the [Storybook Design System for Developers](https://storybook.js.org/tutorials/design-systems-for-developers/).
|
|
41
|
+
|
|
42
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@veritone-ce/design-system",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@emotion/react": "^11.10.4",
|
|
7
|
+
"@emotion/styled": "^11.10.4",
|
|
8
|
+
"@fontsource/dosis": "^4.5.10",
|
|
9
|
+
"@fontsource/nunito-sans": "^4.5.10",
|
|
10
|
+
"@fontsource/roboto": "^4.5.8",
|
|
11
|
+
"@mui/icons-material": "^5.10.6",
|
|
12
|
+
"@mui/material": "^5.10.8",
|
|
13
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
14
|
+
"@testing-library/react": "^13.0.0",
|
|
15
|
+
"@testing-library/user-event": "^13.2.1",
|
|
16
|
+
"@types/jest": "^27.0.1",
|
|
17
|
+
"@types/node": "^16.7.13",
|
|
18
|
+
"@types/react": "^18.0.0",
|
|
19
|
+
"@types/react-dom": "^18.0.0",
|
|
20
|
+
"react": "^18.2.0",
|
|
21
|
+
"react-dom": "^18.2.0",
|
|
22
|
+
"react-scripts": "5.0.1",
|
|
23
|
+
"typescript": "^4.4.2",
|
|
24
|
+
"web-vitals": "^2.1.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"start": "yarn storybook",
|
|
28
|
+
"build": "cross-env BABEL_ENV=production babel src -d dist",
|
|
29
|
+
"build-docs": "yarn build-storybook-docs",
|
|
30
|
+
"test": "yarn test-storybook",
|
|
31
|
+
"storybook": "start-storybook -p 6006 -s public",
|
|
32
|
+
"build-storybook": "build-storybook -s public",
|
|
33
|
+
"test-storybook": "test-storybook",
|
|
34
|
+
"build-storybook-docs": "build-storybook --docs"
|
|
35
|
+
},
|
|
36
|
+
"eslintConfig": {
|
|
37
|
+
"extends": [
|
|
38
|
+
"react-app",
|
|
39
|
+
"react-app/jest"
|
|
40
|
+
],
|
|
41
|
+
"overrides": [
|
|
42
|
+
{
|
|
43
|
+
"files": [
|
|
44
|
+
"**/*.stories.*"
|
|
45
|
+
],
|
|
46
|
+
"rules": {
|
|
47
|
+
"import/no-anonymous-default-export": "off"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"browserslist": {
|
|
53
|
+
"production": [
|
|
54
|
+
">0.2%",
|
|
55
|
+
"not dead",
|
|
56
|
+
"not op_mini all"
|
|
57
|
+
],
|
|
58
|
+
"development": [
|
|
59
|
+
"last 1 chrome version",
|
|
60
|
+
"last 1 firefox version",
|
|
61
|
+
"last 1 safari version"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@babel/cli": "^7.19.3",
|
|
66
|
+
"@storybook/addon-a11y": "^6.5.12",
|
|
67
|
+
"@storybook/addon-actions": "^6.5.12",
|
|
68
|
+
"@storybook/addon-essentials": "^6.5.12",
|
|
69
|
+
"@storybook/addon-interactions": "^6.5.12",
|
|
70
|
+
"@storybook/addon-links": "^6.5.12",
|
|
71
|
+
"@storybook/builder-webpack5": "^6.5.12",
|
|
72
|
+
"@storybook/jest": "^0.0.10",
|
|
73
|
+
"@storybook/manager-webpack5": "^6.5.12",
|
|
74
|
+
"@storybook/node-logger": "^6.5.12",
|
|
75
|
+
"@storybook/preset-create-react-app": "^4.1.2",
|
|
76
|
+
"@storybook/react": "^6.5.12",
|
|
77
|
+
"@storybook/test-runner": "^0.7.2",
|
|
78
|
+
"@storybook/testing-library": "^0.0.13",
|
|
79
|
+
"auto": "^10.37.6",
|
|
80
|
+
"babel-plugin-named-exports-order": "^0.0.2",
|
|
81
|
+
"chromatic": "^6.10.1",
|
|
82
|
+
"cross-env": "^7.0.3",
|
|
83
|
+
"jest": "27",
|
|
84
|
+
"prettier": "^2.7.1",
|
|
85
|
+
"prop-types": "^15.8.1",
|
|
86
|
+
"webpack": "^5.74.0"
|
|
87
|
+
},
|
|
88
|
+
"babel": {
|
|
89
|
+
"presets": [
|
|
90
|
+
[
|
|
91
|
+
"react-app",
|
|
92
|
+
{
|
|
93
|
+
"absoluteRuntime": false
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"description": "design system for veritone ce",
|
|
99
|
+
"main": "index.js",
|
|
100
|
+
"repository": {
|
|
101
|
+
"type": "git",
|
|
102
|
+
"url": "git+ssh://git@github.com/veritone/design-system.git"
|
|
103
|
+
},
|
|
104
|
+
"author": "Veritone",
|
|
105
|
+
"license": "MIT",
|
|
106
|
+
"bugs": {
|
|
107
|
+
"url": "https://github.com/veritone/design-system/issues"
|
|
108
|
+
},
|
|
109
|
+
"homepage": "https://github.com/veritone/design-system#readme",
|
|
110
|
+
"keywords": [
|
|
111
|
+
"design system",
|
|
112
|
+
"ui library"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Veritone CE Design System"
|
|
11
|
+
/>
|
|
12
|
+
<!--
|
|
13
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
14
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
15
|
+
-->
|
|
16
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
17
|
+
<!--
|
|
18
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
19
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
20
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
21
|
+
|
|
22
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
23
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
24
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
25
|
+
-->
|
|
26
|
+
<title>Veritone | Design System</title>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
30
|
+
<div id="root"></div>
|
|
31
|
+
<!--
|
|
32
|
+
This HTML file is a template.
|
|
33
|
+
If you open it directly in the browser, you will see an empty page.
|
|
34
|
+
|
|
35
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
36
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
37
|
+
|
|
38
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
39
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
40
|
+
-->
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "Design System",
|
|
3
|
+
"name": "Veritone CE Design System",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"start_url": ".",
|
|
12
|
+
"display": "standalone",
|
|
13
|
+
"theme_color": "#000000",
|
|
14
|
+
"background_color": "#ffffff"
|
|
15
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { createTheme, ThemeOptions as MuiThemeOptions } from '@mui/material'
|
|
2
|
+
import '@fontsource/nunito-sans'
|
|
3
|
+
import '@fontsource/dosis'
|
|
4
|
+
import sx from '@mui/system/sx'
|
|
5
|
+
import { CSSProperties } from '@mui/styled-engine'
|
|
6
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle'
|
|
7
|
+
import InfoIcon from '@mui/icons-material/Info'
|
|
8
|
+
import WarningIcon from '@mui/icons-material/Error'
|
|
9
|
+
import ErrorIcon from '@mui/icons-material/Cancel'
|
|
10
|
+
|
|
11
|
+
declare module '@mui/material/Button' {
|
|
12
|
+
interface ButtonPropsVariantOverrides {
|
|
13
|
+
secondary: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '@mui/material/styles/createPalette' {
|
|
18
|
+
type ButtonPaletteColorOptions = SimplePaletteColorOptions & {
|
|
19
|
+
hover: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Palette {
|
|
23
|
+
button: ButtonPaletteColorOptions
|
|
24
|
+
neutral: Palette['primary']
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface PaletteOptions {
|
|
28
|
+
button?: ButtonPaletteColorOptions
|
|
29
|
+
neutral?: PaletteColorOptions
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// allow configuration using `createTheme`
|
|
33
|
+
interface ThemeOptions extends MuiThemeOptions {
|
|
34
|
+
pallete?: {
|
|
35
|
+
button?: ButtonPaletteColorOptions
|
|
36
|
+
neutral?: PaletteColorOptions
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// create theme in steps https://mui.com/material-ui/customization/theming/#api
|
|
42
|
+
let theme = createTheme({
|
|
43
|
+
typography: {
|
|
44
|
+
fontFamily: ['Nunito Sans', 'Helvetica', 'sans-serif'].join(','),
|
|
45
|
+
h2: {
|
|
46
|
+
fontSize: '1.429rem',
|
|
47
|
+
lineHeight: '2.143rem',
|
|
48
|
+
fontWeight: '700',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
palette: {
|
|
52
|
+
primary: {
|
|
53
|
+
main: '#214167',
|
|
54
|
+
},
|
|
55
|
+
secondary: {
|
|
56
|
+
main: '#335B89',
|
|
57
|
+
contrastText: '#ffffff',
|
|
58
|
+
},
|
|
59
|
+
neutral: {
|
|
60
|
+
main: '#5C6269',
|
|
61
|
+
},
|
|
62
|
+
button: {
|
|
63
|
+
main: '#1871E8',
|
|
64
|
+
hover: '#335B89',
|
|
65
|
+
},
|
|
66
|
+
success: {
|
|
67
|
+
main: '#28BA3F',
|
|
68
|
+
},
|
|
69
|
+
info: {
|
|
70
|
+
main: '#325491',
|
|
71
|
+
},
|
|
72
|
+
warning: {
|
|
73
|
+
main: '#FFBB0A',
|
|
74
|
+
},
|
|
75
|
+
error: {
|
|
76
|
+
main: '#D43060',
|
|
77
|
+
},
|
|
78
|
+
divider: '#214167',
|
|
79
|
+
},
|
|
80
|
+
spacing: 10,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
theme = createTheme(theme, {
|
|
84
|
+
components: {
|
|
85
|
+
MuiButton: {
|
|
86
|
+
defaultProps: {
|
|
87
|
+
variant: 'contained',
|
|
88
|
+
disableRipple: true,
|
|
89
|
+
},
|
|
90
|
+
styleOverrides: {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
root: ({ ownerState }) => ({
|
|
93
|
+
textTransform: 'none',
|
|
94
|
+
'&.Mui-disabled': {
|
|
95
|
+
borderColor: `#E0E8F0`,
|
|
96
|
+
},
|
|
97
|
+
'&.Mui-disabled .MuiButton-startIcon': {
|
|
98
|
+
opacity: 0.3,
|
|
99
|
+
},
|
|
100
|
+
...(ownerState.variant === `contained` &&
|
|
101
|
+
({
|
|
102
|
+
fontWeight: '600',
|
|
103
|
+
backgroundColor: theme.palette.button.main,
|
|
104
|
+
':hover': {
|
|
105
|
+
backgroundColor: theme.palette.button.hover,
|
|
106
|
+
},
|
|
107
|
+
} as CSSProperties)),
|
|
108
|
+
...(ownerState.variant === `text` &&
|
|
109
|
+
({
|
|
110
|
+
fontWeight: '600',
|
|
111
|
+
color: theme.palette.button.main,
|
|
112
|
+
':hover': {
|
|
113
|
+
color: theme.palette.button.hover,
|
|
114
|
+
},
|
|
115
|
+
'.MuiButton-startIcon': {
|
|
116
|
+
color: `#555F7C`,
|
|
117
|
+
marginRight: theme.spacing(2),
|
|
118
|
+
},
|
|
119
|
+
} as CSSProperties)),
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
variants: [
|
|
123
|
+
{
|
|
124
|
+
props: {
|
|
125
|
+
variant: 'secondary',
|
|
126
|
+
},
|
|
127
|
+
style: sx({
|
|
128
|
+
backgroundColor: 'white',
|
|
129
|
+
color: theme.palette.neutral.main,
|
|
130
|
+
border: `1px solid ${theme.palette.neutral.main}`,
|
|
131
|
+
':hover': {
|
|
132
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
133
|
+
color: theme.palette.primary.main,
|
|
134
|
+
backgroundColor: 'white',
|
|
135
|
+
},
|
|
136
|
+
}),
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
MuiInputLabel: {
|
|
141
|
+
styleOverrides: {
|
|
142
|
+
root: sx({
|
|
143
|
+
color: `#5C6269`,
|
|
144
|
+
fontSize: `14px`,
|
|
145
|
+
lineHeight: `21px`,
|
|
146
|
+
fontWeight: `600`,
|
|
147
|
+
}),
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
MuiFormHelperText: {
|
|
151
|
+
styleOverrides: {
|
|
152
|
+
root: sx({
|
|
153
|
+
position: 'relative',
|
|
154
|
+
marginLeft: 0,
|
|
155
|
+
'&.Mui-error': {
|
|
156
|
+
paddingLeft: `17px`,
|
|
157
|
+
'&::before': {
|
|
158
|
+
content: `""`,
|
|
159
|
+
height: `12px`,
|
|
160
|
+
width: '12px',
|
|
161
|
+
position: 'absolute',
|
|
162
|
+
left: 0,
|
|
163
|
+
top: `50%`,
|
|
164
|
+
transform: `translate(0, -50%)`,
|
|
165
|
+
backgroundColor: theme.palette.error.main,
|
|
166
|
+
borderRadius: `100%`,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
MuiTextField: {
|
|
173
|
+
defaultProps: {
|
|
174
|
+
size: 'small',
|
|
175
|
+
},
|
|
176
|
+
styleOverrides: {
|
|
177
|
+
root: sx({
|
|
178
|
+
color: `#2A323C`,
|
|
179
|
+
'& .MuiOutlinedInput-root': {
|
|
180
|
+
'& fieldset': {
|
|
181
|
+
borderColor: `#E0E8F0`,
|
|
182
|
+
},
|
|
183
|
+
'&:hover fieldset': {
|
|
184
|
+
borderColor: `#335B89`,
|
|
185
|
+
},
|
|
186
|
+
'&.Mui-focused fieldset': {
|
|
187
|
+
border: `1px solid #5C6269`,
|
|
188
|
+
},
|
|
189
|
+
'&.Mui-error fieldset': {
|
|
190
|
+
borderColor: theme.palette.error.main,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
MuiStepIcon: {
|
|
197
|
+
styleOverrides: {
|
|
198
|
+
root: {
|
|
199
|
+
borderRadius: `100%`,
|
|
200
|
+
outline: `1px solid #465364`,
|
|
201
|
+
color: `white`,
|
|
202
|
+
text: {
|
|
203
|
+
fill: `#465364`,
|
|
204
|
+
},
|
|
205
|
+
'&.Mui-active': {
|
|
206
|
+
outline: `none`,
|
|
207
|
+
color: theme.palette.button.main,
|
|
208
|
+
text: {
|
|
209
|
+
fill: `white`,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
MuiDialogTitle: {
|
|
216
|
+
styleOverrides: {
|
|
217
|
+
root: {
|
|
218
|
+
fontSize: `24px`,
|
|
219
|
+
lineHeight: `34px`,
|
|
220
|
+
paddingTop: theme.spacing(3),
|
|
221
|
+
paddingLeft: theme.spacing(3),
|
|
222
|
+
paddingRight: theme.spacing(3),
|
|
223
|
+
paddingBottom: theme.spacing(1),
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
MuiDialogContent: {
|
|
228
|
+
styleOverrides: {
|
|
229
|
+
root: {
|
|
230
|
+
paddingTop: 0,
|
|
231
|
+
paddingLeft: theme.spacing(3),
|
|
232
|
+
paddingRight: theme.spacing(3),
|
|
233
|
+
paddingBottom: theme.spacing(1),
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
MuiDialogActions: {
|
|
238
|
+
styleOverrides: {
|
|
239
|
+
root: {
|
|
240
|
+
padding: theme.spacing(3),
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
MuiLink: {
|
|
245
|
+
defaultProps: {
|
|
246
|
+
underline: `none`,
|
|
247
|
+
color: `#1871E8`,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
MuiSnackbar: {
|
|
251
|
+
defaultProps: {
|
|
252
|
+
autoHideDuration: 6000,
|
|
253
|
+
anchorOrigin: {
|
|
254
|
+
vertical: `top`,
|
|
255
|
+
horizontal: `right`,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
styleOverrides: {
|
|
259
|
+
root: {
|
|
260
|
+
width: `100%`,
|
|
261
|
+
maxWidth: `415px`,
|
|
262
|
+
position: `absolute`,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
MuiAlert: {
|
|
267
|
+
defaultProps: {
|
|
268
|
+
variant: `outlined`,
|
|
269
|
+
iconMapping: {
|
|
270
|
+
success: <CheckCircleIcon />,
|
|
271
|
+
info: <InfoIcon />,
|
|
272
|
+
warning: <WarningIcon />,
|
|
273
|
+
error: <ErrorIcon />,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
styleOverrides: {
|
|
277
|
+
root: {
|
|
278
|
+
width: `100%`,
|
|
279
|
+
backgroundColor: `white`,
|
|
280
|
+
borderColor: `#D5DFE9`,
|
|
281
|
+
position: `relative`,
|
|
282
|
+
overflow: `hidden`,
|
|
283
|
+
'&:after': {
|
|
284
|
+
content: '""',
|
|
285
|
+
position: `absolute`,
|
|
286
|
+
width: `4px`,
|
|
287
|
+
left: 0,
|
|
288
|
+
top: 0,
|
|
289
|
+
bottom: 0,
|
|
290
|
+
},
|
|
291
|
+
'&.MuiAlert-outlinedSuccess:after': {
|
|
292
|
+
backgroundColor: theme.palette.success.main,
|
|
293
|
+
},
|
|
294
|
+
'&.MuiAlert-outlinedInfo:after': {
|
|
295
|
+
backgroundColor: theme.palette.info.main,
|
|
296
|
+
},
|
|
297
|
+
'&.MuiAlert-outlinedWarning:after': {
|
|
298
|
+
backgroundColor: theme.palette.warning.main,
|
|
299
|
+
},
|
|
300
|
+
'&.MuiAlert-outlinedError:after': {
|
|
301
|
+
backgroundColor: theme.palette.error.main,
|
|
302
|
+
},
|
|
303
|
+
'& .MuiAlert-icon': {
|
|
304
|
+
opacity: 1,
|
|
305
|
+
fontSize: 20,
|
|
306
|
+
},
|
|
307
|
+
'& .MuiAlert-message': {
|
|
308
|
+
fontSize: `12px`,
|
|
309
|
+
lineHeight: `22px`,
|
|
310
|
+
color: `black`,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
MuiCircularProgress: {
|
|
316
|
+
styleOverrides: {
|
|
317
|
+
root: {
|
|
318
|
+
color: theme.palette.button.main,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
MuiCardContent: {
|
|
323
|
+
styleOverrides: {
|
|
324
|
+
root: {
|
|
325
|
+
padding: theme.spacing(2),
|
|
326
|
+
paddingTop: theme.spacing(1),
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
MuiDataGrid: {
|
|
331
|
+
styleOverrides: {
|
|
332
|
+
root: {
|
|
333
|
+
'& .MuiDataGrid-columnHeader:focus': {
|
|
334
|
+
outline: 0,
|
|
335
|
+
},
|
|
336
|
+
'& .MuiDataGrid-cell:focus': {
|
|
337
|
+
outline: 0,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
export default theme
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
|
2
|
+
import Button from './'
|
|
3
|
+
// import { userEvent, within } from '@storybook/testing-library'
|
|
4
|
+
// import { expect } from '@storybook/jest'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Button',
|
|
8
|
+
component: Button,
|
|
9
|
+
argType: {
|
|
10
|
+
variant: `contained`,
|
|
11
|
+
},
|
|
12
|
+
parameters: {
|
|
13
|
+
componentSubtitle: 'Clickable Button with many variations',
|
|
14
|
+
controls: {
|
|
15
|
+
exclude: [
|
|
16
|
+
'variant',
|
|
17
|
+
'classes',
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
} as ComponentMeta<typeof Button>
|
|
22
|
+
|
|
23
|
+
const Template: ComponentStory<typeof Button> = (args) => <Button {...args}>Text</Button>
|
|
24
|
+
|
|
25
|
+
export const Primary = Template.bind({})
|
|
26
|
+
|
|
27
|
+
export const Secondary = Template.bind({})
|
|
28
|
+
Secondary.args = {
|
|
29
|
+
variant: 'secondary',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Processing = Template.bind({})
|
|
33
|
+
Processing.args = {
|
|
34
|
+
isProcessing: true,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* New story using the play function.
|
|
39
|
+
* See https://storybook.js.org/docs/react/writing-stories/play-function
|
|
40
|
+
* to learn more about the play function.
|
|
41
|
+
*/
|
|
42
|
+
// export const WithInteractions = (args) => <Button {...args} />;
|
|
43
|
+
// export const WithInteractions = Template.bind({})
|
|
44
|
+
// WithInteractions.args = {
|
|
45
|
+
// href: 'http://storybook.js.org',
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// WithInteractions.play = async ({ canvasElement }) => {
|
|
49
|
+
// // Assigns canvas to the component root element
|
|
50
|
+
// const canvas = within(canvasElement)
|
|
51
|
+
// await userEvent.click(canvas.getByRole('link'))
|
|
52
|
+
// expect(canvas.getByRole('link')).toHaveAttribute(
|
|
53
|
+
// 'href',
|
|
54
|
+
// 'http://storybook.js.org',
|
|
55
|
+
// )
|
|
56
|
+
// }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { Button as MuiButton, ButtonProps, CircularProgress, Box } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
export type Props = {
|
|
5
|
+
/**
|
|
6
|
+
Use the isProcessing prop to indicate to the user that an action is in process. This will disable the button.
|
|
7
|
+
*/
|
|
8
|
+
isProcessing?: boolean
|
|
9
|
+
} & ButtonProps
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
- Use a button for common user click actions. Several variations available.
|
|
13
|
+
**/
|
|
14
|
+
const Button = ({
|
|
15
|
+
children,
|
|
16
|
+
isProcessing = false,
|
|
17
|
+
...props
|
|
18
|
+
}: Props) => {
|
|
19
|
+
const processingIndicator = (
|
|
20
|
+
<Box
|
|
21
|
+
sx={{
|
|
22
|
+
position: `absolute`,
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
display: `grid`,
|
|
28
|
+
justifyItems: `center`,
|
|
29
|
+
alignItems: `center`,
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<CircularProgress size={20}></CircularProgress>
|
|
33
|
+
</Box>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
const indicator = isProcessing ? processingIndicator : null
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Box
|
|
40
|
+
sx={{
|
|
41
|
+
display: `inline-flex`,
|
|
42
|
+
position: `relative`,
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<MuiButton {...props} disabled={isProcessing || props.disabled}>
|
|
46
|
+
{children}
|
|
47
|
+
</MuiButton>
|
|
48
|
+
{indicator}
|
|
49
|
+
</Box>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default Button
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ThemeProvider as MuiThemeProvider, ThemeProviderProps } from '@mui/system'
|
|
2
|
+
import theme from '../../assets/theme'
|
|
3
|
+
|
|
4
|
+
const ThemeProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
}: ThemeProviderProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<MuiThemeProvider theme={theme}>{children}</MuiThemeProvider>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default ThemeProvider
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReportHandler } from 'web-vitals';
|
|
2
|
+
|
|
3
|
+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
+
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
+
getCLS(onPerfEntry);
|
|
7
|
+
getFID(onPerfEntry);
|
|
8
|
+
getFCP(onPerfEntry);
|
|
9
|
+
getLCP(onPerfEntry);
|
|
10
|
+
getTTFB(onPerfEntry);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default reportWebVitals;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"jsx": "react-jsx",
|
|
22
|
+
"rootDir": "src"
|
|
23
|
+
},
|
|
24
|
+
"include": [
|
|
25
|
+
"src"
|
|
26
|
+
]
|
|
27
|
+
}
|