@splunk/themes 0.16.0 → 0.16.2

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 CHANGED
@@ -1,6 +1,19 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 0.16.2 - October 4, 2023
5
+ ----------
6
+ Bug Fixes:
7
+ * `typography` mixin's `title4`, `title5`, and `title6` should now correctly follow the font hierarchy (SUI-5668).
8
+ * `title5` is now larger and bolder than `title6` in Prisma themes.
9
+ * `title4` it now larger than `title6` in the Enterprise compact theme.
10
+ * `typography`'s mixin's `title5` color has been changed to `active` in prisma theme to match the Splunk Design System.
11
+
12
+ 0.16.1 - June 6, 2023
13
+ ----------
14
+ API Changes:
15
+ * Added support for the latest `styled-components@5` (SUI-5467).
16
+
4
17
  0.16.0 - April 6, 2023
5
18
  ----------
6
19
  New Features:
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _chai = require("chai");
4
-
5
- var _sinon = require("sinon");
6
-
7
3
  var _styledComponents = require("styled-components");
8
4
 
9
5
  var _variables = _interopRequireDefault(require("../../variables"));
@@ -36,80 +32,53 @@ describe('colorWithAlpha', function () {
36
32
  };
37
33
  it('sets alpha on a string value', function () {
38
34
  var result = (0, _utilityMixins.colorWithAlpha)('#70f', 0.5)(defaultProps);
39
-
40
- _chai.assert.strictEqual(result, 'rgba(119, 0, 255, 0.5)');
41
-
35
+ expect(result).toBe('rgba(119, 0, 255, 0.5)');
42
36
  var result2 = (0, _utilityMixins.colorWithAlpha)('#1700f3', 0.5)(defaultProps);
43
-
44
- _chai.assert.strictEqual(result2, 'rgba(23, 0, 243, 0.5)');
45
-
37
+ expect(result2).toBe('rgba(23, 0, 243, 0.5)');
46
38
  var result3 = (0, _utilityMixins.colorWithAlpha)('rgb(51, 162, 212)', 0.2)(defaultProps);
47
-
48
- _chai.assert.strictEqual(result3, 'rgba(51, 162, 212, 0.2)');
49
-
39
+ expect(result3).toBe('rgba(51, 162, 212, 0.2)');
50
40
  var result4 = (0, _utilityMixins.colorWithAlpha)('rgba(255, 255, 255, 0.7)', 0.2)(defaultProps);
51
-
52
- _chai.assert.strictEqual(result4, 'rgba(255, 255, 255, 0.2)');
41
+ expect(result4).toBe('rgba(255, 255, 255, 0.2)');
53
42
  });
54
43
  it('sets alpha on a variable', function () {
55
44
  var result = (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, 0.5)(defaultProps);
56
-
57
- _chai.assert.strictEqual(result, 'rgba(255, 255, 255, 0.5)');
58
-
45
+ expect(result).toBe('rgba(255, 255, 255, 0.5)');
59
46
  var result2 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].contentColorDefault, 0.2)(defaultProps);
60
-
61
- _chai.assert.strictEqual(result2, 'rgba(181, 181, 181, 0.2)');
62
-
47
+ expect(result2).toBe('rgba(181, 181, 181, 0.2)');
63
48
  var result3 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].contentColorDefault, 0.3)(enterpriseLightProps);
64
-
65
- _chai.assert.strictEqual(result3, 'rgba(60, 68, 77, 0.3)');
66
-
49
+ expect(result3).toBe('rgba(60, 68, 77, 0.3)');
67
50
  var result4 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(enterpriseLightProps);
68
-
69
- _chai.assert.strictEqual(result4, 'rgba(92, 192, 92, 0.3)');
51
+ expect(result4).toBe('rgba(92, 192, 92, 0.3)');
70
52
  });
71
53
  it('defaults to black for undefined variable', function () {
72
- var consoleStub = (0, _sinon.stub)(console, 'warn');
73
- var result4 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(defaultProps);
74
-
75
- _chai.assert.strictEqual(result4, 'rgba(0, 0, 0, 0.3)');
76
-
77
- _chai.assert.isTrue(consoleStub.calledOnce, "The colorWithAlpha's console warning was called");
78
-
79
- _chai.assert.strictEqual(consoleStub.args[0][0], "The variable 'brandColor' does not exist in the theme 'prisma dark comfortable'.");
80
-
81
- consoleStub.restore();
54
+ var consoleWarn = jest.spyOn(console, 'warn').mockImplementation();
55
+ var result = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(defaultProps);
56
+ expect(result).toBe('rgba(0, 0, 0, 0.3)');
57
+ expect(consoleWarn).toHaveBeenCalled();
58
+ expect(consoleWarn).toHaveBeenCalledWith("The variable 'brandColor' does not exist in the theme 'prisma dark comfortable'.");
59
+ consoleWarn.mockRestore();
82
60
  });
