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

@hig/text-link

Package Overview
Dependencies
Maintainers
5
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/text-link - npm Package Compare versions

Comparing version 0.1.0-alpha.21135dbe to 0.1.0-alpha.35b8a71d

148

build/index.es.js

@@ -1,5 +0,149 @@

import { TextLink } from 'hig-react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { ThemeContext } from '@hig/themes';
TextLink.displayName = "TextLink";
var targets = Object.freeze(["_self", "_blank", "_parent", "_top"]);
/** @type {Object.<string, string>} */
var types = Object.freeze({
PRIMARY: "primary",
SECONDARY: "secondary"
});
/** @type {string[]} */
var AVAILABLE_TYPES = Object.freeze(Object.values(types));
/** @type {Object.<string, string>} */
var classNames = Object.freeze({
wrapper: "hig__text-link",
wrapperPrimary: "hig__text-link--primary",
wrapperSecondary: "hig__text-link--secondary"
});
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _wrapperModifiersByTy;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var wrapperModifiersByType = (_wrapperModifiersByTy = {}, _defineProperty(_wrapperModifiersByTy, types.PRIMARY, classNames.wrapperPrimary), _defineProperty(_wrapperModifiersByTy, types.SECONDARY, classNames.wrapperSecondary), _wrapperModifiersByTy);
var TextLink = function (_Component) {
_inherits(TextLink, _Component);
function TextLink() {
_classCallCheck(this, TextLink);
return _possibleConstructorReturn(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
}
_createClass(TextLink, [{
key: "render",
value: function render() {
var _props = this.props,
children = _props.children,
link = _props.link,
onClick = _props.onClick,
target = _props.target,
type = _props.type;
var linkClasses = function linkClasses(themeClass) {
return cx(themeClass, classNames.wrapper, wrapperModifiersByType[type]);
};
return React.createElement(
ThemeContext.Consumer,
null,
function (_ref) {
var themeClass = _ref.themeClass;
return React.createElement(
"a",
{
href: link,
onClick: onClick,
className: linkClasses(themeClass),
target: target
},
children
);
}
);
}
}]);
return TextLink;
}(Component);
TextLink.propTypes = {
/** Text content of the link */
children: PropTypes.string,
/** The href to link to. Note that this was previously 'href' in the version distributed with hig-react. */
link: PropTypes.string.isRequired,
/** Called when link is clicked */
onClick: PropTypes.func,
/** Specify the anchor tag's target */
target: PropTypes.oneOf(targets),
/** Indicates the style of link */
type: PropTypes.oneOf(AVAILABLE_TYPES)
};
TextLink.defaultProps = {
type: types.PRIMARY
};
TextLink.__docgenInfo = {
"description": "",
"displayName": "TextLink",
"props": {
"children": {
"type": {
"name": "string"
},
"required": false,
"description": "Text content of the link"
},
"link": {
"type": {
"name": "string"
},
"required": true,
"description": "The href to link to. Note that this was previously 'href' in the version distributed with hig-react."
},
"onClick": {
"type": {
"name": "func"
},
"required": false,
"description": "Called when link is clicked"
},
"target": {
"type": {
"name": "enum",
"computed": true,
"value": "targets"
},
"required": false,
"description": "Specify the anchor tag's target"
},
"type": {
"type": {
"name": "enum",
"computed": true,
"value": "AVAILABLE_TYPES"
},
"required": false,
"description": "Indicates the style of link",
"defaultValue": {
"value": "types.PRIMARY",
"computed": true
}
}
}
};
export default TextLink;
'use strict';
var higReact = require('hig-react');
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
higReact.TextLink.displayName = "TextLink";
var React = require('react');
var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var cx = _interopDefault(require('classnames'));
var themes = require('@hig/themes');
module.exports = higReact.TextLink;
var targets = Object.freeze(["_self", "_blank", "_parent", "_top"]);
/** @type {Object.<string, string>} */
var types = Object.freeze({
PRIMARY: "primary",
SECONDARY: "secondary"
});
/** @type {string[]} */
var AVAILABLE_TYPES = Object.freeze(Object.values(types));
/** @type {Object.<string, string>} */
var classNames = Object.freeze({
wrapper: "hig__text-link",
wrapperPrimary: "hig__text-link--primary",
wrapperSecondary: "hig__text-link--secondary"
});
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _wrapperModifiersByTy;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var wrapperModifiersByType = (_wrapperModifiersByTy = {}, _defineProperty(_wrapperModifiersByTy, types.PRIMARY, classNames.wrapperPrimary), _defineProperty(_wrapperModifiersByTy, types.SECONDARY, classNames.wrapperSecondary), _wrapperModifiersByTy);
var TextLink = function (_Component) {
_inherits(TextLink, _Component);
function TextLink() {
_classCallCheck(this, TextLink);
return _possibleConstructorReturn(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
}
_createClass(TextLink, [{
key: "render",
value: function render() {
var _props = this.props,
children = _props.children,
link = _props.link,
onClick = _props.onClick,
target = _props.target,
type = _props.type;
var linkClasses = function linkClasses(themeClass) {
return cx(themeClass, classNames.wrapper, wrapperModifiersByType[type]);
};
return React__default.createElement(
themes.ThemeContext.Consumer,
null,
function (_ref) {
var themeClass = _ref.themeClass;
return React__default.createElement(
"a",
{
href: link,
onClick: onClick,
className: linkClasses(themeClass),
target: target
},
children
);
}
);
}
}]);
return TextLink;
}(React.Component);
TextLink.propTypes = {
/** Text content of the link */
children: PropTypes.string,
/** The href to link to. Note that this was previously 'href' in the version distributed with hig-react. */
link: PropTypes.string.isRequired,
/** Called when link is clicked */
onClick: PropTypes.func,
/** Specify the anchor tag's target */
target: PropTypes.oneOf(targets),
/** Indicates the style of link */
type: PropTypes.oneOf(AVAILABLE_TYPES)
};
TextLink.defaultProps = {
type: types.PRIMARY
};
TextLink.__docgenInfo = {
"description": "",
"displayName": "TextLink",
"props": {
"children": {
"type": {
"name": "string"
},
"required": false,
"description": "Text content of the link"
},
"link": {
"type": {
"name": "string"
},
"required": true,
"description": "The href to link to. Note that this was previously 'href' in the version distributed with hig-react."
},
"onClick": {
"type": {
"name": "func"
},
"required": false,
"description": "Called when link is clicked"
},
"target": {
"type": {
"name": "enum",
"computed": true,
"value": "targets"
},
"required": false,
"description": "Specify the anchor tag's target"
},
"type": {
"type": {
"name": "enum",
"computed": true,
"value": "AVAILABLE_TYPES"
},
"required": false,
"description": "Indicates the style of link",
"defaultValue": {
"value": "types.PRIMARY",
"computed": true
}
}
}
};
module.exports = TextLink;

11

package.json
{
"name": "@hig/text-link",
"version": "0.1.0-alpha.21135dbe",
"version": "0.1.0-alpha.35b8a71d",
"description": "HIG Text Link",

@@ -18,3 +18,2 @@ "author": "Autodesk Inc.",

"classnames": "^2.2.5",
"hig-react": "0.29.0-alpha.21135dbe",
"react-lifecycles-compat": "^3.0.2"

@@ -27,6 +26,6 @@ },

"devDependencies": {
"@hig/babel-preset": "0.2.0-alpha.21135dbe",
"@hig/eslint-config": "0.2.0-alpha.21135dbe",
"@hig/scripts": "0.2.0-alpha.21135dbe",
"@hig/styles": "0.1.0-alpha.21135dbe"
"@hig/babel-preset": "0.2.0-alpha.35b8a71d",
"@hig/eslint-config": "0.2.0-alpha.35b8a71d",
"@hig/scripts": "0.2.0-alpha.35b8a71d",
"@hig/styles": "0.1.0-alpha.35b8a71d"
},

@@ -33,0 +32,0 @@ "scripts": {

@@ -23,6 +23,5 @@ # Text Link

```jsx
<TextLink
href="https://github.com/Autodesk/hig"
text="This is a primary text link"
/>
<TextLink link="https://github.com/Autodesk/hig">
This is a primary text link
</TextLink>
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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