Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terra-hyperlink

Package Overview
Dependencies
Maintainers
8
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-hyperlink - npm Package Compare versions

Comparing version 2.53.0 to 2.54.0

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Changelog

## 2.54.0 - (December 7, 2022)
* Changed
* Minor dependency version bump
## 2.53.0 - (July 14, 2022)

@@ -7,0 +12,0 @@

95

lib/Hyperlink.js
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -9,63 +8,34 @@ value: true

exports.default = exports.HyperlinkVariants = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _IconExternalLink = _interopRequireDefault(require("terra-icon/lib/icon/IconExternalLink"));
var _IconAudio = _interopRequireDefault(require("terra-icon/lib/icon/IconAudio"));
var _IconVideoCamera = _interopRequireDefault(require("terra-icon/lib/icon/IconVideoCamera"));
var _IconImage = _interopRequireDefault(require("terra-icon/lib/icon/IconImage"));
var _IconDocuments = _interopRequireDefault(require("terra-icon/lib/icon/IconDocuments"));
var _classnames = _interopRequireDefault(require("classnames"));
var _bind = _interopRequireDefault(require("classnames/bind"));
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context"));
var KeyCode = _interopRequireWildcard(require("keycode-js"));
var _HyperlinkModule = _interopRequireDefault(require("./Hyperlink.module.scss"));
var _excluded = ["children", "isDisabled", "isUnderlineHidden", "variant", "href", "onClick", "onBlur", "onFocus", "onKeyDown", "onKeyUp", "onMouseDown"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
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); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var cx = _bind.default.bind(_HyperlinkModule.default);
var variants = {

@@ -80,3 +50,2 @@ DEFAULT: 'default',

exports.HyperlinkVariants = variants;
var getHyperlinkIcon = function getHyperlinkIcon(variant) {

@@ -88,3 +57,2 @@ switch (variant) {

}, /*#__PURE__*/_react.default.createElement(_IconAudio.default, null));
case variants.DOCUMENT:

@@ -94,3 +62,2 @@ return /*#__PURE__*/_react.default.createElement("span", {

}, /*#__PURE__*/_react.default.createElement(_IconDocuments.default, null));
case variants.EXTERNAL:

@@ -100,3 +67,2 @@ return /*#__PURE__*/_react.default.createElement("span", {

}, /*#__PURE__*/_react.default.createElement(_IconExternalLink.default, null));
case variants.IMAGE:

@@ -106,3 +72,2 @@ return /*#__PURE__*/_react.default.createElement("span", {

}, /*#__PURE__*/_react.default.createElement(_IconImage.default, null));
case variants.VIDEO:

@@ -112,3 +77,2 @@ return /*#__PURE__*/_react.default.createElement("span", {

}, /*#__PURE__*/_react.default.createElement(_IconVideoCamera.default, null));
default:

@@ -118,3 +82,2 @@ return null;

};
var propTypes = {

@@ -125,3 +88,2 @@ /**

children: _propTypes.default.node,
/**

@@ -131,3 +93,2 @@ * Sets the href of the link.

href: _propTypes.default.string,
/**

@@ -137,3 +98,2 @@ * Whether or not the link should be disabled.

isDisabled: _propTypes.default.bool,
/**

@@ -143,3 +103,2 @@ * Whether or not the link should display an underline by default. Will still display an underline on hover and focus.

isUnderlineHidden: _propTypes.default.bool,
/**

@@ -149,3 +108,2 @@ * Callback function triggered when clicked.

onClick: _propTypes.default.func,
/**

@@ -155,3 +113,2 @@ * Callback function triggered when hyperlink loses focus.

onBlur: _propTypes.default.func,
/**

@@ -161,3 +118,2 @@ * Callback function triggered when hyperlink gains focus.

onFocus: _propTypes.default.func,
/**

@@ -167,3 +123,2 @@ * Callback function triggered when key is pressed.

onKeyDown: _propTypes.default.func,
/**

@@ -173,3 +128,2 @@ * Callback function triggered when key is released.

onKeyUp: _propTypes.default.func,
/**

@@ -179,3 +133,2 @@ * @private Callback function not intended for use with this API, but if set pass it through to the element regardless.

onMouseDown: _propTypes.default.func,
/**

@@ -190,13 +143,8 @@ * Sets the hyperlink variant. One of `default`, `external`, `image`, `video`, `audio`, `document`.

};
var Hyperlink = /*#__PURE__*/function (_React$Component) {
_inherits(Hyperlink, _React$Component);
var _super = _createSuper(Hyperlink);
function Hyperlink(props) {
var _this;
_classCallCheck(this, Hyperlink);
_this = _super.call(this, props);

@@ -214,3 +162,2 @@ _this.state = {

}
_createClass(Hyperlink, [{

@@ -220,3 +167,2 @@ key: "handleMouseDown",

this.linkRef.current.setAttribute('data-focus-styles-enabled', 'false');
if (this.props.onMouseDown) {

@@ -233,3 +179,2 @@ this.props.onMouseDown(event);

this.linkRef.current.setAttribute('data-focus-styles-enabled', 'true');
if (this.props.onBlur) {

@@ -248,3 +193,2 @@ this.props.onBlur(event);

}
if (this.props.onKeyDown) {

@@ -263,3 +207,2 @@ this.props.onKeyDown(event);

}
if (this.props.onKeyUp) {

@@ -273,15 +216,14 @@ this.props.onKeyUp(event);

var _this$props = this.props,
children = _this$props.children,
isDisabled = _this$props.isDisabled,
isUnderlineHidden = _this$props.isUnderlineHidden,
variant = _this$props.variant,
href = _this$props.href,
onClick = _this$props.onClick,
onBlur = _this$props.onBlur,
onFocus = _this$props.onFocus,
onKeyDown = _this$props.onKeyDown,
onKeyUp = _this$props.onKeyUp,
onMouseDown = _this$props.onMouseDown,
customProps = _objectWithoutProperties(_this$props, _excluded);
children = _this$props.children,
isDisabled = _this$props.isDisabled,
isUnderlineHidden = _this$props.isUnderlineHidden,
variant = _this$props.variant,
href = _this$props.href,
onClick = _this$props.onClick,
onBlur = _this$props.onBlur,
onFocus = _this$props.onFocus,
onKeyDown = _this$props.onKeyDown,
onKeyUp = _this$props.onKeyUp,
onMouseDown = _this$props.onMouseDown,
customProps = _objectWithoutProperties(_this$props, _excluded);
var theme = this.context;

@@ -299,15 +241,12 @@ var hyperlinkClasses = (0, _classnames.default)(cx('hyperlink', variant, {

var target = customProps.target; // Defaults to undefined if not set
var rel = customProps.rel; // Defaults to undefined if not set
var rel = customProps.rel; // Defaults to undefined if not set
// If variant is set to external, we'll add target="_blank" and rel="noopener noreferrer"
// unless user passes their own target or rel attribute
if (!customProps.target && variant === 'external') {
target = '_blank';
}
if (!customProps.rel && variant === 'external') {
rel = 'noopener noreferrer';
}
return /*#__PURE__*/_react.default.createElement(ComponentType, _extends({}, customProps, {

@@ -330,6 +269,4 @@ className: hyperlinkClasses,

}]);
return Hyperlink;
}(_react.default.Component);
Hyperlink.propTypes = propTypes;

@@ -336,0 +273,0 @@ Hyperlink.defaultProps = defaultProps;

{
"name": "terra-hyperlink",
"main": "lib/Hyperlink.js",
"version": "2.53.0",
"version": "2.54.0",
"description": "The terra hyperlink component allows linking to other web pages, files, locations within the same page, email addresses, or any other URL.",

@@ -32,3 +32,3 @@ "repository": {

"prop-types": "^15.5.8",
"terra-icon": "^3.48.0",
"terra-icon": "^3.49.0",
"terra-mixins": "^1.40.0",

@@ -50,3 +50,3 @@ "terra-theme-context": "^1.0.0"

},
"gitHead": "a7c88211833e8f180dec97341ef28bbdc590355e"
"gitHead": "421b2643a58e6de628aa789a9cdd0778b0a942a2"
}

@@ -10,3 +10,3 @@ # Terra Hyperlink

- [Getting Started](#getting-started)
- [Documentation](https://engineering.cerner.com/terra-ui/components/terra-hyperlink/hyperlink/hyperlink)
- [Documentation](https://engineering.cerner.com/terra-ui/components/cerner-terra-core-docs/hyperlink/about)
- [LICENSE](#license)

@@ -13,0 +13,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc