@splunk/themes 0.15.0 → 0.16.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 +17 -0
- package/enterprise/light.js +20 -6
- package/mixins/tests/typography.unit.js +29 -4
- package/mixins/tests/utilityMixins.unit.js +23 -56
- package/mixins/typography.js +11 -1
- package/package.json +6 -6
- package/prisma/base.js +20 -6
- package/types/enterprise/dark.d.ts +6 -2
- package/types/enterprise/light.d.ts +6 -2
- package/types/mixins/typography.d.ts +3 -5
- package/types/prisma/base.d.ts +6 -2
- package/unit-test-setup-testing-library.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
0.16.1 - June 6, 2023
|
|
5
|
+
----------
|
|
6
|
+
API Changes:
|
|
7
|
+
* Added support for the latest `styled-components@5` (SUI-5467).
|
|
8
|
+
|
|
9
|
+
0.16.0 - April 6, 2023
|
|
10
|
+
----------
|
|
11
|
+
New Features:
|
|
12
|
+
* Added variables for supported font weights; the `typography` mixin's `weight` param supports these as keyword values (SUI-5344).
|
|
13
|
+
|
|
14
|
+
Breaking Changes:
|
|
15
|
+
* `typography` mixin's `weight` param now only accepts keyword values. Number values have been removed (SUI-5344).
|
|
16
|
+
|
|
17
|
+
Bug Fixes:
|
|
18
|
+
* `typography` mixin properly applies correct CSS for `weight` params (SUI-5344).
|
|
19
|
+
|
|
20
|
+
|
|
4
21
|
0.15.0 - January 25, 2023
|
|
5
22
|
----------
|
|
6
23
|
New Features:
|
package/enterprise/light.js
CHANGED
|
@@ -325,18 +325,32 @@ var borders = {
|
|
|
325
325
|
};
|
|
326
326
|
var sansFontFamily = "'Splunk Platform Sans', 'Proxima Nova', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif";
|
|
327
327
|
/**
|
|
328
|
-
* ##
|
|
328
|
+
* ## Font family
|
|
329
329
|
*
|
|
330
330
|
* @valueSet
|
|
331
331
|
*/
|
|
332
332
|
|
|
333
|
-
var
|
|
333
|
+
var fontFamily = {
|
|
334
334
|
sansFontFamily: sansFontFamily,
|
|
335
335
|
serifFontFamily: "Georgia, 'Times New Roman', Times, serif",
|
|
336
336
|
monoFontFamily: "'Splunk Platform Mono', Inconsolata, Consolas, 'Droid Sans Mono', Monaco, 'Courier New', Courier, monospace",
|
|
337
|
-
fontFamily: sansFontFamily
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
fontFamily: sansFontFamily
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* ## Font weights
|
|
341
|
+
*
|
|
342
|
+
* Based on [common weight name mappings](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping)
|
|
343
|
+
*
|
|
344
|
+
* @valueSet
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
var fontWeights = {
|
|
348
|
+
fontWeightLight: 300,
|
|
349
|
+
fontWeightNormal: 400,
|
|
350
|
+
fontWeightSemiBold: 500,
|
|
351
|
+
fontWeightBold: 700,
|
|
352
|
+
fontWeightHeavy: 800,
|
|
353
|
+
fontWeightExtraBold: 900
|
|
340
354
|
};
|
|
341
355
|
/**
|
|
342
356
|
* ## Layers
|
|
@@ -354,7 +368,7 @@ var zindexes = {
|
|
|
354
368
|
zindexToastMessages: 2000
|
|
355
369
|
};
|
|
356
370
|
|
|
357
|
-
var theme = _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),
|
|
371
|
+
var theme = _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), borders), zindexes);
|
|
358
372
|
|
|
359
373
|
var _default = theme;
|
|
360
374
|
exports["default"] = _default;
|
|
@@ -20,9 +20,19 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
20
20
|
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function _templateObject7() {
|
|
24
24
|
var data = _taggedTemplateLiteral(["\n ", "\n ", ";\n ", ";\n "]);
|
|
25
25
|
|
|
26
|
+
_templateObject7 = function _templateObject7() {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _templateObject6() {
|
|
34
|
+
var data = _taggedTemplateLiteral(["\n ", "\n "]);
|
|
35
|
+
|
|
26
36
|
_templateObject6 = function _templateObject6() {
|
|
27
37
|
return data;
|
|
28
38
|
};
|
|
@@ -177,7 +187,7 @@ describe('typography', function () {
|
|
|
177
187
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Component, null)),
|
|
178
188
|
container = _render5.container;
|
|
179
189
|
|
|
180
|
-
expect(container.firstChild).toMatchInlineSnapshot("\n .c0 {\n color: #909090;\n font-family: 'Splunk Platform Mono','Roboto Mono',Consolas,'Droid Sans Mono',Monaco,'Courier New',Courier,monospace;\n font-size: 56px;\n font-weight:
|
|
190
|
+
expect(container.firstChild).toMatchInlineSnapshot("\n .c0 {\n color: #909090;\n font-family: 'Splunk Platform Mono','Roboto Mono',Consolas,'Droid Sans Mono',Monaco,'Courier New',Courier,monospace;\n font-size: 56px;\n font-weight: 900;\n line-height: 64px;\n }\n\n <p\n class=\"c0\"\n />\n ");
|
|
181
191
|
});
|
|
182
192
|
it('allows default values to be overridden with params', function () {
|
|
183
193
|
var Component = _styledComponents["default"].p(_templateObject5(), (0, _typography["default"])({
|
|
@@ -192,7 +202,22 @@ describe('typography', function () {
|
|
|
192
202
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Component, null)),
|
|
193
203
|
container = _render6.container;
|
|
194
204
|
|
|
195
|
-
expect(container.firstChild).toMatchInlineSnapshot("\n .c0 {\n color: #909090;\n font-family: 'Splunk Platform Mono','Roboto Mono',Consolas,'Droid Sans Mono',Monaco,'Courier New',Courier,monospace;\n font-size: 56px;\n font-weight:
|
|
205
|
+
expect(container.firstChild).toMatchInlineSnapshot("\n .c0 {\n color: #909090;\n font-family: 'Splunk Platform Mono','Roboto Mono',Consolas,'Droid Sans Mono',Monaco,'Courier New',Courier,monospace;\n font-size: 56px;\n font-weight: 900;\n line-height: 64px;\n }\n\n <p\n class=\"c0\"\n />\n ");
|
|
206
|
+
});
|
|
207
|
+
it('transforms params that are shorthand properly to CSS', function () {
|
|
208
|
+
var Component = _styledComponents["default"].p(_templateObject6(), (0, _typography["default"])({
|
|
209
|
+
color: 'muted',
|
|
210
|
+
family: 'monospace',
|
|
211
|
+
lineHeight: 64,
|
|
212
|
+
size: 56,
|
|
213
|
+
weight: 'extraBold',
|
|
214
|
+
withReset: false
|
|
215
|
+
}));
|
|
216
|
+
|
|
217
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Component, null)),
|
|
218
|
+
container = _render7.container;
|
|
219
|
+
|
|
220
|
+
expect(container.firstChild).toMatchInlineSnapshot("\n .c0 {\n color: #909090;\n font-family: 'Splunk Platform Mono','Roboto Mono',Consolas,'Droid Sans Mono',Monaco,'Courier New',Courier,monospace;\n font-size: 56px;\n font-weight: 900;\n line-height: 64px;\n }\n\n <p\n class=\"c0\"\n />\n ");
|
|
196
221
|
});
|
|
197
222
|
it.skip('passes TS verification', function () {
|
|
198
223
|
(0, _typography["default"])();
|
|
@@ -227,7 +252,7 @@ describe('typography', function () {
|
|
|
227
252
|
describe('passes TS verification', function () {
|
|
228
253
|
it.skip('allows mixins in styled-components css', function () {
|
|
229
254
|
/* eslint-disable-next-line @typescript-eslint/no-unused-expressions */
|
|
230
|
-
(0, _styledComponents.css)(
|
|
255
|
+
(0, _styledComponents.css)(_templateObject7(), (0, _typography["default"])('title1'), (0, _typography["default"])('title1', {
|
|
231
256
|
color: 'disabled'
|
|
232
257
|
}), (0, _typography["default"])({
|
|
233
258
|
family: 'monospace'
|
|
@@ -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
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
62
|
+
var consoleWarn = jest.spyOn(console, 'warn').mockImplementation();
|
|
85
63
|
(0, _utilityMixins.colorWithAlpha)(_variables["default"].white, 1.1)(defaultProps);
|
|
86
|
-
(
|
|
87
|
-
|
|
88
|
-
|
|
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 () {
|
package/mixins/typography.js
CHANGED
|
@@ -230,6 +230,15 @@ var colorPropToVariableMap = {
|
|
|
230
230
|
var familyPropToVariableMap = {
|
|
231
231
|
sansSerif: _variables["default"].sansFontFamily,
|
|
232
232
|
monospace: _variables["default"].monoFontFamily
|
|
233
|
+
}; // As defined by [font-weight | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping)
|
|
234
|
+
|
|
235
|
+
var weightPropToValueMap = {
|
|
236
|
+
light: _variables["default"].fontWeightLight,
|
|
237
|
+
normal: _variables["default"].fontWeightNormal,
|
|
238
|
+
semiBold: _variables["default"].fontWeightSemiBold,
|
|
239
|
+
bold: _variables["default"].fontWeightBold,
|
|
240
|
+
extraBold: _variables["default"].fontWeightExtraBold,
|
|
241
|
+
heavy: _variables["default"].fontWeightHeavy
|
|
233
242
|
};
|
|
234
243
|
/**
|
|
235
244
|
* A mixin for styling text content using predefined typography variants
|
|
@@ -295,7 +304,8 @@ function typography(variantOrParams, additionalParams) {
|
|
|
295
304
|
size: params.size ? "".concat(params.size, "px") : undefined,
|
|
296
305
|
lineHeight: params.lineHeight ? "".concat(params.lineHeight, "px") : undefined,
|
|
297
306
|
color: params.color ? colorPropToVariableMap[params.color] : undefined,
|
|
298
|
-
family: params.family ? familyPropToVariableMap[params.family] : undefined
|
|
307
|
+
family: params.family ? familyPropToVariableMap[params.family] : undefined,
|
|
308
|
+
weight: params.weight ? weightPropToValueMap[params.weight] : undefined
|
|
299
309
|
});
|
|
300
310
|
|
|
301
311
|
var defaultTypographyParams = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/themes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
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",
|
|
@@ -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.
|
|
30
|
+
"styled-components": "^5.3.10"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"react": {
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"@storybook/api": "^6.5.9",
|
|
75
75
|
"@storybook/components": "^6.5.9",
|
|
76
76
|
"@storybook/theming": "^6.5.9",
|
|
77
|
+
"@testing-library/jest-dom": "^5.16.1",
|
|
78
|
+
"@testing-library/react": "^12.1.2",
|
|
79
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
77
80
|
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
|
78
81
|
"@typescript-eslint/parser": "^3.4.0",
|
|
79
82
|
"babel-eslint": "^10.1.0",
|
|
80
83
|
"babel-plugin-transform-define": "^2.0.0",
|
|
81
|
-
"chai": "^3.5.0",
|
|
82
84
|
"cross-env": "^6.0.3",
|
|
83
|
-
"enzyme": "^3.11.0",
|
|
84
|
-
"enzyme-adapter-react-16": "^1.15.2",
|
|
85
85
|
"eslint": "^7.4.0",
|
|
86
86
|
"eslint-config-airbnb": "^18.2.0",
|
|
87
87
|
"eslint-config-prettier": "^6.11.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"jest": "^25.1.0",
|
|
93
93
|
"jest-styled-components": "^7.0.8",
|
|
94
94
|
"react": "^16.12.0",
|
|
95
|
-
"styled-components": "5.
|
|
95
|
+
"styled-components": "^5.3.10",
|
|
96
96
|
"typescript": "^4.0.5",
|
|
97
97
|
"webpack": "^4.16.2",
|
|
98
98
|
"webpack-cli": "^4.9.2",
|
package/prisma/base.js
CHANGED
|
@@ -62,18 +62,32 @@ function createPrismaBase(_ref) {
|
|
|
62
62
|
};
|
|
63
63
|
var sansFontFamily = "'Splunk Platform Sans', 'Splunk Data Sans', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif";
|
|
64
64
|
/**
|
|
65
|
-
* ##
|
|
65
|
+
* ## Font family
|
|
66
66
|
*
|
|
67
67
|
* @valueSet
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var fontFamily = {
|
|
71
71
|
sansFontFamily: sansFontFamily,
|
|
72
72
|
serifFontFamily: "Georgia, 'Times New Roman', Times, serif",
|
|
73
73
|
monoFontFamily: "'Splunk Platform Mono', 'Roboto Mono', Consolas, 'Droid Sans Mono', Monaco, 'Courier New', Courier, monospace",
|
|
74
|
-
fontFamily: sansFontFamily
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
fontFamily: sansFontFamily
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* ## Font weights
|
|
78
|
+
*
|
|
79
|
+
* Based on [common weight name mappings](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping)
|
|
80
|
+
*
|
|
81
|
+
* @valueSet
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
var fontWeights = {
|
|
85
|
+
fontWeightLight: 300,
|
|
86
|
+
fontWeightNormal: 400,
|
|
87
|
+
fontWeightSemiBold: 500,
|
|
88
|
+
fontWeightBold: 700,
|
|
89
|
+
fontWeightHeavy: 800,
|
|
90
|
+
fontWeightExtraBold: 900
|
|
77
91
|
};
|
|
78
92
|
/**
|
|
79
93
|
* ## Layers
|
|
@@ -90,7 +104,7 @@ function createPrismaBase(_ref) {
|
|
|
90
104
|
zindexPopover: 1060,
|
|
91
105
|
zindexToastMessages: 2000
|
|
92
106
|
};
|
|
93
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({},
|
|
107
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, fontFamily), fontWeights), usageColors), _dataViz["default"]), shadows), backgrounds), zindexes);
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
var _default = createPrismaBase;
|
|
@@ -25,12 +25,16 @@ declare const theme: {
|
|
|
25
25
|
overlayShadow: string;
|
|
26
26
|
focusColor: string;
|
|
27
27
|
transparent: string;
|
|
28
|
+
fontWeightLight: number;
|
|
29
|
+
fontWeightNormal: number;
|
|
30
|
+
fontWeightSemiBold: number;
|
|
31
|
+
fontWeightBold: number;
|
|
32
|
+
fontWeightHeavy: number;
|
|
33
|
+
fontWeightExtraBold: number;
|
|
28
34
|
sansFontFamily: string;
|
|
29
35
|
serifFontFamily: string;
|
|
30
36
|
monoFontFamily: string;
|
|
31
37
|
fontFamily: string;
|
|
32
|
-
fontWeightBold: string;
|
|
33
|
-
fontWeightSemiBold: string;
|
|
34
38
|
syntaxBlue: string;
|
|
35
39
|
syntaxBlueLight: string;
|
|
36
40
|
syntaxBrown: string;
|
|
@@ -22,12 +22,16 @@ declare const theme: {
|
|
|
22
22
|
backgroundColorHover: string;
|
|
23
23
|
backgroundColor: string;
|
|
24
24
|
transparent: string;
|
|
25
|
+
fontWeightLight: number;
|
|
26
|
+
fontWeightNormal: number;
|
|
27
|
+
fontWeightSemiBold: number;
|
|
28
|
+
fontWeightBold: number;
|
|
29
|
+
fontWeightHeavy: number;
|
|
30
|
+
fontWeightExtraBold: number;
|
|
25
31
|
sansFontFamily: string;
|
|
26
32
|
serifFontFamily: string;
|
|
27
33
|
monoFontFamily: string;
|
|
28
34
|
fontFamily: string;
|
|
29
|
-
fontWeightBold: string;
|
|
30
|
-
fontWeightSemiBold: string;
|
|
31
35
|
syntaxBlue: string;
|
|
32
36
|
syntaxBlueLight: string;
|
|
33
37
|
syntaxBrown: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyTheme, Interpolation, ThemedProps } from '../types';
|
|
2
2
|
declare const typographyVariants: readonly ["body", "title1", "title2", "title3", "title4", "title5", "title6", "title7", "largeBody", "smallBody", "footnote", "monoBody", "monoSmallBody"];
|
|
3
3
|
declare type TypographyVariant = typeof typographyVariants[number];
|
|
4
|
+
declare type TypographyTitleVariant = Extract<TypographyVariant, 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | 'title6' | 'title7'>;
|
|
4
5
|
interface TypographyParams {
|
|
5
6
|
/**
|
|
6
7
|
* Set the font-family to sans-serif or monospace based on current theme.
|
|
@@ -20,11 +21,8 @@ interface TypographyParams {
|
|
|
20
21
|
color?: 'active' | 'default' | 'disabled' | 'inverted' | 'muted' | 'inherit';
|
|
21
22
|
/**
|
|
22
23
|
* Set the font-weight to a system-standard value.
|
|
23
|
-
*
|
|
24
|
-
* Number or equivalent string can be used.
|
|
25
|
-
* See: [font-weight | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)
|
|
26
24
|
*/
|
|
27
|
-
weight?:
|
|
25
|
+
weight?: 'light' | 'normal' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
|
|
28
26
|
/**
|
|
29
27
|
* Apply a reset to the element's margin and padding. This defaults to true if using a `variant`.
|
|
30
28
|
*/
|
|
@@ -80,4 +78,4 @@ declare function typography<T extends AnyTheme, A extends ThemedProps>(variant:
|
|
|
80
78
|
declare function typography<T extends AnyTheme, A extends ThemedProps>({ family, size, lineHeight, color, weight, withReset, }: TypographyParams): Interpolation<T, A>;
|
|
81
79
|
declare function typography<T extends AnyTheme, A extends ThemedProps>(variant: TypographyVariant, additionalParams: TypographyParams): Interpolation<T, A>;
|
|
82
80
|
export default typography;
|
|
83
|
-
export { typographyVariants, TypographyVariant, TypographyParams };
|
|
81
|
+
export { typographyVariants, TypographyTitleVariant, TypographyVariant, TypographyParams };
|
package/types/prisma/base.d.ts
CHANGED
|
@@ -229,12 +229,16 @@ declare function createPrismaBase({ colorScheme }: {
|
|
|
229
229
|
focusColor: string;
|
|
230
230
|
transparent: string;
|
|
231
231
|
linkColor: string;
|
|
232
|
+
fontWeightLight: number;
|
|
233
|
+
fontWeightNormal: number;
|
|
234
|
+
fontWeightSemiBold: number;
|
|
235
|
+
fontWeightBold: number;
|
|
236
|
+
fontWeightHeavy: number;
|
|
237
|
+
fontWeightExtraBold: number;
|
|
232
238
|
sansFontFamily: string;
|
|
233
239
|
serifFontFamily: string;
|
|
234
240
|
monoFontFamily: string;
|
|
235
241
|
fontFamily: string;
|
|
236
|
-
fontWeightBold: string;
|
|
237
|
-
fontWeightSemiBold: string;
|
|
238
242
|
};
|
|
239
243
|
declare type PrismaBase = ReturnType<typeof createPrismaBase>;
|
|
240
244
|
export default createPrismaBase;
|
|
@@ -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' });
|