@hig/text-link
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -1696,7 +1696,17 @@ import React from 'react'; | ||
function stylesheet(props, themeData) { | ||
/** @type {Object.<string, string>} */ | ||
const variants = Object.freeze({ | ||
PRIMARY: "primary", | ||
SECONDARY: "secondary" | ||
}); | ||
/** @type {string[]} */ | ||
const availableVariants = Object.freeze(Object.values(variants)); | ||
function stylesheet(props, themeData, themeMeta) { | ||
const { | ||
stylesheet: customStylesheet, | ||
hasHover, | ||
hasFocus | ||
hasFocus, | ||
variant | ||
} = props; | ||
@@ -1715,17 +1725,17 @@ | ||
cursor: "pointer", | ||
color: themeData["textLink.primary.default.fontColor"], | ||
color: themeData[`textLink.${variant}.default.fontColor`], | ||
outline: "none" | ||
}, hasHover ? { | ||
color: themeData["textLink.primary.hover.fontColor"], | ||
color: themeData[`textLink.${variant}.hover.fontColor`], | ||
textDecoration: "underline", | ||
textDecorationColor: themeData["textLink.primary.hover.underlineColor"] | ||
textDecorationColor: themeData[`textLink.${variant}.hover.underlineColor`] | ||
} : {}), hasFocus ? { | ||
color: themeData["textLink.primary.focus.fontColor"], | ||
color: themeData[`textLink.${variant}.focus.fontColor`], | ||
outline: `solid ${themeData["textLink.focus.haloWidth"]} ${themeData["textLink.focus.haloColor"]}` | ||
} : {}); | ||
return customStylesheet ? customStylesheet(styles, props, themeData) : styles; | ||
return customStylesheet ? customStylesheet(styles, props, themeData, themeMeta) : styles; | ||
} | ||
const _excluded = ["children", "link", "target", "onClick", "onBlur", "onFocus", "onMouseUp", "onMouseDown", "onMouseLeave", "onMouseEnter", "stylesheet"]; | ||
const _excluded = ["children", "link", "target", "onClick", "onBlur", "onFocus", "onMouseUp", "onMouseDown", "onMouseLeave", "onMouseEnter", "stylesheet", "variant"]; | ||
@@ -1744,3 +1754,4 @@ const TextLink = props => { | ||
onMouseEnter, | ||
stylesheet: customStylesheet | ||
stylesheet: customStylesheet, | ||
variant = "primary" | ||
} = props, | ||
@@ -1761,3 +1772,4 @@ otherProps = _objectWithoutProperties(props, _excluded); | ||
let { | ||
resolvedRoles | ||
resolvedRoles, | ||
metadata | ||
} = _ref; | ||
@@ -1787,4 +1799,5 @@ return /*#__PURE__*/React.createElement(ControlBehavior, { | ||
hasHover, | ||
isPressed | ||
}, props), resolvedRoles); | ||
isPressed, | ||
variant | ||
}, props), resolvedRoles, metadata); | ||
return /*#__PURE__*/React.createElement(Element, _extends({}, linkProps, otherProps, { | ||
@@ -1805,2 +1818,5 @@ className: cx(css(styles), className), | ||
TextLink.displayName = "TextLink"; | ||
TextLink.defaultProps = { | ||
variant: "primary" | ||
}; | ||
TextLink.propTypes = { | ||
@@ -1858,3 +1874,8 @@ /** Text content of the link */ | ||
/** Specify the anchor tag's target */ | ||
target: PropTypes.oneOf(availableTargets) | ||
target: PropTypes.oneOf(availableTargets), | ||
/** | ||
* Choose between primary or secondary | ||
*/ | ||
variant: PropTypes.oneOf(availableVariants) | ||
}; | ||
@@ -1950,2 +1971,15 @@ TextLink.__docgenInfo = { | ||
"description": "Specify the anchor tag's target" | ||
}, | ||
"variant": { | ||
"type": { | ||
"name": "enum", | ||
"computed": true, | ||
"value": "availableVariants" | ||
}, | ||
"required": false, | ||
"description": "Choose between primary or secondary", | ||
"defaultValue": { | ||
"value": "\"primary\"", | ||
"computed": false | ||
} | ||
} | ||
@@ -1952,0 +1986,0 @@ } |
@@ -1706,7 +1706,17 @@ 'use strict'; | ||
function stylesheet(props, themeData) { | ||
/** @type {Object.<string, string>} */ | ||
const variants = Object.freeze({ | ||
PRIMARY: "primary", | ||
SECONDARY: "secondary" | ||
}); | ||
/** @type {string[]} */ | ||
const availableVariants = Object.freeze(Object.values(variants)); | ||
function stylesheet(props, themeData, themeMeta) { | ||
const { | ||
stylesheet: customStylesheet, | ||
hasHover, | ||
hasFocus | ||
hasFocus, | ||
variant | ||
} = props; | ||
@@ -1725,17 +1735,17 @@ | ||
cursor: "pointer", | ||
color: themeData["textLink.primary.default.fontColor"], | ||
color: themeData[`textLink.${variant}.default.fontColor`], | ||
outline: "none" | ||
}, hasHover ? { | ||
color: themeData["textLink.primary.hover.fontColor"], | ||
color: themeData[`textLink.${variant}.hover.fontColor`], | ||
textDecoration: "underline", | ||
textDecorationColor: themeData["textLink.primary.hover.underlineColor"] | ||
textDecorationColor: themeData[`textLink.${variant}.hover.underlineColor`] | ||
} : {}), hasFocus ? { | ||
color: themeData["textLink.primary.focus.fontColor"], | ||
color: themeData[`textLink.${variant}.focus.fontColor`], | ||
outline: `solid ${themeData["textLink.focus.haloWidth"]} ${themeData["textLink.focus.haloColor"]}` | ||
} : {}); | ||
return customStylesheet ? customStylesheet(styles, props, themeData) : styles; | ||
return customStylesheet ? customStylesheet(styles, props, themeData, themeMeta) : styles; | ||
} | ||
const _excluded = ["children", "link", "target", "onClick", "onBlur", "onFocus", "onMouseUp", "onMouseDown", "onMouseLeave", "onMouseEnter", "stylesheet"]; | ||
const _excluded = ["children", "link", "target", "onClick", "onBlur", "onFocus", "onMouseUp", "onMouseDown", "onMouseLeave", "onMouseEnter", "stylesheet", "variant"]; | ||
@@ -1754,3 +1764,4 @@ const TextLink = props => { | ||
onMouseEnter, | ||
stylesheet: customStylesheet | ||
stylesheet: customStylesheet, | ||
variant = "primary" | ||
} = props, | ||
@@ -1771,3 +1782,4 @@ otherProps = _objectWithoutProperties(props, _excluded); | ||
let { | ||
resolvedRoles | ||
resolvedRoles, | ||
metadata | ||
} = _ref; | ||
@@ -1797,4 +1809,5 @@ return /*#__PURE__*/React__default["default"].createElement(behaviors.ControlBehavior, { | ||
hasHover, | ||
isPressed | ||
}, props), resolvedRoles); | ||
isPressed, | ||
variant | ||
}, props), resolvedRoles, metadata); | ||
return /*#__PURE__*/React__default["default"].createElement(Element, _extends({}, linkProps, otherProps, { | ||
@@ -1815,2 +1828,5 @@ className: cx(css(styles), className), | ||
TextLink.displayName = "TextLink"; | ||
TextLink.defaultProps = { | ||
variant: "primary" | ||
}; | ||
TextLink.propTypes = { | ||
@@ -1868,3 +1884,8 @@ /** Text content of the link */ | ||
/** Specify the anchor tag's target */ | ||
target: PropTypes__default["default"].oneOf(availableTargets) | ||
target: PropTypes__default["default"].oneOf(availableTargets), | ||
/** | ||
* Choose between primary or secondary | ||
*/ | ||
variant: PropTypes__default["default"].oneOf(availableVariants) | ||
}; | ||
@@ -1960,2 +1981,15 @@ TextLink.__docgenInfo = { | ||
"description": "Specify the anchor tag's target" | ||
}, | ||
"variant": { | ||
"type": { | ||
"name": "enum", | ||
"computed": true, | ||
"value": "availableVariants" | ||
}, | ||
"required": false, | ||
"description": "Choose between primary or secondary", | ||
"defaultValue": { | ||
"value": "\"primary\"", | ||
"computed": false | ||
} | ||
} | ||
@@ -1962,0 +1996,0 @@ } |
@@ -0,1 +1,8 @@ | ||
# [@hig/text-link-v2.3.0](https://github.com/Autodesk/hig/compare/@hig/text-link@2.2.0...@hig/text-link@2.3.0) (2022-10-09) | ||
### Features | ||
* add secondary variant ([0bf5f1a](https://github.com/Autodesk/hig/commit/0bf5f1a)) | ||
# [@hig/text-link-v2.2.0](https://github.com/Autodesk/hig/compare/@hig/text-link@2.1.1...@hig/text-link@2.2.0) (2022-08-28) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@hig/text-link", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "HIG Text Link", | ||
@@ -25,3 +25,3 @@ "author": "Autodesk Inc.", | ||
"@hig/theme-context": "^4.2.0", | ||
"@hig/theme-data": "^3.1.0", | ||
"@hig/theme-data": "^3.4.2", | ||
"react": "^17.0.0" | ||
@@ -28,0 +28,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114843
3288