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

clay-link

Package Overview
Dependencies
Maintainers
4
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clay-link - npm Package Compare versions

Comparing version 2.0.0-rc.3 to 2.0.0-rc.4

11

lib/ClayLink.js

@@ -202,3 +202,12 @@ 'use strict';

*/
target: _metalState.Config.oneOf(['_blank', '_self'])
target: _metalState.Config.oneOf(['_blank', '_self']),
/**
* Sets the HTML attribute title on the anchor tag.
* @instance
* @memberof ClayLink
* @type {?string|undefined}
* @default undefined
*/
title: _metalState.Config.string()
};

@@ -205,0 +214,0 @@

133

lib/ClayLink.soy.js

@@ -87,7 +87,45 @@ 'use strict';

var target = soy.asserts.assertType(opt_data.target == null || goog.isString(opt_data.target) || opt_data.target instanceof goog.soy.data.SanitizedContent, 'target', opt_data.target, '!goog.soy.data.SanitizedContent|null|string|undefined');
var attributes__soy31 = function attributes__soy31() {
$attributes(opt_data, null, opt_ijData);
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var title = soy.asserts.assertType(opt_data.title == null || goog.isString(opt_data.title) || opt_data.title instanceof goog.soy.data.SanitizedContent, 'title', opt_data.title, '!goog.soy.data.SanitizedContent|null|string|undefined');
var attributes__soy88 = function attributes__soy88() {
if (ariaExpanded) {
incrementalDom.attr('aria-expanded', 'true');
} else if (ariaExpanded == false) {
incrementalDom.attr('aria-expanded', 'false');
}
if (ariaLabel) {
incrementalDom.attr('aria-label', ariaLabel);
}
var classes__soy50 = '';
var $tmp = null;
if (buttonStyle) {
$tmp = 'btn btn-' + buttonStyle;
} else if (style) {
$tmp = 'link-' + style;
} else {
$tmp = '';
}
classes__soy50 += $tmp;
classes__soy50 += elementClasses ? ' ' + elementClasses : '';
if (classes__soy50) {
incrementalDom.attr('class', classes__soy50);
}
if (download) {
incrementalDom.attr('download', download);
}
if (href) {
incrementalDom.attr('href', href);
}
if (id) {
incrementalDom.attr('id', id);
}
if (target) {
incrementalDom.attr('target', target);
}
if (title) {
incrementalDom.attr('title', title);
}
};
incrementalDom.elementOpenStart('a');
attributes__soy31();
attributes__soy88();
incrementalDom.elementOpenEnd();

@@ -115,2 +153,3 @@ $content({ icon: icon, iconAlignment: ($$temp = iconAlignment) == null ? 'left' : $$temp, imageAlt: imageAlt, imageSrc: imageSrc, label: label, spritemap: spritemap }, null, opt_ijData);

* target: (!goog.soy.data.SanitizedContent|null|string|undefined),
* title: (!goog.soy.data.SanitizedContent|null|string|undefined),
* }}

@@ -206,86 +245,4 @@ */

