dibk-design 3.2.1 → 3.2.3
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/dist/components/Button.js +21 -12
- package/dist/functions/helpers.js +1 -1
- package/dist/functions/theme.js +12 -12
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
20
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
21
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
22
|
var Button = function Button(props) {
|
|
23
|
-
var _props$href, _props$href2, _props$children
|
|
23
|
+
var _props$href, _props$href2, _props$children;
|
|
24
24
|
var getArrowClass = function getArrowClass(arrow) {
|
|
25
25
|
switch (arrow) {
|
|
26
26
|
case "left":
|
|
@@ -53,17 +53,26 @@ var Button = function Button(props) {
|
|
|
53
53
|
var buttonColor = (props === null || props === void 0 ? void 0 : props.inputType) === "radio" ? props.defaultChecked ? "primary" : "default" : props.color;
|
|
54
54
|
var themeStyle = props.theme ? getThemeStyle(props.theme, buttonColor) : null;
|
|
55
55
|
var className = (0, _helpers.classNameArrayToClassNameString)([_ButtonModule.default.button, _ButtonModule.default[buttonColor], _ButtonModule.default[props.size], getArrowClass(props.arrow), props.theme && _ButtonModule.default.hasTheme, props.noHover || (props === null || props === void 0 ? void 0 : props.inputType) === "radio" ? _ButtonModule.default.noHover : null, props.rounded && _ButtonModule.default.rounded, props.hasErrors && _ButtonModule.default.hasErrors, props.disabled && _ButtonModule.default.disabled]);
|
|
56
|
-
var
|
|
56
|
+
var renderReactLinkElements = function renderReactLinkElements(childElements) {
|
|
57
57
|
var childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
|
|
58
58
|
return childElementsthroughFragments.map(function (childElement, index) {
|
|
59
|
-
var _childElement$props
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
var _childElement$props;
|
|
60
|
+
if (!buttonProps.disabled && !!(childElement !== null && childElement !== void 0 && (_childElement$props = childElement.props) !== null && _childElement$props !== void 0 && _childElement$props.to)) {
|
|
61
|
+
var _childElement$props2, _childElement$props3;
|
|
62
|
+
var childElementCopy = _react.default.cloneElement(childElement, {
|
|
63
|
+
className: className,
|
|
64
|
+
style: themeStyle,
|
|
65
|
+
key: "button-".concat(index),
|
|
66
|
+
to: !buttonProps.disabled && childElement !== null && childElement !== void 0 && (_childElement$props2 = childElement.props) !== null && _childElement$props2 !== void 0 && _childElement$props2.to ? childElement === null || childElement === void 0 || (_childElement$props3 = childElement.props) === null || _childElement$props3 === void 0 ? void 0 : _childElement$props3.to : null
|
|
67
|
+
});
|
|
68
|
+
return childElementCopy;
|
|
69
|
+
} else {
|
|
70
|
+
return _react.default.createElement("button", _extends({}, buttonProps, {
|
|
71
|
+
key: "button-".concat(index),
|
|
72
|
+
className: className,
|
|
73
|
+
style: themeStyle
|
|
74
|
+
}), props.content || childElement.props.children);
|
|
75
|
+
}
|
|
67
76
|
});
|
|
68
77
|
};
|
|
69
78
|
if (props.inputType === "button") {
|
|
@@ -85,8 +94,8 @@ var Button = function Button(props) {
|
|
|
85
94
|
className: className,
|
|
86
95
|
style: themeStyle
|
|
87
96
|
}), props.content || props.children);
|
|
88
|
-
} else if ((props === null || props === void 0
|
|
89
|
-
return _react.default.createElement(_react.Fragment, null,
|
|
97
|
+
} else if ((props === null || props === void 0 || (_props$children = props.children) === null || _props$children === void 0 || (_props$children = _props$children.type) === null || _props$children === void 0 ? void 0 : _props$children.displayName) === "Link") {
|
|
98
|
+
return _react.default.createElement(_react.Fragment, null, renderReactLinkElements(_react.default.Children.toArray(props.children)));
|
|
90
99
|
} else {
|
|
91
100
|
return _react.default.createElement("button", _extends({}, buttonProps, {
|
|
92
101
|
className: className,
|
|
@@ -13,7 +13,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
13
13
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
14
|
var classNameArrayToClassNameString = function classNameArrayToClassNameString(classNameArray) {
|
|
15
15
|
var _classNameArray$filte;
|
|
16
|
-
return (classNameArray === null || classNameArray === void 0
|
|
16
|
+
return (classNameArray === null || classNameArray === void 0 || (_classNameArray$filte = classNameArray.filter(function (className) {
|
|
17
17
|
return className;
|
|
18
18
|
})) === null || _classNameArray$filte === void 0 ? void 0 : _classNameArray$filte.join(" ")) || "";
|
|
19
19
|
};
|
package/dist/functions/theme.js
CHANGED
|
@@ -5,28 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getThemeTextColor = exports.getThemePaletteTextColor = exports.getThemePaletteBorderColor = exports.getThemePaletteBackgroundColor = exports.getThemeNavigationBarTextColor = exports.getThemeNavigationBarBackgroundColor = exports.getThemeLogoPadding = exports.getThemeLogo = exports.getThemeLinkColor = exports.getThemeAppName = void 0;
|
|
7
7
|
var getThemePaletteBackgroundColor = function getThemePaletteBackgroundColor(theme, color) {
|
|
8
|
-
var _theme$colors
|
|
9
|
-
return (theme === null || theme === void 0
|
|
8
|
+
var _theme$colors;
|
|
9
|
+
return (theme === null || theme === void 0 || (_theme$colors = theme.colors) === null || _theme$colors === void 0 || (_theme$colors = _theme$colors.palette) === null || _theme$colors === void 0 || (_theme$colors = _theme$colors[color]) === null || _theme$colors === void 0 ? void 0 : _theme$colors.background) || null;
|
|
10
10
|
};
|
|
11
11
|
exports.getThemePaletteBackgroundColor = getThemePaletteBackgroundColor;
|
|
12
12
|
var getThemePaletteTextColor = function getThemePaletteTextColor(theme, color) {
|
|
13
|
-
var _theme$colors2
|
|
14
|
-
return (theme === null || theme === void 0
|
|
13
|
+
var _theme$colors2;
|
|
14
|
+
return (theme === null || theme === void 0 || (_theme$colors2 = theme.colors) === null || _theme$colors2 === void 0 || (_theme$colors2 = _theme$colors2.palette) === null || _theme$colors2 === void 0 || (_theme$colors2 = _theme$colors2[color]) === null || _theme$colors2 === void 0 ? void 0 : _theme$colors2.text) || null;
|
|
15
15
|
};
|
|
16
16
|
exports.getThemePaletteTextColor = getThemePaletteTextColor;
|
|
17
17
|
var getThemePaletteBorderColor = function getThemePaletteBorderColor(theme, color) {
|
|
18
|
-
var _theme$colors3
|
|
19
|
-
return (theme === null || theme === void 0
|
|
18
|
+
var _theme$colors3;
|
|
19
|
+
return (theme === null || theme === void 0 || (_theme$colors3 = theme.colors) === null || _theme$colors3 === void 0 || (_theme$colors3 = _theme$colors3.palette) === null || _theme$colors3 === void 0 || (_theme$colors3 = _theme$colors3[color]) === null || _theme$colors3 === void 0 ? void 0 : _theme$colors3.border) || null;
|
|
20
20
|
};
|
|
21
21
|
exports.getThemePaletteBorderColor = getThemePaletteBorderColor;
|
|
22
22
|
var getThemeNavigationBarBackgroundColor = function getThemeNavigationBarBackgroundColor(theme) {
|
|
23
|
-
var _theme$colors4
|
|
24
|
-
return (theme === null || theme === void 0
|
|
23
|
+
var _theme$colors4;
|
|
24
|
+
return (theme === null || theme === void 0 || (_theme$colors4 = theme.colors) === null || _theme$colors4 === void 0 || (_theme$colors4 = _theme$colors4.navigationBar) === null || _theme$colors4 === void 0 ? void 0 : _theme$colors4.background) || null;
|
|
25
25
|
};
|
|
26
26
|
exports.getThemeNavigationBarBackgroundColor = getThemeNavigationBarBackgroundColor;
|
|
27
27
|
var getThemeNavigationBarTextColor = function getThemeNavigationBarTextColor(theme) {
|
|
28
|
-
var _theme$colors5
|
|
29
|
-
return (theme === null || theme === void 0
|
|
28
|
+
var _theme$colors5;
|
|
29
|
+
return (theme === null || theme === void 0 || (_theme$colors5 = theme.colors) === null || _theme$colors5 === void 0 || (_theme$colors5 = _theme$colors5.navigationBar) === null || _theme$colors5 === void 0 ? void 0 : _theme$colors5.text) || null;
|
|
30
30
|
};
|
|
31
31
|
exports.getThemeNavigationBarTextColor = getThemeNavigationBarTextColor;
|
|
32
32
|
var getThemeLogo = function getThemeLogo(theme) {
|
|
@@ -43,11 +43,11 @@ var getThemeAppName = function getThemeAppName(theme) {
|
|
|
43
43
|
exports.getThemeAppName = getThemeAppName;
|
|
44
44
|
var getThemeTextColor = function getThemeTextColor(theme) {
|
|
45
45
|
var _theme$colors6;
|
|
46
|
-
return (theme === null || theme === void 0
|
|
46
|
+
return (theme === null || theme === void 0 || (_theme$colors6 = theme.colors) === null || _theme$colors6 === void 0 ? void 0 : _theme$colors6.text) || null;
|
|
47
47
|
};
|
|
48
48
|
exports.getThemeTextColor = getThemeTextColor;
|
|
49
49
|
var getThemeLinkColor = function getThemeLinkColor(theme) {
|
|
50
50
|
var _theme$colors7;
|
|
51
|
-
return (theme === null || theme === void 0
|
|
51
|
+
return (theme === null || theme === void 0 || (_theme$colors7 = theme.colors) === null || _theme$colors7 === void 0 ? void 0 : _theme$colors7.link) || null;
|
|
52
52
|
};
|
|
53
53
|
exports.getThemeLinkColor = getThemeLinkColor;
|