UNPKG

2.99 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", {
3 value: true
4});
5function _export(target, all) {
6 for(var name in all)Object.defineProperty(target, name, {
7 enumerable: true,
8 get: all[name]
9 });
10}
11_export(exports, {
12 setTwoToneColor: function() {
13 return setTwoToneColor;
14 },
15 getTwoToneColor: function() {
16 return getTwoToneColor;
17 }
18});
19var _IconBase = /*#__PURE__*/ _interop_require_default(require("./IconBase"));
20var _utils = require("../utils");
21function _array_like_to_array(arr, len) {
22 if (len == null || len > arr.length) len = arr.length;
23 for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
24 return arr2;
25}
26function _array_with_holes(arr) {
27 if (Array.isArray(arr)) return arr;
28}
29function _interop_require_default(obj) {
30 return obj && obj.__esModule ? obj : {
31 default: obj
32 };
33}
34function _iterable_to_array_limit(arr, i) {
35 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
36 if (_i == null) return;
37 var _arr = [];
38 var _n = true;
39 var _d = false;
40 var _s, _e;
41 try {
42 for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
43 _arr.push(_s.value);
44 if (i && _arr.length === i) break;
45 }
46 } catch (err) {
47 _d = true;
48 _e = err;
49 } finally{
50 try {
51 if (!_n && _i["return"] != null) _i["return"]();
52 } finally{
53 if (_d) throw _e;
54 }
55 }
56 return _arr;
57}
58function _non_iterable_rest() {
59 throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
60}
61function _sliced_to_array(arr, i) {
62 return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
63}
64function _unsupported_iterable_to_array(o, minLen) {
65 if (!o) return;
66 if (typeof o === "string") return _array_like_to_array(o, minLen);
67 var n = Object.prototype.toString.call(o).slice(8, -1);
68 if (n === "Object" && o.constructor) n = o.constructor.name;
69 if (n === "Map" || n === "Set") return Array.from(n);
70 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
71}
72function setTwoToneColor(twoToneColor) {
73 var _normalizeTwoToneColors = _sliced_to_array((0, _utils.normalizeTwoToneColors)(twoToneColor), 2), primaryColor = _normalizeTwoToneColors[0], secondaryColor = _normalizeTwoToneColors[1];
74 return _IconBase.default.setTwoToneColors({
75 primaryColor: primaryColor,
76 secondaryColor: secondaryColor
77 });
78}
79function getTwoToneColor() {
80 var colors = _IconBase.default.getTwoToneColors();
81 if (!colors.calculated) {
82 return colors.primaryColor;
83 }
84 return [
85 colors.primaryColor,
86 colors.secondaryColor
87 ];
88}