@veritone-ce/design-system 1.0.2 → 1.2.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/dist/assets/theme.d.ts +15 -2
- package/dist/assets/theme.js +123 -151
- package/dist/components/Button/Indicator.js +5 -1
- package/dist/components/Button/button.theme.d.ts +838 -0
- package/dist/components/Button/button.theme.js +106 -0
- package/dist/components/Button/index.d.ts +3 -4
- package/dist/components/Button/index.js +14 -3
- package/dist/components/Button/useButtonProps.d.ts +1 -1
- package/dist/components/Button/useButtonProps.js +2 -2
- package/dist/components/ThemeProvider/index.d.ts +1 -1
- package/dist/components/ThemeProvider/index.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +43 -58
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import sx from '@mui/system/sx';
|
|
2
|
+
const buttonTheme = (theme) => ({
|
|
3
|
+
defaultProps: {
|
|
4
|
+
variant: 'contained',
|
|
5
|
+
disableRipple: true
|
|
6
|
+
},
|
|
7
|
+
styleOverrides: {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
root: ({ ownerState }) => (Object.assign(Object.assign(Object.assign({ textTransform: 'none', fontWeight: '600', '&.MuiButton-outlinedError': {
|
|
10
|
+
backgroundColor: theme.palette.common.white
|
|
11
|
+
}, '&.Mui-disabled': Object.assign({}, (ownerState.variant !== `text` && {
|
|
12
|
+
borderColor: theme.palette.misc.altBackground,
|
|
13
|
+
backgroundColor: theme.palette.misc.rowHoverGreyOne,
|
|
14
|
+
borderWidth: '1px',
|
|
15
|
+
borderStyle: 'solid'
|
|
16
|
+
})), '& .MuiButton-startIcon': Object.assign({ marginRight: 0, marginLeft: 0, marginTop: '-1px', fontSize: '18px' }, {
|
|
17
|
+
'& .MuiSvgIcon-root': {
|
|
18
|
+
fontSize: 18
|
|
19
|
+
}
|
|
20
|
+
}), '& .MuiButton-endIcon': Object.assign({ marginRight: 0, marginLeft: 0, marginTop: '-1px', fontSize: '18px' }, {
|
|
21
|
+
'& .MuiSvgIcon-root': {
|
|
22
|
+
fontSize: 18
|
|
23
|
+
}
|
|
24
|
+
}), '&.Mui-disabled .MuiButton-startIcon .MuiButton-endIcon': {
|
|
25
|
+
opacity: 0.3
|
|
26
|
+
} }, (ownerState.variant === `contained` &&
|
|
27
|
+
{
|
|
28
|
+
//@ts-ignore
|
|
29
|
+
backgroundColor: ownerState.color === `primary`
|
|
30
|
+
? theme.palette.button.main
|
|
31
|
+
: //@ts-ignore
|
|
32
|
+
theme.palette[ownerState.color].main,
|
|
33
|
+
':hover': {
|
|
34
|
+
//@ts-ignore
|
|
35
|
+
backgroundColor: ownerState.color === `primary`
|
|
36
|
+
? theme.palette.button.hover
|
|
37
|
+
: //@ts-ignore
|
|
38
|
+
theme.palette[ownerState.color]
|
|
39
|
+
}
|
|
40
|
+
})), (ownerState.variant === `outlined` &&
|
|
41
|
+
{
|
|
42
|
+
backgroundColor: ownerState.color === `primary`
|
|
43
|
+
? theme.palette.common.white
|
|
44
|
+
: //@ts-ignore
|
|
45
|
+
theme.palette[ownerState.color],
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
color: ownerState.color === `primary`
|
|
48
|
+
? theme.palette.neutral.main
|
|
49
|
+
: //@ts-ignore
|
|
50
|
+
theme.palette[ownerState.color].main,
|
|
51
|
+
borderColor: ownerState.color === `primary`
|
|
52
|
+
? theme.palette.neutral.main
|
|
53
|
+
: //@ts-ignore
|
|
54
|
+
theme.palette[ownerState.color].main,
|
|
55
|
+
':hover': {
|
|
56
|
+
backgroundColor: ownerState.color === `primary`
|
|
57
|
+
? theme.palette.common.white
|
|
58
|
+
: //@ts-ignore
|
|
59
|
+
theme.palette[ownerState.color],
|
|
60
|
+
//@ts-ignore
|
|
61
|
+
color: ownerState.color === `primary`
|
|
62
|
+
? theme.palette.secondary.main
|
|
63
|
+
: //@ts-ignore
|
|
64
|
+
theme.palette[ownerState.color],
|
|
65
|
+
//@ts-ignore
|
|
66
|
+
borderColor: ownerState.color === `primary`
|
|
67
|
+
? theme.palette.secondary.main
|
|
68
|
+
: //@ts-ignore
|
|
69
|
+
theme.palette[ownerState.color]
|
|
70
|
+
}
|
|
71
|
+
})), (ownerState.variant === `text` &&
|
|
72
|
+
{
|
|
73
|
+
backgroundColor: 'transparent',
|
|
74
|
+
color: ownerState.color === `primary`
|
|
75
|
+
? theme.palette.text.tertiary
|
|
76
|
+
: //@ts-ignore
|
|
77
|
+
theme.palette[ownerState.color].main,
|
|
78
|
+
':hover': {
|
|
79
|
+
backgroundColor: 'rgba(255, 255, 255, 0.15)',
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
color: ownerState.color === `primary`
|
|
82
|
+
? theme.palette.secondary.main
|
|
83
|
+
: //@ts-ignore
|
|
84
|
+
theme.palette[ownerState.color]
|
|
85
|
+
}
|
|
86
|
+
})))
|
|
87
|
+
},
|
|
88
|
+
variants: [
|
|
89
|
+
{
|
|
90
|
+
props: {
|
|
91
|
+
variant: 'secondary'
|
|
92
|
+
},
|
|
93
|
+
style: sx({
|
|
94
|
+
backgroundColor: 'white',
|
|
95
|
+
color: theme.palette.neutral.main,
|
|
96
|
+
border: `1px solid ${theme.palette.neutral.main}`,
|
|
97
|
+
':hover': {
|
|
98
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
99
|
+
color: theme.palette.primary.main,
|
|
100
|
+
backgroundColor: 'white'
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
export default buttonTheme;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
2
2
|
export declare type ButtonProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isProcessing?: boolean;
|
|
3
|
+
'data-testid'?: string;
|
|
4
|
+
variant?: 'primary' | 'secondary' | 'terciary';
|
|
5
|
+
isLoading?: boolean;
|
|
7
6
|
} & MuiButtonProps;
|
|
8
7
|
/**
|
|
9
8
|
- Use a button for common user click actions. Several variations available.
|
|
@@ -18,10 +18,21 @@ import useButtonProps from './useButtonProps';
|
|
|
18
18
|
**/
|
|
19
19
|
const Button = (_a) => {
|
|
20
20
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
21
|
-
const _b = useButtonProps(props), {
|
|
21
|
+
const _b = useButtonProps(props), { isLoading } = _b, muiButtonProps = __rest(_b, ["isLoading"]);
|
|
22
22
|
return (_jsxs(Box, Object.assign({ sx: {
|
|
23
23
|
display: `inline-flex`,
|
|
24
|
-
position: `relative
|
|
25
|
-
} }, { children: [_jsx(MuiButton, Object.assign({
|
|
24
|
+
position: `relative`
|
|
25
|
+
} }, { children: [_jsx(MuiButton, Object.assign({ sx: {
|
|
26
|
+
fontSize: '14px',
|
|
27
|
+
gap: '5px',
|
|
28
|
+
paddingTop: '8px',
|
|
29
|
+
paddingBottom: '8px',
|
|
30
|
+
paddingLeft: '15px',
|
|
31
|
+
paddingRight: '15px',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
lineHeight: '16px',
|
|
35
|
+
height: 36
|
|
36
|
+
}, disableElevation: true }, muiButtonProps, { children: children })), isLoading && _jsx(Indicator, {})] })));
|
|
26
37
|
};
|
|
27
38
|
export default Button;
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
const useButtonProps = (_a) => {
|
|
13
|
-
var {
|
|
14
|
-
return Object.assign({ disabled:
|
|
13
|
+
var { isLoading = false } = _a, props = __rest(_a, ["isLoading"]);
|
|
14
|
+
return Object.assign({ disabled: isLoading || props.disabled, isLoading }, props);
|
|
15
15
|
};
|
|
16
16
|
export default useButtonProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ThemeProviderProps } from '@mui/system';
|
|
2
|
-
declare const ThemeProvider: ({ children
|
|
2
|
+
declare const ThemeProvider: ({ children }: Omit<ThemeProviderProps, 'theme'>) => JSX.Element;
|
|
3
3
|
export default ThemeProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ThemeProvider as MuiThemeProvider } from '@mui/system';
|
|
3
|
-
import
|
|
4
|
-
const ThemeProvider = ({ children
|
|
5
|
-
return
|
|
3
|
+
import MuiTheme from '../../assets/theme';
|
|
4
|
+
const ThemeProvider = ({ children }) => {
|
|
5
|
+
return _jsx(MuiThemeProvider, Object.assign({ theme: MuiTheme }, { children: children }));
|
|
6
6
|
};
|
|
7
7
|
export default ThemeProvider;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,52 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritone-ce/design-system",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
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
|
-
"react-scripts": "5.0.1",
|
|
19
|
-
"typescript": "^4.4.2",
|
|
20
|
-
"web-vitals": "^2.1.0"
|
|
21
|
-
},
|
|
22
5
|
"scripts": {
|
|
23
6
|
"start": "yarn storybook",
|
|
24
7
|
"build": "yarn tsc",
|
|
8
|
+
"lint": "eslint src",
|
|
25
9
|
"build-docs": "yarn build-storybook-docs",
|
|
26
|
-
"test": "
|
|
10
|
+
"test": "jest",
|
|
27
11
|
"storybook": "start-storybook -p 6006 -s public",
|
|
28
12
|
"release": "auto shipit --base-branch=main",
|
|
29
13
|
"generate": "yarn plop --plopfile generators/plopfile.js",
|
|
30
14
|
"build-storybook": "build-storybook -s public",
|
|
31
15
|
"test-storybook": "test-storybook",
|
|
32
16
|
"build-storybook-docs": "build-storybook --docs",
|
|
33
|
-
"prepare": "install-peers"
|
|
34
|
-
},
|
|
35
|
-
"eslintConfig": {
|
|
36
|
-
"extends": [
|
|
37
|
-
"react-app",
|
|
38
|
-
"react-app/jest"
|
|
39
|
-
],
|
|
40
|
-
"overrides": [
|
|
41
|
-
{
|
|
42
|
-
"files": [
|
|
43
|
-
"**/*.stories.*"
|
|
44
|
-
],
|
|
45
|
-
"rules": {
|
|
46
|
-
"import/no-anonymous-default-export": "off"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
]
|
|
17
|
+
"prepare": "install-peers && husky install"
|
|
50
18
|
},
|
|
51
19
|
"browserslist": {
|
|
52
20
|
"production": [
|
|
@@ -60,29 +28,56 @@
|
|
|
60
28
|
"last 1 safari version"
|
|
61
29
|
]
|
|
62
30
|
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@emotion/react": "^11.10.4",
|
|
33
|
+
"@emotion/styled": "^11.10.4",
|
|
34
|
+
"@fontsource/dosis": "^4.5.10",
|
|
35
|
+
"@fontsource/nunito-sans": "^4.5.10",
|
|
36
|
+
"@fontsource/roboto": "^4.5.8",
|
|
37
|
+
"@mui/icons-material": "^5.10.6",
|
|
38
|
+
"@mui/material": "^5.10.8",
|
|
39
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
40
|
+
"@testing-library/react": "^13.4.0",
|
|
41
|
+
"@testing-library/user-event": "^13.2.1",
|
|
42
|
+
"@types/jest": "^27.0.1",
|
|
43
|
+
"@types/node": "^16.7.13",
|
|
44
|
+
"react-scripts": "5.0.1",
|
|
45
|
+
"typescript": "^4.4.2",
|
|
46
|
+
"web-vitals": "^2.1.0"
|
|
47
|
+
},
|
|
63
48
|
"devDependencies": {
|
|
64
49
|
"@babel/cli": "^7.19.3",
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@storybook/addon-
|
|
68
|
-
"@storybook/addon-
|
|
69
|
-
"@storybook/addon-
|
|
70
|
-
"@storybook/
|
|
50
|
+
"@babel/preset-env": "^7.20.2",
|
|
51
|
+
"@babel/preset-react": "^7.18.6",
|
|
52
|
+
"@storybook/addon-a11y": "^6.5.13",
|
|
53
|
+
"@storybook/addon-actions": "^6.5.13",
|
|
54
|
+
"@storybook/addon-essentials": "^6.5.13",
|
|
55
|
+
"@storybook/addon-interactions": "^6.5.13",
|
|
56
|
+
"@storybook/addon-links": "^6.5.13",
|
|
57
|
+
"@storybook/builder-webpack5": "^6.5.13",
|
|
71
58
|
"@storybook/jest": "^0.0.10",
|
|
72
|
-
"@storybook/manager-webpack5": "^6.5.
|
|
73
|
-
"@storybook/node-logger": "^6.5.
|
|
59
|
+
"@storybook/manager-webpack5": "^6.5.13",
|
|
60
|
+
"@storybook/node-logger": "^6.5.13",
|
|
74
61
|
"@storybook/preset-create-react-app": "^4.1.2",
|
|
75
|
-
"@storybook/react": "^6.5.
|
|
76
|
-
"@storybook/test-runner": "^0.
|
|
62
|
+
"@storybook/react": "^6.5.13",
|
|
63
|
+
"@storybook/test-runner": "^0.9.1",
|
|
77
64
|
"@storybook/testing-library": "^0.0.13",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.45.0",
|
|
78
67
|
"auto": "^10.37.6",
|
|
68
|
+
"babel-jest": "^29.3.1",
|
|
79
69
|
"babel-plugin-named-exports-order": "^0.0.2",
|
|
80
70
|
"chromatic": "^6.10.1",
|
|
81
71
|
"cross-env": "^7.0.3",
|
|
72
|
+
"eslint-config-prettier": "^8.5.0",
|
|
73
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
74
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
75
|
+
"husky": "^8.0.2",
|
|
82
76
|
"install-peers-cli": "^2.2.0",
|
|
83
|
-
"jest": "
|
|
77
|
+
"jest": "^29.3.1",
|
|
78
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
84
79
|
"plop": "^3.1.1",
|
|
85
|
-
"prettier": "^2.
|
|
80
|
+
"prettier": "^2.8.0",
|
|
86
81
|
"prop-types": "^15.8.1",
|
|
87
82
|
"webpack": "^5.74.0"
|
|
88
83
|
},
|
|
@@ -92,16 +87,6 @@
|
|
|
92
87
|
"react": "^18.2.0",
|
|
93
88
|
"react-dom": "^18.2.0"
|
|
94
89
|
},
|
|
95
|
-
"babel": {
|
|
96
|
-
"presets": [
|
|
97
|
-
[
|
|
98
|
-
"react-app",
|
|
99
|
-
{
|
|
100
|
-
"absoluteRuntime": false
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
90
|
"description": "Design System for Veritone CE",
|
|
106
91
|
"repository": {
|
|
107
92
|
"type": "git",
|