@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.
- package/package.json +1 -1
- package/props.js +14 -3
package/package.json
CHANGED
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 = (
|
|
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
|
-
|
|
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
|
}
|