dibk-design 3.2.1 → 3.2.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/dist/components/Button.js +19 -10
- package/package.json +1 -1
|
@@ -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, _childElement$
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
var _childElement$props, _childElement$props$t;
|
|
60
|
+
if (!buttonProps.disabled && childElement !== null && childElement !== void 0 && (_childElement$props = childElement.props) !== null && _childElement$props !== void 0 && (_childElement$props$t = _childElement$props.to) !== null && _childElement$props$t !== void 0 && _childElement$props$t.length) {
|
|
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 ? 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") {
|
|
@@ -86,7 +95,7 @@ var Button = function Button(props) {
|
|
|
86
95
|
style: themeStyle
|
|
87
96
|
}), props.content || props.children);
|
|
88
97
|
} else if ((props === null || props === void 0 ? void 0 : (_props$children = props.children) === null || _props$children === void 0 ? void 0 : (_props$children$type = _props$children.type) === null || _props$children$type === void 0 ? void 0 : _props$children$type.displayName) === "Link") {
|
|
89
|
-
return _react.default.createElement(_react.Fragment, null,
|
|
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,
|