@zendeskgarden/react-theming 9.0.0-next.9 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/ThemeProvider.js +1 -4
- package/dist/esm/elements/theme/index.js +25 -11
- package/dist/esm/index.js +0 -1
- package/dist/esm/utils/arrowStyles.js +29 -40
- package/dist/esm/utils/getColor.js +117 -21
- package/dist/esm/utils/menuStyles.js +23 -16
- package/dist/index.cjs.js +334 -231
- package/dist/typings/elements/ThemeProvider.d.ts +1 -6
- package/dist/typings/index.d.ts +0 -1
- package/dist/typings/types/index.d.ts +2 -0
- package/dist/typings/utils/StyledBaseIcon.d.ts +1 -1
- package/dist/typings/utils/arrowStyles.d.ts +3 -16
- package/dist/typings/utils/getColor.d.ts +0 -1
- package/dist/typings/utils/getColorV8.d.ts +0 -1
- package/dist/typings/utils/menuStyles.d.ts +1 -1
- package/dist/typings/utils/useText.d.ts +1 -1
- package/package.json +6 -8
- package/LICENSE.md +0 -176
package/dist/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var styled = require('styled-components');
|
|
11
|
-
var
|
|
11
|
+
var color2k = require('color2k');
|
|
12
12
|
var polished = require('polished');
|
|
13
13
|
var get = require('lodash.get');
|
|
14
14
|
var memoize = require('lodash.memoize');
|
|
@@ -310,26 +310,27 @@ const colors = {
|
|
|
310
310
|
recessed: 'neutralHue.1200',
|
|
311
311
|
subtle: 'neutralHue.1000',
|
|
312
312
|
emphasis: 'neutralHue.600',
|
|
313
|
-
primary: 'primaryHue.900',
|
|
314
313
|
success: 'successHue.1000',
|
|
315
314
|
warning: 'warningHue.1000',
|
|
316
315
|
danger: 'dangerHue.1000',
|
|
317
316
|
primaryEmphasis: 'primaryHue.600',
|
|
318
317
|
successEmphasis: 'successHue.600',
|
|
319
318
|
warningEmphasis: 'warningHue.600',
|
|
320
|
-
dangerEmphasis: 'dangerHue.600'
|
|
319
|
+
dangerEmphasis: 'dangerHue.600',
|
|
320
|
+
disabled: 'rgba(neutralHue.500, 100)'
|
|
321
321
|
},
|
|
322
322
|
border: {
|
|
323
323
|
default: 'neutralHue.800',
|
|
324
324
|
emphasis: 'neutralHue.600',
|
|
325
325
|
subtle: 'neutralHue.900',
|
|
326
|
-
success: 'successHue.
|
|
327
|
-
warning: 'warningHue.
|
|
328
|
-
danger: 'dangerHue.
|
|
326
|
+
success: 'successHue.900',
|
|
327
|
+
warning: 'warningHue.900',
|
|
328
|
+
danger: 'dangerHue.900',
|
|
329
329
|
primaryEmphasis: 'primaryHue.600',
|
|
330
330
|
successEmphasis: 'successHue.600',
|
|
331
331
|
warningEmphasis: 'warningHue.600',
|
|
332
|
-
dangerEmphasis: 'dangerHue.600'
|
|
332
|
+
dangerEmphasis: 'dangerHue.600',
|
|
333
|
+
disabled: 'neutralHue.800'
|
|
333
334
|
},
|
|
334
335
|
foreground: {
|
|
335
336
|
default: 'neutralHue.300',
|
|
@@ -341,7 +342,13 @@ const colors = {
|
|
|
341
342
|
danger: 'dangerHue.400',
|
|
342
343
|
successEmphasis: 'successHue.300',
|
|
343
344
|
warningEmphasis: 'warningHue.300',
|
|
344
|
-
dangerEmphasis: 'dangerHue.300'
|
|
345
|
+
dangerEmphasis: 'dangerHue.300',
|
|
346
|
+
disabled: 'neutralHue.700'
|
|
347
|
+
},
|
|
348
|
+
shadow: {
|
|
349
|
+
small: 'rgba(neutralHue.1200, 1100)',
|
|
350
|
+
medium: 'rgba(neutralHue.1200, 800)',
|
|
351
|
+
large: 'rgba(neutralHue.1200, 1000)'
|
|
345
352
|
}
|
|
346
353
|
},
|
|
347
354
|
light: {
|
|
@@ -351,14 +358,14 @@ const colors = {
|
|
|
351
358
|
recessed: 'neutralHue.100',
|
|
352
359
|
subtle: 'neutralHue.100',
|
|
353
360
|
emphasis: 'neutralHue.700',
|
|
354
|
-
primary: 'primaryHue.100',
|
|
355
361
|
success: 'successHue.100',
|
|
356
362
|
warning: 'warningHue.100',
|
|
357
363
|
danger: 'dangerHue.100',
|
|
358
364
|
primaryEmphasis: 'primaryHue.700',
|
|
359
365
|
successEmphasis: 'successHue.700',
|
|
360
366
|
warningEmphasis: 'warningHue.700',
|
|
361
|
-
dangerEmphasis: 'dangerHue.700'
|
|
367
|
+
dangerEmphasis: 'dangerHue.700',
|
|
368
|
+
disabled: 'rgba(neutralHue.700, 100)'
|
|
362
369
|
},
|
|
363
370
|
border: {
|
|
364
371
|
default: 'neutralHue.300',
|
|
@@ -370,7 +377,8 @@ const colors = {
|
|
|
370
377
|
primaryEmphasis: 'primaryHue.700',
|
|
371
378
|
successEmphasis: 'successHue.700',
|
|
372
379
|
warningEmphasis: 'warningHue.700',
|
|
373
|
-
dangerEmphasis: 'dangerHue.700'
|
|
380
|
+
dangerEmphasis: 'dangerHue.700',
|
|
381
|
+
disabled: 'neutralHue.300'
|
|
374
382
|
},
|
|
375
383
|
foreground: {
|
|
376
384
|
default: 'neutralHue.900',
|
|
@@ -382,7 +390,13 @@ const colors = {
|
|
|
382
390
|
danger: 'dangerHue.700',
|
|
383
391
|
successEmphasis: 'successHue.900',
|
|
384
392
|
warningEmphasis: 'warningHue.900',
|
|
385
|
-
dangerEmphasis: 'dangerHue.900'
|
|
393
|
+
dangerEmphasis: 'dangerHue.900',
|
|
394
|
+
disabled: 'neutralHue.600'
|
|
395
|
+
},
|
|
396
|
+
shadow: {
|
|
397
|
+
small: 'rgba(neutralHue.1200, 200)',
|
|
398
|
+
medium: 'rgba(neutralHue.1200, 200)',
|
|
399
|
+
large: 'rgba(neutralHue.1200, 200)'
|
|
386
400
|
}
|
|
387
401
|
}
|
|
388
402
|
}
|
|
@@ -489,158 +503,13 @@ const DEFAULT_THEME = {
|
|
|
489
503
|
|
|
490
504
|
const ThemeProvider = _ref => {
|
|
491
505
|
let {
|
|
492
|
-
theme,
|
|
506
|
+
theme = DEFAULT_THEME,
|
|
493
507
|
...other
|
|
494
508
|
} = _ref;
|
|
495
509
|
return React__default.default.createElement(styled.ThemeProvider, Object.assign({
|
|
496
510
|
theme: theme
|
|
497
511
|
}, other));
|
|
498
512
|
};
|
|
499
|
-
ThemeProvider.defaultProps = {
|
|
500
|
-
theme: DEFAULT_THEME
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
const PALETTE_V8 = {
|
|
504
|
-
black: '#000',
|
|
505
|
-
white: '#fff',
|
|
506
|
-
product: {
|
|
507
|
-
support: '#00a656',
|
|
508
|
-
message: '#37b8af',
|
|
509
|
-
explore: '#30aabc',
|
|
510
|
-
gather: '#f6c8be',
|
|
511
|
-
guide: '#eb4962',
|
|
512
|
-
connect: '#ff6224',
|
|
513
|
-
chat: '#f79a3e',
|
|
514
|
-
talk: '#efc93d',
|
|
515
|
-
sell: '#c38f00'
|
|
516
|
-
},
|
|
517
|
-
grey: {
|
|
518
|
-
100: '#f8f9f9',
|
|
519
|
-
200: '#e9ebed',
|
|
520
|
-
300: '#d8dcde',
|
|
521
|
-
400: '#c2c8cc',
|
|
522
|
-
500: '#87929d',
|
|
523
|
-
600: '#68737d',
|
|
524
|
-
700: '#49545c',
|
|
525
|
-
800: '#2f3941'
|
|
526
|
-
},
|
|
527
|
-
blue: {
|
|
528
|
-
100: '#edf7ff',
|
|
529
|
-
200: '#cee2f2',
|
|
530
|
-
300: '#adcce4',
|
|
531
|
-
400: '#5293c7',
|
|
532
|
-
500: '#337fbd',
|
|
533
|
-
600: '#1f73b7',
|
|
534
|
-
700: '#144a75',
|
|
535
|
-
800: '#0f3554'
|
|
536
|
-
},
|
|
537
|
-
red: {
|
|
538
|
-
100: '#fff0f1',
|
|
539
|
-
200: '#f5d5d8',
|
|
540
|
-
300: '#f5b5ba',
|
|
541
|
-
400: '#e35b66',
|
|
542
|
-
500: '#d93f4c',
|
|
543
|
-
600: '#cc3340',
|
|
544
|
-
700: '#8c232c',
|
|
545
|
-
800: '#681219'
|
|
546
|
-
},
|
|
547
|
-
yellow: {
|
|
548
|
-
100: '#fff7ed',
|
|
549
|
-
200: '#ffeedb',
|
|
550
|
-
300: '#fed6a8',
|
|
551
|
-
400: '#ffb057',
|
|
552
|
-
500: '#f79a3e',
|
|
553
|
-
600: '#ed8f1c',
|
|
554
|
-
700: '#ad5918',
|
|
555
|
-
800: '#703815'
|
|
556
|
-
},
|
|
557
|
-
green: {
|
|
558
|
-
100: '#edf8f4',
|
|
559
|
-
200: '#d1e8df',
|
|
560
|
-
300: '#aecfc2',
|
|
561
|
-
400: '#5eae91',
|
|
562
|
-
500: '#228f67',
|
|
563
|
-
600: '#038153',
|
|
564
|
-
700: '#186146',
|
|
565
|
-
800: '#0b3b29'
|
|
566
|
-
},
|
|
567
|
-
kale: {
|
|
568
|
-
100: '#f5fcfc',
|
|
569
|
-
200: '#daeded',
|
|
570
|
-
300: '#bdd9d7',
|
|
571
|
-
400: '#90bbbb',
|
|
572
|
-
500: '#498283',
|
|
573
|
-
600: '#17494d',
|
|
574
|
-
700: '#03363d',
|
|
575
|
-
800: '#012b30'
|
|
576
|
-
},
|
|
577
|
-
fuschia: {
|
|
578
|
-
400: '#d653c2',
|
|
579
|
-
600: '#a81897',
|
|
580
|
-
M400: '#cf62a8',
|
|
581
|
-
M600: '#a8458c'
|
|
582
|
-
},
|
|
583
|
-
pink: {
|
|
584
|
-
400: '#ec4d63',
|
|
585
|
-
600: '#d42054',
|
|
586
|
-
M400: '#d57287',
|
|
587
|
-
M600: '#b23a5d'
|
|
588
|
-
},
|
|
589
|
-
crimson: {
|
|
590
|
-
400: '#e34f32',
|
|
591
|
-
600: '#c72a1c',
|
|
592
|
-
M400: '#cc6c5b',
|
|
593
|
-
M600: '#b24a3c'
|
|
594
|
-
},
|
|
595
|
-
orange: {
|
|
596
|
-
400: '#de701d',
|
|
597
|
-
600: '#bf5000',
|
|
598
|
-
M400: '#d4772c',
|
|
599
|
-
M600: '#b35827'
|
|
600
|
-
},
|
|
601
|
-
lemon: {
|
|
602
|
-
400: '#ffd424',
|
|
603
|
-
600: '#ffbb10',
|
|
604
|
-
M400: '#e7a500',
|
|
605
|
-
M600: '#c38f00'
|
|
606
|
-
},
|
|
607
|
-
lime: {
|
|
608
|
-
400: '#43b324',
|
|
609
|
-
600: '#2e8200',
|
|
610
|
-
M400: '#519e2d',
|
|
611
|
-
M600: '#47782c'
|
|
612
|
-
},
|
|
613
|
-
mint: {
|
|
614
|
-
400: '#00a656',
|
|
615
|
-
600: '#058541',
|
|
616
|
-
M400: '#299c66',
|
|
617
|
-
M600: '#2e8057'
|
|
618
|
-
},
|
|
619
|
-
teal: {
|
|
620
|
-
400: '#02a191',
|
|
621
|
-
600: '#028079',
|
|
622
|
-
M400: '#2d9e8f',
|
|
623
|
-
M600: '#3c7873'
|
|
624
|
-
},
|
|
625
|
-
azure: {
|
|
626
|
-
400: '#3091ec',
|
|
627
|
-
600: '#1371d6',
|
|
628
|
-
M400: '#5f8dcf',
|
|
629
|
-
M600: '#3a70b2'
|
|
630
|
-
},
|
|
631
|
-
royal: {
|
|
632
|
-
400: '#5d7df5',
|
|
633
|
-
600: '#3353e2',
|
|
634
|
-
M400: '#7986d8',
|
|
635
|
-
M600: '#4b61c3'
|
|
636
|
-
},
|
|
637
|
-
purple: {
|
|
638
|
-
400: '#b552e2',
|
|
639
|
-
600: '#6a27b8',
|
|
640
|
-
M400: '#b072cc',
|
|
641
|
-
M600: '#9358b0'
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
513
|
|
|
645
514
|
function retrieveComponentStyles(componentId, props) {
|
|
646
515
|
const components = props.theme && props.theme.components;
|
|
@@ -682,7 +551,6 @@ const getArrowPosition = (theme, placement) => {
|
|
|
682
551
|
return retVal;
|
|
683
552
|
};
|
|
684
553
|
|
|
685
|
-
const PALETTE_SIZE = Object.keys(PALETTE.blue).length;
|
|
686
554
|
const adjust$1 = (color, expected, actual) => {
|
|
687
555
|
if (expected !== actual) {
|
|
688
556
|
const amount = Math.abs(expected - actual) / 100 * 0.05;
|
|
@@ -713,6 +581,78 @@ const toHex = (hue, shade, offset, scheme) => {
|
|
|
713
581
|
}
|
|
714
582
|
return retVal;
|
|
715
583
|
};
|
|
584
|
+
const isValidColor = maybeColor => {
|
|
585
|
+
let retVal = ['currentcolor', 'inherit', 'transparent'].includes(maybeColor);
|
|
586
|
+
if (!retVal) {
|
|
587
|
+
try {
|
|
588
|
+
retVal = !!color2k.parseToRgba(maybeColor);
|
|
589
|
+
} catch {
|
|
590
|
+
retVal = false;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return retVal;
|
|
594
|
+
};
|
|
595
|
+
function findNearestIndex(target, arr) {
|
|
596
|
+
let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
597
|
+
if (typeof target !== 'number' || isNaN(target)) {
|
|
598
|
+
throw new Error('Target must be a number.');
|
|
599
|
+
}
|
|
600
|
+
if (!Array.isArray(arr)) {
|
|
601
|
+
throw new Error('Second argument must be an array.');
|
|
602
|
+
}
|
|
603
|
+
let left = startIndex;
|
|
604
|
+
let right = arr.length - 1;
|
|
605
|
+
if (target < arr[left]) return left;
|
|
606
|
+
if (target > arr[right]) return right;
|
|
607
|
+
while (left <= right) {
|
|
608
|
+
const mid = Math.floor((left + right) / 2);
|
|
609
|
+
if (arr[mid] === target) {
|
|
610
|
+
return mid;
|
|
611
|
+
} else if (arr[mid] < target) {
|
|
612
|
+
left = mid + 1;
|
|
613
|
+
} else {
|
|
614
|
+
right = mid - 1;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return arr[left] - target < target - arr[right] ? left : right;
|
|
618
|
+
}
|
|
619
|
+
const OFFSET_TO_TARGET_RATIO = {
|
|
620
|
+
100: 1.08,
|
|
621
|
+
200: 1.2,
|
|
622
|
+
300: 1.35,
|
|
623
|
+
400: 2,
|
|
624
|
+
500: 2.8,
|
|
625
|
+
600: 3.3,
|
|
626
|
+
700: 5,
|
|
627
|
+
800: 10,
|
|
628
|
+
900: 13,
|
|
629
|
+
1000: 16,
|
|
630
|
+
1100: 17.5,
|
|
631
|
+
1200: 19
|
|
632
|
+
};
|
|
633
|
+
const generateColorScale = memoize__default.default(color => {
|
|
634
|
+
const scaleSize = 200;
|
|
635
|
+
const _scale = color2k.getScale('#FFF', color, '#000');
|
|
636
|
+
const scale = x => _scale(x / scaleSize);
|
|
637
|
+
const colors = [];
|
|
638
|
+
const contrastRatios = [];
|
|
639
|
+
for (let i = 0; i <= scaleSize; i++) {
|
|
640
|
+
const _color = scale(i);
|
|
641
|
+
colors.push(_color);
|
|
642
|
+
contrastRatios.push(polished.getContrast('#FFF', _color));
|
|
643
|
+
}
|
|
644
|
+
const palette = {};
|
|
645
|
+
let startIndex = 0;
|
|
646
|
+
for (const offset in OFFSET_TO_TARGET_RATIO) {
|
|
647
|
+
if (Object.prototype.hasOwnProperty.call(OFFSET_TO_TARGET_RATIO, offset)) {
|
|
648
|
+
const ratio = OFFSET_TO_TARGET_RATIO[offset];
|
|
649
|
+
const nearestIndex = findNearestIndex(ratio, contrastRatios, startIndex);
|
|
650
|
+
startIndex = nearestIndex + 1;
|
|
651
|
+
palette[offset] = colors[nearestIndex];
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return palette;
|
|
655
|
+
});
|
|
716
656
|
const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transparency) => {
|
|
717
657
|
let retVal;
|
|
718
658
|
let _hue = colors[hue] || hue;
|
|
@@ -721,17 +661,11 @@ const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transpare
|
|
|
721
661
|
}
|
|
722
662
|
if (typeof _hue === 'object') {
|
|
723
663
|
retVal = toHex(_hue, shade, offset, scheme);
|
|
724
|
-
} else if (
|
|
664
|
+
} else if (isValidColor(_hue)) {
|
|
725
665
|
if (shade === undefined) {
|
|
726
666
|
retVal = _hue;
|
|
727
667
|
} else {
|
|
728
|
-
|
|
729
|
-
_hue = _colors.reduce((_retVal, color, index) => {
|
|
730
|
-
if (index > 0 && index <= PALETTE_SIZE) {
|
|
731
|
-
_retVal[index * 100] = color;
|
|
732
|
-
}
|
|
733
|
-
return _retVal;
|
|
734
|
-
}, {});
|
|
668
|
+
_hue = generateColorScale(_hue);
|
|
735
669
|
retVal = toHex(_hue, shade, offset, scheme);
|
|
736
670
|
}
|
|
737
671
|
}
|
|
@@ -754,6 +688,41 @@ const toProperty = (object, path) => {
|
|
|
754
688
|
throw new TypeError(`Error: unexpected '${typeof retVal}' type for color variable "${path}"`);
|
|
755
689
|
}
|
|
756
690
|
};
|
|
691
|
+
const fromRgba = value => {
|
|
692
|
+
let retVal;
|
|
693
|
+
const regex = /rgba\s*\(\s*(?<property>[#\w.]+)\s*,\s*(?<alpha>[\w.]+)\s*\)/gu;
|
|
694
|
+
const _rgba = regex.exec(value);
|
|
695
|
+
if (_rgba && _rgba.groups) {
|
|
696
|
+
const property = _rgba.groups.property;
|
|
697
|
+
const transparency = parseFloat(_rgba.groups.alpha);
|
|
698
|
+
retVal = {
|
|
699
|
+
property,
|
|
700
|
+
transparency
|
|
701
|
+
};
|
|
702
|
+
} else {
|
|
703
|
+
throw new Error(`Error: invalid \`rgba\` value "${value}"`);
|
|
704
|
+
}
|
|
705
|
+
return retVal;
|
|
706
|
+
};
|
|
707
|
+
const fromVariable = (variable, variables, palette) => {
|
|
708
|
+
const retVal = {};
|
|
709
|
+
let property = toProperty(variables, variable);
|
|
710
|
+
if (property.startsWith('rgba')) {
|
|
711
|
+
const value = fromRgba(property);
|
|
712
|
+
property = value.property;
|
|
713
|
+
retVal.transparency = value.transparency;
|
|
714
|
+
}
|
|
715
|
+
const [key, value] = property.split(/\.(?<value>.*)/u);
|
|
716
|
+
if (key === 'palette') {
|
|
717
|
+
retVal.hue = toProperty(palette, value);
|
|
718
|
+
} else {
|
|
719
|
+
retVal.hue = key;
|
|
720
|
+
if (value !== undefined) {
|
|
721
|
+
retVal.shade = parseInt(value, 10);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return retVal;
|
|
725
|
+
};
|
|
757
726
|
const getColor = memoize__default.default(_ref => {
|
|
758
727
|
let {
|
|
759
728
|
dark,
|
|
@@ -777,17 +746,13 @@ const getColor = memoize__default.default(_ref => {
|
|
|
777
746
|
let _hue = mode?.hue || hue;
|
|
778
747
|
let _shade = mode?.shade === undefined ? shade : mode.shade;
|
|
779
748
|
const _offset = mode?.offset === undefined ? offset : mode.offset;
|
|
780
|
-
|
|
749
|
+
let _transparency = mode?.transparency === undefined ? transparency : mode.transparency;
|
|
781
750
|
if (variable) {
|
|
782
751
|
const _variables = variables?.[scheme] ? variables[scheme] : DEFAULT_THEME.colors.variables[scheme];
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
} else {
|
|
788
|
-
_hue = key;
|
|
789
|
-
_shade = parseInt(value, 10);
|
|
790
|
-
}
|
|
752
|
+
const value = fromVariable(variable, _variables, palette);
|
|
753
|
+
_hue = value.hue;
|
|
754
|
+
_shade = value.shade;
|
|
755
|
+
_transparency = _transparency === undefined ? value.transparency : _transparency;
|
|
791
756
|
}
|
|
792
757
|
if (_hue) {
|
|
793
758
|
const opacity = theme.opacity && Object.keys(theme.opacity).length > 0 ? theme.opacity : DEFAULT_THEME.opacity;
|
|
@@ -816,6 +781,7 @@ const getColor = memoize__default.default(_ref => {
|
|
|
816
781
|
shade,
|
|
817
782
|
colors: theme.colors,
|
|
818
783
|
palette: theme.palette,
|
|
784
|
+
opacity: theme.opacity,
|
|
819
785
|
transparency,
|
|
820
786
|
variable
|
|
821
787
|
});
|
|
@@ -852,6 +818,148 @@ const getCheckeredBackground = _ref => {
|
|
|
852
818
|
return retVal;
|
|
853
819
|
};
|
|
854
820
|
|
|
821
|
+
const PALETTE_V8 = {
|
|
822
|
+
black: '#000',
|
|
823
|
+
white: '#fff',
|
|
824
|
+
product: {
|
|
825
|
+
support: '#00a656',
|
|
826
|
+
message: '#37b8af',
|
|
827
|
+
explore: '#30aabc',
|
|
828
|
+
gather: '#f6c8be',
|
|
829
|
+
guide: '#eb4962',
|
|
830
|
+
connect: '#ff6224',
|
|
831
|
+
chat: '#f79a3e',
|
|
832
|
+
talk: '#efc93d',
|
|
833
|
+
sell: '#c38f00'
|
|
834
|
+
},
|
|
835
|
+
grey: {
|
|
836
|
+
100: '#f8f9f9',
|
|
837
|
+
200: '#e9ebed',
|
|
838
|
+
300: '#d8dcde',
|
|
839
|
+
400: '#c2c8cc',
|
|
840
|
+
500: '#87929d',
|
|
841
|
+
600: '#68737d',
|
|
842
|
+
700: '#49545c',
|
|
843
|
+
800: '#2f3941'
|
|
844
|
+
},
|
|
845
|
+
blue: {
|
|
846
|
+
100: '#edf7ff',
|
|
847
|
+
200: '#cee2f2',
|
|
848
|
+
300: '#adcce4',
|
|
849
|
+
400: '#5293c7',
|
|
850
|
+
500: '#337fbd',
|
|
851
|
+
600: '#1f73b7',
|
|
852
|
+
700: '#144a75',
|
|
853
|
+
800: '#0f3554'
|
|
854
|
+
},
|
|
855
|
+
red: {
|
|
856
|
+
100: '#fff0f1',
|
|
857
|
+
200: '#f5d5d8',
|
|
858
|
+
300: '#f5b5ba',
|
|
859
|
+
400: '#e35b66',
|
|
860
|
+
500: '#d93f4c',
|
|
861
|
+
600: '#cc3340',
|
|
862
|
+
700: '#8c232c',
|
|
863
|
+
800: '#681219'
|
|
864
|
+
},
|
|
865
|
+
yellow: {
|
|
866
|
+
100: '#fff7ed',
|
|
867
|
+
200: '#ffeedb',
|
|
868
|
+
300: '#fed6a8',
|
|
869
|
+
400: '#ffb057',
|
|
870
|
+
500: '#f79a3e',
|
|
871
|
+
600: '#ed8f1c',
|
|
872
|
+
700: '#ad5918',
|
|
873
|
+
800: '#703815'
|
|
874
|
+
},
|
|
875
|
+
green: {
|
|
876
|
+
100: '#edf8f4',
|
|
877
|
+
200: '#d1e8df',
|
|
878
|
+
300: '#aecfc2',
|
|
879
|
+
400: '#5eae91',
|
|
880
|
+
500: '#228f67',
|
|
881
|
+
600: '#038153',
|
|
882
|
+
700: '#186146',
|
|
883
|
+
800: '#0b3b29'
|
|
884
|
+
},
|
|
885
|
+
kale: {
|
|
886
|
+
100: '#f5fcfc',
|
|
887
|
+
200: '#daeded',
|
|
888
|
+
300: '#bdd9d7',
|
|
889
|
+
400: '#90bbbb',
|
|
890
|
+
500: '#498283',
|
|
891
|
+
600: '#17494d',
|
|
892
|
+
700: '#03363d',
|
|
893
|
+
800: '#012b30'
|
|
894
|
+
},
|
|
895
|
+
fuschia: {
|
|
896
|
+
400: '#d653c2',
|
|
897
|
+
600: '#a81897',
|
|
898
|
+
M400: '#cf62a8',
|
|
899
|
+
M600: '#a8458c'
|
|
900
|
+
},
|
|
901
|
+
pink: {
|
|
902
|
+
400: '#ec4d63',
|
|
903
|
+
600: '#d42054',
|
|
904
|
+
M400: '#d57287',
|
|
905
|
+
M600: '#b23a5d'
|
|
906
|
+
},
|
|
907
|
+
crimson: {
|
|
908
|
+
400: '#e34f32',
|
|
909
|
+
600: '#c72a1c',
|
|
910
|
+
M400: '#cc6c5b',
|
|
911
|
+
M600: '#b24a3c'
|
|
912
|
+
},
|
|
913
|
+
orange: {
|
|
914
|
+
400: '#de701d',
|
|
915
|
+
600: '#bf5000',
|
|
916
|
+
M400: '#d4772c',
|
|
917
|
+
M600: '#b35827'
|
|
918
|
+
},
|
|
919
|
+
lemon: {
|
|
920
|
+
400: '#ffd424',
|
|
921
|
+
600: '#ffbb10',
|
|
922
|
+
M400: '#e7a500',
|
|
923
|
+
M600: '#c38f00'
|
|
924
|
+
},
|
|
925
|
+
lime: {
|
|
926
|
+
400: '#43b324',
|
|
927
|
+
600: '#2e8200',
|
|
928
|
+
M400: '#519e2d',
|
|
929
|
+
M600: '#47782c'
|
|
930
|
+
},
|
|
931
|
+
mint: {
|
|
932
|
+
400: '#00a656',
|
|
933
|
+
600: '#058541',
|
|
934
|
+
M400: '#299c66',
|
|
935
|
+
M600: '#2e8057'
|
|
936
|
+
},
|
|
937
|
+
teal: {
|
|
938
|
+
400: '#02a191',
|
|
939
|
+
600: '#028079',
|
|
940
|
+
M400: '#2d9e8f',
|
|
941
|
+
M600: '#3c7873'
|
|
942
|
+
},
|
|
943
|
+
azure: {
|
|
944
|
+
400: '#3091ec',
|
|
945
|
+
600: '#1371d6',
|
|
946
|
+
M400: '#5f8dcf',
|
|
947
|
+
M600: '#3a70b2'
|
|
948
|
+
},
|
|
949
|
+
royal: {
|
|
950
|
+
400: '#5d7df5',
|
|
951
|
+
600: '#3353e2',
|
|
952
|
+
M400: '#7986d8',
|
|
953
|
+
M600: '#4b61c3'
|
|
954
|
+
},
|
|
955
|
+
purple: {
|
|
956
|
+
400: '#b552e2',
|
|
957
|
+
600: '#6a27b8',
|
|
958
|
+
M400: '#b072cc',
|
|
959
|
+
M600: '#9358b0'
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
|
|
855
963
|
const DEFAULT_SHADE = 600;
|
|
856
964
|
const adjust = (color, expected, actual) => {
|
|
857
965
|
if (expected !== actual) {
|
|
@@ -1060,58 +1168,47 @@ function mediaQuery(query, breakpoint, theme) {
|
|
|
1060
1168
|
return retVal;
|
|
1061
1169
|
}
|
|
1062
1170
|
|
|
1063
|
-
const exponentialSymbols = {
|
|
1064
|
-
symbols: {
|
|
1065
|
-
sqrt: {
|
|
1066
|
-
func: {
|
|
1067
|
-
symbol: 'sqrt',
|
|
1068
|
-
f: a => Math.sqrt(a),
|
|
1069
|
-
notation: 'func',
|
|
1070
|
-
precedence: 0,
|
|
1071
|
-
rightToLeft: 0,
|
|
1072
|
-
argCount: 1
|
|
1073
|
-
},
|
|
1074
|
-
symbol: 'sqrt',
|
|
1075
|
-
regSymbol: 'sqrt\\b'
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
1171
|
const animationStyles$1 = (position, modifier) => {
|
|
1080
1172
|
const property = position.split('-')[0];
|
|
1081
1173
|
const animationName = styled.keyframes(["0%,66%{", ":2px;border:transparent;}"], property);
|
|
1082
1174
|
return styled.css(["&", "::before,&", "::after{animation:0.3s ease-in-out ", ";}"], modifier, modifier, animationName);
|
|
1083
1175
|
};
|
|
1084
|
-
const positionStyles = (position, size, inset) => {
|
|
1085
|
-
const
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1176
|
+
const positionStyles = (position, size, inset, shift) => {
|
|
1177
|
+
const defaultInset = 0.3;
|
|
1178
|
+
const margin = size / -2;
|
|
1179
|
+
const placement = Math.round((margin + inset + defaultInset) * 100) / 100;
|
|
1180
|
+
const marginPx = `${margin}px`;
|
|
1181
|
+
const placementPx = `${placement}px`;
|
|
1182
|
+
const offsetPx = `${size + shift}px`;
|
|
1088
1183
|
let positionCss;
|
|
1089
|
-
let
|
|
1184
|
+
let transform;
|
|
1090
1185
|
if (position.startsWith('top')) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
positionCss = styled.css(["top:", ";right:", ";left:", ";margin-left:", ";"], placement, position === 'top-right' && size, position === 'top' ? '50%' : position === 'top-left' && size, position === 'top' && margin);
|
|
1186
|
+
transform = 'rotate(-135deg)';
|
|
1187
|
+
positionCss = styled.css(["top:", ";right:", ";left:", ";margin-left:", ";"], placementPx, position === 'top-right' && offsetPx, position === 'top' ? '50%' : position === 'top-left' && offsetPx, position === 'top' && marginPx);
|
|
1094
1188
|
} else if (position.startsWith('right')) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
positionCss = styled.css(["top:", ";right:", ";bottom:", ";margin-top:", ";"], position === 'right' ? '50%' : position === 'right-top' && size, placement, position === 'right-bottom' && size, position === 'right' && margin);
|
|
1189
|
+
transform = 'rotate(-45deg)';
|
|
1190
|
+
positionCss = styled.css(["top:", ";right:", ";bottom:", ";margin-top:", ";"], position === 'right' ? '50%' : position === 'right-top' && offsetPx, placementPx, position === 'right-bottom' && offsetPx, position === 'right' && marginPx);
|
|
1098
1191
|
} else if (position.startsWith('bottom')) {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
positionCss = styled.css(["right:", ";bottom:", ";left:", ";margin-left:", ";"], position === 'bottom-right' && size, placement, position === 'bottom' ? '50%' : position === 'bottom-left' && size, position === 'bottom' && margin);
|
|
1192
|
+
transform = 'rotate(45deg)';
|
|
1193
|
+
positionCss = styled.css(["right:", ";bottom:", ";left:", ";margin-left:", ";"], position === 'bottom-right' && offsetPx, placementPx, position === 'bottom' ? '50%' : position === 'bottom-left' && offsetPx, position === 'bottom' && marginPx);
|
|
1102
1194
|
} else if (position.startsWith('left')) {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
positionCss = styled.css(["top:", ";bottom:", ";left:", ";margin-top:", ";"], position === 'left' ? '50%' : position === 'left-top' && size, size, placement, position === 'left' && margin);
|
|
1195
|
+
transform = 'rotate(135deg)';
|
|
1196
|
+
positionCss = styled.css(["top:", ";bottom:", ";left:", ";margin-top:", ";"], position === 'left' ? '50%' : position === 'left-top' && offsetPx, offsetPx, placementPx, position === 'left' && marginPx);
|
|
1106
1197
|
}
|
|
1107
|
-
return styled.css(["&::before{
|
|
1198
|
+
return styled.css(["&::before,&::after{transform:", ";", ";}"], transform, positionCss);
|
|
1108
1199
|
};
|
|
1109
1200
|
function arrowStyles(position) {
|
|
1110
1201
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1111
|
-
const
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1202
|
+
const inset = polished.stripUnit(options.inset || '0');
|
|
1203
|
+
const size = polished.stripUnit(options.size || '6');
|
|
1204
|
+
const shift = polished.stripUnit(options.shift || '0');
|
|
1205
|
+
const sizeOffset = 2;
|
|
1206
|
+
const squareSize = size * 2 / Math.sqrt(2) + sizeOffset;
|
|
1207
|
+
const squareSizeRounded = Math.round(squareSize * 100) / 100;
|
|
1208
|
+
const squareSizePx = `${squareSizeRounded}px`;
|
|
1209
|
+
const afterOffset = 0;
|
|
1210
|
+
const beforeOffset = afterOffset + 2;
|
|
1211
|
+
return styled.css(["position:relative;&::before,&::after{position:absolute;border-width:inherit;border-style:inherit;background-color:inherit;width:", ";height:", ";content:'';box-sizing:inherit;}&::before{border-color:inherit;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}&::after{border-color:transparent;background-clip:content-box;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}", ";", ";"], squareSizePx, squareSizePx, beforeOffset, beforeOffset, afterOffset, afterOffset, positionStyles(position, squareSizeRounded, inset, shift), options.animationModifier && animationStyles$1(position, options.animationModifier));
|
|
1115
1212
|
}
|
|
1116
1213
|
|
|
1117
1214
|
const useDocument = theme => {
|
|
@@ -1173,9 +1270,30 @@ const animationStyles = (position, options) => {
|
|
|
1173
1270
|
} else {
|
|
1174
1271
|
transformFunction = 'translateX';
|
|
1175
1272
|
}
|
|
1176
|
-
const animationName = styled.keyframes(["0%{transform:", "(", ");}"], transformFunction, translateValue);
|
|
1273
|
+
const animationName = styled.keyframes(["0%{transform:", "(", ");pointer-events:none;}100%{pointer-events:auto;}"], transformFunction, translateValue);
|
|
1177
1274
|
return styled.css(["&", " ", "{animation:0.2s cubic-bezier(0.15,0.85,0.35,1.2) ", ";}"], options.animationModifier, options.childSelector || '> *', animationName);
|
|
1178
1275
|
};
|
|
1276
|
+
const colorStyles = theme => {
|
|
1277
|
+
const backgroundColor = getColor({
|
|
1278
|
+
theme,
|
|
1279
|
+
variable: 'background.raised'
|
|
1280
|
+
});
|
|
1281
|
+
const borderColor = getColor({
|
|
1282
|
+
theme,
|
|
1283
|
+
variable: 'border.default'
|
|
1284
|
+
});
|
|
1285
|
+
const boxShadowColor = getColor({
|
|
1286
|
+
variable: 'shadow.medium',
|
|
1287
|
+
theme
|
|
1288
|
+
});
|
|
1289
|
+
const boxShadowBlurRadius = `${theme.space.base * (theme.colors.base === 'dark' ? 5 : 6)}px`;
|
|
1290
|
+
const boxShadowOffsetY = `${theme.space.base * (theme.colors.base === 'dark' ? 4 : 5)}px`;
|
|
1291
|
+
const foregroundColor = getColor({
|
|
1292
|
+
theme,
|
|
1293
|
+
variable: 'foreground.default'
|
|
1294
|
+
});
|
|
1295
|
+
return styled.css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";"], borderColor, theme.shadows.lg(boxShadowOffsetY, boxShadowBlurRadius, boxShadowColor), backgroundColor, foregroundColor);
|
|
1296
|
+
};
|
|
1179
1297
|
const hiddenStyles = options => {
|
|
1180
1298
|
const transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
|
|
1181
1299
|
return styled.css(["transition:", ";visibility:hidden;opacity:0;"], options.animationModifier && transition);
|
|
@@ -1193,21 +1311,7 @@ function menuStyles(position) {
|
|
|
1193
1311
|
} else {
|
|
1194
1312
|
marginProperty = 'margin-right';
|
|
1195
1313
|
}
|
|
1196
|
-
return styled.css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", "
|
|
1197
|
-
theme,
|
|
1198
|
-
variable: 'border.default'
|
|
1199
|
-
}), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColor({
|
|
1200
|
-
theme,
|
|
1201
|
-
hue: 'chromeHue',
|
|
1202
|
-
shade: 600,
|
|
1203
|
-
transparency: 0.15
|
|
1204
|
-
})), getColor({
|
|
1205
|
-
theme,
|
|
1206
|
-
variable: 'background.raised'
|
|
1207
|
-
}), theme.rtl ? 'right' : 'left', getColor({
|
|
1208
|
-
theme,
|
|
1209
|
-
variable: 'foreground.default'
|
|
1210
|
-
}), theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
1314
|
+
return styled.css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;color-scheme:only ", ";& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", ";border-radius:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, p => p.theme.colors.base, options.childSelector || '> *', theme.borders.sm, theme.borderRadii.md, theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', colorStyles(theme), options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
1211
1315
|
}
|
|
1212
1316
|
|
|
1213
1317
|
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
|
|
@@ -1262,7 +1366,6 @@ exports.ARROW_POSITION = ARROW_POSITION;
|
|
|
1262
1366
|
exports.DEFAULT_THEME = DEFAULT_THEME;
|
|
1263
1367
|
exports.MENU_POSITION = MENU_POSITION;
|
|
1264
1368
|
exports.PALETTE = PALETTE;
|
|
1265
|
-
exports.PALETTE_V8 = PALETTE_V8;
|
|
1266
1369
|
exports.PLACEMENT = PLACEMENT;
|
|
1267
1370
|
exports.SELECTOR_FOCUS_VISIBLE = SELECTOR_FOCUS_VISIBLE;
|
|
1268
1371
|
exports.StyledBaseIcon = StyledBaseIcon;
|