@webpros/mui-theme 0.1.6 → 0.3.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/package.json +21 -11
- package/dist/src/components/data-display/Avatar/Avatar.theme.js +11 -8
- package/dist/src/components/data-display/Badge/Badge.theme.d.ts +4 -1
- package/dist/src/components/data-display/Badge/Badge.theme.js +216 -55
- package/dist/src/components/data-display/Chip/Chip.theme.d.ts +17 -3
- package/dist/src/components/data-display/Chip/Chip.theme.js +133 -477
- package/dist/src/components/data-display/Chip/get-chip-colors-map.d.ts +42 -0
- package/dist/src/components/data-display/Chip/get-chip-colors-map.js +253 -0
- package/dist/src/components/data-display/Divider/Divider.theme.d.ts +6 -1
- package/dist/src/components/data-display/Divider/Divider.theme.js +60 -3
- package/dist/src/components/data-display/List/List.theme.d.ts +1 -1
- package/dist/src/components/data-display/List/List.theme.js +1 -1
- package/dist/src/components/data-display/ListItem/ListItem.theme.d.ts +1 -1
- package/dist/src/components/data-display/ListItem/ListItem.theme.js +16 -8
- package/dist/src/components/data-display/ListItemAvatar/ListItemAvatar.theme.js +1 -2
- package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.d.ts +0 -5
- package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.js +14 -48
- package/dist/src/components/data-display/ListItemIcon/ListItemIcon.theme.js +4 -4
- package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.d.ts +1 -1
- package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.js +2 -5
- package/dist/src/components/data-display/Skeleton/Skeleton.d.ts +3 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.js +4 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.theme.d.ts +15 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.theme.js +31 -0
- package/dist/src/components/data-display/Skeleton/index.d.ts +1 -0
- package/dist/src/components/data-display/Skeleton/index.js +2 -0
- package/dist/src/components/data-display/Tooltip/Tooltip.theme.js +7 -9
- package/dist/src/components/data-display/Typography/Typography.theme.d.ts +19 -26
- package/dist/src/components/data-display/Typography/Typography.theme.js +7 -163
- package/dist/src/components/feedback/Alert/Alert.theme.d.ts +12 -0
- package/dist/src/components/feedback/Alert/Alert.theme.js +61 -45
- package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.d.ts +6 -1
- package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.js +49 -8
- package/dist/src/components/feedback/Dialog/Dialog.theme.d.ts +5 -0
- package/dist/src/components/feedback/Dialog/Dialog.theme.js +43 -14
- package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.d.ts +6 -1
- package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.js +91 -9
- package/dist/src/components/feedback/Snackbar/Snackbar.theme.d.ts +4 -4
- package/dist/src/components/feedback/Snackbar/Snackbar.theme.js +11 -3
- package/dist/src/components/index.d.ts +10 -1
- package/dist/src/components/index.js +10 -1
- package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.d.ts +1 -1
- package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.js +23 -51
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteCaretDownIcon.d.ts +1 -0
- package/dist/src/components/inputs/Autocomplete/components/{AutocompletePopupIcon.js → AutocompleteCaretDownIcon.js} +1 -1
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.d.ts +1 -0
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.js +4 -0
- package/dist/src/components/inputs/Button/Button.theme.d.ts +4 -0
- package/dist/src/components/inputs/Button/Button.theme.js +93 -226
- package/dist/src/components/inputs/Button/get-button-colors-map.d.ts +24 -0
- package/dist/src/components/inputs/Button/get-button-colors-map.js +211 -0
- package/dist/src/components/inputs/Checkbox/Checkbox.theme.d.ts +7 -2
- package/dist/src/components/inputs/Checkbox/Checkbox.theme.js +57 -7
- package/dist/src/components/inputs/Fab/Fab.theme.d.ts +5 -9
- package/dist/src/components/inputs/Fab/Fab.theme.js +27 -98
- package/dist/src/components/inputs/FormHelperText/FormHelperText.d.ts +2 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.js +3 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.d.ts +7 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.js +8 -0
- package/dist/src/components/inputs/FormHelperText/index.d.ts +1 -0
- package/dist/src/components/inputs/FormHelperText/index.js +2 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.d.ts +2 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.js +3 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.theme.d.ts +7 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.theme.js +8 -0
- package/dist/src/components/inputs/FormLabel/index.d.ts +1 -0
- package/dist/src/components/inputs/FormLabel/index.js +2 -0
- package/dist/src/components/inputs/IconButton/IconButton.theme.d.ts +3 -2
- package/dist/src/components/inputs/IconButton/IconButton.theme.js +90 -95
- package/dist/src/components/inputs/InputBase/InputBase.theme.d.ts +9 -26
- package/dist/src/components/inputs/InputBase/InputBase.theme.js +2 -64
- package/dist/src/components/inputs/InputLabel/InputLabel.theme.d.ts +7 -4
- package/dist/src/components/inputs/InputLabel/InputLabel.theme.js +26 -12
- package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.d.ts +8 -0
- package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.js +67 -0
- package/dist/src/components/inputs/OutlinedInput/index.d.ts +1 -0
- package/dist/src/components/inputs/OutlinedInput/index.js +2 -0
- package/dist/src/components/inputs/Radio/Radio.d.ts +4 -0
- package/dist/src/components/inputs/Radio/Radio.js +4 -0
- package/dist/src/components/inputs/Radio/Radio.theme.d.ts +11 -0
- package/dist/src/components/inputs/Radio/Radio.theme.js +35 -0
- package/dist/src/components/inputs/Radio/index.d.ts +1 -0
- package/dist/src/components/{navigation/TabList → inputs/Radio}/index.js +1 -1
- package/dist/src/components/inputs/Select/Select.theme.d.ts +2 -3
- package/dist/src/components/inputs/Select/Select.theme.js +6 -33
- package/dist/src/components/inputs/Switch/Switch.theme.js +125 -49
- package/dist/src/components/inputs/TextField/TextField.theme.d.ts +2 -3
- package/dist/src/components/inputs/TextField/TextField.theme.js +2 -26
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.js +5 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.d.ts +11 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.js +23 -0
- package/dist/src/components/navigation/Breadcrumbs/Crumb.d.ts +10 -0
- package/dist/src/components/navigation/Breadcrumbs/Crumb.js +10 -0
- package/dist/src/components/navigation/Breadcrumbs/index.d.ts +1 -0
- package/dist/src/components/navigation/Breadcrumbs/index.js +2 -0
- package/dist/src/components/navigation/Drawer/Drawer.theme.d.ts +1 -1
- package/dist/src/components/navigation/Drawer/Drawer.theme.js +50 -6
- package/dist/src/components/navigation/Link/Link.theme.d.ts +11 -2
- package/dist/src/components/navigation/Link/Link.theme.js +66 -9
- package/dist/src/components/navigation/Menu/Menu.theme.d.ts +2 -3
- package/dist/src/components/navigation/Menu/Menu.theme.js +6 -11
- package/dist/src/components/navigation/MenuItem/MenuItem.theme.d.ts +2 -4
- package/dist/src/components/navigation/MenuItem/MenuItem.theme.js +8 -8
- package/dist/src/components/navigation/Pagination/Pagination.theme.d.ts +1 -1
- package/dist/src/components/navigation/Pagination/Pagination.theme.js +11 -3
- package/dist/src/components/navigation/PaginationItem/PaginationItem.theme.js +65 -10
- package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.d.ts +4 -0
- package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.js +8 -0
- package/dist/src/components/navigation/PaginationItem/components/index.d.ts +1 -0
- package/dist/src/components/navigation/PaginationItem/components/index.js +2 -0
- package/dist/src/components/navigation/Tab/Tab.theme.d.ts +7 -1
- package/dist/src/components/navigation/Tab/Tab.theme.js +52 -13
- package/dist/src/components/navigation/Tabs/Tabs.d.ts +3 -0
- package/dist/src/components/navigation/Tabs/Tabs.js +4 -0
- package/dist/src/components/navigation/Tabs/Tabs.theme.d.ts +16 -0
- package/dist/src/components/navigation/Tabs/Tabs.theme.js +55 -0
- package/dist/src/components/navigation/Tabs/index.d.ts +1 -0
- package/dist/src/components/navigation/Tabs/index.js +2 -0
- package/dist/src/components/surfaces/Accordion/Accordion.theme.js +54 -22
- package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.d.ts +10 -0
- package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.js +19 -0
- package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.d.ts +10 -0
- package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.js +37 -0
- package/dist/src/components/surfaces/Accordion/index.d.ts +2 -0
- package/dist/src/components/surfaces/Accordion/index.js +2 -0
- package/dist/src/components/surfaces/Card/Card.theme.js +1 -1
- package/dist/src/components/surfaces/Paper/Paper.theme.d.ts +16 -1
- package/dist/src/components/surfaces/Paper/Paper.theme.js +21 -7
- package/dist/src/components/surfaces/Paper/Paper.tokens.d.ts +8 -0
- package/dist/src/components/surfaces/Paper/Paper.tokens.js +50 -0
- package/dist/src/components/surfaces/Paper/Paper.variants.d.ts +4 -0
- package/dist/src/components/surfaces/Paper/Paper.variants.js +3 -0
- package/dist/src/components/surfaces/Popover/Popover.d.ts +4 -0
- package/dist/src/components/surfaces/Popover/Popover.js +4 -0
- package/dist/src/components/surfaces/Popover/Popover.theme.d.ts +9 -0
- package/dist/src/components/surfaces/Popover/Popover.theme.js +14 -0
- package/dist/src/components/surfaces/Popover/index.d.ts +1 -0
- package/dist/src/components/surfaces/Popover/index.js +2 -0
- package/dist/src/components/utils/Backdrop/Backdrop.d.ts +3 -0
- package/dist/src/components/utils/Backdrop/Backdrop.js +4 -0
- package/dist/src/components/utils/Backdrop/Backdrop.theme.d.ts +11 -0
- package/dist/src/components/utils/Backdrop/Backdrop.theme.js +17 -0
- package/dist/src/components/utils/Backdrop/index.d.ts +1 -0
- package/dist/src/components/utils/Backdrop/index.js +2 -0
- package/dist/src/icons/index.d.ts +4 -0
- package/dist/src/icons/index.js +12 -0
- package/dist/src/providers/ThemeModeProvider.d.ts +1 -2
- package/dist/src/providers/ThemeModeProvider.js +2 -2
- package/dist/src/providers/WebProsMuiThemeProvider.js +1 -1
- package/dist/src/providers/WebProsTheme.d.ts +1 -0
- package/dist/src/providers/WebProsTheme.js +11 -5
- package/dist/src/shared/rippleEnterKeyframe.d.ts +6 -0
- package/dist/src/shared/rippleEnterKeyframe.js +12 -0
- package/dist/src/shared/viewContext/index.d.ts +1 -0
- package/dist/src/shared/viewContext/index.js +2 -0
- package/dist/src/shared/viewContext/viewContext.d.ts +4 -0
- package/dist/src/shared/viewContext/viewContext.js +2 -0
- package/dist/src/style/additional-color-palette.d.ts +1 -3
- package/dist/src/style/additional-color-palette.js +4 -7
- package/dist/src/style/custom-color-palette.js +51 -53
- package/dist/src/tokens/ThemeColorTokens.d.ts +11 -93
- package/dist/src/tokens/ThemeColorTokens.js +4 -168
- package/dist/src/tokens/ThemeScheme.d.ts +0 -3
- package/dist/src/tokens/ThemeScheme.js +0 -2
- package/dist/src/tokens/colors/Dark.d.ts +16 -0
- package/dist/src/tokens/colors/Dark.js +1422 -0
- package/dist/src/tokens/colors/Light.d.ts +16 -0
- package/dist/src/tokens/colors/Light.js +1392 -0
- package/dist/src/tokens/colors/index.d.ts +7 -0
- package/dist/src/tokens/colors/index.js +4 -0
- package/dist/src/tokens/colors/inverseSchemas.d.ts +40 -0
- package/dist/src/tokens/colors/inverseSchemas.js +3 -0
- package/dist/src/tokens/colors/inverseSchemes.d.ts +53 -0
- package/dist/src/tokens/colors/inverseSchemes.js +3 -0
- package/dist/src/tokens/colors/inverseStateLayers.d.ts +188 -0
- package/dist/src/tokens/colors/inverseStateLayers.js +3 -0
- package/dist/src/tokens/colors/schemas.d.ts +111 -0
- package/dist/src/tokens/colors/schemas.js +3 -0
- package/dist/src/tokens/colors/schemes.d.ts +111 -0
- package/dist/src/tokens/colors/schemes.js +3 -0
- package/dist/src/tokens/colors/stateLayers.d.ts +456 -0
- package/dist/src/tokens/colors/stateLayers.js +3 -0
- package/dist/src/tokens/colors/types.d.ts +9 -0
- package/dist/src/tokens/colors/types.js +2 -0
- package/dist/src/tokens/index.d.ts +6 -2
- package/dist/src/tokens/index.js +2 -1
- package/dist/src/tokens/legacyColors/LegacyDark.d.ts +2 -0
- package/dist/src/tokens/legacyColors/LegacyDark.js +88 -0
- package/dist/src/tokens/legacyColors/LegacyLight.d.ts +2 -0
- package/dist/src/tokens/legacyColors/LegacyLight.js +86 -0
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.d.ts +74 -0
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.js +2 -0
- package/dist/src/tokens/legacyColors/additionalColors/additionalColors.d.ts +21 -0
- package/dist/src/tokens/legacyColors/additionalColors/additionalColors.js +2 -0
- package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.d.ts +1 -0
- package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.js +1 -0
- package/dist/src/tokens/legacyColors/index.d.ts +2 -0
- package/dist/src/tokens/legacyColors/index.js +3 -0
- package/dist/src/tokens/shadows/index.d.ts +12 -0
- package/dist/src/tokens/shadows/index.js +112 -0
- package/dist/src/tokens/typography/index.d.ts +2 -0
- package/dist/src/tokens/typography/index.js +4 -0
- package/dist/src/tokens/typography/typescale.d.ts +28 -0
- package/dist/src/tokens/typography/typescale.js +26 -0
- package/dist/src/tokens/typography/typography.d.ts +2 -0
- package/dist/src/tokens/typography/typography.js +156 -0
- package/dist/src/utils/createIcon.d.ts +12 -0
- package/dist/src/utils/createIcon.js +94 -0
- package/dist/src/utils/flatten.d.ts +1 -0
- package/dist/src/utils/flatten.js +12 -0
- package/dist/src/utils/getMUIComponents.js +2 -2
- package/dist/src/utils/getMUIPalette.d.ts +6 -11
- package/dist/src/utils/getMUIPalette.js +49 -25
- package/dist/src/utils/getMUIThemeCustoimzationType.d.ts +31 -0
- package/dist/src/utils/getMUIThemeCustoimzationType.js +2 -0
- package/dist/src/utils/getMUITypography.d.ts +2 -0
- package/dist/src/utils/getMUITypography.js +5 -0
- package/dist/src/utils/getStateLayerColor.d.ts +37 -0
- package/dist/src/utils/getStateLayerColor.js +43 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/patchMUIShadows.js +4 -3
- package/package.json +21 -11
- package/dist/src/components/inputs/Autocomplete/components/AutocompletePopupIcon.d.ts +0 -1
- package/dist/src/components/navigation/PaginationItem/PaginationItem.d.ts +0 -3
- package/dist/src/components/navigation/PaginationItem/PaginationItem.js +0 -4
- package/dist/src/components/navigation/TabList/TabList.d.ts +0 -3
- package/dist/src/components/navigation/TabList/TabList.js +0 -4
- package/dist/src/components/navigation/TabList/TabList.theme.d.ts +0 -10
- package/dist/src/components/navigation/TabList/TabList.theme.js +0 -17
- package/dist/src/components/navigation/TabList/index.d.ts +0 -1
- package/dist/src/hooks/useTonalPalette.d.ts +0 -3
- package/dist/src/hooks/useTonalPalette.js +0 -32
- package/dist/src/providers/ThemeSchemeProvider.d.ts +0 -12
- package/dist/src/providers/ThemeSchemeProvider.js +0 -29
- package/dist/src/tokens/TonalPalette.d.ts +0 -10
- package/dist/src/tokens/TonalPalette.js +0 -10
- package/dist/src/utils/generateTokens.d.ts +0 -4
- package/dist/src/utils/generateTokens.js +0 -107
- /package/dist/src/tokens/{Tone.d.ts → legacyColors/Tone.d.ts} +0 -0
- /package/dist/src/tokens/{Tone.js → legacyColors/Tone.js} +0 -0
|
@@ -1,241 +1,108 @@
|
|
|
1
1
|
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { flatten } from '../../../utils/flatten';
|
|
3
|
+
import { buttonClasses, circularProgressClasses, iconButtonClasses, touchRippleClasses, } from '@mui/material';
|
|
4
|
+
import { getButtonColorsMap } from './get-button-colors-map';
|
|
5
|
+
import { rippleEnterKeyframe } from '../../../shared/rippleEnterKeyframe';
|
|
4
6
|
export const getButton = (theme) => {
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
const { typography } = theme;
|
|
8
|
+
const sizes = [
|
|
9
|
+
{
|
|
10
|
+
props: { size: 'small' },
|
|
11
|
+
style: Object.assign(Object.assign({}, typography.LabelSmall), { padding: '2px 8px', height: 20, borderRadius: '17px',
|
|
12
|
+
// `!important` is the only way in this case to rewrite loader icon size
|
|
13
|
+
[`& .${circularProgressClasses.root}`]: {
|
|
14
|
+
width: '12px !important',
|
|
15
|
+
height: '12px !important',
|
|
16
|
+
} }),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
props: { size: 'medium' },
|
|
20
|
+
style: Object.assign(Object.assign({}, typography.LabelMedium), { borderRadius: '17px', height: 34, padding: '7px 17px' }),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
props: { size: 'large' },
|
|
24
|
+
style: Object.assign(Object.assign({}, typography.LabelLarge), { borderRadius: '24px', height: 42, padding: '9px 24px' }),
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const getStylesByColor = (color, viewContext) => {
|
|
28
|
+
const colorsMap = getButtonColorsMap(theme);
|
|
29
|
+
const inverseColorsMap = getButtonColorsMap(theme, 'inverse');
|
|
30
|
+
const colorsPalette = viewContext === 'inverse' ? inverseColorsMap[color] : colorsMap[color];
|
|
31
|
+
// variants = [filled?, tonal, ghost]
|
|
32
|
+
const variantsStyles = Object.entries(colorsPalette).map(([variant, variantColors]) => [
|
|
33
|
+
{
|
|
34
|
+
props: { variant: variant, color, viewContext },
|
|
35
|
+
style: {
|
|
36
|
+
background: variantColors.background,
|
|
37
|
+
color: variantColors.color,
|
|
38
|
+
'&:hover': {
|
|
39
|
+
background: variantColors.hover,
|
|
40
|
+
},
|
|
41
|
+
'&:active': {
|
|
42
|
+
background: variantColors.active,
|
|
43
|
+
},
|
|
44
|
+
'&:focus': {
|
|
45
|
+
background: variantColors.focus,
|
|
46
|
+
},
|
|
47
|
+
[`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
|
|
48
|
+
color: variantColors.ripple,
|
|
18
49
|
},
|
|
19
|
-
'.MuiButton-startIcon': { marginRight: 4 },
|
|
20
|
-
'.MuiButton-endIcon': { marginLeft: 4 },
|
|
21
50
|
},
|
|
22
51
|
},
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fontSize: '0.875rem',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
props: { variant: 'filled' },
|
|
34
|
-
style: {
|
|
35
|
-
backgroundColor: palette.primary.main,
|
|
36
|
-
color: palette.onPrimary.main,
|
|
37
|
-
boxShadow: theme.shadows[0],
|
|
38
|
-
padding: '0 24px',
|
|
39
|
-
'&:hover': {
|
|
40
|
-
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.primary.main, palette.onPrimary.main),
|
|
41
|
-
boxShadow: theme.shadows[1],
|
|
42
|
-
},
|
|
43
|
-
'&:focus': {
|
|
44
|
-
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.primary.main, palette.onPrimary.main),
|
|
45
|
-
boxShadow: theme.shadows[0],
|
|
46
|
-
},
|
|
47
|
-
'&:active': {
|
|
48
|
-
backgroundColor: getStateLayerColor(StateLayer.Press, palette.primary.main, palette.onPrimary.main),
|
|
49
|
-
boxShadow: theme.shadows[0],
|
|
50
|
-
outline: `2px solid ${getStateLayerColor(StateLayer.Press, palette.primary.main, palette.onPrimary.main)}`,
|
|
51
|
-
outlineOffset: 2,
|
|
52
|
-
},
|
|
53
|
-
'&.Mui-disabled': {
|
|
54
|
-
backgroundColor: alpha(palette.onSurface.main, 0.04),
|
|
55
|
-
boxShadow: theme.shadows[0],
|
|
56
|
-
},
|
|
57
|
-
'.MuiButton-startIcon': { marginLeft: -8 },
|
|
58
|
-
'.MuiButton-endIcon': { marginRight: -8 },
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
props: { variant: 'filled', size: 'small' },
|
|
63
|
-
style: {
|
|
64
|
-
padding: '0 12px',
|
|
65
|
-
'.MuiButton-startIcon': { marginLeft: -4 },
|
|
66
|
-
'.MuiButton-endIcon': { marginRight: -4 },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
props: { variant: 'outlined' },
|
|
71
|
-
style: {
|
|
72
|
-
color: palette.primary.main,
|
|
73
|
-
borderColor: palette.outline.main,
|
|
74
|
-
borderWidth: 1,
|
|
75
|
-
padding: '0 24px',
|
|
76
|
-
'&:hover': {
|
|
77
|
-
backgroundColor: alpha(palette.primary.main, 0.08),
|
|
78
|
-
borderColor: palette.outline.main,
|
|
79
|
-
},
|
|
80
|
-
'&:focus': {
|
|
81
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
82
|
-
borderColor: palette.primary.main,
|
|
83
|
-
},
|
|
84
|
-
'&:active': {
|
|
85
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
86
|
-
borderColor: palette.outline.main,
|
|
87
|
-
},
|
|
88
|
-
'&.Mui-disabled': {
|
|
89
|
-
borderColor: alpha(palette.onSurface.main, 0.12),
|
|
90
|
-
},
|
|
91
|
-
'.MuiButton-startIcon': { marginLeft: -8 },
|
|
92
|
-
'.MuiButton-endIcon': { marginRight: -8 },
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
props: { variant: 'outlined', size: 'small' },
|
|
97
|
-
style: {
|
|
98
|
-
padding: '0 12px',
|
|
99
|
-
'.MuiButton-startIcon': { marginLeft: 0 },
|
|
100
|
-
'.MuiButton-endIcon': { marginRight: 0 },
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
props: { variant: 'text' },
|
|
105
|
-
style: {
|
|
106
|
-
backgroundColor: 'transparent',
|
|
107
|
-
color: palette.primary.main,
|
|
108
|
-
'&:hover': {
|
|
109
|
-
backgroundColor: alpha(palette.primary.main, 0.08),
|
|
110
|
-
},
|
|
111
|
-
'&:focus': {
|
|
112
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
113
|
-
},
|
|
114
|
-
'&:active': {
|
|
115
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
116
|
-
},
|
|
117
|
-
'.MuiButton-startIcon': { marginLeft: -2 },
|
|
118
|
-
'.MuiButton-endIcon': { marginRight: -2 },
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
props: { variant: 'text', size: 'small' },
|
|
123
|
-
style: {
|
|
124
|
-
padding: '0 6px',
|
|
52
|
+
{
|
|
53
|
+
props: { variant: variant, color, viewContext, disabled: true },
|
|
54
|
+
style: {
|
|
55
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
56
|
+
color: variantColors.disabledColor,
|
|
57
|
+
background: variantColors.disabledBackground,
|
|
125
58
|
},
|
|
126
59
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
'&:focus': {
|
|
136
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
137
|
-
},
|
|
138
|
-
'&:active': {
|
|
139
|
-
backgroundColor: alpha(palette.primary.main, 0.12),
|
|
140
|
-
},
|
|
141
|
-
'& .MuiButton-startIcon': {
|
|
142
|
-
marginRight: 4,
|
|
143
|
-
},
|
|
144
|
-
'.MuiButton-startIcon': { marginLeft: -2 },
|
|
145
|
-
'.MuiButton-endIcon': { marginRight: -2 },
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
props: { variant: 'ghost', size: 'small' },
|
|
150
|
-
style: {
|
|
151
|
-
padding: '0 6px',
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
props: { variant: 'elevated' },
|
|
156
|
-
style: {
|
|
157
|
-
boxShadow: theme.shadows[1],
|
|
158
|
-
backgroundColor: palette.surfaceContainerLow.main,
|
|
159
|
-
color: palette.primary.main,
|
|
160
|
-
padding: '0 24px',
|
|
161
|
-
'&:hover': {
|
|
162
|
-
background: getStateLayerColor(StateLayer.Hover, palette.surfaceContainerLow.main, palette.primary.main),
|
|
163
|
-
boxShadow: theme.shadows[2],
|
|
164
|
-
},
|
|
165
|
-
'&:focus': {
|
|
166
|
-
background: getStateLayerColor(StateLayer.Focus, palette.surfaceContainerLow.main, palette.primary.main),
|
|
167
|
-
},
|
|
168
|
-
'&:active': {
|
|
169
|
-
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainerLow.main, palette.primary.main),
|
|
170
|
-
},
|
|
171
|
-
'&.Mui-disabled': {
|
|
172
|
-
backgroundColor: alpha(palette.onSurface.main, 0.04),
|
|
173
|
-
boxShadow: theme.shadows[0],
|
|
174
|
-
},
|
|
175
|
-
'.MuiButton-startIcon': { marginLeft: -8 },
|
|
176
|
-
'.MuiButton-endIcon': { marginRight: -8 },
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
props: { variant: 'elevated', size: 'small' },
|
|
181
|
-
style: {
|
|
182
|
-
padding: '0 12px',
|
|
183
|
-
'.MuiButton-startIcon': { marginLeft: -4 },
|
|
184
|
-
'.MuiButton-endIcon': { marginRight: -4 },
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
props: { variant: 'tonal' },
|
|
189
|
-
style: {
|
|
190
|
-
backgroundColor: palette.secondaryContainer.main,
|
|
191
|
-
color: palette.onSecondaryContainer.main,
|
|
192
|
-
padding: '0 24px',
|
|
193
|
-
'&:hover': {
|
|
194
|
-
backgroundColor: palette.primary.main,
|
|
195
|
-
color: palette.onPrimary.main,
|
|
196
|
-
},
|
|
197
|
-
'&:focus': {
|
|
198
|
-
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.primary.main, palette.onSecondaryContainer.main),
|
|
199
|
-
color: palette.onPrimary.main,
|
|
200
|
-
},
|
|
201
|
-
'&:active': {
|
|
202
|
-
backgroundColor: getStateLayerColor(StateLayer.Press, palette.primary.main, palette.onSecondaryContainer.main),
|
|
203
|
-
color: palette.onPrimary.main,
|
|
204
|
-
outline: `2px solid ${getStateLayerColor(StateLayer.Press, palette.primary.main, palette.onSecondaryContainer.main)}`,
|
|
205
|
-
outlineOffset: 2,
|
|
206
|
-
},
|
|
207
|
-
'&.Mui-disabled': {
|
|
208
|
-
backgroundColor: alpha(palette.onSurface.main, 0.04),
|
|
209
|
-
},
|
|
210
|
-
'.MuiButton-startIcon': { marginLeft: -8 },
|
|
211
|
-
'.MuiButton-endIcon': { marginRight: -8 },
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
props: { variant: 'tonal', size: 'small' },
|
|
216
|
-
style: {
|
|
217
|
-
padding: '0 12px',
|
|
218
|
-
'.MuiButton-startIcon': { marginLeft: -4 },
|
|
219
|
-
'.MuiButton-endIcon': { marginRight: -4 },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
props: { variant: variant, color, viewContext, loading: true },
|
|
63
|
+
style: {
|
|
64
|
+
[`&.${iconButtonClasses.disabled}`]: {
|
|
65
|
+
color: variantColors.loadingColor,
|
|
66
|
+
background: variantColors.loadingBackground,
|
|
220
67
|
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
props: { variant: 'filled', color: 'error' },
|
|
224
|
-
style: {
|
|
225
|
-
backgroundColor: palette.error.main,
|
|
226
|
-
color: palette.background.default,
|
|
227
|
-
'&:hover': {
|
|
228
|
-
backgroundColor: palette.error.main,
|
|
229
|
-
},
|
|
68
|
+
[`.${buttonClasses.loadingIndicator}`]: {
|
|
69
|
+
color: variantColors.loadingIndicator,
|
|
230
70
|
},
|
|
231
71
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
74
|
+
return flatten(variantsStyles);
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
MuiButton: {
|
|
78
|
+
styleOverrides: {
|
|
79
|
+
root: {
|
|
80
|
+
textTransform: 'none',
|
|
81
|
+
boxShadow: 'none',
|
|
82
|
+
'.MuiButton-startIcon': { marginRight: 4 },
|
|
83
|
+
'.MuiButton-endIcon': { marginLeft: 4 },
|
|
84
|
+
minWidth: 'auto', // Overriding for small buttons
|
|
85
|
+
[`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
|
|
86
|
+
opacity: 1,
|
|
87
|
+
animationName: rippleEnterKeyframe,
|
|
237
88
|
},
|
|
238
89
|
},
|
|
90
|
+
},
|
|
91
|
+
variants: [
|
|
92
|
+
// First we define size variants to ensure proper sizing. Do not couple size with variant and colors.
|
|
93
|
+
...sizes,
|
|
94
|
+
// Now we define variants and colors. Name the variants and states according to the Figma file.
|
|
95
|
+
// Is there is required difference in namings - you should contract design team to clarify it and fix it.
|
|
96
|
+
...getStylesByColor('primary'),
|
|
97
|
+
...getStylesByColor('default'),
|
|
98
|
+
...getStylesByColor('secondary'),
|
|
99
|
+
...getStylesByColor('error'),
|
|
100
|
+
...getStylesByColor('success'),
|
|
101
|
+
...getStylesByColor('primary', 'inverse'),
|
|
102
|
+
...getStylesByColor('default', 'inverse'),
|
|
103
|
+
...getStylesByColor('secondary', 'inverse'),
|
|
104
|
+
...getStylesByColor('error', 'inverse'),
|
|
105
|
+
...getStylesByColor('success', 'inverse'),
|
|
239
106
|
],
|
|
240
107
|
},
|
|
241
108
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { ViewContext } from '../../../shared/viewContext';
|
|
3
|
+
type IconButtonColors = {
|
|
4
|
+
background: string;
|
|
5
|
+
color: string;
|
|
6
|
+
disabledBackground: string;
|
|
7
|
+
disabledColor: string;
|
|
8
|
+
loadingBackground: string;
|
|
9
|
+
loadingColor: string;
|
|
10
|
+
loadingIndicator: string;
|
|
11
|
+
hover: string;
|
|
12
|
+
active: string;
|
|
13
|
+
focus: string;
|
|
14
|
+
ripple?: string;
|
|
15
|
+
};
|
|
16
|
+
export type Variant = 'filled' | 'tonal' | 'ghost';
|
|
17
|
+
export declare const getButtonColorsMap: (theme: Theme, viewContext?: ViewContext) => {
|
|
18
|
+
primary: Partial<Record<Variant, IconButtonColors>>;
|
|
19
|
+
default: Partial<Record<Variant, IconButtonColors>>;
|
|
20
|
+
secondary: Partial<Record<Variant, IconButtonColors>>;
|
|
21
|
+
error: Partial<Record<Variant, IconButtonColors>>;
|
|
22
|
+
success: Partial<Record<Variant, IconButtonColors>>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
+
// Here are extracted colors for `Button` and `IconButton` components, because they have the same color schemes.
|
|
3
|
+
// Not applicable to other components
|
|
4
|
+
export const getButtonColorsMap = (theme, viewContext) => {
|
|
5
|
+
const isInverseView = viewContext === 'inverse';
|
|
6
|
+
const { colors } = theme;
|
|
7
|
+
const schemesPath = isInverseView ? 'inverseSchemes' : 'schemes';
|
|
8
|
+
const stateLayersPath = isInverseView ? 'inverseStateLayers' : 'stateLayers';
|
|
9
|
+
const blendColors = isInverseView
|
|
10
|
+
? colors.blendInverseSchemaWithStateLayer
|
|
11
|
+
: colors.blendSchemaWithStateLayer;
|
|
12
|
+
const PRIMARY_COLORS = {
|
|
13
|
+
filled: {
|
|
14
|
+
background: colors[schemesPath].base.primary,
|
|
15
|
+
color: colors[schemesPath].base.onPrimary,
|
|
16
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
17
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
18
|
+
loadingBackground: colors[schemesPath].base.primary,
|
|
19
|
+
loadingColor: 'transparent',
|
|
20
|
+
loadingIndicator: colors[schemesPath].base.onPrimary,
|
|
21
|
+
hover: blendColors(`${schemesPath}.base.primary`, `${stateLayersPath}.base.onPrimary.opacity08`),
|
|
22
|
+
active: blendColors(`${schemesPath}.base.primary`, `${stateLayersPath}.base.onPrimary.opacity12`),
|
|
23
|
+
focus: blendColors(`${schemesPath}.base.primary`, `${stateLayersPath}.base.onPrimary.opacity12`),
|
|
24
|
+
ripple: colors[stateLayersPath].base.onPrimary.opacity12,
|
|
25
|
+
},
|
|
26
|
+
tonal: {
|
|
27
|
+
background: colors[schemesPath].base.primaryContainer,
|
|
28
|
+
color: colors[schemesPath].base.onPrimaryContainer,
|
|
29
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
30
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
31
|
+
loadingBackground: colors[schemesPath].base.primaryContainer,
|
|
32
|
+
loadingColor: 'transparent',
|
|
33
|
+
loadingIndicator: colors[schemesPath].base.onPrimaryContainer,
|
|
34
|
+
hover: blendColors(`${schemesPath}.base.primaryContainer`, `${stateLayersPath}.base.onPrimaryContainer.opacity08`),
|
|
35
|
+
active: blendColors(`${schemesPath}.base.primaryContainer`, `${stateLayersPath}.base.onPrimaryContainer.opacity12`),
|
|
36
|
+
focus: blendColors(`${schemesPath}.base.primaryContainer`, `${stateLayersPath}.base.onPrimaryContainer.opacity12`),
|
|
37
|
+
ripple: colors[stateLayersPath].base.onPrimaryContainer.opacity12,
|
|
38
|
+
},
|
|
39
|
+
ghost: {
|
|
40
|
+
background: 'transparent',
|
|
41
|
+
color: colors[schemesPath].base.primary,
|
|
42
|
+
disabledBackground: 'transparent',
|
|
43
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
44
|
+
loadingBackground: 'transparent',
|
|
45
|
+
loadingColor: 'transparent',
|
|
46
|
+
loadingIndicator: colors[schemesPath].base.primary,
|
|
47
|
+
hover: colors[stateLayersPath].base.primary.opacity08,
|
|
48
|
+
active: colors[stateLayersPath].base.primary.opacity12,
|
|
49
|
+
focus: colors[stateLayersPath].base.primary.opacity12,
|
|
50
|
+
ripple: colors[stateLayersPath].base.primary.opacity12,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const DEFAULT_COLORS = {
|
|
54
|
+
tonal: {
|
|
55
|
+
background: colors[schemesPath].surfaces.surfaceContainer,
|
|
56
|
+
color: colors[schemesPath].surfaces.onSurfaceVariant,
|
|
57
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
58
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
59
|
+
loadingBackground: colors[schemesPath].surfaces.surfaceContainer,
|
|
60
|
+
loadingColor: 'transparent',
|
|
61
|
+
loadingIndicator: colors[schemesPath].surfaces.onSurfaceVariant,
|
|
62
|
+
hover: blendColors(`${schemesPath}.surfaces.surfaceContainer`, `${stateLayersPath}.surfaces.onSurfaceVariant.opacity08`),
|
|
63
|
+
active: blendColors(`${schemesPath}.surfaces.surfaceContainer`, `${stateLayersPath}.surfaces.onSurfaceVariant.opacity12`),
|
|
64
|
+
focus: blendColors(`${schemesPath}.surfaces.surfaceContainer`, `${stateLayersPath}.surfaces.onSurfaceVariant.opacity12`),
|
|
65
|
+
ripple: colors[stateLayersPath].surfaces.onSurfaceVariant.opacity12,
|
|
66
|
+
},
|
|
67
|
+
ghost: {
|
|
68
|
+
background: 'transparent',
|
|
69
|
+
color: colors[schemesPath].surfaces.onSurfaceVariant,
|
|
70
|
+
disabledBackground: 'transparent',
|
|
71
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
72
|
+
loadingBackground: 'transparent',
|
|
73
|
+
loadingColor: 'transparent',
|
|
74
|
+
loadingIndicator: colors[schemesPath].surfaces.onSurfaceVariant,
|
|
75
|
+
hover: colors[stateLayersPath].surfaces.onSurfaceVariant.opacity08,
|
|
76
|
+
active: colors[stateLayersPath].surfaces.onSurfaceVariant.opacity12,
|
|
77
|
+
focus: colors[stateLayersPath].surfaces.onSurfaceVariant.opacity12,
|
|
78
|
+
ripple: colors[stateLayersPath].surfaces.onSurfaceVariant.opacity12,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const SECONDARY_COLORS = {
|
|
82
|
+
filled: {
|
|
83
|
+
background: colors[schemesPath].base.secondary,
|
|
84
|
+
color: colors[schemesPath].base.onSecondary,
|
|
85
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
86
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
87
|
+
loadingBackground: colors[schemesPath].base.secondary,
|
|
88
|
+
loadingColor: 'transparent',
|
|
89
|
+
loadingIndicator: colors[schemesPath].base.onSecondary,
|
|
90
|
+
hover: blendColors(`${schemesPath}.base.secondary`, `${stateLayersPath}.base.onSecondary.opacity08`),
|
|
91
|
+
active: blendColors(`${schemesPath}.base.secondary`, `${stateLayersPath}.base.onSecondary.opacity12`),
|
|
92
|
+
focus: blendColors(`${schemesPath}.base.secondary`, `${stateLayersPath}.base.onSecondary.opacity12`),
|
|
93
|
+
ripple: colors[stateLayersPath].base.onSecondary.opacity12,
|
|
94
|
+
},
|
|
95
|
+
tonal: {
|
|
96
|
+
background: colors[schemesPath].base.secondaryContainer,
|
|
97
|
+
color: colors[schemesPath].base.onSecondaryContainer,
|
|
98
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
99
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
100
|
+
loadingBackground: colors[schemesPath].base.secondaryContainer,
|
|
101
|
+
loadingColor: 'transparent',
|
|
102
|
+
loadingIndicator: colors[schemesPath].base.secondary,
|
|
103
|
+
hover: blendColors(`${schemesPath}.base.secondaryContainer`, `${stateLayersPath}.base.onSecondaryContainer.opacity08`),
|
|
104
|
+
active: blendColors(`${schemesPath}.base.secondaryContainer`, `${stateLayersPath}.base.onSecondaryContainer.opacity12`),
|
|
105
|
+
focus: blendColors(`${schemesPath}.base.secondaryContainer`, `${stateLayersPath}.base.onSecondaryContainer.opacity12`),
|
|
106
|
+
ripple: colors[stateLayersPath].base.onSecondaryContainer.opacity12,
|
|
107
|
+
},
|
|
108
|
+
ghost: {
|
|
109
|
+
background: 'transparent',
|
|
110
|
+
color: colors[schemesPath].base.secondary,
|
|
111
|
+
disabledBackground: 'transparent',
|
|
112
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
113
|
+
loadingBackground: 'transparent',
|
|
114
|
+
loadingColor: 'transparent',
|
|
115
|
+
loadingIndicator: colors[schemesPath].base.secondary,
|
|
116
|
+
hover: colors[schemesPath].base.secondaryContainer,
|
|
117
|
+
active: blendColors(`${schemesPath}.base.secondaryContainer`, `${stateLayersPath}.base.secondary.opacity08`),
|
|
118
|
+
focus: blendColors(`${schemesPath}.base.secondaryContainer`, `${stateLayersPath}.base.secondary.opacity08`),
|
|
119
|
+
ripple: colors[stateLayersPath].base.secondary.opacity12,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
const ERROR_COLORS = {
|
|
123
|
+
filled: {
|
|
124
|
+
background: colors[schemesPath].status.error,
|
|
125
|
+
color: colors[schemesPath].status.onError,
|
|
126
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
127
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
128
|
+
loadingBackground: colors[schemesPath].status.error,
|
|
129
|
+
loadingColor: 'transparent',
|
|
130
|
+
loadingIndicator: colors[schemesPath].status.onError,
|
|
131
|
+
hover: blendColors(`${schemesPath}.status.error`, `${stateLayersPath}.status.onError.opacity08`),
|
|
132
|
+
active: blendColors(`${schemesPath}.status.error`, `${stateLayersPath}.status.onError.opacity12`),
|
|
133
|
+
focus: blendColors(`${schemesPath}.status.error`, `${stateLayersPath}.status.onError.opacity12`),
|
|
134
|
+
ripple: colors[stateLayersPath].status.onError.opacity12,
|
|
135
|
+
},
|
|
136
|
+
tonal: {
|
|
137
|
+
background: colors[schemesPath].status.errorContainer,
|
|
138
|
+
color: colors[schemesPath].status.onErrorContainer,
|
|
139
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
140
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
141
|
+
loadingBackground: colors[schemesPath].status.errorContainer,
|
|
142
|
+
loadingColor: 'transparent',
|
|
143
|
+
loadingIndicator: colors[schemesPath].status.onErrorContainer,
|
|
144
|
+
hover: blendColors(`${schemesPath}.status.errorContainer`, `${stateLayersPath}.status.onErrorContainer.opacity08`),
|
|
145
|
+
active: blendColors(`${schemesPath}.status.errorContainer`, `${stateLayersPath}.status.onErrorContainer.opacity12`),
|
|
146
|
+
focus: blendColors(`${schemesPath}.status.errorContainer`, `${stateLayersPath}.status.onErrorContainer.opacity12`),
|
|
147
|
+
ripple: colors[stateLayersPath].status.onErrorContainer.opacity08,
|
|
148
|
+
},
|
|
149
|
+
ghost: {
|
|
150
|
+
background: 'transparent',
|
|
151
|
+
color: colors[schemesPath].status.onErrorContainer,
|
|
152
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
153
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
154
|
+
loadingBackground: 'transparent',
|
|
155
|
+
loadingColor: 'transparent',
|
|
156
|
+
loadingIndicator: colors[schemesPath].status.error,
|
|
157
|
+
hover: colors[stateLayersPath].status.error.opacity08,
|
|
158
|
+
active: colors[stateLayersPath].status.error.opacity12,
|
|
159
|
+
focus: colors[stateLayersPath].status.error.opacity12,
|
|
160
|
+
ripple: colors[stateLayersPath].status.error.opacity12,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
const SUCCESS_COLORS = {
|
|
164
|
+
filled: {
|
|
165
|
+
background: colors[schemesPath].status.success,
|
|
166
|
+
color: colors[schemesPath].status.onSuccess,
|
|
167
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
168
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
169
|
+
loadingBackground: colors[schemesPath].status.success,
|
|
170
|
+
loadingColor: 'transparent',
|
|
171
|
+
loadingIndicator: colors[schemesPath].status.onSuccess,
|
|
172
|
+
hover: blendColors(`${schemesPath}.status.success`, `${stateLayersPath}.status.onSuccess.opacity08`),
|
|
173
|
+
active: blendColors(`${schemesPath}.status.success`, `${stateLayersPath}.status.onSuccess.opacity12`),
|
|
174
|
+
focus: blendColors(`${schemesPath}.status.success`, `${stateLayersPath}.status.onSuccess.opacity12`),
|
|
175
|
+
ripple: colors[stateLayersPath].status.onSuccess.opacity12,
|
|
176
|
+
},
|
|
177
|
+
tonal: {
|
|
178
|
+
background: colors[schemesPath].status.successContainer,
|
|
179
|
+
color: colors[schemesPath].status.onSuccessContainer,
|
|
180
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
181
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
182
|
+
loadingBackground: colors[schemesPath].status.successContainer,
|
|
183
|
+
loadingColor: 'transparent',
|
|
184
|
+
loadingIndicator: colors[schemesPath].status.onSuccessContainer,
|
|
185
|
+
hover: blendColors(`${schemesPath}.status.successContainer`, `${stateLayersPath}.status.onSuccessContainer.opacity08`),
|
|
186
|
+
active: blendColors(`${schemesPath}.status.successContainer`, `${stateLayersPath}.status.onSuccessContainer.opacity12`),
|
|
187
|
+
focus: blendColors(`${schemesPath}.status.successContainer`, `${stateLayersPath}.status.onSuccessContainer.opacity12`),
|
|
188
|
+
ripple: colors[stateLayersPath].status.onSuccessContainer.opacity08,
|
|
189
|
+
},
|
|
190
|
+
ghost: {
|
|
191
|
+
background: 'transparent',
|
|
192
|
+
color: colors[schemesPath].status.onSuccessContainer,
|
|
193
|
+
disabledBackground: colors[stateLayersPath].surfaces.onSurface.opacity12,
|
|
194
|
+
disabledColor: colors[stateLayersPath].surfaces.onSurface.opacity38,
|
|
195
|
+
loadingBackground: 'transparent',
|
|
196
|
+
loadingColor: 'transparent',
|
|
197
|
+
loadingIndicator: colors[schemesPath].status.success,
|
|
198
|
+
hover: colors[stateLayersPath].status.success.opacity08,
|
|
199
|
+
active: colors[stateLayersPath].status.success.opacity12,
|
|
200
|
+
focus: colors[stateLayersPath].status.success.opacity12,
|
|
201
|
+
ripple: colors[stateLayersPath].status.success.opacity12,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
primary: PRIMARY_COLORS,
|
|
206
|
+
default: DEFAULT_COLORS,
|
|
207
|
+
secondary: SECONDARY_COLORS,
|
|
208
|
+
error: ERROR_COLORS,
|
|
209
|
+
success: SUCCESS_COLORS,
|
|
210
|
+
};
|
|
211
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { Theme,
|
|
1
|
+
import { Theme, ComponentsOverrides, ComponentsVariants } from '@mui/material';
|
|
2
|
+
import { ComponentWithViewContextOwnProps } from '../../../shared/viewContext';
|
|
3
|
+
declare module '@mui/material/Checkbox' {
|
|
4
|
+
interface CheckboxProps extends ComponentWithViewContextOwnProps {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
2
7
|
interface M3Checkbox {
|
|
3
8
|
MuiCheckbox: {
|
|
4
|
-
defaultProps?: ComponentsProps['MuiCheckbox'];
|
|
5
9
|
styleOverrides?: ComponentsOverrides<Theme>['MuiCheckbox'];
|
|
10
|
+
variants?: ComponentsVariants<Theme>['MuiCheckbox'];
|
|
6
11
|
};
|
|
7
12
|
}
|
|
8
13
|
export declare const getCheckbox: (theme: Theme) => M3Checkbox;
|
|
@@ -1,19 +1,69 @@
|
|
|
1
1
|
export const getCheckbox = (theme) => {
|
|
2
|
-
const {
|
|
2
|
+
const { colors } = theme;
|
|
3
3
|
return {
|
|
4
4
|
MuiCheckbox: {
|
|
5
5
|
styleOverrides: {
|
|
6
6
|
root: {
|
|
7
|
-
color: palette.outline.main,
|
|
8
|
-
padding: 8,
|
|
9
|
-
'&.Mui-checked': {
|
|
10
|
-
color: palette.primary.main,
|
|
11
|
-
},
|
|
12
7
|
'&.Mui-disabled': {
|
|
13
|
-
color:
|
|
8
|
+
color: colors.stateLayers.surfaces.onSurfaceVariant.opacity38,
|
|
14
9
|
},
|
|
15
10
|
},
|
|
16
11
|
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
props: { color: 'default' },
|
|
15
|
+
style: {
|
|
16
|
+
color: colors.schemes.surfaces.onSurfaceVariant,
|
|
17
|
+
'&.Mui-checked': {
|
|
18
|
+
color: colors.schemes.base.primary,
|
|
19
|
+
},
|
|
20
|
+
'&.MuiCheckbox-indeterminate': {
|
|
21
|
+
color: colors.schemes.base.primary,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
props: { color: 'error' },
|
|
27
|
+
style: {
|
|
28
|
+
color: colors.schemes.status.error,
|
|
29
|
+
'&.Mui-checked': {
|
|
30
|
+
color: colors.schemes.status.error,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
props: { viewContext: 'inverse' },
|
|
36
|
+
style: {
|
|
37
|
+
'&.Mui-disabled': {
|
|
38
|
+
color: colors.inverseStateLayers.surfaces.onSurfaceVariant.opacity28,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
props: { color: 'default', viewContext: 'inverse' },
|
|
44
|
+
style: {
|
|
45
|
+
color: colors.inverseSchemes.surfaces.onSurfaceVariant,
|
|
46
|
+
'&.Mui-checked': {
|
|
47
|
+
color: colors.inverseSchemes.base.primary,
|
|
48
|
+
},
|
|
49
|
+
'&.MuiCheckbox-indeterminate': {
|
|
50
|
+
color: colors.inverseSchemes.base.primary,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
props: { color: 'error', viewContext: 'inverse' },
|
|
56
|
+
style: {
|
|
57
|
+
color: colors.inverseSchemes.status.error,
|
|
58
|
+
'&.Mui-checked': {
|
|
59
|
+
color: colors.inverseSchemes.status.error,
|
|
60
|
+
},
|
|
61
|
+
'&.MuiCheckbox-indeterminate': {
|
|
62
|
+
color: colors.inverseSchemes.status.error,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
17
67
|
},
|
|
18
68
|
};
|
|
19
69
|
};
|