@kausal/themes 0.5.1 → 0.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/props.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kausal/themes",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Themes for Kausal products",
5
5
  "type": "module",
6
6
  "main": "setup.cjs",
package/props.js CHANGED
@@ -5,9 +5,19 @@ const { number, exact, string, oneOfType, bool, array, object } = PropTypes;
5
5
  export function makeThemePropType(cssv = null) {
6
6
  if (!cssv) {
7
7
  // No CSS validation
8
- cssv = (propName) => () => null;
8
+ cssv = () => {
9
+ const validate = () => null;
10
+ validate.allowEmpty = () => null;
11
+ validate.isRequired = (props, propName) => {
12
+ const val = props[propName];
13
+ if (val === null || val === undefined) {
14
+ return new Error(`${propName} missing or null`);
15
+ }
16
+ }
17
+ return validate;
18
+ }
9
19
  }
10
- return exact({
20
+ const props = {
11
21
  actionColor: cssv("color").isRequired,
12
22
  actionColorFg: cssv("color").isRequired,
13
23
  actionCompletedColor: cssv("color").isRequired,
@@ -176,5 +186,6 @@ export function makeThemePropType(cssv = null) {
176
186
  cardPlacement: string,
177
187
  }),
178
188
  }),
179
- });
189
+ };
190
+ return exact(props);
180
191
  }