/**
* @param {$attributes.Params} opt_data
* @param {Object<string, *>=} opt_ijData
* @param {Object<string, *>=} opt_ijData_deprecated
* @return {void}
* @suppress {checkTypes}
*/
var $attributes = function $attributes(opt_data, opt_ijData, opt_ijData_deprecated) {
opt_ijData = opt_ijData_deprecated || opt_ijData;
opt_data = opt_data || {};
/** @type {boolean|null|undefined} */
var ariaExpanded = soy.asserts.assertType(opt_data.ariaExpanded == null || goog.isBoolean(opt_data.ariaExpanded) || opt_data.ariaExpanded === 1 || opt_data.ariaExpanded === 0, 'ariaExpanded', opt_data.ariaExpanded, 'boolean|null|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var ariaLabel = soy.asserts.assertType(opt_data.ariaLabel == null || goog.isString(opt_data.ariaLabel) || opt_data.ariaLabel instanceof goog.soy.data.SanitizedContent, 'ariaLabel', opt_data.ariaLabel, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var buttonStyle = soy.asserts.assertType(opt_data.buttonStyle == null || goog.isString(opt_data.buttonStyle) || opt_data.buttonStyle instanceof goog.soy.data.SanitizedContent, 'buttonStyle', opt_data.buttonStyle, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var download = soy.asserts.assertType(opt_data.download == null || goog.isString(opt_data.download) || opt_data.download instanceof goog.soy.data.SanitizedContent, 'download', opt_data.download, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var elementClasses = soy.asserts.assertType(opt_data.elementClasses == null || goog.isString(opt_data.elementClasses) || opt_data.elementClasses instanceof goog.soy.data.SanitizedContent, 'elementClasses', opt_data.elementClasses, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var href = soy.asserts.assertType(opt_data.href == null || goog.isString(opt_data.href) || opt_data.href instanceof goog.soy.data.SanitizedContent, 'href', opt_data.href, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var id = soy.asserts.assertType(opt_data.id == null || goog.isString(opt_data.id) || opt_data.id instanceof goog.soy.data.SanitizedContent, 'id', opt_data.id, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var style = soy.asserts.assertType(opt_data.style == null || goog.isString(opt_data.style) || opt_data.style instanceof goog.soy.data.SanitizedContent, 'style', opt_data.style, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var target = soy.asserts.assertType(opt_data.target == null || goog.isString(opt_data.target) || opt_data.target instanceof goog.soy.data.SanitizedContent, 'target', opt_data.target, '!goog.soy.data.SanitizedContent|null|string|undefined');
if (ariaExpanded) {
incrementalDom.attr('aria-expanded', 'true');
} else if (ariaExpanded == false) {
incrementalDom.attr('aria-expanded', 'false');
}
if (ariaLabel) {
incrementalDom.attr('aria-label', ariaLabel);
}
var classes__soy127 = '';
var $tmp = null;
if (buttonStyle) {
$tmp = 'btn btn-' + buttonStyle;
} else if (style) {
$tmp = 'link-' + style;
} else {
$tmp = '';
}
classes__soy127 += $tmp;
classes__soy127 += elementClasses ? ' ' + elementClasses : '';
if (classes__soy127) {
incrementalDom.attr('class', classes__soy127);
}
if (download) {
incrementalDom.attr('download', download);
}
if (href) {
incrementalDom.attr('href', href);
}
if (id) {
incrementalDom.attr('id', id);
}
if (target) {
incrementalDom.attr('target', target);
}
};
exports.attributes = $attributes;
/**
* @typedef {{
* ariaExpanded: (boolean|null|undefined),
* ariaLabel: (!goog.soy.data.SanitizedContent|null|string|undefined),
* buttonStyle: (!goog.soy.data.SanitizedContent|null|string|undefined),
* download: (!goog.soy.data.SanitizedContent|null|string|undefined),
* elementClasses: (!goog.soy.data.SanitizedContent|null|string|undefined),
* href: (!goog.soy.data.SanitizedContent|null|string|undefined),
* id: (!goog.soy.data.SanitizedContent|null|string|undefined),
* style: (!goog.soy.data.SanitizedContent|null|string|undefined),
* target: (!goog.soy.data.SanitizedContent|null|string|undefined),
* }}
*/
$attributes.Params;
if (goog.DEBUG) {
$attributes.soyTemplateName = 'ClayLink.attributes';
}
exports.render.params = ["ariaExpanded", "ariaLabel", "buttonStyle", "download", "elementClasses", "href", "icon", "iconAlignment", "id", "imageAlt", "imageSrc", "label", "spritemap", "style", "target"];
exports.render.types = { "ariaExpanded": "bool", "ariaLabel": "string", "buttonStyle": "string", "download": "string", "elementClasses": "string", "href": "string", "icon": "string", "iconAlignment": "string", "id": "string", "imageAlt": "string", "imageSrc": "string", "label": "html|string", "spritemap": "string", "style": "string", "target": "string" };
exports.render.params = ["ariaExpanded", "ariaLabel", "buttonStyle", "download", "elementClasses", "href", "icon", "iconAlignment", "id", "imageAlt", "imageSrc", "label", "spritemap", "style", "target", "title"];
exports.render.types = { "ariaExpanded": "bool", "ariaLabel": "string", "buttonStyle": "string", "download": "string", "elementClasses": "string", "href": "string", "icon": "string", "iconAlignment": "string", "id": "string", "imageAlt": "string", "imageSrc": "string", "label": "html|string", "spritemap": "string", "style": "string", "target": "string", "title": "string" };
exports.content.params = ["icon", "iconAlignment", "imageAlt", "imageSrc", "label", "spritemap"];

@@ -295,4 +252,2 @@ exports.content.types = { "icon": "string", "iconAlignment": "string", "imageAlt": "string", "imageSrc": "string", "label": "html|string", "spritemap": "string" };

exports.icon.types = { "icon": "string", "spritemap": "string" };
exports.attributes.params = ["ariaExpanded", "ariaLabel", "buttonStyle", "download", "elementClasses", "href", "id", "style", "target"];
exports.attributes.types = { "ariaExpanded": "bool", "ariaLabel": "string", "buttonStyle": "string", "download": "string", "elementClasses": "string", "href": "string", "id": "string", "style": "string", "target": "string" };
exports.templates = templates = exports;

@@ -299,0 +254,0 @@ return exports;

{
"name": "clay-link",
"version": "2.0.0-rc.3",
"version": "2.0.0-rc.4",
"description": "Clay Link Component",

@@ -30,4 +30,4 @@ "license": "BSD",

"dependencies": {
"clay-component": "^2.0.0-rc.3",
"clay-icon": "^2.0.0-rc.3",
"clay-component": "^2.0.0-rc.4",
"clay-icon": "^2.0.0-rc.4",
"metal": "^2.16.0",

@@ -46,3 +46,3 @@ "metal-component": "^2.16.0",

"browserslist-config-clay-components": "^2.0.0-rc.3",
"clay": "^2.0.0-rc.3",
"clay": "^2.0.0-rc.4",
"metal-dom": "^2.16.0",

@@ -49,0 +49,0 @@ "metal-tools-soy": "^6.0.0",

@@ -178,2 +178,10 @@ import ClayLink from '../ClayLink';

});
it('should render a link with title', () => {
link = new ClayLink({
title: 'title',
});
expect(link).toMatchSnapshot();
});
});