83
61
  it('warns developers of invalid alpha prop at runtime', function () {
84
- var consoleStub = (0, _sinon.stub)(console, 'warn');
62
+ var consoleWarn = jest.spyOn(console, 'warn').mockImplementation();
85
63
  (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, 1.1)(defaultProps);
86
- (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, -0.1)(defaultProps);
87
-
88
- _chai.assert.isTrue(consoleStub.calledTwice, "The colorWithAlpha's console warning was called twice");
89
-
90
- _chai.assert.strictEqual(consoleStub.args[0][0], 'The alpha value "1.1" is not within acceptable 0-1 range.');
91
-
92
- _chai.assert.strictEqual(consoleStub.args[1][0], 'The alpha value "-0.1" is not within acceptable 0-1 range.');
93
-
94
- consoleStub.restore();
64
+ expect(consoleWarn).toHaveBeenCalled();
65
+ expect(consoleWarn).toHaveBeenCalledWith('The alpha value "1.1" is not within acceptable 0-1 range.');
66
+ consoleWarn.mockRestore();
95
67
  });
96
68
  });
97
69
  describe('overlayColors', function () {
98
70
  var defaultProps = {};
99
71
  it('overlays two string values', function () {
100
72
  var result = (0, _utilityMixins.overlayColors)('#f0f', 'rgba(255, 255, 128, 0.5)')(defaultProps);
101
-
102
- _chai.assert.strictEqual(result, 'rgb(255, 128, 192)');
73
+ expect(result).toBe('rgb(255, 128, 192)');
103
74
  });
104
75
  it('overlays a solid color', function () {
105
76
  var result = (0, _utilityMixins.overlayColors)('#f39', _variables["default"].black)(defaultProps);
106
-
107
- _chai.assert.strictEqual(result, 'rgb(0, 0, 0)');
77
+ expect(result).toBe('rgb(0, 0, 0)');
108
78
  });
109
79
  it('uses default theme variables', function () {
110
80
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].interactiveColorPrimary, _variables["default"].interactiveColorOverlayHover)(defaultProps);
111
-
112
- _chai.assert.strictEqual(result, 'rgb(67, 152, 255)');
81
+ expect(result).toBe('rgb(67, 152, 255)');
113
82
  });
114
83
  var enterpriseLightProps = {
115
84
  theme: {
@@ -121,13 +90,11 @@ describe('overlayColors', function () {
121
90
  };
122
91
  it('uses Enterprise variables', function () {
123
92
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].brandColor, 'rgba(255, 255, 255, 0.5)')(enterpriseLightProps);
124
-
125
- _chai.assert.strictEqual(result, 'rgb(174, 224, 174)');
93
+ expect(result).toBe('rgb(174, 224, 174)');
126
94
  });
127
95
  it('defaults to black for undefined colors', function () {
128
96
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].brandColor, 'rgba(255, 255, 255, 0.5)')(defaultProps);
129
-
130
- _chai.assert.strictEqual(result, 'rgb(128, 128, 128)');
97
+ expect(result).toBe('rgb(128, 128, 128)');
131
98
  });
132
99
  });
