@splunk/themes 0.13.1 → 0.15.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 CHANGED
@@ -1,6 +1,21 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 0.15.0 - January 25, 2023
5
+ ----------
6
+ New Features:
7
+ * Added theme specific code in `typography` mixin for title variations (SUI-5272).
8
+
9
+ Bug Fixes:
10
+ * `mixins` now applies `color-scheme` (SUI-1926).
11
+ * This causes form controls, scrollbars, and other elements to respect the color scheme specified by `ThemeProvider`.
12
+ * Fixes documentation typo in `typography` mixin where 'subtitle' and 'smallSubtitle' should be instead be named 'title6' and 'title7' respectively.
13
+
14
+ 0.14.0 - January 10, 2023
15
+ ----------
16
+ New Features:
17
+ * Added `inherit` option for `color` prop in `typography` mixin.
18
+
4
19
  0.13.1 - December 6, 2022
5
20
  ----------
6
21
  * Optimizes bundle sizes of consumers by reducing footprint of "lodash" (SUI-5090).
@@ -11,6 +11,8 @@ var _merge = _interopRequireDefault(require("lodash/merge"));
11
11
 
12
12
  var _variables = _interopRequireDefault(require("../variables"));
13
13
 
14
+ var _pick = _interopRequireDefault(require("../pick"));
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
17
 