@@ -164,2 +164,11 @@ import 'clay-icon';

target: Config.oneOf(['_blank', '_self']),
/**
* Sets the HTML attribute title on the anchor tag.
* @instance
* @memberof ClayLink
* @type {?string|undefined}
* @default undefined
*/
title: Config.string(),
};

@@ -166,0 +175,0 @@

@@ -68,7 +68,45 @@ /* jshint ignore:start */

var target = soy.asserts.assertType(opt_data.target == null || (goog.isString(opt_data.target) || opt_data.target instanceof goog.soy.data.SanitizedContent), 'target', opt_data.target, '!goog.soy.data.SanitizedContent|null|string|undefined');
var attributes__soy31 = function() {
$attributes(opt_data, null, opt_ijData);
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var title = soy.asserts.assertType(opt_data.title == null || (goog.isString(opt_data.title) || opt_data.title instanceof goog.soy.data.SanitizedContent), 'title', opt_data.title, '!goog.soy.data.SanitizedContent|null|string|undefined');
var attributes__soy88 = function() {
if (ariaExpanded) {
incrementalDom.attr('aria-expanded', 'true');
} else if (ariaExpanded == false) {
incrementalDom.attr('aria-expanded', 'false');
}
if (ariaLabel) {
incrementalDom.attr('aria-label', ariaLabel);
}
var classes__soy50 = '';
var $tmp = null;
if (buttonStyle) {
$tmp = 'btn btn-' + buttonStyle;
} else if (style) {
$tmp = 'link-' + style;
} else {
$tmp = '';
}
classes__soy50 += $tmp;
classes__soy50 += elementClasses ? ' ' + elementClasses : '';
if (classes__soy50) {
incrementalDom.attr('class', classes__soy50);
}
if (download) {
incrementalDom.attr('download', download);
}
if (href) {
incrementalDom.attr('href', href);
}
if (id) {
incrementalDom.attr('id', id);
}
if (target) {
incrementalDom.attr('target', target);
}
if (title) {
incrementalDom.attr('title', title);
}
};
incrementalDom.elementOpenStart('a');
attributes__soy31();
attributes__soy88();
incrementalDom.elementOpenEnd();

@@ -96,2 +134,3 @@ $content({icon: icon, iconAlignment: ($$temp = iconAlignment) == null ? 'left' : $$temp, imageAlt: imageAlt, imageSrc: imageSrc, label: label, spritemap: spritemap}, null, opt_ijData);

* target: (!goog.soy.data.SanitizedContent|null|string|undefined),
* title: (!goog.soy.data.SanitizedContent|null|string|undefined),
* }}

