@splunk/themes 0.7.0 → 0.10.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 +22 -0
- package/enterprise/dark.js +1 -1
- package/enterprise/light.js +1 -1
- package/enterprise/prismaAliases.js +18 -1
- package/getTheme.js +19 -1
- package/package.json +26 -1
- package/pick.js +1 -1
- package/prisma/dark.js +7 -7
- package/prisma/light.js +6 -6
- package/storybook-addon-splunk-themes/SplunkThemesTool.js +108 -0
- package/storybook-addon-splunk-themes/ThemedDocsContainer.js +45 -0
- package/storybook-addon-splunk-themes/addDecorator.js +11 -0
- package/storybook-addon-splunk-themes/addParameter.js +23 -0
- package/storybook-addon-splunk-themes/constants.js +18 -0
- package/storybook-addon-splunk-themes/index.js +37 -0
- package/storybook-addon-splunk-themes/preset.js +30 -0
- package/storybook-addon-splunk-themes/register.js +32 -0
- package/storybook-addon-splunk-themes/themes.js +44 -0
- package/storybook-addon-splunk-themes/util.js +32 -0
- package/storybook-addon-splunk-themes/withSplunkTheme.js +30 -0
- package/types/enterprise/prismaAliases.d.ts +1 -1
- package/types/pick.d.ts +1 -1
- package/types/prisma/dark.d.ts +2 -2
- package/types/prisma/light.d.ts +2 -2
- package/types/storybook-addon-splunk-themes/SplunkThemesTool.d.ts +10 -0
- package/types/storybook-addon-splunk-themes/ThemedDocsContainer.d.ts +7 -0
- package/types/storybook-addon-splunk-themes/addDecorator.d.ts +1 -0
- package/types/storybook-addon-splunk-themes/addParameter.d.ts +15 -0
- package/types/storybook-addon-splunk-themes/constants.d.ts +6 -0
- package/types/storybook-addon-splunk-themes/index.d.ts +4 -0
- package/types/storybook-addon-splunk-themes/preset.d.ts +2 -0
- package/types/storybook-addon-splunk-themes/register.d.ts +1 -0
- package/types/storybook-addon-splunk-themes/themes.d.ts +5 -0
- package/types/storybook-addon-splunk-themes/util.d.ts +4 -0
- package/types/storybook-addon-splunk-themes/withSplunkTheme.d.ts +2 -0
- package/types/types.d.ts +8 -0
- package/types/useSplunkTheme.d.ts +2 -2
- package/types/utils.d.ts +1 -1
- package/useSplunkTheme.js +2 -2
- package/utils.js +20 -2
- package/withSplunkTheme.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
0.10.0 - February 23, 2022
|
|
5
|
+
----------
|
|
6
|
+
New Features:
|
|
7
|
+
* Utility variables, `isPrisma`, `isEnterprise`, `isComfortable`, `isCompact`, `isDark`, and `isLight`, added to `useSplunkTheme()` and `withSplunkTheme()` (SUI-2376).
|
|
8
|
+
|
|
9
|
+
0.9.0 - September 8, 2021
|
|
10
|
+
----------
|
|
11
|
+
API Changes:
|
|
12
|
+
* Prisma content colors no longer use transparency (SUI-2688).
|
|
13
|
+
|
|
14
|
+
0.8.0 - March 31, 2021
|
|
15
|
+
----------
|
|
16
|
+
New Features:
|
|
17
|
+
* New variable `backgroundColorDialog`.
|
|
18
|
+
* New Storybook Add-on, `@splunk/themes/storybook-addon-splunk-themes`.
|
|
19
|
+
|
|
20
|
+
API Changes:
|
|
21
|
+
* `backgroundColorModal` has been removed. Instead, use the new variable `backgroundColorDialog`.
|
|
22
|
+
|
|
23
|
+
Bug Fixes:
|
|
24
|
+
* Enterprise `draggable` and `draggableDark` assets updated to improve contrast (SUI-2494).
|
|
25
|
+
|
|
4
26
|
0.7.0 - February 4, 2021
|
|
5
27
|
----------
|
|
6
28
|
|
package/enterprise/dark.js
CHANGED
|
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
15
|
|
|
16
16
|
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; }
|
|
17
17
|
|
|
18
|
-
var dragHandleDark = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/
|
|
18
|
+
var dragHandleDark = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAA1SURBVHgB7dKhEQAgDAPAhHmwSKZHYtmHVtZVVNTkXS53UeG57yPYazLmrB8o6h8QgPqBOAOboRAPJUGIOAAAAABJRU5ErkJggg=="; // see babel-plugin-base64-png
|
|
19
19
|
|
|
20
20
|
var dark = {
|
|
21
21
|
backgroundColor: _light["default"].gray20,
|
package/enterprise/light.js
CHANGED
|
@@ -11,7 +11,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
11
11
|
|
|
12
12
|
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; }
|
|
13
13
|
|
|
14
|
-
var dragHandle = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/
|
|
14
|
+
var dragHandle = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAA2SURBVHgB7dKhEQAgDAPAhDnxDMAcDIBnT1pZV1FRk3e53EWFc+2P4N3DmLN+oKh/QADqB+IMUKEQD/CeueAAAAAASUVORK5CYII="; // see babel-plugin-base64-pngimport {
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* # Brand Colors
|
|
@@ -36,6 +36,23 @@ function createPrismaAliases(_ref) {
|
|
|
36
36
|
*
|
|
37
37
|
* They cover all values except most `interactiveColor*` variables.
|
|
38
38
|
*
|
|
39
|
+
*
|
|
40
|
+
* For example, use
|
|
41
|
+
* ``` css
|
|
42
|
+
* const myClickable = styled(Clickable)`
|
|
43
|
+
* color: ${variables.contentColorDefault};
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
* instead of
|
|
47
|
+
* ``` css
|
|
48
|
+
* const myClickable = styled(Clickable)`
|
|
49
|
+
* color: ${pick({
|
|
50
|
+
* enterprise: variables.textColor;
|
|
51
|
+
* prisma: variables.contentColorDefault;
|
|
52
|
+
* })};
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
39
56
|
* @valueSet
|
|
40
57
|
*/
|
|
41
58
|
|
|
@@ -59,7 +76,7 @@ function createPrismaAliases(_ref) {
|
|
|
59
76
|
backgroundColorPage: cs.backgroundColor,
|
|
60
77
|
backgroundColorNavigation: cs.backgroundColor,
|
|
61
78
|
backgroundColorFloating: cs.backgroundColor,
|
|
62
|
-
|
|
79
|
+
backgroundColorDialog: cs.backgroundColor,
|
|
63
80
|
backgroundColorScrim: (0, _tinycolor["default"])(cs.gray30).setAlpha(0.8).toRgbString(),
|
|
64
81
|
contentColorActive: cs.textColor,
|
|
65
82
|
contentColorDefault: cs.textColor,
|
package/getTheme.js
CHANGED
|
@@ -41,6 +41,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
41
41
|
* @param {'prisma' | 'enterprise'} [options.family = 'prisma']
|
|
42
42
|
* @param {'dark' | 'light'} [options.colorScheme = 'dark']
|
|
43
43
|
* @param {'comfortable' | 'compact'} [options.density = 'comfortable']
|
|
44
|
+
* @param {Boolean} [options.isPrisma = true]
|
|
45
|
+
* @param {Boolean} [options.isEnterprise = false]
|
|
46
|
+
* @param {Boolean} [options.isComfortable = true]
|
|
47
|
+
* @param {Boolean} [options.isCompact = false]
|
|
48
|
+
* @param {Boolean} [options.isDark = true]
|
|
49
|
+
* @param {Boolean} [options.isLight = false]
|
|
44
50
|
* @returns {object} A flat object of all variables and their values.
|
|
45
51
|
* @public
|
|
46
52
|
*/
|
|
@@ -52,10 +58,22 @@ function getTheme() {
|
|
|
52
58
|
colorScheme = _addThemeDefaults.colorScheme,
|
|
53
59
|
density = _addThemeDefaults.density;
|
|
54
60
|
|
|
61
|
+
var isPrisma = family === 'prisma';
|
|
62
|
+
var isEnterprise = family === 'enterprise';
|
|
63
|
+
var isComfortable = density === 'comfortable';
|
|
64
|
+
var isCompact = density === 'compact';
|
|
65
|
+
var isDark = colorScheme === 'dark';
|
|
66
|
+
var isLight = colorScheme === 'light';
|
|
55
67
|
return Object.freeze(_objectSpread({
|
|
56
68
|
colorScheme: colorScheme,
|
|
57
69
|
density: density,
|
|
58
|
-
family: family
|
|
70
|
+
family: family,
|
|
71
|
+
isPrisma: isPrisma,
|
|
72
|
+
isEnterprise: isEnterprise,
|
|
73
|
+
isComfortable: isComfortable,
|
|
74
|
+
isCompact: isCompact,
|
|
75
|
+
isDark: isDark,
|
|
76
|
+
isLight: isLight
|
|
59
77
|
}, family === 'enterprise' ? (0, _enterprise["default"])({
|
|
60
78
|
colorScheme: colorScheme,
|
|
61
79
|
density: density
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/themes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Theme variables and mixins for the Splunk design language",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "cross-env NODE_ENV=production babel src -d . --ignore src/babel-plugin-base64-png,src/tests --extensions .js,.ts,.tsx && yarn types:build",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"types:start": "yarn types:build --watch"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
+
"@storybook/addon-docs": ">= 6.x",
|
|
18
|
+
"@storybook/addons": ">= 6.x",
|
|
19
|
+
"@storybook/api": ">= 6.x",
|
|
20
|
+
"@storybook/components": ">= 6.x",
|
|
21
|
+
"@storybook/theming": ">= 6.x",
|
|
17
22
|
"react": "^16.8",
|
|
18
23
|
"styled-components": "^5.1"
|
|
19
24
|
},
|
|
@@ -23,6 +28,21 @@
|
|
|
23
28
|
},
|
|
24
29
|
"styled-components": {
|
|
25
30
|
"optional": true
|
|
31
|
+
},
|
|
32
|
+
"@storybook/addon-docs": {
|
|
33
|
+
"optional": true
|
|
34
|
+
},
|
|
35
|
+
"@storybook/addons": {
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"@storybook/api": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"@storybook/components": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"@storybook/theming": {
|
|
45
|
+
"optional": true
|
|
26
46
|
}
|
|
27
47
|
},
|
|
28
48
|
"license": "Apache-2.0",
|
|
@@ -41,6 +61,11 @@
|
|
|
41
61
|
"@babel/core": "^7.2.0",
|
|
42
62
|
"@splunk/babel-preset": "^3.0.0",
|
|
43
63
|
"@splunk/eslint-config": "^4.0.0",
|
|
64
|
+
"@storybook/addon-docs": "^6.0.28",
|
|
65
|
+
"@storybook/addons": "^6.0.28",
|
|
66
|
+
"@storybook/api": "^6.0.28",
|
|
67
|
+
"@storybook/components": "^6.0.28",
|
|
68
|
+
"@storybook/theming": "^6.0.28",
|
|
44
69
|
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
|
45
70
|
"@typescript-eslint/parser": "^3.4.0",
|
|
46
71
|
"babel-eslint": "^10.1.0",
|
package/pick.js
CHANGED
|
@@ -62,7 +62,7 @@ var getThemeVariant = function getThemeVariant(tree, theme) {
|
|
|
62
62
|
* import { pick, variables } from '@splunk/themes';
|
|
63
63
|
*
|
|
64
64
|
* const Wrapper = styled.div`
|
|
65
|
-
*
|
|
65
|
+
* color: ${pick({
|
|
66
66
|
* enterprise: {
|
|
67
67
|
* light: variables.grey35,
|
|
68
68
|
* dark: variables.grey92,
|
package/prisma/dark.js
CHANGED
|
@@ -24,22 +24,22 @@ var backgroundColors = {
|
|
|
24
24
|
backgroundColorPage: '#111215',
|
|
25
25
|
backgroundColorNavigation: '#08090a',
|
|
26
26
|
backgroundColorFloating: '#ffffff',
|
|
27
|
-
|
|
27
|
+
backgroundColorDialog: '#1e2024',
|
|
28
28
|
backgroundColorScrim: 'rgba(0, 0, 0, 0.8)'
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* # Content Colors
|
|
32
|
-
* Content colors should be used for text, icons and dividers.
|
|
32
|
+
* Content colors should be used for text, icons and dividers.
|
|
33
33
|
*
|
|
34
34
|
* @colorSet verbose
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
var contentColors = {
|
|
38
|
-
contentColorActive: '
|
|
39
|
-
contentColorDefault: '
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
contentColorActive: '#fafafa',
|
|
39
|
+
contentColorDefault: '#b5b5b5',
|
|
40
|
+
contentColorDisabled: '#6b6b6b',
|
|
41
|
+
contentColorInverted: '#000000',
|
|
42
|
+
contentColorMuted: '#909090'
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* # Interactive Colors
|
package/prisma/light.js
CHANGED
|
@@ -24,22 +24,22 @@ var backgroundColors = {
|
|
|
24
24
|
backgroundColorPage: '#f9f9f9',
|
|
25
25
|
backgroundColorNavigation: '#f7f7f7',
|
|
26
26
|
backgroundColorFloating: '#000000',
|
|
27
|
-
|
|
27
|
+
backgroundColorDialog: '#ffffff',
|
|
28
28
|
backgroundColorScrim: 'rgba(255, 255, 255, 0.75)'
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* # Content Colors
|
|
32
|
-
* Content colors should be used for text, icons and dividers.
|
|
32
|
+
* Content colors should be used for text, icons and dividers.
|
|
33
33
|
*
|
|
34
34
|
* @colorSet verbose
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
var contentColors = {
|
|
38
38
|
contentColorActive: '#2c2c2c',
|
|
39
|
-
contentColorDefault: '
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
contentColorDefault: '#4d4d4d',
|
|
40
|
+
contentColorDisabled: '#878787',
|
|
41
|
+
contentColorInverted: '#ffffff',
|
|
42
|
+
contentColorMuted: '#6b6b6b'
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* # Interactive Colors
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SplunkThemesTool = exports.themeOptions = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _api = require("@storybook/api");
|
|
13
|
+
|
|
14
|
+
var _components = require("@storybook/components");
|
|
15
|
+
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
18
|
+
var _themes = require("./themes");
|
|
19
|
+
|
|
20
|
+
var _util = require("./util");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
|
+
|
|
24
|
+
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
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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
|
+
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
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."); }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
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
|
+
|
|
60
|
+
var SplunkThemesTool = function SplunkThemesTool() {
|
|
61
|
+
var _useGlobals = (0, _api.useGlobals)(),
|
|
62
|
+
_useGlobals2 = _slicedToArray(_useGlobals, 2),
|
|
63
|
+
globals = _useGlobals2[0],
|
|
64
|
+
updateGlobals = _useGlobals2[1];
|
|
65
|
+
|
|
66
|
+
var params = (0, _api.useParameter)(_constants.PARAM_KEY, {});
|
|
67
|
+
var globalsTheme = globals[_constants.PARAM_KEY];
|
|
68
|
+
var currentTheme = (0, _util.normalizeThemeOptions)(params, globalsTheme);
|
|
69
|
+
var updateTheme = (0, _react.useCallback)(function (newTheme) {
|
|
70
|
+
updateGlobals(_defineProperty({}, _constants.PARAM_KEY, _objectSpread(_objectSpread({}, globals[_constants.PARAM_KEY]), newTheme)));
|
|
71
|
+
}, [globals, updateGlobals]);
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement(_components.WithTooltip, {
|
|
73
|
+
placement: "top",
|
|
74
|
+
trigger: "click",
|
|
75
|
+
tooltip: function tooltip() {
|
|
76
|
+
return Object.keys(themeOptions).map(function (themeOptionKey) {
|
|
77
|
+
var themeOptionValues = themeOptions[themeOptionKey];
|
|
78
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
79
|
+
key: themeOptionKey
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(_themes.TooltipSectionTitle, null, themeOptionValues.name), /*#__PURE__*/_react["default"].createElement(_components.TooltipLinkList, {
|
|
81
|
+
links: themeOptionValues.values.map(function (themeValue) {
|
|
82
|
+
var active = currentTheme[themeOptionKey] === themeValue;
|
|
83
|
+
return {
|
|
84
|
+
active: active,
|
|
85
|
+
id: themeValue,
|
|
86
|
+
onClick: function onClick(e, clickProps) {
|
|
87
|
+
updateTheme(_defineProperty({}, themeOptionKey, clickProps.title));
|
|
88
|
+
},
|
|
89
|
+
right: active && /*#__PURE__*/_react["default"].createElement(_components.Icons, {
|
|
90
|
+
icon: "check"
|
|
91
|
+
}),
|
|
92
|
+
title: themeValue
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
closeOnClick: true
|
|
99
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.IconButton, {
|
|
100
|
+
key: "splunk-themes",
|
|
101
|
+
title: "Set options for @splunk/themes",
|
|
102
|
+
active: true
|
|
103
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.Icons, {
|
|
104
|
+
icon: "paintbrush"
|
|
105
|
+
})));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.SplunkThemesTool = SplunkThemesTool;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ThemedDocsContainer = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _blocks = require("@storybook/addon-docs/blocks");
|
|
11
|
+
|
|
12
|
+
var _theming = require("@storybook/theming");
|
|
13
|
+
|
|
14
|
+
var _themes = require("./themes");
|
|
15
|
+
|
|
16
|
+
var _util = require("./util");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
var ThemedDocsContainer = function ThemedDocsContainer(_ref) {
|
|
27
|
+
var children = _ref.children,
|
|
28
|
+
context = _ref.context;
|
|
29
|
+
var parameters = context.parameters;
|
|
30
|
+
var currentTheme = (0, _util.getThemeOptionsFromContext)(context);
|
|
31
|
+
|
|
32
|
+
var themedContext = _objectSpread(_objectSpread({}, context), {}, {
|
|
33
|
+
parameters: _objectSpread(_objectSpread({}, parameters), {}, {
|
|
34
|
+
docs: {
|
|
35
|
+
theme: currentTheme.colorScheme === 'dark' ? _theming.themes.dark : _theming.themes.light
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_blocks.DocsContainer, {
|
|
41
|
+
context: themedContext
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(_themes.GlobalStyles, null), children);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.ThemedDocsContainer = ThemedDocsContainer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.decorators = void 0;
|
|
7
|
+
|
|
8
|
+
var _withSplunkTheme = require("./withSplunkTheme");
|
|
9
|
+
|
|
10
|
+
var decorators = [_withSplunkTheme.withSplunkTheme];
|
|
11
|
+
exports.decorators = decorators;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parameters = void 0;
|
|
7
|
+
|
|
8
|
+
var _blocks = require("@storybook/addon-docs/blocks");
|
|
9
|
+
|
|
10
|
+
var _ThemedDocsContainer = require("./ThemedDocsContainer");
|
|
11
|
+
|
|
12
|
+
var parameters = {
|
|
13
|
+
docs: {
|
|
14
|
+
container: _ThemedDocsContainer.ThemedDocsContainer,
|
|
15
|
+
page: _blocks.DocsPage
|
|
16
|
+
},
|
|
17
|
+
splunkThemes: {
|
|
18
|
+
family: 'prisma',
|
|
19
|
+
colorScheme: 'dark',
|
|
20
|
+
density: 'comfortable'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.parameters = parameters;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CHANGED = exports.SET = exports.CONFIGURE = exports.UPDATE = exports.PARAM_KEY = exports.ADDON_ID = void 0;
|
|
7
|
+
var ADDON_ID = '@splunk/themes';
|
|
8
|
+
exports.ADDON_ID = ADDON_ID;
|
|
9
|
+
var PARAM_KEY = 'splunkThemes';
|
|
10
|
+
exports.PARAM_KEY = PARAM_KEY;
|
|
11
|
+
var UPDATE = "".concat(ADDON_ID, "/update");
|
|
12
|
+
exports.UPDATE = UPDATE;
|
|
13
|
+
var CONFIGURE = "".concat(ADDON_ID, "/configure");
|
|
14
|
+
exports.CONFIGURE = CONFIGURE;
|
|
15
|
+
var SET = "".concat(ADDON_ID, "/default");
|
|
16
|
+
exports.SET = SET;
|
|
17
|
+
var CHANGED = "".concat(ADDON_ID, "/changed");
|
|
18
|
+
exports.CHANGED = CHANGED;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SplunkThemesTool", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _SplunkThemesTool.SplunkThemesTool;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "withSplunkTheme", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _withSplunkTheme.withSplunkTheme;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ThemedDocsContainer", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _ThemedDocsContainer.ThemedDocsContainer;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getThemeOptionsFromContext", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _util.getThemeOptionsFromContext;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _SplunkThemesTool = require("./SplunkThemesTool");
|
|
32
|
+
|
|
33
|
+
var _withSplunkTheme = require("./withSplunkTheme");
|
|
34
|
+
|
|
35
|
+
var _ThemedDocsContainer = require("./ThemedDocsContainer");
|
|
36
|
+
|
|
37
|
+
var _util = require("./util");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.config = config;
|
|
7
|
+
exports.managerEntries = managerEntries;
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
16
|
+
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
22
|
+
function config() {
|
|
23
|
+
var entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
|
+
return [].concat(_toConsumableArray(entry), [require.resolve('./addDecorator'), require.resolve('./addParameter')]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function managerEntries() {
|
|
28
|
+
var entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
29
|
+
return [].concat(_toConsumableArray(entry), [require.resolve('./register')]);
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _addons = _interopRequireWildcard(require("@storybook/addons"));
|
|
8
|
+
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
|
|
11
|
+
var _SplunkThemesTool = require("./SplunkThemesTool");
|
|
12
|
+
|
|
13
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
+
|
|
19
|
+
_addons["default"].register(_constants.ADDON_ID, function () {
|
|
20
|
+
_addons["default"].add(_constants.ADDON_ID, {
|
|
21
|
+
title: 'splunk/themes',
|
|
22
|
+
type: _addons.types.TOOL,
|
|
23
|
+
match: function match(_ref) {
|
|
24
|
+
var viewMode = _ref.viewMode;
|
|
25
|
+
return !!(viewMode && viewMode.match(/^(story|docs)$/));
|
|
26
|
+
},
|
|
27
|
+
paramKey: _constants.PARAM_KEY,
|
|
28
|
+
render: function render() {
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement(_SplunkThemesTool.SplunkThemesTool, null);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TooltipSectionTitle = exports.GlobalStyles = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = require("styled-components");
|
|
9
|
+
|
|
10
|
+
var _theming = require("@storybook/theming");
|
|
11
|
+
|
|
12
|
+
var _mixins = _interopRequireDefault(require("../mixins"));
|
|
13
|
+
|
|
14
|
+
var _variables = _interopRequireDefault(require("../variables"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
function _templateObject() {
|
|
19
|
+
var data = _taggedTemplateLiteral(["\n .sb-show-main {\n ", ";\n background-color: ", ";\n }\n\n #docs-root, .sbdocs {\n background-color: ", ";\n }\n"]);
|
|
20
|
+
|
|
21
|
+
_templateObject = function _templateObject() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
+
|
|
30
|
+
var GlobalStyles = (0, _styledComponents.createGlobalStyle)(_templateObject(), _mixins["default"].reset('block'), _variables["default"].backgroundColorPage, _variables["default"].backgroundColorPage); // theming based on Storybook's <TooltipMessage>
|
|
31
|
+
|
|
32
|
+
exports.GlobalStyles = GlobalStyles;
|
|
33
|
+
|
|
34
|
+
var TooltipSectionTitle = _theming.styled.div(function (_ref) {
|
|
35
|
+
var theme = _ref.theme;
|
|
36
|
+
return {
|
|
37
|
+
color: theme.textColor,
|
|
38
|
+
fontWeight: theme.typography.weight.black,
|
|
39
|
+
lineHeight: '18px',
|
|
40
|
+
padding: '15px 15px 0 15px'
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
exports.TooltipSectionTitle = TooltipSectionTitle;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getThemeOptionsFromContext = exports.normalizeThemeOptions = void 0;
|
|
7
|
+
|
|
8
|
+
var _constants = require("./constants");
|
|
9
|
+
|
|
10
|
+
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
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
var normalizeThemeOptions = function normalizeThemeOptions() {
|
|
17
|
+
var paramOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
+
var globalOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
+
return _objectSpread(_objectSpread({}, paramOptions), globalOptions);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.normalizeThemeOptions = normalizeThemeOptions;
|
|
23
|
+
|
|
24
|
+
var getThemeOptionsFromContext = function getThemeOptionsFromContext(context) {
|
|
25
|
+
var globals = context.globals,
|
|
26
|
+
parameters = context.parameters;
|
|
27
|
+
var globalsTheme = globals[_constants.PARAM_KEY];
|
|
28
|
+
var themesConfig = parameters[_constants.PARAM_KEY];
|
|
29
|
+
return normalizeThemeOptions(themesConfig, globalsTheme);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.getThemeOptionsFromContext = getThemeOptionsFromContext;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withSplunkTheme = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _SplunkThemeProvider = _interopRequireDefault(require("../SplunkThemeProvider"));
|
|
11
|
+
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
|
|
14
|
+
var _themes = require("./themes");
|
|
15
|
+
|
|
16
|
+
var _util = require("./util");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
var WithSplunkTheme = function WithSplunkTheme(Story, context) {
|
|
21
|
+
var globals = context.globals,
|
|
22
|
+
parameters = context.parameters;
|
|
23
|
+
var globalsTheme = globals[_constants.PARAM_KEY];
|
|
24
|
+
var themesConfig = parameters[_constants.PARAM_KEY];
|
|
25
|
+
var currentTheme = (0, _util.normalizeThemeOptions)(themesConfig, globalsTheme);
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_SplunkThemeProvider["default"], currentTheme, /*#__PURE__*/_react["default"].createElement(_themes.GlobalStyles, null), /*#__PURE__*/_react["default"].createElement(Story, context));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var withSplunkTheme = WithSplunkTheme;
|
|
30
|
+
exports.withSplunkTheme = withSplunkTheme;
|
|
@@ -22,7 +22,7 @@ declare function createPrismaAliases({ colorScheme, density, }: {
|
|
|
22
22
|
backgroundColorPage: string;
|
|
23
23
|
backgroundColorNavigation: string;
|
|
24
24
|
backgroundColorFloating: string;
|
|
25
|
-
|
|
25
|
+
backgroundColorDialog: string;
|
|
26
26
|
backgroundColorScrim: string;
|
|
27
27
|
contentColorActive: string;
|
|
28
28
|
contentColorDefault: string;
|
package/types/pick.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const getThemeVariant: <T extends AnyTheme, A extends object>(tre
|
|
|
12
12
|
* import { pick, variables } from '@splunk/themes';
|
|
13
13
|
*
|
|
14
14
|
* const Wrapper = styled.div`
|
|
15
|
-
*
|
|
15
|
+
* color: ${pick({
|
|
16
16
|
* enterprise: {
|
|
17
17
|
* light: variables.grey35,
|
|
18
18
|
* dark: variables.grey92,
|
package/types/prisma/dark.d.ts
CHANGED
|
@@ -33,16 +33,16 @@ declare const theme: {
|
|
|
33
33
|
white: string;
|
|
34
34
|
contentColorActive: string;
|
|
35
35
|
contentColorDefault: string;
|
|
36
|
-
contentColorMuted: string;
|
|
37
36
|
contentColorDisabled: string;
|
|
38
37
|
contentColorInverted: string;
|
|
38
|
+
contentColorMuted: string;
|
|
39
39
|
backgroundColorPopup: string;
|
|
40
40
|
backgroundColorSection: string;
|
|
41
41
|
backgroundColorSidebar: string;
|
|
42
42
|
backgroundColorPage: string;
|
|
43
43
|
backgroundColorNavigation: string;
|
|
44
44
|
backgroundColorFloating: string;
|
|
45
|
-
|
|
45
|
+
backgroundColorDialog: string;
|
|
46
46
|
backgroundColorScrim: string;
|
|
47
47
|
embossShadow: string;
|
|
48
48
|
overlayShadow: string;
|
package/types/prisma/light.d.ts
CHANGED
|
@@ -33,16 +33,16 @@ declare const theme: {
|
|
|
33
33
|
black: string;
|
|
34
34
|
contentColorActive: string;
|
|
35
35
|
contentColorDefault: string;
|
|
36
|
-
contentColorMuted: string;
|
|
37
36
|
contentColorDisabled: string;
|
|
38
37
|
contentColorInverted: string;
|
|
38
|
+
contentColorMuted: string;
|
|
39
39
|
backgroundColorPopup: string;
|
|
40
40
|
backgroundColorSection: string;
|
|
41
41
|
backgroundColorSidebar: string;
|
|
42
42
|
backgroundColorPage: string;
|
|
43
43
|
backgroundColorNavigation: string;
|
|
44
44
|
backgroundColorFloating: string;
|
|
45
|
-
|
|
45
|
+
backgroundColorDialog: string;
|
|
46
46
|
backgroundColorScrim: string;
|
|
47
47
|
embossShadow: string;
|
|
48
48
|
overlayShadow: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ThemeSettings } from '../types';
|
|
3
|
+
declare type ThemeOption = {
|
|
4
|
+
name: string;
|
|
5
|
+
values: string[];
|
|
6
|
+
};
|
|
7
|
+
declare type ThemeOptions = Pick<Record<keyof ThemeSettings, ThemeOption>, 'family' | 'colorScheme' | 'density'>;
|
|
8
|
+
export declare const themeOptions: ThemeOptions;
|
|
9
|
+
export declare const SplunkThemesTool: FunctionComponent;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decorators: import("@storybook/addons").StoryWrapper[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const parameters: {
|
|
3
|
+
docs: {
|
|
4
|
+
container: ({ children, context, }: {
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
context: import("@storybook/addons").StoryContext;
|
|
7
|
+
}) => import("react").ReactNode;
|
|
8
|
+
page: import("react").FC<{}>;
|
|
9
|
+
};
|
|
10
|
+
splunkThemes: {
|
|
11
|
+
family: string;
|
|
12
|
+
colorScheme: string;
|
|
13
|
+
density: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const GlobalStyles: import("styled-components").GlobalStyleComponent<import("../types").OptionalThemedProps<import("../types").AnyTheme> & import("../types").ThemedProps<import("../types").AnyTheme>, import("styled-components").DefaultTheme>;
|
|
3
|
+
export declare const TooltipSectionTitle: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "slot" | "style" | "title" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is"> & {
|
|
4
|
+
theme: import("@storybook/theming").Theme;
|
|
5
|
+
}, import("@storybook/theming").Theme>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { StoryContext } from '@storybook/addons';
|
|
2
|
+
import { ThemeSettings } from '../types';
|
|
3
|
+
export declare const normalizeThemeOptions: (paramOptions?: {}, globalOptions?: {}) => Partial<ThemeSettings>;
|
|
4
|
+
export declare const getThemeOptionsFromContext: (context: StoryContext) => Partial<ThemeSettings>;
|
package/types/types.d.ts
CHANGED
|
@@ -6,15 +6,23 @@ declare type Density = 'comfortable' | 'compact';
|
|
|
6
6
|
interface ThemeSettingsBase {
|
|
7
7
|
colorScheme: ColorScheme;
|
|
8
8
|
density: Density;
|
|
9
|
+
isPrisma: boolean;
|
|
10
|
+
isEnterprise: boolean;
|
|
11
|
+
isComfortable: boolean;
|
|
12
|
+
isCompact: boolean;
|
|
13
|
+
isDark: boolean;
|
|
14
|
+
isLight: boolean;
|
|
9
15
|
}
|
|
10
16
|
interface ThemeSettings<T extends AnyTheme = AnyTheme> extends ThemeSettingsBase {
|
|
11
17
|
family: T extends Enterprise ? 'enterprise' : 'prisma';
|
|
12
18
|
}
|
|
13
19
|
declare type Enterprise = EnterpriseVariables & ThemeSettingsBase & {
|
|
14
20
|
family: 'enterprise';
|
|
21
|
+
isEnterprise: true;
|
|
15
22
|
};
|
|
16
23
|
declare type Prisma = PrismaVariables & ThemeSettingsBase & {
|
|
17
24
|
family: 'prisma';
|
|
25
|
+
isPrisma: true;
|
|
18
26
|
};
|
|
19
27
|
declare type CustomizeTheme<T extends AnyTheme = AnyTheme> = {
|
|
20
28
|
bivarianceHack(theme: T): T;
|
|
@@ -10,11 +10,11 @@ import { AnyTheme } from './types';
|
|
|
10
10
|
* import useSplunkTheme from '@splunk/themes/useSplunkTheme';
|
|
11
11
|
* ...
|
|
12
12
|
* export function() {
|
|
13
|
-
* const {
|
|
13
|
+
* const { isComfortable, focusColor } = useSplunkTheme();
|
|
14
14
|
*
|
|
15
15
|
* const style = {
|
|
16
16
|
* color: focusColor,
|
|
17
|
-
* padding:
|
|
17
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
18
18
|
* }
|
|
19
19
|
*
|
|
20
20
|
* ...
|
package/types/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ThemeSettings, CustomizeTheme, AnyTheme } from './types';
|
|
|
4
4
|
* Accepts a theme object and returns supported values and defaults.
|
|
5
5
|
* @private
|
|
6
6
|
*/
|
|
7
|
-
export declare const addThemeDefaults: ({ family, colorScheme, density, }?: Partial<ThemeSettings>) => ThemeSettings;
|
|
7
|
+
export declare const addThemeDefaults: ({ family, colorScheme, density, isPrisma, isEnterprise, isComfortable, isCompact, isDark, isLight, }?: Partial<ThemeSettings>) => ThemeSettings;
|
|
8
8
|
declare function getCustomizedThemeUnmemo<T extends AnyTheme>(settings?: Partial<ThemeSettings<T>>, customizer?: CustomizeTheme<T>): T;
|
|
9
9
|
/**
|
|
10
10
|
* Accepts a theme object and customizer, and returns supported values and defaults.
|
package/useSplunkTheme.js
CHANGED
|
@@ -32,11 +32,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
32
32
|
* import useSplunkTheme from '@splunk/themes/useSplunkTheme';
|
|
33
33
|
* ...
|
|
34
34
|
* export function() {
|
|
35
|
-
* const {
|
|
35
|
+
* const { isComfortable, focusColor } = useSplunkTheme();
|
|
36
36
|
*
|
|
37
37
|
* const style = {
|
|
38
38
|
* color: focusColor,
|
|
39
|
-
* padding:
|
|
39
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
40
40
|
* }
|
|
41
41
|
*
|
|
42
42
|
* ...
|
package/utils.js
CHANGED
|
@@ -22,12 +22,30 @@ var addThemeDefaults = function addThemeDefaults() {
|
|
|
22
22
|
_ref$colorScheme = _ref.colorScheme,
|
|
23
23
|
colorScheme = _ref$colorScheme === void 0 ? 'dark' : _ref$colorScheme,
|
|
24
24
|
_ref$density = _ref.density,
|
|
25
|
-
density = _ref$density === void 0 ? 'comfortable' : _ref$density
|
|
25
|
+
density = _ref$density === void 0 ? 'comfortable' : _ref$density,
|
|
26
|
+
_ref$isPrisma = _ref.isPrisma,
|
|
27
|
+
isPrisma = _ref$isPrisma === void 0 ? true : _ref$isPrisma,
|
|
28
|
+
_ref$isEnterprise = _ref.isEnterprise,
|
|
29
|
+
isEnterprise = _ref$isEnterprise === void 0 ? false : _ref$isEnterprise,
|
|
30
|
+
_ref$isComfortable = _ref.isComfortable,
|
|
31
|
+
isComfortable = _ref$isComfortable === void 0 ? true : _ref$isComfortable,
|
|
32
|
+
_ref$isCompact = _ref.isCompact,
|
|
33
|
+
isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
|
|
34
|
+
_ref$isDark = _ref.isDark,
|
|
35
|
+
isDark = _ref$isDark === void 0 ? true : _ref$isDark,
|
|
36
|
+
_ref$isLight = _ref.isLight,
|
|
37
|
+
isLight = _ref$isLight === void 0 ? false : _ref$isLight;
|
|
26
38
|
|
|
27
39
|
return {
|
|
28
40
|
family: family,
|
|
29
41
|
colorScheme: colorScheme,
|
|
30
|
-
density: density
|
|
42
|
+
density: density,
|
|
43
|
+
isPrisma: isPrisma,
|
|
44
|
+
isEnterprise: isEnterprise,
|
|
45
|
+
isComfortable: isComfortable,
|
|
46
|
+
isCompact: isCompact,
|
|
47
|
+
isDark: isDark,
|
|
48
|
+
isLight: isLight
|
|
31
49
|
};
|
|
32
50
|
};
|
|
33
51
|
|
package/withSplunkTheme.js
CHANGED
|
@@ -50,11 +50,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
50
50
|
* };
|
|
51
51
|
*
|
|
52
52
|
* render() {
|
|
53
|
-
* const {
|
|
53
|
+
* const { isComfortable, focusColor } = this.props.splunkTheme;
|
|
54
54
|
*
|
|
55
55
|
* const style = {
|
|
56
56
|
* color: focusColor,
|
|
57
|
-
* padding:
|
|
57
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
58
58
|
* }
|
|
59
59
|
*
|
|
60
60
|
* return (
|