@splunk/themes 0.20.0 → 0.22.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/CHANGELOG.md +12 -0
- package/enterprise/dark.js +28 -1
- package/enterprise/light.js +28 -2
- package/enterprise/prismaAliases.js +0 -6
- package/package.json +1 -1
- package/prisma/base.js +1 -3
- package/prisma/dark.js +31 -15
- package/prisma/light.js +31 -15
- package/storybook-addon-splunk-themes/SplunkThemesTool.js +16 -24
- package/storybook-addon-splunk-themes/tests/util.unit.js +63 -0
- package/storybook-addon-splunk-themes/themeOptions.js +28 -0
- package/storybook-addon-splunk-themes/util.js +57 -2
- package/storybook-addon-splunk-themes/withSplunkTheme.js +112 -2
- package/types/enterprise/dark.d.ts +18 -1
- package/types/enterprise/light.d.ts +18 -1
- package/types/enterprise/prismaAliases.d.ts +0 -6
- package/types/prisma/base.d.ts +10 -15
- package/types/prisma/dark.d.ts +12 -6
- package/types/prisma/light.d.ts +12 -6
- package/types/storybook-addon-splunk-themes/SplunkThemesTool.d.ts +0 -8
- package/types/storybook-addon-splunk-themes/tests/util.unit.d.ts +1 -0
- package/types/storybook-addon-splunk-themes/themeOptions.d.ts +11 -0
- package/types/storybook-addon-splunk-themes/util.d.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
0.22.0 - October 1, 2024
|
|
5
|
+
----------
|
|
6
|
+
New Features:
|
|
7
|
+
* New Status Color tokens for weak and strong variants (SUI-6348).
|
|
8
|
+
* `@splunk/themes/storybook-addon-splunk-themes` now supports showing both versions of a single theme setting side by side (SUI-6281).
|
|
9
|
+
|
|
10
|
+
0.21.0 - August 26, 2024
|
|
11
|
+
----------
|
|
12
|
+
New Features:
|
|
13
|
+
* Prisma `focusColor` transparency removed to increase contrast and meet accessibility requirements (SUI-6519).
|
|
14
|
+
|
|
4
15
|
0.20.0 - August 7, 2024
|
|
5
16
|
----------
|
|
17
|
+
New Features:
|
|
6
18
|
* Prisma light theme's `interactiveColorBorder` value has been updated to meet accessibility requirements (SUI-6342).
|
|
7
19
|
|
|
8
20
|
0.19.0 - June 4, 2024
|
package/enterprise/dark.js
CHANGED
|
@@ -35,6 +35,33 @@ var dark = {
|
|
|
35
35
|
focusShadowInset: "inset 0 0 1px 1px ".concat(_light["default"].gray25, ", inset 0 0 0 3px ").concat(_light["default"].focusColor),
|
|
36
36
|
draggableBackground: "url('data:image/png;base64,".concat(dragHandleDark, "') 0 0 / 8px 8px repeat")
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* ## Status colors
|
|
40
|
+
* Status colors are reserved for communicating urgency and severity associated with data objects and to categorize the visual communication of system responses.
|
|
41
|
+
*
|
|
42
|
+
* @colorSet verbose
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
var statusColors = {
|
|
46
|
+
statusColorInfo: _light["default"].infoColorL10,
|
|
47
|
+
statusColorInfoWeak: _light["default"].infoColor,
|
|
48
|
+
statusColorInfoStrong: _light["default"].infoColorL20,
|
|
49
|
+
statusColorNormal: _light["default"].successColorL10,
|
|
50
|
+
statusColorNormalWeak: _light["default"].successColor,
|
|
51
|
+
statusColorNormalStrong: _light["default"].successColorL20,
|
|
52
|
+
statusColorLow: _light["default"].warningColorL10,
|
|
53
|
+
statusColorLowWeak: _light["default"].warningColor,
|
|
54
|
+
statusColorLowStrong: _light["default"].warningColorL20,
|
|
55
|
+
statusColorMedium: _light["default"].alertColorL10,
|
|
56
|
+
statusColorMediumWeak: _light["default"].alertColor,
|
|
57
|
+
statusColorMediumStrong: _light["default"].alertColorL20,
|
|
58
|
+
statusColorHigh: _light["default"].errorColorL10,
|
|
59
|
+
statusColorHighWeak: _light["default"].errorColor,
|
|
60
|
+
statusColorHighStrong: _light["default"].errorColorL20,
|
|
61
|
+
statusColorCritical: _light["default"].errorColorD20,
|
|
62
|
+
statusColorCriticalWeak: _light["default"].errorColorD30,
|
|
63
|
+
statusColorCriticalStrong: _light["default"].errorColorD10
|
|
64
|
+
};
|
|
38
65
|
/**
|
|
39
66
|
* ## Syntax colors
|
|
40
67
|
* Syntax colors are used only for code blocks.
|
|
@@ -63,7 +90,7 @@ var bordersInteractive = {
|
|
|
63
90
|
activeBorder: "".concat(dark.borderActiveColor, " double")
|
|
64
91
|
};
|
|
65
92
|
|
|
66
|
-
var theme = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _light["default"]), dark), syntaxColors), bordersInteractive), {}, {
|
|
93
|
+
var theme = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _light["default"]), dark), statusColors), syntaxColors), bordersInteractive), {}, {
|
|
67
94
|
borderLightColor: _light["default"].gray60 // @deprecated, SUI-5981
|
|
68
95
|
|
|
69
96
|
});
|
package/enterprise/light.js
CHANGED
|
@@ -273,6 +273,33 @@ var usageColors = {
|
|
|
273
273
|
backgroundColor: grays.white,
|
|
274
274
|
transparent: 'transparent'
|
|
275
275
|
};
|
|
276
|
+
/**
|
|
277
|
+
* ## Status colors
|
|
278
|
+
* Status colors are reserved for communicating urgency and severity associated with data objects and to categorize the visual communication of system responses.
|
|
279
|
+
*
|
|
280
|
+
* @colorSet verbose
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
var statusColors = {
|
|
284
|
+
statusColorInfo: infoColors.infoColorL10,
|
|
285
|
+
statusColorInfoWeak: infoColors.infoColorL20,
|
|
286
|
+
statusColorInfoStrong: infoColors.infoColor,
|
|
287
|
+
statusColorNormal: successColors.successColorL10,
|
|
288
|
+
statusColorNormalWeak: successColors.successColorL20,
|
|
289
|
+
statusColorNormalStrong: successColors.successColor,
|
|
290
|
+
statusColorLow: warningColors.warningColorL10,
|
|
291
|
+
statusColorLowWeak: warningColors.warningColorL20,
|
|
292
|
+
statusColorLowStrong: warningColors.warningColor,
|
|
293
|
+
statusColorMedium: alertColors.alertColorL10,
|
|
294
|
+
statusColorMediumWeak: alertColors.alertColorL20,
|
|
295
|
+
statusColorMediumStrong: alertColors.alertColor,
|
|
296
|
+
statusColorHigh: errorColors.errorColorL10,
|
|
297
|
+
statusColorHighWeak: errorColors.errorColorL20,
|
|
298
|
+
statusColorHighStrong: errorColors.errorColor,
|
|
299
|
+
statusColorCritical: errorColors.errorColorD20,
|
|
300
|
+
statusColorCriticalWeak: errorColors.errorColorD30,
|
|
301
|
+
statusColorCriticalStrong: errorColors.errorColorD10
|
|
302
|
+
};
|
|
276
303
|
/**
|
|
277
304
|
* ## Syntax colors
|
|
278
305
|
* The following colors should only be used for syntax coloring of code.
|
|
@@ -331,7 +358,6 @@ var backgrounds = {
|
|
|
331
358
|
*/
|
|
332
359
|
|
|
333
360
|
var borders = {
|
|
334
|
-
borderRadius: '3px',
|
|
335
361
|
border: "1px solid ".concat(usageColors.borderColor)
|
|
336
362
|
};
|
|
337
363
|
var sansFontFamily = "'Splunk Platform Sans', 'Proxima Nova', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif";
|
|
@@ -379,7 +405,7 @@ var zindexes = {
|
|
|
379
405
|
zindexToastMessages: 2000
|
|
380
406
|
};
|
|
381
407
|
|
|
382
|
-
var theme = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, brandColors), grays), accentColors), errorColors), alertColors), warningColors), successColors), infoColors), categoricalColors), divergingColors), syntaxColors), fontFamily), fontWeights), usageColors), backgrounds), shadows), bordersInteractive), borders), zindexes), {}, {
|
|
408
|
+
var theme = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, brandColors), grays), accentColors), errorColors), alertColors), warningColors), successColors), infoColors), categoricalColors), divergingColors), statusColors), syntaxColors), fontFamily), fontWeights), usageColors), backgrounds), shadows), bordersInteractive), borders), zindexes), {}, {
|
|
383
409
|
borderLightColor: grays.gray92 // @deprecated SUI-5981
|
|
384
410
|
|
|
385
411
|
});
|
|
@@ -61,12 +61,6 @@ function createPrismaAliases(_ref) {
|
|
|
61
61
|
accentColorWarning: cs.warningColor,
|
|
62
62
|
accentColorAlert: cs.alertColor,
|
|
63
63
|
accentColorNegative: cs.errorColor,
|
|
64
|
-
statusColorInfo: cs.infoColorL10,
|
|
65
|
-
statusColorNormal: cs.successColorL10,
|
|
66
|
-
statusColorLow: cs.warningColorL10,
|
|
67
|
-
statusColorMedium: cs.alertColorL10,
|
|
68
|
-
statusColorHigh: cs.errorColorL10,
|
|
69
|
-
statusColorCritical: cs.errorColorD20,
|
|
70
64
|
embossShadow: cs.overlayShadow,
|
|
71
65
|
dragShadow: cs.overlayShadow,
|
|
72
66
|
modalShadow: cs.overlayShadow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/themes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Theme variables and mixins for the Splunk design language",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"babel": "babel src -d . --ignore src/babel-plugin-base64-png,src/tests --ignore \"**/docs\" --extensions .js,.ts,.tsx",
|
package/prisma/base.js
CHANGED
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
-
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
|
|
9
|
-
|
|
10
8
|
var _dataViz = _interopRequireDefault(require("./dataViz"));
|
|
11
9
|
|
|
12
10
|
var _light = _interopRequireDefault(require("./light"));
|
|
@@ -35,7 +33,7 @@ function createPrismaBase(_ref) {
|
|
|
35
33
|
*/
|
|
36
34
|
|
|
37
35
|
var usageColors = {
|
|
38
|
-
focusColor:
|
|
36
|
+
focusColor: colorSchemeVars.interactiveColorPrimary,
|
|
39
37
|
transparent: 'transparent',
|
|
40
38
|
linkColor: colorSchemeVars.interactiveColorPrimary
|
|
41
39
|
};
|
package/prisma/dark.js
CHANGED
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
+
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
8
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
9
13
|
|
|
10
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -79,33 +83,45 @@ var neutralColors = {
|
|
|
79
83
|
neutral500: '#acacad',
|
|
80
84
|
white: '#ffffff'
|
|
81
85
|
};
|
|
82
|
-
/**
|
|
83
|
-
* ## Accent colors
|
|
84
|
-
* Accent colors aid and categorize the visual communication of the system response.
|
|
85
|
-
*
|
|
86
|
-
* @colorSet verbose
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
var accentColors = {
|
|
90
|
-
accentColorPositive: '#85f415',
|
|
91
|
-
accentColorWarning: '#f49106',
|
|
92
|
-
accentColorAlert: '#f0581f',
|
|
93
|
-
accentColorNegative: '#ff4242'
|
|
94
|
-
};
|
|
95
86
|
/**
|
|
96
87
|
* ## Status colors
|
|
97
|
-
* Status colors are reserved for communicating urgency and severity associated with data objects.
|
|
88
|
+
* Status colors are reserved for communicating urgency and severity associated with data objects and to categorize the visual communication of system responses.
|
|
98
89
|
*
|
|
99
90
|
* @colorSet verbose
|
|
100
91
|
*/
|
|
101
92
|
|
|
102
93
|
var statusColors = {
|
|
103
94
|
statusColorInfo: '#61cafa',
|
|
95
|
+
statusColorInfoWeak: (0, _tinycolor["default"])('#61cafa').darken(10).toHexString(),
|
|
96
|
+
statusColorInfoStrong: (0, _tinycolor["default"])('#61cafa').lighten(10).toHexString(),
|
|
104
97
|
statusColorNormal: '#85f415',
|
|
98
|
+
statusColorNormalWeak: (0, _tinycolor["default"])('#85f415').darken(10).toHexString(),
|
|
99
|
+
statusColorNormalStrong: (0, _tinycolor["default"])('#85f415').lighten(10).toHexString(),
|
|
105
100
|
statusColorLow: '#2cbda3',
|
|
101
|
+
statusColorLowWeak: (0, _tinycolor["default"])('#2cbda3').darken(10).toHexString(),
|
|
102
|
+
statusColorLowStrong: (0, _tinycolor["default"])('#2cbda3').lighten(10).toHexString(),
|
|
106
103
|
statusColorMedium: '#f49106',
|
|
104
|
+
statusColorMediumWeak: (0, _tinycolor["default"])('#f49106').darken(10).toHexString(),
|
|
105
|
+
statusColorMediumStrong: (0, _tinycolor["default"])('#f49106').lighten(10).toHexString(),
|
|
107
106
|
statusColorHigh: '#ff4242',
|
|
108
|
-
|
|
107
|
+
statusColorHighWeak: (0, _tinycolor["default"])('#ff4242').darken(10).toHexString(),
|
|
108
|
+
statusColorHighStrong: (0, _tinycolor["default"])('#ff4242').lighten(10).toHexString(),
|
|
109
|
+
statusColorCritical: '#ff3361',
|
|
110
|
+
statusColorCriticalWeak: (0, _tinycolor["default"])('#ff3361').darken(10).toHexString(),
|
|
111
|
+
statusColorCriticalStrong: (0, _tinycolor["default"])('#ff3361').lighten(10).toHexString()
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* ## Accent colors
|
|
115
|
+
* Accent colors aid and categorize the visual communication of the system response.
|
|
116
|
+
*
|
|
117
|
+
* @colorSet verbose
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
var accentColors = {
|
|
121
|
+
accentColorPositive: statusColors.statusColorNormal,
|
|
122
|
+
accentColorWarning: statusColors.statusColorMedium,
|
|
123
|
+
accentColorAlert: '#f0581f',
|
|
124
|
+
accentColorNegative: statusColors.statusColorHigh
|
|
109
125
|
};
|
|
110
126
|
/**
|
|
111
127
|
* ## Elevation shadows
|
package/prisma/light.js
CHANGED
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
+
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
8
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
9
13
|
|
|
10
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -79,33 +83,45 @@ var neutralColors = {
|
|
|
79
83
|
neutral500: '#b8b8b8',
|
|
80
84
|
black: '#000000'
|
|
81
85
|
};
|
|
82
|
-
/**
|
|
83
|
-
* ## Accent colors
|
|
84
|
-
* Accent colors aid and categorize the visual communication of the system response.
|
|
85
|
-
*
|
|
86
|
-
* @colorSet verbose
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
var accentColors = {
|
|
90
|
-
accentColorPositive: '#407a06',
|
|
91
|
-
accentColorWarning: '#c97705',
|
|
92
|
-
accentColorAlert: '#c6400d',
|
|
93
|
-
accentColorNegative: '#e00000'
|
|
94
|
-
};
|
|
95
86
|
/**
|
|
96
87
|
* ## Status colors
|
|
97
|
-
* Status colors are reserved for communicating urgency and severity associated with data objects.
|
|
88
|
+
* Status colors are reserved for communicating urgency and severity associated with data objects and to categorize the visual communication of system responses.
|
|
98
89
|
*
|
|
99
90
|
* @colorSet verbose
|
|
100
91
|
*/
|
|
101
92
|
|
|
102
93
|
var statusColors = {
|
|
103
94
|
statusColorInfo: '#006be5',
|
|
95
|
+
statusColorInfoWeak: (0, _tinycolor["default"])('#006be5').lighten(10).toHexString(),
|
|
96
|
+
statusColorInfoStrong: (0, _tinycolor["default"])('#006be5').darken(10).toHexString(),
|
|
104
97
|
statusColorNormal: '#407a06',
|
|
98
|
+
statusColorNormalWeak: (0, _tinycolor["default"])('#407a06').lighten(10).toHexString(),
|
|
99
|
+
statusColorNormalStrong: (0, _tinycolor["default"])('#407a06').darken(10).toHexString(),
|
|
105
100
|
statusColorLow: '#155a4e',
|
|
101
|
+
statusColorLowWeak: (0, _tinycolor["default"])('#155a4e').lighten(10).toHexString(),
|
|
102
|
+
statusColorLowStrong: (0, _tinycolor["default"])('#155a4e').darken(10).toHexString(),
|
|
106
103
|
statusColorMedium: '#c97705',
|
|
104
|
+
statusColorMediumWeak: (0, _tinycolor["default"])('#c97705').lighten(10).toHexString(),
|
|
105
|
+
statusColorMediumStrong: (0, _tinycolor["default"])('#c97705').darken(10).toHexString(),
|
|
107
106
|
statusColorHigh: '#e00000',
|
|
108
|
-
|
|
107
|
+
statusColorHighWeak: (0, _tinycolor["default"])('#e00000').lighten(10).toHexString(),
|
|
108
|
+
statusColorHighStrong: (0, _tinycolor["default"])('#e00000').darken(10).toHexString(),
|
|
109
|
+
statusColorCritical: '#9e1534',
|
|
110
|
+
statusColorCriticalWeak: (0, _tinycolor["default"])('#9e1534').lighten(10).toHexString(),
|
|
111
|
+
statusColorCriticalStrong: (0, _tinycolor["default"])('#9e1534').darken(10).toHexString()
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* ## Accent colors
|
|
115
|
+
* Accent colors aid and categorize the visual communication of the system response.
|
|
116
|
+
*
|
|
117
|
+
* @colorSet verbose
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
var accentColors = {
|
|
121
|
+
accentColorPositive: statusColors.statusColorNormal,
|
|
122
|
+
accentColorWarning: statusColors.statusColorMedium,
|
|
123
|
+
accentColorAlert: '#c6400d',
|
|
124
|
+
accentColorNegative: statusColors.statusColorHigh
|
|
109
125
|
};
|
|
110
126
|
/**
|
|
111
127
|
* ## Elevation shadows
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SplunkThemesTool =
|
|
8
|
+
exports.SplunkThemesTool = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -15,6 +15,8 @@ var _components = require("@storybook/components");
|
|
|
15
15
|
|
|
16
16
|
var _constants = require("./constants");
|
|
17
17
|
|
|
18
|
+
var _themeOptions = require("./themeOptions");
|
|
19
|
+
|
|
18
20
|
var _themes = require("./themes");
|
|
19
21
|
|
|
20
22
|
var _util = require("./util");
|
|
@@ -23,9 +25,13 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
23
25
|
|
|
24
26
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
27
|
|
|
26
|
-
function
|
|
28
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
29
|
+
|
|
30
|
+
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."); }
|
|
31
|
+
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
27
33
|
|
|
28
|
-
function
|
|
34
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
35
|
|
|
30
36
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
37
|
|
|
@@ -41,21 +47,6 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
41
47
|
|
|
42
48
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
49
|
|
|
44
|
-
var themeOptions = {
|
|
45
|
-
family: {
|
|
46
|
-
name: 'Family',
|
|
47
|
-
values: ['prisma', 'enterprise']
|
|
48
|
-
},
|
|
49
|
-
colorScheme: {
|
|
50
|
-
name: 'Color Scheme',
|
|
51
|
-
values: ['light', 'dark']
|
|
52
|
-
},
|
|
53
|
-
density: {
|
|
54
|
-
name: 'Density',
|
|
55
|
-
values: ['compact', 'comfortable']
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.themeOptions = themeOptions;
|
|
59
50
|
var SplunkThemesTool = /*#__PURE__*/(0, _react.memo)(function () {
|
|
60
51
|
var _React$useState = _react["default"].useState(false),
|
|
61
52
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -68,21 +59,22 @@ var SplunkThemesTool = /*#__PURE__*/(0, _react.memo)(function () {
|
|
|
68
59
|
updateGlobals = _useGlobals2[1];
|
|
69
60
|
|
|
70
61
|
var params = (0, _managerApi.useParameter)(_constants.PARAM_KEY, {});
|
|
71
|
-
var globalsTheme = globals[_constants.PARAM_KEY];
|
|
62
|
+
var globalsTheme = globals[_constants.PARAM_KEY] || undefined;
|
|
72
63
|
var currentTheme = (0, _util.normalizeThemeOptions)(params, globalsTheme);
|
|
73
64
|
var updateTheme = (0, _react.useCallback)(function (newTheme) {
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
var mergedTheme = (0, _util.getMergedTheme)(globalsTheme, newTheme);
|
|
66
|
+
updateGlobals(_defineProperty({}, _constants.PARAM_KEY, mergedTheme));
|
|
67
|
+
}, [globalsTheme, updateGlobals]);
|
|
76
68
|
return /*#__PURE__*/_react["default"].createElement(_components.WithTooltip, {
|
|
77
69
|
placement: "top",
|
|
78
70
|
trigger: "click",
|
|
79
71
|
tooltip: function tooltip() {
|
|
80
|
-
return Object.keys(themeOptions).map(function (themeOptionKey) {
|
|
81
|
-
var themeOptionValues = themeOptions[themeOptionKey];
|
|
72
|
+
return Object.keys(_themeOptions.themeOptions).map(function (themeOptionKey) {
|
|
73
|
+
var themeOptionValues = _themeOptions.themeOptions[themeOptionKey];
|
|
82
74
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
83
75
|
key: themeOptionKey
|
|
84
76
|
}, /*#__PURE__*/_react["default"].createElement(_themes.TooltipSectionTitle, null, themeOptionValues.name), /*#__PURE__*/_react["default"].createElement(_components.TooltipLinkList, {
|
|
85
|
-
links: themeOptionValues.values.map(function (themeValue) {
|
|
77
|
+
links: [].concat(_toConsumableArray(themeOptionValues.values), ['both']).map(function (themeValue) {
|
|
86
78
|
var active = currentTheme[themeOptionKey] === themeValue;
|
|
87
79
|
return {
|
|
88
80
|
active: active,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _util = require("../util");
|
|
4
|
+
|
|
5
|
+
describe('getMergedTheme', function () {
|
|
6
|
+
// Storybook will set "null" for "globalsTheme" in some situtations so we need to validate that this doesn't throw
|
|
7
|
+
it('should not throw if globalsTheme is null', function () {
|
|
8
|
+
expect((0, _util.getMergedTheme)(null, {})).toStrictEqual({});
|
|
9
|
+
});
|
|
10
|
+
it('should merge two different keys correctly', function () {
|
|
11
|
+
expect((0, _util.getMergedTheme)({
|
|
12
|
+
density: 'compact'
|
|
13
|
+
}, {
|
|
14
|
+
colorScheme: 'dark'
|
|
15
|
+
})).toStrictEqual({
|
|
16
|
+
colorScheme: 'dark',
|
|
17
|
+
density: 'compact'
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
it('should merge the same key correctly', function () {
|
|
21
|
+
expect((0, _util.getMergedTheme)({
|
|
22
|
+
density: 'compact'
|
|
23
|
+
}, {
|
|
24
|
+
density: 'comfortable'
|
|
25
|
+
})).toStrictEqual({
|
|
26
|
+
density: 'comfortable'
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should pass through properties that only exist on one side of the merge', function () {
|
|
30
|
+
expect((0, _util.getMergedTheme)({
|
|
31
|
+
density: 'compact'
|
|
32
|
+
}, {
|
|
33
|
+
colorScheme: 'dark',
|
|
34
|
+
density: 'comfortable'
|
|
35
|
+
})).toStrictEqual({
|
|
36
|
+
colorScheme: 'dark',
|
|
37
|
+
density: 'comfortable'
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it('should pass through "both"', function () {
|
|
41
|
+
expect((0, _util.getMergedTheme)({
|
|
42
|
+
density: 'compact'
|
|
43
|
+
}, {
|
|
44
|
+
colorScheme: 'both',
|
|
45
|
+
density: 'comfortable'
|
|
46
|
+
})).toStrictEqual({
|
|
47
|
+
colorScheme: 'both',
|
|
48
|
+
density: 'comfortable'
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('should reset values "both" in globalsTheme to its default if the new theme has "both"', function () {
|
|
52
|
+
expect((0, _util.getMergedTheme)({
|
|
53
|
+
density: 'both',
|
|
54
|
+
family: 'prisma'
|
|
55
|
+
}, {
|
|
56
|
+
colorScheme: 'both'
|
|
57
|
+
})).toStrictEqual({
|
|
58
|
+
colorScheme: 'both',
|
|
59
|
+
density: 'comfortable',
|
|
60
|
+
family: 'prisma'
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isThemeOptionKey = isThemeOptionKey;
|
|
7
|
+
exports.themeOptions = exports.themeOptionsKeys = void 0;
|
|
8
|
+
var themeOptionsKeys = ['family', 'colorScheme', 'density'];
|
|
9
|
+
exports.themeOptionsKeys = themeOptionsKeys;
|
|
10
|
+
var themeOptions = {
|
|
11
|
+
family: {
|
|
12
|
+
name: 'family',
|
|
13
|
+
values: ['prisma', 'enterprise']
|
|
14
|
+
},
|
|
15
|
+
colorScheme: {
|
|
16
|
+
name: 'colorScheme',
|
|
17
|
+
values: ['dark', 'light']
|
|
18
|
+
},
|
|
19
|
+
density: {
|
|
20
|
+
name: 'density',
|
|
21
|
+
values: ['comfortable', 'compact']
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.themeOptions = themeOptions;
|
|
25
|
+
|
|
26
|
+
function isThemeOptionKey(key) {
|
|
27
|
+
return themeOptionsKeys.includes(key);
|
|
28
|
+
}
|
|
@@ -3,10 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getThemeOptionsFromContext = exports.normalizeThemeOptions = void 0;
|
|
6
|
+
exports.getThemeOptionsFromContext = exports.getMergedTheme = exports.normalizeThemeOptions = void 0;
|
|
7
7
|
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
|
|
10
|
+
var _themeOptions = require("./themeOptions");
|
|
11
|
+
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
+
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
+
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
|
|
10
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
11
25
|
|
|
12
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -17,10 +31,51 @@ var normalizeThemeOptions = function normalizeThemeOptions() {
|
|
|
17
31
|
var paramOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
32
|
var globalOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
33
|
return _objectSpread(_objectSpread({}, paramOptions), globalOptions);
|
|
20
|
-
};
|
|
34
|
+
}; // merge the existing theme with the newly selected theme
|
|
35
|
+
// this functon only allows the most recently-selectd "both" option to persist
|
|
36
|
+
// because allowing more than one "both" leads to an unwieldy visualization
|
|
37
|
+
|
|
21
38
|
|
|
22
39
|
exports.normalizeThemeOptions = normalizeThemeOptions;
|
|
23
40
|
|
|
41
|
+
var getMergedTheme = function getMergedTheme(globalsTheme, newTheme) {
|
|
42
|
+
var firstBothEntry = Object.entries(newTheme).find(function (_ref) {
|
|
43
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
44
|
+
value = _ref2[1];
|
|
45
|
+
|
|
46
|
+
return value === 'both';
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
var _ref3 = firstBothEntry || [],
|
|
50
|
+
_ref4 = _slicedToArray(_ref3, 1),
|
|
51
|
+
firstBothOption = _ref4[0];
|
|
52
|
+
|
|
53
|
+
var finalValue; // only allow "both" for a single theme setting; if a new one is passed, remove the old one
|
|
54
|
+
|
|
55
|
+
var mergedTheme = Object.entries(_themeOptions.themeOptions).reduce(function (themeAccum, _ref5) {
|
|
56
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
57
|
+
key = _ref6[0];
|
|
58
|
+
|
|
59
|
+
if ((0, _themeOptions.isThemeOptionKey)(key)) {
|
|
60
|
+
if ((globalsTheme === null || globalsTheme === void 0 ? void 0 : globalsTheme[key]) === 'both' && firstBothOption != null && key !== firstBothOption) {
|
|
61
|
+
var defaultThemeOptionValue = _themeOptions.themeOptions[key].values[0];
|
|
62
|
+
finalValue = defaultThemeOptionValue;
|
|
63
|
+
} else {
|
|
64
|
+
finalValue = newTheme[key] || (globalsTheme === null || globalsTheme === void 0 ? void 0 : globalsTheme[key]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (finalValue != null) {
|
|
68
|
+
return _objectSpread(_objectSpread({}, themeAccum), {}, _defineProperty({}, key, finalValue));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return themeAccum;
|
|
73
|
+
}, {});
|
|
74
|
+
return mergedTheme;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.getMergedTheme = getMergedTheme;
|
|
78
|
+
|
|
24
79
|
var getThemeOptionsFromContext = function getThemeOptionsFromContext(context) {
|
|
25
80
|
var globals = context.globals,
|
|
26
81
|
parameters = context.parameters;
|
|
@@ -1,29 +1,139 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.withSplunkTheme = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
15
|
|
|
10
16
|
var _SplunkThemeProvider = _interopRequireDefault(require("../SplunkThemeProvider"));
|
|
11
17
|
|
|
18
|
+
var _variables = _interopRequireDefault(require("../variables"));
|
|
19
|
+
|
|
12
20
|
var _constants = require("./constants");
|
|
13
21
|
|
|
14
22
|
var _themes = require("./themes");
|
|
15
23
|
|
|
24
|
+
var _themeOptions = require("./themeOptions");
|
|
25
|
+
|
|
16
26
|
var _util = require("./util");
|
|
17
27
|
|
|
18
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
29
|
|
|
30
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
|
+
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
50
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
51
|
+
|
|
52
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
+
|
|
54
|
+
function _templateObject2() {
|
|
55
|
+
var data = _taggedTemplateLiteral(["\n display: flex;\n gap: ", ";\n flex-direction: column;\n"]);
|
|
56
|
+
|
|
57
|
+
_templateObject2 = function _templateObject2() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _templateObject() {
|
|
65
|
+
var data = _taggedTemplateLiteral(["\n background-color: ", ";\n padding: ", ";\n"]);
|
|
66
|
+
|
|
67
|
+
_templateObject = function _templateObject() {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
75
|
+
|
|
76
|
+
var StoryWrapper = _styledComponents["default"].div(_templateObject(), _variables["default"].backgroundColorPage, _variables["default"].spacingLarge);
|
|
77
|
+
|
|
78
|
+
var DualStoryContainer = _styledComponents["default"].div(_templateObject2(), _variables["default"].spacingLarge);
|
|
79
|
+
|
|
80
|
+
// Renders a story twice side-by-side in two separate color schemes
|
|
81
|
+
var DualStory = function DualStory(_ref) {
|
|
82
|
+
var _children$props;
|
|
83
|
+
|
|
84
|
+
var children = _ref.children,
|
|
85
|
+
context = _ref.context,
|
|
86
|
+
themeOption = _ref.themeOption,
|
|
87
|
+
themeProviderProps = _ref.themeProviderProps;
|
|
88
|
+
|
|
89
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(children) && (children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.componentId)) {
|
|
90
|
+
var _themeOptions$themeOp;
|
|
91
|
+
|
|
92
|
+
var themeOptionValues = ((_themeOptions$themeOp = _themeOptions.themeOptions[themeOption]) === null || _themeOptions$themeOp === void 0 ? void 0 : _themeOptions$themeOp.values) || [];
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(DualStoryContainer, null, themeOptionValues.map(function (themeOptionValue) {
|
|
94
|
+
return /*#__PURE__*/_react["default"].createElement(_SplunkThemeProvider["default"], _extends({
|
|
95
|
+
key: themeOptionValue
|
|
96
|
+
}, themeProviderProps, _defineProperty({}, themeOption, themeOptionValue)), /*#__PURE__*/_react["default"].createElement(StoryWrapper, null, children.props.undecoratedStoryFn(context)));
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
|
|
101
|
+
};
|
|
102
|
+
|
|
20
103
|
var WithSplunkTheme = function WithSplunkTheme(Story, context) {
|
|
21
104
|
var globals = context.globals,
|
|
22
105
|
parameters = context.parameters;
|
|
23
106
|
var globalsTheme = globals[_constants.PARAM_KEY];
|
|
24
107
|
var themesConfig = parameters[_constants.PARAM_KEY];
|
|
25
108
|
var currentTheme = (0, _util.normalizeThemeOptions)(themesConfig, globalsTheme);
|
|
26
|
-
|
|
109
|
+
var dualThemeOption = null; // ideally fromPairs would be fromEntries but our ES2015 target doesn't allow this
|
|
110
|
+
|
|
111
|
+
var cleanedThemeProviderProps = (0, _lodash.fromPairs)(Object.entries(currentTheme).filter(function (_ref3) {
|
|
112
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
113
|
+
key = _ref4[0],
|
|
114
|
+
value = _ref4[1];
|
|
115
|
+
|
|
116
|
+
if ((0, _themeOptions.isThemeOptionKey)(key) && value === 'both') {
|
|
117
|
+
dualThemeOption = key;
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return true;
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
var themeProviderProps = _objectSpread({}, cleanedThemeProviderProps);
|
|
125
|
+
|
|
126
|
+
if (dualThemeOption != null && currentTheme[dualThemeOption] === 'both') {
|
|
127
|
+
return /*#__PURE__*/_react["default"].createElement(DualStory, {
|
|
128
|
+
context: context,
|
|
129
|
+
themeOption: dualThemeOption,
|
|
130
|
+
themeProviderProps: cleanedThemeProviderProps
|
|
131
|
+
}, /*#__PURE__*/_react["default"].createElement(Story, context));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return /*#__PURE__*/_react["default"].createElement(_SplunkThemeProvider["default"], _extends({}, cleanedThemeProviderProps, {
|
|
135
|
+
colorScheme: themeProviderProps.colorScheme
|
|
136
|
+
}), /*#__PURE__*/_react["default"].createElement(_themes.GlobalStyles, null), /*#__PURE__*/_react["default"].createElement(Story, context));
|
|
27
137
|
};
|
|
28
138
|
|
|
29
139
|
var withSplunkTheme = WithSplunkTheme;
|
|
@@ -10,6 +10,24 @@ declare const theme: {
|
|
|
10
10
|
syntaxPurple: string;
|
|
11
11
|
syntaxRed: string;
|
|
12
12
|
syntaxTeal: string;
|
|
13
|
+
statusColorInfo: string;
|
|
14
|
+
statusColorInfoWeak: string;
|
|
15
|
+
statusColorInfoStrong: string;
|
|
16
|
+
statusColorNormal: string;
|
|
17
|
+
statusColorNormalWeak: string;
|
|
18
|
+
statusColorNormalStrong: string;
|
|
19
|
+
statusColorLow: string;
|
|
20
|
+
statusColorLowWeak: string;
|
|
21
|
+
statusColorLowStrong: string;
|
|
22
|
+
statusColorMedium: string;
|
|
23
|
+
statusColorMediumWeak: string;
|
|
24
|
+
statusColorMediumStrong: string;
|
|
25
|
+
statusColorHigh: string;
|
|
26
|
+
statusColorHighWeak: string;
|
|
27
|
+
statusColorHighStrong: string;
|
|
28
|
+
statusColorCritical: string;
|
|
29
|
+
statusColorCriticalWeak: string;
|
|
30
|
+
statusColorCriticalStrong: string;
|
|
13
31
|
backgroundColor: string;
|
|
14
32
|
backgroundColorHover: string;
|
|
15
33
|
borderColor: string;
|
|
@@ -32,7 +50,6 @@ declare const theme: {
|
|
|
32
50
|
zindexModal: number;
|
|
33
51
|
zindexPopover: number;
|
|
34
52
|
zindexToastMessages: number;
|
|
35
|
-
borderRadius: string;
|
|
36
53
|
focusShadow: string;
|
|
37
54
|
overlayShadow: string;
|
|
38
55
|
focusColor: string;
|
|
@@ -6,7 +6,6 @@ declare const theme: {
|
|
|
6
6
|
zindexModal: number;
|
|
7
7
|
zindexPopover: number;
|
|
8
8
|
zindexToastMessages: number;
|
|
9
|
-
borderRadius: string;
|
|
10
9
|
border: string;
|
|
11
10
|
activeBorder: string;
|
|
12
11
|
focusShadow: string;
|
|
@@ -49,6 +48,24 @@ declare const theme: {
|
|
|
49
48
|
syntaxRed: string;
|
|
50
49
|
syntaxRedLight: string;
|
|
51
50
|
syntaxTeal: string;
|
|
51
|
+
statusColorInfo: string;
|
|
52
|
+
statusColorInfoWeak: string;
|
|
53
|
+
statusColorInfoStrong: string;
|
|
54
|
+
statusColorNormal: string;
|
|
55
|
+
statusColorNormalWeak: string;
|
|
56
|
+
statusColorNormalStrong: string;
|
|
57
|
+
statusColorLow: string;
|
|
58
|
+
statusColorLowWeak: string;
|
|
59
|
+
statusColorLowStrong: string;
|
|
60
|
+
statusColorMedium: string;
|
|
61
|
+
statusColorMediumWeak: string;
|
|
62
|
+
statusColorMediumStrong: string;
|
|
63
|
+
statusColorHigh: string;
|
|
64
|
+
statusColorHighWeak: string;
|
|
65
|
+
statusColorHighStrong: string;
|
|
66
|
+
statusColorCritical: string;
|
|
67
|
+
statusColorCriticalWeak: string;
|
|
68
|
+
statusColorCriticalStrong: string;
|
|
52
69
|
diverging1ColorA: string;
|
|
53
70
|
diverging1ColorB: string;
|
|
54
71
|
diverging2ColorA: string;
|
|
@@ -7,12 +7,6 @@ declare function createPrismaAliases({ colorScheme, density, }: {
|
|
|
7
7
|
accentColorWarning: string;
|
|
8
8
|
accentColorAlert: string;
|
|
9
9
|
accentColorNegative: string;
|
|
10
|
-
statusColorInfo: string;
|
|
11
|
-
statusColorNormal: string;
|
|
12
|
-
statusColorLow: string;
|
|
13
|
-
statusColorMedium: string;
|
|
14
|
-
statusColorHigh: string;
|
|
15
|
-
statusColorCritical: string;
|
|
16
10
|
embossShadow: string;
|
|
17
11
|
dragShadow: string;
|
|
18
12
|
modalShadow: string;
|
package/types/prisma/base.d.ts
CHANGED
|
@@ -151,12 +151,7 @@ declare function createPrismaBase({ colorScheme }: {
|
|
|
151
151
|
divergent2L5: string;
|
|
152
152
|
divergent2L6: string;
|
|
153
153
|
divergent2L7: string;
|
|
154
|
-
divergent2D1: string;
|
|
155
|
-
* ## Layers
|
|
156
|
-
* If a variable does not suit your purpose, set a value relatively, such as zindexModal +1.
|
|
157
|
-
*
|
|
158
|
-
* @valueSet
|
|
159
|
-
*/
|
|
154
|
+
divergent2D1: string;
|
|
160
155
|
divergent2D2: string;
|
|
161
156
|
divergent2D3: string;
|
|
162
157
|
divergent2D4: string;
|
|
@@ -180,7 +175,11 @@ declare function createPrismaBase({ colorScheme }: {
|
|
|
180
175
|
categorical2L1: string;
|
|
181
176
|
categorical2L2: string;
|
|
182
177
|
categorical2L3: string;
|
|
183
|
-
categorical2L4: string;
|
|
178
|
+
categorical2L4: string; /**
|
|
179
|
+
* ## Font family
|
|
180
|
+
*
|
|
181
|
+
* @valueSet
|
|
182
|
+
*/
|
|
184
183
|
categorical2L5: string;
|
|
185
184
|
categorical2L6: string;
|
|
186
185
|
categorical2L7: string;
|
|
@@ -211,11 +210,7 @@ declare function createPrismaBase({ colorScheme }: {
|
|
|
211
210
|
static4: string;
|
|
212
211
|
static5: string;
|
|
213
212
|
static6: string;
|
|
214
|
-
static7: string;
|
|
215
|
-
* ## Misc. colors
|
|
216
|
-
*
|
|
217
|
-
* @colorSet verbose
|
|
218
|
-
*/
|
|
213
|
+
static7: string;
|
|
219
214
|
static8: string;
|
|
220
215
|
static9: string;
|
|
221
216
|
static10: string;
|
|
@@ -225,15 +220,15 @@ declare function createPrismaBase({ colorScheme }: {
|
|
|
225
220
|
static14: string;
|
|
226
221
|
static15: string;
|
|
227
222
|
static16: string;
|
|
228
|
-
static17: string;
|
|
229
|
-
static18: string;
|
|
230
|
-
static19: string;
|
|
231
223
|
/**
|
|
232
224
|
* ## Interactive state shadows
|
|
233
225
|
*
|
|
234
226
|
* @shadowSet
|
|
235
227
|
*
|
|
236
228
|
*/
|
|
229
|
+
static17: string;
|
|
230
|
+
static18: string;
|
|
231
|
+
static19: string;
|
|
237
232
|
static20: string;
|
|
238
233
|
focusColor: string;
|
|
239
234
|
transparent: string;
|
package/types/prisma/dark.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ## Background colors
|
|
3
|
-
* Background colors should be used only for backgrounds of higher level sections & containers of a UI.
|
|
4
|
-
*
|
|
5
|
-
* @colorSet verbose
|
|
6
|
-
*/
|
|
7
1
|
declare const theme: {
|
|
8
2
|
syntaxBlue: string;
|
|
9
3
|
syntaxBrown: string;
|
|
@@ -50,11 +44,23 @@ declare const theme: {
|
|
|
50
44
|
dragShadow: string;
|
|
51
45
|
modalShadow: string;
|
|
52
46
|
statusColorInfo: string;
|
|
47
|
+
statusColorInfoWeak: string;
|
|
48
|
+
statusColorInfoStrong: string;
|
|
53
49
|
statusColorNormal: string;
|
|
50
|
+
statusColorNormalWeak: string;
|
|
51
|
+
statusColorNormalStrong: string;
|
|
54
52
|
statusColorLow: string;
|
|
53
|
+
statusColorLowWeak: string;
|
|
54
|
+
statusColorLowStrong: string;
|
|
55
55
|
statusColorMedium: string;
|
|
56
|
+
statusColorMediumWeak: string;
|
|
57
|
+
statusColorMediumStrong: string;
|
|
56
58
|
statusColorHigh: string;
|
|
59
|
+
statusColorHighWeak: string;
|
|
60
|
+
statusColorHighStrong: string;
|
|
57
61
|
statusColorCritical: string;
|
|
62
|
+
statusColorCriticalWeak: string;
|
|
63
|
+
statusColorCriticalStrong: string;
|
|
58
64
|
accentColorPositive: string;
|
|
59
65
|
accentColorWarning: string;
|
|
60
66
|
accentColorAlert: string;
|
package/types/prisma/light.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ## Background colors
|
|
3
|
-
* Background colors should be used only for backgrounds of higher level sections & containers of a UI.
|
|
4
|
-
*
|
|
5
|
-
* @colorSet verbose
|
|
6
|
-
*/
|
|
7
1
|
declare const theme: {
|
|
8
2
|
syntaxBlue: string;
|
|
9
3
|
syntaxBrown: string;
|
|
@@ -50,11 +44,23 @@ declare const theme: {
|
|
|
50
44
|
dragShadow: string;
|
|
51
45
|
modalShadow: string;
|
|
52
46
|
statusColorInfo: string;
|
|
47
|
+
statusColorInfoWeak: string;
|
|
48
|
+
statusColorInfoStrong: string;
|
|
53
49
|
statusColorNormal: string;
|
|
50
|
+
statusColorNormalWeak: string;
|
|
51
|
+
statusColorNormalStrong: string;
|
|
54
52
|
statusColorLow: string;
|
|
53
|
+
statusColorLowWeak: string;
|
|
54
|
+
statusColorLowStrong: string;
|
|
55
55
|
statusColorMedium: string;
|
|
56
|
+
statusColorMediumWeak: string;
|
|
57
|
+
statusColorMediumStrong: string;
|
|
56
58
|
statusColorHigh: string;
|
|
59
|
+
statusColorHighWeak: string;
|
|
60
|
+
statusColorHighStrong: string;
|
|
57
61
|
statusColorCritical: string;
|
|
62
|
+
statusColorCriticalWeak: string;
|
|
63
|
+
statusColorCriticalStrong: string;
|
|
58
64
|
accentColorPositive: string;
|
|
59
65
|
accentColorWarning: string;
|
|
60
66
|
accentColorAlert: string;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ThemeSettings } from '../types';
|
|
3
|
-
type ThemeOption = {
|
|
4
|
-
name: string;
|
|
5
|
-
values: string[];
|
|
6
|
-
};
|
|
7
|
-
type ThemeOptions = Pick<Record<keyof ThemeSettings, ThemeOption>, 'family' | 'colorScheme' | 'density'>;
|
|
8
|
-
export declare const themeOptions: ThemeOptions;
|
|
9
2
|
export declare const SplunkThemesTool: React.MemoExoticComponent<() => JSX.Element>;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThemeSettings } from '../types';
|
|
2
|
+
export declare const themeOptionsKeys: readonly ["family", "colorScheme", "density"];
|
|
3
|
+
export type ThemeOptionKeys = typeof themeOptionsKeys[number];
|
|
4
|
+
type ThemeOption = {
|
|
5
|
+
name: ThemeOptionKeys;
|
|
6
|
+
values: string[];
|
|
7
|
+
};
|
|
8
|
+
export type ThemeOptions = Pick<Record<keyof ThemeSettings, ThemeOption>, ThemeOptionKeys>;
|
|
9
|
+
export declare const themeOptions: ThemeOptions;
|
|
10
|
+
export declare function isThemeOptionKey(key: string): key is ThemeOptionKeys;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { StoryContext } from '@storybook/types';
|
|
2
2
|
import { ThemeSettings } from '../types';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import { ThemeOptionKeys } from './themeOptions';
|
|
4
|
+
export interface ExtendedThemeSettings extends Omit<Pick<ThemeSettings, ThemeOptionKeys>, ThemeOptionKeys> {
|
|
5
|
+
colorScheme: ThemeSettings['colorScheme'] | 'both';
|
|
6
|
+
density: ThemeSettings['density'] | 'both';
|
|
7
|
+
family: ThemeSettings['family'] | 'both';
|
|
8
|
+
}
|
|
9
|
+
export declare const normalizeThemeOptions: (paramOptions?: {}, globalOptions?: {}) => Partial<ExtendedThemeSettings>;
|
|
10
|
+
export declare const getMergedTheme: (globalsTheme: Partial<ExtendedThemeSettings> | undefined | null, newTheme: Partial<ExtendedThemeSettings>) => {};
|
|
11
|
+
export declare const getThemeOptionsFromContext: (context: StoryContext) => Partial<ExtendedThemeSettings>;
|