@elliemae/ds-classnames 2.2.0-alpha.3 → 2.2.0-next.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/cjs/aggregatedClasses.js +89 -68
- package/cjs/classNameManager.js +77 -68
- package/cjs/converPropsToFormModifiers.js +25 -48
- package/cjs/convertPropToFeedBackModifiers.js +25 -51
- package/cjs/convertPropsToColorModifiers.js +21 -41
- package/cjs/convertPropsToLayoutModifiers.js +27 -51
- package/cjs/convertPropsToSizeModifiers.js +28 -62
- package/cjs/convertPropsToTextModifiers.js +23 -43
- package/cjs/index.js +12 -38
- package/cjs/validateNativeProps.js +31 -48
- package/esm/aggregatedClasses.js +75 -41
- package/esm/classNameManager.js +67 -38
- package/esm/converPropsToFormModifiers.js +23 -19
- package/esm/convertPropToFeedBackModifiers.js +23 -22
- package/esm/convertPropsToColorModifiers.js +19 -12
- package/esm/convertPropsToLayoutModifiers.js +25 -22
- package/esm/convertPropsToSizeModifiers.js +26 -33
- package/esm/convertPropsToTextModifiers.js +21 -14
- package/esm/index.js +2 -9
- package/esm/validateNativeProps.js +19 -19
- package/package.json +3 -3
- package/types/classNameManager.d.ts +0 -1
- package/types/converPropsToFormModifiers.d.ts +0 -1
- package/types/convertPropToFeedBackModifiers.d.ts +0 -1
- package/types/convertPropsToColorModifiers.d.ts +0 -1
- package/types/convertPropsToLayoutModifiers.d.ts +0 -1
- package/types/convertPropsToSizeModifiers.d.ts +0 -1
- package/types/convertPropsToTextModifiers.d.ts +0 -1
- package/cjs/aggregatedClasses.js.map +0 -7
- package/cjs/aggregatedClasses.md +0 -323
- package/cjs/classNameManager.js.map +0 -7
- package/cjs/converPropsToFormModifiers.js.map +0 -7
- package/cjs/convertPropToFeedBackModifiers.js.map +0 -7
- package/cjs/convertPropsToColorModifiers.js.map +0 -7
- package/cjs/convertPropsToLayoutModifiers.js.map +0 -7
- package/cjs/convertPropsToSizeModifiers.js.map +0 -7
- package/cjs/convertPropsToTextModifiers.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/validateNativeProps.js.map +0 -7
- package/esm/aggregatedClasses.js.map +0 -7
- package/esm/aggregatedClasses.md +0 -323
- package/esm/classNameManager.js.map +0 -7
- package/esm/converPropsToFormModifiers.js.map +0 -7
- package/esm/convertPropToFeedBackModifiers.js.map +0 -7
- package/esm/convertPropsToColorModifiers.js.map +0 -7
- package/esm/convertPropsToLayoutModifiers.js.map +0 -7
- package/esm/convertPropsToSizeModifiers.js.map +0 -7
- package/esm/convertPropsToTextModifiers.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/validateNativeProps.js.map +0 -7
|
@@ -1,65 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var convertPropsToLayoutModifiers_exports = {};
|
|
29
|
-
__export(convertPropsToLayoutModifiers_exports, {
|
|
30
|
-
default: () => convertPropsToLayoutModifiers_default,
|
|
31
|
-
pipe: () => pipe
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
const basicAction = ({
|
|
35
|
-
id,
|
|
36
|
-
buttonType = "default",
|
|
37
|
-
fluidWidth = false,
|
|
38
|
-
fluidHeight = false
|
|
39
|
-
}) => {
|
|
40
|
-
const cssModifier = [];
|
|
41
|
-
if (id)
|
|
42
|
-
cssModifier.push(`id-${id}`);
|
|
43
|
-
if (buttonType)
|
|
44
|
-
cssModifier.push(buttonType);
|
|
45
|
-
if (fluidWidth)
|
|
46
|
-
cssModifier.push("fluid-width");
|
|
47
|
-
if (fluidHeight)
|
|
48
|
-
cssModifier.push("fluid-height");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
|
|
8
|
+
const basicAction = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
id,
|
|
11
|
+
buttonType = 'default',
|
|
12
|
+
fluidWidth = false,
|
|
13
|
+
fluidHeight = false
|
|
14
|
+
} = _ref;
|
|
15
|
+
const cssModifier = []; // buttons types
|
|
16
|
+
|
|
17
|
+
if (id) cssModifier.push("id-".concat(id));
|
|
18
|
+
if (buttonType) cssModifier.push(buttonType);
|
|
19
|
+
if (fluidWidth) cssModifier.push('fluid-width');
|
|
20
|
+
if (fluidHeight) cssModifier.push('fluid-height');
|
|
49
21
|
return cssModifier;
|
|
50
22
|
};
|
|
23
|
+
|
|
51
24
|
const instance = [basicAction];
|
|
25
|
+
|
|
52
26
|
const pipe = () => ({
|
|
53
27
|
getInstance() {
|
|
54
28
|
return instance;
|
|
55
29
|
},
|
|
30
|
+
|
|
56
31
|
add(customModifier) {
|
|
57
32
|
instance.push(customModifier);
|
|
58
33
|
},
|
|
34
|
+
|
|
59
35
|
execute(props) {
|
|
60
36
|
return instance.reduce((temp, action) => [...temp, ...action(props)], []);
|
|
61
37
|
}
|
|
38
|
+
|
|
62
39
|
});
|
|
63
|
-
|
|
64
|
-
module.exports =
|
|
65
|
-
//# sourceMappingURL=convertPropsToLayoutModifiers.js.map
|
|
40
|
+
|
|
41
|
+
module.exports = pipe;
|
|
@@ -1,77 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var convertPropsToSizeModifiers_exports = {};
|
|
29
|
-
__export(convertPropsToSizeModifiers_exports, {
|
|
30
|
-
default: () => convertPropsToSizeModifiers_default,
|
|
31
|
-
pipe: () => pipe
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
const basicAction = ({
|
|
35
|
-
size = null,
|
|
36
|
-
extraTight = false,
|
|
37
|
-
tight = false,
|
|
38
|
-
base = false,
|
|
39
|
-
bitLoose = false,
|
|
40
|
-
loose = false,
|
|
41
|
-
extraLoose = false,
|
|
42
|
-
superLoose = false
|
|
43
|
-
}) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
|
|
8
|
+
const basicAction = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
size = null,
|
|
11
|
+
extraTight = false,
|
|
12
|
+
tight = false,
|
|
13
|
+
base = false,
|
|
14
|
+
bitLoose = false,
|
|
15
|
+
loose = false,
|
|
16
|
+
extraLoose = false,
|
|
17
|
+
superLoose = false
|
|
18
|
+
} = _ref;
|
|
44
19
|
const cssModifier = [];
|
|
45
|
-
if (size)
|
|
46
|
-
|
|
47
|
-
if (extraTight)
|
|
48
|
-
cssModifier.push("size-extra-tight");
|
|
49
|
-
else if (tight)
|
|
50
|
-
cssModifier.push("size-tight");
|
|
51
|
-
else if (base)
|
|
52
|
-
cssModifier.push("size-base");
|
|
53
|
-
else if (bitLoose)
|
|
54
|
-
cssModifier.push("size-bit-loose");
|
|
55
|
-
else if (loose)
|
|
56
|
-
cssModifier.push("size-loose");
|
|
57
|
-
else if (extraLoose)
|
|
58
|
-
cssModifier.push("size-extra-loose");
|
|
59
|
-
else if (superLoose)
|
|
60
|
-
cssModifier.push("size-super-loose");
|
|
20
|
+
if (size) cssModifier.push("".concat(size)); // Size as Flag
|
|
21
|
+
|
|
22
|
+
if (extraTight) cssModifier.push('size-extra-tight');else if (tight) cssModifier.push('size-tight');else if (base) cssModifier.push('size-base');else if (bitLoose) cssModifier.push('size-bit-loose');else if (loose) cssModifier.push('size-loose');else if (extraLoose) cssModifier.push('size-extra-loose');else if (superLoose) cssModifier.push('size-super-loose');
|
|
61
23
|
return cssModifier;
|
|
62
24
|
};
|
|
25
|
+
|
|
63
26
|
const instance = [basicAction];
|
|
27
|
+
|
|
64
28
|
const pipe = () => ({
|
|
65
29
|
getInstance() {
|
|
66
30
|
return instance;
|
|
67
31
|
},
|
|
32
|
+
|
|
68
33
|
add(customModifier) {
|
|
69
34
|
instance.push(customModifier);
|
|
70
35
|
},
|
|
36
|
+
|
|
71
37
|
execute(props) {
|
|
72
38
|
return instance.reduce((temp, action) => [...temp, ...action(props)], []);
|
|
73
39
|
}
|
|
40
|
+
|
|
74
41
|
});
|
|
75
|
-
|
|
76
|
-
module.exports =
|
|
77
|
-
//# sourceMappingURL=convertPropsToSizeModifiers.js.map
|
|
42
|
+
|
|
43
|
+
module.exports = pipe;
|
|
@@ -1,58 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var convertPropsToTextModifiers_exports = {};
|
|
29
|
-
__export(convertPropsToTextModifiers_exports, {
|
|
30
|
-
default: () => convertPropsToTextModifiers_default,
|
|
31
|
-
pipe: () => pipe
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
const basicAction = ({ textEllipsis, textAlignment, wordBreak }) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
|
|
8
|
+
const basicAction = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
textEllipsis,
|
|
11
|
+
textAlignment,
|
|
12
|
+
wordBreak
|
|
13
|
+
} = _ref;
|
|
35
14
|
const cssModifier = [];
|
|
36
|
-
if (textEllipsis)
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
cssModifier.push("text-overflow-word-break");
|
|
40
|
-
if (["left", "right", "center", "justify"].indexOf(textAlignment) > -1)
|
|
41
|
-
cssModifier.push(`text-align-${textAlignment}`);
|
|
15
|
+
if (textEllipsis) cssModifier.push('text-overflow-ellipsis');
|
|
16
|
+
if (wordBreak) cssModifier.push('text-overflow-word-break');
|
|
17
|
+
if (['left', 'right', 'center', 'justify'].indexOf(textAlignment) > -1) cssModifier.push("text-align-".concat(textAlignment));
|
|
42
18
|
return cssModifier;
|
|
43
19
|
};
|
|
20
|
+
|
|
44
21
|
const instance = [basicAction];
|
|
22
|
+
|
|
45
23
|
const pipe = () => ({
|
|
46
24
|
getInstance() {
|
|
47
25
|
return instance;
|
|
48
26
|
},
|
|
27
|
+
|
|
49
28
|
add(customModifier) {
|
|
50
29
|
instance.push(customModifier);
|
|
51
30
|
},
|
|
31
|
+
|
|
52
32
|
execute(props) {
|
|
53
33
|
return instance.reduce((temp, action) => [...temp, ...action(props)], []);
|
|
54
34
|
}
|
|
35
|
+
|
|
55
36
|
});
|
|
56
|
-
|
|
57
|
-
module.exports =
|
|
58
|
-
//# sourceMappingURL=convertPropsToTextModifiers.js.map
|
|
37
|
+
|
|
38
|
+
module.exports = pipe;
|
package/cjs/index.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
aggregatedClasses: () => import_aggregatedClasses.default,
|
|
31
|
-
convertPropToCssClassName: () => import_classNameManager.default,
|
|
32
|
-
cssPrefix: () => import_classNameManager.cssPrefix
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_classNameManager = __toESM(require("./classNameManager"));
|
|
36
|
-
var import_aggregatedClasses = __toESM(require("./aggregatedClasses"));
|
|
37
|
-
module.exports = __toCommonJS(src_exports);
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var classNameManager = require('./classNameManager.js');
|
|
6
|
+
var aggregatedClasses = require('./aggregatedClasses.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.convertPropToCssClassName = classNameManager["default"];
|
|
11
|
+
exports.cssPrefix = classNameManager.cssPrefix;
|
|
12
|
+
exports.aggregatedClasses = aggregatedClasses["default"];
|
|
@@ -1,39 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var validateNativeProps_exports = {};
|
|
29
|
-
__export(validateNativeProps_exports, {
|
|
30
|
-
isAriaAttribute: () => isAriaAttribute,
|
|
31
|
-
isDataAttribute: () => isDataAttribute,
|
|
32
|
-
isNativeHTMLElement: () => isNativeHTMLElement,
|
|
33
|
-
isValidNativeAttribute: () => isValidNativeAttribute,
|
|
34
|
-
whiteList: () => whiteList
|
|
35
|
-
});
|
|
36
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable max-lines */
|
|
37
21
|
const attributeWhiteList = {
|
|
38
22
|
accept: true,
|
|
39
23
|
acceptCharset: true,
|
|
@@ -301,15 +285,10 @@ const eventsWhiteList = {
|
|
|
301
285
|
onTransitionEnd: true,
|
|
302
286
|
onToggle: true
|
|
303
287
|
};
|
|
304
|
-
const whiteList = {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
...eventsWhiteList
|
|
309
|
-
};
|
|
310
|
-
const isDataAttribute = (attribute) => attribute.substring(0, 5) === "data-";
|
|
311
|
-
const isAriaAttribute = (attribute) => attribute.substring(0, 6) === "aria-";
|
|
312
|
-
const isValidNativeAttribute = (attribute) => whiteList[attribute] === true || isDataAttribute(attribute) || isAriaAttribute(attribute) || attribute.toLowerCase() === attribute;
|
|
288
|
+
const whiteList = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, attributeWhiteList), svgAttributesWhiteList), otherWhiteList), eventsWhiteList);
|
|
289
|
+
const isDataAttribute = attribute => attribute.substring(0, 5) === 'data-';
|
|
290
|
+
const isAriaAttribute = attribute => attribute.substring(0, 6) === 'aria-';
|
|
291
|
+
const isValidNativeAttribute = attribute => whiteList[attribute] === true || isDataAttribute(attribute) || isAriaAttribute(attribute) || attribute.toLowerCase() === attribute;
|
|
313
292
|
const nativeHTMLElements = {
|
|
314
293
|
a: true,
|
|
315
294
|
abbr: true,
|
|
@@ -424,6 +403,10 @@ const nativeHTMLElements = {
|
|
|
424
403
|
video: true,
|
|
425
404
|
wbr: true
|
|
426
405
|
};
|
|
427
|
-
const isNativeHTMLElement =
|
|
428
|
-
|
|
429
|
-
|
|
406
|
+
const isNativeHTMLElement = type => nativeHTMLElements[type] === true;
|
|
407
|
+
|
|
408
|
+
exports.isAriaAttribute = isAriaAttribute;
|
|
409
|
+
exports.isDataAttribute = isDataAttribute;
|
|
410
|
+
exports.isNativeHTMLElement = isNativeHTMLElement;
|
|
411
|
+
exports.isValidNativeAttribute = isValidNativeAttribute;
|
|
412
|
+
exports.whiteList = whiteList;
|
package/esm/aggregatedClasses.js
CHANGED
|
@@ -1,44 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import cx from 'obj-str';
|
|
12
|
+
import DimsumConfig from '@elliemae/ds-shared/dimsum.config';
|
|
13
|
+
import cssPipeline from './classNameManager.js';
|
|
14
|
+
import { isNativeHTMLElement, isValidNativeAttribute } from './validateNativeProps.js';
|
|
15
|
+
|
|
16
|
+
const _excluded = ["innerRef", "children", "classProps", "useComponent", "className", "as"];
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
const cssPrefix = DimsumConfig.classNamePrefix;
|
|
22
|
+
|
|
23
|
+
const generateClassNameWithModifier = (block, element, modifier) => "".concat(cssPrefix, "-").concat(block).concat(element ? "__".concat(element) : '', "--").concat(modifier);
|
|
24
|
+
|
|
25
|
+
const appendBlockAndPrefixToObj = (obj, block, element) => obj ? Object.keys(obj).reduce((acc, key) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
26
|
+
["".concat(generateClassNameWithModifier(block, element, key))]: obj[key]
|
|
15
27
|
}), {}) : [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
const aggregatedClasses = (type, props) => function (block, element, additionalModifiers) {
|
|
30
|
+
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
31
|
+
return /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
32
|
+
let {
|
|
33
|
+
innerRef,
|
|
34
|
+
children,
|
|
35
|
+
classProps,
|
|
36
|
+
useComponent,
|
|
37
|
+
className,
|
|
38
|
+
as
|
|
39
|
+
} = _ref,
|
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
|
|
42
|
+
// get the additional classNames either from a function or an object
|
|
43
|
+
let otherModifiers = appendBlockAndPrefixToObj(additionalModifiers, block, element);
|
|
44
|
+
if (typeof additionalModifiers === 'function') otherModifiers = appendBlockAndPrefixToObj(additionalModifiers(_objectSpread(_objectSpread(_objectSpread({}, rest), classProps), {}, {
|
|
45
|
+
className
|
|
46
|
+
})), block, element);
|
|
47
|
+
const otherModifiersStr = cx(otherModifiers);
|
|
48
|
+
const {
|
|
49
|
+
prefix,
|
|
50
|
+
propsToRemoveFromFinalElement = []
|
|
51
|
+
} = options;
|
|
52
|
+
const {
|
|
53
|
+
cssClassName: classNames
|
|
54
|
+
} = cssPipeline(block, null, _objectSpread({}, classProps), {
|
|
55
|
+
prefix,
|
|
56
|
+
element
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const cleanedPropsPassedDown = _objectSpread(_objectSpread({}, props), rest);
|
|
60
|
+
|
|
61
|
+
propsToRemoveFromFinalElement.forEach(propKey => {
|
|
62
|
+
delete cleanedPropsPassedDown[propKey];
|
|
31
63
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
|
|
65
|
+
if (isNativeHTMLElement(block)) {
|
|
66
|
+
Object.keys(cleanedPropsPassedDown).forEach(key => {
|
|
67
|
+
if (!isValidNativeAttribute(key)) delete cleanedPropsPassedDown[key];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React.createElement(as || type, _objectSpread({
|
|
72
|
+
ref: innerRef || ref,
|
|
73
|
+
className: [classNames, otherModifiersStr, className].join(' ')
|
|
74
|
+
}, cleanedPropsPassedDown), children);
|
|
75
|
+
});
|
|
43
76
|
};
|
|
44
|
-
|
|
77
|
+
|
|
78
|
+
export { cssPrefix, aggregatedClasses as default };
|