@lumx/core 3.10.1-alpha.6 → 3.10.1-alpha.7
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/js/constants/design-tokens.js +2 -2
- package/js/constants/design-tokens.min.js +1 -1
- package/js/constants/design-tokens.min.js.map +1 -1
- package/js/constants/index.js +63 -63
- package/js/constants/index.min.js +1 -1
- package/js/constants/index.min.js.map +1 -1
- package/js/custom-colors.js +337 -344
- package/js/custom-colors.min.js +1 -1
- package/js/custom-colors.min.js.map +1 -1
- package/js/date-picker.js +763 -773
- package/js/date-picker.min.js +1 -1
- package/js/date-picker.min.js.map +1 -1
- package/js/utils.js +1405 -1918
- package/js/utils.min.js +1 -1
- package/js/utils.min.js.map +1 -1
- package/js/utils.ts +17 -24
- package/package.json +1 -1
package/js/utils.ts
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import React from 'react';
|
|
4
2
|
|
|
5
|
-
import
|
|
3
|
+
import type React from 'react';
|
|
6
4
|
|
|
7
5
|
/** Transform camelCase to kebab-case */
|
|
8
6
|
function camelToKebabCase(str: string): string {
|
|
9
7
|
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
* Enhance isEmpty method to also works with numbers.
|
|
14
|
-
*
|
|
15
|
-
* @param value The value to check.
|
|
16
|
-
* @return Whether the input value is empty or != 0.
|
|
17
|
-
*/
|
|
18
|
-
const _isEmpty = (value: any) => {
|
|
19
|
-
if (typeof value === 'number') {
|
|
20
|
-
return value === 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return isEmpty(value);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
10
|
/**
|
|
27
11
|
* Get the basic CSS class for the given type.
|
|
28
12
|
*
|
|
@@ -38,7 +22,7 @@ export function getBasicClass({
|
|
|
38
22
|
}: {
|
|
39
23
|
prefix: string;
|
|
40
24
|
type: string;
|
|
41
|
-
value: string | number | boolean | undefined;
|
|
25
|
+
value: string | number | boolean | undefined | null;
|
|
42
26
|
}): string {
|
|
43
27
|
if (typeof value === 'boolean') {
|
|
44
28
|
if (!value) {
|
|
@@ -68,13 +52,22 @@ export function getBasicClass({
|
|
|
68
52
|
* be used in the classname to represent the value of the given prop.
|
|
69
53
|
* @return All LumX basic CSS classes.
|
|
70
54
|
*/
|
|
71
|
-
export function handleBasicClasses({
|
|
55
|
+
export function handleBasicClasses({
|
|
56
|
+
prefix,
|
|
57
|
+
...props
|
|
58
|
+
}: {
|
|
59
|
+
prefix: string;
|
|
60
|
+
[prop: string]: string | number | boolean | null | undefined;
|
|
61
|
+
}): string {
|
|
72
62
|
const otherClasses: any = {};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
const propKeys = Object.keys(props);
|
|
64
|
+
if (propKeys.length > 1) {
|
|
65
|
+
for (const prop of propKeys) {
|
|
66
|
+
if (props[prop]) {
|
|
67
|
+
const className = getBasicClass({ prefix, type: prop, value: props[prop] });
|
|
68
|
+
otherClasses[className] = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
78
71
|
}
|
|
79
72
|
|
|
80
73
|
return classNames(prefix, otherClasses);
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
|
-
"version": "3.10.1-alpha.
|
|
43
|
+
"version": "3.10.1-alpha.7",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/core": "^7.18.13",
|
|
46
46
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|