@nebula.js/stardust 4.6.1 → 4.6.2

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.6.1
2
+ * @nebula.js/stardust v4.6.2
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -2363,7 +2363,7 @@
2363
2363
  return prototype;
2364
2364
  }
2365
2365
 
2366
- function Color() {}
2366
+ function Color$1() {}
2367
2367
 
2368
2368
  var darker = 0.7;
2369
2369
  var brighter = 1 / darker;
@@ -2530,7 +2530,7 @@
2530
2530
  yellowgreen: 0x9acd32
2531
2531
  };
2532
2532
 
2533
- define(Color, color$3, {
2533
+ define(Color$1, color$3, {
2534
2534
  copy(channels) {
2535
2535
  return Object.assign(new this.constructor, this, channels);
2536
2536
  },
@@ -2566,15 +2566,15 @@
2566
2566
  format = (format + "").trim().toLowerCase();
2567
2567
  return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
2568
2568
  : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
2569
- : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
2570
- : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
2569
+ : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
2570
+ : l === 4 ? rgba$1((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
2571
2571
  : null) // invalid hex
2572
2572
  : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
2573
2573
  : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
2574
- : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
2575
- : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
2576
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
2577
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
2574
+ : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
2575
+ : (m = reRgbaPercent.exec(format)) ? rgba$1(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
2576
+ : (m = reHslPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
2577
+ : (m = reHslaPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
2578
2578
  : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
2579
2579
  : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
2580
2580
  : null;
@@ -2584,19 +2584,19 @@
2584
2584
  return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
2585
2585
  }
2586
2586
 
2587
- function rgba(r, g, b, a) {
2587
+ function rgba$1(r, g, b, a) {
2588
2588
  if (a <= 0) r = g = b = NaN;
2589
2589
  return new Rgb(r, g, b, a);
2590
2590
  }
2591
2591
 
2592
2592
  function rgbConvert(o) {
2593
- if (!(o instanceof Color)) o = color$3(o);
2593
+ if (!(o instanceof Color$1)) o = color$3(o);
2594
2594
  if (!o) return new Rgb;
2595
2595
  o = o.rgb();
2596
2596
  return new Rgb(o.r, o.g, o.b, o.opacity);
2597
2597
  }
2598
2598
 
2599
- function rgb(r, g, b, opacity) {
2599
+ function rgb$1(r, g, b, opacity) {
2600
2600
  return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
2601
2601
  }
2602
2602
 
@@ -2607,7 +2607,7 @@
2607
2607
  this.opacity = +opacity;
2608
2608
  }
2609
2609
 
2610
- define(Rgb, rgb, extend$3(Color, {
2610
+ define(Rgb, rgb$1, extend$3(Color$1, {
2611
2611
  brighter(k) {
2612
2612
  k = k == null ? brighter : Math.pow(brighter, k);
2613
2613
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
@@ -2636,11 +2636,11 @@
2636
2636
  }));
2637
2637
 
2638
2638
  function rgb_formatHex() {
2639
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
2639
+ return `#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}`;
2640
2640
  }
2641
2641
 
2642
2642
  function rgb_formatHex8() {
2643
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2643
+ return `#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}${hex$1((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2644
2644
  }
2645
2645
 
2646
2646
  function rgb_formatRgb() {
@@ -2656,12 +2656,12 @@
2656
2656
  return Math.max(0, Math.min(255, Math.round(value) || 0));
2657
2657
  }
2658
2658
 
2659
- function hex(value) {
2659
+ function hex$1(value) {
2660
2660
  value = clampi(value);
2661
2661
  return (value < 16 ? "0" : "") + value.toString(16);
2662
2662
  }
2663
2663
 
2664
- function hsla(h, s, l, a) {
2664
+ function hsla$1(h, s, l, a) {
2665
2665
  if (a <= 0) h = s = l = NaN;
2666
2666
  else if (l <= 0 || l >= 1) h = s = NaN;
2667
2667
  else if (s <= 0) h = NaN;
@@ -2670,7 +2670,7 @@
2670
2670
 
2671
2671
  function hslConvert(o) {
2672
2672
  if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
2673
- if (!(o instanceof Color)) o = color$3(o);
2673
+ if (!(o instanceof Color$1)) o = color$3(o);
2674
2674
  if (!o) return new Hsl;
2675
2675
  if (o instanceof Hsl) return o;
2676
2676
  o = o.rgb();
@@ -2694,7 +2694,7 @@
2694
2694
  return new Hsl(h, s, l, o.opacity);
2695
2695
  }
2696
2696
 
2697
- function hsl(h, s, l, opacity) {
2697
+ function hsl$1(h, s, l, opacity) {
2698
2698
  return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
2699
2699
  }
2700
2700
 
@@ -2705,7 +2705,7 @@
2705
2705
  this.opacity = +opacity;
2706
2706
  }
2707
2707
 
2708
- define(Hsl, hsl, extend$3(Color, {
2708
+ define(Hsl, hsl$1, extend$3(Color$1, {
2709
2709
  brighter(k) {
2710
2710
  k = k == null ? brighter : Math.pow(brighter, k);
2711
2711
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
@@ -3298,7 +3298,7 @@
3298
3298
  const g = Math.floor(c1.g + (c2.g - c1.g) * t);
3299
3299
  const b = Math.floor(c1.b + (c2.b - c1.b) * t);
3300
3300
  const a = Math.floor(c1.opacity + (c2.opacity - c1.opacity) * t);
3301
- return rgb(r, g, b, a);
3301
+ return rgb$1(r, g, b, a);
3302
3302
  }
3303
3303
  class ColorScale {
3304
3304
  constructor(nanColor) {
@@ -4540,10 +4540,10 @@
4540
4540
  useEnhancedEffect$1(() => {
4541
4541
  ref.current = fn;
4542
4542
  });
4543
- return reactExports.useCallback((...args) =>
4543
+ return reactExports.useRef((...args) =>
4544
4544
  // @ts-expect-error hide `this`
4545
4545
  // tslint:disable-next-line:ban-comma-operator
4546
- (0, ref.current)(...args), []);
4546
+ (0, ref.current)(...args)).current;
4547
4547
  }
4548
4548
 
4549
4549
  function useForkRef(...refs) {
@@ -6952,7 +6952,7 @@
6952
6952
  }
6953
6953
 
6954
6954
  /**
6955
- * @mui/styled-engine v5.14.13
6955
+ * @mui/styled-engine v5.14.16
6956
6956
  *
6957
6957
  * @license MIT
6958
6958
  * This source code is licensed under the MIT license found in the
@@ -9533,7 +9533,7 @@
9533
9533
  }
9534
9534
 
9535
9535
  const _excluded$I = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
9536
- function round$2(value) {
9536
+ function round$3(value) {
9537
9537
  return Math.round(value * 1e5) / 1e5;
9538
9538
  }
9539
9539
  const caseAllCaps = {
@@ -9573,7 +9573,7 @@
9573
9573
  // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
9574
9574
  lineHeight
9575
9575
  }, fontFamily === defaultFontFamily ? {
9576
- letterSpacing: `${round$2(letterSpacing / size)}em`
9576
+ letterSpacing: `${round$3(letterSpacing / size)}em`
9577
9577
  } : {}, casing, allVariants);
9578
9578
  const variants = {
9579
9579
  h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
@@ -11599,6 +11599,7 @@
11599
11599
  excluded: '#BEBEBE',
11600
11600
  selectedExcluded: '#BEBEBE',
11601
11601
  possible: colors.grey100,
11602
+ selectedContrastText: colors.grey100,
11602
11603
  mainContrastText: colors.grey100,
11603
11604
  alternativeContrastText: colors.grey25,
11604
11605
  excludedContrastText: colors.grey25,
@@ -11666,6 +11667,7 @@
11666
11667
  excluded: colors.grey10,
11667
11668
  selectedExcluded: colors.grey10,
11668
11669
  possible: colors.grey80,
11670
+ selectedContrastText: colors.grey100,
11669
11671
  mainContrastText: colors.grey100,
11670
11672
  alternativeContrastText: colors.grey100,
11671
11673
  excludedContrastText: colors.grey100,
@@ -11818,7 +11820,7 @@
11818
11820
  return cache[key];
11819
11821
  }
11820
11822
 
11821
- const NEBULA_VERSION_HASH = "2504" ;
11823
+ const NEBULA_VERSION_HASH = "ca95" ;
11822
11824
  ClassNameGenerator$1.configure(componentName => {
11823
11825
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
11824
11826
  });
@@ -12079,7 +12081,7 @@
12079
12081
  const appRef = React.createRef();
12080
12082
  const element = document.createElement('div');
12081
12083
  element.style.display = 'none';
12082
- element.setAttribute('data-nebulajs-version', "4.6.1" );
12084
+ element.setAttribute('data-nebulajs-version', "4.6.2" );
12083
12085
  element.setAttribute('data-app-id', app.id);
12084
12086
  document.body.appendChild(element);
12085
12087
  if (context) {
@@ -12147,246 +12149,6 @@
12147
12149
  }, appRef, rendered];
12148
12150
  }
12149
12151
 
12150
- const pink = {
12151
- 50: '#fce4ec',
12152
- 100: '#f8bbd0',
12153
- 200: '#f48fb1',
12154
- 300: '#f06292',
12155
- 400: '#ec407a',
12156
- 500: '#e91e63',
12157
- 600: '#d81b60',
12158
- 700: '#c2185b',
12159
- 800: '#ad1457',
12160
- 900: '#880e4f',
12161
- A100: '#ff80ab',
12162
- A200: '#ff4081',
12163
- A400: '#f50057',
12164
- A700: '#c51162'
12165
- };
12166
- var pink$1 = pink;
12167
-
12168
- const deepPurple = {
12169
- 50: '#ede7f6',
12170
- 100: '#d1c4e9',
12171
- 200: '#b39ddb',
12172
- 300: '#9575cd',
12173
- 400: '#7e57c2',
12174
- 500: '#673ab7',
12175
- 600: '#5e35b1',
12176
- 700: '#512da8',
12177
- 800: '#4527a0',
12178
- 900: '#311b92',
12179
- A100: '#b388ff',
12180
- A200: '#7c4dff',
12181
- A400: '#651fff',
12182
- A700: '#6200ea'
12183
- };
12184
- var deepPurple$1 = deepPurple;
12185
-
12186
- const indigo = {
12187
- 50: '#e8eaf6',
12188
- 100: '#c5cae9',
12189
- 200: '#9fa8da',
12190
- 300: '#7986cb',
12191
- 400: '#5c6bc0',
12192
- 500: '#3f51b5',
12193
- 600: '#3949ab',
12194
- 700: '#303f9f',
12195
- 800: '#283593',
12196
- 900: '#1a237e',
12197
- A100: '#8c9eff',
12198
- A200: '#536dfe',
12199
- A400: '#3d5afe',
12200
- A700: '#304ffe'
12201
- };
12202
- var indigo$1 = indigo;
12203
-
12204
- const cyan = {
12205
- 50: '#e0f7fa',
12206
- 100: '#b2ebf2',
12207
- 200: '#80deea',
12208
- 300: '#4dd0e1',
12209
- 400: '#26c6da',
12210
- 500: '#00bcd4',
12211
- 600: '#00acc1',
12212
- 700: '#0097a7',
12213
- 800: '#00838f',
12214
- 900: '#006064',
12215
- A100: '#84ffff',
12216
- A200: '#18ffff',
12217
- A400: '#00e5ff',
12218
- A700: '#00b8d4'
12219
- };
12220
- var cyan$1 = cyan;
12221
-
12222
- const teal = {
12223
- 50: '#e0f2f1',
12224
- 100: '#b2dfdb',
12225
- 200: '#80cbc4',
12226
- 300: '#4db6ac',
12227
- 400: '#26a69a',
12228
- 500: '#009688',
12229
- 600: '#00897b',
12230
- 700: '#00796b',
12231
- 800: '#00695c',
12232
- 900: '#004d40',
12233
- A100: '#a7ffeb',
12234
- A200: '#64ffda',
12235
- A400: '#1de9b6',
12236
- A700: '#00bfa5'
12237
- };
12238
- var teal$1 = teal;
12239
-
12240
- const lightGreen = {
12241
- 50: '#f1f8e9',
12242
- 100: '#dcedc8',
12243
- 200: '#c5e1a5',
12244
- 300: '#aed581',
12245
- 400: '#9ccc65',
12246
- 500: '#8bc34a',
12247
- 600: '#7cb342',
12248
- 700: '#689f38',
12249
- 800: '#558b2f',
12250
- 900: '#33691e',
12251
- A100: '#ccff90',
12252
- A200: '#b2ff59',
12253
- A400: '#76ff03',
12254
- A700: '#64dd17'
12255
- };
12256
- var lightGreen$1 = lightGreen;
12257
-
12258
- const lime = {
12259
- 50: '#f9fbe7',
12260
- 100: '#f0f4c3',
12261
- 200: '#e6ee9c',
12262
- 300: '#dce775',
12263
- 400: '#d4e157',
12264
- 500: '#cddc39',
12265
- 600: '#c0ca33',
12266
- 700: '#afb42b',
12267
- 800: '#9e9d24',
12268
- 900: '#827717',
12269
- A100: '#f4ff81',
12270
- A200: '#eeff41',
12271
- A400: '#c6ff00',
12272
- A700: '#aeea00'
12273
- };
12274
- var lime$1 = lime;
12275
-
12276
- const yellow = {
12277
- 50: '#fffde7',
12278
- 100: '#fff9c4',
12279
- 200: '#fff59d',
12280
- 300: '#fff176',
12281
- 400: '#ffee58',
12282
- 500: '#ffeb3b',
12283
- 600: '#fdd835',
12284
- 700: '#fbc02d',
12285
- 800: '#f9a825',
12286
- 900: '#f57f17',
12287
- A100: '#ffff8d',
12288
- A200: '#ffff00',
12289
- A400: '#ffea00',
12290
- A700: '#ffd600'
12291
- };
12292
- var yellow$1 = yellow;
12293
-
12294
- const amber = {
12295
- 50: '#fff8e1',
12296
- 100: '#ffecb3',
12297
- 200: '#ffe082',
12298
- 300: '#ffd54f',
12299
- 400: '#ffca28',
12300
- 500: '#ffc107',
12301
- 600: '#ffb300',
12302
- 700: '#ffa000',
12303
- 800: '#ff8f00',
12304
- 900: '#ff6f00',
12305
- A100: '#ffe57f',
12306
- A200: '#ffd740',
12307
- A400: '#ffc400',
12308
- A700: '#ffab00'
12309
- };
12310
- var amber$1 = amber;
12311
-
12312
- const deepOrange = {
12313
- 50: '#fbe9e7',
12314
- 100: '#ffccbc',
12315
- 200: '#ffab91',
12316
- 300: '#ff8a65',
12317
- 400: '#ff7043',
12318
- 500: '#ff5722',
12319
- 600: '#f4511e',
12320
- 700: '#e64a19',
12321
- 800: '#d84315',
12322
- 900: '#bf360c',
12323
- A100: '#ff9e80',
12324
- A200: '#ff6e40',
12325
- A400: '#ff3d00',
12326
- A700: '#dd2c00'
12327
- };
12328
- var deepOrange$1 = deepOrange;
12329
-
12330
- const brown = {
12331
- 50: '#efebe9',
12332
- 100: '#d7ccc8',
12333
- 200: '#bcaaa4',
12334
- 300: '#a1887f',
12335
- 400: '#8d6e63',
12336
- 500: '#795548',
12337
- 600: '#6d4c41',
12338
- 700: '#5d4037',
12339
- 800: '#4e342e',
12340
- 900: '#3e2723',
12341
- A100: '#d7ccc8',
12342
- A200: '#bcaaa4',
12343
- A400: '#8d6e63',
12344
- A700: '#5d4037'
12345
- };
12346
- var brown$1 = brown;
12347
-
12348
- const blueGrey = {
12349
- 50: '#eceff1',
12350
- 100: '#cfd8dc',
12351
- 200: '#b0bec5',
12352
- 300: '#90a4ae',
12353
- 400: '#78909c',
12354
- 500: '#607d8b',
12355
- 600: '#546e7a',
12356
- 700: '#455a64',
12357
- 800: '#37474f',
12358
- 900: '#263238',
12359
- A100: '#cfd8dc',
12360
- A200: '#b0bec5',
12361
- A400: '#78909c',
12362
- A700: '#455a64'
12363
- };
12364
- var blueGrey$1 = blueGrey;
12365
-
12366
- var namedColors = /*#__PURE__*/Object.freeze({
12367
- __proto__: null,
12368
- amber: amber$1,
12369
- blue: blue$1,
12370
- blueGrey: blueGrey$1,
12371
- brown: brown$1,
12372
- common: common$1,
12373
- cyan: cyan$1,
12374
- deepOrange: deepOrange$1,
12375
- deepPurple: deepPurple$1,
12376
- green: green$1,
12377
- grey: grey$1,
12378
- indigo: indigo$1,
12379
- lightBlue: lightBlue$1,
12380
- lightGreen: lightGreen$1,
12381
- lime: lime$1,
12382
- orange: orange$1,
12383
- pink: pink$1,
12384
- purple: purple$1,
12385
- red: red$1,
12386
- teal: teal$1,
12387
- yellow: yellow$1
12388
- });
12389
-
12390
12152
  function getSvgIconUtilityClass(slot) {
12391
12153
  return generateUtilityClass('MuiSvgIcon', slot);
12392
12154
  }
@@ -13025,7 +12787,7 @@
13025
12787
  if (!getSlotProps) {
13026
12788
  // The simpler case - getSlotProps is not defined, so no internal event handlers are defined,
13027
12789
  // so we can simply merge all the props without having to worry about extracting event handlers.
13028
- const joinedClasses = clsx(externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className, className, additionalProps == null ? void 0 : additionalProps.className);
12790
+ const joinedClasses = clsx(additionalProps == null ? void 0 : additionalProps.className, className, externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className);
13029
12791
  const mergedStyle = _extends({}, additionalProps == null ? void 0 : additionalProps.style, externalForwardedProps == null ? void 0 : externalForwardedProps.style, externalSlotProps == null ? void 0 : externalSlotProps.style);
13030
12792
  const props = _extends({}, additionalProps, externalForwardedProps, externalSlotProps);
13031
12793
  if (joinedClasses.length > 0) {
@@ -13566,7 +13328,7 @@
13566
13328
 
13567
13329
  var max = Math.max;
13568
13330
  var min = Math.min;
13569
- var round$1 = Math.round;
13331
+ var round$2 = Math.round;
13570
13332
 
13571
13333
  function getUAString() {
13572
13334
  var uaData = navigator.userAgentData;
@@ -13598,8 +13360,8 @@
13598
13360
  var scaleY = 1;
13599
13361
 
13600
13362
  if (includeScale && isHTMLElement$1(element)) {
13601
- scaleX = element.offsetWidth > 0 ? round$1(clientRect.width) / element.offsetWidth || 1 : 1;
13602
- scaleY = element.offsetHeight > 0 ? round$1(clientRect.height) / element.offsetHeight || 1 : 1;
13363
+ scaleX = element.offsetWidth > 0 ? round$2(clientRect.width) / element.offsetWidth || 1 : 1;
13364
+ scaleY = element.offsetHeight > 0 ? round$2(clientRect.height) / element.offsetHeight || 1 : 1;
13603
13365
  }
13604
13366
 
13605
13367
  var _ref = isElement(element) ? getWindow(element) : window,
@@ -13894,8 +13656,8 @@
13894
13656
  y = _ref.y;
13895
13657
  var dpr = win.devicePixelRatio || 1;
13896
13658
  return {
13897
- x: round$1(x * dpr) / dpr || 0,
13898
- y: round$1(y * dpr) / dpr || 0
13659
+ x: round$2(x * dpr) / dpr || 0,
13660
+ y: round$2(y * dpr) / dpr || 0
13899
13661
  };
13900
13662
  }
13901
13663
 
@@ -14884,8 +14646,8 @@
14884
14646
 
14885
14647
  function isElementScaled(element) {
14886
14648
  var rect = element.getBoundingClientRect();
14887
- var scaleX = round$1(rect.width) / element.offsetWidth || 1;
14888
- var scaleY = round$1(rect.height) / element.offsetHeight || 1;
14649
+ var scaleX = round$2(rect.width) / element.offsetWidth || 1;
14650
+ var scaleY = round$2(rect.height) / element.offsetHeight || 1;
14889
14651
  return scaleX !== 1 || scaleY !== 1;
14890
14652
  } // Returns the composite rect of an element relative to its offsetParent.
14891
14653
  // Composite means it takes into account transforms as well as layout.
@@ -17162,7 +16924,9 @@
17162
16924
  }, ownerState.edge === 'end' && {
17163
16925
  marginRight: ownerState.size === 'small' ? -3 : -12
17164
16926
  }));
17165
- const SwitchBaseInput = styled$1('input')({
16927
+ const SwitchBaseInput = styled$1('input', {
16928
+ shouldForwardProp: rootShouldForwardProp
16929
+ })({
17166
16930
  cursor: 'inherit',
17167
16931
  position: 'absolute',
17168
16932
  opacity: 0,
@@ -17327,7 +17091,7 @@
17327
17091
  const {
17328
17092
  ownerState
17329
17093
  } = props;
17330
- return [styles.root, ownerState.indeterminate && styles.indeterminate, ownerState.color !== 'default' && styles[`color${capitalize(ownerState.color)}`]];
17094
+ return [styles.root, ownerState.indeterminate && styles.indeterminate, styles[`size${capitalize(ownerState.size)}`], ownerState.color !== 'default' && styles[`color${capitalize(ownerState.color)}`]];
17331
17095
  }
17332
17096
  })(({
17333
17097
  theme,
@@ -20088,7 +19852,9 @@
20088
19852
 
20089
19853
  var _span;
20090
19854
  const _excluded$8 = ["children", "classes", "className", "label", "notched"];
20091
- const NotchedOutlineRoot$1 = styled$1('fieldset')({
19855
+ const NotchedOutlineRoot$1 = styled$1('fieldset', {
19856
+ shouldForwardProp: rootShouldForwardProp
19857
+ })({
20092
19858
  textAlign: 'left',
20093
19859
  position: 'absolute',
20094
19860
  bottom: 0,
@@ -20104,7 +19870,9 @@
20104
19870
  overflow: 'hidden',
20105
19871
  minWidth: '0%'
20106
19872
  });
20107
- const NotchedOutlineLegend = styled$1('legend')(({
19873
+ const NotchedOutlineLegend = styled$1('legend', {
19874
+ shouldForwardProp: rootShouldForwardProp
19875
+ })(({
20108
19876
  ownerState,
20109
19877
  theme
20110
19878
  }) => _extends$5({
@@ -20360,7 +20128,9 @@
20360
20128
  d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
20361
20129
  }), 'RadioButtonChecked');
20362
20130
 
20363
- const RadioButtonIconRoot = styled$1('span')({
20131
+ const RadioButtonIconRoot = styled$1('span', {
20132
+ shouldForwardProp: rootShouldForwardProp
20133
+ })({
20364
20134
  position: 'relative',
20365
20135
  display: 'flex'
20366
20136
  });
@@ -20450,7 +20220,7 @@
20450
20220
  const {
20451
20221
  ownerState
20452
20222
  } = props;
20453
- return [styles.root, styles[`color${capitalize(ownerState.color)}`]];
20223
+ return [styles.root, ownerState.size !== 'medium' && styles[`size${capitalize(ownerState.size)}`], styles[`color${capitalize(ownerState.color)}`]];
20454
20224
  }
20455
20225
  })(({
20456
20226
  theme,
@@ -20546,7 +20316,7 @@
20546
20316
  var tooltipClasses$1 = tooltipClasses;
20547
20317
 
20548
20318
  const _excluded$5 = ["arrow", "children", "classes", "components", "componentsProps", "describeChild", "disableFocusListener", "disableHoverListener", "disableInteractive", "disableTouchListener", "enterDelay", "enterNextDelay", "enterTouchDelay", "followCursor", "id", "leaveDelay", "leaveTouchDelay", "onClose", "onOpen", "open", "placement", "PopperComponent", "PopperProps", "slotProps", "slots", "title", "TransitionComponent", "TransitionProps"];
20549
- function round(value) {
20319
+ function round$1(value) {
20550
20320
  return Math.round(value * 1e5) / 1e5;
20551
20321
  }
20552
20322
  const useUtilityClasses = ownerState => {
@@ -20655,7 +20425,7 @@
20655
20425
  }, ownerState.touch && {
20656
20426
  padding: '8px 16px',
20657
20427
  fontSize: theme.typography.pxToRem(14),
20658
- lineHeight: `${round(16 / 14)}em`,
20428
+ lineHeight: `${round$1(16 / 14)}em`,
20659
20429
  fontWeight: theme.typography.fontWeightRegular
20660
20430
  }, {
20661
20431
  [`.${tooltipClasses$1.popper}[data-popper-placement*="left"] &`]: _extends$5({
@@ -27589,57 +27359,1614 @@
27589
27359
  return totalCounts > 0;
27590
27360
  }
27591
27361
 
27592
- const LIGHT = '#FFF';
27593
- const DARK = '#000';
27594
- const TRANSPARENT = 'rgba(255, 255, 255, 0)';
27362
+ const colorStruct = {
27363
+ aliceblue: {
27364
+ r: 240,
27365
+ g: 248,
27366
+ b: 255
27367
+ },
27368
+ antiquewhite: {
27369
+ r: 250,
27370
+ g: 235,
27371
+ b: 215
27372
+ },
27373
+ aqua: {
27374
+ r: 0,
27375
+ g: 255,
27376
+ b: 255
27377
+ },
27378
+ aquamarine: {
27379
+ r: 127,
27380
+ g: 255,
27381
+ b: 212
27382
+ },
27383
+ azure: {
27384
+ r: 240,
27385
+ g: 255,
27386
+ b: 255
27387
+ },
27388
+ beige: {
27389
+ r: 245,
27390
+ g: 245,
27391
+ b: 220
27392
+ },
27393
+ bisque: {
27394
+ r: 255,
27395
+ g: 228,
27396
+ b: 196
27397
+ },
27398
+ black: {
27399
+ r: 0,
27400
+ g: 0,
27401
+ b: 0
27402
+ },
27403
+ blanchedalmond: {
27404
+ r: 255,
27405
+ g: 235,
27406
+ b: 205
27407
+ },
27408
+ blue: {
27409
+ r: 0,
27410
+ g: 0,
27411
+ b: 255
27412
+ },
27413
+ blueviolet: {
27414
+ r: 138,
27415
+ g: 43,
27416
+ b: 226
27417
+ },
27418
+ brown: {
27419
+ r: 165,
27420
+ g: 42,
27421
+ b: 42
27422
+ },
27423
+ burlywood: {
27424
+ r: 222,
27425
+ g: 184,
27426
+ b: 135
27427
+ },
27428
+ cadetblue: {
27429
+ r: 95,
27430
+ g: 158,
27431
+ b: 160
27432
+ },
27433
+ chartreuse: {
27434
+ r: 127,
27435
+ g: 255,
27436
+ b: 0
27437
+ },
27438
+ chocolate: {
27439
+ r: 210,
27440
+ g: 105,
27441
+ b: 30
27442
+ },
27443
+ coral: {
27444
+ r: 255,
27445
+ g: 127,
27446
+ b: 80
27447
+ },
27448
+ cornflowerblue: {
27449
+ r: 100,
27450
+ g: 149,
27451
+ b: 237
27452
+ },
27453
+ cornsilk: {
27454
+ r: 255,
27455
+ g: 248,
27456
+ b: 220
27457
+ },
27458
+ crimson: {
27459
+ r: 220,
27460
+ g: 20,
27461
+ b: 60
27462
+ },
27463
+ cyan: {
27464
+ r: 0,
27465
+ g: 255,
27466
+ b: 255
27467
+ },
27468
+ darkblue: {
27469
+ r: 0,
27470
+ g: 0,
27471
+ b: 139
27472
+ },
27473
+ darkcyan: {
27474
+ r: 0,
27475
+ g: 139,
27476
+ b: 139
27477
+ },
27478
+ darkgoldenrod: {
27479
+ r: 184,
27480
+ g: 134,
27481
+ b: 11
27482
+ },
27483
+ darkgray: {
27484
+ r: 169,
27485
+ g: 169,
27486
+ b: 169
27487
+ },
27488
+ darkgreen: {
27489
+ r: 0,
27490
+ g: 100,
27491
+ b: 0
27492
+ },
27493
+ darkgrey: {
27494
+ r: 169,
27495
+ g: 169,
27496
+ b: 169
27497
+ },
27498
+ darkkhaki: {
27499
+ r: 189,
27500
+ g: 183,
27501
+ b: 107
27502
+ },
27503
+ darkmagenta: {
27504
+ r: 139,
27505
+ g: 0,
27506
+ b: 139
27507
+ },
27508
+ darkolivegreen: {
27509
+ r: 85,
27510
+ g: 107,
27511
+ b: 47
27512
+ },
27513
+ darkorange: {
27514
+ r: 255,
27515
+ g: 140,
27516
+ b: 0
27517
+ },
27518
+ darkorchid: {
27519
+ r: 153,
27520
+ g: 50,
27521
+ b: 204
27522
+ },
27523
+ darkred: {
27524
+ r: 139,
27525
+ g: 0,
27526
+ b: 0
27527
+ },
27528
+ darksalmon: {
27529
+ r: 233,
27530
+ g: 150,
27531
+ b: 122
27532
+ },
27533
+ darkseagreen: {
27534
+ r: 143,
27535
+ g: 188,
27536
+ b: 143
27537
+ },
27538
+ darkslateblue: {
27539
+ r: 72,
27540
+ g: 61,
27541
+ b: 139
27542
+ },
27543
+ darkslategray: {
27544
+ r: 47,
27545
+ g: 79,
27546
+ b: 79
27547
+ },
27548
+ darkslategrey: {
27549
+ r: 47,
27550
+ g: 79,
27551
+ b: 79
27552
+ },
27553
+ darkturquoise: {
27554
+ r: 0,
27555
+ g: 206,
27556
+ b: 209
27557
+ },
27558
+ darkviolet: {
27559
+ r: 148,
27560
+ g: 0,
27561
+ b: 211
27562
+ },
27563
+ deeppink: {
27564
+ r: 255,
27565
+ g: 20,
27566
+ b: 147
27567
+ },
27568
+ deepskyblue: {
27569
+ r: 0,
27570
+ g: 191,
27571
+ b: 255
27572
+ },
27573
+ dimgray: {
27574
+ r: 105,
27575
+ g: 105,
27576
+ b: 105
27577
+ },
27578
+ dimgrey: {
27579
+ r: 105,
27580
+ g: 105,
27581
+ b: 105
27582
+ },
27583
+ dodgerblue: {
27584
+ r: 30,
27585
+ g: 144,
27586
+ b: 255
27587
+ },
27588
+ firebrick: {
27589
+ r: 178,
27590
+ g: 34,
27591
+ b: 34
27592
+ },
27593
+ floralwhite: {
27594
+ r: 255,
27595
+ g: 250,
27596
+ b: 240
27597
+ },
27598
+ forestgreen: {
27599
+ r: 34,
27600
+ g: 139,
27601
+ b: 34
27602
+ },
27603
+ fuchsia: {
27604
+ r: 255,
27605
+ g: 0,
27606
+ b: 255
27607
+ },
27608
+ gainsboro: {
27609
+ r: 220,
27610
+ g: 220,
27611
+ b: 220
27612
+ },
27613
+ ghostwhite: {
27614
+ r: 248,
27615
+ g: 248,
27616
+ b: 255
27617
+ },
27618
+ gold: {
27619
+ r: 255,
27620
+ g: 215,
27621
+ b: 0
27622
+ },
27623
+ goldenrod: {
27624
+ r: 218,
27625
+ g: 165,
27626
+ b: 32
27627
+ },
27628
+ gray: {
27629
+ r: 128,
27630
+ g: 128,
27631
+ b: 128
27632
+ },
27633
+ green: {
27634
+ r: 0,
27635
+ g: 128,
27636
+ b: 0
27637
+ },
27638
+ greenyellow: {
27639
+ r: 173,
27640
+ g: 255,
27641
+ b: 47
27642
+ },
27643
+ grey: {
27644
+ r: 128,
27645
+ g: 128,
27646
+ b: 128
27647
+ },
27648
+ honeydew: {
27649
+ r: 240,
27650
+ g: 255,
27651
+ b: 240
27652
+ },
27653
+ hotpink: {
27654
+ r: 255,
27655
+ g: 105,
27656
+ b: 180
27657
+ },
27658
+ indianred: {
27659
+ r: 205,
27660
+ g: 92,
27661
+ b: 92
27662
+ },
27663
+ indigo: {
27664
+ r: 75,
27665
+ g: 0,
27666
+ b: 130
27667
+ },
27668
+ ivory: {
27669
+ r: 255,
27670
+ g: 255,
27671
+ b: 240
27672
+ },
27673
+ khaki: {
27674
+ r: 240,
27675
+ g: 230,
27676
+ b: 140
27677
+ },
27678
+ lavender: {
27679
+ r: 230,
27680
+ g: 230,
27681
+ b: 250
27682
+ },
27683
+ lavenderblush: {
27684
+ r: 255,
27685
+ g: 240,
27686
+ b: 245
27687
+ },
27688
+ lawngreen: {
27689
+ r: 124,
27690
+ g: 252,
27691
+ b: 0
27692
+ },
27693
+ lemonchiffon: {
27694
+ r: 255,
27695
+ g: 250,
27696
+ b: 205
27697
+ },
27698
+ lightblue: {
27699
+ r: 173,
27700
+ g: 216,
27701
+ b: 230
27702
+ },
27703
+ lightcoral: {
27704
+ r: 240,
27705
+ g: 128,
27706
+ b: 128
27707
+ },
27708
+ lightcyan: {
27709
+ r: 224,
27710
+ g: 255,
27711
+ b: 255
27712
+ },
27713
+ lightgoldenrodyellow: {
27714
+ r: 250,
27715
+ g: 250,
27716
+ b: 210
27717
+ },
27718
+ lightgray: {
27719
+ r: 211,
27720
+ g: 211,
27721
+ b: 211
27722
+ },
27723
+ lightgreen: {
27724
+ r: 144,
27725
+ g: 238,
27726
+ b: 144
27727
+ },
27728
+ lightgrey: {
27729
+ r: 211,
27730
+ g: 211,
27731
+ b: 211
27732
+ },
27733
+ lightpink: {
27734
+ r: 255,
27735
+ g: 182,
27736
+ b: 193
27737
+ },
27738
+ lightsalmon: {
27739
+ r: 255,
27740
+ g: 160,
27741
+ b: 122
27742
+ },
27743
+ lightseagreen: {
27744
+ r: 32,
27745
+ g: 178,
27746
+ b: 170
27747
+ },
27748
+ lightskyblue: {
27749
+ r: 135,
27750
+ g: 206,
27751
+ b: 250
27752
+ },
27753
+ lightslategray: {
27754
+ r: 119,
27755
+ g: 136,
27756
+ b: 153
27757
+ },
27758
+ lightslategrey: {
27759
+ r: 119,
27760
+ g: 136,
27761
+ b: 153
27762
+ },
27763
+ lightsteelblue: {
27764
+ r: 176,
27765
+ g: 196,
27766
+ b: 222
27767
+ },
27768
+ lightyellow: {
27769
+ r: 255,
27770
+ g: 255,
27771
+ b: 224
27772
+ },
27773
+ lime: {
27774
+ r: 0,
27775
+ g: 255,
27776
+ b: 0
27777
+ },
27778
+ limegreen: {
27779
+ r: 50,
27780
+ g: 205,
27781
+ b: 50
27782
+ },
27783
+ linen: {
27784
+ r: 250,
27785
+ g: 240,
27786
+ b: 230
27787
+ },
27788
+ magenta: {
27789
+ r: 255,
27790
+ g: 0,
27791
+ b: 255
27792
+ },
27793
+ maroon: {
27794
+ r: 128,
27795
+ g: 0,
27796
+ b: 0
27797
+ },
27798
+ mediumaquamarine: {
27799
+ r: 102,
27800
+ g: 205,
27801
+ b: 170
27802
+ },
27803
+ mediumblue: {
27804
+ r: 0,
27805
+ g: 0,
27806
+ b: 205
27807
+ },
27808
+ mediumorchid: {
27809
+ r: 186,
27810
+ g: 85,
27811
+ b: 211
27812
+ },
27813
+ mediumpurple: {
27814
+ r: 147,
27815
+ g: 112,
27816
+ b: 219
27817
+ },
27818
+ mediumseagreen: {
27819
+ r: 60,
27820
+ g: 179,
27821
+ b: 113
27822
+ },
27823
+ mediumslateblue: {
27824
+ r: 123,
27825
+ g: 104,
27826
+ b: 238
27827
+ },
27828
+ mediumspringgreen: {
27829
+ r: 0,
27830
+ g: 250,
27831
+ b: 154
27832
+ },
27833
+ mediumturquoise: {
27834
+ r: 72,
27835
+ g: 209,
27836
+ b: 204
27837
+ },
27838
+ mediumvioletred: {
27839
+ r: 199,
27840
+ g: 21,
27841
+ b: 133
27842
+ },
27843
+ midnightblue: {
27844
+ r: 25,
27845
+ g: 25,
27846
+ b: 112
27847
+ },
27848
+ mintcream: {
27849
+ r: 245,
27850
+ g: 255,
27851
+ b: 250
27852
+ },
27853
+ mistyrose: {
27854
+ r: 255,
27855
+ g: 228,
27856
+ b: 225
27857
+ },
27858
+ moccasin: {
27859
+ r: 255,
27860
+ g: 228,
27861
+ b: 181
27862
+ },
27863
+ navajowhite: {
27864
+ r: 255,
27865
+ g: 222,
27866
+ b: 173
27867
+ },
27868
+ navy: {
27869
+ r: 0,
27870
+ g: 0,
27871
+ b: 128
27872
+ },
27873
+ oldlace: {
27874
+ r: 253,
27875
+ g: 245,
27876
+ b: 230
27877
+ },
27878
+ olive: {
27879
+ r: 128,
27880
+ g: 128,
27881
+ b: 0
27882
+ },
27883
+ olivedrab: {
27884
+ r: 107,
27885
+ g: 142,
27886
+ b: 35
27887
+ },
27888
+ orange: {
27889
+ r: 255,
27890
+ g: 165,
27891
+ b: 0
27892
+ },
27893
+ orangered: {
27894
+ r: 255,
27895
+ g: 69,
27896
+ b: 0
27897
+ },
27898
+ orchid: {
27899
+ r: 218,
27900
+ g: 112,
27901
+ b: 214
27902
+ },
27903
+ palegoldenrod: {
27904
+ r: 238,
27905
+ g: 232,
27906
+ b: 170
27907
+ },
27908
+ palegreen: {
27909
+ r: 152,
27910
+ g: 251,
27911
+ b: 152
27912
+ },
27913
+ paleturquoise: {
27914
+ r: 175,
27915
+ g: 238,
27916
+ b: 238
27917
+ },
27918
+ palevioletred: {
27919
+ r: 219,
27920
+ g: 112,
27921
+ b: 147
27922
+ },
27923
+ papayawhip: {
27924
+ r: 255,
27925
+ g: 239,
27926
+ b: 213
27927
+ },
27928
+ peachpuff: {
27929
+ r: 255,
27930
+ g: 218,
27931
+ b: 185
27932
+ },
27933
+ peru: {
27934
+ r: 205,
27935
+ g: 133,
27936
+ b: 63
27937
+ },
27938
+ pink: {
27939
+ r: 255,
27940
+ g: 192,
27941
+ b: 203
27942
+ },
27943
+ plum: {
27944
+ r: 221,
27945
+ g: 160,
27946
+ b: 221
27947
+ },
27948
+ powderblue: {
27949
+ r: 176,
27950
+ g: 224,
27951
+ b: 230
27952
+ },
27953
+ purple: {
27954
+ r: 128,
27955
+ g: 0,
27956
+ b: 128
27957
+ },
27958
+ red: {
27959
+ r: 255,
27960
+ g: 0,
27961
+ b: 0
27962
+ },
27963
+ rosybrown: {
27964
+ r: 188,
27965
+ g: 143,
27966
+ b: 143
27967
+ },
27968
+ royalblue: {
27969
+ r: 65,
27970
+ g: 105,
27971
+ b: 225
27972
+ },
27973
+ saddlebrown: {
27974
+ r: 139,
27975
+ g: 69,
27976
+ b: 19
27977
+ },
27978
+ salmon: {
27979
+ r: 250,
27980
+ g: 128,
27981
+ b: 114
27982
+ },
27983
+ sandybrown: {
27984
+ r: 244,
27985
+ g: 164,
27986
+ b: 96
27987
+ },
27988
+ seagreen: {
27989
+ r: 46,
27990
+ g: 139,
27991
+ b: 87
27992
+ },
27993
+ seashell: {
27994
+ r: 255,
27995
+ g: 245,
27996
+ b: 238
27997
+ },
27998
+ sienna: {
27999
+ r: 160,
28000
+ g: 82,
28001
+ b: 45
28002
+ },
28003
+ silver: {
28004
+ r: 192,
28005
+ g: 192,
28006
+ b: 192
28007
+ },
28008
+ skyblue: {
28009
+ r: 135,
28010
+ g: 206,
28011
+ b: 235
28012
+ },
28013
+ slateblue: {
28014
+ r: 106,
28015
+ g: 90,
28016
+ b: 205
28017
+ },
28018
+ slategray: {
28019
+ r: 112,
28020
+ g: 128,
28021
+ b: 144
28022
+ },
28023
+ slategrey: {
28024
+ r: 112,
28025
+ g: 128,
28026
+ b: 144
28027
+ },
28028
+ snow: {
28029
+ r: 255,
28030
+ g: 250,
28031
+ b: 250
28032
+ },
28033
+ springgreen: {
28034
+ r: 0,
28035
+ g: 255,
28036
+ b: 127
28037
+ },
28038
+ steelblue: {
28039
+ r: 70,
28040
+ g: 130,
28041
+ b: 180
28042
+ },
28043
+ tan: {
28044
+ r: 210,
28045
+ g: 180,
28046
+ b: 140
28047
+ },
28048
+ teal: {
28049
+ r: 0,
28050
+ g: 128,
28051
+ b: 128
28052
+ },
28053
+ thistle: {
28054
+ r: 216,
28055
+ g: 191,
28056
+ b: 216
28057
+ },
28058
+ tomato: {
28059
+ r: 255,
28060
+ g: 99,
28061
+ b: 71
28062
+ },
28063
+ transparent: {
28064
+ r: 255,
28065
+ g: 255,
28066
+ b: 255,
28067
+ a: 0
28068
+ },
28069
+ turquoise: {
28070
+ r: 64,
28071
+ g: 224,
28072
+ b: 208
28073
+ },
28074
+ violet: {
28075
+ r: 238,
28076
+ g: 130,
28077
+ b: 238
28078
+ },
28079
+ wheat: {
28080
+ r: 245,
28081
+ g: 222,
28082
+ b: 179
28083
+ },
28084
+ white: {
28085
+ r: 255,
28086
+ g: 255,
28087
+ b: 255
28088
+ },
28089
+ whitesmoke: {
28090
+ r: 245,
28091
+ g: 245,
28092
+ b: 245
28093
+ },
28094
+ yellow: {
28095
+ r: 255,
28096
+ g: 255,
28097
+ b: 0
28098
+ },
28099
+ yellowgreen: {
28100
+ r: 154,
28101
+ g: 205,
28102
+ b: 50
28103
+ }
28104
+ };
28105
+
28106
+ /* eslint-disable no-param-reassign */
28107
+ /* eslint-disable camelcase */
28108
+ /* eslint-disable no-nested-ternary */
28109
+ /* eslint-disable no-cond-assign */
28110
+ /* eslint-disable prefer-destructuring */
28111
+ /* eslint-disable no-underscore-dangle */
28112
+
27595
28113
 
27596
28114
  /**
27597
- * If needed, converts a named color to a more reliable CSS color format.
27598
- *
27599
- * @param {string} c The CSS color.
27600
- * @returns {string} Converted color or same color as before.
28115
+ * Module which defines a color object
27601
28116
  * @private
28117
+ * @exports objects.views/charts/representation/color
28118
+ * @expose module:objects.views/charts/representation/color~Color
28119
+ */
28120
+
28121
+ // color formats
28122
+ const rgb = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i;
28123
+ const rgba = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d(\.\d+)?)\)$/i;
28124
+ const hex = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i;
28125
+ const hexShort = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i;
28126
+ const hsl = /^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i;
28127
+ const hsla = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i;
28128
+ const {
28129
+ floor
28130
+ } = Math;
28131
+ const {
28132
+ round
28133
+ } = Math;
28134
+
28135
+ /**
28136
+ * @class
28137
+ * @classdesc Class which provides color transformation functionality
28138
+ * @description This is a constructor.
28139
+ * @private This is a constructor.
28140
+ * @param {object} - Parameters to create a color from different notations
27602
28141
  * @example
27603
- * convertNamedColor('red') => '#FF0000'
28142
+ * // a few ways of instantiating a red color
28143
+ * var red;
28144
+ * red = new Color(255, 0, 0, 1); // rgba as parameters
28145
+ * red = new Color('#ff0000'); // hex
28146
+ * red = new Color('rgb(255,0,0)');//rgb as string
28147
+ * red = new Color('hsl(0, 100, 50)');// hsl as string
28148
+ * red = new Color(16711680);// uint
27604
28149
  */
27605
- function convertNamedColor(c) {
27606
- let out = c;
27607
- try {
27608
- if (c in namedColors) {
27609
- ({
27610
- 500: out
27611
- } = namedColors[c]); // 500 exposes the standard color
27612
- } else if (c === 'transparent') {
27613
- out = TRANSPARENT;
28150
+ class Color {
28151
+ constructor() {
28152
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28153
+ args[_key] = arguments[_key];
27614
28154
  }
27615
- } catch (err) {
27616
- out = c;
28155
+ let r = 0;
28156
+ let g = 0;
28157
+ let b = 0;
28158
+ let a = 1;
28159
+ let h;
28160
+ let s;
28161
+ let lcs;
28162
+ let l;
28163
+ let v;
28164
+ let c;
28165
+ let h_;
28166
+ let x;
28167
+ let rgb_;
28168
+ let m;
28169
+ let matches;
28170
+ let colorString;
28171
+ this._invalid = false;
28172
+ if (args[0] instanceof Color) {
28173
+ r = args[0]._r;
28174
+ g = args[0]._g;
28175
+ b = args[0]._b;
28176
+ a = args[0]._a;
28177
+ this._invalid = args[0]._invalid;
28178
+ } else if (args.length < 3) {
28179
+ if (typeof args[0] === 'string') {
28180
+ colorString = args[0];
28181
+ if (matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(colorString)) {
28182
+ r = parseInt(matches[1], 10);
28183
+ g = parseInt(matches[2], 10);
28184
+ b = parseInt(matches[3], 10);
28185
+ } else if (matches = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(colorString)) {
28186
+ // rgba(1, 2, 3, 0.4)
28187
+ r = parseInt(matches[1], 10);
28188
+ g = parseInt(matches[2], 10);
28189
+ b = parseInt(matches[3], 10);
28190
+ a = parseFloat(matches[4]);
28191
+ } else if (matches = /^ARGB\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(colorString)) {
28192
+ // ARGB(255,255,255,255)
28193
+ a = parseInt(matches[1], 10) / 255;
28194
+ r = parseInt(matches[2], 10);
28195
+ g = parseInt(matches[3], 10);
28196
+ b = parseInt(matches[4], 10);
28197
+ } else if (matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(colorString)) {
28198
+ // #aBc123
28199
+ r = parseInt(matches[1], 16);
28200
+ g = parseInt(matches[2], 16);
28201
+ b = parseInt(matches[3], 16);
28202
+ a = 1;
28203
+ } else if (matches = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i.exec(colorString)) {
28204
+ // #a5F
28205
+ r = parseInt(matches[1] + matches[1], 16);
28206
+ g = parseInt(matches[2] + matches[2], 16);
28207
+ b = parseInt(matches[3] + matches[3], 16);
28208
+ a = 1;
28209
+ } else if (matches = /^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(colorString)) {
28210
+ // hsl(1, 2, 3)
28211
+ h = parseFloat(matches[1]);
28212
+ s = parseFloat(matches[3]);
28213
+ l = parseFloat(matches[5]);
28214
+ h %= 360;
28215
+ s /= 100;
28216
+ l /= 100;
28217
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
28218
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
28219
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
28220
+ c = l <= 0.5 ? 2 * l * s : (2 - 2 * l) * s;
28221
+ h_ = h / 60;
28222
+ x = c * (1 - Math.abs(h_ % 2 - 1));
28223
+ rgb_ = [];
28224
+ h_ = Math.floor(h_);
28225
+ switch (h_) {
28226
+ case 0:
28227
+ rgb_ = [c, x, 0];
28228
+ break;
28229
+ case 1:
28230
+ rgb_ = [x, c, 0];
28231
+ break;
28232
+ case 2:
28233
+ rgb_ = [0, c, x];
28234
+ break;
28235
+ case 3:
28236
+ rgb_ = [0, x, c];
28237
+ break;
28238
+ case 4:
28239
+ rgb_ = [x, 0, c];
28240
+ break;
28241
+ case 5:
28242
+ rgb_ = [c, 0, x];
28243
+ break;
28244
+ default:
28245
+ rgb_ = [0, 0, 0];
28246
+ }
28247
+ m = l - 0.5 * c;
28248
+ r = rgb_[0] + m;
28249
+ g = rgb_[1] + m;
28250
+ b = rgb_[2] + m;
28251
+ r = round(255 * r);
28252
+ g = round(255 * g);
28253
+ b = round(255 * b);
28254
+ a = 1.0;
28255
+ } else if (matches = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i.exec(colorString)) {
28256
+ // hsla(1,2,3,0.4)
28257
+ h = parseFloat(matches[1]);
28258
+ s = parseFloat(matches[3]);
28259
+ l = parseFloat(matches[5]);
28260
+ a = parseFloat(matches[7]);
28261
+ h %= 360;
28262
+ s /= 100;
28263
+ l /= 100;
28264
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
28265
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
28266
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
28267
+ c = l <= 0.5 ? 2 * l * s : (2 - 2 * l) * s;
28268
+ h_ = h / 60;
28269
+ x = c * (1 - Math.abs(h_ % 2 - 1));
28270
+ rgb_ = [];
28271
+ h_ = Math.floor(h_);
28272
+ switch (h_) {
28273
+ case 0:
28274
+ rgb_ = [c, x, 0];
28275
+ break;
28276
+ case 1:
28277
+ rgb_ = [x, c, 0];
28278
+ break;
28279
+ case 2:
28280
+ rgb_ = [0, c, x];
28281
+ break;
28282
+ case 3:
28283
+ rgb_ = [0, x, c];
28284
+ break;
28285
+ case 4:
28286
+ rgb_ = [x, 0, c];
28287
+ break;
28288
+ case 5:
28289
+ rgb_ = [c, 0, x];
28290
+ break;
28291
+ default:
28292
+ rgb_ = [0, 0, 0];
28293
+ }
28294
+ m = l - 0.5 * c;
28295
+ r = rgb_[0] + m;
28296
+ g = rgb_[1] + m;
28297
+ b = rgb_[2] + m;
28298
+ r = round(255 * r);
28299
+ g = round(255 * g);
28300
+ b = round(255 * b);
28301
+ } else if (matches = /^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(colorString)) {
28302
+ // hsv(1, 2, 3) {
28303
+ h = parseFloat(matches[1]);
28304
+ s = parseFloat(matches[3]);
28305
+ v = parseFloat(matches[5]);
28306
+ h %= 360;
28307
+ s /= 100;
28308
+ v /= 100;
28309
+ h = h < 0 ? 0 : h > 360 ? 360 : h;
28310
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
28311
+ v = v < 0 ? 0 : v > 1 ? 1 : v;
28312
+ c = v * s;
28313
+ h_ = h / 60;
28314
+ x = c * (1 - Math.abs(h_ % 2 - 1));
28315
+ rgb_ = [];
28316
+ h_ = Math.floor(h_);
28317
+ switch (h_) {
28318
+ case 0:
28319
+ rgb_ = [c, x, 0];
28320
+ break;
28321
+ case 1:
28322
+ rgb_ = [x, c, 0];
28323
+ break;
28324
+ case 2:
28325
+ rgb_ = [0, c, x];
28326
+ break;
28327
+ case 3:
28328
+ rgb_ = [0, x, c];
28329
+ break;
28330
+ case 4:
28331
+ rgb_ = [x, 0, c];
28332
+ break;
28333
+ case 5:
28334
+ rgb_ = [c, 0, x];
28335
+ break;
28336
+ default:
28337
+ rgb_ = [0, 0, 0];
28338
+ }
28339
+ m = v - c;
28340
+ r = rgb_[0] + m;
28341
+ g = rgb_[1] + m;
28342
+ b = rgb_[2] + m;
28343
+ r = round(255 * r);
28344
+ g = round(255 * g);
28345
+ b = round(255 * b);
28346
+ a = 1.0;
28347
+ } else if (colorStruct[colorString.toLowerCase()]) {
28348
+ lcs = colorString.toLowerCase();
28349
+ r = colorStruct[lcs].r;
28350
+ g = colorStruct[lcs].g;
28351
+ b = colorStruct[lcs].b;
28352
+ a = typeof colorStruct[lcs].a === 'number' ? colorStruct[lcs].a : 1.0;
28353
+ } else {
28354
+ this._invalid = true;
28355
+ }
28356
+ } else if (typeof args[0] === 'number' && args[0] >= 0 && args[1] === 'argb') {
28357
+ a = (0xff000000 & args[0]) >>> 24;
28358
+ a /= 255;
28359
+ r = (0xff0000 & args[0]) >> 16;
28360
+ g = (0x00ff00 & args[0]) >> 8;
28361
+ b = 0x0000ff & args[0];
28362
+ } else if (typeof args[0] === 'number' && args[0] >= 0) {
28363
+ r = (0xff0000 & args[0]) >> 16;
28364
+ g = (0x00ff00 & args[0]) >> 8;
28365
+ b = 0x0000ff & args[0];
28366
+ } else {
28367
+ this._invalid = true;
28368
+ }
28369
+ } else if (args.length >= 3) {
28370
+ r = args[0];
28371
+ g = args[1];
28372
+ b = args[2];
28373
+ a = arguments.length >= 4 ? args[3] : 1;
28374
+ } else {
28375
+ this._invalid = true;
28376
+ }
28377
+ if (Number.isNaN(+r + g + b + a)) {
28378
+ this._invalid = true;
28379
+ }
28380
+ this._r = floor(r);
28381
+ this._g = floor(g);
28382
+ this._b = floor(b);
28383
+ this._a = a;
28384
+
28385
+ // object to cache string representations in various color spaces
28386
+ this._spaces = {};
28387
+ }
28388
+ isInvalid() {
28389
+ return this._invalid;
28390
+ }
28391
+
28392
+ /**
28393
+ * Sets alpha value of color
28394
+ * @private
28395
+ * @param {number} a - Alpha value of the color
28396
+ */
28397
+ setAlpha(a) {
28398
+ this._a = a;
28399
+ this._spaces = {};
28400
+ }
28401
+
28402
+ /**
28403
+ * Gets the alpha value of this color
28404
+ * @private
28405
+ * @returns {number}
28406
+ */
28407
+ getAlpha() {
28408
+ return this._a;
28409
+ }
28410
+
28411
+ /**
28412
+ * Returns an rgb string representation of this color.
28413
+ * @private
28414
+ * @return {string} An rgb string representation of this color
28415
+ */
28416
+ toRGB() {
28417
+ if (!this._spaces.rgb) {
28418
+ this._spaces.rgb = Color.toRGB(this);
28419
+ }
28420
+ return this._spaces.rgb;
28421
+ }
28422
+
28423
+ /**
28424
+ * Returns an rgba string representation of this color.
28425
+ * @private
28426
+ * @return {string} An rgba string representation of this color.
28427
+ */
28428
+ toRGBA() {
28429
+ if (!this._spaces.rgba) {
28430
+ this._spaces.rgba = Color.toRGBA(this);
28431
+ }
28432
+ return this._spaces.rgba;
28433
+ }
28434
+ toString() {
28435
+ if (!this._spaces.rgb) {
28436
+ this._spaces.rgb = Color.toRGB(this);
28437
+ }
28438
+ return this._spaces.rgb;
28439
+ }
28440
+
28441
+ /**
28442
+ * Returns a hex string representation of this color.
28443
+ * @private
28444
+ * @return {string}
28445
+ */
28446
+ toHex() {
28447
+ if (!this._spaces.hex) {
28448
+ this._spaces.hex = Color.toHex(this);
28449
+ }
28450
+ return this._spaces.hex;
28451
+ }
28452
+
28453
+ /**
28454
+ * Returns a hsl string representation of this color using "bi-hexcone" model for lightness
28455
+ * @private
28456
+ * @param {boolean} luma - Whether to use luma calculation
28457
+ * @return {string} In format hsl(0,0,0)
28458
+ */
28459
+ toHSL(luma) {
28460
+ if (!this._spaces.hsl) {
28461
+ this._spaces.hsl = Color.toHSL(this, luma);
28462
+ }
28463
+ return this._spaces.hsl;
28464
+ }
28465
+
28466
+ /**
28467
+ * Returns a hsla string representation of this color using "bi-hexcone" model for lightness
28468
+ * @private
28469
+ * @param {boolean} luma - Whether to use luma calculation
28470
+ * @return {string} In format hsla(0,0,0,0)
28471
+ */
28472
+ toHSLA(luma) {
28473
+ if (!this._spaces.hsla) {
28474
+ this._spaces.hsla = Color.toHSLA(this, luma);
28475
+ }
28476
+ return this._spaces.hsla;
28477
+ }
28478
+
28479
+ /**
28480
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
28481
+ * @private
28482
+ * @param {Color|string} c
28483
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
28484
+ */
28485
+ toHSV() {
28486
+ const hsvComp = this.toHSVComponents();
28487
+ return "hsv(".concat(hsvComp.h, ",").concat(hsvComp.s, ",").concat(hsvComp.v, ")");
28488
+ }
28489
+
28490
+ /**
28491
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
28492
+ * @private
28493
+ * @param {Color|string} c
28494
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
28495
+ */
28496
+ toHSVComponents() {
28497
+ if (!this._spaces.hsvComp) {
28498
+ this._spaces.hsvComp = Color.toHSVComponents(this);
28499
+ }
28500
+ return this._spaces.hsvComp;
28501
+ }
28502
+
28503
+ /**
28504
+ * Returns a uint representation of this color
28505
+ * @private
28506
+ * @return {number}
28507
+ */
28508
+ toNumber() {
28509
+ if (!this._spaces.num) {
28510
+ this._spaces.num = Color.toNumber(this);
28511
+ }
28512
+ return this._spaces.num;
28513
+ }
28514
+
28515
+ /**
28516
+ * Checks if this color is perceived as dark.
28517
+ * @private
28518
+ * @return {string} True if the luminance is below 160, false otherwise.
28519
+ */
28520
+ isDark() {
28521
+ return this.isInvalid() || this.getLuminance() < 125; // luminace calc option #2
28522
+ // return this.getLuminance() < 160; //luminace calc option #3
28523
+ }
28524
+
28525
+ /**
28526
+ * Calculates the perceived luminance of the color.
28527
+ * @private
28528
+ * @return {number} A value in the range 0-255 where a low value is considered dark and vice versa.
28529
+ */
28530
+ getLuminance() {
28531
+ // alpha channel is not considered
28532
+ if (typeof this._lumi === 'undefined') {
28533
+ // calculate luminance
28534
+ // this._lumi = 0.2126 * this._r + 0.7152 * this._g + 0.0722 * this._b; // option 1
28535
+ this._lumi = 0.299 * this._r + 0.587 * this._g + 0.114 * this._b; // option 2
28536
+ // this._lumi = Math.sqrt( 0.241 * this._r * this._r + 0.691 * this._g * this._g + 0.068 * this._b * this._b ); // option 3
28537
+ }
28538
+
28539
+ return this._lumi;
28540
+ }
28541
+
28542
+ /**
28543
+ * Shifts the color towards a lighter or darker shade
28544
+ * @private
28545
+ * @param {number} value - A value in the range -100-100 to shift the color with along the HSL lightness.
28546
+ * @return {string} The shifted color as hsla string.
28547
+ */
28548
+ shiftLuminance(value) {
28549
+ const chsla = this.toHSLA();
28550
+ const matches = /^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,(\d(\.\d+)?)\)$/i.exec(chsla);
28551
+ const h = parseFloat(matches[1]);
28552
+ const s = parseFloat(matches[3]);
28553
+ let l = parseFloat(matches[5]);
28554
+ const a = parseFloat(matches[7]);
28555
+ // l *= 1 + value / 100;
28556
+ // l = Math.max( 0, l % 100 );
28557
+ l += value;
28558
+ l = Math.max(0, Math.min(l, 100));
28559
+
28560
+ // if( value > 0 ){
28561
+ // s = s*0.2; //removing saturation to avoid the border from being too light
28562
+ // }
28563
+
28564
+ return "hsla(".concat(h, ",").concat(s, ",").concat(l, ",").concat(a, ")");
28565
+ }
28566
+
28567
+ /**
28568
+ * Compares two colors.
28569
+ * @private
28570
+ * @param {Color} c The color to compare with.
28571
+ * @return {boolean} True if the rgba channels are the same, false otherwise
28572
+ */
28573
+ isEqual(c) {
28574
+ if (c instanceof Color) {
28575
+ return this._r === c._r && this._g === c._g && this._b === c._b && this._a === c._a;
28576
+ }
28577
+ c = new Color(c);
28578
+ return this._r === c._r && this._g === c._g && this._b === c._b && this._a === c._a;
28579
+ }
28580
+
28581
+ /**
28582
+ * Linearly interpolates each channel of two colors.
28583
+ * @private
28584
+ * @param {Color} c2 The other color.
28585
+ * @param {number} t The interpolation value in the range (0-1).
28586
+ * @return {string} The blend as an rgb string.
28587
+ */
28588
+ blend(c2, t) {
28589
+ const r = floor(this._r + (c2._r - this._r) * t);
28590
+ const g = floor(this._g + (c2._g - this._g) * t);
28591
+ const b = floor(this._b + (c2._b - this._b) * t);
28592
+ const a = floor(this._a + (c2._a - this._a) * t);
28593
+ return "rgba(".concat([r, g, b, a].join(','), ")");
28594
+ }
28595
+ createShiftedColor(v) {
28596
+ if (v === undefined || Number.isNaN(+v)) {
28597
+ v = 1;
28598
+ }
28599
+ const lumi = this.getLuminance();
28600
+ const greenMultiplier = this._g < 126 ? 1 : 1 + this._g / 512;
28601
+ const hsla_string = this.shiftLuminance((lumi * greenMultiplier < 220 ? 0.8 + 4 * (1 / (lumi + 1)) : -(0.8 + 1 * (lumi / 255))) * 20 * v);
28602
+ return new Color(hsla_string);
28603
+ }
28604
+
28605
+ /**
28606
+ * Returns an rgb string representation of this color
28607
+ * @private
28608
+ * @param {Color|string} c
28609
+ * @returns {string} An rgb string with channel values within range 0-255.
28610
+ */
28611
+ static toRGB(c) {
28612
+ if (c instanceof Color) {
28613
+ return "rgb(".concat([c._r, c._g, c._b].join(','), ")");
28614
+ }
28615
+ if (typeof c === 'string') {
28616
+ c = Color.toNumber(c);
28617
+ }
28618
+ const r = (c & 0xff0000) >> 16;
28619
+ const g = (c & 0x00ff00) >> 8;
28620
+ const b = c & 0x0000ff;
28621
+ return "rgb(".concat(r, ",").concat(g, ",").concat(b, ")");
28622
+ }
28623
+
28624
+ /**
28625
+ *
28626
+ * @private
28627
+ * @param c
28628
+ * @param a
28629
+ * @returns {string} The color rgb format.
28630
+ */
28631
+ static toRGBA(c, a) {
28632
+ if (c instanceof Color) {
28633
+ return "rgba(".concat([c._r, c._g, c._b, typeof a !== 'undefined' ? a : c._a].join(','), ")");
28634
+ }
28635
+ if (typeof c === 'string') {
28636
+ c = Color.toNumber(c);
28637
+ }
28638
+ const r = (c & 0xff0000) >> 16;
28639
+ const g = (c & 0x00ff00) >> 8;
28640
+ const b = c & 0x0000ff;
28641
+ return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(typeof a !== 'undefined' ? a : c._a, ")");
28642
+ }
28643
+
28644
+ /**
28645
+ *
28646
+ * @private
28647
+ * @param {Color|string} c
28648
+ * @returns {string} The color in hexadecimal space.
28649
+ */
28650
+ static toHex(c) {
28651
+ let r;
28652
+ let g;
28653
+ let b;
28654
+ if (c instanceof Color) {
28655
+ r = c._r.toString(16);
28656
+ g = c._g.toString(16);
28657
+ b = c._b.toString(16);
28658
+ if (r.length === 1) {
28659
+ r = "0".concat(r);
28660
+ }
28661
+ if (g.length === 1) {
28662
+ g = "0".concat(g);
28663
+ }
28664
+ if (b.length === 1) {
28665
+ b = "0".concat(b);
28666
+ }
28667
+ return "#".concat([r, g, b].join(''));
28668
+ }
28669
+ if (typeof c === 'string') {
28670
+ c = Color.toNumber(c);
28671
+ }
28672
+ r = ((c & 0xff0000) >> 16).toString(16);
28673
+ g = ((c & 0x00ff00) >> 8).toString(16);
28674
+ b = (c & 0x0000ff).toString(16);
28675
+ if (r.length === 1) {
28676
+ r = "0".concat(r);
28677
+ }
28678
+ if (g.length === 1) {
28679
+ g = "0".concat(g);
28680
+ }
28681
+ if (b.length === 1) {
28682
+ b = "0".concat(b);
28683
+ }
28684
+ return "#".concat(r).concat(g).concat(b);
28685
+ }
28686
+
28687
+ /**
28688
+ * Return the color in hsl space using "bi-hexcone" model for lightness
28689
+ * @private
28690
+ * @param {Color|string} c
28691
+ * @param {boolean} luma - Whether to use luma calculation
28692
+ * @returns {string} The color in hsl space.
28693
+ */
28694
+ static toHSL(c, luma) {
28695
+ let h = 0;
28696
+ let s;
28697
+ let l;
28698
+ let ch;
28699
+ if (typeof c === 'string') {
28700
+ c = new Color(c);
28701
+ }
28702
+
28703
+ // red, green, blue, hue, saturation, lightness/luma, max, min, chroma
28704
+ const r = c._r / 255;
28705
+ const g = c._g / 255;
28706
+ const b = c._b / 255;
28707
+ const max = Math.max(r, g, b);
28708
+ const min = Math.min(r, g, b);
28709
+ if (luma) {
28710
+ // Y'709 http://en.wikipedia.org/wiki/Rec._709
28711
+ // Y′709 = 0.21R + 0.72G + 0.07B
28712
+ l = 0.21 * r + 0.72 * g + 0.07 * b;
28713
+ } else {
28714
+ l = (max + min) / 2;
28715
+ }
28716
+ if (max === min) {
28717
+ // greyscale
28718
+ s = 0;
28719
+ h = 0;
28720
+ } else {
28721
+ ch = max - min;
28722
+ s = l > 0.5 ? ch / (2 - max - min) : ch / (max + min);
28723
+ switch (max) {
28724
+ case r:
28725
+ h = (g - b) / ch + (g < b ? 6 : 0);
28726
+ break;
28727
+ case g:
28728
+ h = (b - r) / ch + 2;
28729
+ break;
28730
+ case b:
28731
+ h = (r - g) / ch + 4;
28732
+ break;
28733
+ }
28734
+ h /= 6;
28735
+ }
28736
+ return "hsl(".concat(h * 360, ",").concat(s * 100, ",").concat(l * 100, ")");
28737
+ }
28738
+
28739
+ /**
28740
+ * Return the color in hsla space using "bi-hexcone" model for lightness
28741
+ * @private
28742
+ * @param {Color|string} c
28743
+ * @param {boolean} luma - Whether to use luma calculation
28744
+ * @returns {string} The color in hsla space.
28745
+ */
28746
+ static toHSLA(c, luma) {
28747
+ let h = 0;
28748
+ let s;
28749
+ let l;
28750
+ let ch;
28751
+ if (typeof c === 'string') {
28752
+ c = new Color(c);
28753
+ }
28754
+
28755
+ // red, green, blue, hue, saturation, lightness/luma, max, min, chroma
28756
+ const r = c._r / 255;
28757
+ const g = c._g / 255;
28758
+ const b = c._b / 255;
28759
+ const a = c._a;
28760
+ const max = Math.max(r, g, b);
28761
+ const min = Math.min(r, g, b);
28762
+ if (luma) {
28763
+ // Y'709 http://en.wikipedia.org/wiki/Rec._709
28764
+ // Y′709 = 0.21R + 0.72G + 0.07B
28765
+ l = 0.21 * r + 0.72 * g + 0.07 * b;
28766
+ } else {
28767
+ l = (max + min) / 2;
28768
+ }
28769
+ if (max === min) {
28770
+ // greyscale
28771
+ s = 0;
28772
+ h = 0;
28773
+ } else {
28774
+ ch = max - min;
28775
+ s = l > 0.5 ? ch / (2 - max - min) : ch / (max + min);
28776
+ switch (max) {
28777
+ case r:
28778
+ h = (g - b) / ch + (g < b ? 6 : 0);
28779
+ break;
28780
+ case g:
28781
+ h = (b - r) / ch + 2;
28782
+ break;
28783
+ case b:
28784
+ h = (r - g) / ch + 4;
28785
+ break;
28786
+ }
28787
+ h /= 6;
28788
+ }
28789
+ return "hsla(".concat(h * 360, ",").concat(s * 100, ",").concat(l * 100, ",").concat(a, ")");
28790
+ }
28791
+
28792
+ /**
28793
+ * Return the color components in hsv space using "hexcone" model for value (lightness)
28794
+ * @private
28795
+ * @param {Color|string} c
28796
+ * @returns {object} The color components in hsv space {h:0-360, s:0-100, v:0-100}
28797
+ */
28798
+ static toHSVComponents(c) {
28799
+ let h = 0;
28800
+ let s;
28801
+ let ch;
28802
+ if (typeof c === 'string') {
28803
+ c = new Color(c);
28804
+ }
28805
+
28806
+ // red, green, blue, hue, saturation, value/luma, max, min, chroma
28807
+ const r = c._r / 255;
28808
+ const g = c._g / 255;
28809
+ const b = c._b / 255;
28810
+ const max = Math.max(r, g, b);
28811
+ const min = Math.min(r, g, b);
28812
+ const v = max;
28813
+ if (max === min) {
28814
+ // greyscale
28815
+ s = 0;
28816
+ h = 0;
28817
+ } else {
28818
+ ch = max - min;
28819
+ s = ch === 0 ? 0 : ch / v;
28820
+ switch (max) {
28821
+ case r:
28822
+ h = (g - b) / ch + (g < b ? 6 : 0);
28823
+ break;
28824
+ case g:
28825
+ h = (b - r) / ch + 2;
28826
+ break;
28827
+ case b:
28828
+ h = (r - g) / ch + 4;
28829
+ break;
28830
+ }
28831
+ h /= 6;
28832
+ }
28833
+ return {
28834
+ h: h * 360 % 360,
28835
+ s: s * 100,
28836
+ v: v * 100
28837
+ };
28838
+ }
28839
+
28840
+ /**
28841
+ * Returns an number representation of the color
28842
+ * @private
28843
+ * @param {Color|string} c
28844
+ * @returns {Number} Unsigned integer in the range 0-16 777 216
28845
+ */
28846
+ static toNumber() {
28847
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
28848
+ args[_key2] = arguments[_key2];
28849
+ }
28850
+ if (args.length === 1 && args[0] instanceof Color) {
28851
+ return (args[0]._r << 16) + (args[0]._g << 8) + args[0]._b;
28852
+ }
28853
+ let r = 0;
28854
+ let g = 0;
28855
+ let b = 0;
28856
+ let matches;
28857
+ let colorString;
28858
+ if (args.length === 1) {
28859
+ if (typeof args[0] === 'string') {
28860
+ colorString = args[0];
28861
+ if (matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i.exec(colorString)) {
28862
+ r = parseInt(matches[1], 10);
28863
+ g = parseInt(matches[2], 10);
28864
+ b = parseInt(matches[3], 10);
28865
+ } else if (matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(colorString)) {
28866
+ r = parseInt(matches[1], 16);
28867
+ g = parseInt(matches[2], 16);
28868
+ b = parseInt(matches[3], 16);
28869
+ } else if (matches = /^#([A-f0-9])([A-f0-9])([A-f0-9])$/i.exec(colorString)) {
28870
+ r = parseInt(matches[1] + matches[1], 16);
28871
+ g = parseInt(matches[2] + matches[2], 16);
28872
+ b = parseInt(matches[3] + matches[3], 16);
28873
+ }
28874
+ }
28875
+ }
28876
+ return (r << 16) + (g << 8) + b;
28877
+ }
28878
+ static blend(c1, c2, t) {
28879
+ c1 = Color.toNumber(c1);
28880
+ c2 = Color.toNumber(c2);
28881
+ const r1 = (c1 & 0xff0000) >> 16;
28882
+ const g1 = (c1 & 0x00ff00) >> 8;
28883
+ const b1 = c1 & 0x0000ff;
28884
+ const r2 = (c2 & 0xff0000) >> 16;
28885
+ const g2 = (c2 & 0x00ff00) >> 8;
28886
+ const b2 = c2 & 0x0000ff;
28887
+ const r = r1 + (r2 - r1) * t;
28888
+ const g = g1 + (g2 - g1) * t;
28889
+ const b = b1 + (b2 - b1) * t;
28890
+ return (r << 16) + (g << 8) + b;
28891
+ }
28892
+ static getBlend(c1, c2, t) {
28893
+ const r = c1._r + (c2._r - c1._r) * t;
28894
+ const g = c1._g + (c2._g - c1._g) * t;
28895
+ const b = c1._b + (c2._b - c1._b) * t;
28896
+ const a = c1._a + (c2._a - c1._a) * t;
28897
+ return new Color(r, g, b, a);
28898
+ }
28899
+ static isCSSColor(color) {
28900
+ if (arguments.length > 1 || typeof color !== 'string') {
28901
+ return false;
28902
+ }
28903
+ return rgb.test(color) || rgba.test(color) || hex.test(color) || hexShort.test(color) || hsl.test(color) || hsla.test(color) || colorStruct[color.toLowerCase()];
28904
+ }
28905
+ static getBestContrast(color, cl, cd) {
28906
+ const lum = color.getLuminance();
28907
+ return Math.abs(lum - cl.getLuminance()) > Math.abs(lum - cd.getLuminance()) ? cl : cd;
28908
+ }
28909
+ static getContrast(color1, color2) {
28910
+ if (!color1 || !color2) {
28911
+ return undefined;
28912
+ }
28913
+ const l1 = color1.getLuminance() / 100;
28914
+ const l2 = color2.getLuminance() / 100;
28915
+ if (l1 > l2) {
28916
+ return (l1 + 0.05) / (l2 + 0.05);
28917
+ }
28918
+ return (l2 + 0.05) / (l1 + 0.05);
28919
+ }
28920
+ static isDark() {
28921
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
28922
+ args[_key3] = arguments[_key3];
28923
+ }
28924
+ const C = new Color(...args);
28925
+ return C.isDark(...args);
28926
+ }
28927
+ static useDarkLabel(areaColor, bgIsDark) {
28928
+ return areaColor._a > 0.5 ? !areaColor.isDark() : !bgIsDark;
27617
28929
  }
27618
- return out;
27619
28930
  }
27620
- const hasEnoughContrast = (desiredTextColor, backgroundColor) => {
27621
- const desired = convertNamedColor(desiredTextColor);
27622
- const background = convertNamedColor(backgroundColor);
27623
- const CONTRAST_THRESHOLD = 3.0;
27624
- let isContrastingEnough;
28931
+
28932
+ const LIGHT = '#FFF';
28933
+ const DARK = '#000';
28934
+ const CONTRAST_THRESHOLD = 1.5;
28935
+ const LIGHT_PREFERRED_THRESHOLD = 3;
28936
+ const getContrast = (desired, background) => {
28937
+ let contrast = false;
28938
+ const des = new Color(desired);
28939
+ const bg = new Color(background);
28940
+ if (bg.isInvalid() || des.isInvalid() || bg.getAlpha() < 1 || des.getAlpha() < 1) {
28941
+ return undefined;
28942
+ }
27625
28943
  try {
27626
- isContrastingEnough = getContrastRatio(desired, background) > CONTRAST_THRESHOLD;
28944
+ contrast = Color.getContrast(des, bg);
27627
28945
  } catch (err) {
27628
- // The function throws on unsupported or misspelled colors.
27629
- // In these cases, simply return true.
27630
- isContrastingEnough = true;
28946
+ contrast = undefined;
27631
28947
  }
27632
- return isContrastingEnough;
28948
+ return contrast;
27633
28949
  };
27634
28950
  function getContrastingColor(backgroundColor) {
27635
28951
  let desiredTextColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
27636
28952
  let dark = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DARK;
27637
28953
  let light = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : LIGHT;
28954
+ const lightColor = new Color(light);
28955
+ const bg = new Color(backgroundColor);
28956
+ const des = new Color(desiredTextColor);
28957
+ if (bg.isInvalid() || des.isInvalid() || bg.getAlpha() < 1 || des.getAlpha() < 1) {
28958
+ return desiredTextColor;
28959
+ }
28960
+
28961
+ // Always prioritise light color if it gives better contrast than desired color's.
28962
+ const lightColorContrast = getContrast(lightColor, bg);
28963
+ const desiredColorContrast = getContrast(des, bg);
28964
+ const useLightColor = lightColorContrast > desiredColorContrast || lightColorContrast > LIGHT_PREFERRED_THRESHOLD;
27638
28965
  let contrastingColor;
27639
- if (desiredTextColor && hasEnoughContrast(desiredTextColor, backgroundColor)) {
28966
+ if (desiredTextColor && desiredColorContrast > CONTRAST_THRESHOLD && !useLightColor) {
27640
28967
  contrastingColor = desiredTextColor;
27641
28968
  } else {
27642
- contrastingColor = hasEnoughContrast(light, backgroundColor) ? light : dark;
28969
+ contrastingColor = useLightColor ? light : dark;
27643
28970
  }
27644
28971
  return contrastingColor;
27645
28972
  }
@@ -27658,7 +28985,8 @@
27658
28985
  }
27659
28986
  function getSelectionColors(theme, getListboxStyle, overrides) {
27660
28987
  var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections, _selectionColors$sele, _theme$palette2, _selectionColors$alte, _theme$palette3, _selectionColors$excl, _theme$palette4, _selectionColors$sele2, _theme$palette5, _selectionColors$poss, _theme$palette6, _theme$palette7, _theme$palette8, _theme$palette9, _theme$palette10, _theme$palette11;
27661
- const desiredTextColor = ((_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.fontColor) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.color) || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
28988
+ const componentContentTextColor = (_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.fontColor) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.color;
28989
+ const desiredTextColor = componentContentTextColor || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
27662
28990
  const useContrastTextColor = (_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true;
27663
28991
 
27664
28992
  // Background colors
@@ -27670,7 +28998,7 @@
27670
28998
  const possible = ((_selectionColors$poss = selectionColors.possible) === null || _selectionColors$poss === void 0 ? void 0 : _selectionColors$poss.color) || getListboxStyle('', 'backgroundColor') || ((_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.selected.possible) || '#FFFFFF';
27671
28999
 
27672
29000
  // Font colors
27673
- let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.main);
29001
+ let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.selectedContrastText);
27674
29002
  let alternativeContrast = desiredTextColor || ((_theme$palette8 = theme.palette) === null || _theme$palette8 === void 0 ? void 0 : _theme$palette8.selected.alternativeContrastText);
27675
29003
  let excludedContrast = desiredTextColor || ((_theme$palette9 = theme.palette) === null || _theme$palette9 === void 0 ? void 0 : _theme$palette9.selected.excludedContrastText);
27676
29004
  let selectedExcludedContrast = desiredTextColor || ((_theme$palette10 = theme.palette) === null || _theme$palette10 === void 0 ? void 0 : _theme$palette10.selected.selectedExcludedContrastText);