16
18
  function _templateObject2() {
@@ -60,42 +62,87 @@ function getStylesForVariant(variant) {
60
62
  var lineHeight = _variables["default"].lineHeight; // eslint-disable-line prefer-destructuring
61
63
 
62
64
  var size = _variables["default"].fontSize;
63
- var weight = 'normal';
65
+ var weight = 'normal'; // TODO: After sections are removed from Heading update HeadingStyles accordingly to preserve section styles as typography variants SUI-5268
64
66
 
65
67
  switch (variant) {
66
68
  case 'title1':
67
69
  color = _variables["default"].contentColorActive;
68
- lineHeight = '40px';
69
- size = '36px';
70
- weight = _variables["default"].fontWeightBold;
70
+ lineHeight = (0, _pick["default"])({
71
+ enterprise: '20px',
72
+ prisma: '48px'
73
+ });
74
+ size = (0, _pick["default"])({
75
+ enterprise: '24px',
76
+ prisma: '36px'
77
+ });
78
+ weight = (0, _pick["default"])({
79
+ enterprise: '500',
80
+ prisma: _variables["default"].fontWeightBold
81
+ });
71
82
  break;
72
83
 
73
84
  case 'title2':
74
85
  color = _variables["default"].contentColorActive;
75
- lineHeight = '48px';
76
- size = _variables["default"].fontSizeXXLarge;
77
- weight = _variables["default"].fontWeightBold;
86
+ lineHeight = (0, _pick["default"])({
87
+ enterprise: '20px',
88
+ prisma: '24px'
89
+ });
90
+ size = (0, _pick["default"])({
91
+ enterprise: '18px',
92
+ prisma: '24px'
93
+ });
94
+ weight = (0, _pick["default"])({
95
+ enterprise: '500',
96
+ prisma: _variables["default"].fontWeightBold
97
+ });
78
98
  break;
79
99
 
80
100
  case 'title3':
81
101
  color = _variables["default"].contentColorActive;
82
- lineHeight = '24px';
83
- size = '20px';
84
- weight = _variables["default"].fontWeightBold;
102
+ lineHeight = (0, _pick["default"])({
103
+ enterprise: '20px',
104
+ prisma: '24px'
105
+ });
106
+ size = (0, _pick["default"])({
107
+ enterprise: '16px',
108
+ prisma: '20px'
109
+ });
110
+ weight = (0, _pick["default"])({
111
+ enterprise: '500',
112
+ prisma: _variables["default"].fontWeightBold
113
+ });
85
114
  break;
86
115
 
87
116
  case 'title4':
88
117
  color = _variables["default"].contentColorActive;
89
- lineHeight = '22px';
90
- size = _variables["default"].fontSizeLarge;
118
+ lineHeight = (0, _pick["default"])({
119
+ enterprise: '20px',
120
+ prisma: '24px'
121
+ });
122
+ size = (0, _pick["default"])({
123
+ enterprise: '12px',
124
+ prisma: '16px'
125
+ });
91
126
  weight = _variables["default"].fontWeightBold;
92
127
  break;
93
128
 
94
129
  case 'title5':
95
- color = _variables["default"].contentColorActive;
96
- lineHeight = _variables["default"].lineHeight;
97
- size = _variables["default"].fontSize;
98
- weight = _variables["default"].fontWeightBold;
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
+ });
138
+ size = (0, _pick["default"])({
139
+ enterprise: '12px',
140
+ prisma: '13px'
141
+ });
142
+ weight = (0, _pick["default"])({
143
+ enterprise: '500',
144
+ prisma: _variables["default"].fontWeightBold
145
+ });
99
146
  break;
100
147
 
101
148
  case 'title6':
@@ -177,7 +224,8 @@ var colorPropToVariableMap = {
177
224
  "default": _variables["default"].contentColorDefault,
178
225
  disabled: _variables["default"].contentColorDisabled,
179
226
  inverted: _variables["default"].contentColorInverted,
180
- muted: _variables["default"].contentColorMuted
227
+ muted: _variables["default"].contentColorMuted,
228
+ inherit: 'inherit'
181
229
  };
182
230
  var familyPropToVariableMap = {
183
231
  sansSerif: _variables["default"].sansFontFamily,
@@ -217,8 +265,8 @@ var familyPropToVariableMap = {
217
265
  * `'title3'`,
218
266
  * `'title4'`,
219
267
  * `'title5'`,
220
- * `'subtitle'`,
221
- * `'smallSubtitle'`,
268
+ * `'title6'`,
269
+ * `'title7'`,
222
270
  * `'largeBody'`,
223
271
  * `'smallBody'`,
224
272
  * `'footnote'`,
@@ -27,7 +27,7 @@ var _pick = _interopRequireDefault(require("../pick"));
27
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
28
28
 
29
29
  function _templateObject() {
30
- var data = _taggedTemplateLiteral(["\n /* Generic resets */\n animation: none 0s ease 0s 1 normal none running;\n backface-visibility: visible;\n background: transparent none repeat 0 0 / auto auto padding-box border-box scroll;\n border: medium none currentColor;\n border-collapse: separate;\n border-image: none;\n border-radius: 0;\n border-spacing: 0;\n bottom: auto;\n box-shadow: none;\n caption-side: top;\n clear: none;\n clip: auto;\n columns: auto;\n column-count: auto;\n column-fill: balance;\n column-gap: normal;\n column-rule: medium none currentColor;\n column-span: 1;\n column-width: auto;\n content: normal;\n counter-increment: none;\n counter-reset: none;\n empty-cells: show;\n float: none;\n font-style: normal;\n font-variant: normal;\n font-weight: normal;\n font-stretch: normal;\n height: auto;\n hyphens: none;\n left: auto;\n letter-spacing: normal;\n list-style: disc outside none;\n margin: 0;\n max-height: none;\n max-width: none;\n min-height: 0;\n min-width: 0;\n opacity: 1;\n orphans: 2;\n overflow: visible;\n overflow-x: visible;\n overflow-y: visible;\n padding: 0;\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: auto;\n perspective: none;\n perspective-origin: 50% 50%;\n pointer-events: auto;\n position: static;\n right: auto;\n tab-size: 8;\n table-layout: auto;\n text-align: left;\n text-align-last: auto;\n text-decoration: none;\n text-indent: 0;\n text-shadow: none;\n text-transform: none;\n top: auto;\n transform: none;\n transform-origin: 50% 50% 0;\n transform-style: flat;\n transition: none 0s ease 0s;\n user-select: auto;\n vertical-align: baseline;\n white-space: normal;\n widows: 2;\n width: auto;\n word-spacing: normal;\n z-index: auto;\n /* Splunk-specific resets */\n border-width: 1px;\n box-sizing: border-box;\n color: ", ";\n cursor: inherit;\n display: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n outline: medium none ", ";\n visibility: inherit;\n "]);
30
+ var data = _taggedTemplateLiteral(["\n /* Generic resets */\n animation: none 0s ease 0s 1 normal none running;\n backface-visibility: visible;\n background: transparent none repeat 0 0 / auto auto padding-box border-box scroll;\n border: medium none currentColor;\n border-collapse: separate;\n border-image: none;\n border-radius: 0;\n border-spacing: 0;\n bottom: auto;\n box-shadow: none;\n caption-side: top;\n clear: none;\n clip: auto;\n color-scheme: ", ";\n columns: auto;\n column-count: auto;\n column-fill: balance;\n column-gap: normal;\n column-rule: medium none currentColor;\n column-span: 1;\n column-width: auto;\n content: normal;\n counter-increment: none;\n counter-reset: none;\n empty-cells: show;\n float: none;\n font-style: normal;\n font-variant: normal;\n font-weight: normal;\n font-stretch: normal;\n height: auto;\n hyphens: none;\n left: auto;\n letter-spacing: normal;\n list-style: disc outside none;\n margin: 0;\n max-height: none;\n max-width: none;\n min-height: 0;\n min-width: 0;\n opacity: 1;\n orphans: 2;\n overflow: visible;\n overflow-x: visible;\n overflow-y: visible;\n padding: 0;\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: auto;\n perspective: none;\n perspective-origin: 50% 50%;\n pointer-events: auto;\n position: static;\n right: auto;\n tab-size: 8;\n table-layout: auto;\n text-align: left;\n text-align-last: auto;\n text-decoration: none;\n text-indent: 0;\n text-shadow: none;\n text-transform: none;\n top: auto;\n transform: none;\n transform-origin: 50% 50% 0;\n transform-style: flat;\n transition: none 0s ease 0s;\n user-select: auto;\n vertical-align: baseline;\n white-space: normal;\n widows: 2;\n width: auto;\n word-spacing: normal;\n z-index: auto;\n /* Splunk-specific resets */\n border-width: 1px;\n box-sizing: border-box;\n color: ", ";\n cursor: inherit;\n display: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n outline: medium none ", ";\n visibility: inherit;\n "]);
31
31
 
32
32
  _templateObject = function _templateObject() {
33
33
  return data;
@@ -66,6 +66,14 @@ var reset = function reset() {
66
66
  var display = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'inline';
67
67
  return function () {
68
68
  return (0, _styledComponents.css)(_templateObject(), (0, _pick["default"])({
69
+ /*
70
+ use pick() rather than relying on variables.colorScheme
71
+ because there's no guarantee that variables.colorScheme
72
+ has to match the css color-scheme prop
73
+ */
74
+ dark: 'dark',
75
+ light: 'light'
76
+ }), (0, _pick["default"])({
69
77
  enterprise: _variables["default"].textColor,
70
78
  prisma: _variables["default"].contentColorDefault
71
79
  }), display, _variables["default"].fontFamily, _variables["default"].fontSize, _variables["default"].lineHeight, _variables["default"].focusColor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/themes",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
4
4
  "description": "Theme variables and mixins for the Splunk design language",
5
5
  "scripts": {
6
6
  "babel": "babel src -d . --ignore src/babel-plugin-base64-png,src/tests --ignore \"**/docs\" --extensions .js,.ts,.tsx",
@@ -16,6 +16,7 @@
16
16
  "test": "jest",
17
17
  "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",
18
18
  "test:watch": "jest --watch",
19
+ "pretypes:build": "rm -rf ./types",
19
20
  "types:build": "tsc --emitDeclarationOnly --declaration",
20
21
  "types:start": "yarn types:build --watch"
21
22
  },
@@ -17,7 +17,7 @@ interface TypographyParams {
17
17
  /**
18
18
  * Set the color to a system-standard color: e.g. `active` for `@splunk/themes/variables.contentColorActive`.
19
19
  */
20
- color?: 'active' | 'default' | 'disabled' | 'inverted' | 'muted';
20
+ color?: 'active' | 'default' | 'disabled' | 'inverted' | 'muted' | 'inherit';
21
21
  /**
22
22
  * Set the font-weight to a system-standard value.
23
23
  *
@@ -64,8 +64,8 @@ interface TypographyParams {
64
64
  * `'title3'`,
65
65
  * `'title4'`,
66
66
  * `'title5'`,
67
- * `'subtitle'`,
68
- * `'smallSubtitle'`,
67
+ * `'title6'`,
68
+ * `'title7'`,
69
69
  * `'largeBody'`,
70
70
  * `'smallBody'`,
71
71
  * `'footnote'`,