dibk-design 2.0.8 → 2.1.1
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.
|
@@ -43,17 +43,27 @@ var Button = function Button(props) {
|
|
|
43
43
|
delete buttonProps.noHover;
|
|
44
44
|
delete buttonProps.hasErrors;
|
|
45
45
|
delete buttonProps.rounded;
|
|
46
|
-
delete buttonProps.
|
|
46
|
+
delete buttonProps.inputType;
|
|
47
47
|
delete buttonProps.color;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
delete buttonProps.content;
|
|
49
|
+
delete buttonProps.arrow;
|
|
50
|
+
var buttonColor = (props === null || props === void 0 ? void 0 : props.inputType) === "radio" ? props.defaultChecked ? "primary" : "default" : props.color;
|
|
51
|
+
var themeStyle = props.theme ? getThemeStyle(props.theme, buttonColor) : null;
|
|
52
|
+
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]);
|
|
53
|
+
if (props.inputType === "button") {
|
|
51
54
|
return _react.default.createElement("input", _extends({}, buttonProps, {
|
|
52
55
|
className: className,
|
|
53
56
|
style: themeStyle,
|
|
54
57
|
type: "button",
|
|
55
58
|
value: props.content
|
|
56
59
|
}));
|
|
60
|
+
} else if (props.inputType === "radio") {
|
|
61
|
+
return _react.default.createElement("label", {
|
|
62
|
+
className: className
|
|
63
|
+
}, _react.default.createElement("input", _extends({}, buttonProps, {
|
|
64
|
+
style: themeStyle,
|
|
65
|
+
type: "radio"
|
|
66
|
+
})), props.content);
|
|
57
67
|
} else if ((_props$href = props.href) !== null && _props$href !== void 0 && _props$href.length) {
|
|
58
68
|
return _react.default.createElement("a", _extends({}, buttonProps, {
|
|
59
69
|
className: className,
|
|
@@ -73,7 +83,9 @@ Button.propTypes = {
|
|
|
73
83
|
arrow: _propTypes.default.oneOf(["none", "left", "right"]),
|
|
74
84
|
theme: _propTypes.default.object,
|
|
75
85
|
disabled: _propTypes.default.bool,
|
|
76
|
-
|
|
86
|
+
inputType: _propTypes.default.oneOf(["button", "radio"]),
|
|
87
|
+
name: _propTypes.default.string,
|
|
88
|
+
defaultChecked: _propTypes.default.bool,
|
|
77
89
|
required: _propTypes.default.bool,
|
|
78
90
|
hasErrors: _propTypes.default.bool,
|
|
79
91
|
"aria-describedby": _propTypes.default.string,
|
|
@@ -123,7 +123,8 @@
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
&:disabled
|
|
126
|
+
&:disabled,
|
|
127
|
+
&.disabled {
|
|
127
128
|
&.hasTheme,
|
|
128
129
|
&:not(.hasTheme) {
|
|
129
130
|
&.default {
|
|
@@ -250,3 +251,10 @@
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
}
|
|
254
|
+
|
|
255
|
+
label.button {
|
|
256
|
+
input[type="radio"] {
|
|
257
|
+
@include appearance(none);
|
|
258
|
+
margin: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|