@lumx/core 3.10.1-alpha.5 → 3.10.1-alpha.6
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 +4 -4
- package/js/constants/index.min.js +1 -1
- package/js/constants/index.min.js.map +1 -1
- package/js/constants/keycodes.js +2 -2
- package/js/constants/keycodes.min.js +1 -1
- package/js/constants/keycodes.min.js.map +1 -1
- package/js/custom-colors.js +166 -167
- package/js/custom-colors.min.js +1 -1
- package/js/custom-colors.min.js.map +1 -1
- package/js/date-picker.js +313 -314
- package/js/date-picker.min.js +1 -1
- package/js/date-picker.min.js.map +1 -1
- package/js/utils.js +1088 -1204
- package/js/utils.min.js +1 -1
- package/js/utils.min.js.map +1 -1
- package/js/utils.ts +11 -9
- package/package.json +1 -1
package/js/utils.ts
CHANGED
|
@@ -2,9 +2,12 @@ import classNames from 'classnames';
|
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
-
import isBoolean from 'lodash/isBoolean';
|
|
6
5
|
import isEmpty from 'lodash/isEmpty';
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
/** Transform camelCase to kebab-case */
|
|
8
|
+
function camelToKebabCase(str: string): string {
|
|
9
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
10
|
+
}
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Enhance isEmpty method to also works with numbers.
|
|
@@ -37,7 +40,7 @@ export function getBasicClass({
|
|
|
37
40
|
type: string;
|
|
38
41
|
value: string | number | boolean | undefined;
|
|
39
42
|
}): string {
|
|
40
|
-
if (
|
|
43
|
+
if (typeof value === 'boolean') {
|
|
41
44
|
if (!value) {
|
|
42
45
|
// False value should not return a class.
|
|
43
46
|
return '';
|
|
@@ -45,13 +48,13 @@ export function getBasicClass({
|
|
|
45
48
|
const booleanPrefixes = ['has', 'is'];
|
|
46
49
|
|
|
47
50
|
if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {
|
|
48
|
-
return `${prefix}--${
|
|
51
|
+
return `${prefix}--${camelToKebabCase(type)}`;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
return `${prefix}--is-${
|
|
54
|
+
return `${prefix}--is-${camelToKebabCase(type)}`;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
return `${prefix}--${
|
|
57
|
+
return `${prefix}--${camelToKebabCase(type)}-${value}`;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|
|
@@ -69,9 +72,8 @@ export function handleBasicClasses({ prefix, ...props }: { prefix: string; [prop
|
|
|
69
72
|
const otherClasses: any = {};
|
|
70
73
|
if (!isEmpty(props)) {
|
|
71
74
|
Object.keys(props).forEach((prop) => {
|
|
72
|
-
otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] =
|
|
73
|
-
? props[prop]
|
|
74
|
-
: !_isEmpty(props[prop]);
|
|
75
|
+
otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] =
|
|
76
|
+
typeof props[prop] === 'boolean' ? props[prop] : !_isEmpty(props[prop]);
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
|
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.6",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/core": "^7.18.13",
|
|
46
46
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|