Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
@@ -85,3 +85,3 @@ 'use strict'; | ||
*/ | ||
buttonStyle: _metalState.Config.oneOf(['borderless', 'link', 'primary', 'secondary']), | ||
buttonStyle: _metalState.Config.oneOf(['link', 'primary', 'secondary']), | ||
@@ -125,15 +125,20 @@ /** | ||
/** | ||
* Render ClayIcon in the ClayLink element. | ||
* Icon to be rendered in the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?Object|undefined} | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
icon: _metalState.Config.shapeOf({ | ||
alignment: _metalState.Config.oneOf(['left', 'right']), | ||
spritemap: _metalState.Config.string().required(), | ||
symbol: _metalState.Config.string().required() | ||
}), | ||
icon: _metalState.Config.string(), | ||
/** | ||
* Render position of the ClayIcon in the ClayLink element. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string} | ||
* @default left | ||
*/ | ||
iconAlignment: _metalState.Config.oneOf(['left', 'right']).value('left'), | ||
/** | ||
* Id to be applied to the element. | ||
@@ -148,2 +153,20 @@ * @instance | ||
/** | ||
* Alternative text of the image to be rendered inside the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
imageAlt: _metalState.Config.string(), | ||
/** | ||
* Source of the image to be rendered inside the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
imageSrc: _metalState.Config.string(), | ||
/** | ||
* Sets the text or HTML to be rendered inside the anchor tag. | ||
@@ -158,2 +181,11 @@ * @instance | ||
/** | ||
* The path to the SVG spritemap file containing the icons. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
spritemap: _metalState.Config.string(), | ||
/** | ||
* The css class that colors the button. | ||
@@ -174,3 +206,3 @@ * @instance | ||
*/ | ||
target: _metalState.Config.string() | ||
target: _metalState.Config.oneOf(['_blank', '_self']) | ||
}; | ||
@@ -177,0 +209,0 @@ |
@@ -54,5 +54,9 @@ 'use strict'; | ||
* href: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}), | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* id: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
@@ -68,2 +72,3 @@ * target: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
var $$temp; | ||
opt_data = opt_data || {}; | ||
@@ -82,59 +87,27 @@ /** @type {boolean|null|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 {null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isObject(opt_data.icon), 'icon', opt_data.icon, 'null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent, 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var iconAlignment = soy.asserts.assertType(opt_data.iconAlignment == null || goog.isString(opt_data.iconAlignment) || opt_data.iconAlignment instanceof goog.soy.data.SanitizedContent, 'iconAlignment', opt_data.iconAlignment, '!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 imageAlt = soy.asserts.assertType(opt_data.imageAlt == null || goog.isString(opt_data.imageAlt) || opt_data.imageAlt instanceof goog.soy.data.SanitizedContent, 'imageAlt', opt_data.imageAlt, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageSrc = soy.asserts.assertType(opt_data.imageSrc == null || goog.isString(opt_data.imageSrc) || opt_data.imageSrc instanceof goog.soy.data.SanitizedContent, 'imageSrc', opt_data.imageSrc, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|function()|null|string|undefined} */ | ||
var label = soy.asserts.assertType(opt_data.label == null || goog.isFunction(opt_data.label) || goog.isString(opt_data.label) || opt_data.label instanceof goog.soy.data.SanitizedContent, 'label', opt_data.label, '!goog.soy.data.SanitizedContent|function()|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var spritemap = soy.asserts.assertType(opt_data.spritemap == null || goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!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'); | ||
var attributes__soy15 = function attributes__soy15() { | ||
if (ariaLabel) { | ||
incrementalDom.attr('aria-label', ariaLabel); | ||
} | ||
if (ariaExpanded) { | ||
incrementalDom.attr('aria-expanded', 'true'); | ||
} else if (ariaExpanded == false) { | ||
incrementalDom.attr('aria-expanded', 'false'); | ||
} | ||
var classes__soy29 = ''; | ||
var $tmp = null; | ||
if (buttonStyle) { | ||
$tmp = 'btn btn-' + buttonStyle; | ||
} else if (style) { | ||
$tmp = 'link-' + style; | ||
} else { | ||
$tmp = ''; | ||
} | ||
classes__soy29 += $tmp; | ||
classes__soy29 += elementClasses ? ' ' + elementClasses : ''; | ||
if (classes__soy29) { | ||
incrementalDom.attr('class', classes__soy29); | ||
} | ||
if (download) { | ||
incrementalDom.attr('download', download); | ||
} | ||
if (href) { | ||
incrementalDom.attr('href', href); | ||
} | ||
if (id) { | ||
incrementalDom.attr('id', id); | ||
} | ||
if (target) { | ||
incrementalDom.attr('target', target); | ||
} | ||
var attributes__soy19 = function attributes__soy19() { | ||
$attributes(opt_data, null, opt_ijData); | ||
}; | ||
incrementalDom.elementOpenStart('a'); | ||
attributes__soy15(); | ||
attributes__soy19(); | ||
incrementalDom.elementOpenEnd(); | ||
var iconAlignment__soy81 = icon && icon.alignment ? icon.alignment : 'left'; | ||
if (icon && iconAlignment__soy81 == 'left') { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
soyIdom.print(label); | ||
if (icon && iconAlignment__soy81 == 'right') { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
$content({ icon: icon, iconAlignment: ($$temp = iconAlignment) == null ? 'left' : $$temp, imageAlt: imageAlt, imageSrc: imageSrc, label: label, spritemap: spritemap }, null, opt_ijData); | ||
incrementalDom.elementClose('a'); | ||
@@ -151,5 +124,9 @@ } | ||
* href: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}), | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* id: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
@@ -166,3 +143,8 @@ * target: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* @param {{ | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}) | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* }} opt_data | ||
@@ -174,13 +156,74 @@ * @param {Object<string, *>=} opt_ijData | ||
*/ | ||
function $icon(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
function $content(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
var $$temp; | ||
opt_data = opt_data || {}; | ||
/** @type {null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isObject(opt_data.icon), 'icon', opt_data.icon, 'null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}'); | ||
$templateAlias1({ spritemap: icon.spritemap, symbol: icon.symbol }, null, opt_ijData); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent, 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var iconAlignment = soy.asserts.assertType(opt_data.iconAlignment == null || goog.isString(opt_data.iconAlignment) || opt_data.iconAlignment instanceof goog.soy.data.SanitizedContent, 'iconAlignment', opt_data.iconAlignment, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageAlt = soy.asserts.assertType(opt_data.imageAlt == null || goog.isString(opt_data.imageAlt) || opt_data.imageAlt instanceof goog.soy.data.SanitizedContent, 'imageAlt', opt_data.imageAlt, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageSrc = soy.asserts.assertType(opt_data.imageSrc == null || goog.isString(opt_data.imageSrc) || opt_data.imageSrc instanceof goog.soy.data.SanitizedContent, 'imageSrc', opt_data.imageSrc, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|function()|null|string|undefined} */ | ||
var label = soy.asserts.assertType(opt_data.label == null || goog.isFunction(opt_data.label) || goog.isString(opt_data.label) || opt_data.label instanceof goog.soy.data.SanitizedContent, 'label', opt_data.label, '!goog.soy.data.SanitizedContent|function()|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var spritemap = soy.asserts.assertType(opt_data.spritemap == null || goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
if (imageSrc) { | ||
incrementalDom.elementOpenStart('img'); | ||
incrementalDom.attr('alt', imageAlt); | ||
incrementalDom.attr('class', 'img-fluid'); | ||
incrementalDom.attr('src', imageSrc); | ||
incrementalDom.elementOpenEnd(); | ||
incrementalDom.elementClose('img'); | ||
} else { | ||
if (icon && iconAlignment == 'left' && spritemap) { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
soyIdom.print(($$temp = label) == null ? '' : $$temp); | ||
if (icon && iconAlignment == 'right' && spritemap) { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
} | ||
} | ||
exports.content = $content; | ||
/** | ||
* @typedef {{ | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* }} | ||
*/ | ||
$content.Params; | ||
if (goog.DEBUG) { | ||
$content.soyTemplateName = 'ClayLink.content'; | ||
} | ||
/** | ||
* @param {{ | ||
* icon: (!goog.soy.data.SanitizedContent|string), | ||
* spritemap: (!goog.soy.data.SanitizedContent|string) | ||
* }} opt_data | ||
* @param {Object<string, *>=} opt_ijData | ||
* @param {Object<string, *>=} opt_ijData_deprecated | ||
* @return {void} | ||
* @suppress {checkTypes} | ||
*/ | ||
function $icon(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
/** @type {!goog.soy.data.SanitizedContent|string} */ | ||
var icon = soy.asserts.assertType(goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent, 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|string'); | ||
/** @type {!goog.soy.data.SanitizedContent|string} */ | ||
var spritemap = soy.asserts.assertType(goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|string'); | ||
$templateAlias1({ spritemap: spritemap, symbol: icon }, null, opt_ijData); | ||
} | ||
exports.icon = $icon; | ||
/** | ||
* @typedef {{ | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}) | ||
* icon: (!goog.soy.data.SanitizedContent|string), | ||
* spritemap: (!goog.soy.data.SanitizedContent|string) | ||
* }} | ||
@@ -193,6 +236,102 @@ */ | ||
exports.render.params = ["ariaExpanded", "ariaLabel", "buttonStyle", "download", "elementClasses", "href", "icon", "id", "label", "style", "target"]; | ||
exports.render.types = { "ariaExpanded": "bool", "ariaLabel": "string", "buttonStyle": "string", "download": "string", "elementClasses": "string", "href": "string", "icon": "[\n\t\talignment: string,\n\t\tspritemap: string,\n\t\tsymbol: string\n\t]", "id": "string", "label": "html|string", "style": "string", "target": "string" }; | ||
exports.icon.params = ["icon"]; | ||
exports.icon.types = { "icon": "[\n\t\talignment: string,\n\t\tspritemap: string,\n\t\tsymbol: string\n\t]" }; | ||
/** | ||
* @param {{ | ||
* 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) | ||
* }} opt_data | ||
* @param {Object<string, *>=} opt_ijData | ||
* @param {Object<string, *>=} opt_ijData_deprecated | ||
* @return {void} | ||
* @suppress {checkTypes} | ||
*/ | ||
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__soy110 = ''; | ||
var $tmp = null; | ||
if (buttonStyle) { | ||
$tmp = 'btn btn-' + buttonStyle; | ||
} else if (style) { | ||
$tmp = 'link-' + style; | ||
} else { | ||
$tmp = ''; | ||
} | ||
classes__soy110 += $tmp; | ||
classes__soy110 += elementClasses ? ' ' + elementClasses : ''; | ||
if (classes__soy110) { | ||
incrementalDom.attr('class', classes__soy110); | ||
} | ||
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.content.params = ["icon", "iconAlignment", "imageAlt", "imageSrc", "label", "spritemap"]; | ||
exports.content.types = { "icon": "string", "iconAlignment": "string", "imageAlt": "string", "imageSrc": "string", "label": "html|string", "spritemap": "string" }; | ||
exports.icon.params = ["icon", "spritemap"]; | ||
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; | ||
@@ -199,0 +338,0 @@ return exports; |
{ | ||
"name": "clay-link", | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "Clay Link Component", | ||
@@ -31,3 +31,3 @@ "license": "BSD", | ||
"clay-component": "^1.0.0-alpha.8", | ||
"clay-icon": "^1.0.0-alpha.5", | ||
"clay-icon": "^1.0.0-alpha.9", | ||
"metal": "^2.14.0", | ||
@@ -34,0 +34,0 @@ "metal-component": "^2.14.0", |
@@ -90,6 +90,4 @@ import ClayLink from '../ClayLink'; | ||
link = new ClayLink({ | ||
icon: { | ||
spritemap: 'icons.svg', | ||
symbol: 'plus', | ||
}, | ||
icon: 'plus', | ||
spritemap: 'icons.svg', | ||
}); | ||
@@ -102,7 +100,5 @@ | ||
link = new ClayLink({ | ||
icon: { | ||
spritemap: 'icons.svg', | ||
symbol: 'plus', | ||
}, | ||
icon: 'plus', | ||
label: 'My Link', | ||
spritemap: 'icons.svg', | ||
}); | ||
@@ -115,8 +111,6 @@ | ||
link = new ClayLink({ | ||
icon: { | ||
alignment: 'right', | ||
spritemap: 'icons.svg', | ||
symbol: 'plus', | ||
}, | ||
icon: 'plus', | ||
iconAlignment: 'right', | ||
label: 'My Link', | ||
spritemap: 'icons.svg', | ||
}); | ||
@@ -127,2 +121,19 @@ | ||
it('should render a link with image', () => { | ||
link = new ClayLink({ | ||
imageSrc: 'image.jpg', | ||
}); | ||
expect(link).toMatchSnapshot(); | ||
}); | ||
it('should render a link with image and image alt', () => { | ||
link = new ClayLink({ | ||
imageAlt: 'my image', | ||
imageSrc: 'image.jpg', | ||
}); | ||
expect(link).toMatchSnapshot(); | ||
}); | ||
it('should render a link with secondary style', () => { | ||
@@ -152,10 +163,2 @@ link = new ClayLink({ | ||
it('should render a link with button borderless style', () => { | ||
link = new ClayLink({ | ||
buttonStyle: 'borderless', | ||
}); | ||
expect(link).toMatchSnapshot(); | ||
}); | ||
it('should render a link with button link style', () => { | ||
@@ -162,0 +165,0 @@ link = new ClayLink({ |
@@ -46,3 +46,3 @@ import 'clay-icon'; | ||
*/ | ||
buttonStyle: Config.oneOf(['borderless', 'link', 'primary', 'secondary']), | ||
buttonStyle: Config.oneOf(['link', 'primary', 'secondary']), | ||
@@ -86,15 +86,20 @@ /** | ||
/** | ||
* Render ClayIcon in the ClayLink element. | ||
* Icon to be rendered in the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?Object|undefined} | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
icon: Config.shapeOf({ | ||
alignment: Config.oneOf(['left', 'right']), | ||
spritemap: Config.string().required(), | ||
symbol: Config.string().required(), | ||
}), | ||
icon: Config.string(), | ||
/** | ||
* Render position of the ClayIcon in the ClayLink element. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string} | ||
* @default left | ||
*/ | ||
iconAlignment: Config.oneOf(['left', 'right']).value('left'), | ||
/** | ||
* Id to be applied to the element. | ||
@@ -109,2 +114,20 @@ * @instance | ||
/** | ||
* Alternative text of the image to be rendered inside the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
imageAlt: Config.string(), | ||
/** | ||
* Source of the image to be rendered inside the link. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
imageSrc: Config.string(), | ||
/** | ||
* Sets the text or HTML to be rendered inside the anchor tag. | ||
@@ -119,2 +142,11 @@ * @instance | ||
/** | ||
* The path to the SVG spritemap file containing the icons. | ||
* @instance | ||
* @memberof ClayLink | ||
* @type {?string|undefined} | ||
* @default undefined | ||
*/ | ||
spritemap: Config.string(), | ||
/** | ||
* The css class that colors the button. | ||
@@ -135,3 +167,3 @@ * @instance | ||
*/ | ||
target: Config.string(), | ||
target: Config.oneOf(['_blank', '_self']), | ||
}; | ||
@@ -138,0 +170,0 @@ |
@@ -35,5 +35,9 @@ /* jshint ignore:start */ | ||
* href: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}), | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* id: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
@@ -49,2 +53,3 @@ * target: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
var $$temp; | ||
opt_data = opt_data || {}; | ||
@@ -63,59 +68,27 @@ /** @type {boolean|null|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 {null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isObject(opt_data.icon), 'icon', opt_data.icon, 'null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || (goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent), 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var iconAlignment = soy.asserts.assertType(opt_data.iconAlignment == null || (goog.isString(opt_data.iconAlignment) || opt_data.iconAlignment instanceof goog.soy.data.SanitizedContent), 'iconAlignment', opt_data.iconAlignment, '!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 imageAlt = soy.asserts.assertType(opt_data.imageAlt == null || (goog.isString(opt_data.imageAlt) || opt_data.imageAlt instanceof goog.soy.data.SanitizedContent), 'imageAlt', opt_data.imageAlt, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageSrc = soy.asserts.assertType(opt_data.imageSrc == null || (goog.isString(opt_data.imageSrc) || opt_data.imageSrc instanceof goog.soy.data.SanitizedContent), 'imageSrc', opt_data.imageSrc, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|function()|null|string|undefined} */ | ||
var label = soy.asserts.assertType(opt_data.label == null || goog.isFunction(opt_data.label) || (goog.isString(opt_data.label) || opt_data.label instanceof goog.soy.data.SanitizedContent), 'label', opt_data.label, '!goog.soy.data.SanitizedContent|function()|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var spritemap = soy.asserts.assertType(opt_data.spritemap == null || (goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent), 'spritemap', opt_data.spritemap, '!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'); | ||
var attributes__soy15 = function() { | ||
if (ariaLabel) { | ||
incrementalDom.attr('aria-label', ariaLabel); | ||
} | ||
if (ariaExpanded) { | ||
incrementalDom.attr('aria-expanded', 'true'); | ||
} else if (ariaExpanded == false) { | ||
incrementalDom.attr('aria-expanded', 'false'); | ||
} | ||
var classes__soy29 = ''; | ||
var $tmp = null; | ||
if (buttonStyle) { | ||
$tmp = 'btn btn-' + buttonStyle; | ||
} else if (style) { | ||
$tmp = 'link-' + style; | ||
} else { | ||
$tmp = ''; | ||
} | ||
classes__soy29 += $tmp; | ||
classes__soy29 += elementClasses ? ' ' + elementClasses : ''; | ||
if (classes__soy29) { | ||
incrementalDom.attr('class', classes__soy29); | ||
} | ||
if (download) { | ||
incrementalDom.attr('download', download); | ||
} | ||
if (href) { | ||
incrementalDom.attr('href', href); | ||
} | ||
if (id) { | ||
incrementalDom.attr('id', id); | ||
} | ||
if (target) { | ||
incrementalDom.attr('target', target); | ||
} | ||
var attributes__soy19 = function() { | ||
$attributes(opt_data, null, opt_ijData); | ||
}; | ||
incrementalDom.elementOpenStart('a'); | ||
attributes__soy15(); | ||
attributes__soy19(); | ||
incrementalDom.elementOpenEnd(); | ||
var iconAlignment__soy81 = icon && icon.alignment ? icon.alignment : 'left'; | ||
if (icon && iconAlignment__soy81 == 'left') { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
soyIdom.print(label); | ||
if (icon && iconAlignment__soy81 == 'right') { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
$content({icon: icon, iconAlignment: ($$temp = iconAlignment) == null ? 'left' : $$temp, imageAlt: imageAlt, imageSrc: imageSrc, label: label, spritemap: spritemap}, null, opt_ijData); | ||
incrementalDom.elementClose('a'); | ||
@@ -132,5 +105,9 @@ } | ||
* href: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}), | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* id: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
@@ -148,3 +125,8 @@ * target: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* @param {{ | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}) | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* }} opt_data | ||
@@ -156,13 +138,75 @@ * @param {Object<string, *>=} opt_ijData | ||
*/ | ||
function $icon(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
function $content(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
var $$temp; | ||
opt_data = opt_data || {}; | ||
/** @type {null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || goog.isObject(opt_data.icon), 'icon', opt_data.icon, 'null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}'); | ||
$templateAlias1({spritemap: icon.spritemap, symbol: icon.symbol}, null, opt_ijData); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var icon = soy.asserts.assertType(opt_data.icon == null || (goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent), 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var iconAlignment = soy.asserts.assertType(opt_data.iconAlignment == null || (goog.isString(opt_data.iconAlignment) || opt_data.iconAlignment instanceof goog.soy.data.SanitizedContent), 'iconAlignment', opt_data.iconAlignment, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageAlt = soy.asserts.assertType(opt_data.imageAlt == null || (goog.isString(opt_data.imageAlt) || opt_data.imageAlt instanceof goog.soy.data.SanitizedContent), 'imageAlt', opt_data.imageAlt, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var imageSrc = soy.asserts.assertType(opt_data.imageSrc == null || (goog.isString(opt_data.imageSrc) || opt_data.imageSrc instanceof goog.soy.data.SanitizedContent), 'imageSrc', opt_data.imageSrc, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|function()|null|string|undefined} */ | ||
var label = soy.asserts.assertType(opt_data.label == null || goog.isFunction(opt_data.label) || (goog.isString(opt_data.label) || opt_data.label instanceof goog.soy.data.SanitizedContent), 'label', opt_data.label, '!goog.soy.data.SanitizedContent|function()|null|string|undefined'); | ||
/** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */ | ||
var spritemap = soy.asserts.assertType(opt_data.spritemap == null || (goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent), 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|null|string|undefined'); | ||
if (imageSrc) { | ||
incrementalDom.elementOpenStart('img'); | ||
incrementalDom.attr('alt', imageAlt); | ||
incrementalDom.attr('class', 'img-fluid'); | ||
incrementalDom.attr('src', imageSrc); | ||
incrementalDom.elementOpenEnd(); | ||
incrementalDom.elementClose('img'); | ||
} else { | ||
if (icon && iconAlignment == 'left' && spritemap) { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
soyIdom.print(($$temp = label) == null ? '' : $$temp); | ||
if (icon && iconAlignment == 'right' && spritemap) { | ||
$icon(opt_data, null, opt_ijData); | ||
} | ||
} | ||
} | ||
exports.content = $content; | ||
/** | ||
* @typedef {{ | ||
* icon: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* iconAlignment: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageAlt: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* imageSrc: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* label: (!goog.soy.data.SanitizedContent|function()|null|string|undefined), | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined) | ||
* }} | ||
*/ | ||
$content.Params; | ||
if (goog.DEBUG) { | ||
$content.soyTemplateName = 'ClayLink.content'; | ||
} | ||
/** | ||
* @param {{ | ||
* icon: (!goog.soy.data.SanitizedContent|string), | ||
* spritemap: (!goog.soy.data.SanitizedContent|string) | ||
* }} opt_data | ||
* @param {Object<string, *>=} opt_ijData | ||
* @param {Object<string, *>=} opt_ijData_deprecated | ||
* @return {void} | ||
* @suppress {checkTypes} | ||
*/ | ||
function $icon(opt_data, opt_ijData, opt_ijData_deprecated) { | ||
opt_ijData = opt_ijData_deprecated || opt_ijData; | ||
/** @type {!goog.soy.data.SanitizedContent|string} */ | ||
var icon = soy.asserts.assertType(goog.isString(opt_data.icon) || opt_data.icon instanceof goog.soy.data.SanitizedContent, 'icon', opt_data.icon, '!goog.soy.data.SanitizedContent|string'); | ||
/** @type {!goog.soy.data.SanitizedContent|string} */ | ||
var spritemap = soy.asserts.assertType(goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|string'); | ||
$templateAlias1({spritemap: spritemap, symbol: icon}, null, opt_ijData); | ||
} | ||
exports.icon = $icon; | ||
/** | ||
* @typedef {{ | ||
* icon: (null|undefined|{alignment: (!goog.soy.data.SanitizedContent|string), spritemap: (!goog.soy.data.SanitizedContent|string), symbol: (!goog.soy.data.SanitizedContent|string)}) | ||
* icon: (!goog.soy.data.SanitizedContent|string), | ||
* spritemap: (!goog.soy.data.SanitizedContent|string) | ||
* }} | ||
@@ -175,6 +219,103 @@ */ | ||
exports.render.params = ["ariaExpanded","ariaLabel","buttonStyle","download","elementClasses","href","icon","id","label","style","target"]; | ||
exports.render.types = {"ariaExpanded":"bool","ariaLabel":"string","buttonStyle":"string","download":"string","elementClasses":"string","href":"string","icon":"[\n\t\talignment: string,\n\t\tspritemap: string,\n\t\tsymbol: string\n\t]","id":"string","label":"html|string","style":"string","target":"string"}; | ||
exports.icon.params = ["icon"]; | ||
exports.icon.types = {"icon":"[\n\t\talignment: string,\n\t\tspritemap: string,\n\t\tsymbol: string\n\t]"}; | ||
/** | ||
* @param {{ | ||
* 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) | ||
* }} opt_data | ||
* @param {Object<string, *>=} opt_ijData | ||
* @param {Object<string, *>=} opt_ijData_deprecated | ||
* @return {void} | ||
* @suppress {checkTypes} | ||
*/ | ||
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__soy110 = ''; | ||
var $tmp = null; | ||
if (buttonStyle) { | ||
$tmp = 'btn btn-' + buttonStyle; | ||
} else if (style) { | ||
$tmp = 'link-' + style; | ||
} else { | ||
$tmp = ''; | ||
} | ||
classes__soy110 += $tmp; | ||
classes__soy110 += elementClasses ? ' ' + elementClasses : ''; | ||
if (classes__soy110) { | ||
incrementalDom.attr('class', classes__soy110); | ||
} | ||
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.content.params = ["icon","iconAlignment","imageAlt","imageSrc","label","spritemap"]; | ||
exports.content.types = {"icon":"string","iconAlignment":"string","imageAlt":"string","imageSrc":"string","label":"html|string","spritemap":"string"}; | ||
exports.icon.params = ["icon","spritemap"]; | ||
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; | ||
@@ -181,0 +322,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
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
104464
1106
Updatedclay-icon@^1.0.0-alpha.9