@splunk/themes 0.8.0 → 0.10.1
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/getTheme.js +19 -1
- package/package.json +19 -4
- package/prisma/dark.js +6 -6
- package/prisma/light.js +5 -5
- package/types/prisma/dark.d.ts +1 -1
- package/types/prisma/light.d.ts +1 -1
- package/types/storybook-addon-splunk-themes/SplunkThemesTool.d.ts +2 -1
- 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.1 - April 5, 2022
|
|
5
|
+
----------
|
|
6
|
+
Bug Fixes:
|
|
7
|
+
* Pinned `styled-components@5.1.1` to avoid breaking changes introduced in `styled-components@5.2.0`.
|
|
8
|
+
|
|
9
|
+
**`@splunk/themes` is incompatible with styled-components version(s) `^5.2.0`**.
|
|
10
|
+
|
|
11
|
+
`styled-components@5.2.0` changed how selectors like `& + &` are compiled; [styled-components PR#3236](https://github.com/styled-components/styled-components/pull/3236).
|
|
12
|
+
This breaks styles that worked in previous versions of styled-components; [styled-components issue #3265](https://github.com/styled-components/styled-components/issues/3265).
|
|
13
|
+
|
|
14
|
+
**Until noted otherwise in a future release of `@splunk/themes` do not use `styled-components@^5.2.0` with` @splunk/themes`**.
|
|
15
|
+
|
|
16
|
+
0.10.0 - February 23, 2022
|
|
17
|
+
----------
|
|
18
|
+
New Features:
|
|
19
|
+
* Utility variables, `isPrisma`, `isEnterprise`, `isComfortable`, `isCompact`, `isDark`, and `isLight`, added to `useSplunkTheme()` and `withSplunkTheme()` (SUI-2376).
|
|
20
|
+
|
|
21
|
+
0.9.0 - September 8, 2021
|
|
22
|
+
----------
|
|
23
|
+
API Changes:
|
|
24
|
+
* Prisma content colors no longer use transparency (SUI-2688).
|
|
25
|
+
|
|
4
26
|
0.8.0 - March 31, 2021
|
|
5
27
|
----------
|
|
6
28
|
New Features:
|
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.1",
|
|
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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"lint:ci": "yarn run lint -- -f junit -o test-reports/lint-results.xml",
|
|
9
9
|
"start": "babel src -d . --watch --ignore src/babel-plugin-base64-png,src/tests --extensions .js,.ts,.tsx",
|
|
10
10
|
"test": "jest",
|
|
11
|
-
"test:ci": "JEST_JUNIT_OUTPUT_DIR=./test-reports JEST_JUNIT_OUTPUT_NAME=unit-results.xml JEST_JUNIT_CLASSNAME=unit yarn run test --ci --reporters=default jest-junit --coverage --coverageDirectory=coverage_report/coverage_maps_unit --coverageReporters=
|
|
11
|
+
"test:ci": "JEST_JUNIT_OUTPUT_DIR=./test-reports JEST_JUNIT_OUTPUT_NAME=unit-results.xml JEST_JUNIT_CLASSNAME=unit yarn run test --ci --reporters=default jest-junit --coverage --coverageDirectory=coverage_report/coverage_maps_unit --coverageReporters=cobertura",
|
|
12
12
|
"test:watch": "jest --watch",
|
|
13
13
|
"types:build": "tsc",
|
|
14
14
|
"types:start": "yarn types:build --watch"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@storybook/components": ">= 6.x",
|
|
21
21
|
"@storybook/theming": ">= 6.x",
|
|
22
22
|
"react": "^16.8",
|
|
23
|
-
"styled-components": "
|
|
23
|
+
"styled-components": "5.1.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependenciesMeta": {
|
|
26
26
|
"react": {
|
|
@@ -28,6 +28,21 @@
|
|
|
28
28
|
},
|
|
29
29
|
"styled-components": {
|
|
30
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
|
|
31
46
|
}
|
|
32
47
|
},
|
|
33
48
|
"license": "Apache-2.0",
|
|
@@ -68,7 +83,7 @@
|
|
|
68
83
|
"eslint-plugin-react-hooks": "^4.0.5",
|
|
69
84
|
"jest": "^25.1.0",
|
|
70
85
|
"react": "^16.12.0",
|
|
71
|
-
"styled-components": "
|
|
86
|
+
"styled-components": "5.1.1",
|
|
72
87
|
"typescript": "^4.0.5"
|
|
73
88
|
},
|
|
74
89
|
"engines": {
|
package/prisma/dark.js
CHANGED
|
@@ -29,17 +29,17 @@ var backgroundColors = {
|
|
|
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
|
@@ -29,17 +29,17 @@ var backgroundColors = {
|
|
|
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
|
package/types/prisma/dark.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ 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;
|
package/types/prisma/light.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ 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;
|
|
@@ -4,6 +4,7 @@ declare type ThemeOption = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
values: string[];
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
declare type ThemeOptions = Pick<Record<keyof ThemeSettings, ThemeOption>, 'family' | 'colorScheme' | 'density'>;
|
|
8
|
+
export declare const themeOptions: ThemeOptions;
|
|
8
9
|
export declare const SplunkThemesTool: FunctionComponent;
|
|
9
10
|
export {};
|
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 (
|