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

semantic-ui-less

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semantic-ui-less - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

2

definitions/behaviors/api.js

@@ -1106,3 +1106,3 @@ /*!

noReturnedValue : 'The beforeSend callback must return a settings object, beforeSend ignored.',
noStorage : 'Caching respopnses locally requires session storage',
noStorage : 'Caching responses locally requires session storage',
parseError : 'There was an error parsing your request',

@@ -1109,0 +1109,0 @@ requiredParameter : 'Missing a required URL parameter: ',

@@ -228,2 +228,5 @@ /*!

is: {
bracketedRule: function(rule) {
return (rule.type && rule.type.match(settings.regExp.bracket));
},
valid: function() {

@@ -235,3 +238,3 @@ var

$.each(validation, function(fieldName, field) {
if( !( module.validate.field(field) ) ) {
if( !( module.validate.field(field, fieldName) ) ) {
allValid = false;

@@ -290,3 +293,3 @@ }

},
blur: function() {
blur: function(event) {
var

@@ -299,3 +302,3 @@ $field = $(this),

module.debug('Revalidating field', $field, validationRules);
module.validate.field( validationRules );
module.validate.form.call(module, event, true);
}

@@ -306,3 +309,3 @@ else if(settings.on == 'blur' || settings.on == 'change') {

},
change: function() {
change: function(event) {
var

@@ -316,3 +319,3 @@ $field = $(this),

module.debug('Revalidating field', $field, module.get.validation($field));
module.validate.field( module.get.validation($field) );
module.validate.form.call(module, event, true);
}, settings.delay);

@@ -326,2 +329,14 @@ }

get: {
ancillaryValue: function(rule) {
if(!rule.type || !module.is.bracketedRule(rule)) {
return false;
}
return rule.type.match(settings.regExp.bracket)[1] + '';
},
ruleName: function(rule) {
if( module.is.bracketedRule(rule) ) {
return rule.type.replace(rule.type.match(settings.regExp.bracket)[0], '');
}
return rule.type;
},
changeEvent: function(type, $input) {

@@ -343,12 +358,42 @@ if(type == 'checkbox' || type == 'radio' || type == 'hidden' || $input.is('select')) {

},
settings: function() {
prompt: function(rule, field) {
var
firstProperty
ruleName = module.get.ruleName(rule),
ancillary = module.get.ancillaryValue(rule),
prompt = rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule,
requiresValue = (prompt.search('{value}') !== -1),
requiresName = (prompt.search('{name}') !== -1),
$label,
$field,
name
;
if(requiresName || requiresValue) {
$field = module.get.field(field.identifier);
}
if(requiresValue) {
prompt = prompt.replace('{value}', $field.val());
}
if(requiresName) {
$label = $field.closest(selector.group).find('label').eq(0);
name = ($label.size() == 1)
? $label.text()
: $field.prop('placeholder') || settings.text.unspecifiedField
;
prompt = prompt.replace('{name}', name);
}
prompt = prompt.replace('{identifier}', field.identifier);
prompt = prompt.replace('{ruleValue}', ancillary);
if(!rule.prompt) {
module.verbose('Using default validation prompt for type', prompt, ruleName);
}
return prompt;
},
settings: function() {
if($.isPlainObject(parameters)) {
var
keys = Object.keys(parameters),
keys = Object.keys(parameters),
isLegacySettings = (keys.length > 0)
? (parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined)
: false
: false,
ruleKeys
;

@@ -364,2 +409,19 @@ if(isLegacySettings) {

// 2.x
if(parameters.fields) {
ruleKeys = Object.keys(parameters.fields);
if( typeof parameters.fields[ruleKeys[0]] == 'string' || $.isArray(parameters.fields[ruleKeys[0]]) ) {
$.each(parameters.fields, function(name, rules) {
if(typeof rules == 'string') {
rules = [rules];
}
parameters.fields[name] = {
rules: []
};
$.each(rules, function(index, rule) {
parameters.fields[name].rules.push({ type: rule });
});
});
}
}
settings = $.extend(true, {}, $.fn.form.settings, parameters);

@@ -418,3 +480,4 @@ validation = $.extend({}, $.fn.form.settings.defaults, settings.fields);

var
rules
fieldValidation,
identifier
;

@@ -425,7 +488,9 @@ if(!validation) {

$.each(validation, function(fieldName, field) {
if( module.get.field(field.identifier)[0] == $field[0] ) {
rules = field;
identifier = field.identifier || fieldName;
if( module.get.field(identifier)[0] == $field[0] ) {
field.identifier = identifier;
fieldValidation = field;
}
});
return rules || false;
return fieldValidation || false;
},

@@ -469,3 +534,3 @@ value: function (field) {

if(isChecked) {
values[name].push(true);
values[name].push(value || true);
}

@@ -488,3 +553,3 @@ else {

if(isChecked) {
values[name] = true;
values[name] = value || true;
}

@@ -571,2 +636,3 @@ else {

module.debug('Adding form error messages', errors);
module.set.error();
$message

@@ -579,5 +645,5 @@ .html( settings.templates.error(errors) )

remove: {
prompt: function(field) {
prompt: function(identifier) {
var
$field = module.get.field(field.identifier),
$field = module.get.field(identifier),
$fieldGroup = $field.closest($group),

@@ -590,3 +656,3 @@ $prompt = $fieldGroup.children(selector.prompt)

if(settings.inline && $prompt.is(':visible')) {
module.verbose('Removing prompt for field', field);
module.verbose('Removing prompt for field', identifier);
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {

@@ -700,3 +766,3 @@ $prompt.transition(settings.transition + ' out', settings.duration, function() {

form: function(event) {
form: function(event, ignoreCallbacks) {
var

@@ -717,3 +783,5 @@ values = module.get.values(),

module.set.success();
return settings.onSuccess.call(element, event, values);
if(ignoreCallbacks !== true) {
return settings.onSuccess.call(element, event, values);
}
}

@@ -730,3 +798,5 @@ else {

}
return settings.onFailure.call(element, formErrors, values);
if(ignoreCallbacks !== true) {
return settings.onFailure.call(element, formErrors, values);
}
}

@@ -736,14 +806,19 @@ },

// takes a validation object and returns whether field passes validation
field: function(field) {
field: function(field, fieldName) {
var
$field = module.get.field(field.identifier),
identifier = field.identifier || fieldName,
$field = module.get.field(identifier),
fieldValid = true,
fieldErrors = []
;
if(!field.identifier) {
module.debug('Using field name as identifier', identifier);
field.identifier = identifier;
}
if($field.prop('disabled')) {
module.debug('Field is disabled. Skipping', field.identifier);
module.debug('Field is disabled. Skipping', identifier);
fieldValid = true;
}
else if(field.optional && $.trim($field.val()) === ''){
module.debug('Field is optional and empty. Skipping', field.identifier);
module.debug('Field is optional and empty. Skipping', identifier);
fieldValid = true;

@@ -753,5 +828,5 @@ }

$.each(field.rules, function(index, rule) {
if( module.has.field(field.identifier) && !( module.validate.rule(field, rule) ) ) {
module.debug('Field is invalid', field.identifier, rule.type);
fieldErrors.push(rule.prompt);
if( module.has.field(identifier) && !( module.validate.rule(field, rule) ) ) {
module.debug('Field is invalid', identifier, rule.type);
fieldErrors.push(module.get.prompt(rule, field));
fieldValid = false;

@@ -762,3 +837,3 @@ }

if(fieldValid) {
module.remove.prompt(field, fieldErrors);
module.remove.prompt(identifier, fieldErrors);
settings.onValid.call($field);

@@ -768,3 +843,3 @@ }

formErrors = formErrors.concat(fieldErrors);
module.add.prompt(field.identifier, fieldErrors);
module.add.prompt(identifier, fieldErrors);
settings.onInvalid.call($field, fieldErrors);

@@ -777,13 +852,16 @@ return false;

// takes validation rule and returns whether field passes rule
rule: function(field, validation) {
rule: function(field, rule) {
var
$field = module.get.field(field.identifier),
type = validation.type,
value = $field.val(),
bracket = type.match(settings.regExp.bracket),
isValid = true,
rule,
ancillary,
functionType
$field = module.get.field(field.identifier),
type = rule.type,
value = $field.val(),
isValid = true,
ancillary = module.get.ancillaryValue(rule),
ruleName = module.get.ruleName(rule),
ruleFunction = settings.rules[ruleName]
;
if( !$.isFunction(ruleFunction) ) {
module.error(error.noRule, ruleName);
return;
}
// cast to string avoiding encoding special values

@@ -794,22 +872,3 @@ value = (value === undefined || value === '' || value === null)

;
// if bracket notation is used, pass in extra parameters
if(bracket) {
ancillary = '' + bracket[1];
functionType = type.replace(bracket[0], '');
rule = settings.rules[functionType];
if( !$.isFunction(rule) ) {
module.error(error.noRule, functionType);
return;
}
isValid = rule.call($field, value, ancillary);
}
else {
rule = settings.rules[type];
if( !$.isFunction(rule) ) {
module.error(error.noRule, type);
return;
}
isValid = rule.call($field, value);
}
return isValid;
return ruleFunction.call($field, value, ancillary);
}

@@ -1026,2 +1085,36 @@ },

text: {
unspecifiedRule : 'Please enter a valid value',
unspecifiedField : 'This field'
},
prompt: {
empty : '{name} must have a value',
checked : '{name} must be checked',
email : '{name} must be a valid e-mail',
url : '{name} must be a valid url',
regExp : '{name} is not formatted correctly',
integer : '{name} must be an integer',
decimal : '{name} must be a decimal number',
number : '{name} must be set to a number',
is : '{name} must be "{ruleValue}"',
isExactly : '{name} must be exactly "{ruleValue}"',
not : '{name} cannot be set to "{ruleValue}"',
notExactly : '{name} cannot be set to exactly "{ruleValue}"',
contain : '{name} cannot contain "{ruleValue}"',
containExactly : '{name} cannot contain exactly "{ruleValue}"',
doesntContain : '{name} must contain "{ruleValue}"',
doesntContainExactly : '{name} must contain exactly "{ruleValue}"',
minLength : '{name} must be at least {ruleValue} characters',
length : '{name} must be at least {ruleValue} characters',
exactLength : '{name} must be exactly {ruleValue} characters',
maxLength : '{name} cannot be longer than {ruleValue} characters',
match : '{name} must match {ruleValue} field',
different : '{name} must have a different value than {ruleValue} field',
creditCard : '{name} must be a valid credit card number',
minCount : '{name} must have at least {ruleValue} choices',
exactCount : '{name} must have exactly {ruleValue} choices',
maxCount : '{name} must have {ruleValue} or less choices'
},
selector : {

@@ -1285,2 +1378,28 @@ checkbox : 'input[type="checkbox"], input[type="radio"]',

},
// different than another field
different: function(value, identifier) {
// use either id or name of field
var
$form = $(this),
matchingValue
;
if( $('[data-validate="'+ identifier +'"]').length > 0 ) {
matchingValue = $('[data-validate="'+ identifier +'"]').val();
}
else if($('#' + identifier).length > 0) {
matchingValue = $('#' + identifier).val();
}
else if($('[name="' + identifier +'"]').length > 0) {
matchingValue = $('[name="' + identifier + '"]').val();
}
else if( $('[name="' + identifier +'[]"]').length > 0 ) {
matchingValue = $('[name="' + identifier +'[]"]');
}
return (matchingValue !== undefined)
? ( value.toString() !== matchingValue.toString() )
: false
;
},
creditCard: function(cardNumber, cardTypes) {

@@ -1390,25 +1509,10 @@ var

// different than another field
different: function(value, identifier) {
// use either id or name of field
var
$form = $(this),
matchingValue
;
if( $('[data-validate="'+ identifier +'"]').length > 0 ) {
matchingValue = $('[data-validate="'+ identifier +'"]').val();
minCount: function(value, minCount) {
if(minCount == 0) {
return true;
}
else if($('#' + identifier).length > 0) {
matchingValue = $('#' + identifier).val();
if(minCount == 1) {
return (value !== '');
}
else if($('[name="' + identifier +'"]').length > 0) {
matchingValue = $('[name="' + identifier + '"]').val();
}
else if( $('[name="' + identifier +'[]"]').length > 0 ) {
matchingValue = $('[name="' + identifier +'[]"]');
}
return (matchingValue !== undefined)
? ( value.toString() !== matchingValue.toString() )
: false
;
return (value.split(',').length >= minCount);
},

@@ -1426,12 +1530,2 @@

minCount: function(value, minCount) {
if(minCount == 0) {
return true;
}
if(minCount == 1) {
return (value !== '');
}
return (value.split(',').length >= minCount);
},
maxCount: function(value, maxCount) {

@@ -1438,0 +1532,0 @@ if(maxCount == 0) {

@@ -84,3 +84,3 @@ /*!

if(window.requestAnimationFrame === undefined) {
module.debug('RequestAnimationFrame not available, normailizing event');
module.debug('RequestAnimationFrame not available, normalizing event');
window.requestAnimationFrame = window.requestAnimationFrame

@@ -488,2 +488,2 @@ || window.mozRequestAnimationFrame

})( jQuery, window , document );
})( jQuery, window , document );

@@ -353,3 +353,3 @@ /*!

result = module.search.object(value, category.results, lookupFields)[0];
// dont continue searching if a result is found
// don't continue searching if a result is found
if(result) {

@@ -356,0 +356,0 @@ return false;

@@ -110,3 +110,3 @@ /*!

events: function() {
// if using $.tab dont add events
// if using $.tab don't add events
if( !$.isWindow( element ) ) {

@@ -899,2 +899,2 @@ module.debug('Attaching tab activation events to element', $module);

})( jQuery, window , document );
})( jQuery, window , document );

@@ -8,3 +8,3 @@ var

summary : 'Semantic UI - LESS Release of Semantic UI',
version : '2.1.3',
version : '2.1.4',
git : 'git://github.com/Semantic-Org/Semantic-UI-LESS.git',

@@ -11,0 +11,0 @@ });

{
"name": "semantic-ui-less",
"version": "2.1.3",
"version": "2.1.4",
"title": "Semantic UI",

@@ -5,0 +5,0 @@ "description": "LESS Only distribution of Semantic UI",

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

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

Sorry, the diff of this file is too big to display

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