@@ -189,87 +228,4 @@ */

/**
* @param {$attributes.Params} opt_data
* @param {Object<string, *>=} opt_ijData
* @param {Object<string, *>=} opt_ijData_deprecated
* @return {void}
* @suppress {checkTypes}
*/
var $attributes = function(opt_data, opt_ijData, opt_ijData_deprecated) {
opt_ijData = opt_ijData_deprecated || opt_ijData;
opt_data = opt_data || {};
/** @type {boolean|null|undefined} */
var ariaExpanded = soy.asserts.assertType(opt_data.ariaExpanded == null || (goog.isBoolean(opt_data.ariaExpanded) || opt_data.ariaExpanded === 1 || opt_data.ariaExpanded === 0), 'ariaExpanded', opt_data.ariaExpanded, 'boolean|null|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var ariaLabel = soy.asserts.assertType(opt_data.ariaLabel == null || (goog.isString(opt_data.ariaLabel) || opt_data.ariaLabel instanceof goog.soy.data.SanitizedContent), 'ariaLabel', opt_data.ariaLabel, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var buttonStyle = soy.asserts.assertType(opt_data.buttonStyle == null || (goog.isString(opt_data.buttonStyle) || opt_data.buttonStyle instanceof goog.soy.data.SanitizedContent), 'buttonStyle', opt_data.buttonStyle, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var download = soy.asserts.assertType(opt_data.download == null || (goog.isString(opt_data.download) || opt_data.download instanceof goog.soy.data.SanitizedContent), 'download', opt_data.download, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var elementClasses = soy.asserts.assertType(opt_data.elementClasses == null || (goog.isString(opt_data.elementClasses) || opt_data.elementClasses instanceof goog.soy.data.SanitizedContent), 'elementClasses', opt_data.elementClasses, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var href = soy.asserts.assertType(opt_data.href == null || (goog.isString(opt_data.href) || opt_data.href instanceof goog.soy.data.SanitizedContent), 'href', opt_data.href, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var id = soy.asserts.assertType(opt_data.id == null || (goog.isString(opt_data.id) || opt_data.id instanceof goog.soy.data.SanitizedContent), 'id', opt_data.id, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var style = soy.asserts.assertType(opt_data.style == null || (goog.isString(opt_data.style) || opt_data.style instanceof goog.soy.data.SanitizedContent), 'style', opt_data.style, '!goog.soy.data.SanitizedContent|null|string|undefined');
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
var target = soy.asserts.assertType(opt_data.target == null || (goog.isString(opt_data.target) || opt_data.target instanceof goog.soy.data.SanitizedContent), 'target', opt_data.target, '!goog.soy.data.SanitizedContent|null|string|undefined');
if (ariaExpanded) {
incrementalDom.attr('aria-expanded', 'true');
} else if (ariaExpanded == false) {
incrementalDom.attr('aria-expanded', 'false');
}
if (ariaLabel) {
incrementalDom.attr('aria-label', ariaLabel);
}
var classes__soy127 = '';
var $tmp = null;
if (buttonStyle) {
$tmp = 'btn btn-' + buttonStyle;
} else if (style) {
$tmp = 'link-' + style;
} else {
$tmp = '';
}
classes__soy127 += $tmp;
classes__soy127 += elementClasses ? ' ' + elementClasses : '';
if (classes__soy127) {
incrementalDom.attr('class', classes__soy127);
}
if (download) {
incrementalDom.attr('download', download);
}
if (href) {
incrementalDom.attr('href', href);
}
if (id) {
incrementalDom.attr('id', id);
}
if (target) {
incrementalDom.attr('target', target);
}
};
exports.attributes = $attributes;
/**
* @typedef {{
* ariaExpanded: (boolean|null|undefined),
* ariaLabel: (!goog.soy.data.SanitizedContent|null|string|undefined),
* buttonStyle: (!goog.soy.data.SanitizedContent|null|string|undefined),
* download: (!goog.soy.data.SanitizedContent|null|string|undefined),
* elementClasses: (!goog.soy.data.SanitizedContent|null|string|undefined),
* href: (!goog.soy.data.SanitizedContent|null|string|undefined),
* id: (!goog.soy.data.SanitizedContent|null|string|undefined),
* style: (!goog.soy.data.SanitizedContent|null|string|undefined),
* target: (!goog.soy.data.SanitizedContent|null|string|undefined),
* }}
*/
$attributes.Params;
if (goog.DEBUG) {
$attributes.soyTemplateName = 'ClayLink.attributes';
}
exports.render.params = ["ariaExpanded","ariaLabel","buttonStyle","download","elementClasses","href","icon","iconAlignment","id","imageAlt","imageSrc","label","spritemap","style","target"];
exports.render.types = {"ariaExpanded":"bool","ariaLabel":"string","buttonStyle":"string","download":"string","elementClasses":"string","href":"string","icon":"string","iconAlignment":"string","id":"string","imageAlt":"string","imageSrc":"string","label":"html|string","spritemap":"string","style":"string","target":"string"};
exports.render.params = ["ariaExpanded","ariaLabel","buttonStyle","download","elementClasses","href","icon","iconAlignment","id","imageAlt","imageSrc","label","spritemap","style","target","title"];
exports.render.types = {"ariaExpanded":"bool","ariaLabel":"string","buttonStyle":"string","download":"string","elementClasses":"string","href":"string","icon":"string","iconAlignment":"string","id":"string","imageAlt":"string","imageSrc":"string","label":"html|string","spritemap":"string","style":"string","target":"string","title":"string"};
exports.content.params = ["icon","iconAlignment","imageAlt","imageSrc","label","spritemap"];

@@ -279,4 +235,2 @@ exports.content.types = {"icon":"string","iconAlignment":"string","imageAlt":"string","imageSrc":"string","label":"html|string","spritemap":"string"};

exports.icon.types = {"icon":"string","spritemap":"string"};
exports.attributes.params = ["ariaExpanded","ariaLabel","buttonStyle","download","elementClasses","href","id","style","target"];
exports.attributes.types = {"ariaExpanded":"bool","ariaLabel":"string","buttonStyle":"string","download":"string","elementClasses":"string","href":"string","id":"string","style":"string","target":"string"};
templates = exports;

@@ -283,0 +237,0 @@ return exports;

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

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