@veritone-ce/design-system 1.1.0 → 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.
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritone-ce/design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "yarn storybook",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build-storybook": "build-storybook -s public",
|
|
15
15
|
"test-storybook": "test-storybook",
|
|
16
16
|
"build-storybook-docs": "build-storybook --docs",
|
|
17
|
-
"prepare": "install-peers"
|
|
17
|
+
"prepare": "install-peers && husky install"
|
|
18
18
|
},
|
|
19
19
|
"browserslist": {
|
|
20
20
|
"production": [
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"eslint-config-prettier": "^8.5.0",
|
|
73
73
|
"eslint-plugin-prettier": "^4.2.1",
|
|
74
74
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
75
|
+
"husky": "^8.0.2",
|
|
75
76
|
"install-peers-cli": "^2.2.0",
|
|
76
77
|
"jest": "^29.3.1",
|
|
77
78
|
"jest-environment-jsdom": "^29.3.1",
|