133
100
  describe('passes TS verification', function () {
@@ -120,35 +120,35 @@ function getStylesForVariant(variant) {
120
120
  prisma: '24px'
121
121
  });
122
122
  size = (0, _pick["default"])({
123
- enterprise: '12px',
123
+ enterprise: _variables["default"].fontSize,
124
124
  prisma: '16px'
125
125
  });
126
126
  weight = _variables["default"].fontWeightBold;
127
127
  break;
128
128
 
129
129
  case 'title5':
130
- color = (0, _pick["default"])({
131
- enterprise: _variables["default"].contentColorActive,
132
- prisma: 'default'
133
- });
134
- lineHeight = (0, _pick["default"])({
135
- enterprise: _variables["default"].lineHeight,
136
- prisma: '16px'
137
- });
130
+ color = _variables["default"].contentColorActive;
131
+ lineHeight = _variables["default"].lineHeight;
138
132
  size = (0, _pick["default"])({
139
133
  enterprise: '12px',
140
- prisma: '13px'
134
+ prisma: _variables["default"].fontSize
141
135
  });
142
136
  weight = (0, _pick["default"])({
143
- enterprise: '500',
137
+ enterprise: _variables["default"].fontWeightSemiBold,
144
138
  prisma: _variables["default"].fontWeightBold
145
139
  });
146
140
  break;
147
141
 
148
142
  case 'title6':
149
143
  color = _variables["default"].contentColorActive;
150
- lineHeight = _variables["default"].lineHeight;
151
- size = _variables["default"].fontSize;
144
+ lineHeight = (0, _pick["default"])({
145
+ enterprise: _variables["default"].lineHeight,
146
+ prisma: '16px'
147
+ });
148
+ size = (0, _pick["default"])({
149
+ enterprise: '12px',
150
+ prisma: '13px'
151
+ });
152
152
  weight = _variables["default"].fontWeightSemiBold;
153
153
  break;
154
154
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@splunk/themes",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
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",
7
7
  "build": "cross-env NODE_ENV=production yarn babel && yarn types:build",
8
8
  "docs": "NODE_ENV=production webpack --config docs.gen.webpack.config.js",
9
- "docs:publish": "cicd-publish-docs docs --force",
10
- "docs:publish:external": "cicd-publish-docs docs-external --force --suffix=public",
9
+ "docs:publish": "eval $(splunk-docs-package docs) && artifact-ci publish generic $DOCS_GEN_OUTPUT_NAME $DOCS_GEN_REMOTE_PATH",
10
+ "docs:publish:external": "eval $(splunk-docs-package docs-external --suffix=public) && artifact-ci publish generic $DOCS_GEN_OUTPUT_NAME $DOCS_GEN_REMOTE_PATH",
11
11
  "docs:start": "INTERNAL=true webpack serve --config docs.gen.webpack.config.js",
12
12
  "docs:start:external": "webpack serve --config docs.gen.webpack.config.js",
13
13
  "lint": "eslint src --ext \".ts,.tsx,.js,.jsx\"",
@@ -27,7 +27,7 @@
27
27
  "@storybook/components": ">= 6.x",
28
28
  "@storybook/theming": ">= 6.x",
29
29
  "react": "^16.8",
30
- "styled-components": "5.1.1"
30
+ "styled-components": "^5.3.10"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "react": {
@@ -66,22 +66,21 @@
66
66
  "devDependencies": {
67
67
  "@babel/cli": "^7.2.0",
68
68
  "@babel/core": "^7.2.0",
69
- "@splunk/babel-preset": "^3.0.0",
70
- "@splunk/cicd-tools": "^0.5.0",
69
+ "@splunk/babel-preset": "^4.0.0",
71
70
  "@splunk/eslint-config": "^4.0.0",
72
71
  "@storybook/addon-docs": "^6.5.9",
73
72
  "@storybook/addons": "^6.5.9",
74
73
  "@storybook/api": "^6.5.9",
75
74
  "@storybook/components": "^6.5.9",
76
75
  "@storybook/theming": "^6.5.9",
76
+ "@testing-library/jest-dom": "^5.16.1",
77
+ "@testing-library/react": "^12.1.2",
78
+ "@testing-library/react-hooks": "^7.0.2",
77
79
  "@typescript-eslint/eslint-plugin": "^3.4.0",
78
80
  "@typescript-eslint/parser": "^3.4.0",
79
81
  "babel-eslint": "^10.1.0",
80
82
  "babel-plugin-transform-define": "^2.0.0",
81
- "chai": "^3.5.0",
82
83
  "cross-env": "^6.0.3",
83
- "enzyme": "^3.11.0",
84
- "enzyme-adapter-react-16": "^1.15.2",
85
84
  "eslint": "^7.4.0",
86
85
  "eslint-config-airbnb": "^18.2.0",
87
86
  "eslint-config-prettier": "^6.11.0",
@@ -89,15 +88,15 @@
89
88
  "eslint-plugin-jsx-a11y": "^6.3.1",
90
89
  "eslint-plugin-react": "^7.20.3",
91
90
  "eslint-plugin-react-hooks": "^4.0.5",
92
- "jest": "^25.1.0",
91
+ "jest": "^26.6.3",
93
92
  "jest-styled-components": "^7.0.8",
94
93
  "react": "^16.12.0",
95
- "styled-components": "5.1.1",
94
+ "styled-components": "^5.3.10",
96
95
  "typescript": "^4.0.5",
97
- "webpack": "^4.16.2",
98
- "webpack-cli": "^4.9.2",
99
- "webpack-dev-server": "^4.7.4",
100
- "webpack-merge": "^4.1.3"
96
+ "webpack": "^5.88.2",
97
+ "webpack-cli": "^5.1.4",
98
+ "webpack-dev-server": "^4.15.1",
99
+ "webpack-merge": "^5.9.0"
101
100
  },
102
101
  "engines": {
103
102
  "node": ">=6"
@@ -51,7 +51,7 @@ var ThemedDocsContainer = function ThemedDocsContainer(_ref) {
51
51
 
52
52
  return /*#__PURE__*/_react["default"].createElement(_blocks.DocsContainer, {
53
53
  context: themedContext
54
- }, /*#__PURE__*/_react["default"].createElement(_themes.GlobalStyles, null), children);
54
+ }, /*#__PURE__*/_react["default"].createElement(_themes.GlobalStyles, null), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children));
55
55
  };
56
56
 
57
57
  exports.ThemedDocsContainer = ThemedDocsContainer;
@@ -0,0 +1,8 @@
1
+ import '@storybook/addon-docs/blocks';
2
+
3
+ declare module '@storybook/addon-docs/blocks' {
4
+ declare interface DocsContainerPropsWithChildren extends DocsContainerProps {
5
+ children?: ReactNode;
6
+ }
7
+ export declare const DocsContainer: FunctionComponent<DocsContainerPropsWithChildren>;
8
+ }
package/types.js CHANGED
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Setup testing-library for react and jest-dom matchers
3
+ * This file needs to be included in tsconfig for the types from @testing-library/jest-dom
4
+ * to get picked up. See: https://github.com/testing-library/jest-dom#usage
5
+ */
6
+ import { screen, configure } from '@testing-library/react';
7
+ import '@testing-library/jest-dom';
8
+
9
+ configure({ testIdAttribute: 'data-test' });