clay-label
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -144,5 +144,5 @@ 'use strict'; | ||
* @memberof ClayLabel | ||
* @type {?string} | ||
* @type {?(bool|string)} | ||
*/ | ||
style: _metalState.Config.oneOf(['danger', 'info', 'secondary', 'success', 'warning']).value('secondary') | ||
style: _metalState.Config.oneOfType([_metalState.Config.bool(), _metalState.Config.oneOf(['danger', 'info', 'secondary', 'warning', 'success'])]).value('secondary') | ||
}; | ||
@@ -149,0 +149,0 @@ |
@@ -74,6 +74,14 @@ 'use strict'; | ||
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'); | ||
var attributes__soy38 = function attributes__soy38() { | ||
incrementalDom.attr('class', 'label label-' + (style != null ? style : 'secondary') + (closeable ? ' label-dismissible' : '') + (elementClasses ? ' ' + elementClasses : '') + (size ? ' label-' + size : '')); | ||
/** @type {!goog.soy.data.SanitizedContent|boolean|null|string|undefined} */ | ||
var style = soy.asserts.assertType(opt_data.style == null || goog.isBoolean(opt_data.style) || opt_data.style === 1 || opt_data.style === 0 || goog.isString(opt_data.style) || opt_data.style instanceof goog.soy.data.SanitizedContent, 'style', opt_data.style, '!goog.soy.data.SanitizedContent|boolean|null|string|undefined'); | ||
var attributes__soy44 = function attributes__soy44() { | ||
var $tmp; | ||
if (style != null && style != true && style != false) { | ||
$tmp = ' label-' + style; | ||
} else if (!(style != null) || style == true) { | ||
$tmp = ' label-secondary'; | ||
} else { | ||
$tmp = ''; | ||
} | ||
incrementalDom.attr('class', 'label' + $tmp + (closeable ? ' label-dismissible' : '') + (elementClasses ? ' ' + elementClasses : '') + (size ? ' label-' + size : '')); | ||
if (id) { | ||
@@ -84,3 +92,3 @@ incrementalDom.attr('id', id); | ||
incrementalDom.elementOpenStart('span'); | ||
attributes__soy38(); | ||
attributes__soy44(); | ||
incrementalDom.elementOpenEnd(); | ||
@@ -101,3 +109,3 @@ $content({ _handleCloseButtonClick: _handleCloseButtonClick, closeable: closeable, href: href, label: label, spritemap: spritemap }, opt_ijData); | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|boolean|null|string|undefined), | ||
* }} | ||
@@ -130,3 +138,3 @@ */ | ||
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'); | ||
var labelContent__soy69 = function labelContent__soy69() { | ||
var labelContent__soy75 = function labelContent__soy75() { | ||
incrementalDom.elementOpenStart('span'); | ||
@@ -143,14 +151,14 @@ incrementalDom.attr('class', 'label-item label-item-expand'); | ||
if (closeable && spritemap) { | ||
var msg_1_202442244688100878__soy616 = ''; | ||
var msg_1_202442244688100878__soy624 = ''; | ||
/** @desc The word 'Close' used as a verb */ | ||
var MSG_EXTERNAL_202442244688100878 = goog.getMsg('close'); | ||
msg_1_202442244688100878__soy616 += MSG_EXTERNAL_202442244688100878; | ||
labelContent__soy69(); | ||
msg_1_202442244688100878__soy624 += MSG_EXTERNAL_202442244688100878; | ||
labelContent__soy75(); | ||
incrementalDom.elementOpenStart('span'); | ||
incrementalDom.attr('class', 'label-item label-item-after'); | ||
incrementalDom.elementOpenEnd(); | ||
$templateAlias1({ ariaLabel: '' + msg_1_202442244688100878__soy616, elementClasses: 'close', events: { click: _handleCloseButtonClick }, icon: 'times', iconAlignment: 'right', ref: 'closeButton', spritemap: spritemap, style: 'unstyled', type: 'button' }, opt_ijData); | ||
$templateAlias1({ ariaLabel: '' + msg_1_202442244688100878__soy624, elementClasses: 'close', events: { click: _handleCloseButtonClick }, icon: 'times', iconAlignment: 'right', ref: 'closeButton', spritemap: spritemap, style: false, type: 'button' }, opt_ijData); | ||
incrementalDom.elementClose('span'); | ||
} else { | ||
labelContent__soy69(); | ||
labelContent__soy75(); | ||
} | ||
@@ -174,3 +182,3 @@ }; | ||
exports.render.params = ["_handleCloseButtonClick", "closeable", "elementClasses", "href", "id", "label", "size", "spritemap", "style"]; | ||
exports.render.types = { "_handleCloseButtonClick": "any", "closeable": "bool", "elementClasses": "string", "href": "string", "id": "string", "label": "html|string", "size": "string", "spritemap": "string", "style": "string" }; | ||
exports.render.types = { "_handleCloseButtonClick": "any", "closeable": "bool", "elementClasses": "string", "href": "string", "id": "string", "label": "html|string", "size": "string", "spritemap": "string", "style": "bool|string" }; | ||
exports.content.params = ["_handleCloseButtonClick", "closeable", "href", "label", "spritemap"]; | ||
@@ -177,0 +185,0 @@ exports.content.types = { "_handleCloseButtonClick": "any", "closeable": "bool", "href": "string", "label": "html|string", "spritemap": "string" }; |
{ | ||
"name": "clay-label", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Metal Clay Label component", | ||
@@ -31,4 +31,4 @@ "license": "BSD", | ||
"dependencies": { | ||
"clay-button": "^2.3.2", | ||
"clay-link": "^2.3.2", | ||
"clay-button": "^2.3.3", | ||
"clay-link": "^2.3.3", | ||
"metal": "^2.16.0", | ||
@@ -46,8 +46,8 @@ "metal-component": "^2.16.0", | ||
"babel-preset-env": "^1.6.0", | ||
"browserslist-config-clay": "^2.3.2", | ||
"clay-css": "^2.3.2", | ||
"browserslist-config-clay": "^2.3.3", | ||
"clay-css": "^2.3.3", | ||
"metal-dom": "^2.13.2", | ||
"metal-tools-soy": "^6.0.0", | ||
"webpack": "^3.0.0", | ||
"webpack-config-clay": "^2.3.2" | ||
"webpack-config-clay": "^2.3.3" | ||
}, | ||
@@ -54,0 +54,0 @@ "browserslist": [ |
@@ -52,3 +52,3 @@ 'use strict'; | ||
it('should render a label with removable', () => { | ||
it('should render a removable label', () => { | ||
label = new ClayLabel({ | ||
@@ -112,2 +112,10 @@ label: 'Foo', | ||
it('should render a label with no style', () => { | ||
label = new ClayLabel({ | ||
style: false, | ||
}); | ||
expect(label).toMatchSnapshot(); | ||
}); | ||
it('should render a closeable label and emit an event on close button click', () => { | ||
@@ -114,0 +122,0 @@ label = new ClayLabel({ |
@@ -98,10 +98,7 @@ import 'clay-button'; | ||
* @memberof ClayLabel | ||
* @type {?string} | ||
* @type {?(bool|string)} | ||
*/ | ||
style: Config.oneOf([ | ||
'danger', | ||
'info', | ||
'secondary', | ||
'success', | ||
'warning', | ||
style: Config.oneOfType([ | ||
Config.bool(), | ||
Config.oneOf(['danger', 'info', 'secondary', 'warning', 'success']), | ||
]).value('secondary'), | ||
@@ -108,0 +105,0 @@ }; |
@@ -55,6 +55,14 @@ /* jshint ignore:start */ | ||
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'); | ||
var attributes__soy38 = function() { | ||
incrementalDom.attr('class', 'label label-' + (style != null ? style : 'secondary') + (closeable ? ' label-dismissible' : '') + (elementClasses ? ' ' + elementClasses : '') + (size ? ' label-' + size : '')); | ||
/** @type {!goog.soy.data.SanitizedContent|boolean|null|string|undefined} */ | ||
var style = soy.asserts.assertType(opt_data.style == null || (goog.isBoolean(opt_data.style) || opt_data.style === 1 || opt_data.style === 0) || (goog.isString(opt_data.style) || opt_data.style instanceof goog.soy.data.SanitizedContent), 'style', opt_data.style, '!goog.soy.data.SanitizedContent|boolean|null|string|undefined'); | ||
var attributes__soy44 = function() { | ||
var $tmp; | ||
if ((style != null) && style != true && style != false) { | ||
$tmp = ' label-' + style; | ||
} else if (!(style != null) || style == true) { | ||
$tmp = ' label-secondary'; | ||
} else { | ||
$tmp = ''; | ||
} | ||
incrementalDom.attr('class', 'label' + $tmp + (closeable ? ' label-dismissible' : '') + (elementClasses ? ' ' + elementClasses : '') + (size ? ' label-' + size : '')); | ||
if (id) { | ||
@@ -65,3 +73,3 @@ incrementalDom.attr('id', id); | ||
incrementalDom.elementOpenStart('span'); | ||
attributes__soy38(); | ||
attributes__soy44(); | ||
incrementalDom.elementOpenEnd(); | ||
@@ -82,3 +90,3 @@ $content({_handleCloseButtonClick: _handleCloseButtonClick, closeable: closeable, href: href, label: label, spritemap: spritemap}, opt_ijData); | ||
* spritemap: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|null|string|undefined), | ||
* style: (!goog.soy.data.SanitizedContent|boolean|null|string|undefined), | ||
* }} | ||
@@ -112,3 +120,3 @@ */ | ||
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'); | ||
var labelContent__soy69 = function() { | ||
var labelContent__soy75 = function() { | ||
incrementalDom.elementOpenStart('span'); | ||
@@ -125,14 +133,14 @@ incrementalDom.attr('class', 'label-item label-item-expand'); | ||
if (closeable && spritemap) { | ||
var msg_1_202442244688100878__soy616 = ''; | ||
var msg_1_202442244688100878__soy624 = ''; | ||
/** @desc The word 'Close' used as a verb */ | ||
var MSG_EXTERNAL_202442244688100878 = goog.getMsg('close'); | ||
msg_1_202442244688100878__soy616 += MSG_EXTERNAL_202442244688100878; | ||
labelContent__soy69(); | ||
msg_1_202442244688100878__soy624 += MSG_EXTERNAL_202442244688100878; | ||
labelContent__soy75(); | ||
incrementalDom.elementOpenStart('span'); | ||
incrementalDom.attr('class', 'label-item label-item-after'); | ||
incrementalDom.elementOpenEnd(); | ||
$templateAlias1({ariaLabel: '' + msg_1_202442244688100878__soy616, elementClasses: 'close', events: {click: _handleCloseButtonClick}, icon: 'times', iconAlignment: 'right', ref: 'closeButton', spritemap: spritemap, style: 'unstyled', type: 'button'}, opt_ijData); | ||
$templateAlias1({ariaLabel: '' + msg_1_202442244688100878__soy624, elementClasses: 'close', events: {click: _handleCloseButtonClick}, icon: 'times', iconAlignment: 'right', ref: 'closeButton', spritemap: spritemap, style: false, type: 'button'}, opt_ijData); | ||
incrementalDom.elementClose('span'); | ||
} else { | ||
labelContent__soy69(); | ||
labelContent__soy75(); | ||
} | ||
@@ -156,3 +164,3 @@ }; | ||
exports.render.params = ["_handleCloseButtonClick","closeable","elementClasses","href","id","label","size","spritemap","style"]; | ||
exports.render.types = {"_handleCloseButtonClick":"any","closeable":"bool","elementClasses":"string","href":"string","id":"string","label":"html|string","size":"string","spritemap":"string","style":"string"}; | ||
exports.render.types = {"_handleCloseButtonClick":"any","closeable":"bool","elementClasses":"string","href":"string","id":"string","label":"html|string","size":"string","spritemap":"string","style":"bool|string"}; | ||
exports.content.params = ["_handleCloseButtonClick","closeable","href","label","spritemap"]; | ||
@@ -159,0 +167,0 @@ exports.content.types = {"_handleCloseButtonClick":"any","closeable":"bool","href":"string","label":"html|string","spritemap":"string"}; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
58688
661
0
Updatedclay-button@^2.3.3
Updatedclay-link@^2.3.3