@mui/material 6.0.0-alpha.3 → 6.0.0-alpha.4
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/CHANGELOG.md +55 -0
- package/Checkbox/Checkbox.js +51 -20
- package/FormHelperText/FormHelperText.js +18 -8
- package/IconButton/IconButton.js +97 -40
- package/ImageList/ImageList.js +16 -14
- package/ImageListItem/ImageListItem.js +37 -22
- package/ImageListItemBar/ImageListItemBar.js +65 -32
- package/ListItem/ListItem.js +94 -50
- package/ListItemAvatar/ListItemAvatar.js +12 -8
- package/ListItemButton/ListItemButton.js +35 -15
- package/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
- package/ListItemText/ListItemText.js +20 -11
- package/ListSubheader/ListSubheader.js +44 -19
- package/Radio/Radio.js +50 -20
- package/Radio/RadioButtonIcon.js +18 -12
- package/Rating/Rating.js +71 -37
- package/Table/Table.js +11 -6
- package/TableCell/TableCell.js +96 -41
- package/TableSortLabel/TableSortLabel.js +19 -9
- package/Toolbar/Toolbar.js +33 -17
- package/Typography/Typography.js +3 -2
- package/index.js +1 -1
- package/modern/Checkbox/Checkbox.js +51 -20
- package/modern/FormHelperText/FormHelperText.js +18 -8
- package/modern/IconButton/IconButton.js +97 -40
- package/modern/ImageList/ImageList.js +16 -14
- package/modern/ImageListItem/ImageListItem.js +37 -22
- package/modern/ImageListItemBar/ImageListItemBar.js +65 -32
- package/modern/ListItem/ListItem.js +94 -50
- package/modern/ListItemAvatar/ListItemAvatar.js +12 -8
- package/modern/ListItemButton/ListItemButton.js +35 -15
- package/modern/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
- package/modern/ListItemText/ListItemText.js +20 -11
- package/modern/ListSubheader/ListSubheader.js +44 -19
- package/modern/Radio/Radio.js +50 -20
- package/modern/Radio/RadioButtonIcon.js +18 -12
- package/modern/Rating/Rating.js +71 -37
- package/modern/Table/Table.js +11 -6
- package/modern/TableCell/TableCell.js +96 -41
- package/modern/TableSortLabel/TableSortLabel.js +19 -9
- package/modern/Toolbar/Toolbar.js +33 -17
- package/modern/Typography/Typography.js +3 -2
- package/modern/index.js +1 -1
- package/modern/styles/experimental_extendTheme.js +2 -1
- package/modern/styles/getOverlayAlpha.js +3 -4
- package/node/Checkbox/Checkbox.js +54 -23
- package/node/FormHelperText/FormHelperText.js +18 -8
- package/node/IconButton/IconButton.js +99 -43
- package/node/ImageList/ImageList.js +16 -14
- package/node/ImageListItem/ImageListItem.js +37 -22
- package/node/ImageListItemBar/ImageListItemBar.js +65 -32
- package/node/ListItem/ListItem.js +94 -50
- package/node/ListItemAvatar/ListItemAvatar.js +12 -8
- package/node/ListItemButton/ListItemButton.js +35 -15
- package/node/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
- package/node/ListItemText/ListItemText.js +20 -11
- package/node/ListSubheader/ListSubheader.js +44 -19
- package/node/Radio/Radio.js +52 -22
- package/node/Radio/RadioButtonIcon.js +21 -15
- package/node/Rating/Rating.js +71 -37
- package/node/Table/Table.js +11 -6
- package/node/TableCell/TableCell.js +96 -41
- package/node/TableSortLabel/TableSortLabel.js +19 -9
- package/node/Toolbar/Toolbar.js +33 -17
- package/node/Typography/Typography.js +3 -2
- package/node/index.js +1 -1
- package/node/styles/experimental_extendTheme.js +1 -0
- package/node/styles/getOverlayAlpha.js +4 -5
- package/package.json +4 -4
- package/styles/experimental_extendTheme.d.ts +2 -0
- package/styles/experimental_extendTheme.js +2 -1
- package/styles/getOverlayAlpha.d.ts +1 -2
- package/styles/getOverlayAlpha.js +3 -4
- package/umd/material-ui.development.js +1028 -533
- package/umd/material-ui.production.min.js +4 -4
|
@@ -47,8 +47,7 @@ const TableCellRoot = (0, _styled.default)('td', {
|
|
|
47
47
|
return [styles.root, styles[ownerState.variant], styles[`size${(0, _capitalize.default)(ownerState.size)}`], ownerState.padding !== 'normal' && styles[`padding${(0, _capitalize.default)(ownerState.padding)}`], ownerState.align !== 'inherit' && styles[`align${(0, _capitalize.default)(ownerState.align)}`], ownerState.stickyHeader && styles.stickyHeader];
|
|
48
48
|
}
|
|
49
49
|
})(({
|
|
50
|
-
theme
|
|
51
|
-
ownerState
|
|
50
|
+
theme
|
|
52
51
|
}) => (0, _extends2.default)({}, theme.typography.body2, {
|
|
53
52
|
display: 'table-cell',
|
|
54
53
|
verticalAlign: 'inherit',
|
|
@@ -57,47 +56,103 @@ const TableCellRoot = (0, _styled.default)('td', {
|
|
|
57
56
|
borderBottom: theme.vars ? `1px solid ${theme.vars.palette.TableCell.border}` : `1px solid
|
|
58
57
|
${theme.palette.mode === 'light' ? (0, _colorManipulator.lighten)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.88) : (0, _colorManipulator.darken)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.68)}`,
|
|
59
58
|
textAlign: 'left',
|
|
60
|
-
padding: 16
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
59
|
+
padding: 16,
|
|
60
|
+
variants: [{
|
|
61
|
+
props: {
|
|
62
|
+
variant: 'head'
|
|
63
|
+
},
|
|
64
|
+
style: {
|
|
65
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
66
|
+
lineHeight: theme.typography.pxToRem(24),
|
|
67
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
props: {
|
|
71
|
+
variant: 'body'
|
|
72
|
+
},
|
|
73
|
+
style: {
|
|
74
|
+
color: (theme.vars || theme).palette.text.primary
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
props: {
|
|
78
|
+
variant: 'footer'
|
|
79
|
+
},
|
|
80
|
+
style: {
|
|
81
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
82
|
+
lineHeight: theme.typography.pxToRem(21),
|
|
83
|
+
fontSize: theme.typography.pxToRem(12)
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
props: {
|
|
87
|
+
size: 'small'
|
|
88
|
+
},
|
|
89
|
+
style: {
|
|
90
|
+
padding: '6px 16px',
|
|
91
|
+
[`&.${_tableCellClasses.default.paddingCheckbox}`]: {
|
|
92
|
+
width: 24,
|
|
93
|
+
// prevent the checkbox column from growing
|
|
94
|
+
padding: '0 12px 0 16px',
|
|
95
|
+
'& > *': {
|
|
96
|
+
padding: 0
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
props: {
|
|
102
|
+
padding: 'checkbox'
|
|
103
|
+
},
|
|
104
|
+
style: {
|
|
105
|
+
width: 48,
|
|
106
|
+
// prevent the checkbox column from growing
|
|
107
|
+
padding: '0 0 0 4px'
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
props: {
|
|
111
|
+
padding: 'none'
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
78
114
|
padding: 0
|
|
79
115
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
}, {
|
|
117
|
+
props: {
|
|
118
|
+
align: 'left'
|
|
119
|
+
},
|
|
120
|
+
style: {
|
|
121
|
+
textAlign: 'left'
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
props: {
|
|
125
|
+
align: 'center'
|
|
126
|
+
},
|
|
127
|
+
style: {
|
|
128
|
+
textAlign: 'center'
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
props: {
|
|
132
|
+
align: 'right'
|
|
133
|
+
},
|
|
134
|
+
style: {
|
|
135
|
+
textAlign: 'right',
|
|
136
|
+
flexDirection: 'row-reverse'
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
props: {
|
|
140
|
+
align: 'justify'
|
|
141
|
+
},
|
|
142
|
+
style: {
|
|
143
|
+
textAlign: 'justify'
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
props: ({
|
|
147
|
+
ownerState
|
|
148
|
+
}) => ownerState.stickyHeader,
|
|
149
|
+
style: {
|
|
150
|
+
position: 'sticky',
|
|
151
|
+
top: 0,
|
|
152
|
+
zIndex: 2,
|
|
153
|
+
backgroundColor: (theme.vars || theme).palette.background.default
|
|
154
|
+
}
|
|
155
|
+
}]
|
|
101
156
|
}));
|
|
102
157
|
|
|
103
158
|
/**
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -78,9 +78,8 @@ const TableSortLabelIcon = (0, _styled.default)('span', {
|
|
|
78
78
|
return [styles.icon, styles[`iconDirection${(0, _capitalize.default)(ownerState.direction)}`]];
|
|
79
79
|
}
|
|
80
80
|
})(({
|
|
81
|
-
theme
|
|
82
|
-
|
|
83
|
-
}) => (0, _extends2.default)({
|
|
81
|
+
theme
|
|
82
|
+
}) => ({
|
|
84
83
|
fontSize: 18,
|
|
85
84
|
marginRight: 4,
|
|
86
85
|
marginLeft: 4,
|
|
@@ -88,11 +87,22 @@ const TableSortLabelIcon = (0, _styled.default)('span', {
|
|
|
88
87
|
transition: theme.transitions.create(['opacity', 'transform'], {
|
|
89
88
|
duration: theme.transitions.duration.shorter
|
|
90
89
|
}),
|
|
91
|
-
userSelect: 'none'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
userSelect: 'none',
|
|
91
|
+
variants: [{
|
|
92
|
+
props: {
|
|
93
|
+
direction: 'desc'
|
|
94
|
+
},
|
|
95
|
+
style: {
|
|
96
|
+
transform: 'rotate(0deg)'
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
props: {
|
|
100
|
+
direction: 'asc'
|
|
101
|
+
},
|
|
102
|
+
style: {
|
|
103
|
+
transform: 'rotate(180deg)'
|
|
104
|
+
}
|
|
105
|
+
}]
|
|
96
106
|
}));
|
|
97
107
|
|
|
98
108
|
/**
|
package/node/Toolbar/Toolbar.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -40,25 +40,41 @@ const ToolbarRoot = (0, _styled.default)('div', {
|
|
|
40
40
|
return [styles.root, !ownerState.disableGutters && styles.gutters, styles[ownerState.variant]];
|
|
41
41
|
}
|
|
42
42
|
})(({
|
|
43
|
-
theme
|
|
44
|
-
|
|
45
|
-
}) => (0, _extends2.default)({
|
|
43
|
+
theme
|
|
44
|
+
}) => ({
|
|
46
45
|
position: 'relative',
|
|
47
46
|
display: 'flex',
|
|
48
|
-
alignItems: 'center'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
variants: [{
|
|
49
|
+
props: ({
|
|
50
|
+
ownerState
|
|
51
|
+
}) => !ownerState.disableGutters,
|
|
52
|
+
style: {
|
|
53
|
+
paddingLeft: theme.spacing(2),
|
|
54
|
+
paddingRight: theme.spacing(2),
|
|
55
|
+
[theme.breakpoints.up('sm')]: {
|
|
56
|
+
paddingLeft: theme.spacing(3),
|
|
57
|
+
paddingRight: theme.spacing(3)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
props: {
|
|
62
|
+
variant: 'dense'
|
|
63
|
+
},
|
|
64
|
+
style: {
|
|
65
|
+
minHeight: 48
|
|
66
|
+
}
|
|
67
|
+
}]
|
|
58
68
|
}), ({
|
|
59
|
-
theme
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
theme
|
|
70
|
+
}) => ({
|
|
71
|
+
variants: [{
|
|
72
|
+
props: {
|
|
73
|
+
variant: 'regular'
|
|
74
|
+
},
|
|
75
|
+
style: theme.mixins.toolbar
|
|
76
|
+
}]
|
|
77
|
+
}));
|
|
62
78
|
const Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(inProps, ref) {
|
|
63
79
|
const props = (0, _useThemeProps.default)({
|
|
64
80
|
props: inProps,
|
|
@@ -126,9 +126,10 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, re
|
|
|
126
126
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TypographyRoot, (0, _extends2.default)({
|
|
127
127
|
as: Component,
|
|
128
128
|
ref: ref,
|
|
129
|
-
ownerState: ownerState,
|
|
130
129
|
className: (0, _clsx.default)(classes.root, className)
|
|
131
|
-
}, other
|
|
130
|
+
}, other, {
|
|
131
|
+
ownerState: ownerState
|
|
132
|
+
}));
|
|
132
133
|
});
|
|
133
134
|
process.env.NODE_ENV !== "production" ? Typography.propTypes /* remove-proptypes */ = {
|
|
134
135
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
package/node/index.js
CHANGED
|
@@ -130,6 +130,7 @@ function extendTheme(options = {}, ...args) {
|
|
|
130
130
|
overlays: ((_colorSchemesInput$da3 = colorSchemesInput.dark) == null ? void 0 : _colorSchemesInput$da3.overlays) || defaultDarkOverlays
|
|
131
131
|
})
|
|
132
132
|
}),
|
|
133
|
+
font: (0, _extends2.default)({}, (0, _cssVars.prepareTypographyVars)(muiTheme.typography), muiTheme.font),
|
|
133
134
|
spacing: getSpacingVal(input.spacing)
|
|
134
135
|
});
|
|
135
136
|
Object.keys(theme.colorSchemes).forEach(key => {
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = getOverlayAlpha;
|
|
7
7
|
// Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
|
|
8
|
-
|
|
8
|
+
function getOverlayAlpha(elevation) {
|
|
9
9
|
let alphaValue;
|
|
10
10
|
if (elevation < 1) {
|
|
11
11
|
alphaValue = 5.11916 * elevation ** 2;
|
|
12
12
|
} else {
|
|
13
13
|
alphaValue = 4.5 * Math.log(elevation + 1) + 2;
|
|
14
14
|
}
|
|
15
|
-
return (alphaValue /
|
|
16
|
-
}
|
|
17
|
-
var _default = exports.default = getOverlayAlpha;
|
|
15
|
+
return Math.round(alphaValue * 10) / 1000;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"prop-types": "^15.8.1",
|
|
35
35
|
"react-is": "^18.2.0",
|
|
36
36
|
"react-transition-group": "^4.4.5",
|
|
37
|
-
"@mui/base": "5.0.0-beta.42",
|
|
38
|
-
"@mui/system": "^6.0.0-alpha.3",
|
|
39
37
|
"@mui/types": "^7.2.14",
|
|
38
|
+
"@mui/system": "^6.0.0-alpha.4",
|
|
39
|
+
"@mui/core-downloads-tracker": "^6.0.0-alpha.4",
|
|
40
40
|
"@mui/utils": "^6.0.0-alpha.3",
|
|
41
|
-
"@mui/
|
|
41
|
+
"@mui/base": "5.0.0-beta.42"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@emotion/react": "^11.5.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
2
|
import { OverridableStringUnion } from '@mui/types';
|
|
3
3
|
import { SxConfig, SxProps, CSSObject, ApplyStyles } from '@mui/system';
|
|
4
|
+
import { ExtractTypographyTokens } from '@mui/system/cssVars';
|
|
4
5
|
import { ThemeOptions, Theme } from './createTheme';
|
|
5
6
|
import { Palette, PaletteOptions } from './createPalette';
|
|
6
7
|
import { Shadows } from './shadows';
|
|
@@ -321,6 +322,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
|
|
|
321
322
|
|
|
322
323
|
// should not include keys defined in `shouldSkipGeneratingVar` and have value typeof function
|
|
323
324
|
export interface ThemeVars {
|
|
325
|
+
font: ExtractTypographyTokens<Theme['typography']>;
|
|
324
326
|
palette: Omit<
|
|
325
327
|
ColorSystem['palette'],
|
|
326
328
|
| 'colorScheme'
|
|
@@ -5,7 +5,7 @@ const _excluded = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar", "g
|
|
|
5
5
|
import deepmerge from '@mui/utils/deepmerge';
|
|
6
6
|
import { unstable_createGetCssVar as systemCreateGetCssVar, createSpacing } from '@mui/system';
|
|
7
7
|
import { createUnarySpacing } from '@mui/system/spacing';
|
|
8
|
-
import { prepareCssVars } from '@mui/system/cssVars';
|
|
8
|
+
import { prepareCssVars, prepareTypographyVars } from '@mui/system/cssVars';
|
|
9
9
|
import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
|
|
10
10
|
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, hslToRgb } from '@mui/system/colorManipulator';
|
|
11
11
|
import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
|
|
@@ -118,6 +118,7 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
118
118
|
overlays: colorSchemesInput.dark?.overlays || defaultDarkOverlays
|
|
119
119
|
})
|
|
120
120
|
}),
|
|
121
|
+
font: _extends({}, prepareTypographyVars(muiTheme.typography), muiTheme.font),
|
|
121
122
|
spacing: getSpacingVal(input.spacing)
|
|
122
123
|
});
|
|
123
124
|
Object.keys(theme.colorSchemes).forEach(key => {
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default getOverlayAlpha;
|
|
1
|
+
export default function getOverlayAlpha(elevation: number): number;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
|
|
2
|
-
|
|
2
|
+
export default function getOverlayAlpha(elevation) {
|
|
3
3
|
let alphaValue;
|
|
4
4
|
if (elevation < 1) {
|
|
5
5
|
alphaValue = 5.11916 * elevation ** 2;
|
|
6
6
|
} else {
|
|
7
7
|
alphaValue = 4.5 * Math.log(elevation + 1) + 2;
|
|
8
8
|
}
|
|
9
|
-
return (alphaValue /
|
|
10
|
-
}
|
|
11
|
-
export default getOverlayAlpha;
|
|
9
|
+
return Math.round(alphaValue * 10) / 1000;
|
|
10
|
+
}
|