td-plots 1.4.1 → 1.5.1
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/components/Histogram.d.ts +2 -1
- package/dist/components/Utils.d.ts +1 -0
- package/dist/index.esm.js +374 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +373 -115
- package/dist/index.js.map +1 -1
- package/package.json +17 -9
package/dist/index.js
CHANGED
|
@@ -77,6 +77,26 @@ function calculateMean(arr) {
|
|
|
77
77
|
return sum / arr.length;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
// Calculate standard deviation of an array of numbers or dates
|
|
81
|
+
function calculateStandardDeviation(arr) {
|
|
82
|
+
if (arr.length === 0)
|
|
83
|
+
return undefined;
|
|
84
|
+
var mean = calculateMean(arr);
|
|
85
|
+
if (mean === undefined)
|
|
86
|
+
return undefined;
|
|
87
|
+
var sumOfSquares = 0;
|
|
88
|
+
if (isNumberArray(arr)) {
|
|
89
|
+
sumOfSquares = arr.reduce(function (acc, num) { return acc + Math.pow(num - mean, 2); }, 0);
|
|
90
|
+
}
|
|
91
|
+
else if (isDateArray(arr)) {
|
|
92
|
+
sumOfSquares = arr.reduce(function (acc, date) { return acc + Math.pow(date.getTime() - mean, 2); }, 0);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
var variance = sumOfSquares / arr.length;
|
|
98
|
+
return Math.sqrt(variance);
|
|
99
|
+
}
|
|
80
100
|
// Utilities for rounding dates to the nearest day.
|
|
81
101
|
// Helpful for making nice bins
|
|
82
102
|
var roundToNextDay = function (timestamp) {
|
|
@@ -1392,8 +1412,8 @@ function requireReactIs_production () {
|
|
|
1392
1412
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
1393
1413
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
1394
1414
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
1395
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler")
|
|
1396
|
-
|
|
1415
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
1416
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
1397
1417
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
1398
1418
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
1399
1419
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
@@ -1563,8 +1583,8 @@ function requireReactIs_development () {
|
|
|
1563
1583
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
1564
1584
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
1565
1585
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
1566
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler")
|
|
1567
|
-
|
|
1586
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
1587
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
1568
1588
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
1569
1589
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
1570
1590
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
@@ -1735,7 +1755,7 @@ const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.one
|
|
|
1735
1755
|
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
1736
1756
|
* Note: this function does not work and will not support multiple units.
|
|
1737
1757
|
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
1738
|
-
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300
|
|
1758
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 even though 40rem > 300px
|
|
1739
1759
|
*/
|
|
1740
1760
|
function sortContainerQueries(theme, css) {
|
|
1741
1761
|
if (!theme.containerQueries) {
|
|
@@ -2760,7 +2780,7 @@ const styleFunctionSx = unstable_createStyleFunctionSx();
|
|
|
2760
2780
|
styleFunctionSx.filterProps = ['sx'];
|
|
2761
2781
|
|
|
2762
2782
|
/**
|
|
2763
|
-
* @mui/styled-engine v7.
|
|
2783
|
+
* @mui/styled-engine v7.3.3
|
|
2764
2784
|
*
|
|
2765
2785
|
* @license MIT
|
|
2766
2786
|
* This source code is licensed under the MIT license found in the
|
|
@@ -3707,6 +3727,9 @@ function private_safeAlpha(color, value, warning) {
|
|
|
3707
3727
|
try {
|
|
3708
3728
|
return alpha(color, value);
|
|
3709
3729
|
} catch (error) {
|
|
3730
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3731
|
+
console.warn(warning);
|
|
3732
|
+
}
|
|
3710
3733
|
return color;
|
|
3711
3734
|
}
|
|
3712
3735
|
}
|
|
@@ -3733,6 +3756,9 @@ function private_safeDarken(color, coefficient, warning) {
|
|
|
3733
3756
|
try {
|
|
3734
3757
|
return darken(color, coefficient);
|
|
3735
3758
|
} catch (error) {
|
|
3759
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3760
|
+
console.warn(warning);
|
|
3761
|
+
}
|
|
3736
3762
|
return color;
|
|
3737
3763
|
}
|
|
3738
3764
|
}
|
|
@@ -3763,6 +3789,9 @@ function private_safeLighten(color, coefficient, warning) {
|
|
|
3763
3789
|
try {
|
|
3764
3790
|
return lighten(color, coefficient);
|
|
3765
3791
|
} catch (error) {
|
|
3792
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3793
|
+
console.warn(warning);
|
|
3794
|
+
}
|
|
3766
3795
|
return color;
|
|
3767
3796
|
}
|
|
3768
3797
|
}
|
|
@@ -4018,7 +4047,8 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
4018
4047
|
const {
|
|
4019
4048
|
getSelector = defaultGetSelector,
|
|
4020
4049
|
disableCssColorScheme,
|
|
4021
|
-
colorSchemeSelector: selector
|
|
4050
|
+
colorSchemeSelector: selector,
|
|
4051
|
+
enableContrastVars
|
|
4022
4052
|
} = parserConfig;
|
|
4023
4053
|
// @ts-ignore - ignore components do not exist
|
|
4024
4054
|
const {
|
|
@@ -4156,6 +4186,16 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
4156
4186
|
...finalCss
|
|
4157
4187
|
}), finalCss);
|
|
4158
4188
|
});
|
|
4189
|
+
if (enableContrastVars) {
|
|
4190
|
+
stylesheets.push({
|
|
4191
|
+
':root': {
|
|
4192
|
+
// use double underscore to indicate that these are private variables
|
|
4193
|
+
'--__l-threshold': '0.7',
|
|
4194
|
+
'--__l': 'clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)',
|
|
4195
|
+
'--__a': 'clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)' // 0.87 is the default alpha value for black text.
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
}
|
|
4159
4199
|
return stylesheets;
|
|
4160
4200
|
};
|
|
4161
4201
|
return {
|
|
@@ -4341,6 +4381,19 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
|
|
|
4341
4381
|
}
|
|
4342
4382
|
}
|
|
4343
4383
|
}
|
|
4384
|
+
function mixLightOrDark(colorSpace, intent, direction, shade, tonalOffset) {
|
|
4385
|
+
const tonalOffsetLight = tonalOffset.light || tonalOffset;
|
|
4386
|
+
const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
|
4387
|
+
if (!intent[direction]) {
|
|
4388
|
+
if (intent.hasOwnProperty(shade)) {
|
|
4389
|
+
intent[direction] = intent[shade];
|
|
4390
|
+
} else if (direction === 'light') {
|
|
4391
|
+
intent.light = `color-mix(in ${colorSpace}, ${intent.main}, #fff ${(tonalOffsetLight * 100).toFixed(0)}%)`;
|
|
4392
|
+
} else if (direction === 'dark') {
|
|
4393
|
+
intent.dark = `color-mix(in ${colorSpace}, ${intent.main}, #000 ${(tonalOffsetDark * 100).toFixed(0)}%)`;
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4344
4397
|
function getDefaultPrimary(mode = 'light') {
|
|
4345
4398
|
if (mode === 'dark') {
|
|
4346
4399
|
return {
|
|
@@ -4426,11 +4479,17 @@ function getDefaultWarning(mode = 'light') {
|
|
|
4426
4479
|
dark: orange[900]
|
|
4427
4480
|
};
|
|
4428
4481
|
}
|
|
4482
|
+
|
|
4483
|
+
// Use the same name as the experimental CSS `contrast-color` function.
|
|
4484
|
+
function contrastColor(background) {
|
|
4485
|
+
return `oklch(from ${background} var(--__l) 0 h / var(--__a))`;
|
|
4486
|
+
}
|
|
4429
4487
|
function createPalette(palette) {
|
|
4430
4488
|
const {
|
|
4431
4489
|
mode = 'light',
|
|
4432
4490
|
contrastThreshold = 3,
|
|
4433
4491
|
tonalOffset = 0.2,
|
|
4492
|
+
colorSpace,
|
|
4434
4493
|
...other
|
|
4435
4494
|
} = palette;
|
|
4436
4495
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
@@ -4444,6 +4503,9 @@ function createPalette(palette) {
|
|
|
4444
4503
|
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
|
4445
4504
|
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
|
4446
4505
|
function getContrastText(background) {
|
|
4506
|
+
if (colorSpace) {
|
|
4507
|
+
return contrastColor(background);
|
|
4508
|
+
}
|
|
4447
4509
|
const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
|
4448
4510
|
if (process.env.NODE_ENV !== 'production') {
|
|
4449
4511
|
const contrast = getContrastRatio(background, contrastText);
|
|
@@ -4472,8 +4534,13 @@ function createPalette(palette) {
|
|
|
4472
4534
|
if (typeof color.main !== 'string') {
|
|
4473
4535
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
4474
4536
|
}
|
|
4475
|
-
|
|
4476
|
-
|
|
4537
|
+
if (colorSpace) {
|
|
4538
|
+
mixLightOrDark(colorSpace, color, 'light', lightShade, tonalOffset);
|
|
4539
|
+
mixLightOrDark(colorSpace, color, 'dark', darkShade, tonalOffset);
|
|
4540
|
+
} else {
|
|
4541
|
+
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
4542
|
+
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
4543
|
+
}
|
|
4477
4544
|
if (!color.contrastText) {
|
|
4478
4545
|
color.contrastText = getContrastText(color.main);
|
|
4479
4546
|
}
|
|
@@ -4838,6 +4905,58 @@ theme.transitions = createTransitions(theme.transitions || {});
|
|
|
4838
4905
|
export default theme;`;
|
|
4839
4906
|
}
|
|
4840
4907
|
|
|
4908
|
+
function coefficientToPercentage(coefficient) {
|
|
4909
|
+
if (typeof coefficient === 'number') {
|
|
4910
|
+
return `${(coefficient * 100).toFixed(0)}%`;
|
|
4911
|
+
}
|
|
4912
|
+
return `calc((${coefficient}) * 100%)`;
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
// This can be removed when moved to `color-mix()` entirely.
|
|
4916
|
+
const parseAddition = str => {
|
|
4917
|
+
if (!Number.isNaN(+str)) {
|
|
4918
|
+
return +str;
|
|
4919
|
+
}
|
|
4920
|
+
const numbers = str.match(/\d*\.?\d+/g);
|
|
4921
|
+
if (!numbers) {
|
|
4922
|
+
return 0;
|
|
4923
|
+
}
|
|
4924
|
+
let sum = 0;
|
|
4925
|
+
for (let i = 0; i < numbers.length; i += 1) {
|
|
4926
|
+
sum += +numbers[i];
|
|
4927
|
+
}
|
|
4928
|
+
return sum;
|
|
4929
|
+
};
|
|
4930
|
+
function attachColorManipulators(theme) {
|
|
4931
|
+
Object.assign(theme, {
|
|
4932
|
+
alpha(color, coefficient) {
|
|
4933
|
+
const obj = this || theme;
|
|
4934
|
+
if (obj.colorSpace) {
|
|
4935
|
+
return `oklch(from ${color} l c h / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`;
|
|
4936
|
+
}
|
|
4937
|
+
if (obj.vars) {
|
|
4938
|
+
// To preserve the behavior of the CSS theme variables
|
|
4939
|
+
// In the future, this could be replaced by `color-mix` (when https://caniuse.com/?search=color-mix reaches 95%).
|
|
4940
|
+
return `rgba(${color.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g, 'var(--$1Channel)')} / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`;
|
|
4941
|
+
}
|
|
4942
|
+
return alpha(color, parseAddition(coefficient));
|
|
4943
|
+
},
|
|
4944
|
+
lighten(color, coefficient) {
|
|
4945
|
+
const obj = this || theme;
|
|
4946
|
+
if (obj.colorSpace) {
|
|
4947
|
+
return `color-mix(in ${obj.colorSpace}, ${color}, #fff ${coefficientToPercentage(coefficient)})`;
|
|
4948
|
+
}
|
|
4949
|
+
return lighten(color, coefficient);
|
|
4950
|
+
},
|
|
4951
|
+
darken(color, coefficient) {
|
|
4952
|
+
const obj = this || theme;
|
|
4953
|
+
if (obj.colorSpace) {
|
|
4954
|
+
return `color-mix(in ${obj.colorSpace}, ${color}, #000 ${coefficientToPercentage(coefficient)})`;
|
|
4955
|
+
}
|
|
4956
|
+
return darken(color, coefficient);
|
|
4957
|
+
}
|
|
4958
|
+
});
|
|
4959
|
+
}
|
|
4841
4960
|
function createThemeNoVars(options = {}, ...args) {
|
|
4842
4961
|
const {
|
|
4843
4962
|
breakpoints: breakpointsInput,
|
|
@@ -4847,6 +4966,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4847
4966
|
transitions: transitionsInput = {},
|
|
4848
4967
|
typography: typographyInput = {},
|
|
4849
4968
|
shape: shapeInput,
|
|
4969
|
+
colorSpace,
|
|
4850
4970
|
...other
|
|
4851
4971
|
} = options;
|
|
4852
4972
|
if (options.vars &&
|
|
@@ -4857,7 +4977,10 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4857
4977
|
// #host-reference
|
|
4858
4978
|
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : formatMuiErrorMessage(20));
|
|
4859
4979
|
}
|
|
4860
|
-
const palette = createPalette(
|
|
4980
|
+
const palette = createPalette({
|
|
4981
|
+
...paletteInput,
|
|
4982
|
+
colorSpace
|
|
4983
|
+
});
|
|
4861
4984
|
const systemTheme = createTheme$1(options);
|
|
4862
4985
|
let muiTheme = deepmerge(systemTheme, {
|
|
4863
4986
|
mixins: createMixins(systemTheme.breakpoints, mixinsInput),
|
|
@@ -4914,6 +5037,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4914
5037
|
};
|
|
4915
5038
|
muiTheme.toRuntimeSource = stringifyTheme; // for Pigment CSS integration
|
|
4916
5039
|
|
|
5040
|
+
attachColorManipulators(muiTheme);
|
|
4917
5041
|
return muiTheme;
|
|
4918
5042
|
}
|
|
4919
5043
|
|
|
@@ -4954,9 +5078,14 @@ function createColorScheme(options) {
|
|
|
4954
5078
|
// need to cast to avoid module augmentation test
|
|
4955
5079
|
opacity,
|
|
4956
5080
|
overlays,
|
|
4957
|
-
|
|
5081
|
+
colorSpace,
|
|
5082
|
+
...other
|
|
4958
5083
|
} = options;
|
|
4959
|
-
|
|
5084
|
+
// need to cast because `colorSpace` is considered internal at the moment.
|
|
5085
|
+
const palette = createPalette({
|
|
5086
|
+
...paletteInput,
|
|
5087
|
+
colorSpace
|
|
5088
|
+
});
|
|
4960
5089
|
return {
|
|
4961
5090
|
palette,
|
|
4962
5091
|
opacity: {
|
|
@@ -4964,7 +5093,7 @@ function createColorScheme(options) {
|
|
|
4964
5093
|
...opacity
|
|
4965
5094
|
},
|
|
4966
5095
|
overlays: overlays || getOverlays(palette.mode),
|
|
4967
|
-
...
|
|
5096
|
+
...other
|
|
4968
5097
|
};
|
|
4969
5098
|
}
|
|
4970
5099
|
|
|
@@ -5082,7 +5211,7 @@ const silent = fn => {
|
|
|
5082
5211
|
return undefined;
|
|
5083
5212
|
};
|
|
5084
5213
|
const createGetCssVar = (cssVarPrefix = 'mui') => createGetCssVar$1(cssVarPrefix);
|
|
5085
|
-
function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
5214
|
+
function attachColorScheme$1(colorSpace, colorSchemes, scheme, restTheme, colorScheme) {
|
|
5086
5215
|
if (!scheme) {
|
|
5087
5216
|
return undefined;
|
|
5088
5217
|
}
|
|
@@ -5094,7 +5223,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
5094
5223
|
palette: {
|
|
5095
5224
|
mode,
|
|
5096
5225
|
...scheme?.palette
|
|
5097
|
-
}
|
|
5226
|
+
},
|
|
5227
|
+
colorSpace
|
|
5098
5228
|
});
|
|
5099
5229
|
return undefined;
|
|
5100
5230
|
}
|
|
@@ -5106,7 +5236,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
5106
5236
|
palette: {
|
|
5107
5237
|
mode,
|
|
5108
5238
|
...scheme?.palette
|
|
5109
|
-
}
|
|
5239
|
+
},
|
|
5240
|
+
colorSpace
|
|
5110
5241
|
});
|
|
5111
5242
|
colorSchemes[colorScheme] = {
|
|
5112
5243
|
...scheme,
|
|
@@ -5136,6 +5267,7 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5136
5267
|
defaultColorScheme: defaultColorSchemeInput,
|
|
5137
5268
|
disableCssColorScheme = false,
|
|
5138
5269
|
cssVarPrefix = 'mui',
|
|
5270
|
+
nativeColor = false,
|
|
5139
5271
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
|
|
5140
5272
|
colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? 'media' : undefined,
|
|
5141
5273
|
rootSelector = ':root',
|
|
@@ -5163,13 +5295,19 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5163
5295
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : formatMuiErrorMessage(21, defaultColorScheme));
|
|
5164
5296
|
}
|
|
5165
5297
|
|
|
5298
|
+
// The reason to use `oklch` is that it is the most perceptually uniform color space and widely supported.
|
|
5299
|
+
let colorSpace;
|
|
5300
|
+
if (nativeColor) {
|
|
5301
|
+
colorSpace = 'oklch';
|
|
5302
|
+
}
|
|
5303
|
+
|
|
5166
5304
|
// Create the palette for the default color scheme, either `light`, `dark`, or custom color scheme.
|
|
5167
|
-
const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
|
|
5305
|
+
const muiTheme = attachColorScheme$1(colorSpace, colorSchemes, defaultScheme, input, defaultColorScheme);
|
|
5168
5306
|
if (builtInLight && !colorSchemes.light) {
|
|
5169
|
-
attachColorScheme$1(colorSchemes, builtInLight, undefined, 'light');
|
|
5307
|
+
attachColorScheme$1(colorSpace, colorSchemes, builtInLight, undefined, 'light');
|
|
5170
5308
|
}
|
|
5171
5309
|
if (builtInDark && !colorSchemes.dark) {
|
|
5172
|
-
attachColorScheme$1(colorSchemes, builtInDark, undefined, 'dark');
|
|
5310
|
+
attachColorScheme$1(colorSpace, colorSchemes, builtInDark, undefined, 'dark');
|
|
5173
5311
|
}
|
|
5174
5312
|
let theme = {
|
|
5175
5313
|
defaultColorScheme,
|
|
@@ -5203,14 +5341,30 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5203
5341
|
setColor(palette.common, 'background', '#000');
|
|
5204
5342
|
setColor(palette.common, 'onBackground', '#fff');
|
|
5205
5343
|
}
|
|
5344
|
+
function colorMix(method, color, coefficient) {
|
|
5345
|
+
if (colorSpace) {
|
|
5346
|
+
let mixer;
|
|
5347
|
+
if (method === private_safeAlpha) {
|
|
5348
|
+
mixer = `transparent ${((1 - coefficient) * 100).toFixed(0)}%`;
|
|
5349
|
+
}
|
|
5350
|
+
if (method === private_safeDarken) {
|
|
5351
|
+
mixer = `#000 ${(coefficient * 100).toFixed(0)}%`;
|
|
5352
|
+
}
|
|
5353
|
+
if (method === private_safeLighten) {
|
|
5354
|
+
mixer = `#fff ${(coefficient * 100).toFixed(0)}%`;
|
|
5355
|
+
}
|
|
5356
|
+
return `color-mix(in ${colorSpace}, ${color}, ${mixer})`;
|
|
5357
|
+
}
|
|
5358
|
+
return method(color, coefficient);
|
|
5359
|
+
}
|
|
5206
5360
|
|
|
5207
5361
|
// assign component variables
|
|
5208
5362
|
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Button', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
5209
5363
|
if (palette.mode === 'light') {
|
|
5210
|
-
setColor(palette.Alert, 'errorColor', private_safeDarken
|
|
5211
|
-
setColor(palette.Alert, 'infoColor', private_safeDarken
|
|
5212
|
-
setColor(palette.Alert, 'successColor', private_safeDarken
|
|
5213
|
-
setColor(palette.Alert, 'warningColor', private_safeDarken
|
|
5364
|
+
setColor(palette.Alert, 'errorColor', colorMix(private_safeDarken, palette.error.light, 0.6));
|
|
5365
|
+
setColor(palette.Alert, 'infoColor', colorMix(private_safeDarken, palette.info.light, 0.6));
|
|
5366
|
+
setColor(palette.Alert, 'successColor', colorMix(private_safeDarken, palette.success.light, 0.6));
|
|
5367
|
+
setColor(palette.Alert, 'warningColor', colorMix(private_safeDarken, palette.warning.light, 0.6));
|
|
5214
5368
|
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-main'));
|
|
5215
5369
|
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-main'));
|
|
5216
5370
|
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-main'));
|
|
@@ -5219,10 +5373,10 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5219
5373
|
setColor(palette.Alert, 'infoFilledColor', silent(() => palette.getContrastText(palette.info.main)));
|
|
5220
5374
|
setColor(palette.Alert, 'successFilledColor', silent(() => palette.getContrastText(palette.success.main)));
|
|
5221
5375
|
setColor(palette.Alert, 'warningFilledColor', silent(() => palette.getContrastText(palette.warning.main)));
|
|
5222
|
-
setColor(palette.Alert, 'errorStandardBg', private_safeLighten
|
|
5223
|
-
setColor(palette.Alert, 'infoStandardBg', private_safeLighten
|
|
5224
|
-
setColor(palette.Alert, 'successStandardBg', private_safeLighten
|
|
5225
|
-
setColor(palette.Alert, 'warningStandardBg', private_safeLighten
|
|
5376
|
+
setColor(palette.Alert, 'errorStandardBg', colorMix(private_safeLighten, palette.error.light, 0.9));
|
|
5377
|
+
setColor(palette.Alert, 'infoStandardBg', colorMix(private_safeLighten, palette.info.light, 0.9));
|
|
5378
|
+
setColor(palette.Alert, 'successStandardBg', colorMix(private_safeLighten, palette.success.light, 0.9));
|
|
5379
|
+
setColor(palette.Alert, 'warningStandardBg', colorMix(private_safeLighten, palette.warning.light, 0.9));
|
|
5226
5380
|
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
|
|
5227
5381
|
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
|
|
5228
5382
|
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
|
|
@@ -5237,41 +5391,42 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5237
5391
|
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
|
|
5238
5392
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
|
|
5239
5393
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
|
|
5240
|
-
setColor(palette.LinearProgress, 'primaryBg', private_safeLighten
|
|
5241
|
-
setColor(palette.LinearProgress, 'secondaryBg', private_safeLighten
|
|
5242
|
-
setColor(palette.LinearProgress, 'errorBg', private_safeLighten
|
|
5243
|
-
setColor(palette.LinearProgress, 'infoBg', private_safeLighten
|
|
5244
|
-
setColor(palette.LinearProgress, 'successBg', private_safeLighten
|
|
5245
|
-
setColor(palette.LinearProgress, 'warningBg', private_safeLighten
|
|
5246
|
-
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
|
|
5247
|
-
setColor(palette.Slider, 'primaryTrack', private_safeLighten
|
|
5248
|
-
setColor(palette.Slider, 'secondaryTrack', private_safeLighten
|
|
5249
|
-
setColor(palette.Slider, 'errorTrack', private_safeLighten
|
|
5250
|
-
setColor(palette.Slider, 'infoTrack', private_safeLighten
|
|
5251
|
-
setColor(palette.Slider, 'successTrack', private_safeLighten
|
|
5252
|
-
setColor(palette.Slider, 'warningTrack', private_safeLighten
|
|
5253
|
-
const snackbarContentBackground =
|
|
5394
|
+
setColor(palette.LinearProgress, 'primaryBg', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5395
|
+
setColor(palette.LinearProgress, 'secondaryBg', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5396
|
+
setColor(palette.LinearProgress, 'errorBg', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5397
|
+
setColor(palette.LinearProgress, 'infoBg', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5398
|
+
setColor(palette.LinearProgress, 'successBg', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5399
|
+
setColor(palette.LinearProgress, 'warningBg', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5400
|
+
setColor(palette.Skeleton, 'bg', colorSpace ? colorMix(private_safeAlpha, palette.text.primary, 0.11) : `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
|
|
5401
|
+
setColor(palette.Slider, 'primaryTrack', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5402
|
+
setColor(palette.Slider, 'secondaryTrack', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5403
|
+
setColor(palette.Slider, 'errorTrack', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5404
|
+
setColor(palette.Slider, 'infoTrack', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5405
|
+
setColor(palette.Slider, 'successTrack', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5406
|
+
setColor(palette.Slider, 'warningTrack', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5407
|
+
const snackbarContentBackground = colorSpace ? colorMix(private_safeDarken, palette.background.default, 0.6825) // use `0.6825` instead of `0.8` to match the contrast ratio of JS implementation
|
|
5408
|
+
: private_safeEmphasize(palette.background.default, 0.8);
|
|
5254
5409
|
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
5255
|
-
setColor(palette.SnackbarContent, 'color', silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
5410
|
+
setColor(palette.SnackbarContent, 'color', silent(() => colorSpace ? dark.text.primary : palette.getContrastText(snackbarContentBackground)));
|
|
5256
5411
|
setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
|
|
5257
5412
|
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-400'));
|
|
5258
5413
|
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-400'));
|
|
5259
5414
|
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-common-white'));
|
|
5260
5415
|
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-100'));
|
|
5261
|
-
setColor(palette.Switch, 'primaryDisabledColor', private_safeLighten
|
|
5262
|
-
setColor(palette.Switch, 'secondaryDisabledColor', private_safeLighten
|
|
5263
|
-
setColor(palette.Switch, 'errorDisabledColor', private_safeLighten
|
|
5264
|
-
setColor(palette.Switch, 'infoDisabledColor', private_safeLighten
|
|
5265
|
-
setColor(palette.Switch, 'successDisabledColor', private_safeLighten
|
|
5266
|
-
setColor(palette.Switch, 'warningDisabledColor', private_safeLighten
|
|
5267
|
-
setColor(palette.TableCell, 'border', private_safeLighten(private_safeAlpha
|
|
5268
|
-
setColor(palette.Tooltip, 'bg', private_safeAlpha
|
|
5416
|
+
setColor(palette.Switch, 'primaryDisabledColor', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5417
|
+
setColor(palette.Switch, 'secondaryDisabledColor', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5418
|
+
setColor(palette.Switch, 'errorDisabledColor', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5419
|
+
setColor(palette.Switch, 'infoDisabledColor', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5420
|
+
setColor(palette.Switch, 'successDisabledColor', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5421
|
+
setColor(palette.Switch, 'warningDisabledColor', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5422
|
+
setColor(palette.TableCell, 'border', colorMix(private_safeLighten, colorMix(private_safeAlpha, palette.divider, 1), 0.88));
|
|
5423
|
+
setColor(palette.Tooltip, 'bg', colorMix(private_safeAlpha, palette.grey[700], 0.92));
|
|
5269
5424
|
}
|
|
5270
5425
|
if (palette.mode === 'dark') {
|
|
5271
|
-
setColor(palette.Alert, 'errorColor', private_safeLighten
|
|
5272
|
-
setColor(palette.Alert, 'infoColor', private_safeLighten
|
|
5273
|
-
setColor(palette.Alert, 'successColor', private_safeLighten
|
|
5274
|
-
setColor(palette.Alert, 'warningColor', private_safeLighten
|
|
5426
|
+
setColor(palette.Alert, 'errorColor', colorMix(private_safeLighten, palette.error.light, 0.6));
|
|
5427
|
+
setColor(palette.Alert, 'infoColor', colorMix(private_safeLighten, palette.info.light, 0.6));
|
|
5428
|
+
setColor(palette.Alert, 'successColor', colorMix(private_safeLighten, palette.success.light, 0.6));
|
|
5429
|
+
setColor(palette.Alert, 'warningColor', colorMix(private_safeLighten, palette.warning.light, 0.6));
|
|
5275
5430
|
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-dark'));
|
|
5276
5431
|
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-dark'));
|
|
5277
5432
|
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-dark'));
|
|
@@ -5280,10 +5435,10 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5280
5435
|
setColor(palette.Alert, 'infoFilledColor', silent(() => palette.getContrastText(palette.info.dark)));
|
|
5281
5436
|
setColor(palette.Alert, 'successFilledColor', silent(() => palette.getContrastText(palette.success.dark)));
|
|
5282
5437
|
setColor(palette.Alert, 'warningFilledColor', silent(() => palette.getContrastText(palette.warning.dark)));
|
|
5283
|
-
setColor(palette.Alert, 'errorStandardBg', private_safeDarken
|
|
5284
|
-
setColor(palette.Alert, 'infoStandardBg', private_safeDarken
|
|
5285
|
-
setColor(palette.Alert, 'successStandardBg', private_safeDarken
|
|
5286
|
-
setColor(palette.Alert, 'warningStandardBg', private_safeDarken
|
|
5438
|
+
setColor(palette.Alert, 'errorStandardBg', colorMix(private_safeDarken, palette.error.light, 0.9));
|
|
5439
|
+
setColor(palette.Alert, 'infoStandardBg', colorMix(private_safeDarken, palette.info.light, 0.9));
|
|
5440
|
+
setColor(palette.Alert, 'successStandardBg', colorMix(private_safeDarken, palette.success.light, 0.9));
|
|
5441
|
+
setColor(palette.Alert, 'warningStandardBg', colorMix(private_safeDarken, palette.warning.light, 0.9));
|
|
5287
5442
|
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
|
|
5288
5443
|
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
|
|
5289
5444
|
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
|
|
@@ -5300,35 +5455,36 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5300
5455
|
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
|
|
5301
5456
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
|
|
5302
5457
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
|
|
5303
|
-
setColor(palette.LinearProgress, 'primaryBg', private_safeDarken
|
|
5304
|
-
setColor(palette.LinearProgress, 'secondaryBg', private_safeDarken
|
|
5305
|
-
setColor(palette.LinearProgress, 'errorBg', private_safeDarken
|
|
5306
|
-
setColor(palette.LinearProgress, 'infoBg', private_safeDarken
|
|
5307
|
-
setColor(palette.LinearProgress, 'successBg', private_safeDarken
|
|
5308
|
-
setColor(palette.LinearProgress, 'warningBg', private_safeDarken
|
|
5309
|
-
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
|
|
5310
|
-
setColor(palette.Slider, 'primaryTrack', private_safeDarken
|
|
5311
|
-
setColor(palette.Slider, 'secondaryTrack', private_safeDarken
|
|
5312
|
-
setColor(palette.Slider, 'errorTrack', private_safeDarken
|
|
5313
|
-
setColor(palette.Slider, 'infoTrack', private_safeDarken
|
|
5314
|
-
setColor(palette.Slider, 'successTrack', private_safeDarken
|
|
5315
|
-
setColor(palette.Slider, 'warningTrack', private_safeDarken
|
|
5316
|
-
const snackbarContentBackground =
|
|
5458
|
+
setColor(palette.LinearProgress, 'primaryBg', colorMix(private_safeDarken, palette.primary.main, 0.5));
|
|
5459
|
+
setColor(palette.LinearProgress, 'secondaryBg', colorMix(private_safeDarken, palette.secondary.main, 0.5));
|
|
5460
|
+
setColor(palette.LinearProgress, 'errorBg', colorMix(private_safeDarken, palette.error.main, 0.5));
|
|
5461
|
+
setColor(palette.LinearProgress, 'infoBg', colorMix(private_safeDarken, palette.info.main, 0.5));
|
|
5462
|
+
setColor(palette.LinearProgress, 'successBg', colorMix(private_safeDarken, palette.success.main, 0.5));
|
|
5463
|
+
setColor(palette.LinearProgress, 'warningBg', colorMix(private_safeDarken, palette.warning.main, 0.5));
|
|
5464
|
+
setColor(palette.Skeleton, 'bg', colorSpace ? colorMix(private_safeAlpha, palette.text.primary, 0.13) : `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
|
|
5465
|
+
setColor(palette.Slider, 'primaryTrack', colorMix(private_safeDarken, palette.primary.main, 0.5));
|
|
5466
|
+
setColor(palette.Slider, 'secondaryTrack', colorMix(private_safeDarken, palette.secondary.main, 0.5));
|
|
5467
|
+
setColor(palette.Slider, 'errorTrack', colorMix(private_safeDarken, palette.error.main, 0.5));
|
|
5468
|
+
setColor(palette.Slider, 'infoTrack', colorMix(private_safeDarken, palette.info.main, 0.5));
|
|
5469
|
+
setColor(palette.Slider, 'successTrack', colorMix(private_safeDarken, palette.success.main, 0.5));
|
|
5470
|
+
setColor(palette.Slider, 'warningTrack', colorMix(private_safeDarken, palette.warning.main, 0.5));
|
|
5471
|
+
const snackbarContentBackground = colorSpace ? colorMix(private_safeLighten, palette.background.default, 0.985) // use `0.985` instead of `0.98` to match the contrast ratio of JS implementation
|
|
5472
|
+
: private_safeEmphasize(palette.background.default, 0.98);
|
|
5317
5473
|
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
5318
|
-
setColor(palette.SnackbarContent, 'color', silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
5474
|
+
setColor(palette.SnackbarContent, 'color', silent(() => colorSpace ? light.text.primary : palette.getContrastText(snackbarContentBackground)));
|
|
5319
5475
|
setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
|
|
5320
5476
|
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-600'));
|
|
5321
5477
|
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-600'));
|
|
5322
5478
|
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-grey-300'));
|
|
5323
5479
|
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-600'));
|
|
5324
|
-
setColor(palette.Switch, 'primaryDisabledColor', private_safeDarken
|
|
5325
|
-
setColor(palette.Switch, 'secondaryDisabledColor', private_safeDarken
|
|
5326
|
-
setColor(palette.Switch, 'errorDisabledColor', private_safeDarken
|
|
5327
|
-
setColor(palette.Switch, 'infoDisabledColor', private_safeDarken
|
|
5328
|
-
setColor(palette.Switch, 'successDisabledColor', private_safeDarken
|
|
5329
|
-
setColor(palette.Switch, 'warningDisabledColor', private_safeDarken
|
|
5330
|
-
setColor(palette.TableCell, 'border', private_safeDarken(private_safeAlpha
|
|
5331
|
-
setColor(palette.Tooltip, 'bg', private_safeAlpha
|
|
5480
|
+
setColor(palette.Switch, 'primaryDisabledColor', colorMix(private_safeDarken, palette.primary.main, 0.55));
|
|
5481
|
+
setColor(palette.Switch, 'secondaryDisabledColor', colorMix(private_safeDarken, palette.secondary.main, 0.55));
|
|
5482
|
+
setColor(palette.Switch, 'errorDisabledColor', colorMix(private_safeDarken, palette.error.main, 0.55));
|
|
5483
|
+
setColor(palette.Switch, 'infoDisabledColor', colorMix(private_safeDarken, palette.info.main, 0.55));
|
|
5484
|
+
setColor(palette.Switch, 'successDisabledColor', colorMix(private_safeDarken, palette.success.main, 0.55));
|
|
5485
|
+
setColor(palette.Switch, 'warningDisabledColor', colorMix(private_safeDarken, palette.warning.main, 0.55));
|
|
5486
|
+
setColor(palette.TableCell, 'border', colorMix(private_safeDarken, colorMix(private_safeAlpha, palette.divider, 1), 0.68));
|
|
5487
|
+
setColor(palette.Tooltip, 'bg', colorMix(private_safeAlpha, palette.grey[700], 0.92));
|
|
5332
5488
|
}
|
|
5333
5489
|
|
|
5334
5490
|
// MUI X - DataGrid needs this token.
|
|
@@ -5380,7 +5536,8 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5380
5536
|
prefix: cssVarPrefix,
|
|
5381
5537
|
disableCssColorScheme,
|
|
5382
5538
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
|
|
5383
|
-
getSelector: defaultGetSelector(theme)
|
|
5539
|
+
getSelector: defaultGetSelector(theme),
|
|
5540
|
+
enableContrastVars: nativeColor
|
|
5384
5541
|
};
|
|
5385
5542
|
const {
|
|
5386
5543
|
vars,
|
|
@@ -5446,7 +5603,7 @@ function createTheme(options = {},
|
|
|
5446
5603
|
light: true
|
|
5447
5604
|
} : undefined,
|
|
5448
5605
|
defaultColorScheme: initialDefaultColorScheme = palette?.mode,
|
|
5449
|
-
...
|
|
5606
|
+
...other
|
|
5450
5607
|
} = options;
|
|
5451
5608
|
const defaultColorSchemeInput = initialDefaultColorScheme || 'light';
|
|
5452
5609
|
const defaultScheme = initialColorSchemes?.[defaultColorSchemeInput];
|
|
@@ -5503,7 +5660,7 @@ function createTheme(options = {},
|
|
|
5503
5660
|
colorSchemesInput.light = true;
|
|
5504
5661
|
}
|
|
5505
5662
|
return createThemeWithVars({
|
|
5506
|
-
...
|
|
5663
|
+
...other,
|
|
5507
5664
|
colorSchemes: colorSchemesInput,
|
|
5508
5665
|
defaultColorScheme: defaultColorSchemeInput,
|
|
5509
5666
|
...(typeof cssVariables !== 'boolean' && cssVariables)
|
|
@@ -5592,7 +5749,7 @@ function createSimplePaletteValueFilter(additionalPropertiesToCheck = []) {
|
|
|
5592
5749
|
function getCircularProgressUtilityClass(slot) {
|
|
5593
5750
|
return generateUtilityClass('MuiCircularProgress', slot);
|
|
5594
5751
|
}
|
|
5595
|
-
generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
|
|
5752
|
+
generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'track', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
|
|
5596
5753
|
|
|
5597
5754
|
const SIZE = 44;
|
|
5598
5755
|
const circularRotateKeyframe = react.keyframes`
|
|
@@ -5640,6 +5797,7 @@ const useUtilityClasses = ownerState => {
|
|
|
5640
5797
|
const slots = {
|
|
5641
5798
|
root: ['root', variant, `color${capitalize(color)}`],
|
|
5642
5799
|
svg: ['svg'],
|
|
5800
|
+
track: ['track'],
|
|
5643
5801
|
circle: ['circle', `circle${capitalize(variant)}`, disableShrink && 'circleDisableShrink']
|
|
5644
5802
|
};
|
|
5645
5803
|
return composeClasses(slots, getCircularProgressUtilityClass, classes);
|
|
@@ -5725,6 +5883,15 @@ const CircularProgressCircle = styled('circle', {
|
|
|
5725
5883
|
}
|
|
5726
5884
|
}]
|
|
5727
5885
|
})));
|
|
5886
|
+
const CircularProgressTrack = styled('circle', {
|
|
5887
|
+
name: 'MuiCircularProgress',
|
|
5888
|
+
slot: 'Track'
|
|
5889
|
+
})(memoTheme(({
|
|
5890
|
+
theme
|
|
5891
|
+
}) => ({
|
|
5892
|
+
stroke: 'currentColor',
|
|
5893
|
+
opacity: (theme.vars || theme).palette.action.activatedOpacity
|
|
5894
|
+
})));
|
|
5728
5895
|
|
|
5729
5896
|
/**
|
|
5730
5897
|
* ## ARIA
|
|
@@ -5742,6 +5909,7 @@ const CircularProgress = /*#__PURE__*/React__namespace.forwardRef(function Circu
|
|
|
5742
5909
|
className,
|
|
5743
5910
|
color = 'primary',
|
|
5744
5911
|
disableShrink = false,
|
|
5912
|
+
enableTrackSlot = false,
|
|
5745
5913
|
size = 40,
|
|
5746
5914
|
style,
|
|
5747
5915
|
thickness = 3.6,
|
|
@@ -5756,7 +5924,8 @@ const CircularProgress = /*#__PURE__*/React__namespace.forwardRef(function Circu
|
|
|
5756
5924
|
size,
|
|
5757
5925
|
thickness,
|
|
5758
5926
|
value,
|
|
5759
|
-
variant
|
|
5927
|
+
variant,
|
|
5928
|
+
enableTrackSlot
|
|
5760
5929
|
};
|
|
5761
5930
|
const classes = useUtilityClasses(ownerState);
|
|
5762
5931
|
const circleStyle = {};
|
|
@@ -5782,11 +5951,20 @@ const CircularProgress = /*#__PURE__*/React__namespace.forwardRef(function Circu
|
|
|
5782
5951
|
role: "progressbar",
|
|
5783
5952
|
...rootProps,
|
|
5784
5953
|
...other,
|
|
5785
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
5954
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(CircularProgressSVG, {
|
|
5786
5955
|
className: classes.svg,
|
|
5787
5956
|
ownerState: ownerState,
|
|
5788
5957
|
viewBox: `${SIZE / 2} ${SIZE / 2} ${SIZE} ${SIZE}`,
|
|
5789
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
5958
|
+
children: [enableTrackSlot ? /*#__PURE__*/jsxRuntime.jsx(CircularProgressTrack, {
|
|
5959
|
+
className: classes.track,
|
|
5960
|
+
ownerState: ownerState,
|
|
5961
|
+
cx: SIZE,
|
|
5962
|
+
cy: SIZE,
|
|
5963
|
+
r: (SIZE - thickness) / 2,
|
|
5964
|
+
fill: "none",
|
|
5965
|
+
strokeWidth: thickness,
|
|
5966
|
+
"aria-hidden": "true"
|
|
5967
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(CircularProgressCircle, {
|
|
5790
5968
|
className: classes.circle,
|
|
5791
5969
|
style: circleStyle,
|
|
5792
5970
|
ownerState: ownerState,
|
|
@@ -5795,7 +5973,7 @@ const CircularProgress = /*#__PURE__*/React__namespace.forwardRef(function Circu
|
|
|
5795
5973
|
r: (SIZE - thickness) / 2,
|
|
5796
5974
|
fill: "none",
|
|
5797
5975
|
strokeWidth: thickness
|
|
5798
|
-
})
|
|
5976
|
+
})]
|
|
5799
5977
|
})
|
|
5800
5978
|
});
|
|
5801
5979
|
});
|
|
@@ -5830,6 +6008,12 @@ process.env.NODE_ENV !== "production" ? CircularProgress.propTypes /* remove-pro
|
|
|
5830
6008
|
}
|
|
5831
6009
|
return null;
|
|
5832
6010
|
}),
|
|
6011
|
+
/**
|
|
6012
|
+
* If `true`, a track circle slot is mounted to show a subtle background for the progress.
|
|
6013
|
+
* The `size` and `thickness` apply to the track slot to be consistent with the progress circle.
|
|
6014
|
+
* @default false
|
|
6015
|
+
*/
|
|
6016
|
+
enableTrackSlot: PropTypes.bool,
|
|
5833
6017
|
/**
|
|
5834
6018
|
* The size of the component.
|
|
5835
6019
|
* If using a number, the pixel unit is assumed.
|
|
@@ -5871,12 +6055,12 @@ var Loading = function () {
|
|
|
5871
6055
|
|
|
5872
6056
|
var Plot$2 = React.lazy(function () { return import('react-plotly.js'); });
|
|
5873
6057
|
var HistogramPlot = function (props) {
|
|
5874
|
-
var _a, _b;
|
|
5875
|
-
var data = props.data, title = props.title, xAxisTitle = props.xAxisTitle,
|
|
6058
|
+
var _a, _b, _c, _d;
|
|
6059
|
+
var data = props.data, title = props.title, xAxisTitle = props.xAxisTitle, _e = props.barColor, barColor = _e === void 0 ? 'rgb(72, 72, 74)' : _e, _f = props.unselectedBarColor, unselectedBarColor = _f === void 0 ? 'rgba(203, 195, 195, 0.88)' : _f, _g = props.selectorsColor, selectorsColor = _g === void 0 ? 'black' : _g, containerStyleOverrides = props.containerStyleOverrides, _h = props.unselectedData, unselectedData = _h === void 0 ? [] : _h, _j = props.handleClickOrSelection, handleClickOrSelection = _j === void 0 ? function () { } : _j, _k = props.onDeselect, onDeselect = _k === void 0 ? function () { } : _k, plotId = props.plotId, _l = props.selectByBin, selectByBin = _l === void 0 ? false : _l, dateTickFormat = props.dateTickFormat, binSizeOverride = props.binSizeOverride, _m = props.statsAnnotations, statsAnnotations = _m === void 0 ? ['mean'] : _m;
|
|
5876
6060
|
// Ref for plot container
|
|
5877
6061
|
var containerRef = React.useRef(null);
|
|
5878
6062
|
// Track any selections made in this plot so we can style the selection box.
|
|
5879
|
-
var
|
|
6063
|
+
var _o = React.useState(null), selectedRange = _o[0], setSelectedRange = _o[1];
|
|
5880
6064
|
// If all the data becomes selected, we should forget any old selections.
|
|
5881
6065
|
React.useEffect(function () {
|
|
5882
6066
|
if (unselectedData.length === 0) {
|
|
@@ -5888,7 +6072,7 @@ var HistogramPlot = function (props) {
|
|
|
5888
6072
|
// Plotly determines "nice" bins which consequently means it internally decides the axis range. We need
|
|
5889
6073
|
// to access that information once the plot has been initialized so that we can prevent the
|
|
5890
6074
|
// axis range from changing during interaction. Dates use strings.
|
|
5891
|
-
var
|
|
6075
|
+
var _p = React.useState(undefined), fixedXAxisRange = _p[0], setFixedXAxisRange = _p[1];
|
|
5892
6076
|
// Once the plot is drawn, record the initial axis range so we can keep it fixed.
|
|
5893
6077
|
// figure should be Readonly<Plotly.Figure> but react-plotly.js doesn't expose that type, so we use any.
|
|
5894
6078
|
var handlePlotUpdate = function (figure, graphDiv) {
|
|
@@ -6057,8 +6241,9 @@ var HistogramPlot = function (props) {
|
|
|
6057
6241
|
}, [selectedRange, unselectedData]);
|
|
6058
6242
|
// Calculate the mean of the selected data using normalized data
|
|
6059
6243
|
var meanValue = (_a = calculateMean(data)) !== null && _a !== void 0 ? _a : 0; // Default to 0 if no data
|
|
6244
|
+
var stdevValue = (_b = calculateStandardDeviation(data)) !== null && _b !== void 0 ? _b : 0;
|
|
6060
6245
|
var meanLineRadius = 0.01; // distance from the top of the y axis to the top/bottom end of the mean line
|
|
6061
|
-
var meanLine = (
|
|
6246
|
+
var meanLine = (statsAnnotations.includes('mean') && data.length > 0) ? [{
|
|
6062
6247
|
type: 'line',
|
|
6063
6248
|
x0: meanValue,
|
|
6064
6249
|
y0: 1 - meanLineRadius,
|
|
@@ -6072,8 +6257,8 @@ var HistogramPlot = function (props) {
|
|
|
6072
6257
|
}] : [];
|
|
6073
6258
|
// Draw mean line for all data
|
|
6074
6259
|
var allData = tslib.__spreadArray(tslib.__spreadArray([], data, true), unselectedData, true);
|
|
6075
|
-
var allDataMeanValue = (
|
|
6076
|
-
var allDataMeanLine = (
|
|
6260
|
+
var allDataMeanValue = (_c = calculateMean(allData)) !== null && _c !== void 0 ? _c : 0;
|
|
6261
|
+
var allDataMeanLine = (statsAnnotations.includes('mean') && unselectedData.length > 0 && data.length > 0) ? [{
|
|
6077
6262
|
type: 'line',
|
|
6078
6263
|
x0: allDataMeanValue,
|
|
6079
6264
|
y0: 1 - meanLineRadius,
|
|
@@ -6085,6 +6270,61 @@ var HistogramPlot = function (props) {
|
|
|
6085
6270
|
width: 1.5,
|
|
6086
6271
|
}
|
|
6087
6272
|
}] : [];
|
|
6273
|
+
var stdevLines = (statsAnnotations.includes('stdev') && data.length > 0) ? [{
|
|
6274
|
+
type: 'line',
|
|
6275
|
+
x0: meanValue - stdevValue,
|
|
6276
|
+
y0: 1 - meanLineRadius,
|
|
6277
|
+
x1: meanValue - stdevValue,
|
|
6278
|
+
yref: 'paper',
|
|
6279
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6280
|
+
line: {
|
|
6281
|
+
color: barColor,
|
|
6282
|
+
width: 1.5,
|
|
6283
|
+
dash: 'dot',
|
|
6284
|
+
}
|
|
6285
|
+
},
|
|
6286
|
+
{
|
|
6287
|
+
type: 'line',
|
|
6288
|
+
x0: meanValue + stdevValue,
|
|
6289
|
+
y0: 1 - meanLineRadius,
|
|
6290
|
+
x1: meanValue + stdevValue,
|
|
6291
|
+
yref: 'paper',
|
|
6292
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6293
|
+
line: {
|
|
6294
|
+
color: barColor,
|
|
6295
|
+
width: 1.5,
|
|
6296
|
+
dash: 'dot',
|
|
6297
|
+
}
|
|
6298
|
+
}]
|
|
6299
|
+
: [];
|
|
6300
|
+
var allDataStdevValue = (_d = calculateStandardDeviation(allData)) !== null && _d !== void 0 ? _d : 0;
|
|
6301
|
+
var allDataStdevLines = (statsAnnotations.includes('stdev') && unselectedData.length > 0 && data.length > 0) ? [{
|
|
6302
|
+
type: 'line',
|
|
6303
|
+
x0: allDataMeanValue - allDataStdevValue,
|
|
6304
|
+
y0: 1 - meanLineRadius,
|
|
6305
|
+
x1: allDataMeanValue - allDataStdevValue,
|
|
6306
|
+
yref: 'paper',
|
|
6307
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6308
|
+
line: {
|
|
6309
|
+
color: unselectedBarColor,
|
|
6310
|
+
width: 1.5,
|
|
6311
|
+
dash: 'dot',
|
|
6312
|
+
}
|
|
6313
|
+
},
|
|
6314
|
+
{
|
|
6315
|
+
type: 'line',
|
|
6316
|
+
x0: allDataMeanValue + allDataStdevValue,
|
|
6317
|
+
y0: 1 - meanLineRadius,
|
|
6318
|
+
x1: allDataMeanValue + allDataStdevValue,
|
|
6319
|
+
yref: 'paper',
|
|
6320
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6321
|
+
line: {
|
|
6322
|
+
color: unselectedBarColor,
|
|
6323
|
+
width: 1.5,
|
|
6324
|
+
dash: 'dot',
|
|
6325
|
+
}
|
|
6326
|
+
}]
|
|
6327
|
+
: [];
|
|
6088
6328
|
// If binSizeOverride is provided, use it to set the bin size and range explicitly.
|
|
6089
6329
|
// Plotly does a better job of setting bins and ending them at nice numbers, so only use
|
|
6090
6330
|
// this prop when necessary.
|
|
@@ -6120,6 +6360,40 @@ var HistogramPlot = function (props) {
|
|
|
6120
6360
|
},
|
|
6121
6361
|
hovertemplate: '[%{x})<br>Count: %{y}<extra></extra>', // Custom hover text
|
|
6122
6362
|
};
|
|
6363
|
+
var meanAnnotation = (statsAnnotations.includes('mean') && meanLine && data.length > 0) ? [{
|
|
6364
|
+
x: meanValue,
|
|
6365
|
+
y: 1 + meanLineRadius + 0.04, // Position above the mean line. Value set with respect to the paper coordinates.
|
|
6366
|
+
yref: 'paper',
|
|
6367
|
+
text: "<span style=\"font-weight:300\">AVG </span><span style=\"font-weight:600\">".concat(isDateArray(data) ? new Date(meanValue).toLocaleDateString('en-US', {
|
|
6368
|
+
month: '2-digit',
|
|
6369
|
+
day: '2-digit',
|
|
6370
|
+
year: '2-digit'
|
|
6371
|
+
}) : meanValue.toFixed(2), "</span>"),
|
|
6372
|
+
xanchor: 'center',
|
|
6373
|
+
yanchor: 'bottom',
|
|
6374
|
+
showarrow: false,
|
|
6375
|
+
font: {
|
|
6376
|
+
color: barColor,
|
|
6377
|
+
size: 12,
|
|
6378
|
+
},
|
|
6379
|
+
}] : [];
|
|
6380
|
+
var stdevAnnotation = (statsAnnotations.includes('stdev') && stdevLines && data.length > 0) ? [{
|
|
6381
|
+
x: meanValue, // Draw above the mean annotation
|
|
6382
|
+
y: 1 + meanLineRadius + (statsAnnotations.includes('mean') ? 0.11 : 0.04),
|
|
6383
|
+
yref: 'paper',
|
|
6384
|
+
text: "<span style=\"font-weight:300\">\u03C3 </span><span style=\"font-weight:600\">±".concat(isDateArray(data) ? new Date(stdevValue).toLocaleDateString('en-US', {
|
|
6385
|
+
month: '2-digit',
|
|
6386
|
+
day: '2-digit',
|
|
6387
|
+
year: '2-digit'
|
|
6388
|
+
}) : stdevValue.toFixed(2), "</span>"),
|
|
6389
|
+
xanchor: 'center',
|
|
6390
|
+
yanchor: 'bottom',
|
|
6391
|
+
showarrow: false,
|
|
6392
|
+
font: {
|
|
6393
|
+
color: barColor,
|
|
6394
|
+
size: 12,
|
|
6395
|
+
},
|
|
6396
|
+
}] : [];
|
|
6123
6397
|
var plotlyData = [
|
|
6124
6398
|
{
|
|
6125
6399
|
x: data,
|
|
@@ -6152,7 +6426,7 @@ var HistogramPlot = function (props) {
|
|
|
6152
6426
|
margin: {
|
|
6153
6427
|
l: 50,
|
|
6154
6428
|
r: 35, // Balance between ensuring the mean annotation doesn't get cut off and having too much margin.
|
|
6155
|
-
t: title ?
|
|
6429
|
+
t: 40 + (title ? 50 : 0), // Add extra top margin if there is a title
|
|
6156
6430
|
b: 50,
|
|
6157
6431
|
pad: 4
|
|
6158
6432
|
},
|
|
@@ -6198,24 +6472,8 @@ var HistogramPlot = function (props) {
|
|
|
6198
6472
|
bargap: 0.03, // Gap between bars
|
|
6199
6473
|
dragmode: 'select', // Enable drag to select
|
|
6200
6474
|
selectdirection: 'h', // User can select in horizontal direction only
|
|
6201
|
-
shapes: tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], allDataMeanLine, true), meanLine, true), selectedRangeBox, true), // Add the mean line and selection box
|
|
6202
|
-
annotations: (
|
|
6203
|
-
x: meanValue,
|
|
6204
|
-
y: 1 + meanLineRadius + 0.04, // Position above the mean line. Value set with respect to the paper coordinates.
|
|
6205
|
-
yref: 'paper',
|
|
6206
|
-
text: "<span style=\"font-weight:300\">AVG </span><span style=\"font-weight:600\">".concat(isDateArray(data) ? new Date(meanValue).toLocaleDateString('en-US', {
|
|
6207
|
-
month: '2-digit',
|
|
6208
|
-
day: '2-digit',
|
|
6209
|
-
year: '2-digit'
|
|
6210
|
-
}) : meanValue.toFixed(2), "</span>"),
|
|
6211
|
-
xanchor: 'center',
|
|
6212
|
-
yanchor: 'bottom',
|
|
6213
|
-
showarrow: false,
|
|
6214
|
-
font: {
|
|
6215
|
-
color: barColor,
|
|
6216
|
-
size: 12,
|
|
6217
|
-
},
|
|
6218
|
-
}] : [],
|
|
6475
|
+
shapes: tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], allDataMeanLine, true), meanLine, true), selectedRangeBox, true), stdevLines, true), allDataStdevLines, true), // Add the mean line and selection box
|
|
6476
|
+
annotations: tslib.__spreadArray(tslib.__spreadArray([], meanAnnotation, true), stdevAnnotation, true)
|
|
6219
6477
|
};
|
|
6220
6478
|
var config = {
|
|
6221
6479
|
responsive: true, // Make the plot responsive
|