@elastic/eui-theme-common 10.1.0 → 10.2.0-snapshot.1794367676681

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.mathWithUnits = void 0;
8
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
8
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
9
9
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
10
10
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
11
11
  /*
@@ -0,0 +1,23 @@
1
+ export declare const MID_COLOR_STOP = "#EBEFF5";
2
+ /**
3
+ * This function takes an array of colors and returns an array of interpolated
4
+ * colors based on the number of steps/len needed for use in UI elements such as charts.
5
+ * Derived from https://github.com/gka/palettes (Unlicensed)
6
+ */
7
+ export declare function colorPalette(
8
+ /**
9
+ * The main color code or array of codes
10
+ */
11
+ colors: string[],
12
+ /**
13
+ * The number of colors in the resulting array (default 10)
14
+ */
15
+ len?: number,
16
+ /**
17
+ * Forces color interpolation to be calculated separately for each half (default false)
18
+ */
19
+ diverging?: boolean,
20
+ /**
21
+ * Uses a more static interpolation for non-continuous spectrums
22
+ */
23
+ categorical?: boolean): string[];
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MID_COLOR_STOP = void 0;
7
+ exports.colorPalette = colorPalette;
8
+ var _chromaJs = _interopRequireDefault(require("chroma-js"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+
18
+ var MID_COLOR_STOP = exports.MID_COLOR_STOP = '#EBEFF5';
19
+
20
+ /**
21
+ * This function takes an array of colors and returns an array of interpolated
22
+ * colors based on the number of steps/len needed for use in UI elements such as charts.
23
+ * Derived from https://github.com/gka/palettes (Unlicensed)
24
+ */
25
+
26
+ function colorPalette(
27
+ /**
28
+ * The main color code or array of codes
29
+ */
30
+ colors) {
31
+ var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
32
+ var diverging = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
33
+ var categorical = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
34
+ var hexStart = colors.slice();
35
+ var hexEnd = [];
36
+ var even = len % 2 === 0;
37
+ var numColorsLeft = diverging ? Math.ceil(len / 2) + (even ? 1 : 0) : len;
38
+ var numColorsRight = diverging ? Math.ceil(len / 2) + (even ? 1 : 0) : 0;
39
+
40
+ // If only a single color is provided prepend the mid-point color
41
+ if (hexStart.length === 1) {
42
+ hexStart.unshift(MID_COLOR_STOP);
43
+ }
44
+
45
+ // If diverging, split the start array and duplicate the mid color
46
+ if (diverging) {
47
+ // If there's no midpoint, create one
48
+ if (hexStart.length < 3) {
49
+ hexStart[2] = hexStart[1];
50
+ hexStart[1] = MID_COLOR_STOP;
51
+ }
52
+ var numColorsHalf = Math.ceil(hexStart.length / 2);
53
+ var colorsLeft = hexStart.filter(function (item, index) {
54
+ if (index < numColorsHalf) {
55
+ return true; // keep it
56
+ }
57
+ });
58
+ var colorsRight = hexStart.reverse().filter(function (item, index) {
59
+ if (index < numColorsHalf) {
60
+ return true; // keep it
61
+ }
62
+ }).reverse();
63
+ hexStart = colorsLeft;
64
+ hexEnd = colorsRight;
65
+ }
66
+ function createSteps(colors, steps) {
67
+ if (!colors.length) {
68
+ return colors;
69
+ }
70
+ if (!categorical) {
71
+ return _chromaJs["default"].bezier(colors).scale().correctLightness().colors(steps);
72
+ } else {
73
+ return _chromaJs["default"].scale(colors).colors(steps);
74
+ }
75
+ }
76
+ var stepsLeft = createSteps(hexStart, numColorsLeft);
77
+ var stepsRight = createSteps(hexEnd, numColorsRight);
78
+ return (even && diverging ? stepsLeft.slice(0, stepsLeft.length - 1) : stepsLeft).concat(stepsRight.slice(1));
79
+ }
@@ -0,0 +1,132 @@
1
+ import { _EuiThemeVisColors } from '../global_styling';
2
+ export declare type EuiPalette = string[];
3
+ export declare type EuiPaletteCommonProps = {
4
+ /**
5
+ * Defines the default set of colors the palette uses.
6
+ * Defaults to vis colors from `EUI_VIS_COLOR_STORE`.
7
+ * Use this to specify colors when you can't rely on the EuiProvider updates.
8
+ */
9
+ colors?: _EuiThemeVisColors;
10
+ };
11
+ export declare type EuiPaletteRotationProps = {
12
+ /**
13
+ * How many variations of the series is needed
14
+ */
15
+ rotations?: number;
16
+ /**
17
+ * Order similar colors as `group`s or just `append` each variation
18
+ */
19
+ order?: 'append' | 'group';
20
+ /**
21
+ * Specifies if the direction of the color variations
22
+ */
23
+ direction?: 'lighter' | 'darker' | 'both';
24
+ /**
25
+ * Use the default sort order, or re-sort them based on the color wheel (natural)
26
+ */
27
+ sortBy?: 'default' | 'natural';
28
+ /**
29
+ * Shift the sorting order by a certain number when used in conjunction with `'natural'` `sortBy`.
30
+ * Defaults to a number close to green.
31
+ */
32
+ sortShift?: string;
33
+ };
34
+ export declare type EuiPaletteColorBlindProps = EuiPaletteCommonProps & EuiPaletteRotationProps;
35
+ /**
36
+ * For usage in React use the `useEuiPaletteColorBlind` hook instead.
37
+ *
38
+ * NOTE: These functions rely on base vis colors of the theme which are provided via a global
39
+ * singleton instance `EUI_VIS_COLOR_STORE` that's updated by the EuiProvider on theme change.
40
+ * Make sure the function is recalled on theme change to retrieve theme-related colors.
41
+ *
42
+ * Outside of a react component you can use the `subscibe()` method on the `EUI_VIS_COLOR_STORE`
43
+ * to subscribe to updates and update your usages to ensure latest colors are loaded.
44
+ */
45
+ export declare const euiPaletteColorBlind: ({ rotations, order, direction, sortBy, sortShift, colors, }?: EuiPaletteColorBlindProps) => EuiPalette;
46
+ /**
47
+ * For usage in React use the `useEuiPaletteColorBlindBehindText` hook instead.
48
+ *
49
+ * Color blind palette with text is meant for use when text is applied on top of the color.
50
+ * It increases the brightness of the color to give the text more contrast.
51
+ *
52
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
53
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
54
+ */
55
+ export declare const euiPaletteColorBlindBehindText: (paletteProps?: EuiPaletteColorBlindProps) => EuiPalette;
56
+ /**
57
+ * For usage in React use the `useEuiPaletteForStatus` hook instead.
58
+ *
59
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
60
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
61
+ */
62
+ export declare const euiPaletteForStatus: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
63
+ /**
64
+ * For usage in React use the `useEuiPaletteForTemperature` hook instead.
65
+ *
66
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
67
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
68
+ */
69
+ export declare const euiPaletteForTemperature: (steps: any, { colors }?: EuiPaletteCommonProps) => EuiPalette;
70
+ /**
71
+ * For usage in React use the `useEuiPaletteComplementary` hook instead.
72
+ *
73
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
74
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
75
+ */
76
+ export declare const euiPaletteComplementary: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
77
+ /**
78
+ * For usage in React use the `useEuiPaletteRed` hook instead.
79
+ *
80
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
81
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
82
+ */
83
+ export declare const euiPaletteRed: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
84
+ /**
85
+ * For usage in React use the `useEuiPaletteGreen` hook instead.
86
+ *
87
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
88
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
89
+ */
90
+ export declare const euiPaletteGreen: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
91
+ /**
92
+ * For usage in React use the `useEuiPaletteSkyBlue` hook instead.
93
+ *
94
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
95
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
96
+ */
97
+ export declare const euiPaletteSkyBlue: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
98
+ /**
99
+ * For usage in React use the `useEuiPaletteYellow` hook instead.
100
+ *
101
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
102
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
103
+ */
104
+ export declare const euiPaletteYellow: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
105
+ /**
106
+ * For usage in React use the `useEuiPaletteOrange` hook instead.
107
+ *
108
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
109
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
110
+ */
111
+ export declare const euiPaletteOrange: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
112
+ /**
113
+ * For usage in React use the `useEuiPaletteCool` hook instead.
114
+ *
115
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
116
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
117
+ */
118
+ export declare const euiPaletteCool: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
119
+ /**
120
+ * For usage in React use the `useEuiPaletteWarm` hook instead.
121
+ *
122
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
123
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
124
+ */
125
+ export declare const euiPaletteWarm: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
126
+ /**
127
+ * For usage in React use the `useEuiPaletteGray` hook instead.
128
+ *
129
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
130
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
131
+ */
132
+ export declare const euiPaletteGray: (steps: number, { colors }?: EuiPaletteCommonProps) => EuiPalette;
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiPaletteYellow = exports.euiPaletteWarm = exports.euiPaletteSkyBlue = exports.euiPaletteRed = exports.euiPaletteOrange = exports.euiPaletteGreen = exports.euiPaletteGray = exports.euiPaletteForTemperature = exports.euiPaletteForStatus = exports.euiPaletteCool = exports.euiPaletteComplementary = exports.euiPaletteColorBlindBehindText = exports.euiPaletteColorBlind = void 0;
7
+ var _chromaJs = _interopRequireDefault(require("chroma-js"));
8
+ var _color_palette = require("./color_palette");
9
+ var _vis_color_store = require("./vis_color_store");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
12
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
15
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /*
17
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
+ * or more contributor license agreements. Licensed under the Elastic License
19
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
20
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
21
+ * Side Public License, v 1.
22
+ */
23
+ /**
24
+ * Resolves the default vis colors from the global vis color store singleton.
25
+ * The store is initialized by the theme packages (e.g. `@elastic/eui-theme-borealis`)
26
+ * and kept up to date by `EuiProvider` on theme change.
27
+ */
28
+ var getDefaultVisColors = function getDefaultVisColors() {
29
+ return _vis_color_store.EuiVisColorStore.getInstance().visColors;
30
+ };
31
+ var flatten = function flatten(arr) {
32
+ var _ref;
33
+ return (_ref = []).concat.apply(_ref, _toConsumableArray(arr));
34
+ };
35
+ var euiPalette = function euiPalette(colors, steps) {
36
+ var diverge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
37
+ var categorical = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
38
+ // This function also trims the first color so white/black is never a color
39
+ if (!diverge && steps > 1) {
40
+ var palette = (0, _color_palette.colorPalette)(colors, steps + 1);
41
+ palette.shift();
42
+ return palette;
43
+ }
44
+ return (0, _color_palette.colorPalette)(colors, steps, diverge, categorical);
45
+ };
46
+ /**
47
+ * For usage in React use the `useEuiPaletteColorBlind` hook instead.
48
+ *
49
+ * NOTE: These functions rely on base vis colors of the theme which are provided via a global
50
+ * singleton instance `EUI_VIS_COLOR_STORE` that's updated by the EuiProvider on theme change.
51
+ * Make sure the function is recalled on theme change to retrieve theme-related colors.
52
+ *
53
+ * Outside of a react component you can use the `subscibe()` method on the `EUI_VIS_COLOR_STORE`
54
+ * to subscribe to updates and update your usages to ensure latest colors are loaded.
55
+ */
56
+ var euiPaletteColorBlind = exports.euiPaletteColorBlind = function euiPaletteColorBlind() {
57
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
58
+ _ref2$rotations = _ref2.rotations,
59
+ rotations = _ref2$rotations === void 0 ? 1 : _ref2$rotations,
60
+ _ref2$order = _ref2.order,
61
+ order = _ref2$order === void 0 ? 'append' : _ref2$order,
62
+ _ref2$direction = _ref2.direction,
63
+ direction = _ref2$direction === void 0 ? 'lighter' : _ref2$direction,
64
+ _ref2$sortBy = _ref2.sortBy,
65
+ sortBy = _ref2$sortBy === void 0 ? 'default' : _ref2$sortBy,
66
+ _ref2$sortShift = _ref2.sortShift,
67
+ sortShift = _ref2$sortShift === void 0 ? '-100' : _ref2$sortShift,
68
+ colors = _ref2.colors;
69
+ var _colors = [];
70
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
71
+ var base = [visColors.euiColorVis0, visColors.euiColorVis1, visColors.euiColorVis2, visColors.euiColorVis3, visColors.euiColorVis4, visColors.euiColorVis5, visColors.euiColorVis6, visColors.euiColorVis7, visColors.euiColorVis8, visColors.euiColorVis9];
72
+ if (sortBy === 'natural') {
73
+ // Sort the colors based on the color wheel, but shifting the values based on sortShift
74
+ base = _toConsumableArray(base).sort(function (a, b) {
75
+ return (0, _chromaJs["default"])(a).set('hsl.h', sortShift).hsl()[0] - (0, _chromaJs["default"])(b).set('hsl.h', sortShift).hsl()[0];
76
+ });
77
+ }
78
+ if (rotations > 1) {
79
+ var palettes = base.map(function (color) {
80
+ // Create the darkest and lightest versions of each color using black and white
81
+ var palette = (0, _color_palette.colorPalette)(['black', color, 'white'], 5, false, true);
82
+ // Then removing the extremes
83
+ palette.pop();
84
+ palette.shift();
85
+ switch (direction) {
86
+ case 'lighter':
87
+ return (0, _color_palette.colorPalette)([palette[1], palette[2]], rotations, false, true);
88
+ case 'darker':
89
+ return (0, _color_palette.colorPalette)([palette[1], palette[0]], rotations, false, true);
90
+ case 'both':
91
+ return (0, _color_palette.colorPalette)(palette, rotations, false, true);
92
+ }
93
+ });
94
+ if (order === 'group') {
95
+ _colors = flatten(palettes);
96
+ } else {
97
+ var _loop = function _loop(i) {
98
+ var _colors2;
99
+ var rotation = palettes.map(function (palette) {
100
+ return palette[i];
101
+ });
102
+ (_colors2 = _colors).push.apply(_colors2, _toConsumableArray(rotation));
103
+ };
104
+ for (var i = 0; i < rotations; i++) {
105
+ _loop(i);
106
+ }
107
+ }
108
+ } else {
109
+ _colors = base;
110
+ }
111
+ return _colors;
112
+ };
113
+
114
+ /**
115
+ * For usage in React use the `useEuiPaletteColorBlindBehindText` hook instead.
116
+ *
117
+ * Color blind palette with text is meant for use when text is applied on top of the color.
118
+ * It increases the brightness of the color to give the text more contrast.
119
+ *
120
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
121
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
122
+ */
123
+ var euiPaletteColorBlindBehindText = exports.euiPaletteColorBlindBehindText = function euiPaletteColorBlindBehindText() {
124
+ var paletteProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
125
+ var originalPalette = euiPaletteColorBlind(paletteProps);
126
+ return originalPalette;
127
+ };
128
+
129
+ /**
130
+ * For usage in React use the `useEuiPaletteForStatus` hook instead.
131
+ *
132
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
133
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
134
+ */
135
+ var euiPaletteForStatus = exports.euiPaletteForStatus = function euiPaletteForStatus(steps) {
136
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
137
+ colors = _ref3.colors;
138
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
139
+ if (steps === 1) {
140
+ return [visColors.euiColorVisSuccess0];
141
+ }
142
+ if (steps <= 3) {
143
+ return euiPalette([visColors.euiColorVisSuccess0, visColors.euiColorVisWarning1, visColors.euiColorVisDanger0], steps, true);
144
+ }
145
+ return euiPalette([visColors.euiColorVisSuccess0, visColors.euiColorVisSuccess1, visColors.euiColorVisWarning1, visColors.euiColorVisDanger1, visColors.euiColorVisDanger0], steps, true);
146
+ };
147
+
148
+ /**
149
+ * For usage in React use the `useEuiPaletteForTemperature` hook instead.
150
+ *
151
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
152
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
153
+ */
154
+ var euiPaletteForTemperature = exports.euiPaletteForTemperature = function euiPaletteForTemperature(steps) {
155
+ var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
156
+ colors = _ref4.colors;
157
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
158
+ if (steps === 1) {
159
+ return [visColors.euiColorVisCool2];
160
+ } else if (steps <= 3) {
161
+ return euiPalette([visColors.euiColorVisCool2, visColors.euiColorVisWarm2], steps, true);
162
+ }
163
+ var cools = (0, _color_palette.colorPalette)([visColors.euiColorVisCool2, visColors.euiColorVisCool1, visColors.euiColorVisCool0], 3);
164
+ var warms = (0, _color_palette.colorPalette)([visColors.euiColorVisWarm0, visColors.euiColorVisWarm1, visColors.euiColorVisWarm2], 3);
165
+ var paletteColors = [].concat(_toConsumableArray(cools), [visColors.euiColorVisBase0], _toConsumableArray(warms));
166
+ return euiPalette(paletteColors, steps, true);
167
+ };
168
+
169
+ /**
170
+ * For usage in React use the `useEuiPaletteComplementary` hook instead.
171
+ *
172
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
173
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
174
+ */
175
+ var euiPaletteComplementary = exports.euiPaletteComplementary = function euiPaletteComplementary(steps) {
176
+ var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
177
+ colors = _ref5.colors;
178
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
179
+ if (steps === 1) {
180
+ return [visColors.euiColorVisComplementary0];
181
+ }
182
+ var paletteColors = [visColors.euiColorVisComplementary0, visColors.euiColorVisBase0, visColors.euiColorVisComplementary1];
183
+ return euiPalette(paletteColors, steps, true);
184
+ };
185
+
186
+ /**
187
+ * For usage in React use the `useEuiPaletteRed` hook instead.
188
+ *
189
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
190
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
191
+ */
192
+ var euiPaletteRed = exports.euiPaletteRed = function euiPaletteRed(steps) {
193
+ var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
194
+ colors = _ref6.colors;
195
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
196
+ if (steps === 1) {
197
+ return [visColors.euiColorVisDanger1];
198
+ }
199
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisDanger0], steps);
200
+ };
201
+
202
+ /**
203
+ * For usage in React use the `useEuiPaletteGreen` hook instead.
204
+ *
205
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
206
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
207
+ */
208
+ var euiPaletteGreen = exports.euiPaletteGreen = function euiPaletteGreen(steps) {
209
+ var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
210
+ colors = _ref7.colors;
211
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
212
+ if (steps === 1) {
213
+ return [visColors.euiColorVisSuccess1];
214
+ }
215
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisSuccess0], steps);
216
+ };
217
+
218
+ /**
219
+ * For usage in React use the `useEuiPaletteSkyBlue` hook instead.
220
+ *
221
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
222
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
223
+ */
224
+ var euiPaletteSkyBlue = exports.euiPaletteSkyBlue = function euiPaletteSkyBlue(steps) {
225
+ var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
226
+ colors = _ref8.colors;
227
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
228
+ if (steps === 1) {
229
+ return [visColors.euiColorVisNeutral1];
230
+ }
231
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisNeutral0], steps);
232
+ };
233
+
234
+ /**
235
+ * For usage in React use the `useEuiPaletteYellow` hook instead.
236
+ *
237
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
238
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
239
+ */
240
+ var euiPaletteYellow = exports.euiPaletteYellow = function euiPaletteYellow(steps) {
241
+ var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
242
+ colors = _ref9.colors;
243
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
244
+ if (steps === 1) {
245
+ return [visColors.euiColorVisWarning1];
246
+ }
247
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisWarning0], steps);
248
+ };
249
+
250
+ /**
251
+ * For usage in React use the `useEuiPaletteOrange` hook instead.
252
+ *
253
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
254
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
255
+ */
256
+ var euiPaletteOrange = exports.euiPaletteOrange = function euiPaletteOrange(steps) {
257
+ var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
258
+ colors = _ref10.colors;
259
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
260
+ if (steps === 1) {
261
+ return [visColors.euiColorVisRisk1];
262
+ }
263
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisRisk0], steps);
264
+ };
265
+
266
+ /**
267
+ * For usage in React use the `useEuiPaletteCool` hook instead.
268
+ *
269
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
270
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
271
+ */
272
+ var euiPaletteCool = exports.euiPaletteCool = function euiPaletteCool(steps) {
273
+ var _ref11 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
274
+ colors = _ref11.colors;
275
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
276
+ if (steps === 1) {
277
+ return [visColors.euiColorVisCool1];
278
+ }
279
+ return euiPalette([visColors.euiColorVisCool0, visColors.euiColorVisCool1, visColors.euiColorVisCool2], steps);
280
+ };
281
+
282
+ /**
283
+ * For usage in React use the `useEuiPaletteWarm` hook instead.
284
+ *
285
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
286
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
287
+ */
288
+ var euiPaletteWarm = exports.euiPaletteWarm = function euiPaletteWarm(steps) {
289
+ var _ref12 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
290
+ colors = _ref12.colors;
291
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
292
+ if (steps === 1) {
293
+ return [visColors.euiColorVisWarm2];
294
+ }
295
+ return euiPalette([visColors.euiColorVisWarm0, visColors.euiColorVisWarm1, visColors.euiColorVisWarm2], steps);
296
+ };
297
+
298
+ /**
299
+ * For usage in React use the `useEuiPaletteGray` hook instead.
300
+ *
301
+ * NOTE: This function is not pure. It relies on `EUI_VIS_COLOR_STORE` which is updated by the
302
+ * EuiProvider on theme change. Ensure to recall the function on theme change or subscribe to the store.
303
+ */
304
+ var euiPaletteGray = exports.euiPaletteGray = function euiPaletteGray(steps) {
305
+ var _ref13 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
306
+ colors = _ref13.colors;
307
+ var visColors = colors !== null && colors !== void 0 ? colors : getDefaultVisColors();
308
+ if (steps === 1) {
309
+ return [visColors.euiColorVisGrey1];
310
+ }
311
+ return euiPalette([visColors.euiColorVisBase0, visColors.euiColorVisGrey0, visColors.euiColorVisGrey1, visColors.euiColorVisGrey2, visColors.euiColorVisGrey3], steps, false);
312
+ };
@@ -1 +1,3 @@
1
+ export * from './color_palette';
2
+ export * from './eui_palettes';
1
3
  export * from './vis_color_store';
