dibk-design 3.2.0 → 3.2.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.
@@ -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$children, _props$children$type;
23
+ var _props$href, _props$href2, _props$children, _props$children$type;
24
24
  var getArrowClass = function getArrowClass(arrow) {
25
25
  switch (arrow) {
26
26
  case "left":
@@ -40,7 +40,8 @@ var Button = function Button(props) {
40
40
  };
41
41
  };
42
42
  var buttonProps = _objectSpread(_objectSpread({}, props), {}, {
43
- "aria-invalid": props.hasErrors || null
43
+ "aria-invalid": props.hasErrors || null,
44
+ href: !props.disabled && (_props$href = props.href) !== null && _props$href !== void 0 && _props$href.length ? props.href : null
44
45
  });
45
46
  delete buttonProps.noHover;
46
47
  delete buttonProps.hasErrors;
@@ -55,10 +56,12 @@ var Button = function Button(props) {
55
56
  var renderChildElements = function renderChildElements(childElements) {
56
57
  var childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
57
58
  return childElementsthroughFragments.map(function (childElement, index) {
59
+ var _childElement$props, _childElement$props2;
58
60
  var childElementCopy = _react.default.cloneElement(childElement, {
59
61
  className: className,
60
62
  style: themeStyle,
61
- key: "button-".concat(index)
63
+ key: "button-".concat(index),
64
+ to: !buttonProps.disabled && childElement !== null && childElement !== void 0 && (_childElement$props = childElement.props) !== null && _childElement$props !== void 0 && _childElement$props.to ? childElement === null || childElement === void 0 ? void 0 : (_childElement$props2 = childElement.props) === null || _childElement$props2 === void 0 ? void 0 : _childElement$props2.to : null
62
65
  });
63
66
  return childElementCopy;
64
67
  });
@@ -77,7 +80,7 @@ var Button = function Button(props) {
77
80
  style: themeStyle,
78
81
  type: "radio"
79
82
  })), props.content);
80
- } else if ((_props$href = props.href) !== null && _props$href !== void 0 && _props$href.length) {
83
+ } else if ((_props$href2 = props.href) !== null && _props$href2 !== void 0 && _props$href2.length && !props.disabled) {
81
84
  return _react.default.createElement("a", _extends({}, buttonProps, {
82
85
  className: className,
83
86
  style: themeStyle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dibk-design",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "files": [