Socket
Socket
Sign inDemoInstall

@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.6ba8ec1c to 0.1.0-alpha.711c802c

190

build/index.es.js

@@ -0,8 +1,170 @@

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { ThemeContext } from '@hig/themes';
var targets = Object.freeze(["_self", "_blank", "_parent", "_top"]);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var HIGLightTheme = {
themeId: "hig-light",
themeClass: "hig--light-theme"
};
var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
var _extends = Object.assign || 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;
};
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;
};
}();
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 === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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;
}
var Provider = function (_Component) {
_inherits(Provider, _Component);
function Provider() {
_classCallCheck(this, Provider);
return _possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments));
}
_createClass(Provider, [{
key: "getChildContext",
value: function getChildContext() {
return _extends({}, this.props.value);
}
}, {
key: "render",
value: function render() {
return this.props.children;
}
}]);
return Provider;
}(Component);
Provider.propTypes = {
/** A theme provided to the consumer within */
value: PropTypes.shape(themeContextShape),
/** Content within will be provided with the passed theme */
children: PropTypes.node.isRequired
};
Provider.childContextTypes = themeContextShape;
Provider.defaultProps = {
value: HIGLightTheme
};
var _createClass$1 = 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;
};
}();
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$1(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits$1(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _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;
}
var Consumer = function (_Component) {
_inherits$1(Consumer, _Component);
function Consumer() {
_classCallCheck$1(this, Consumer);
return _possibleConstructorReturn$1(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
}
_createClass$1(Consumer, [{
key: "render",
value: function render() {
var theme = this.context.themeId && this.context.themeClass ? this.context : HIGLightTheme;
return this.props.children(theme);
}
}]);
return Consumer;
}(Component);
Consumer.propTypes = {
/** A theme provided to the consumer within */
children: PropTypes.func
};
Consumer.contextTypes = themeContextShape;
Consumer.__docgenInfo = {
"description": "",
"displayName": "Consumer",
"props": {
"children": {
"type": {
"name": "func"
},
"required": false,
"description": "A theme provided to the consumer within"
}
}
};
var index = { Provider: Provider, Consumer: Consumer };
var targets = Object.freeze({
SELF: "_self",
BLANK: "_blank",
PARENT: "_parent",
TOP: "_top"
});
var availableTargets = Object.freeze(Object.values(targets));
/** @type {Object.<string, string>} */

@@ -24,11 +186,11 @@ var types = Object.freeze({

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 _createClass$2 = 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 _classCallCheck$2(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 _possibleConstructorReturn$2(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 _inherits$2(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; }

@@ -40,11 +202,11 @@ 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 TextLink = function (_Component) {
_inherits(TextLink, _Component);
_inherits$2(TextLink, _Component);
function TextLink() {
_classCallCheck(this, TextLink);
_classCallCheck$2(this, TextLink);
return _possibleConstructorReturn(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
return _possibleConstructorReturn$2(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
}
_createClass(TextLink, [{
_createClass$2(TextLink, [{
key: "render",

@@ -64,3 +226,3 @@ value: function render() {

return React.createElement(
ThemeContext.Consumer,
index.Consumer,
null,

@@ -95,3 +257,3 @@ function (_ref) {

/** Specify the anchor tag's target */
target: PropTypes.oneOf(targets),
target: PropTypes.oneOf(availableTargets),
/** Indicates the style of link */

@@ -132,3 +294,3 @@ type: PropTypes.oneOf(AVAILABLE_TYPES)

"computed": true,
"value": "targets"
"value": "availableTargets"
},

@@ -135,0 +297,0 @@ "required": false,

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var PropTypes = _interopDefault(require('prop-types'));
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');
var targets = Object.freeze(["_self", "_blank", "_parent", "_top"]);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var HIGLightTheme = {
themeId: "hig-light",
themeClass: "hig--light-theme"
};
var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
var _extends = Object.assign || 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;
};
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;
};
}();
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 === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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;
}
var Provider = function (_Component) {
_inherits(Provider, _Component);
function Provider() {
_classCallCheck(this, Provider);
return _possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments));
}
_createClass(Provider, [{
key: "getChildContext",
value: function getChildContext() {
return _extends({}, this.props.value);
}
}, {
key: "render",
value: function render() {
return this.props.children;
}
}]);
return Provider;
}(React.Component);
Provider.propTypes = {
/** A theme provided to the consumer within */
value: PropTypes.shape(themeContextShape),
/** Content within will be provided with the passed theme */
children: PropTypes.node.isRequired
};
Provider.childContextTypes = themeContextShape;
Provider.defaultProps = {
value: HIGLightTheme
};
var _createClass$1 = 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;
};
}();
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$1(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits$1(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _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;
}
var Consumer = function (_Component) {
_inherits$1(Consumer, _Component);
function Consumer() {
_classCallCheck$1(this, Consumer);
return _possibleConstructorReturn$1(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
}
_createClass$1(Consumer, [{
key: "render",
value: function render() {
var theme = this.context.themeId && this.context.themeClass ? this.context : HIGLightTheme;
return this.props.children(theme);
}
}]);
return Consumer;
}(React.Component);
Consumer.propTypes = {
/** A theme provided to the consumer within */
children: PropTypes.func
};
Consumer.contextTypes = themeContextShape;
Consumer.__docgenInfo = {
"description": "",
"displayName": "Consumer",
"props": {
"children": {
"type": {
"name": "func"
},
"required": false,
"description": "A theme provided to the consumer within"
}
}
};
var index = { Provider: Provider, Consumer: Consumer };
var targets = Object.freeze({
SELF: "_self",
BLANK: "_blank",
PARENT: "_parent",
TOP: "_top"
});
var availableTargets = Object.freeze(Object.values(targets));
/** @type {Object.<string, string>} */

@@ -29,11 +193,11 @@ var types = Object.freeze({

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 _createClass$2 = 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 _classCallCheck$2(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 _possibleConstructorReturn$2(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 _inherits$2(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; }

@@ -45,11 +209,11 @@ 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 TextLink = function (_Component) {
_inherits(TextLink, _Component);
_inherits$2(TextLink, _Component);
function TextLink() {
_classCallCheck(this, TextLink);
_classCallCheck$2(this, TextLink);
return _possibleConstructorReturn(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
return _possibleConstructorReturn$2(this, (TextLink.__proto__ || Object.getPrototypeOf(TextLink)).apply(this, arguments));
}
_createClass(TextLink, [{
_createClass$2(TextLink, [{
key: "render",

@@ -69,3 +233,3 @@ value: function render() {

return React__default.createElement(
themes.ThemeContext.Consumer,
index.Consumer,
null,

@@ -100,3 +264,3 @@ function (_ref) {

/** Specify the anchor tag's target */
target: PropTypes.oneOf(targets),
target: PropTypes.oneOf(availableTargets),
/** Indicates the style of link */

@@ -137,3 +301,3 @@ type: PropTypes.oneOf(AVAILABLE_TYPES)

"computed": true,
"value": "targets"
"value": "availableTargets"
},

@@ -159,2 +323,2 @@ "required": false,

module.exports = TextLink;
exports.default = TextLink;

11

package.json
{
"name": "@hig/text-link",
"version": "0.1.0-alpha.6ba8ec1c",
"version": "0.1.0-alpha.711c802c",
"description": "HIG Text Link",

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

"dependencies": {
"@hig/themes": "0.1.0-alpha.711c802c",
"classnames": "^2.2.5",

@@ -26,6 +27,6 @@ "react-lifecycles-compat": "^3.0.2"

"devDependencies": {
"@hig/babel-preset": "0.2.0-alpha.6ba8ec1c",
"@hig/eslint-config": "0.2.0-alpha.6ba8ec1c",
"@hig/scripts": "0.2.0-alpha.6ba8ec1c",
"@hig/styles": "0.1.0-alpha.6ba8ec1c"
"@hig/babel-preset": "0.2.0-alpha.711c802c",
"@hig/eslint-config": "0.2.0-alpha.711c802c",
"@hig/scripts": "0.2.0-alpha.711c802c",
"@hig/styles": "0.2.0-alpha.711c802c"
},

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

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