@zendeskgarden/react-theming 9.0.0-next.26 → 9.0.0-next.27

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.
@@ -41,11 +41,15 @@ const toHex = (hue, shade, offset, scheme) => {
41
41
  return retVal;
42
42
  };
43
43
  const isValidColor = maybeColor => {
44
- try {
45
- return !!parseToRgba(maybeColor);
46
- } catch {
47
- return false;
44
+ let retVal = ['currentcolor', 'inherit', 'transparent'].includes(maybeColor);
45
+ if (!retVal) {
46
+ try {
47
+ retVal = !!parseToRgba(maybeColor);
48
+ } catch {
49
+ retVal = false;
50
+ }
48
51
  }
52
+ return retVal;
49
53
  };
50
54
  function findNearestIndex(target, arr) {
51
55
  let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -116,7 +120,7 @@ const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transpare
116
120
  }
117
121
  if (typeof _hue === 'object') {
118
122
  retVal = toHex(_hue, shade, offset, scheme);
119
- } else if (_hue === 'transparent' || isValidColor(_hue)) {
123
+ } else if (isValidColor(_hue)) {
120
124
  if (shade === undefined) {
121
125
  retVal = _hue;
122
126
  } else {
package/dist/index.cjs.js CHANGED
@@ -584,11 +584,15 @@ const toHex = (hue, shade, offset, scheme) => {
584
584
  return retVal;
585
585
  };
586
586
  const isValidColor = maybeColor => {
587
- try {
588
- return !!color2k.parseToRgba(maybeColor);
589
- } catch {
590
- return false;
587
+ let retVal = ['currentcolor', 'inherit', 'transparent'].includes(maybeColor);
588
+ if (!retVal) {
589
+ try {
590
+ retVal = !!color2k.parseToRgba(maybeColor);
591
+ } catch {
592
+ retVal = false;
593
+ }
591
594
  }
595
+ return retVal;
592
596
  };
593
597
  function findNearestIndex(target, arr) {
594
598
  let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -659,7 +663,7 @@ const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transpare
659
663
  }
660
664
  if (typeof _hue === 'object') {
661
665
  retVal = toHex(_hue, shade, offset, scheme);
662
- } else if (_hue === 'transparent' || isValidColor(_hue)) {
666
+ } else if (isValidColor(_hue)) {
663
667
  if (shade === undefined) {
664
668
  retVal = _hue;
665
669
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.0.0-next.26",
3
+ "version": "9.0.0-next.27",
4
4
  "description": "Theming utilities and components within the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "049dd7bd143029147de333f78bd879dc7d7251f2"
50
+ "gitHead": "1e33779f9a7a284af3eda1405fa624c00e739a6a"
51
51
  }