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.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __spreadArray, __assign } from 'tslib';
|
|
2
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { lazy, useRef, useState, useEffect, useMemo, Suspense } from 'react';
|
|
5
5
|
import emStyled from '@emotion/styled';
|
|
@@ -57,6 +57,26 @@ function calculateMean(arr) {
|
|
|
57
57
|
return sum / arr.length;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
// Calculate standard deviation of an array of numbers or dates
|
|
61
|
+
function calculateStandardDeviation(arr) {
|
|
62
|
+
if (arr.length === 0)
|
|
63
|
+
return undefined;
|
|
64
|
+
var mean = calculateMean(arr);
|
|
65
|
+
if (mean === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
var sumOfSquares = 0;
|
|
68
|
+
if (isNumberArray(arr)) {
|
|
69
|
+
sumOfSquares = arr.reduce(function (acc, num) { return acc + Math.pow(num - mean, 2); }, 0);
|
|
70
|
+
}
|
|
71
|
+
else if (isDateArray(arr)) {
|
|
72
|
+
sumOfSquares = arr.reduce(function (acc, date) { return acc + Math.pow(date.getTime() - mean, 2); }, 0);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
var variance = sumOfSquares / arr.length;
|
|
78
|
+
return Math.sqrt(variance);
|
|
79
|
+
}
|
|
60
80
|
// Utilities for rounding dates to the nearest day.
|
|
61
81
|
// Helpful for making nice bins
|
|
62
82
|
var roundToNextDay = function (timestamp) {
|
|
@@ -1372,8 +1392,8 @@ function requireReactIs_production () {
|
|
|
1372
1392
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
1373
1393
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
1374
1394
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
1375
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler")
|
|
1376
|
-
|
|
1395
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
1396
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
1377
1397
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
1378
1398
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
1379
1399
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
@@ -1543,8 +1563,8 @@ function requireReactIs_development () {
|
|
|
1543
1563
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
1544
1564
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
1545
1565
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
1546
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler")
|
|
1547
|
-
|
|
1566
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
1567
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
1548
1568
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
1549
1569
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
1550
1570
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
@@ -1715,7 +1735,7 @@ const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.one
|
|
|
1715
1735
|
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
1716
1736
|
* Note: this function does not work and will not support multiple units.
|
|
1717
1737
|
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
1718
|
-
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300
|
|
1738
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 even though 40rem > 300px
|
|
1719
1739
|
*/
|
|
1720
1740
|
function sortContainerQueries(theme, css) {
|
|
1721
1741
|
if (!theme.containerQueries) {
|
|
@@ -2740,7 +2760,7 @@ const styleFunctionSx = unstable_createStyleFunctionSx();
|
|
|
2740
2760
|
styleFunctionSx.filterProps = ['sx'];
|
|
2741
2761
|
|
|
2742
2762
|
/**
|
|
2743
|
-
* @mui/styled-engine v7.
|
|
2763
|
+
* @mui/styled-engine v7.3.3
|
|
2744
2764
|
*
|
|
2745
2765
|
* @license MIT
|
|
2746
2766
|
* This source code is licensed under the MIT license found in the
|
|
@@ -3687,6 +3707,9 @@ function private_safeAlpha(color, value, warning) {
|
|
|
3687
3707
|
try {
|
|
3688
3708
|
return alpha(color, value);
|
|
3689
3709
|
} catch (error) {
|
|
3710
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3711
|
+
console.warn(warning);
|
|
3712
|
+
}
|
|
3690
3713
|
return color;
|
|
3691
3714
|
}
|
|
3692
3715
|
}
|
|
@@ -3713,6 +3736,9 @@ function private_safeDarken(color, coefficient, warning) {
|
|
|
3713
3736
|
try {
|
|
3714
3737
|
return darken(color, coefficient);
|
|
3715
3738
|
} catch (error) {
|
|
3739
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3740
|
+
console.warn(warning);
|
|
3741
|
+
}
|
|
3716
3742
|
return color;
|
|
3717
3743
|
}
|
|
3718
3744
|
}
|
|
@@ -3743,6 +3769,9 @@ function private_safeLighten(color, coefficient, warning) {
|
|
|
3743
3769
|
try {
|
|
3744
3770
|
return lighten(color, coefficient);
|
|
3745
3771
|
} catch (error) {
|
|
3772
|
+
if (warning && process.env.NODE_ENV !== 'production') {
|
|
3773
|
+
console.warn(warning);
|
|
3774
|
+
}
|
|
3746
3775
|
return color;
|
|
3747
3776
|
}
|
|
3748
3777
|
}
|
|
@@ -3998,7 +4027,8 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
3998
4027
|
const {
|
|
3999
4028
|
getSelector = defaultGetSelector,
|
|
4000
4029
|
disableCssColorScheme,
|
|
4001
|
-
colorSchemeSelector: selector
|
|
4030
|
+
colorSchemeSelector: selector,
|
|
4031
|
+
enableContrastVars
|
|
4002
4032
|
} = parserConfig;
|
|
4003
4033
|
// @ts-ignore - ignore components do not exist
|
|
4004
4034
|
const {
|
|
@@ -4136,6 +4166,16 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
4136
4166
|
...finalCss
|
|
4137
4167
|
}), finalCss);
|
|
4138
4168
|
});
|
|
4169
|
+
if (enableContrastVars) {
|
|
4170
|
+
stylesheets.push({
|
|
4171
|
+
':root': {
|
|
4172
|
+
// use double underscore to indicate that these are private variables
|
|
4173
|
+
'--__l-threshold': '0.7',
|
|
4174
|
+
'--__l': 'clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)',
|
|
4175
|
+
'--__a': 'clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)' // 0.87 is the default alpha value for black text.
|
|
4176
|
+
}
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4139
4179
|
return stylesheets;
|
|
4140
4180
|
};
|
|
4141
4181
|
return {
|
|
@@ -4321,6 +4361,19 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
|
|
|
4321
4361
|
}
|
|
4322
4362
|
}
|
|
4323
4363
|
}
|
|
4364
|
+
function mixLightOrDark(colorSpace, intent, direction, shade, tonalOffset) {
|
|
4365
|
+
const tonalOffsetLight = tonalOffset.light || tonalOffset;
|
|
4366
|
+
const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
|
4367
|
+
if (!intent[direction]) {
|
|
4368
|
+
if (intent.hasOwnProperty(shade)) {
|
|
4369
|
+
intent[direction] = intent[shade];
|
|
4370
|
+
} else if (direction === 'light') {
|
|
4371
|
+
intent.light = `color-mix(in ${colorSpace}, ${intent.main}, #fff ${(tonalOffsetLight * 100).toFixed(0)}%)`;
|
|
4372
|
+
} else if (direction === 'dark') {
|
|
4373
|
+
intent.dark = `color-mix(in ${colorSpace}, ${intent.main}, #000 ${(tonalOffsetDark * 100).toFixed(0)}%)`;
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4324
4377
|
function getDefaultPrimary(mode = 'light') {
|
|
4325
4378
|
if (mode === 'dark') {
|
|
4326
4379
|
return {
|
|
@@ -4406,11 +4459,17 @@ function getDefaultWarning(mode = 'light') {
|
|
|
4406
4459
|
dark: orange[900]
|
|
4407
4460
|
};
|
|
4408
4461
|
}
|
|
4462
|
+
|
|
4463
|
+
// Use the same name as the experimental CSS `contrast-color` function.
|
|
4464
|
+
function contrastColor(background) {
|
|
4465
|
+
return `oklch(from ${background} var(--__l) 0 h / var(--__a))`;
|
|
4466
|
+
}
|
|
4409
4467
|
function createPalette(palette) {
|
|
4410
4468
|
const {
|
|
4411
4469
|
mode = 'light',
|
|
4412
4470
|
contrastThreshold = 3,
|
|
4413
4471
|
tonalOffset = 0.2,
|
|
4472
|
+
colorSpace,
|
|
4414
4473
|
...other
|
|
4415
4474
|
} = palette;
|
|
4416
4475
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
@@ -4424,6 +4483,9 @@ function createPalette(palette) {
|
|
|
4424
4483
|
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
|
4425
4484
|
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
|
4426
4485
|
function getContrastText(background) {
|
|
4486
|
+
if (colorSpace) {
|
|
4487
|
+
return contrastColor(background);
|
|
4488
|
+
}
|
|
4427
4489
|
const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
|
4428
4490
|
if (process.env.NODE_ENV !== 'production') {
|
|
4429
4491
|
const contrast = getContrastRatio(background, contrastText);
|
|
@@ -4452,8 +4514,13 @@ function createPalette(palette) {
|
|
|
4452
4514
|
if (typeof color.main !== 'string') {
|
|
4453
4515
|
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)));
|
|
4454
4516
|
}
|
|
4455
|
-
|
|
4456
|
-
|
|
4517
|
+
if (colorSpace) {
|
|
4518
|
+
mixLightOrDark(colorSpace, color, 'light', lightShade, tonalOffset);
|
|
4519
|
+
mixLightOrDark(colorSpace, color, 'dark', darkShade, tonalOffset);
|
|
4520
|
+
} else {
|
|
4521
|
+
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
4522
|
+
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
4523
|
+
}
|
|
4457
4524
|
if (!color.contrastText) {
|
|
4458
4525
|
color.contrastText = getContrastText(color.main);
|
|
4459
4526
|
}
|
|
@@ -4818,6 +4885,58 @@ theme.transitions = createTransitions(theme.transitions || {});
|
|
|
4818
4885
|
export default theme;`;
|
|
4819
4886
|
}
|
|
4820
4887
|
|
|
4888
|
+
function coefficientToPercentage(coefficient) {
|
|
4889
|
+
if (typeof coefficient === 'number') {
|
|
4890
|
+
return `${(coefficient * 100).toFixed(0)}%`;
|
|
4891
|
+
}
|
|
4892
|
+
return `calc((${coefficient}) * 100%)`;
|
|
4893
|
+
}
|
|
4894
|
+
|
|
4895
|
+
// This can be removed when moved to `color-mix()` entirely.
|
|
4896
|
+
const parseAddition = str => {
|
|
4897
|
+
if (!Number.isNaN(+str)) {
|
|
4898
|
+
return +str;
|
|
4899
|
+
}
|
|
4900
|
+
const numbers = str.match(/\d*\.?\d+/g);
|
|
4901
|
+
if (!numbers) {
|
|
4902
|
+
return 0;
|
|
4903
|
+
}
|
|
4904
|
+
let sum = 0;
|
|
4905
|
+
for (let i = 0; i < numbers.length; i += 1) {
|
|
4906
|
+
sum += +numbers[i];
|
|
4907
|
+
}
|
|
4908
|
+
return sum;
|
|
4909
|
+
};
|
|
4910
|
+
function attachColorManipulators(theme) {
|
|
4911
|
+
Object.assign(theme, {
|
|
4912
|
+
alpha(color, coefficient) {
|
|
4913
|
+
const obj = this || theme;
|
|
4914
|
+
if (obj.colorSpace) {
|
|
4915
|
+
return `oklch(from ${color} l c h / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`;
|
|
4916
|
+
}
|
|
4917
|
+
if (obj.vars) {
|
|
4918
|
+
// To preserve the behavior of the CSS theme variables
|
|
4919
|
+
// In the future, this could be replaced by `color-mix` (when https://caniuse.com/?search=color-mix reaches 95%).
|
|
4920
|
+
return `rgba(${color.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g, 'var(--$1Channel)')} / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`;
|
|
4921
|
+
}
|
|
4922
|
+
return alpha(color, parseAddition(coefficient));
|
|
4923
|
+
},
|
|
4924
|
+
lighten(color, coefficient) {
|
|
4925
|
+
const obj = this || theme;
|
|
4926
|
+
if (obj.colorSpace) {
|
|
4927
|
+
return `color-mix(in ${obj.colorSpace}, ${color}, #fff ${coefficientToPercentage(coefficient)})`;
|
|
4928
|
+
}
|
|
4929
|
+
return lighten(color, coefficient);
|
|
4930
|
+
},
|
|
4931
|
+
darken(color, coefficient) {
|
|
4932
|
+
const obj = this || theme;
|
|
4933
|
+
if (obj.colorSpace) {
|
|
4934
|
+
return `color-mix(in ${obj.colorSpace}, ${color}, #000 ${coefficientToPercentage(coefficient)})`;
|
|
4935
|
+
}
|
|
4936
|
+
return darken(color, coefficient);
|
|
4937
|
+
}
|
|
4938
|
+
});
|
|
4939
|
+
}
|
|
4821
4940
|
function createThemeNoVars(options = {}, ...args) {
|
|
4822
4941
|
const {
|
|
4823
4942
|
breakpoints: breakpointsInput,
|
|
@@ -4827,6 +4946,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4827
4946
|
transitions: transitionsInput = {},
|
|
4828
4947
|
typography: typographyInput = {},
|
|
4829
4948
|
shape: shapeInput,
|
|
4949
|
+
colorSpace,
|
|
4830
4950
|
...other
|
|
4831
4951
|
} = options;
|
|
4832
4952
|
if (options.vars &&
|
|
@@ -4837,7 +4957,10 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4837
4957
|
// #host-reference
|
|
4838
4958
|
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : formatMuiErrorMessage(20));
|
|
4839
4959
|
}
|
|
4840
|
-
const palette = createPalette(
|
|
4960
|
+
const palette = createPalette({
|
|
4961
|
+
...paletteInput,
|
|
4962
|
+
colorSpace
|
|
4963
|
+
});
|
|
4841
4964
|
const systemTheme = createTheme$1(options);
|
|
4842
4965
|
let muiTheme = deepmerge(systemTheme, {
|
|
4843
4966
|
mixins: createMixins(systemTheme.breakpoints, mixinsInput),
|
|
@@ -4894,6 +5017,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
4894
5017
|
};
|
|
4895
5018
|
muiTheme.toRuntimeSource = stringifyTheme; // for Pigment CSS integration
|
|
4896
5019
|
|
|
5020
|
+
attachColorManipulators(muiTheme);
|
|
4897
5021
|
return muiTheme;
|
|
4898
5022
|
}
|
|
4899
5023
|
|
|
@@ -4934,9 +5058,14 @@ function createColorScheme(options) {
|
|
|
4934
5058
|
// need to cast to avoid module augmentation test
|
|
4935
5059
|
opacity,
|
|
4936
5060
|
overlays,
|
|
4937
|
-
|
|
5061
|
+
colorSpace,
|
|
5062
|
+
...other
|
|
4938
5063
|
} = options;
|
|
4939
|
-
|
|
5064
|
+
// need to cast because `colorSpace` is considered internal at the moment.
|
|
5065
|
+
const palette = createPalette({
|
|
5066
|
+
...paletteInput,
|
|
5067
|
+
colorSpace
|
|
5068
|
+
});
|
|
4940
5069
|
return {
|
|
4941
5070
|
palette,
|
|
4942
5071
|
opacity: {
|
|
@@ -4944,7 +5073,7 @@ function createColorScheme(options) {
|
|
|
4944
5073
|
...opacity
|
|
4945
5074
|
},
|
|
4946
5075
|
overlays: overlays || getOverlays(palette.mode),
|
|
4947
|
-
...
|
|
5076
|
+
...other
|
|
4948
5077
|
};
|
|
4949
5078
|
}
|
|
4950
5079
|
|
|
@@ -5062,7 +5191,7 @@ const silent = fn => {
|
|
|
5062
5191
|
return undefined;
|
|
5063
5192
|
};
|
|
5064
5193
|
const createGetCssVar = (cssVarPrefix = 'mui') => createGetCssVar$1(cssVarPrefix);
|
|
5065
|
-
function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
5194
|
+
function attachColorScheme$1(colorSpace, colorSchemes, scheme, restTheme, colorScheme) {
|
|
5066
5195
|
if (!scheme) {
|
|
5067
5196
|
return undefined;
|
|
5068
5197
|
}
|
|
@@ -5074,7 +5203,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
5074
5203
|
palette: {
|
|
5075
5204
|
mode,
|
|
5076
5205
|
...scheme?.palette
|
|
5077
|
-
}
|
|
5206
|
+
},
|
|
5207
|
+
colorSpace
|
|
5078
5208
|
});
|
|
5079
5209
|
return undefined;
|
|
5080
5210
|
}
|
|
@@ -5086,7 +5216,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
|
5086
5216
|
palette: {
|
|
5087
5217
|
mode,
|
|
5088
5218
|
...scheme?.palette
|
|
5089
|
-
}
|
|
5219
|
+
},
|
|
5220
|
+
colorSpace
|
|
5090
5221
|
});
|
|
5091
5222
|
colorSchemes[colorScheme] = {
|
|
5092
5223
|
...scheme,
|
|
@@ -5116,6 +5247,7 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5116
5247
|
defaultColorScheme: defaultColorSchemeInput,
|
|
5117
5248
|
disableCssColorScheme = false,
|
|
5118
5249
|
cssVarPrefix = 'mui',
|
|
5250
|
+
nativeColor = false,
|
|
5119
5251
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
|
|
5120
5252
|
colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? 'media' : undefined,
|
|
5121
5253
|
rootSelector = ':root',
|
|
@@ -5143,13 +5275,19 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5143
5275
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : formatMuiErrorMessage(21, defaultColorScheme));
|
|
5144
5276
|
}
|
|
5145
5277
|
|
|
5278
|
+
// The reason to use `oklch` is that it is the most perceptually uniform color space and widely supported.
|
|
5279
|
+
let colorSpace;
|
|
5280
|
+
if (nativeColor) {
|
|
5281
|
+
colorSpace = 'oklch';
|
|
5282
|
+
}
|
|
5283
|
+
|
|
5146
5284
|
// Create the palette for the default color scheme, either `light`, `dark`, or custom color scheme.
|
|
5147
|
-
const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
|
|
5285
|
+
const muiTheme = attachColorScheme$1(colorSpace, colorSchemes, defaultScheme, input, defaultColorScheme);
|
|
5148
5286
|
if (builtInLight && !colorSchemes.light) {
|
|
5149
|
-
attachColorScheme$1(colorSchemes, builtInLight, undefined, 'light');
|
|
5287
|
+
attachColorScheme$1(colorSpace, colorSchemes, builtInLight, undefined, 'light');
|
|
5150
5288
|
}
|
|
5151
5289
|
if (builtInDark && !colorSchemes.dark) {
|
|
5152
|
-
attachColorScheme$1(colorSchemes, builtInDark, undefined, 'dark');
|
|
5290
|
+
attachColorScheme$1(colorSpace, colorSchemes, builtInDark, undefined, 'dark');
|
|
5153
5291
|
}
|
|
5154
5292
|
let theme = {
|
|
5155
5293
|
defaultColorScheme,
|
|
@@ -5183,14 +5321,30 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5183
5321
|
setColor(palette.common, 'background', '#000');
|
|
5184
5322
|
setColor(palette.common, 'onBackground', '#fff');
|
|
5185
5323
|
}
|
|
5324
|
+
function colorMix(method, color, coefficient) {
|
|
5325
|
+
if (colorSpace) {
|
|
5326
|
+
let mixer;
|
|
5327
|
+
if (method === private_safeAlpha) {
|
|
5328
|
+
mixer = `transparent ${((1 - coefficient) * 100).toFixed(0)}%`;
|
|
5329
|
+
}
|
|
5330
|
+
if (method === private_safeDarken) {
|
|
5331
|
+
mixer = `#000 ${(coefficient * 100).toFixed(0)}%`;
|
|
5332
|
+
}
|
|
5333
|
+
if (method === private_safeLighten) {
|
|
5334
|
+
mixer = `#fff ${(coefficient * 100).toFixed(0)}%`;
|
|
5335
|
+
}
|
|
5336
|
+
return `color-mix(in ${colorSpace}, ${color}, ${mixer})`;
|
|
5337
|
+
}
|
|
5338
|
+
return method(color, coefficient);
|
|
5339
|
+
}
|
|
5186
5340
|
|
|
5187
5341
|
// assign component variables
|
|
5188
5342
|
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Button', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
5189
5343
|
if (palette.mode === 'light') {
|
|
5190
|
-
setColor(palette.Alert, 'errorColor', private_safeDarken
|
|
5191
|
-
setColor(palette.Alert, 'infoColor', private_safeDarken
|
|
5192
|
-
setColor(palette.Alert, 'successColor', private_safeDarken
|
|
5193
|
-
setColor(palette.Alert, 'warningColor', private_safeDarken
|
|
5344
|
+
setColor(palette.Alert, 'errorColor', colorMix(private_safeDarken, palette.error.light, 0.6));
|
|
5345
|
+
setColor(palette.Alert, 'infoColor', colorMix(private_safeDarken, palette.info.light, 0.6));
|
|
5346
|
+
setColor(palette.Alert, 'successColor', colorMix(private_safeDarken, palette.success.light, 0.6));
|
|
5347
|
+
setColor(palette.Alert, 'warningColor', colorMix(private_safeDarken, palette.warning.light, 0.6));
|
|
5194
5348
|
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-main'));
|
|
5195
5349
|
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-main'));
|
|
5196
5350
|
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-main'));
|
|
@@ -5199,10 +5353,10 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5199
5353
|
setColor(palette.Alert, 'infoFilledColor', silent(() => palette.getContrastText(palette.info.main)));
|
|
5200
5354
|
setColor(palette.Alert, 'successFilledColor', silent(() => palette.getContrastText(palette.success.main)));
|
|
5201
5355
|
setColor(palette.Alert, 'warningFilledColor', silent(() => palette.getContrastText(palette.warning.main)));
|
|
5202
|
-
setColor(palette.Alert, 'errorStandardBg', private_safeLighten
|
|
5203
|
-
setColor(palette.Alert, 'infoStandardBg', private_safeLighten
|
|
5204
|
-
setColor(palette.Alert, 'successStandardBg', private_safeLighten
|
|
5205
|
-
setColor(palette.Alert, 'warningStandardBg', private_safeLighten
|
|
5356
|
+
setColor(palette.Alert, 'errorStandardBg', colorMix(private_safeLighten, palette.error.light, 0.9));
|
|
5357
|
+
setColor(palette.Alert, 'infoStandardBg', colorMix(private_safeLighten, palette.info.light, 0.9));
|
|
5358
|
+
setColor(palette.Alert, 'successStandardBg', colorMix(private_safeLighten, palette.success.light, 0.9));
|
|
5359
|
+
setColor(palette.Alert, 'warningStandardBg', colorMix(private_safeLighten, palette.warning.light, 0.9));
|
|
5206
5360
|
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
|
|
5207
5361
|
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
|
|
5208
5362
|
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
|
|
@@ -5217,41 +5371,42 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5217
5371
|
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
|
|
5218
5372
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
|
|
5219
5373
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
|
|
5220
|
-
setColor(palette.LinearProgress, 'primaryBg', private_safeLighten
|
|
5221
|
-
setColor(palette.LinearProgress, 'secondaryBg', private_safeLighten
|
|
5222
|
-
setColor(palette.LinearProgress, 'errorBg', private_safeLighten
|
|
5223
|
-
setColor(palette.LinearProgress, 'infoBg', private_safeLighten
|
|
5224
|
-
setColor(palette.LinearProgress, 'successBg', private_safeLighten
|
|
5225
|
-
setColor(palette.LinearProgress, 'warningBg', private_safeLighten
|
|
5226
|
-
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
|
|
5227
|
-
setColor(palette.Slider, 'primaryTrack', private_safeLighten
|
|
5228
|
-
setColor(palette.Slider, 'secondaryTrack', private_safeLighten
|
|
5229
|
-
setColor(palette.Slider, 'errorTrack', private_safeLighten
|
|
5230
|
-
setColor(palette.Slider, 'infoTrack', private_safeLighten
|
|
5231
|
-
setColor(palette.Slider, 'successTrack', private_safeLighten
|
|
5232
|
-
setColor(palette.Slider, 'warningTrack', private_safeLighten
|
|
5233
|
-
const snackbarContentBackground =
|
|
5374
|
+
setColor(palette.LinearProgress, 'primaryBg', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5375
|
+
setColor(palette.LinearProgress, 'secondaryBg', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5376
|
+
setColor(palette.LinearProgress, 'errorBg', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5377
|
+
setColor(palette.LinearProgress, 'infoBg', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5378
|
+
setColor(palette.LinearProgress, 'successBg', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5379
|
+
setColor(palette.LinearProgress, 'warningBg', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5380
|
+
setColor(palette.Skeleton, 'bg', colorSpace ? colorMix(private_safeAlpha, palette.text.primary, 0.11) : `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
|
|
5381
|
+
setColor(palette.Slider, 'primaryTrack', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5382
|
+
setColor(palette.Slider, 'secondaryTrack', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5383
|
+
setColor(palette.Slider, 'errorTrack', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5384
|
+
setColor(palette.Slider, 'infoTrack', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5385
|
+
setColor(palette.Slider, 'successTrack', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5386
|
+
setColor(palette.Slider, 'warningTrack', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5387
|
+
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
|
|
5388
|
+
: private_safeEmphasize(palette.background.default, 0.8);
|
|
5234
5389
|
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
5235
|
-
setColor(palette.SnackbarContent, 'color', silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
5390
|
+
setColor(palette.SnackbarContent, 'color', silent(() => colorSpace ? dark.text.primary : palette.getContrastText(snackbarContentBackground)));
|
|
5236
5391
|
setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
|
|
5237
5392
|
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-400'));
|
|
5238
5393
|
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-400'));
|
|
5239
5394
|
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-common-white'));
|
|
5240
5395
|
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-100'));
|
|
5241
|
-
setColor(palette.Switch, 'primaryDisabledColor', private_safeLighten
|
|
5242
|
-
setColor(palette.Switch, 'secondaryDisabledColor', private_safeLighten
|
|
5243
|
-
setColor(palette.Switch, 'errorDisabledColor', private_safeLighten
|
|
5244
|
-
setColor(palette.Switch, 'infoDisabledColor', private_safeLighten
|
|
5245
|
-
setColor(palette.Switch, 'successDisabledColor', private_safeLighten
|
|
5246
|
-
setColor(palette.Switch, 'warningDisabledColor', private_safeLighten
|
|
5247
|
-
setColor(palette.TableCell, 'border', private_safeLighten(private_safeAlpha
|
|
5248
|
-
setColor(palette.Tooltip, 'bg', private_safeAlpha
|
|
5396
|
+
setColor(palette.Switch, 'primaryDisabledColor', colorMix(private_safeLighten, palette.primary.main, 0.62));
|
|
5397
|
+
setColor(palette.Switch, 'secondaryDisabledColor', colorMix(private_safeLighten, palette.secondary.main, 0.62));
|
|
5398
|
+
setColor(palette.Switch, 'errorDisabledColor', colorMix(private_safeLighten, palette.error.main, 0.62));
|
|
5399
|
+
setColor(palette.Switch, 'infoDisabledColor', colorMix(private_safeLighten, palette.info.main, 0.62));
|
|
5400
|
+
setColor(palette.Switch, 'successDisabledColor', colorMix(private_safeLighten, palette.success.main, 0.62));
|
|
5401
|
+
setColor(palette.Switch, 'warningDisabledColor', colorMix(private_safeLighten, palette.warning.main, 0.62));
|
|
5402
|
+
setColor(palette.TableCell, 'border', colorMix(private_safeLighten, colorMix(private_safeAlpha, palette.divider, 1), 0.88));
|
|
5403
|
+
setColor(palette.Tooltip, 'bg', colorMix(private_safeAlpha, palette.grey[700], 0.92));
|
|
5249
5404
|
}
|
|
5250
5405
|
if (palette.mode === 'dark') {
|
|
5251
|
-
setColor(palette.Alert, 'errorColor', private_safeLighten
|
|
5252
|
-
setColor(palette.Alert, 'infoColor', private_safeLighten
|
|
5253
|
-
setColor(palette.Alert, 'successColor', private_safeLighten
|
|
5254
|
-
setColor(palette.Alert, 'warningColor', private_safeLighten
|
|
5406
|
+
setColor(palette.Alert, 'errorColor', colorMix(private_safeLighten, palette.error.light, 0.6));
|
|
5407
|
+
setColor(palette.Alert, 'infoColor', colorMix(private_safeLighten, palette.info.light, 0.6));
|
|
5408
|
+
setColor(palette.Alert, 'successColor', colorMix(private_safeLighten, palette.success.light, 0.6));
|
|
5409
|
+
setColor(palette.Alert, 'warningColor', colorMix(private_safeLighten, palette.warning.light, 0.6));
|
|
5255
5410
|
setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-dark'));
|
|
5256
5411
|
setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-dark'));
|
|
5257
5412
|
setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-dark'));
|
|
@@ -5260,10 +5415,10 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5260
5415
|
setColor(palette.Alert, 'infoFilledColor', silent(() => palette.getContrastText(palette.info.dark)));
|
|
5261
5416
|
setColor(palette.Alert, 'successFilledColor', silent(() => palette.getContrastText(palette.success.dark)));
|
|
5262
5417
|
setColor(palette.Alert, 'warningFilledColor', silent(() => palette.getContrastText(palette.warning.dark)));
|
|
5263
|
-
setColor(palette.Alert, 'errorStandardBg', private_safeDarken
|
|
5264
|
-
setColor(palette.Alert, 'infoStandardBg', private_safeDarken
|
|
5265
|
-
setColor(palette.Alert, 'successStandardBg', private_safeDarken
|
|
5266
|
-
setColor(palette.Alert, 'warningStandardBg', private_safeDarken
|
|
5418
|
+
setColor(palette.Alert, 'errorStandardBg', colorMix(private_safeDarken, palette.error.light, 0.9));
|
|
5419
|
+
setColor(palette.Alert, 'infoStandardBg', colorMix(private_safeDarken, palette.info.light, 0.9));
|
|
5420
|
+
setColor(palette.Alert, 'successStandardBg', colorMix(private_safeDarken, palette.success.light, 0.9));
|
|
5421
|
+
setColor(palette.Alert, 'warningStandardBg', colorMix(private_safeDarken, palette.warning.light, 0.9));
|
|
5267
5422
|
setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
|
|
5268
5423
|
setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
|
|
5269
5424
|
setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
|
|
@@ -5280,35 +5435,36 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5280
5435
|
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
|
|
5281
5436
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
|
|
5282
5437
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
|
|
5283
|
-
setColor(palette.LinearProgress, 'primaryBg', private_safeDarken
|
|
5284
|
-
setColor(palette.LinearProgress, 'secondaryBg', private_safeDarken
|
|
5285
|
-
setColor(palette.LinearProgress, 'errorBg', private_safeDarken
|
|
5286
|
-
setColor(palette.LinearProgress, 'infoBg', private_safeDarken
|
|
5287
|
-
setColor(palette.LinearProgress, 'successBg', private_safeDarken
|
|
5288
|
-
setColor(palette.LinearProgress, 'warningBg', private_safeDarken
|
|
5289
|
-
setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
|
|
5290
|
-
setColor(palette.Slider, 'primaryTrack', private_safeDarken
|
|
5291
|
-
setColor(palette.Slider, 'secondaryTrack', private_safeDarken
|
|
5292
|
-
setColor(palette.Slider, 'errorTrack', private_safeDarken
|
|
5293
|
-
setColor(palette.Slider, 'infoTrack', private_safeDarken
|
|
5294
|
-
setColor(palette.Slider, 'successTrack', private_safeDarken
|
|
5295
|
-
setColor(palette.Slider, 'warningTrack', private_safeDarken
|
|
5296
|
-
const snackbarContentBackground =
|
|
5438
|
+
setColor(palette.LinearProgress, 'primaryBg', colorMix(private_safeDarken, palette.primary.main, 0.5));
|
|
5439
|
+
setColor(palette.LinearProgress, 'secondaryBg', colorMix(private_safeDarken, palette.secondary.main, 0.5));
|
|
5440
|
+
setColor(palette.LinearProgress, 'errorBg', colorMix(private_safeDarken, palette.error.main, 0.5));
|
|
5441
|
+
setColor(palette.LinearProgress, 'infoBg', colorMix(private_safeDarken, palette.info.main, 0.5));
|
|
5442
|
+
setColor(palette.LinearProgress, 'successBg', colorMix(private_safeDarken, palette.success.main, 0.5));
|
|
5443
|
+
setColor(palette.LinearProgress, 'warningBg', colorMix(private_safeDarken, palette.warning.main, 0.5));
|
|
5444
|
+
setColor(palette.Skeleton, 'bg', colorSpace ? colorMix(private_safeAlpha, palette.text.primary, 0.13) : `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
|
|
5445
|
+
setColor(palette.Slider, 'primaryTrack', colorMix(private_safeDarken, palette.primary.main, 0.5));
|
|
5446
|
+
setColor(palette.Slider, 'secondaryTrack', colorMix(private_safeDarken, palette.secondary.main, 0.5));
|
|
5447
|
+
setColor(palette.Slider, 'errorTrack', colorMix(private_safeDarken, palette.error.main, 0.5));
|
|
5448
|
+
setColor(palette.Slider, 'infoTrack', colorMix(private_safeDarken, palette.info.main, 0.5));
|
|
5449
|
+
setColor(palette.Slider, 'successTrack', colorMix(private_safeDarken, palette.success.main, 0.5));
|
|
5450
|
+
setColor(palette.Slider, 'warningTrack', colorMix(private_safeDarken, palette.warning.main, 0.5));
|
|
5451
|
+
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
|
|
5452
|
+
: private_safeEmphasize(palette.background.default, 0.98);
|
|
5297
5453
|
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
5298
|
-
setColor(palette.SnackbarContent, 'color', silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
5454
|
+
setColor(palette.SnackbarContent, 'color', silent(() => colorSpace ? light.text.primary : palette.getContrastText(snackbarContentBackground)));
|
|
5299
5455
|
setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
|
|
5300
5456
|
setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-600'));
|
|
5301
5457
|
setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-600'));
|
|
5302
5458
|
setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-grey-300'));
|
|
5303
5459
|
setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-600'));
|
|
5304
|
-
setColor(palette.Switch, 'primaryDisabledColor', private_safeDarken
|
|
5305
|
-
setColor(palette.Switch, 'secondaryDisabledColor', private_safeDarken
|
|
5306
|
-
setColor(palette.Switch, 'errorDisabledColor', private_safeDarken
|
|
5307
|
-
setColor(palette.Switch, 'infoDisabledColor', private_safeDarken
|
|
5308
|
-
setColor(palette.Switch, 'successDisabledColor', private_safeDarken
|
|
5309
|
-
setColor(palette.Switch, 'warningDisabledColor', private_safeDarken
|
|
5310
|
-
setColor(palette.TableCell, 'border', private_safeDarken(private_safeAlpha
|
|
5311
|
-
setColor(palette.Tooltip, 'bg', private_safeAlpha
|
|
5460
|
+
setColor(palette.Switch, 'primaryDisabledColor', colorMix(private_safeDarken, palette.primary.main, 0.55));
|
|
5461
|
+
setColor(palette.Switch, 'secondaryDisabledColor', colorMix(private_safeDarken, palette.secondary.main, 0.55));
|
|
5462
|
+
setColor(palette.Switch, 'errorDisabledColor', colorMix(private_safeDarken, palette.error.main, 0.55));
|
|
5463
|
+
setColor(palette.Switch, 'infoDisabledColor', colorMix(private_safeDarken, palette.info.main, 0.55));
|
|
5464
|
+
setColor(palette.Switch, 'successDisabledColor', colorMix(private_safeDarken, palette.success.main, 0.55));
|
|
5465
|
+
setColor(palette.Switch, 'warningDisabledColor', colorMix(private_safeDarken, palette.warning.main, 0.55));
|
|
5466
|
+
setColor(palette.TableCell, 'border', colorMix(private_safeDarken, colorMix(private_safeAlpha, palette.divider, 1), 0.68));
|
|
5467
|
+
setColor(palette.Tooltip, 'bg', colorMix(private_safeAlpha, palette.grey[700], 0.92));
|
|
5312
5468
|
}
|
|
5313
5469
|
|
|
5314
5470
|
// MUI X - DataGrid needs this token.
|
|
@@ -5360,7 +5516,8 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
5360
5516
|
prefix: cssVarPrefix,
|
|
5361
5517
|
disableCssColorScheme,
|
|
5362
5518
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
|
|
5363
|
-
getSelector: defaultGetSelector(theme)
|
|
5519
|
+
getSelector: defaultGetSelector(theme),
|
|
5520
|
+
enableContrastVars: nativeColor
|
|
5364
5521
|
};
|
|
5365
5522
|
const {
|
|
5366
5523
|
vars,
|
|
@@ -5426,7 +5583,7 @@ function createTheme(options = {},
|
|
|
5426
5583
|
light: true
|
|
5427
5584
|
} : undefined,
|
|
5428
5585
|
defaultColorScheme: initialDefaultColorScheme = palette?.mode,
|
|
5429
|
-
...
|
|
5586
|
+
...other
|
|
5430
5587
|
} = options;
|
|
5431
5588
|
const defaultColorSchemeInput = initialDefaultColorScheme || 'light';
|
|
5432
5589
|
const defaultScheme = initialColorSchemes?.[defaultColorSchemeInput];
|
|
@@ -5483,7 +5640,7 @@ function createTheme(options = {},
|
|
|
5483
5640
|
colorSchemesInput.light = true;
|
|
5484
5641
|
}
|
|
5485
5642
|
return createThemeWithVars({
|
|
5486
|
-
...
|
|
5643
|
+
...other,
|
|
5487
5644
|
colorSchemes: colorSchemesInput,
|
|
5488
5645
|
defaultColorScheme: defaultColorSchemeInput,
|
|
5489
5646
|
...(typeof cssVariables !== 'boolean' && cssVariables)
|
|
@@ -5572,7 +5729,7 @@ function createSimplePaletteValueFilter(additionalPropertiesToCheck = []) {
|
|
|
5572
5729
|
function getCircularProgressUtilityClass(slot) {
|
|
5573
5730
|
return generateUtilityClass('MuiCircularProgress', slot);
|
|
5574
5731
|
}
|
|
5575
|
-
generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
|
|
5732
|
+
generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'track', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
|
|
5576
5733
|
|
|
5577
5734
|
const SIZE = 44;
|
|
5578
5735
|
const circularRotateKeyframe = keyframes`
|
|
@@ -5620,6 +5777,7 @@ const useUtilityClasses = ownerState => {
|
|
|
5620
5777
|
const slots = {
|
|
5621
5778
|
root: ['root', variant, `color${capitalize(color)}`],
|
|
5622
5779
|
svg: ['svg'],
|
|
5780
|
+
track: ['track'],
|
|
5623
5781
|
circle: ['circle', `circle${capitalize(variant)}`, disableShrink && 'circleDisableShrink']
|
|
5624
5782
|
};
|
|
5625
5783
|
return composeClasses(slots, getCircularProgressUtilityClass, classes);
|
|
@@ -5705,6 +5863,15 @@ const CircularProgressCircle = styled('circle', {
|
|
|
5705
5863
|
}
|
|
5706
5864
|
}]
|
|
5707
5865
|
})));
|
|
5866
|
+
const CircularProgressTrack = styled('circle', {
|
|
5867
|
+
name: 'MuiCircularProgress',
|
|
5868
|
+
slot: 'Track'
|
|
5869
|
+
})(memoTheme(({
|
|
5870
|
+
theme
|
|
5871
|
+
}) => ({
|
|
5872
|
+
stroke: 'currentColor',
|
|
5873
|
+
opacity: (theme.vars || theme).palette.action.activatedOpacity
|
|
5874
|
+
})));
|
|
5708
5875
|
|
|
5709
5876
|
/**
|
|
5710
5877
|
* ## ARIA
|
|
@@ -5722,6 +5889,7 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
5722
5889
|
className,
|
|
5723
5890
|
color = 'primary',
|
|
5724
5891
|
disableShrink = false,
|
|
5892
|
+
enableTrackSlot = false,
|
|
5725
5893
|
size = 40,
|
|
5726
5894
|
style,
|
|
5727
5895
|
thickness = 3.6,
|
|
@@ -5736,7 +5904,8 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
5736
5904
|
size,
|
|
5737
5905
|
thickness,
|
|
5738
5906
|
value,
|
|
5739
|
-
variant
|
|
5907
|
+
variant,
|
|
5908
|
+
enableTrackSlot
|
|
5740
5909
|
};
|
|
5741
5910
|
const classes = useUtilityClasses(ownerState);
|
|
5742
5911
|
const circleStyle = {};
|
|
@@ -5762,11 +5931,20 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
5762
5931
|
role: "progressbar",
|
|
5763
5932
|
...rootProps,
|
|
5764
5933
|
...other,
|
|
5765
|
-
children: /*#__PURE__*/
|
|
5934
|
+
children: /*#__PURE__*/jsxs(CircularProgressSVG, {
|
|
5766
5935
|
className: classes.svg,
|
|
5767
5936
|
ownerState: ownerState,
|
|
5768
5937
|
viewBox: `${SIZE / 2} ${SIZE / 2} ${SIZE} ${SIZE}`,
|
|
5769
|
-
children: /*#__PURE__*/jsx(
|
|
5938
|
+
children: [enableTrackSlot ? /*#__PURE__*/jsx(CircularProgressTrack, {
|
|
5939
|
+
className: classes.track,
|
|
5940
|
+
ownerState: ownerState,
|
|
5941
|
+
cx: SIZE,
|
|
5942
|
+
cy: SIZE,
|
|
5943
|
+
r: (SIZE - thickness) / 2,
|
|
5944
|
+
fill: "none",
|
|
5945
|
+
strokeWidth: thickness,
|
|
5946
|
+
"aria-hidden": "true"
|
|
5947
|
+
}) : null, /*#__PURE__*/jsx(CircularProgressCircle, {
|
|
5770
5948
|
className: classes.circle,
|
|
5771
5949
|
style: circleStyle,
|
|
5772
5950
|
ownerState: ownerState,
|
|
@@ -5775,7 +5953,7 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
5775
5953
|
r: (SIZE - thickness) / 2,
|
|
5776
5954
|
fill: "none",
|
|
5777
5955
|
strokeWidth: thickness
|
|
5778
|
-
})
|
|
5956
|
+
})]
|
|
5779
5957
|
})
|
|
5780
5958
|
});
|
|
5781
5959
|
});
|
|
@@ -5810,6 +5988,12 @@ process.env.NODE_ENV !== "production" ? CircularProgress.propTypes /* remove-pro
|
|
|
5810
5988
|
}
|
|
5811
5989
|
return null;
|
|
5812
5990
|
}),
|
|
5991
|
+
/**
|
|
5992
|
+
* If `true`, a track circle slot is mounted to show a subtle background for the progress.
|
|
5993
|
+
* The `size` and `thickness` apply to the track slot to be consistent with the progress circle.
|
|
5994
|
+
* @default false
|
|
5995
|
+
*/
|
|
5996
|
+
enableTrackSlot: PropTypes.bool,
|
|
5813
5997
|
/**
|
|
5814
5998
|
* The size of the component.
|
|
5815
5999
|
* If using a number, the pixel unit is assumed.
|
|
@@ -5851,12 +6035,12 @@ var Loading = function () {
|
|
|
5851
6035
|
|
|
5852
6036
|
var Plot$2 = lazy(function () { return import('react-plotly.js'); });
|
|
5853
6037
|
var HistogramPlot = function (props) {
|
|
5854
|
-
var _a, _b;
|
|
5855
|
-
var data = props.data, title = props.title, xAxisTitle = props.xAxisTitle,
|
|
6038
|
+
var _a, _b, _c, _d;
|
|
6039
|
+
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;
|
|
5856
6040
|
// Ref for plot container
|
|
5857
6041
|
var containerRef = useRef(null);
|
|
5858
6042
|
// Track any selections made in this plot so we can style the selection box.
|
|
5859
|
-
var
|
|
6043
|
+
var _o = useState(null), selectedRange = _o[0], setSelectedRange = _o[1];
|
|
5860
6044
|
// If all the data becomes selected, we should forget any old selections.
|
|
5861
6045
|
useEffect(function () {
|
|
5862
6046
|
if (unselectedData.length === 0) {
|
|
@@ -5868,7 +6052,7 @@ var HistogramPlot = function (props) {
|
|
|
5868
6052
|
// Plotly determines "nice" bins which consequently means it internally decides the axis range. We need
|
|
5869
6053
|
// to access that information once the plot has been initialized so that we can prevent the
|
|
5870
6054
|
// axis range from changing during interaction. Dates use strings.
|
|
5871
|
-
var
|
|
6055
|
+
var _p = useState(undefined), fixedXAxisRange = _p[0], setFixedXAxisRange = _p[1];
|
|
5872
6056
|
// Once the plot is drawn, record the initial axis range so we can keep it fixed.
|
|
5873
6057
|
// figure should be Readonly<Plotly.Figure> but react-plotly.js doesn't expose that type, so we use any.
|
|
5874
6058
|
var handlePlotUpdate = function (figure, graphDiv) {
|
|
@@ -6037,8 +6221,9 @@ var HistogramPlot = function (props) {
|
|
|
6037
6221
|
}, [selectedRange, unselectedData]);
|
|
6038
6222
|
// Calculate the mean of the selected data using normalized data
|
|
6039
6223
|
var meanValue = (_a = calculateMean(data)) !== null && _a !== void 0 ? _a : 0; // Default to 0 if no data
|
|
6224
|
+
var stdevValue = (_b = calculateStandardDeviation(data)) !== null && _b !== void 0 ? _b : 0;
|
|
6040
6225
|
var meanLineRadius = 0.01; // distance from the top of the y axis to the top/bottom end of the mean line
|
|
6041
|
-
var meanLine = (
|
|
6226
|
+
var meanLine = (statsAnnotations.includes('mean') && data.length > 0) ? [{
|
|
6042
6227
|
type: 'line',
|
|
6043
6228
|
x0: meanValue,
|
|
6044
6229
|
y0: 1 - meanLineRadius,
|
|
@@ -6052,8 +6237,8 @@ var HistogramPlot = function (props) {
|
|
|
6052
6237
|
}] : [];
|
|
6053
6238
|
// Draw mean line for all data
|
|
6054
6239
|
var allData = __spreadArray(__spreadArray([], data, true), unselectedData, true);
|
|
6055
|
-
var allDataMeanValue = (
|
|
6056
|
-
var allDataMeanLine = (
|
|
6240
|
+
var allDataMeanValue = (_c = calculateMean(allData)) !== null && _c !== void 0 ? _c : 0;
|
|
6241
|
+
var allDataMeanLine = (statsAnnotations.includes('mean') && unselectedData.length > 0 && data.length > 0) ? [{
|
|
6057
6242
|
type: 'line',
|
|
6058
6243
|
x0: allDataMeanValue,
|
|
6059
6244
|
y0: 1 - meanLineRadius,
|
|
@@ -6065,6 +6250,61 @@ var HistogramPlot = function (props) {
|
|
|
6065
6250
|
width: 1.5,
|
|
6066
6251
|
}
|
|
6067
6252
|
}] : [];
|
|
6253
|
+
var stdevLines = (statsAnnotations.includes('stdev') && data.length > 0) ? [{
|
|
6254
|
+
type: 'line',
|
|
6255
|
+
x0: meanValue - stdevValue,
|
|
6256
|
+
y0: 1 - meanLineRadius,
|
|
6257
|
+
x1: meanValue - stdevValue,
|
|
6258
|
+
yref: 'paper',
|
|
6259
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6260
|
+
line: {
|
|
6261
|
+
color: barColor,
|
|
6262
|
+
width: 1.5,
|
|
6263
|
+
dash: 'dot',
|
|
6264
|
+
}
|
|
6265
|
+
},
|
|
6266
|
+
{
|
|
6267
|
+
type: 'line',
|
|
6268
|
+
x0: meanValue + stdevValue,
|
|
6269
|
+
y0: 1 - meanLineRadius,
|
|
6270
|
+
x1: meanValue + stdevValue,
|
|
6271
|
+
yref: 'paper',
|
|
6272
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6273
|
+
line: {
|
|
6274
|
+
color: barColor,
|
|
6275
|
+
width: 1.5,
|
|
6276
|
+
dash: 'dot',
|
|
6277
|
+
}
|
|
6278
|
+
}]
|
|
6279
|
+
: [];
|
|
6280
|
+
var allDataStdevValue = (_d = calculateStandardDeviation(allData)) !== null && _d !== void 0 ? _d : 0;
|
|
6281
|
+
var allDataStdevLines = (statsAnnotations.includes('stdev') && unselectedData.length > 0 && data.length > 0) ? [{
|
|
6282
|
+
type: 'line',
|
|
6283
|
+
x0: allDataMeanValue - allDataStdevValue,
|
|
6284
|
+
y0: 1 - meanLineRadius,
|
|
6285
|
+
x1: allDataMeanValue - allDataStdevValue,
|
|
6286
|
+
yref: 'paper',
|
|
6287
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6288
|
+
line: {
|
|
6289
|
+
color: unselectedBarColor,
|
|
6290
|
+
width: 1.5,
|
|
6291
|
+
dash: 'dot',
|
|
6292
|
+
}
|
|
6293
|
+
},
|
|
6294
|
+
{
|
|
6295
|
+
type: 'line',
|
|
6296
|
+
x0: allDataMeanValue + allDataStdevValue,
|
|
6297
|
+
y0: 1 - meanLineRadius,
|
|
6298
|
+
x1: allDataMeanValue + allDataStdevValue,
|
|
6299
|
+
yref: 'paper',
|
|
6300
|
+
y1: 1 + meanLineRadius + 0.04, // Add extra length above to make the line look centered on the y-axis top.
|
|
6301
|
+
line: {
|
|
6302
|
+
color: unselectedBarColor,
|
|
6303
|
+
width: 1.5,
|
|
6304
|
+
dash: 'dot',
|
|
6305
|
+
}
|
|
6306
|
+
}]
|
|
6307
|
+
: [];
|
|
6068
6308
|
// If binSizeOverride is provided, use it to set the bin size and range explicitly.
|
|
6069
6309
|
// Plotly does a better job of setting bins and ending them at nice numbers, so only use
|
|
6070
6310
|
// this prop when necessary.
|
|
@@ -6100,6 +6340,40 @@ var HistogramPlot = function (props) {
|
|
|
6100
6340
|
},
|
|
6101
6341
|
hovertemplate: '[%{x})<br>Count: %{y}<extra></extra>', // Custom hover text
|
|
6102
6342
|
};
|
|
6343
|
+
var meanAnnotation = (statsAnnotations.includes('mean') && meanLine && data.length > 0) ? [{
|
|
6344
|
+
x: meanValue,
|
|
6345
|
+
y: 1 + meanLineRadius + 0.04, // Position above the mean line. Value set with respect to the paper coordinates.
|
|
6346
|
+
yref: 'paper',
|
|
6347
|
+
text: "<span style=\"font-weight:300\">AVG </span><span style=\"font-weight:600\">".concat(isDateArray(data) ? new Date(meanValue).toLocaleDateString('en-US', {
|
|
6348
|
+
month: '2-digit',
|
|
6349
|
+
day: '2-digit',
|
|
6350
|
+
year: '2-digit'
|
|
6351
|
+
}) : meanValue.toFixed(2), "</span>"),
|
|
6352
|
+
xanchor: 'center',
|
|
6353
|
+
yanchor: 'bottom',
|
|
6354
|
+
showarrow: false,
|
|
6355
|
+
font: {
|
|
6356
|
+
color: barColor,
|
|
6357
|
+
size: 12,
|
|
6358
|
+
},
|
|
6359
|
+
}] : [];
|
|
6360
|
+
var stdevAnnotation = (statsAnnotations.includes('stdev') && stdevLines && data.length > 0) ? [{
|
|
6361
|
+
x: meanValue, // Draw above the mean annotation
|
|
6362
|
+
y: 1 + meanLineRadius + (statsAnnotations.includes('mean') ? 0.11 : 0.04),
|
|
6363
|
+
yref: 'paper',
|
|
6364
|
+
text: "<span style=\"font-weight:300\">\u03C3 </span><span style=\"font-weight:600\">±".concat(isDateArray(data) ? new Date(stdevValue).toLocaleDateString('en-US', {
|
|
6365
|
+
month: '2-digit',
|
|
6366
|
+
day: '2-digit',
|
|
6367
|
+
year: '2-digit'
|
|
6368
|
+
}) : stdevValue.toFixed(2), "</span>"),
|
|
6369
|
+
xanchor: 'center',
|
|
6370
|
+
yanchor: 'bottom',
|
|
6371
|
+
showarrow: false,
|
|
6372
|
+
font: {
|
|
6373
|
+
color: barColor,
|
|
6374
|
+
size: 12,
|
|
6375
|
+
},
|
|
6376
|
+
}] : [];
|
|
6103
6377
|
var plotlyData = [
|
|
6104
6378
|
{
|
|
6105
6379
|
x: data,
|
|
@@ -6132,7 +6406,7 @@ var HistogramPlot = function (props) {
|
|
|
6132
6406
|
margin: {
|
|
6133
6407
|
l: 50,
|
|
6134
6408
|
r: 35, // Balance between ensuring the mean annotation doesn't get cut off and having too much margin.
|
|
6135
|
-
t: title ?
|
|
6409
|
+
t: 40 + (title ? 50 : 0), // Add extra top margin if there is a title
|
|
6136
6410
|
b: 50,
|
|
6137
6411
|
pad: 4
|
|
6138
6412
|
},
|
|
@@ -6178,24 +6452,8 @@ var HistogramPlot = function (props) {
|
|
|
6178
6452
|
bargap: 0.03, // Gap between bars
|
|
6179
6453
|
dragmode: 'select', // Enable drag to select
|
|
6180
6454
|
selectdirection: 'h', // User can select in horizontal direction only
|
|
6181
|
-
shapes: __spreadArray(__spreadArray(__spreadArray([], allDataMeanLine, true), meanLine, true), selectedRangeBox, true), // Add the mean line and selection box
|
|
6182
|
-
annotations: (
|
|
6183
|
-
x: meanValue,
|
|
6184
|
-
y: 1 + meanLineRadius + 0.04, // Position above the mean line. Value set with respect to the paper coordinates.
|
|
6185
|
-
yref: 'paper',
|
|
6186
|
-
text: "<span style=\"font-weight:300\">AVG </span><span style=\"font-weight:600\">".concat(isDateArray(data) ? new Date(meanValue).toLocaleDateString('en-US', {
|
|
6187
|
-
month: '2-digit',
|
|
6188
|
-
day: '2-digit',
|
|
6189
|
-
year: '2-digit'
|
|
6190
|
-
}) : meanValue.toFixed(2), "</span>"),
|
|
6191
|
-
xanchor: 'center',
|
|
6192
|
-
yanchor: 'bottom',
|
|
6193
|
-
showarrow: false,
|
|
6194
|
-
font: {
|
|
6195
|
-
color: barColor,
|
|
6196
|
-
size: 12,
|
|
6197
|
-
},
|
|
6198
|
-
}] : [],
|
|
6455
|
+
shapes: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], allDataMeanLine, true), meanLine, true), selectedRangeBox, true), stdevLines, true), allDataStdevLines, true), // Add the mean line and selection box
|
|
6456
|
+
annotations: __spreadArray(__spreadArray([], meanAnnotation, true), stdevAnnotation, true)
|
|
6199
6457
|
};
|
|
6200
6458
|
var config = {
|
|
6201
6459
|
responsive: true, // Make the plot responsive
|