@@ -3,6 +3,28 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _color_palette = require("./color_palette");
7
+ Object.keys(_color_palette).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _color_palette[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _color_palette[key];
14
+ }
15
+ });
16
+ });
17
+ var _eui_palettes = require("./eui_palettes");
18
+ Object.keys(_eui_palettes).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _eui_palettes[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _eui_palettes[key];
25
+ }
26
+ });
27
+ });
6
28
  var _vis_color_store = require("./vis_color_store");
7
29
  Object.keys(_vis_color_store).forEach(function (key) {
8
30
  if (key === "default" || key === "__esModule") return;
@@ -24,6 +24,6 @@ declare class EuiVisColorStoreImpl implements _EuiVisColorStore {
24
24
  }
25
25
  export declare class EuiVisColorStore {
26
26
  private static instance;
27
- static getInstance(defaultColors: _EuiThemeVisColors): EuiVisColorStoreImpl;
27
+ static getInstance(defaultColors?: _EuiThemeVisColors): EuiVisColorStoreImpl;
28
28
  }
29
29
  export {};
@@ -13,7 +13,7 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
13
13
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14
14
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
16
+ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /*
17
17
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
18
  * or more contributor license agreements. Licensed under the Elastic License
19
19
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
@@ -73,6 +73,9 @@ var EuiVisColorStore = exports.EuiVisColorStore = /*#__PURE__*/function () {
73
73
  key: "getInstance",
74
74
  value: function getInstance(defaultColors) {
75
75
  if (!this.instance) {
76
+ if (!defaultColors) {
77
+ throw new Error('EuiVisColorStore was accessed before it was initialized with default colors. ' + 'Import a theme package (e.g. `@elastic/eui-theme-borealis`) or `@elastic/eui` first.');
78
+ }
76
79
  this.instance = new EuiVisColorStoreImpl({
77
80
  defaultColors: defaultColors
78
81
  });