@clayui/link
Advanced tools
Comparing version 3.1.1 to 3.2.0
@@ -6,2 +6,11 @@ # Change Log | ||
# [3.2.0](https://github.com/liferay/clay/compare/@clayui/link@3.1.1...@clayui/link@3.2.0) (2020-06-18) | ||
### Features | ||
- **@clayui/link:** add ability to style link like a button ([5599f58](https://github.com/liferay/clay/commit/5599f58)) | ||
- **@clayui/link:** add default value for 'rel' if target exists ([1e0697b](https://github.com/liferay/clay/commit/1e0697b)) | ||
- **clayui.com:** Improve API docs - Make displayNames consistent ([5a33822](https://github.com/liferay/clay/commit/5a33822)) | ||
- **clayui.com:** Improve API docs of Form, Input & Link components ([38f2696](https://github.com/liferay/clay/commit/38f2696)) | ||
## [3.1.1](https://github.com/liferay/clay/compare/@clayui/link@3.1.0...@clayui/link@3.1.1) (2020-04-24) | ||
@@ -8,0 +17,0 @@ |
@@ -5,3 +5,8 @@ import React from 'react'; | ||
borderless?: boolean; | ||
displayType?: 'primary' | 'secondary'; | ||
button?: boolean | { | ||
block?: boolean; | ||
monospaced?: boolean; | ||
small?: boolean; | ||
}; | ||
displayType?: 'primary' | 'secondary' | 'unstyled'; | ||
monospaced?: boolean; | ||
@@ -8,0 +13,0 @@ outline?: boolean; |
@@ -30,6 +30,5 @@ "use strict"; | ||
var ClayLink = _react.default.forwardRef(function (_ref, ref) { | ||
var _classNames; | ||
var ClayLink = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) { | ||
var borderless = _ref.borderless, | ||
button = _ref.button, | ||
children = _ref.children, | ||
@@ -40,17 +39,45 @@ className = _ref.className, | ||
outline = _ref.outline, | ||
otherProps = _objectWithoutProperties(_ref, ["borderless", "children", "className", "displayType", "monospaced", "outline"]); | ||
rel = _ref.rel, | ||
target = _ref.target, | ||
otherProps = _objectWithoutProperties(_ref, ["borderless", "button", "children", "className", "displayType", "monospaced", "outline", "rel", "target"]); | ||
var TagOrComponent = _react.default.useContext(_Context.default); | ||
return _react.default.createElement(TagOrComponent, _extends({ | ||
className: (0, _classnames.default)(className, (_classNames = { | ||
var classes; | ||
if (button) { | ||
var _classes; | ||
button = button === true ? {} : button; | ||
classes = (_classes = { | ||
btn: !!button, | ||
'btn-block': button.block, | ||
'btn-monospaced': button.monospaced, | ||
'btn-outline-borderless': borderless, | ||
'btn-sm': button.small | ||
}, _defineProperty(_classes, "btn-".concat(displayType), displayType && !outline && !borderless), _defineProperty(_classes, "btn-outline-".concat(displayType), displayType && (outline || borderless)), _classes); | ||
} else { | ||
var _classes2; | ||
classes = (_classes2 = { | ||
'link-monospaced': monospaced, | ||
'link-outline': outline, | ||
'link-outline-borderless': borderless | ||
}, _defineProperty(_classNames, "link-".concat(displayType), displayType && !outline), _defineProperty(_classNames, "link-outline-".concat(displayType), displayType && outline), _classNames)), | ||
ref: ref | ||
}, _defineProperty(_classes2, "link-".concat(displayType), displayType && !outline), _defineProperty(_classes2, "link-outline-".concat(displayType), displayType && outline), _classes2); | ||
} | ||
if (target && !rel) { | ||
rel = 'noreferrer noopener'; | ||
} | ||
return /*#__PURE__*/_react.default.createElement(TagOrComponent, _extends({ | ||
className: (0, _classnames.default)(className, classes), | ||
ref: ref, | ||
rel: rel, | ||
target: target | ||
}, otherProps), children); | ||
}); | ||
ClayLink.displayName = 'ClayLink'; | ||
var _default = ClayLink; | ||
exports.default = _default; |
{ | ||
"name": "@clayui/link", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "ClayLink component", | ||
@@ -39,3 +39,3 @@ "license": "BSD-3-Clause", | ||
], | ||
"gitHead": "315966237dc08b74f9d7bc28e7455946f104a026" | ||
"gitHead": "0b4bbca3faa7445e2e10acc86d6288d20f2bc9dc" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16814
292
38