diff --git a/definitions/behaviors/form.js b/definitions/behaviors/form.js
index 6fbb07e..747f095 100644
--- a/definitions/behaviors/form.js
+++ b/definitions/behaviors/form.js
@@ -91,6 +91,7 @@ $.fn.form = function(parameters) {
else {
if(instance !== undefined) {
instance.invoke('destroy');
+ module.refresh();
}
module.verbose('Initializing form validation', $module, settings);
module.bindEvents();
@@ -171,11 +172,9 @@ $.fn.form = function(parameters) {
}
$field.on('change click keyup keydown blur', function(e) {
- $(this).triggerHandler(e.type + ".dirty");
+ module.determine.isDirty();
});
- $field.on('change.dirty click.dirty keyup.dirty keydown.dirty blur.dirty', module.determine.isDirty);
-
$module.on('dirty' + eventNamespace, function(e) {
settings.onDirty.call();
});
@@ -302,10 +301,6 @@ $.fn.form = function(parameters) {
module.set.clean();
}
- if (e && e.namespace === 'dirty') {
- e.stopImmediatePropagation();
- e.preventDefault();
- }
}
},
@@ -313,13 +308,6 @@ $.fn.form = function(parameters) {
bracketedRule: function(rule) {
return (rule.type && rule.type.match(settings.regExp.bracket));
},
- shorthandFields: function(fields) {
- var
- fieldKeys = Object.keys(fields),
- firstRule = fields[fieldKeys[0]]
- ;
- return module.is.shorthandRules(firstRule);
- },
// duck type rule test
shorthandRules: function(rules) {
return (typeof rules == 'string' || Array.isArray(rules));
@@ -422,7 +410,7 @@ $.fn.form = function(parameters) {
;
if( key == keyCode.escape) {
module.verbose('Escape key pressed blurring field');
- $field
+ $field[0]
.blur()
;
}
@@ -444,15 +432,11 @@ $.fn.form = function(parameters) {
$fieldGroup = $field.closest($group),
validationRules = module.get.validation($field)
;
- if( $fieldGroup.hasClass(className.error) ) {
+ if(validationRules && (settings.on == 'blur' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
module.debug('Revalidating field', $field, validationRules);
- if(validationRules) {
- module.validate.field( validationRules );
- }
- }
- else if(settings.on == 'blur') {
- if(validationRules) {
- module.validate.field( validationRules );
+ module.validate.field( validationRules );
+ if(!settings.inline) {
+ module.validate.form(false,true);
}
}
},
@@ -465,7 +449,7 @@ $.fn.form = function(parameters) {
if(validationRules && (settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
clearTimeout(module.timer);
module.timer = setTimeout(function() {
- module.debug('Revalidating field', $field, module.get.validation($field));
+ module.debug('Revalidating field', $field, validationRules);
module.validate.field( validationRules );
if(!settings.inline) {
module.validate.form(false,true);
@@ -527,15 +511,19 @@ $.fn.form = function(parameters) {
fullFields = {}
;
$.each(fields, function(name, rules) {
- if(typeof rules == 'string') {
- rules = [rules];
+ if (!Array.isArray(rules) && typeof rules === 'object') {
+ fullFields[name] = rules;
+ } else {
+ if (typeof rules == 'string') {
+ rules = [rules];
+ }
+ fullFields[name] = {
+ rules: []
+ };
+ $.each(rules, function (index, rule) {
+ fullFields[name].rules.push({type: rule});
+ });
}
- fullFields[name] = {
- rules: []
- };
- $.each(rules, function(index, rule) {
- fullFields[name].rules.push({ type: rule });
- });
});
return fullFields;
},
@@ -551,8 +539,23 @@ $.fn.form = function(parameters) {
requiresValue = (prompt.search('{value}') !== -1),
requiresName = (prompt.search('{name}') !== -1),
$label,
- name
+ name,
+ parts,
+ suffixPrompt
;
+ if(ancillary && ancillary.indexOf('..') >= 0) {
+ parts = ancillary.split('..', 2);
+ if(!rule.prompt) {
+ suffixPrompt = (
+ parts[0] === '' ? settings.prompt.maxValue.replace(/\{ruleValue\}/g,'{max}') :
+ parts[1] === '' ? settings.prompt.minValue.replace(/\{ruleValue\}/g,'{min}') :
+ settings.prompt.range
+ );
+ prompt += suffixPrompt.replace(/\{name\}/g, ' ' + settings.text.and);
+ }
+ prompt = prompt.replace(/\{min\}/g, parts[0]);
+ prompt = prompt.replace(/\{max\}/g, parts[1]);
+ }
if(requiresValue) {
prompt = prompt.replace(/\{value\}/g, $field.val());
}
@@ -588,7 +591,7 @@ $.fn.form = function(parameters) {
}
else {
// 2.x
- if(parameters.fields && module.is.shorthandFields(parameters.fields)) {
+ if(parameters.fields) {
parameters.fields = module.get.fieldsFromShorthand(parameters.fields);
}
settings = $.extend(true, {}, $.fn.form.settings, parameters);
@@ -616,7 +619,7 @@ $.fn.form = function(parameters) {
instance = $module.data(moduleNamespace);
// refresh selector cache
- module.refresh();
+ (instance || module).refresh();
},
field: function(identifier) {
module.verbose('Finding field with identifier', identifier);
@@ -862,16 +865,7 @@ $.fn.form = function(parameters) {
module.debug('Adding rules', newValidation.rules, validation);
},
fields: function(fields) {
- var
- newValidation
- ;
- if(fields && module.is.shorthandFields(fields)) {
- newValidation = module.get.fieldsFromShorthand(fields);
- }
- else {
- newValidation = fields;
- }
- validation = $.extend({}, validation, newValidation);
+ validation = $.extend({}, validation, module.get.fieldsFromShorthand(fields));
},
prompt: function(identifier, errors, internal) {
var
@@ -1165,6 +1159,14 @@ $.fn.form = function(parameters) {
}
}
});
+ },
+ optional: function(identifier, bool) {
+ bool = (bool !== false);
+ $.each(validation, function(fieldName, field) {
+ if (identifier == fieldName || identifier == field.identifier) {
+ field.optional = bool;
+ }
+ });
}
},
@@ -1201,6 +1203,24 @@ $.fn.form = function(parameters) {
if(event && $module.data('moduleApi') !== undefined) {
event.stopImmediatePropagation();
}
+ if(settings.errorFocus) {
+ var focusElement, hasTabIndex = true;
+ if (typeof settings.errorFocus === 'string') {
+ focusElement = $(settings.errorFocus);
+ hasTabIndex = focusElement.is('[tabindex]');
+ // to be able to focus/scroll into non input elements we need a tabindex
+ if (!hasTabIndex) {
+ focusElement.attr('tabindex',-1);
+ }
+ } else {
+ focusElement = $group.filter('.' + className.error).first().find(selector.field);
+ }
+ focusElement.focus();
+ // only remove tabindex if it was dynamically created above
+ if (!hasTabIndex){
+ focusElement.removeAttr('tabindex');
+ }
+ }
if(ignoreCallbacks !== true) {
return settings.onFailure.call(element, formErrors, values);
}
@@ -1290,7 +1310,7 @@ $.fn.form = function(parameters) {
// cast to string avoiding encoding special values
value = (value === undefined || value === '' || value === null)
? ''
- : (settings.shouldTrim) ? String(value + '').trim() : String(value + '')
+ : (settings.shouldTrim && rule.shouldTrim !== false) || rule.shouldTrim ? String(value + '').trim() : String(value + '')
;
return ruleFunction.call(field, value, ancillary, $module);
}
@@ -1506,6 +1526,7 @@ $.fn.form.settings = {
autoCheckRequired : false,
preventLeaving : false,
+ errorFocus : false,
dateHandling : 'date', // 'date', 'input', 'formatter'
onValid : function() {},
@@ -1534,12 +1555,16 @@ $.fn.form.settings = {
},
text: {
+ and : 'and',
unspecifiedRule : 'Please enter a valid value',
unspecifiedField : 'This field',
leavingMessage : 'There are unsaved changes on this page which will be discarded if you continue.'
},
prompt: {
+ range : '{name} must be in a range from {min} to {max}',
+ maxValue : '{name} must have a maximum value of {ruleValue}',
+ minValue : '{name} must have a minimum value of {ruleValue}',
empty : '{name} must have a value',
checked : '{name} must be checked',
email : '{name} must be a valid e-mail',
@@ -1571,9 +1596,9 @@ $.fn.form.settings = {
selector : {
checkbox : 'input[type="checkbox"], input[type="radio"]',
clear : '.clear',
- field : 'input:not(.search), textarea, select',
+ field : 'input:not(.search):not([type="file"]), textarea, select',
group : '.field',
- input : 'input',
+ input : 'input:not([type="file"])',
message : '.error.message',
prompt : '.prompt.label',
radio : 'input[type="radio"]',
@@ -1702,11 +1727,24 @@ $.fn.form.settings = {
}
return value.match( new RegExp(regExp, flags) );
},
-
+ minValue: function(value, range) {
+ return $.fn.form.settings.rules.range(value, range+'..', 'number');
+ },
+ maxValue: function(value, range) {
+ return $.fn.form.settings.rules.range(value, '..'+range, 'number');
+ },
// is valid integer or matches range
integer: function(value, range) {
+ return $.fn.form.settings.rules.range(value, range, 'integer');
+ },
+ range: function(value, range, regExp) {
+ if(typeof regExp == "string") {
+ regExp = $.fn.form.settings.regExp[regExp];
+ }
+ if(!(regExp instanceof RegExp)) {
+ regExp = $.fn.form.settings.regExp.integer;
+ }
var
- intRegExp = $.fn.form.settings.regExp.integer,
min,
max,
parts
@@ -1715,34 +1753,34 @@ $.fn.form.settings = {
// do nothing
}
else if(range.indexOf('..') == -1) {
- if(intRegExp.test(range)) {
+ if(regExp.test(range)) {
min = max = range - 0;
}
}
else {
parts = range.split('..', 2);
- if(intRegExp.test(parts[0])) {
+ if(regExp.test(parts[0])) {
min = parts[0] - 0;
}
- if(intRegExp.test(parts[1])) {
+ if(regExp.test(parts[1])) {
max = parts[1] - 0;
}
}
return (
- intRegExp.test(value) &&
+ regExp.test(value) &&
(min === undefined || value >= min) &&
(max === undefined || value <= max)
);
},
// is valid number (with decimal)
- decimal: function(value) {
- return $.fn.form.settings.regExp.decimal.test(value);
+ decimal: function(value, range) {
+ return $.fn.form.settings.rules.range(value, range, 'decimal');
},
// is valid number
- number: function(value) {
- return $.fn.form.settings.regExp.number.test(value);
+ number: function(value, range) {
+ return $.fn.form.settings.rules.range(value, range, 'number');
},
// is value (case insensitive)
@@ -1947,8 +1985,8 @@ $.fn.form.settings = {
return;
}
- // allow dashes in card
- cardNumber = cardNumber.replace(/[\-]/g, '');
+ // allow dashes and spaces in card
+ cardNumber = cardNumber.replace(/[\s\-]/g, '');
// verify card types
if(requiredTypes) {
diff --git a/definitions/collections/form.less b/definitions/collections/form.less
index 3cde7f1..813c715 100644
--- a/definitions/collections/form.less
+++ b/definitions/collections/form.less
@@ -178,13 +178,13 @@
margin-top: @inputLineHeight + @checkboxSliderFieldTopMargin;
}
.ui.ui.form .field .fields .field:not(:only-child) .ui.checkbox {
- margin-top: @checkboxFieldTopMargin / 2;
+ margin-top: (@checkboxFieldTopMargin / 2);
}
.ui.ui.form .field .fields .field:not(:only-child) .ui.toggle.checkbox {
- margin-top: @checkboxToggleFieldTopMargin / 2;
+ margin-top: (@checkboxToggleFieldTopMargin / 2);
}
.ui.ui.form .field .fields .field:not(:only-child) .ui.slider.checkbox {
- margin-top: @checkboxSliderFieldTopMargin / 2;
+ margin-top: (@checkboxSliderFieldTopMargin / 2);
}
& when (@variationFormTransparent) {
@@ -377,6 +377,7 @@
}
.ui.form ::-moz-placeholder {
color: @inputPlaceholderColor;
+ opacity: 1;
}
.ui.form :focus::-webkit-input-placeholder {
@@ -468,6 +469,7 @@
@c: @formStates[@@state][color];
@bg: @formStates[@@state][background];
@bdc: @formStates[@@state][borderColor];
+ @lbg: @formStates[@@state][labelBackground];
/* On Form */
.ui.form.@{state} .@{state}.message:not(:empty) {
@@ -495,12 +497,19 @@
}
.ui.ui.form .fields.@{state} .field label,
+ .ui.ui.form .fields.@{state} .field .ui.label:not(.corner),
.ui.ui.form .field.@{state} label,
+ .ui.ui.form .field.@{state} .ui.label:not(.corner),
.ui.ui.form .fields.@{state} .field .input,
.ui.ui.form .field.@{state} .input {
color: @c;
}
+ .ui.form .fields.@{state} .field .ui.label,
+ .ui.form .field.@{state} .ui.label {
+ background-color: @lbg;
+ }
+
.ui.form .fields.@{state} .field .corner.label,
.ui.form .field.@{state} .corner.label {
border-color: @c;
@@ -614,7 +623,7 @@
.ui.form .fields.@{state} .field .ui.dropdown,
.ui.form .fields.@{state} .field .ui.dropdown .item,
.ui.form .field.@{state} .ui.dropdown,
- .ui.form .field.@{state} .ui.dropdown .text,
+ .ui.form .field.@{state} .ui.dropdown > .text,
.ui.form .field.@{state} .ui.dropdown .item {
background: @bg;
color: @c;
@@ -677,6 +686,13 @@
.ui.form .field.@{state} .checkbox .box:after {
color: @c;
}
+
+ & when (@variationFormInverted) {
+ .ui.inverted.form .fields.@{state} .field label,
+ .ui.inverted.form .@{state}.field label {
+ color: @lbg;
+ }
+ }
})
}
diff --git a/definitions/collections/grid.less b/definitions/collections/grid.less
index 1b5e252..70a6175 100644
--- a/definitions/collections/grid.less
+++ b/definitions/collections/grid.less
@@ -139,7 +139,7 @@
margin: (@rowSpacing / 2) (@gutterWidth / 2);
}
.ui.grid .column + .ui.vertical.divider {
- height: e(%("calc(50%% - %d)", @rowSpacing / 2));
+ height: e(%("calc(50%% - %d)", (@rowSpacing / 2)));
}
/* Remove Border on Last Horizontal Segment */
@@ -1659,7 +1659,7 @@ each(@colors, {
--------------------*/
@media only screen and (max-width: @largestMobileScreen) {
- .ui.stackable.grid {
+ .ui.ui.ui.ui.stackable.grid {
width: auto;
margin-left: 0 !important;
margin-right: 0 !important;
@@ -1868,6 +1868,10 @@ each(@colors, {
Compact
-----------------*/
+ .ui.ui.ui.compact.grid {
+ margin: -(@compactGutterWidth / 2);
+ }
+
.ui.ui.ui.compact.grid > .column:not(.row),
.ui.ui.ui.compact.grid > .row > .column {
padding-left: (@compactGutterWidth / 2);
@@ -1883,6 +1887,8 @@ each(@colors, {
.ui.ui.ui.compact.grid > .row {
padding-top: (@compactRowSpacing / 2);
padding-bottom: (@compactRowSpacing / 2);
+ padding-left: 0;
+ padding-right: 0;
}
/* Columns */
@@ -1906,6 +1912,10 @@ each(@colors, {
Very compact
-----------------*/
+ .ui.ui.ui[class*="very compact"].grid {
+ margin: -(@veryCompactGutterWidth / 2);
+ }
+
.ui.ui.ui[class*="very compact"].grid > .column:not(.row),
.ui.ui.ui[class*="very compact"].grid > .row > .column {
padding-left: (@veryCompactGutterWidth / 2);
@@ -1921,8 +1931,8 @@ each(@colors, {
.ui.ui.ui[class*="very compact"].grid > .row {
padding-top: (@veryCompactRowSpacing / 2);
padding-bottom: (@veryCompactRowSpacing / 2);
- padding-left: (@veryCompactGutterWidth * 1.5);
- padding-right: (@veryCompactGutterWidth * 1.5);
+ padding-left: 0;
+ padding-right: 0;
}
/* Columns */
diff --git a/definitions/collections/menu.less b/definitions/collections/menu.less
index 3d712ed..a60e32c 100644
--- a/definitions/collections/menu.less
+++ b/definitions/collections/menu.less
@@ -218,7 +218,9 @@
background: @dropdownBackground;
margin: @dropdownMenuDistance 0 0;
box-shadow: @dropdownMenuBoxShadow;
- flex-direction: column !important;
+}
+.ui.menu .dropdown.item:not(.column) .menu {
+ flex-direction: column;
}
diff --git a/definitions/collections/message.less b/definitions/collections/message.less
index e237277..9d0e7b9 100644
--- a/definitions/collections/message.less
+++ b/definitions/collections/message.less
@@ -107,8 +107,12 @@
/* Icon */
-.ui.message > i.icon {
+.ui.icon.message > .icons,
+.ui.icon.message > i.icon {
margin-right: @iconDistance;
+ &:last-child {
+ margin: 0 0 0 @iconDistance;
+ }
}
/* Close Icon */
@@ -169,6 +173,21 @@
/*******************************
Variations
*******************************/
+& when (@variationMessageCentered) {
+ .ui.centered.message,
+ .ui.center.aligned.message {
+ text-align: center;
+ justify-content: center;
+ & > .content {
+ flex: 0 0 auto;
+ }
+ }
+}
+& when (@variationMessageRightAligned) {
+ .ui.right.aligned.message {
+ text-align: right;
+ }
+}
& when (@variationMessageCompact) {
/*--------------
@@ -225,6 +244,7 @@
width: 100%;
align-items: center;
}
+ .ui.icon.message > .icons,
.ui.icon.message > i.icon:not(.close) {
display: block;
flex: 0 0 auto;
@@ -240,11 +260,11 @@
vertical-align: @iconVerticalAlign;
}
-
+ .ui.icon.message > .icons + .content,
.ui.icon.message > i.icon:not(.close) + .content {
padding-left: @iconContentDistance;
}
- .ui.icon.message > i.circular.icon {
+ .ui.icon.message > i.circular {
width: 1em;
}
}
@@ -276,6 +296,7 @@
boxShadow : @positiveBoxShadow;
boxFloatShadow : @positiveBoxFloatingShadow;
text : @positiveTextColor;
+ invertedText : @positiveBorderColor;
};
@negative: {
background : @negativeBackgroundColor;
@@ -283,6 +304,7 @@
boxShadow : @negativeBoxShadow;
boxFloatShadow : @negativeBoxFloatingShadow;
text : @negativeTextColor;
+ invertedText : @negativeBorderColor;
};
@info: {
background : @infoBackgroundColor;
@@ -290,6 +312,7 @@
boxShadow : @infoBoxShadow;
boxFloatShadow : @infoBoxFloatingShadow;
text : @infoTextColor;
+ invertedText : @formInfoLabelBackground;
};
@warning: {
background : @warningBackgroundColor;
@@ -297,6 +320,7 @@
boxShadow : @warningBoxShadow;
boxFloatShadow : @warningBoxFloatingShadow;
text : @warningTextColor;
+ invertedText : @formWarningLabelBackground;
};
@error: {
background : @errorBackgroundColor;
@@ -304,6 +328,7 @@
boxShadow : @errorBoxShadow;
boxFloatShadow : @errorBoxFloatingShadow;
text : @errorTextColor;
+ invertedText : @formErrorLabelBackground;
};
@success: {
background : @successBackgroundColor;
@@ -311,6 +336,7 @@
boxShadow : @successBoxShadow;
boxFloatShadow : @successBoxFloatingShadow;
text : @successTextColor;
+ invertedText : @formSuccessLabelBackground;
};
}
@@ -323,6 +349,7 @@
@bs: @consequences[@@color][boxShadow];
@bfs: @consequences[@@color][boxFloatShadow];
@t: @consequences[@@color][text];
+ @it: @consequences[@@color][invertedText];
.ui.@{color}.message {
background-color: @bg;
@@ -341,6 +368,12 @@
.ui.@{color}.message .header {
color: @hd;
}
+ & when (@variationMessageInverted) {
+ .ui.inverted.@{color}.message,
+ .ui.inverted.@{color}.message .header {
+ color: @it;
+ }
+ }
})
}
diff --git a/definitions/collections/table.less b/definitions/collections/table.less
index f185282..2eec75c 100644
--- a/definitions/collections/table.less
+++ b/definitions/collections/table.less
@@ -334,6 +334,10 @@
-moz-transform: scale(1);
}
+ .ui.definition.table > thead:not(.full-width) > tr > th:first-child:not(:empty) {
+ pointer-events: auto;
+ }
+
.ui.definition.table > tfoot:not(.full-width) > tr > th:first-child {
pointer-events: none;
background: @definitionFooterBackground;
@@ -1112,7 +1116,7 @@ each(@colors, {
.ui.inverted.definition.table > thead:not(.full-width) > tr > th:first-child {
background: @definitionPageBackground;
}
- .ui.inverted.definition.table > tbody > tr > td:first-child
+ .ui.inverted.definition.table > tbody > tr > td:first-child,
.ui.inverted.definition.table > tfoot > tr > td:first-child,
.ui.inverted.definition.table > tr > td:first-child {
background: @invertedDefinitionColumnBackground;
diff --git a/definitions/elements/button.less b/definitions/elements/button.less
index 3e648a5..c05b51d 100644
--- a/definitions/elements/button.less
+++ b/definitions/elements/button.less
@@ -635,6 +635,33 @@
Variations
*******************************/
+& when (@variationButtonStackable) {
+ /*--------------
+ Stackable
+ ---------------*/
+
+ /* Tablet Or Below */
+ @media only screen and (max-width: @largestMobileScreen) {
+
+ .ui.stackable.buttons {
+ flex-direction: column;
+ width: 100%;
+ & .button:first-child {
+ border-bottom-left-radius: 0;
+ border-top-right-radius: @borderRadius;
+ }
+ & .button:last-child {
+ border-bottom-left-radius: @borderRadius;
+ border-top-right-radius: 0;
+ }
+ & .button:only-child {
+ border-radius: @borderRadius;
+ }
+ }
+
+ }
+}
+
& when (@variationButtonFloated) {
/*-------------------
Floated
@@ -708,7 +735,7 @@
---------------*/
.ui.icon.buttons .button,
-.ui.icon.button:not(.animated):not(.compact) {
+.ui.icon.button:not(.animated):not(.compact):not(.labeled) {
padding: @verticalPadding @verticalPadding ( @verticalPadding + @shadowOffset );
}
.ui.animated.icon.button > .content > .icon,
diff --git a/definitions/elements/header.less b/definitions/elements/header.less
index 669f316..2d7b676 100644
--- a/definitions/elements/header.less
+++ b/definitions/elements/header.less
@@ -62,6 +62,7 @@
Icon
---------------*/
+.ui.header > .icons,
.ui.header > i.icon {
display: table-cell;
opacity: @iconOpacity;
@@ -71,7 +72,8 @@
}
/* With Text Node */
-.ui.header > i.icon:only-child {
+.ui.header:not(.icon) > .icons:only-child,
+.ui.header:not(.icon) > i.icon:only-child {
display: inline-block;
padding: 0;
margin-right: @iconMargin;
@@ -111,7 +113,8 @@
}
/* After Icon */
-.ui.header > i.icon + .content {
+.ui.header:not(.icon):not(.centered):not(.aligned) > .icons + .content,
+.ui.header:not(.icon):not(.centered):not(.aligned) > i.icon + .content {
padding-left: @iconMargin;
display: table-cell;
vertical-align: @contentIconAlignment;
@@ -220,6 +223,7 @@
.ui.icon.header:first-child {
margin-top: @iconHeaderFirstMargin;
}
+ .ui.icon.header > .icons,
.ui.icon.header > i.icon {
float: none;
display: block;
@@ -238,13 +242,14 @@
display: block;
padding: 0;
}
- .ui.icon.header > i.circular.icon {
+ .ui.icon.header > i.circular {
font-size: @circularHeaderIconSize;
}
- .ui.icon.header > i.square.icon {
+ .ui.icon.header > i.square {
font-size: @squareHeaderIconSize;
}
& when (@variationHeaderBlock) {
+ .ui.block.icon.header > .icons,
.ui.block.icon.header > i.icon {
margin-bottom: 0;
}
diff --git a/definitions/elements/icon.less b/definitions/elements/icon.less
index e97ae46..c8fcfd8 100644
--- a/definitions/elements/icon.less
+++ b/definitions/elements/icon.less
@@ -68,9 +68,11 @@ i.icon:before {
Loading
---------------*/
- i.icon.loading {
+ i.loading.icon {
height: 1em;
line-height: 1;
+ }
+ i.loading.icon, i.loading.icons {
animation: loader @loadingDuration linear infinite;
}
}
@@ -137,6 +139,9 @@ i.emphasized.icon:not(.disabled), i.emphasized.icons:not(.disabled) {
width: @circularSize !important;
height: @circularSize !important;
+ &.colored when (@variationIconColored){
+ box-shadow: @coloredBoxShadow;
+ }
}
& when (@variationIconInverted) {
i.circular.inverted.icon {
@@ -158,6 +163,16 @@ i.emphasized.icon:not(.disabled), i.emphasized.icons:not(.disabled) {
i.vertically.flipped.icon {
transform: scale(1, -1);
}
+
+ & when(@variationIconGroups) {
+ .icons i.flipped.icon:not(.corner):not(:first-child),
+ .icons i.horizontally.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(-1, 1);
+ }
+ .icons i.vertically.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(1, -1);
+ }
+ }
}
& when (@variationIconRotated) {
@@ -179,6 +194,21 @@ i.emphasized.icon:not(.disabled), i.emphasized.icons:not(.disabled) {
i.halfway.rotated.icon {
transform: rotate(180deg);
}
+
+ & when(@variationIconGroups) {
+ .icons i.rotated.rotated.icon:not(.corner):not(:first-child),
+ .icons i.right.rotated.icon:not(.corner):not(:first-child),
+ .icons i.clockwise.rotated.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) rotate(90deg);
+ }
+ .icons i.left.rotated.icon:not(.corner):not(:first-child),
+ .icons i.counterclockwise.rotated.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) rotate(-90deg);
+ }
+ .icons i.halfway.rotated.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) rotate(180deg);
+ }
+ }
}
& when (@variationIconFlipped) and (@variationIconRotated) {
@@ -215,6 +245,33 @@ i.emphasized.icon:not(.disabled), i.emphasized.icons:not(.disabled) {
i.halfway.rotated.vertically.flipped.icon {
transform: scale(1, -1) rotate(180deg);
}
+
+ & when(@variationIconGroups) {
+ .icons i.rotated.flipped.icon:not(.corner):not(:first-child),
+ .icons i.right.rotated.flipped.icon:not(.corner):not(:first-child),
+ .icons i.clockwise.rotated.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(-1, 1) rotate(90deg);
+ }
+ .icons i.left.rotated.flipped.icon:not(.corner):not(:first-child),
+ .icons i.counterclockwise.rotated.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(-1, 1) rotate(-90deg);
+ }
+ .icons i.halfway.rotated.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(-1, 1) rotate(180deg);
+ }
+ .icons i.rotated.vertically.flipped.icon:not(.corner):not(:first-child),
+ .icons i.right.rotated.vertically.flipped.icon:not(.corner):not(:first-child),
+ .icons i.clockwise.rotated.vertically.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(1, -1) rotate(90deg);
+ }
+ .icons i.left.rotated.vertically.flipped.icon:not(.corner):not(:first-child),
+ .icons i.counterclockwise.rotated.vertically.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(1, -1) rotate(-90deg);
+ }
+ .icons i.halfway.rotated.vertically.flipped.icon:not(.corner):not(:first-child) {
+ transform: translateX(-50%) translateY(-50%) scale(1, -1) rotate(180deg);
+ }
+ }
}
& when (@variationIconBordered) {
@@ -230,6 +287,9 @@ i.emphasized.icon:not(.disabled), i.emphasized.icons:not(.disabled) {
height: @borderedSize;
padding: @borderedVerticalPadding @borderedHorizontalPadding !important;
box-shadow: @borderedShadow;
+ &.colored when (@variationIconColored){
+ box-shadow: @coloredBoxShadow;
+ }
}
& when (@variationIconInverted) {
i.bordered.inverted.icon {
@@ -265,17 +325,21 @@ each(@colors, {
@c: @colors[@@color][color];
@l: @colors[@@color][light];
- i.@{color}.icon.icon.icon.icon {
+ i.@{color}.icon.icon.icon.icon.icon {
color: @c;
}
& when (@variationIconInverted) {
- i.inverted.@{color}.icon.icon.icon.icon {
+ i.inverted.@{color}.icon.icon.icon.icon.icon {
color: @l;
}
- i.inverted.bordered.@{color}.icon.icon.icon.icon,
- i.inverted.circular.@{color}.icon.icon.icon.icon {
- background-color: @c;
- color: @white;
+ & when (@variationIconBordered) or (@variationIconCircular) {
+ i.inverted.bordered.@{color}.icon.icon.icon.icon.icon,
+ i.inverted.circular.@{color}.icon.icon.icon.icon.icon,
+ i.inverted.bordered.@{color}.icons,
+ i.inverted.circular.@{color}.icons {
+ background-color: @c;
+ color: @white;
+ }
}
}
})
@@ -289,6 +353,7 @@ i.icon,
i.icons {
font-size: @medium;
line-height: @lineHeight;
+ font-style: normal;
}
& when not (@variationIconSizes = false) {
each(@variationIconSizes, {
@@ -316,8 +381,10 @@ i.icons {
position: absolute;
top: 50%;
left: 50%;
- transform: translateX(-50%) translateY(-50%);
margin: 0;
+ &:not(.corner):not(.rotated):not(.flipped) {
+ transform: translateX(-50%) translateY(-50%);
+ }
}
i.icons .icon:first-child {
@@ -325,6 +392,8 @@ i.icons {
width: auto;
height: auto;
vertical-align: top;
+ }
+ i.icons:not(.bordered):not(.circular) .icon:first-child:not(.rotated):not(.flipped) {
transform: none;
}
@@ -333,35 +402,37 @@ i.icons {
i.icons .corner.icon {
top: auto;
left: auto;
- right: 0;
- bottom: 0;
- transform: none;
+ right: @cornerOffset;
+ bottom: @cornerOffset;
font-size: @cornerIconSize;
text-shadow: @cornerIconShadow;
+ &:not(.rotated):not(.flipped) {
+ transform: none;
+ }
}
i.icons .icon.corner[class*="top right"] {
- top: 0;
+ top: @cornerOffset;
left: auto;
- right: 0;
+ right: @cornerOffset;
bottom: auto;
}
i.icons .icon.corner[class*="top left"] {
- top: 0;
- left: 0;
+ top: @cornerOffset;
+ left: @cornerOffset;
right: auto;
bottom: auto;
}
i.icons .icon.corner[class*="bottom left"] {
top: auto;
- left: 0;
+ left: @cornerOffset;
right: auto;
- bottom: 0;
+ bottom: @cornerOffset;
}
i.icons .icon.corner[class*="bottom right"] {
top: auto;
left: auto;
- right: 0;
- bottom: 0;
+ right: @cornerOffset;
+ bottom: @cornerOffset;
}
& when (@variationIconInverted) {
i.icons .inverted.corner.icon {
@@ -371,4 +442,74 @@ i.icons {
}
}
+& when ((@variationIconGroups) or (@variationIconCorner))
+ and ((@variationIconBordered) or (@variationIconCircular)) {
+ /*************************************************
+ Bordered/circular with corner or group icons
+ *************************************************/
+ i.bordered.icons,
+ i.circular.icons {
+ width: @borderedSize;
+ height: @borderedSize;
+ box-shadow: @borderedShadow;
+ vertical-align: middle;
+ &.colored when (@variationIconColored){
+ box-shadow: @coloredBoxShadow;
+ }
+ }
+ i.circular.icons {
+ border-radius: 500em;
+ }
+ i.bordered.icons i.icon:first-child,
+ i.circular.icons i.icon:first-child {
+ position: absolute;
+ transform: translateX(-50%) translateY(-50%);
+ }
+
+ & when (@variationIconInverted) {
+ /* Inverted Icon */
+ i.bordered.inverted.icons,
+ i.circular.inverted.icons {
+ border: none;
+ box-shadow: none;
+ background-color: @black;
+ color: @white;
+ }
+ }
+
+ & when (@variationIconCorner) {
+ /* Corner Icon */
+ i.bordered.icons .icon.corner,
+ i.circular.icons .icon.corner,
+ i.bordered.icons .icon.corner[class*="bottom right"],
+ i.circular.icons .icon.corner[class*="bottom right"] {
+ top: auto;
+ left: auto;
+ right: @borderedGroupCornerOffset;
+ bottom: @borderedGroupCornerOffset;
+ }
+ i.bordered.icons .icon.corner[class*="top right"],
+ i.circular.icons .icon.corner[class*="top right"] {
+ top: @borderedGroupCornerOffset;
+ left: auto;
+ right: @borderedGroupCornerOffset;
+ bottom: auto;
+ }
+ i.bordered.icons .icon.corner[class*="top left"],
+ i.circular.icons .icon.corner[class*="top left"] {
+ top: @borderedGroupCornerOffset;
+ left: @borderedGroupCornerOffset;
+ right: auto;
+ bottom: auto;
+ }
+ i.bordered.icons .icon.corner[class*="bottom left"],
+ i.circular.icons .icon.corner[class*="bottom left"] {
+ top: auto;
+ left: @borderedGroupCornerOffset;
+ right: auto;
+ bottom: @borderedGroupCornerOffset;
+ }
+ }
+}
+
.loadUIOverrides();
diff --git a/definitions/elements/input.less b/definitions/elements/input.less
index 7782ede..338aa96 100644
--- a/definitions/elements/input.less
+++ b/definitions/elements/input.less
@@ -67,6 +67,7 @@
}
.ui.input > input::-moz-placeholder {
color: @placeholderColor;
+ opacity: 1;
}
.ui.input > input:-ms-input-placeholder {
color: @placeholderColor;
diff --git a/definitions/elements/loader.less b/definitions/elements/loader.less
index 0b64a84..188bb1b 100644
--- a/definitions/elements/loader.less
+++ b/definitions/elements/loader.less
@@ -212,7 +212,7 @@ each(@colors, {
.ui.@{color}.elastic.loader.loader:before,
.ui.@{color}.basic.elastic.loading.button:before,
.ui.@{color}.basic.elastic.loading.button:after,
- .ui.@{color}.elastic.loading.loading.loading:not(.segment):before,
+ .ui.@{color}.elastic.loading.loading.loading:not(.segment):not(.segments):not(.card):before,
.ui.@{color}.elastic.loading.loading.loading .input > i.icon:before,
.ui.@{color}.elastic.loading.loading.loading.loading > i.icon:before,
.ui.@{color}.loading.loading.loading.loading:not(.usual):not(.button):after,
@@ -222,7 +222,7 @@ each(@colors, {
color: @c;
}
.ui.inverted.@{color}.elastic.loader:before,
- .ui.inverted.@{color}.elastic.loading.loading.loading:not(.segment):before,
+ .ui.inverted.@{color}.elastic.loading.loading.loading:not(.segment):not(.segments):not(.card):before,
.ui.inverted.@{color}.elastic.loading.loading.loading .input > i.icon:before,
.ui.inverted.@{color}.elastic.loading.loading.loading > i.icon:before,
.ui.inverted.@{color}.loading.loading.loading.loading:not(.usual):after,
@@ -295,11 +295,15 @@ each(@colors, {
.ui.loader.loader.loader.loader.loader.loader:not(.double):after {
border-bottom-color: transparent;
}
+.ui.loading.loading.loading.loading.loading.loading.card:after,
+.ui.loading.loading.loading.loading.loading.loading.segments:after,
.ui.loading.loading.loading.loading.loading.loading.segment:after,
.ui.loading.loading.loading.loading.loading.loading.form:after {
border-left-color:@loaderFillColor;
border-right-color:@loaderFillColor;
}
+.ui.loading.loading.loading.loading.loading.loading.card:not(.double):after,
+.ui.loading.loading.loading.loading.loading.loading.segments:not(.double):after,
.ui.loading.loading.loading.loading.loading.loading.segment:not(.double):after,
.ui.loading.loading.loading.loading.loading.loading.form:not(.double):after {
border-bottom-color: @loaderFillColor;
@@ -316,14 +320,14 @@ each(@colors, {
.ui.inverted.dimmer > .ui.elastic.loader {
color: @loaderLineColor;
}
- .ui.elastic.loading.loading:not(.form):not(.segment):after,
+ .ui.elastic.loading.loading:not(.form):not(.segment):not(.segments):not(.card):after,
.ui.elastic.loading.loading .input > i.icon:after,
.ui.elastic.loading.loading > i.icon:after,
.ui.elastic.loader.loader:after {
animation: loader 1s infinite cubic-bezier(.27, 1.05, .92, .61);
animation-delay: 0.3s;
}
- .ui.elastic.loading.loading.loading:not(.form):not(.segment):before,
+ .ui.elastic.loading.loading.loading:not(.form):not(.segment):not(.segments):not(.card):before,
.ui.elastic.loading.loading.loading .input > i.icon:before,
.ui.elastic.loading.loading.loading > i.icon:before,
.ui.elastic.loader.loader:before {
@@ -337,27 +341,27 @@ each(@colors, {
}
}
& when (@variationLoaderSpeeds) {
- .ui.slow.elastic.loading.loading:not(.form):not(.segment):after,
+ .ui.slow.elastic.loading.loading:not(.form):not(.segment):not(.segments):not(.card):after,
.ui.slow.elastic.loading.loading .input > i.icon:after,
.ui.slow.elastic.loading.loading > i.icon:after,
.ui.slow.elastic.loader.loader:after {
animation-duration: 1.5s;
animation-delay: 0.45s;
}
- .ui.slow.elastic.loading.loading.loading:not(.form):not(.segment):before,
+ .ui.slow.elastic.loading.loading.loading:not(.form):not(.segment):not(.segments):not(.card):before,
.ui.slow.elastic.loading.loading.loading .input > i.icon:before,
.ui.slow.elastic.loading.loading.loading > i.icon:before,
.ui.slow.elastic.loader.loader:before {
animation-duration: 1.5s;
}
- .ui.fast.elastic.loading.loading:not(.form):not(.segment):after,
+ .ui.fast.elastic.loading.loading:not(.form):not(.segment):not(.segments):not(.card):after,
.ui.fast.elastic.loading.loading .input > i.icon:after,
.ui.fast.elastic.loading.loading > i.icon:after,
.ui.fast.elastic.loader.loader:after {
animation-duration: 0.66s;
animation-delay: 0.20s;
}
- .ui.fast.elastic.loading.loading.loading:not(.form):not(.segment):before,
+ .ui.fast.elastic.loading.loading.loading:not(.form):not(.segment):not(.segments):not(.card):before,
.ui.fast.elastic.loading.loading.loading .input > i.icon:before,
.ui.fast.elastic.loading.loading.loading > i.icon:before,
.ui.fast.elastic.loader.loader:before {
diff --git a/definitions/elements/segment.less b/definitions/elements/segment.less
index ec5e19b..cee5c73 100644
--- a/definitions/elements/segment.less
+++ b/definitions/elements/segment.less
@@ -62,6 +62,8 @@
--------------------*/
& when (@variationSegmentInverted) {
/* Header */
+ .ui.inverted.segments .segment > .ui.header .sub.header,
+ .ui.inverted.segments .segment > .ui.header,
.ui.inverted.segment > .ui.header .sub.header,
.ui.inverted.segment > .ui.header {
color: @white;
@@ -137,6 +139,12 @@
background: @placeholderBackground;
border-color: @placeholderBorderColor;
box-shadow: @placeholderBoxShadow;
+ &.tab {
+ display: none;
+ &.active {
+ display: flex;
+ }
+ }
}
.ui.placeholder.segment .button,
@@ -475,6 +483,10 @@
.ui.horizontal.segments > .segment:last-child {
border-radius: 0 @borderRadius @borderRadius 0;
}
+ /* Equal Width */
+ .ui[class*="equal width"].horizontal.segments > .segment {
+ width: 100%;
+ }
}
}
@@ -488,9 +500,12 @@
Disabled
---------------*/
+ .ui.disabled.segments,
.ui.disabled.segment {
opacity: @disabledOpacity;
color: @disabledTextColor;
+ pointer-events: none;
+ user-select: none;
}
}
@@ -499,13 +514,15 @@
Loading
---------------*/
+ .ui.loading.segments,
.ui.loading.segment {
position: relative;
cursor: default;
pointer-events: none;
- text-shadow: none !important;
+ user-select: none;
transition: all 0s linear;
}
+ .ui.loading.segments:before,
.ui.loading.segment:before {
position: absolute;
content: '';
@@ -517,6 +534,7 @@
border-radius: @borderRadius;
z-index: @loaderDimmerZIndex;
}
+ .ui.loading.segments:after,
.ui.loading.segment:after {
position: absolute;
content: '';
@@ -626,11 +644,13 @@ each(@colors,{
/*-------------------
Inverted
--------------------*/
-
+ .ui.inverted.segments,
+ .ui.inverted.segments .segment,
.ui.inverted.segment {
border: none;
box-shadow: none;
}
+ .ui.inverted.segments .segment,
.ui.inverted.segment,
.ui.primary.inverted.segment {
background: @invertedBackground;
@@ -652,9 +672,11 @@ each(@colors,{
}
& when (@variationSegmentLoading) {
/* Loading */
+ .ui.inverted.loading.segments,
.ui.inverted.loading.segment {
color: @invertedLoaderLineColor;
}
+ .ui.inverted.loading.segments:before,
.ui.inverted.loading.segment:before {
background: @loaderInvertedDimmerColor;
}
diff --git a/definitions/modules/calendar.js b/definitions/modules/calendar.js
index 1757f32..7fe8aff 100644
--- a/definitions/modules/calendar.js
+++ b/definitions/modules/calendar.js
@@ -377,6 +377,7 @@ $.fn.calendar = function(parameters) {
cell.data(metadata.date, cellDate);
var adjacent = isDay && cellDate.getMonth() !== ((month + 12) % 12);
var disabled = (!settings.selectAdjacentDays && adjacent) || !module.helper.isDateInRange(cellDate, mode) || settings.isDisabled(cellDate, mode) || module.helper.isDisabled(cellDate, mode) || !module.helper.isEnabled(cellDate, mode);
+ var eventDate;
if (disabled) {
var disabledDate = module.helper.findDayAsObject(cellDate, mode, settings.disabledDates);
if (disabledDate !== null && disabledDate[metadata.message]) {
@@ -390,7 +391,7 @@ $.fn.calendar = function(parameters) {
}
}
} else {
- var eventDate = module.helper.findDayAsObject(cellDate, mode, settings.eventDates);
+ eventDate = module.helper.findDayAsObject(cellDate, mode, settings.eventDates);
if (eventDate !== null) {
cell.addClass(eventDate[metadata.class] || settings.eventClass);
if (eventDate[metadata.message]) {
@@ -407,9 +408,9 @@ $.fn.calendar = function(parameters) {
}
var active = module.helper.dateEqual(cellDate, date, mode);
var isToday = module.helper.dateEqual(cellDate, today, mode);
- cell.toggleClass(className.adjacentCell, adjacent);
+ cell.toggleClass(className.adjacentCell, adjacent && !eventDate);
cell.toggleClass(className.disabledCell, disabled);
- cell.toggleClass(className.activeCell, active && !adjacent);
+ cell.toggleClass(className.activeCell, active && !(adjacent && disabled));
if (!isHour && !isMinute) {
cell.toggleClass(className.todayCell, !adjacent && isToday);
}
@@ -971,7 +972,7 @@ $.fn.calendar = function(parameters) {
helper: {
isDisabled: function(date, mode) {
- return (mode === 'day' || mode === 'month' || mode === 'year') && ((settings.disabledDaysOfWeek.indexOf(date.getDay()) !== -1) || settings.disabledDates.some(function(d){
+ return (mode === 'day' || mode === 'month' || mode === 'year') && ((mode === 'day' && settings.disabledDaysOfWeek.indexOf(date.getDay()) !== -1) || settings.disabledDates.some(function(d){
if(typeof d === 'string') {
d = module.helper.sanitiseDate(d);
}
@@ -1073,14 +1074,11 @@ $.fn.calendar = function(parameters) {
return null;
},
sanitiseDate: function (date) {
- if (!date) {
- return undefined;
- }
if (!(date instanceof Date)) {
date = parser.date('' + date, settings);
}
- if (!date || date === null || isNaN(date.getTime())) {
- return undefined;
+ if (!date || isNaN(date.getTime())) {
+ return null;
}
return date;
},
@@ -1467,11 +1465,11 @@ $.fn.calendar.settings = {
if (text.length === 0) {
return null;
}
- if(text.match(/^[0-9]{4}[\/\-\.][0-9]{2}[\/\-\.][0-9]{2}$/)){
+ if(text.match(/^[0-9]{4}[\/\-\.][0-9]{1,2}[\/\-\.][0-9]{1,2}$/)){
text = text.replace(/[\/\-\.]/g,'/') + ' 00:00:00';
}
// Reverse date and month in some cases
- text = settings.monthFirst || !text.match(/^[0-9]{2}[\/\-\.]/) ? text : text.replace(/[\/\-\.]/g,'/').replace(/([0-9]+)\/([0-9]+)/,'$2/$1');
+ text = settings.monthFirst || !text.match(/^[0-9]{1,2}[\/\-\.]/) ? text : text.replace(/[\/\-\.]/g,'/').replace(/([0-9]+)\/([0-9]+)/,'$2/$1');
var textDate = new Date(text);
var numberOnly = text.match(/^[0-9]+$/) !== null;
if(!numberOnly && !isNaN(textDate.getDate())) {
diff --git a/definitions/modules/calendar.less b/definitions/modules/calendar.less
index aaa7f11..5866880 100644
--- a/definitions/modules/calendar.less
+++ b/definitions/modules/calendar.less
@@ -127,7 +127,7 @@
color: @disabledTextColor;
}
-.ui.calendar .ui.table tr .adjacent:not(.disabled) {
+.ui.calendar .ui.table tr .adjacent:not(.disabled):not(.active) {
color: @adjacentTextColor;
background: @adjacentBackground;
}
@@ -166,7 +166,7 @@
color: @invertedDisabledTextColor;
}
- .ui.inverted.calendar .ui.inverted.table tr .adjacent:not(.disabled) {
+ .ui.inverted.calendar .ui.inverted.table tr .adjacent:not(.disabled):not(.active) {
color: @adjacentInvertedTextColor;
background: @adjacentInvertedBackground;
}
diff --git a/definitions/modules/checkbox.less b/definitions/modules/checkbox.less
index 32974de..43a5376 100644
--- a/definitions/modules/checkbox.less
+++ b/definitions/modules/checkbox.less
@@ -217,7 +217,17 @@
color: @checkboxColor;
transition: @checkboxTransition;
}
-
+& when (@variationCheckboxRightAligned) {
+ .ui.right.aligned.checkbox label {
+ padding-left: 0;
+ padding-right: @labelDistance;
+ &:after,
+ &:before {
+ right: 0;
+ left: auto;
+ }
+ }
+}
/*--------------
Label
---------------*/
@@ -317,6 +327,12 @@
left: @toggleCenterOffset;
}
}
+ & when (@variationCheckboxRightAligned) {
+ .ui.right.aligned.indeterminate.toggle.checkbox input:not([type=radio]) ~ label:after {
+ left: auto;
+ right: @toggleCenterOffset;
+ }
+ }
}
/*--------------
@@ -333,14 +349,16 @@
color: @checkboxActiveFocusCheckColor;
}
+& when (@variationCheckboxReadonly) {
+ /*--------------
+ Read-Only
+ ---------------*/
-/*--------------
- Read-Only
----------------*/
-
-.ui.read-only.checkbox,
-.ui.read-only.checkbox label {
- cursor: default;
+ .ui.read-only.checkbox,
+ .ui.read-only.checkbox label {
+ cursor: default;
+ pointer-events: none;
+ }
}
& when (@variationCheckboxDisabled) {
@@ -350,7 +368,7 @@
.ui.disabled.checkbox label,
.ui.checkbox input[disabled] ~ label {
- cursor: default !important;
+ cursor: default;
opacity: @disabledCheckboxOpacity;
color: @disabledCheckboxLabelColor;
pointer-events: none;
@@ -542,6 +560,22 @@
.ui.slider.checkbox input:focus:checked ~ label:before {
background-color: @sliderOnFocusLineColor !important;
}
+
+ & when (@variationCheckboxRightAligned) {
+ .ui.right.aligned.slider.checkbox label {
+ padding-left: 0;
+ padding-right: @sliderLabelDistance;
+ }
+ .ui.right.aligned.slider.checkbox label:after {
+ left: auto;
+ right: @sliderTravelDistance;
+ transition: @sliderHandleTransitionRightAligned;
+ }
+ .ui.right.aligned.slider.checkbox input:checked ~ label:after {
+ left: auto;
+ right: 0;
+ }
+ }
}
& when (@variationCheckboxToggle) {
@@ -643,6 +677,22 @@
.ui.toggle.checkbox input:focus:checked ~ label:before {
background-color: @toggleOnFocusLaneColor !important;
}
+
+ & when (@variationCheckboxRightAligned) {
+ .ui.right.aligned.toggle.checkbox label {
+ padding-left: 0;
+ padding-right: @toggleLabelDistance;
+ }
+ .ui.right.aligned.toggle.checkbox input ~ label:after {
+ left: auto;
+ right: @toggleOnOffset;
+ transition: @toggleHandleTransitionRightAligned;
+ }
+ .ui.right.aligned.toggle.checkbox input:checked ~ label:after {
+ left: auto;
+ right: @toggleOffOffset;
+ }
+ }
}
/*******************************
diff --git a/definitions/modules/dimmer.js b/definitions/modules/dimmer.js
index 9429a9e..f3678b5 100644
--- a/definitions/modules/dimmer.js
+++ b/definitions/modules/dimmer.js
@@ -155,7 +155,7 @@ $.fn.dimmer = function(parameters) {
event: {
click: function(event) {
- module.verbose('Determining if event occured on dimmer', event);
+ module.verbose('Determining if event occurred on dimmer', event);
if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {
module.hide();
event.stopImmediatePropagation();
@@ -255,7 +255,7 @@ $.fn.dimmer = function(parameters) {
displayType : settings.useFlex
? 'flex'
: 'block',
- animation : settings.transition + ' in',
+ animation : (settings.transition.showMethod || settings.transition) + ' in',
queue : false,
duration : module.get.duration(),
useFailSafe : true,
@@ -302,7 +302,7 @@ $.fn.dimmer = function(parameters) {
displayType : settings.useFlex
? 'flex'
: 'block',
- animation : settings.transition + ' out',
+ animation : (settings.transition.hideMethod || settings.transition) + ' out',
queue : false,
duration : module.get.duration(),
useFailSafe : true,
@@ -335,15 +335,12 @@ $.fn.dimmer = function(parameters) {
return $dimmer;
},
duration: function() {
- if(typeof settings.duration == 'object') {
- if( module.is.active() ) {
- return settings.duration.hide;
- }
- else {
- return settings.duration.show;
- }
+ if( module.is.active() ) {
+ return settings.transition.hideDuration || settings.duration.hide || settings.duration;
+ }
+ else {
+ return settings.transition.showDuration || settings.duration.show || settings.duration;
}
- return settings.duration;
}
},
diff --git a/definitions/modules/dropdown.js b/definitions/modules/dropdown.js
index 9edd33d..c307885 100644
--- a/definitions/modules/dropdown.js
+++ b/definitions/modules/dropdown.js
@@ -87,6 +87,7 @@ $.fn.dropdown = function(parameters) {
internalChange = false,
iconClicked = false,
element = this,
+ focused = false,
instance = $module.data(moduleNamespace),
selectActionActive,
@@ -296,7 +297,9 @@ $.fn.dropdown = function(parameters) {
: module.get.query()
;
module.verbose('Searching for query', query);
- if(module.has.minCharacters(query)) {
+ if(settings.fireOnInit === false && module.is.initialLoad()) {
+ module.verbose('Skipping callback on initial load', settings.onSearch);
+ } else if(module.has.minCharacters(query) && settings.onSearch.call(element, query) !== false) {
module.filter(query);
}
else {
@@ -358,7 +361,7 @@ $.fn.dropdown = function(parameters) {
if( !module.has.menu() ) {
module.create.menu();
}
- if ( module.is.selection() && module.is.clearable() && !module.has.clearItem() ) {
+ if ( module.is.clearable() && !module.has.clearItem() ) {
module.verbose('Adding clear icon');
$clear = $('')
.addClass('remove icon')
@@ -369,7 +372,7 @@ $.fn.dropdown = function(parameters) {
module.verbose('Adding search input');
$search = $('')
.addClass(className.search)
- .prop('autocomplete', 'off')
+ .prop('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
.insertBefore($text)
;
}
@@ -497,6 +500,11 @@ $.fn.dropdown = function(parameters) {
;
},
+ clearItems: function() {
+ $menu.empty();
+ module.refreshItems();
+ },
+
toggle: function() {
module.verbose('Toggling menu visibility');
if( !module.is.active() ) {
@@ -512,9 +520,12 @@ $.fn.dropdown = function(parameters) {
? callback
: function(){}
;
+ if ((focused || iconClicked) && module.is.remote() && module.is.noApiCache()) {
+ module.clearItems();
+ }
if(!module.can.show() && module.is.remote()) {
module.debug('No API results retrieved, searching before show');
- module.queryRemote(module.get.query(), module.show);
+ module.queryRemote(module.get.query(), module.show, [callback, preventFocus]);
}
if( module.can.show() && !module.is.active() ) {
module.debug('Showing dropdown');
@@ -560,6 +571,7 @@ $.fn.dropdown = function(parameters) {
module.unbind.intent();
}
iconClicked = false;
+ focused = false;
},
hideOthers: function() {
@@ -638,6 +650,7 @@ $.fn.dropdown = function(parameters) {
if(module.is.multiple()) {
$module
.on(clickEvent + eventNamespace, module.event.click)
+ .on(clickEvent + eventNamespace, module.event.search.focus)
;
}
}
@@ -767,11 +780,14 @@ $.fn.dropdown = function(parameters) {
if(!Array.isArray(preSelected)) {
preSelected = preSelected && preSelected!=="" ? preSelected.split(settings.delimiter) : [];
}
- $.each(preSelected,function(index,value){
- $item.filter('[data-value="'+value+'"]')
- .addClass(className.filtered)
- ;
- });
+ if (module.is.multiple()) {
+ $.each(preSelected,function(index,value){
+ $item.filter('[data-value="'+value+'"]')
+ .addClass(className.filtered)
+ ;
+ });
+ }
+ module.focusSearch(true);
afterFiltered();
});
}
@@ -785,7 +801,10 @@ $.fn.dropdown = function(parameters) {
}
},
- queryRemote: function(query, callback) {
+ queryRemote: function(query, callback, callbackParameters) {
+ if(!Array.isArray(callbackParameters)){
+ callbackParameters = [callbackParameters];
+ }
var
apiSettings = {
errorDuration : false,
@@ -796,11 +815,15 @@ $.fn.dropdown = function(parameters) {
},
onError: function() {
module.add.message(message.serverError);
- callback();
+ iconClicked = false;
+ focused = false;
+ callback.apply(null, callbackParameters);
},
onFailure: function() {
module.add.message(message.serverError);
- callback();
+ iconClicked = false;
+ focused = false;
+ callback.apply(null, callbackParameters);
},
onSuccess : function(response) {
var
@@ -817,7 +840,16 @@ $.fn.dropdown = function(parameters) {
if(values.length===0 && !settings.allowAdditions) {
module.add.message(message.noResults);
}
- callback();
+ else {
+ var value = module.is.multiple() ? module.get.values() : module.get.value();
+ if (value !== '') {
+ module.verbose('Value(s) present after click icon, select value(s) in items');
+ module.set.selected(value, null, null, true);
+ }
+ }
+ iconClicked = false;
+ focused = false;
+ callback.apply(null, callbackParameters);
}
}
;
@@ -1049,6 +1081,7 @@ $.fn.dropdown = function(parameters) {
},
focus: function() {
if(settings.showOnFocus && !activated && module.is.hidden() && !pageLostFocus) {
+ focused = true;
module.show();
}
},
@@ -1098,7 +1131,8 @@ $.fn.dropdown = function(parameters) {
if(module.is.multiple()) {
module.remove.activeLabel();
}
- if(settings.showOnFocus || (event.type !== 'focus' && event.type !== 'focusin')) {
+ if(!focused && !module.is.active() && (settings.showOnFocus || (event.type !== 'focus' && event.type !== 'focusin'))) {
+ focused = true;
module.search();
}
},
@@ -1143,6 +1177,7 @@ $.fn.dropdown = function(parameters) {
} else {
module.toggle();
}
+ event.stopPropagation();
}
},
text: {
@@ -1182,10 +1217,11 @@ $.fn.dropdown = function(parameters) {
$label.addClass(className.active);
}
settings.onLabelSelect.apply(this, $labels.filter('.' + className.active));
+ event.stopPropagation();
}
},
remove: {
- click: function() {
+ click: function(event) {
var
$label = $(this).parent()
;
@@ -1197,6 +1233,7 @@ $.fn.dropdown = function(parameters) {
// remove this label only
module.remove.activeLabels( $label );
}
+ event.stopPropagation();
}
},
test: {
@@ -1209,6 +1246,9 @@ $.fn.dropdown = function(parameters) {
if(module.is.bubbledLabelClick(event) || module.is.bubbledIconClick(event)) {
return;
}
+ if (!module.is.multiple() || (module.is.multiple() && !module.is.active())) {
+ focused = true;
+ }
if( module.determine.eventOnElement(event, toggleBehavior) ) {
event.preventDefault();
}
@@ -1829,7 +1869,7 @@ $.fn.dropdown = function(parameters) {
return count;
},
transition: function($subMenu) {
- return (settings.transition == 'auto')
+ return (settings.transition === 'auto')
? module.is.upward($subMenu)
? 'slide up'
: 'slide down'
@@ -1892,7 +1932,7 @@ $.fn.dropdown = function(parameters) {
: value
;
},
- values: function() {
+ values: function(raw) {
var
value = module.get.value()
;
@@ -1901,7 +1941,7 @@ $.fn.dropdown = function(parameters) {
}
return ( !module.has.selectInput() && module.is.multiple() )
? (typeof value == 'string') // delimited string
- ? module.escape.htmlEntities(value).split(settings.delimiter)
+ ? (raw ? value : module.escape.htmlEntities(value)).split(settings.delimiter)
: ''
: value
;
@@ -1945,8 +1985,8 @@ $.fn.dropdown = function(parameters) {
return ($choice.data(metadata.text) !== undefined)
? $choice.data(metadata.text)
: (preserveHTML)
- ? $choice.html().trim()
- : $choice.text().trim()
+ ? $choice.html() && $choice.html().trim()
+ : $choice.text() && $choice.text().trim()
;
}
},
@@ -2136,6 +2176,9 @@ $.fn.dropdown = function(parameters) {
;
}
return $selectedItem;
+ },
+ displayType: function() {
+ return $module.hasClass('column') ? 'flex' : settings.displayType;
}
},
@@ -2327,7 +2370,7 @@ $.fn.dropdown = function(parameters) {
clear: function(preventChangeTrigger) {
if(module.is.multiple() && settings.useLabels) {
- module.remove.labels();
+ module.remove.labels($module.find(selector.label), preventChangeTrigger);
}
else {
module.remove.activeItem();
@@ -2690,7 +2733,7 @@ $.fn.dropdown = function(parameters) {
module.clear();
module.set.selected(value, $selectedItem);
},
- selected: function(value, $selectedItem) {
+ selected: function(value, $selectedItem, preventChangeTrigger, keepSearchTerm) {
var
isMultiple = module.is.multiple()
;
@@ -2752,8 +2795,10 @@ $.fn.dropdown = function(parameters) {
if(settings.apiSettings && settings.saveRemoteData) {
module.save.remoteData(selectedText, selectedValue);
}
- module.set.text(selectedText);
- module.set.value(selectedValue, selectedText, $selected);
+ if (!keepSearchTerm) {
+ module.set.text(selectedText);
+ }
+ module.set.value(selectedValue, selectedText, $selected, preventChangeTrigger);
$selected
.addClass(className.active)
.addClass(className.selected)
@@ -2761,7 +2806,9 @@ $.fn.dropdown = function(parameters) {
}
})
;
- module.remove.searchTerm();
+ if (!keepSearchTerm) {
+ module.remove.searchTerm();
+ }
}
},
@@ -2925,7 +2972,7 @@ $.fn.dropdown = function(parameters) {
},
value: function(addedValue, addedText, $selectedItem) {
var
- currentValue = module.get.values(),
+ currentValue = module.get.values(true),
newValue
;
if(module.has.value(addedValue)) {
@@ -3049,7 +3096,7 @@ $.fn.dropdown = function(parameters) {
userAddition: function() {
$item.filter(selector.addition).remove();
},
- selected: function(value, $selectedItem) {
+ selected: function(value, $selectedItem, preventChangeTrigger) {
$selectedItem = (settings.allowAdditions)
? $selectedItem || module.get.itemWithAdditions(value)
: $selectedItem || module.get.item(value)
@@ -3068,11 +3115,11 @@ $.fn.dropdown = function(parameters) {
;
if(module.is.multiple()) {
if(settings.useLabels) {
- module.remove.value(selectedValue, selectedText, $selected);
+ module.remove.value(selectedValue, selectedText, $selected, preventChangeTrigger);
module.remove.label(selectedValue);
}
else {
- module.remove.value(selectedValue, selectedText, $selected);
+ module.remove.value(selectedValue, selectedText, $selected, preventChangeTrigger);
if(module.get.selectionCount() === 0) {
module.set.placeholderText();
}
@@ -3082,7 +3129,7 @@ $.fn.dropdown = function(parameters) {
}
}
else {
- module.remove.value(selectedValue, selectedText, $selected);
+ module.remove.value(selectedValue, selectedText, $selected, preventChangeTrigger);
}
$selected
.removeClass(className.filtered)
@@ -3097,7 +3144,7 @@ $.fn.dropdown = function(parameters) {
selectedItem: function() {
$item.removeClass(className.selected);
},
- value: function(removedValue, removedText, $removedItem) {
+ value: function(removedValue, removedText, $removedItem, preventChangeTrigger) {
var
values = module.get.values(),
newValue
@@ -3119,7 +3166,7 @@ $.fn.dropdown = function(parameters) {
else {
settings.onRemove.call(element, removedValue, removedText, $removedItem);
}
- module.set.value(newValue, removedText, $removedItem);
+ module.set.value(newValue, removedText, $removedItem, preventChangeTrigger);
module.check.maxSelections();
},
arrayValue: function(removedValue, values) {
@@ -3134,8 +3181,9 @@ $.fn.dropdown = function(parameters) {
},
label: function(value, shouldAnimate) {
var
+ escapedValue = module.escape.value(value),
$labels = $module.find(selector.label),
- $removedLabel = $labels.filter('[data-' + metadata.value + '="' + module.escape.string(settings.ignoreCase ? value.toLowerCase() : value) +'"]')
+ $removedLabel = $labels.filter('[data-' + metadata.value + '="' + module.escape.string(settings.ignoreCase ? escapedValue.toLowerCase() : escapedValue) +'"]')
;
module.verbose('Removing label', $removedLabel);
$removedLabel.remove();
@@ -3145,7 +3193,7 @@ $.fn.dropdown = function(parameters) {
module.verbose('Removing active label selections', $activeLabels);
module.remove.labels($activeLabels);
},
- labels: function($labels) {
+ labels: function($labels, preventChangeTrigger) {
$labels = $labels || $module.find(selector.label);
module.verbose('Removing labels', $labels);
$labels
@@ -3164,12 +3212,12 @@ $.fn.dropdown = function(parameters) {
}
module.remove.message();
if(isUserValue) {
- module.remove.value(stringValue);
+ module.remove.value(stringValue, stringValue, module.get.item(stringValue), preventChangeTrigger);
module.remove.label(stringValue);
}
else {
// selected will also remove label
- module.remove.selected(stringValue);
+ module.remove.selected(stringValue, false, preventChangeTrigger);
}
})
;
@@ -3248,6 +3296,9 @@ $.fn.dropdown = function(parameters) {
menu: function() {
return ($menu.length > 0);
},
+ subMenu: function($currentMenu) {
+ return ($currentMenu || $menu).find(selector.menu).length > 0;
+ },
message: function() {
return ($menu.children(selector.message).length !== 0);
},
@@ -3284,7 +3335,7 @@ $.fn.dropdown = function(parameters) {
},
valueMatchingCase: function(value) {
var
- values = module.get.values(),
+ values = module.get.values(true),
hasValue = Array.isArray(values)
? values && ($.inArray(value, values) !== -1)
: (values == value)
@@ -3296,7 +3347,7 @@ $.fn.dropdown = function(parameters) {
},
valueIgnoringCase: function(value) {
var
- values = module.get.values(),
+ values = module.get.values(true),
hasValue = false
;
if(!Array.isArray(values)) {
@@ -3328,6 +3379,9 @@ $.fn.dropdown = function(parameters) {
bubbledIconClick: function(event) {
return $(event.target).closest($icon).length > 0;
},
+ chrome: function() {
+ return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
+ },
alreadySetup: function() {
return ($module.is('select') && $module.parent(selector.dropdown).data(moduleNamespace) !== undefined && $module.prev().length === 0);
},
@@ -3380,6 +3434,9 @@ $.fn.dropdown = function(parameters) {
remote: function() {
return settings.apiSettings && module.can.useAPI();
},
+ noApiCache: function() {
+ return settings.apiSettings && !settings.apiSettings.cache
+ },
single: function() {
return !module.is.multiple();
},
@@ -3474,6 +3531,9 @@ $.fn.dropdown = function(parameters) {
if(module.is.verticallyScrollableContext()) {
calculations.menu.offset.top += calculations.context.scrollTop;
}
+ if(module.has.subMenu($currentMenu)) {
+ calculations.menu.height += $currentMenu.find(selector.menu).first().outerHeight();
+ }
onScreen = {
above : (calculations.context.scrollTop) <= calculations.menu.offset.top - calculations.context.offset.top - calculations.menu.height,
below : (calculations.context.scrollTop + calculations.context.height) >= calculations.menu.offset.top - calculations.context.offset.top + calculations.menu.height
@@ -3560,16 +3620,15 @@ $.fn.dropdown = function(parameters) {
;
module.verbose('Doing menu show animation', $currentMenu);
module.set.direction($subMenu);
- transition = module.get.transition($subMenu);
+ transition = settings.transition.showMethod || module.get.transition($subMenu);
if( module.is.selection() ) {
module.set.scrollPosition(module.get.selectedItem(), true);
}
if( module.is.hidden($currentMenu) || module.is.animating($currentMenu) ) {
- var displayType = $module.hasClass('column') ? 'flex' : false;
- if(transition == 'none') {
+ if(transition === 'none') {
start();
$currentMenu.transition({
- displayType: displayType
+ displayType: module.get.displayType()
}).transition('show');
callback.call(element);
}
@@ -3579,10 +3638,10 @@ $.fn.dropdown = function(parameters) {
animation : transition + ' in',
debug : settings.debug,
verbose : settings.verbose,
- duration : settings.duration,
+ duration : settings.transition.showDuration || settings.duration,
queue : true,
onStart : start,
- displayType: displayType,
+ displayType: module.get.displayType(),
onComplete : function() {
callback.call(element);
}
@@ -3605,7 +3664,7 @@ $.fn.dropdown = function(parameters) {
}
module.remove.active();
},
- transition = module.get.transition($subMenu)
+ transition = settings.transition.hideMethod || module.get.transition($subMenu)
;
callback = $.isFunction(callback)
? callback
@@ -3614,20 +3673,23 @@ $.fn.dropdown = function(parameters) {
if( module.is.visible($currentMenu) || module.is.animating($currentMenu) ) {
module.verbose('Doing menu hide animation', $currentMenu);
- if(transition == 'none') {
+ if(transition === 'none') {
start();
- $currentMenu.transition('hide');
+ $currentMenu.transition({
+ displayType: module.get.displayType()
+ }).transition('hide');
callback.call(element);
}
else if($.fn.transition !== undefined && $module.transition('is supported')) {
$currentMenu
.transition({
animation : transition + ' out',
- duration : settings.duration,
+ duration : settings.transition.hideDuration || settings.duration,
debug : settings.debug,
verbose : settings.verbose,
queue : false,
onStart : start,
+ displayType: module.get.displayType(),
onComplete : function() {
callback.call(element);
}
@@ -3956,6 +4018,7 @@ $.fn.dropdown.settings = {
transition : 'auto', // auto transition will slide down or up based on direction
duration : 200, // duration of transition
+ displayType : false, // displayType of transition
glyphWidth : 1.037, // widest glyph width in em (W is 1.037 em) used to calculate multiselect input width
@@ -3980,6 +4043,7 @@ $.fn.dropdown.settings = {
onChange : function(value, text, $selected){},
onAdd : function(value, text, $selected){},
onRemove : function(value, text, $selected){},
+ onSearch : function(searchTerm){},
onLabelSelect : function($selectedLabels){},
onLabelCreate : function(value, text) { return $(this); },
@@ -4027,19 +4091,21 @@ $.fn.dropdown.settings = {
// property names for remote query
fields: {
- remoteValues : 'results', // grouping for api results
- values : 'values', // grouping for all dropdown values
- disabled : 'disabled', // whether value should be disabled
- name : 'name', // displayed dropdown text
- value : 'value', // actual dropdown value
- text : 'text', // displayed text when selected
- type : 'type', // type of dropdown element
- image : 'image', // optional image path
- imageClass : 'imageClass', // optional individual class for image
- icon : 'icon', // optional icon name
- iconClass : 'iconClass', // optional individual class for icon (for example to use flag instead)
- class : 'class', // optional individual class for item/header
- divider : 'divider' // optional divider append for group headers
+ remoteValues : 'results', // grouping for api results
+ values : 'values', // grouping for all dropdown values
+ disabled : 'disabled', // whether value should be disabled
+ name : 'name', // displayed dropdown text
+ description : 'description', // displayed dropdown description
+ descriptionVertical : 'descriptionVertical', // whether description should be vertical
+ value : 'value', // actual dropdown value
+ text : 'text', // displayed text when selected
+ type : 'type', // type of dropdown element
+ image : 'image', // optional image path
+ imageClass : 'imageClass', // optional individual class for image
+ icon : 'icon', // optional icon name
+ iconClass : 'iconClass', // optional individual class for icon (for example to use flag instead)
+ class : 'class', // optional individual class for item/header
+ divider : 'divider' // optional divider append for group headers
},
keys : {
@@ -4078,45 +4144,48 @@ $.fn.dropdown.settings = {
},
className : {
- active : 'active',
- addition : 'addition',
- animating : 'animating',
- disabled : 'disabled',
- empty : 'empty',
- dropdown : 'ui dropdown',
- filtered : 'filtered',
- hidden : 'hidden transition',
- icon : 'icon',
- image : 'image',
- item : 'item',
- label : 'ui label',
- loading : 'loading',
- menu : 'menu',
- message : 'message',
- multiple : 'multiple',
- placeholder : 'default',
- sizer : 'sizer',
- search : 'search',
- selected : 'selected',
- selection : 'selection',
- upward : 'upward',
- leftward : 'left',
- visible : 'visible',
- clearable : 'clearable',
- noselection : 'noselection',
- delete : 'delete',
- header : 'header',
- divider : 'divider',
- groupIcon : '',
- unfilterable : 'unfilterable'
+ active : 'active',
+ addition : 'addition',
+ animating : 'animating',
+ description : 'description',
+ descriptionVertical : 'vertical',
+ disabled : 'disabled',
+ empty : 'empty',
+ dropdown : 'ui dropdown',
+ filtered : 'filtered',
+ hidden : 'hidden transition',
+ icon : 'icon',
+ image : 'image',
+ item : 'item',
+ label : 'ui label',
+ loading : 'loading',
+ menu : 'menu',
+ message : 'message',
+ multiple : 'multiple',
+ placeholder : 'default',
+ sizer : 'sizer',
+ search : 'search',
+ selected : 'selected',
+ selection : 'selection',
+ text : 'text',
+ upward : 'upward',
+ leftward : 'left',
+ visible : 'visible',
+ clearable : 'clearable',
+ noselection : 'noselection',
+ delete : 'delete',
+ header : 'header',
+ divider : 'divider',
+ groupIcon : '',
+ unfilterable : 'unfilterable'
}
};
/* Templates */
$.fn.dropdown.settings.templates = {
- deQuote: function(string) {
- return String(string).replace(/"/g,"");
+ deQuote: function(string, encode) {
+ return String(string).replace(/"/g,encode ? """ : "");
},
escape: function(string, preserveHTML) {
if (preserveHTML){
@@ -4174,26 +4243,49 @@ $.fn.dropdown.settings.templates = {
var
itemType = (option[fields.type])
? option[fields.type]
- : 'item'
+ : 'item',
+ isMenu = itemType.indexOf('menu') !== -1
;
- if( itemType === 'item' ) {
+ if( itemType === 'item' || isMenu) {
var
maybeText = (option[fields.text])
- ? ' data-text="' + deQuote(option[fields.text]) + '"'
+ ? ' data-text="' + deQuote(option[fields.text],true) + '"'
: '',
maybeDisabled = (option[fields.disabled])
? className.disabled+' '
- : ''
+ : '',
+ maybeDescriptionVertical = (option[fields.descriptionVertical])
+ ? className.descriptionVertical+' '
+ : '',
+ hasDescription = (escape(option[fields.description] || '', preserveHTML) != '')
;
- html += '
';
+ html += '
';
+ if (isMenu) {
+ html += '
';
+ }
if(option[fields.image]) {
html += '
';
}
if(option[fields.icon]) {
html += '
';
}
+ if(hasDescription){
+ html += '
'+ escape(option[fields.description] || '', preserveHTML) + '';
+ html += (!isMenu) ? '
' : '';
+ }
+ if (isMenu) {
+ html += '';
+ }
html += escape(option[fields.name] || '', preserveHTML);
+ if (isMenu) {
+ html += '';
+ html += '';
+ html += $.fn.dropdown.settings.templates.menu(option, fields, preserveHTML, className);
+ html += '
';
+ } else if(hasDescription){
+ html += '';
+ }
html += '
';
} else if (itemType === 'header') {
var groupName = escape(option[fields.name] || '', preserveHTML),
diff --git a/definitions/modules/dropdown.less b/definitions/modules/dropdown.less
index 3953c20..00c1374 100644
--- a/definitions/modules/dropdown.less
+++ b/definitions/modules/dropdown.less
@@ -87,6 +87,7 @@
.ui.dropdown:not(.labeled) > .dropdown.icon {
position: relative;
width: auto;
+ min-width: @dropdownIconMinWidth;
font-size: @dropdownIconSize;
margin: @dropdownIconMargin;
}
@@ -267,6 +268,7 @@
---------------*/
/* Icons / Flags / Labels / Image */
+.ui.dropdown > .text > i.icons,
.ui.dropdown > .text > i.icon,
.ui.dropdown > .text > .label,
.ui.dropdown > .text > .flag,
@@ -274,6 +276,7 @@
.ui.dropdown > .text > .image {
margin-top: @textLineHeightOffset;
}
+.ui.dropdown .menu > .item > i.icons,
.ui.dropdown .menu > .item > i.icon,
.ui.dropdown .menu > .item > .label,
.ui.dropdown .menu > .item > .flag,
@@ -282,11 +285,13 @@
margin-top: @itemLineHeightOffset;
}
+.ui.dropdown > .text > i.icons,
.ui.dropdown > .text > i.icon,
.ui.dropdown > .text > .label,
.ui.dropdown > .text > .flag,
.ui.dropdown > .text > img,
.ui.dropdown > .text > .image,
+.ui.dropdown .menu > .item > i.icons,
.ui.dropdown .menu > .item > i.icon,
.ui.dropdown .menu > .item > .label,
.ui.dropdown .menu > .item > .flag,
@@ -767,29 +772,44 @@ select.ui.dropdown {
}
}
-/* Clearable Selection */
-.ui.dropdown > .remove.icon {
- cursor: pointer;
- font-size: @dropdownIconSize;
- margin: @selectionIconMargin;
- padding: @selectionIconPadding;
- right: 3em;
- top: @selectionVerticalPadding;
- position: absolute;
- opacity: 0.6;
- z-index: @selectionIconZIndex;
-}
+& when (@variationDropdownClear) {
+ /* Clearable Selection */
+ .ui.dropdown > .remove.icon {
+ cursor: pointer;
+ font-size: @dropdownIconSize;
+ margin: @selectionIconMargin;
+ padding: @selectionIconPadding;
+ right: @clearableIconPosition;
+ top: @selectionVerticalPadding;
+ position: absolute;
+ opacity: @clearableIconOpacity;
+ z-index: @selectionIconZIndex;
+ }
+ .ui.selection.dropdown > .remove.icon {
+ right: @clearableIconSelectionPosition;
+ }
+ .ui.inline.dropdown > .remove.icon {
+ right: @clearableIconInlinePosition;
+ }
-.ui.clearable.dropdown .text,
-.ui.clearable.dropdown a:last-of-type {
- margin-right: 1.5em;
-}
+ .ui.clearable.dropdown .text,
+ .ui.clearable.dropdown a:last-of-type {
+ margin-right: @clearableTextMargin;
+ }
-.ui.dropdown select.noselection ~ .remove.icon,
-.ui.dropdown input[value=''] ~ .remove.icon,
-.ui.dropdown input:not([value]) ~ .remove.icon,
-.ui.dropdown.loading > .remove.icon {
- display: none;
+ .ui.dropdown select.noselection ~ .remove.icon,
+ .ui.dropdown input[value=''] ~ .remove.icon,
+ .ui.dropdown input:not([value]) ~ .remove.icon,
+ .ui.dropdown.loading > .remove.icon {
+ display: none;
+ }
+
+ .ui.dropdown:not(.selection) > .remove.icon ~ .dropdown.icon {
+ margin-left: @clearableIconMargin;
+ }
+ .ui.dropdown:not(.selection) > .remove.icon {
+ margin-top: -@clearableIconMarginTop;
+ }
}
& when (@variationDropdownMultiple) {
@@ -1107,11 +1127,12 @@ select.ui.dropdown {
/*--------------------
Clear
----------------------*/
-
+ .ui.dropdown > .remove.icon,
.ui.dropdown > .clear.dropdown.icon {
opacity: @clearableIconOpacity;
transition: opacity @defaultDuration @defaultEasing;
}
+ .ui.dropdown > .remove.icon:hover,
.ui.dropdown > .clear.dropdown.icon:hover {
opacity: @clearableIconActiveOpacity;
}
@@ -1131,6 +1152,16 @@ select.ui.dropdown {
}
}
+& when (@variationDropdownReadonly) {
+ /*--------------------
+ Read-Only
+ ----------------------*/
+
+ .ui.read-only.dropdown {
+ cursor: default;
+ pointer-events: none;
+ }
+}
/*******************************
Variations
@@ -1323,6 +1354,30 @@ select.ui.dropdown {
}
}
+& when (@variationInputLabeled) {
+ /*--------------------
+ Labeled
+ ---------------------*/
+
+ /* Regular Label on Left */
+ .ui.labeled.input:not([class*="corner labeled"]) .label:first-child + .dropdown {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ border-left-color: transparent;
+ }
+
+ /* Regular Label on Right */
+ .ui[class*="right labeled"].input > .dropdown:not(:last-child) {
+ border-top-right-radius: 0 !important;
+ border-bottom-right-radius: 0 !important;
+ border-right-color: transparent !important;
+ }
+ .ui[class*="right labeled"].input > .dropdown + .label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+}
+
/*--------------
Columnar
---------------*/
@@ -1679,46 +1734,55 @@ select.ui.dropdown {
---------------*/
/* General rules and basic dropdowns */
+ .ui.dropdown .inverted.menu,
.ui.inverted.dropdown .menu {
background: @invertedMenuBackground;
box-shadow: @invertedMenuBoxShadow;
border: @invertedMenuBorder;
}
+ .ui.dropdown .inverted.menu > .item,
.ui.inverted.dropdown .menu > .item {
color: @invertedMenuColor;
}
+ .ui.dropdown .inverted.menu .active.item,
.ui.inverted.dropdown .menu .active.item {
background: @invertedActiveItemBackground;
color: @invertedActiveItemColor;
box-shadow: @invertedActiveItemBoxShadow;
}
+ .ui.dropdown .inverted.menu > .item:hover,
.ui.inverted.dropdown .menu > .item:hover {
background: @invertedHoveredItemBackground;
color: @invertedHoveredItemColor;
}
.ui.inverted.dropdown.selected,
+ .ui.dropdown .inverted.menu .selected.item,
.ui.inverted.dropdown .menu .selected.item {
background: @invertedSelectedBackground;
color: @invertedSelectedColor;
}
+ .ui.dropdown .inverted.menu > .header,
.ui.inverted.dropdown .menu > .header {
color: @invertedMenuHeaderColor;
}
.ui.inverted.dropdown > .text > .description,
+ .ui.dropdown .inverted.menu > .item > .description,
.ui.inverted.dropdown .menu > .item > .description {
color: @invertedItemDescriptionColor;
}
+ .ui.dropdown .inverted.menu > .divider,
.ui.inverted.dropdown .menu > .divider {
border-top: @invertedMenuDividerBorder;
}
+ .ui.dropdown .inverted.scrolling.menu,
.ui.inverted.dropdown .scrolling.menu {
border: none;
border-top: @invertedMenuBorder;
@@ -1745,11 +1809,13 @@ select.ui.dropdown {
color: @invertedSelectionVisibleTextColor;
}
+ .ui.selection.active.dropdown .inverted.menu,
.ui.inverted.selection.active.dropdown .menu,
.ui.inverted.selection.active.dropdown:hover {
border-color: @invertedSelectionVisibleBorderColor;
}
+ .ui.selection.dropdown .inverted.menu > .item,
.ui.inverted.selection.dropdown .menu > .item {
border-top: @invertedSelectionItemDivider;
}
@@ -1772,11 +1838,13 @@ select.ui.dropdown {
color: @invertedSelectionTextUnderlayColor !important;
}
+ .ui.dropdown .inverted.menu > .message:not(.ui),
.ui.inverted.dropdown .menu > .message:not(.ui) {
color: @invertedMessageColor;
}
/* Fixing the border */
+ .ui.dropdown .inverted.menu > .item:first-child,
.ui.inverted.dropdown .menu > .item:first-child {
border-top-width: 0;
}
@@ -1827,19 +1895,24 @@ select.ui.dropdown {
}
/* Scrollbars */
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-track,
.ui.inverted.dropdown .menu::-webkit-scrollbar-track {
background: @trackInvertedBackground;
}
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb {
background: @thumbInvertedBackground;
}
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:window-inactive,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:window-inactive {
background: @thumbInvertedInactiveBackground;
}
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:hover,
.ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:hover {
background: @thumbInvertedHoverBackground;
}
& when (@variationDropdownPointing) {
+ .ui.pointing.dropdown > .inverted.menu:after,
.ui.inverted.pointing.dropdown > .menu:after {
background: @invertedPointingArrowBackground;
box-shadow: @invertedPointingArrowBoxShadow;
diff --git a/definitions/modules/modal.js b/definitions/modules/modal.js
index 420ecc2..3091c75 100644
--- a/definitions/modules/modal.js
+++ b/definitions/modules/modal.js
@@ -58,6 +58,7 @@ $.fn.modal = function(parameters) {
selector = settings.selector,
className = settings.className,
namespace = settings.namespace,
+ fields = settings.fields,
error = settings.error,
eventNamespace = '.' + namespace,
@@ -74,7 +75,7 @@ $.fn.modal = function(parameters) {
$dimmer,
element = this,
- instance = $module.data(moduleNamespace),
+ instance = $module.hasClass('modal') ? $module.data(moduleNamespace) : undefined,
ignoreRepeatedEvents = false,
@@ -91,6 +92,46 @@ $.fn.modal = function(parameters) {
module = {
initialize: function() {
+ if(!$module.hasClass('modal')) {
+ module.create.modal();
+ if(!$.isFunction(settings.onHidden)) {
+ settings.onHidden = function () {
+ module.destroy();
+ $module.remove();
+ };
+ }
+ }
+ $module.addClass(settings.class);
+ if (settings.title !== '') {
+ $module.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
+ }
+ if (settings.content !== '') {
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
+ }
+ if(module.has.configActions()){
+ var $actions = $module.find(selector.actions).addClass(settings.classActions);
+ if ($actions.length === 0) {
+ $actions = $('
', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($module);
+ } else {
+ $actions.empty();
+ }
+ settings.actions.forEach(function (el) {
+ var icon = el[fields.icon] ? '
' : '',
+ text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
+ cls = module.helpers.deQuote(el[fields.class] || ''),
+ click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {};
+ $actions.append($('
', {
+ html: icon + text,
+ class: className.button + ' ' + cls,
+ click: function () {
+ if (click.call(element, $module) === false) {
+ return;
+ }
+ module.hide();
+ }
+ }));
+ });
+ }
module.cache = {};
module.verbose('Initializing dimmer', $context);
@@ -110,6 +151,9 @@ $.fn.modal = function(parameters) {
module.observeChanges();
}
module.instantiate();
+ if(settings.autoShow){
+ module.show();
+ }
},
instantiate: function() {
@@ -121,6 +165,23 @@ $.fn.modal = function(parameters) {
},
create: {
+ modal: function() {
+ $module = $('
', {class: className.modal});
+ if (settings.closeIcon) {
+ $close = $('
', {class: className.close})
+ $module.append($close);
+ }
+ if (settings.title !== '') {
+ $('
', {class: className.title}).appendTo($module);
+ }
+ if (settings.content !== '') {
+ $('
', {class: className.content}).appendTo($module);
+ }
+ if (module.has.configActions()) {
+ $('
', {class: className.actions}).appendTo($module);
+ }
+ $context.append($module);
+ },
dimmer: function() {
var
defaultSettings = {
@@ -247,6 +308,12 @@ $.fn.modal = function(parameters) {
get: {
id: function() {
return (Math.random().toString(16) + '000000000').substr(2, 8);
+ },
+ element: function() {
+ return $module;
+ },
+ settings: function() {
+ return settings;
}
},
@@ -424,9 +491,9 @@ $.fn.modal = function(parameters) {
$module
.transition({
debug : settings.debug,
- animation : settings.transition + ' in',
+ animation : (settings.transition.showMethod || settings.transition) + ' in',
queue : settings.queue,
- duration : settings.duration,
+ duration : settings.transition.showDuration || settings.duration,
useFailSafe : true,
onComplete : function() {
settings.onVisible.apply(element);
@@ -474,9 +541,9 @@ $.fn.modal = function(parameters) {
$module
.transition({
debug : settings.debug,
- animation : settings.transition + ' out',
+ animation : (settings.transition.hideMethod || settings.transition) + ' out',
queue : settings.queue,
- duration : settings.duration,
+ duration : settings.transition.hideDuration || settings.duration,
useFailSafe : true,
onStart : function() {
if(!module.others.active() && !module.others.animating() && !keepDimmed) {
@@ -499,7 +566,9 @@ $.fn.modal = function(parameters) {
$previousModal.find(selector.dimmer).removeClass('active');
}
}
- settings.onHidden.call(element);
+ if($.isFunction(settings.onHidden)) {
+ settings.onHidden.call(element);
+ }
module.remove.dimmerStyles();
module.restore.focus();
callback();
@@ -625,7 +694,12 @@ $.fn.modal = function(parameters) {
bodyMargin: function() {
var position = module.can.leftBodyScrollbar() ? 'left':'right';
$body.css('margin-'+position, initialBodyMargin);
- $body.find(selector.bodyFixed.replace('right',position)).css('padding-'+position, initialBodyMargin);
+ $body.find(selector.bodyFixed.replace('right',position)).each(function(){
+ var el = $(this),
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
+ ;
+ el.css(attribute, '');
+ });
}
},
@@ -699,7 +773,35 @@ $.fn.modal = function(parameters) {
$module.removeClass(className.loading);
module.debug('Caching modal and container sizes', module.cache);
},
-
+ helpers: {
+ deQuote: function(string) {
+ return String(string).replace(/"/g,"");
+ },
+ escape: function(string, preserveHTML) {
+ if (preserveHTML){
+ return string;
+ }
+ var
+ badChars = /[<>"'`]/g,
+ shouldEscape = /[&<>"'`]/,
+ escape = {
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'",
+ "`": "`"
+ },
+ escapedChar = function(chr) {
+ return escape[chr];
+ }
+ ;
+ if(shouldEscape.test(string)) {
+ string = string.replace(/&(?![a-z0-9#]{1,6};)/, "&");
+ return string.replace(badChars, escapedChar);
+ }
+ return string;
+ }
+ },
can: {
leftBodyScrollbar: function(){
if(module.cache.leftBodyScrollbar === undefined) {
@@ -734,7 +836,11 @@ $.fn.modal = function(parameters) {
;
}
},
-
+ has: {
+ configActions: function () {
+ return Array.isArray(settings.actions) && settings.actions.length > 0;
+ }
+ },
is: {
active: function() {
return $module.hasClass(className.active);
@@ -811,7 +917,12 @@ $.fn.modal = function(parameters) {
if(settings.detachable || module.can.fit()) {
$body.css('margin-'+position, tempBodyMargin + 'px');
}
- $body.find(selector.bodyFixed.replace('right',position)).css('padding-'+position, tempBodyMargin + 'px');
+ $body.find(selector.bodyFixed.replace('right',position)).each(function(){
+ var el = $(this),
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
+ ;
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
+ });
},
clickaway: function() {
if (!settings.detachable) {
@@ -838,8 +949,8 @@ $.fn.modal = function(parameters) {
closable : 'auto',
useFlex : module.can.useFlex(),
duration : {
- show : settings.duration,
- hide : settings.duration
+ show : settings.transition.showDuration || settings.duration,
+ hide : settings.transition.hideDuration || settings.duration
}
},
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
@@ -1098,15 +1209,29 @@ $.fn.modal = function(parameters) {
if(methodInvoked) {
if(instance === undefined) {
+ if ($.isFunction(settings.templates[query])) {
+ settings.autoShow = true;
+ settings.className.modal = settings.className.template;
+ settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
+
+ // reassign shortcuts
+ className = settings.className;
+ namespace = settings.namespace;
+ fields = settings.fields;
+ error = settings.error;
+ }
module.initialize();
}
- module.invoke(query);
+ if (!$.isFunction(settings.templates[query])) {
+ module.invoke(query);
+ }
}
else {
if(instance !== undefined) {
instance.invoke('destroy');
}
module.initialize();
+ returnedValue = $module;
}
})
;
@@ -1137,6 +1262,7 @@ $.fn.modal.settings = {
closable : true,
autofocus : true,
restoreFocus : true,
+ autoShow : false,
inverted : false,
blurring : false,
@@ -1161,6 +1287,24 @@ $.fn.modal.settings = {
padding : 50,
scrollbarWidth: 10,
+ //dynamic content
+ title : '',
+ content : '',
+ class : '',
+ classTitle : '',
+ classContent : '',
+ classActions : '',
+ closeIcon : false,
+ actions : false,
+ preserveHTML : true,
+
+ fields : {
+ class : 'class',
+ text : 'text',
+ icon : 'icon',
+ click : 'click'
+ },
+
// called before show animation
onShow : function(){},
@@ -1171,7 +1315,7 @@ $.fn.modal.settings = {
onHide : function(){ return true; },
// called after hide animation
- onHidden : function(){},
+ onHidden : false,
// called after approve selector match
onApprove : function(){ return true; },
@@ -1180,12 +1324,16 @@ $.fn.modal.settings = {
onDeny : function(){ return true; },
selector : {
+ title : '> .header',
+ content : '> .content',
+ actions : '> .actions',
close : '> .close',
approve : '.actions .positive, .actions .approve, .actions .ok',
deny : '.actions .negative, .actions .deny, .actions .cancel',
modal : '.ui.modal',
dimmer : '> .ui.dimmer',
- bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar'
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
+ prompt : '.ui.input > input'
},
error : {
dimmer : 'UI Dimmer, a required component is not included in this page',
@@ -1201,9 +1349,104 @@ $.fn.modal.settings = {
loading : 'loading',
scrolling : 'scrolling',
undetached : 'undetached',
- front : 'front'
+ front : 'front',
+ close : 'close icon',
+ button : 'ui button',
+ modal : 'ui modal',
+ title : 'header',
+ content : 'content',
+ actions : 'actions',
+ template : 'ui tiny modal',
+ ok : 'positive',
+ cancel : 'negative',
+ prompt : 'ui fluid input'
+ },
+ text: {
+ ok : 'Ok',
+ cancel: 'Cancel'
}
};
+$.fn.modal.settings.templates = {
+ getArguments: function(args) {
+ var queryArguments = [].slice.call(args);
+ if($.isPlainObject(queryArguments[0])){
+ return $.extend({
+ handler:function(){},
+ content:'',
+ title: ''
+ }, queryArguments[0]);
+ } else {
+ if(!$.isFunction(queryArguments[queryArguments.length-1])) {
+ queryArguments.push(function() {});
+ }
+ return {
+ handler: queryArguments.pop(),
+ content: queryArguments.pop() || '',
+ title: queryArguments.pop() || ''
+ };
+ }
+ },
+ alert: function () {
+ var settings = this.get.settings(),
+ args = settings.templates.getArguments(arguments)
+ ;
+ return {
+ title : args.title,
+ content: args.content,
+ actions: [{
+ text : settings.text.ok,
+ class: settings.className.ok,
+ click: args.handler
+ }]
+ }
+ },
+ confirm: function () {
+ var settings = this.get.settings(),
+ args = settings.templates.getArguments(arguments)
+ ;
+ return {
+ title : args.title,
+ content: args.content,
+ actions: [{
+ text : settings.text.ok,
+ class: settings.className.ok,
+ click: function(){args.handler(true)}
+ },{
+ text: settings.text.cancel,
+ class: settings.className.cancel,
+ click: function(){args.handler(false)}
+ }]
+ }
+ },
+ prompt: function () {
+ var $this = this,
+ settings = this.get.settings(),
+ args = settings.templates.getArguments(arguments),
+ input = $($.parseHTML(args.content)).filter('.ui.input')
+ ;
+ if (input.length === 0) {
+ args.content += '
';
+ }
+ return {
+ title : args.title,
+ content: args.content,
+ actions: [{
+ text: settings.text.ok,
+ class: settings.className.ok,
+ click: function(){
+ var settings = $this.get.settings(),
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
+ ;
+ args.handler($(inputField).val());
+ }
+ },{
+ text: settings.text.cancel,
+ class: settings.className.cancel,
+ click: function(){args.handler(null)}
+ }]
+ }
+ }
+}
})( jQuery, window, document );
diff --git a/definitions/modules/modal.less b/definitions/modules/modal.less
index e171222..ef850c7 100644
--- a/definitions/modules/modal.less
+++ b/definitions/modules/modal.less
@@ -40,9 +40,9 @@
will-change: top, left, margin, transform, opacity;
}
-.ui.modal > :first-child:not(.icon):not(.dimmer),
+.ui.modal > :first-child:not(.close):not(.dimmer),
.ui.modal > i.icon:first-child + *,
-.ui.modal > .dimmer:first-child + *:not(.icon),
+.ui.modal > .dimmer:first-child + *:not(.close),
.ui.modal > .dimmer:first-child + i.icon + * {
border-top-left-radius: @borderRadius;
border-top-right-radius: @borderRadius;
@@ -182,6 +182,15 @@
border-top:none;
}
+.ui.modal > .centered,
+.ui.modal > .center.aligned {
+ text-align: center;
+ &.actions > .button:not(.fluid) {
+ margin-left: @buttonCenteredDistance;
+ margin-right: @buttonCenteredDistance;
+ }
+}
+
/*-------------------
Responsive
--------------------*/
@@ -220,7 +229,7 @@
/* Tablet and Mobile */
@media only screen and (max-width : @largestTabletScreen) {
- .ui.modal > .header {
+ .ui.modal > .close + .header {
padding-right: @closeHitbox;
}
.ui.modal > .close {
@@ -234,8 +243,10 @@
@media only screen and (max-width : @largestMobileScreen) {
.ui.modal > .header {
- padding: @mobileHeaderPadding !important;
- padding-right: @closeHitbox !important;
+ padding: @mobileHeaderPadding;
+ }
+ .ui.modal > .close + .header {
+ padding-right: @closeHitbox;
}
.ui.overlay.fullscreen.modal > .content.content.content {
min-height: @overlayFullscreenScrollingContentMaxHeightMobile;
@@ -466,8 +477,8 @@
border-radius:0;
}
}
- .ui.modal > .close.inside + .header,
- .ui.fullscreen.modal > .header {
+ .ui.modal > .close.inside + .header:not(.centered):not(.center):not(.icon),
+ .ui.fullscreen.modal > .close + .header:not(.centered):not(.center):not(.icon) {
padding-right: @closeHitbox;
}
.ui.modal > .close.inside,
diff --git a/definitions/modules/nag.js b/definitions/modules/nag.js
index db88b77..3325beb 100644
--- a/definitions/modules/nag.js
+++ b/definitions/modules/nag.js
@@ -58,14 +58,14 @@ $.fn.nag = function(parameters) {
element = this,
instance = $module.data(moduleNamespace),
-
+ storage,
module
;
module = {
initialize: function() {
module.verbose('Initializing element');
-
+ storage = module.get.storage();
$module
.on('click' + eventNamespace, selector.close, module.dismiss)
.data(moduleNamespace, module)
@@ -94,47 +94,47 @@ $.fn.nag = function(parameters) {
show: function() {
if( module.should.show() && !$module.is(':visible') ) {
+ if(settings.onShow.call(element) === false) {
+ module.debug('onShow callback returned false, cancelling nag animation');
+ return false;
+ }
module.debug('Showing nag', settings.animation.show);
- if(settings.animation.show == 'fade') {
+ if(settings.animation.show === 'fade') {
$module
- .fadeIn(settings.duration, settings.easing)
+ .fadeIn(settings.duration, settings.easing, settings.onVisible)
;
}
else {
$module
- .slideDown(settings.duration, settings.easing)
+ .slideDown(settings.duration, settings.easing, settings.onVisible)
;
}
}
},
hide: function() {
- module.debug('Showing nag', settings.animation.hide);
- if(settings.animation.show == 'fade') {
+ if(settings.onHide.call(element) === false) {
+ module.debug('onHide callback returned false, cancelling nag animation');
+ return false;
+ }
+ module.debug('Hiding nag', settings.animation.hide);
+ if(settings.animation.hide === 'fade') {
$module
- .fadeIn(settings.duration, settings.easing)
+ .fadeOut(settings.duration, settings.easing, settings.onHidden)
;
}
else {
$module
- .slideUp(settings.duration, settings.easing)
+ .slideUp(settings.duration, settings.easing, settings.onHidden)
;
}
},
- onHide: function() {
- module.debug('Removing nag', settings.animation.hide);
- $module.remove();
- if (settings.onHide) {
- settings.onHide();
- }
- },
-
dismiss: function(event) {
- if(settings.storageMethod) {
+ if(module.hide() !== false && settings.storageMethod) {
+ module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
module.storage.set(settings.key, settings.value);
}
- module.hide();
event.stopImmediatePropagation();
event.preventDefault();
},
@@ -155,12 +155,71 @@ $.fn.nag = function(parameters) {
},
get: {
+ expirationDate: function(expires) {
+ if (typeof expires === 'number') {
+ expires = new Date(Date.now() + expires * 864e5);
+ }
+ if(expires instanceof Date && expires.getTime() ){
+ return expires.toUTCString();
+ } else {
+ module.error(error.expiresFormat);
+ }
+ },
+ storage: function(){
+ if(settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
+ module.debug('Using local storage');
+ return window.localStorage;
+ }
+ else if(settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
+ module.debug('Using session storage');
+ return window.sessionStorage;
+ }
+ else if("cookie" in document) {
+ module.debug('Using cookie');
+ return {
+ setItem: function(key, value, options) {
+ // RFC6265 compliant encoding
+ key = encodeURIComponent(key)
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
+ .replace(/[()]/g, escape);
+ value = encodeURIComponent(value)
+ .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
+
+ var cookieOptions = '';
+ for (var option in options) {
+ if (options.hasOwnProperty(option)) {
+ cookieOptions += '; ' + option;
+ if (typeof options[option] === 'string') {
+ cookieOptions += '=' + options[option].split(';')[0];
+ }
+ }
+ }
+ document.cookie = key + '=' + value + cookieOptions;
+ },
+ getItem: function(key) {
+ var cookies = document.cookie.split('; ');
+ for (var i = 0, il = cookies.length; i < il; i++) {
+ var parts = cookies[i].split('='),
+ foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
+ if (key === foundKey) {
+ return parts[1] || '';
+ }
+ }
+ },
+ removeItem: function(key, options) {
+ storage.setItem(key,'',options);
+ }
+ };
+ } else {
+ module.error(error.noStorage);
+ }
+ },
storageOptions: function() {
var
options = {}
;
if(settings.expires) {
- options.expires = settings.expires;
+ options.expires = module.get.expirationDate(settings.expires);
}
if(settings.domain) {
options.domain = settings.domain;
@@ -168,6 +227,12 @@ $.fn.nag = function(parameters) {
if(settings.path) {
options.path = settings.path;
}
+ if(settings.secure) {
+ options.secure = settings.secure;
+ }
+ if(settings.samesite) {
+ options.samesite = settings.samesite;
+ }
return options;
}
},
@@ -181,39 +246,30 @@ $.fn.nag = function(parameters) {
var
options = module.get.storageOptions()
;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- window.localStorage.setItem(key, value);
- module.debug('Value stored using local storage', key, value);
+ if(storage === window.localStorage && options.expires) {
+ module.debug('Storing expiration value in localStorage', key, options.expires);
+ storage.setItem(key + settings.expirationKey, options.expires );
}
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
- window.sessionStorage.setItem(key, value);
- module.debug('Value stored using session storage', key, value);
+ module.debug('Value stored', key, value);
+ try {
+ storage.setItem(key, value, options);
}
- else if($.cookie !== undefined) {
- $.cookie(key, value, options);
- module.debug('Value stored using cookie', key, value, options);
- }
- else {
- module.error(error.noCookieStorage);
- return;
+ catch(e) {
+ module.error(error.setItem, e);
}
},
- get: function(key, value) {
+ get: function(key) {
var
storedValue
;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- storedValue = window.localStorage.getItem(key);
- }
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
- storedValue = window.sessionStorage.getItem(key);
- }
- // get by cookie
- else if($.cookie !== undefined) {
- storedValue = $.cookie(key);
- }
- else {
- module.error(error.noCookieStorage);
+ storedValue = storage.getItem(key);
+ if(storage === window.localStorage) {
+ var expiration = storage.getItem(key + settings.expirationKey);
+ if(expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
+ module.debug('Value in localStorage has expired. Deleting key', key);
+ module.storage.remove(key);
+ storedValue = null;
+ }
}
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
storedValue = undefined;
@@ -224,19 +280,11 @@ $.fn.nag = function(parameters) {
var
options = module.get.storageOptions()
;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- window.localStorage.removeItem(key);
- }
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
- window.sessionStorage.removeItem(key);
- }
- // store by cookie
- else if($.cookie !== undefined) {
- $.removeCookie(key, options);
- }
- else {
- module.error(error.noStorage);
+ options.expires = module.get.expirationDate(-1);
+ if(storage === window.localStorage) {
+ storage.removeItem(key + settings.expirationKey);
}
+ storage.removeItem(key, options);
}
},
@@ -450,8 +498,12 @@ $.fn.nag.settings = {
detachable : false,
expires : 30,
+
+// cookie storage only options
domain : false,
path : '/',
+ secure : false,
+ samesite : false,
// type of storage to use
storageMethod : 'cookie',
@@ -460,10 +512,14 @@ $.fn.nag.settings = {
key : 'nag',
value : 'dismiss',
+// Key suffix to support expiration in localstorage
+ expirationKey : 'ExpirationDate',
+
error: {
- noCookieStorage : '$.cookie is not included. A storage solution is required.',
- noStorage : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
- method : 'The method you called is not defined.'
+ noStorage : 'Unsupported storage method',
+ method : 'The method you called is not defined.',
+ setItem : 'Unexpected error while setting value',
+ expiresFormat : '"expires" must be a number of days or a Date Object'
},
className : {
@@ -472,13 +528,23 @@ $.fn.nag.settings = {
},
selector : {
- close : '.close.icon'
+ close : '> .close.icon'
},
- speed : 500,
+ duration : 500,
easing : 'easeOutQuad',
- onHide: function() {}
+ // callback before show animation, return false to prevent show
+ onShow : function() {},
+
+ // called after show animation
+ onVisible : function() {},
+
+ // callback before hide animation, return false to prevent hide
+ onHide : function() {},
+
+ // callback after hide animation
+ onHidden : function() {}
};
diff --git a/definitions/modules/nag.less b/definitions/modules/nag.less
index 386e7fe..dfbe8d3 100644
--- a/definitions/modules/nag.less
+++ b/definitions/modules/nag.less
@@ -74,7 +74,9 @@ a.ui.nag {
transition: @closeTransition;
}
-
+.ui.nag:not(.overlay):not(.fixed) {
+ border-radius: @borderRadius;
+}
/*******************************
States
@@ -86,7 +88,7 @@ a.ui.nag {
opacity: @nagHoverOpacity;
}
-.ui.nag .close:hover {
+.ui.nag > .close:hover {
opacity: @closeHoverOpacity;
}
@@ -95,64 +97,126 @@ a.ui.nag {
Variations
*******************************/
-
-/*--------------
- Static
----------------*/
-
-.ui.overlay.nag {
- position: absolute;
- display: block;
+& when(@variationNagOverlay) {
+ /*--------------
+ Static
+ ---------------*/
+ .ui.overlay.nags,
+ .ui.overlay.nag {
+ position: absolute;
+ display: block;
+ }
}
+& when(@variationNagFixed) {
/*--------------
Fixed
---------------*/
-
-.ui.fixed.nag {
- position: fixed;
+ .ui.fixed.nags,
+ .ui.fixed.nag {
+ position: fixed;
+ }
}
-
+& when(@variationNagBottom) {
/*--------------
Bottom
---------------*/
-
-.ui.bottom.nags,
-.ui.bottom.nag {
- border-radius: @bottomBorderRadius;
- top: auto;
- bottom: @bottom;
+ .ui.bottom.nags,
+ .ui.bottom.nag {
+ border-radius: @bottomBorderRadius;
+ top: auto;
+ bottom: @bottom;
+ }
}
+& when(@variationNagInverted) {
/*--------------
- White
+ Inverted
---------------*/
-.ui.inverted.nags .nag,
-.ui.inverted.nag {
- background-color: @invertedBackground;
- color: @darkTextColor;
-}
-.ui.inverted.nags .nag .close,
-.ui.inverted.nags .nag .title,
-.ui.inverted.nag .close,
-.ui.inverted.nag .title {
- color: @lightTextColor;
+ .ui.inverted.nags .nag,
+ .ui.inverted.nag {
+ background-color: @invertedBackground;
+ color: @darkTextColor;
+ }
+ .ui.inverted.nags .nag > .close,
+ .ui.inverted.nag > .close {
+ color: @invertedCloseColor;
+ }
+ .ui.inverted.nags .nag > .title,
+ .ui.inverted.nag > .title {
+ color: @invertedTitleColor;
+ }
}
+& when not (@variationNagSizes = false) {
+/*-------------------
+ Sizes
+--------------------*/
+ each(@variationNagSizes, {
+ @s: @@value;
+ @sr: "@{value}Raw";
+ .ui.@{value}.nag,
+ .ui.@{value}.nags .nag {
+ font-size: @s;
+ & when (@@sr > 1.4) {
+ line-height: 1;
+ }
+ }
+ })
+}
+/*--------------
+ Colors
+-------------- */
+
+each(@colors, {
+ @color: replace(@key, '@', '');
+ @c: @colors[@@color][color];
+ @l: @colors[@@color][light];
+ @isVeryDark: @colors[@@color][isVeryDark];
+
+ .ui.@{color}.nag {
+ background-color: @c;
+ & when (@isVeryDark) {
+ color: @invertedTextColor;
+ }
+ }
+ & when (@variationNagInverted) {
+ .ui.inverted.@{color}.nag {
+ background-color: @l;
+ & .title when (@isVeryDark) {
+ color: @titleColor;
+ }
+ }
+ }
+})
+
+& when (@variationNagGroups) {
/*******************************
Groups
*******************************/
-
-.ui.nags .nag {
- border-radius: @groupedBorderRadius !important;
+ .ui.nags {
+ top: @top;
+ left: 0;
+ width: @width;
+ }
+ .ui.ui.nags .nag {
+ border-radius: @groupedBorderRadius;
+ }
+ .ui.nags:not(.bottom) .nag:last-child {
+ border-radius: @topBorderRadius;
+ }
+ & when(@variationNagBottom) {
+ .ui.bottom.nags .nag:first-child {
+ border-radius: @bottomBorderRadius;
+ }
+ }
+ .ui.nags:not(.fixed):not(.overlay) .nag:first-child {
+ border-radius: @bottomBorderRadius;
+ }
+ .ui.nags:not(.fixed):not(.overlay) .nag:only-child {
+ border-radius: @borderRadius;
+ }
}
-.ui.nags .nag:last-child {
- border-radius: @topBorderRadius;
-}
-.ui.bottom.nags .nag:last-child {
- border-radius: @bottomBorderRadius;
-}
-
.loadUIOverrides();
diff --git a/definitions/modules/popup.js b/definitions/modules/popup.js
index d6b70e1..c54f9e9 100644
--- a/definitions/modules/popup.js
+++ b/definitions/modules/popup.js
@@ -434,11 +434,11 @@ $.fn.popup = function(parameters) {
module.set.visible();
$popup
.transition({
- animation : settings.transition + ' in',
+ animation : (settings.transition.showMethod || settings.transition) + ' in',
queue : false,
debug : settings.debug,
verbose : settings.verbose,
- duration : settings.duration,
+ duration : settings.transition.showDuration || settings.duration,
onComplete : function() {
module.bind.close();
callback.call($popup, element);
@@ -457,9 +457,9 @@ $.fn.popup = function(parameters) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$popup
.transition({
- animation : settings.transition + ' out',
+ animation : (settings.transition.hideMethod || settings.transition) + ' out',
queue : false,
- duration : settings.duration,
+ duration : settings.transition.hideDuration || settings.duration,
debug : settings.debug,
verbose : settings.verbose,
onComplete : function() {
diff --git a/definitions/modules/popup.less b/definitions/modules/popup.less
index 7d08569..e683e45 100644
--- a/definitions/modules/popup.less
+++ b/definitions/modules/popup.less
@@ -336,7 +336,8 @@
top: 100%;
left: 50%;
margin-left: @tooltipArrowHorizontalOffset;
- margin-top: -@tooltipArrowVerticalOffset;
+ margin-top: -@arrowOffset;
+ transform-origin: center top;
}
}
& when (@variationPopupLeft) {
diff --git a/definitions/modules/progress.js b/definitions/modules/progress.js
index 0d90a4d..77ef2d4 100644
--- a/definitions/modules/progress.js
+++ b/definitions/modules/progress.js
@@ -500,10 +500,14 @@ $.fn.progress = function(parameters) {
},
percent: function(percents) {
percents = module.helper.forceArray(percents).map(function(percent) {
- return (typeof percent == 'string')
+ percent = (typeof percent == 'string')
? +(percent.replace('%', ''))
: percent
;
+ return (settings.limitValues)
+ ? Math.max(0, Math.min(100, percent))
+ : percent
+ ;
});
var hasTotal = module.has.total();
var totalPercent = module.helper.sum(percents);
@@ -533,21 +537,15 @@ $.fn.progress = function(parameters) {
});
module.percent = roundedPercents;
if (hasTotal) {
- module.value = roundedPercents.map(function (percent) {
+ module.value = percents.map(function (percent) {
return (autoPrecision > 0)
? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
: Math.round((percent / 100) * module.total * 10) / 10
;
});
- if (settings.limitValues) {
- module.value = module.value.map(function (value) {
- return Math.max(0, Math.min(100, value));
- });
- }
}
module.set.barWidth(percents);
module.set.labelInterval();
- module.set.labels();
}
settings.onChange.call(element, percents, module.value, module.total);
},
diff --git a/definitions/modules/progress.less b/definitions/modules/progress.less
index e5300d3..41db91d 100644
--- a/definitions/modules/progress.less
+++ b/definitions/modules/progress.less
@@ -24,7 +24,7 @@
.ui.progress {
position: relative;
- display: block;
+ display: flex;
max-width: 100%;
border: @border;
margin: @margin;
@@ -87,6 +87,16 @@
text-align: @progressTextAlign;
}
+& when (@variationProgressRightAligned) {
+ .ui.right.aligned.progress {
+ justify-content: flex-end;
+ & .bar > .progress {
+ left: @progressRightAlignedLeft;
+ right: @progressRightAlignedRight;
+ }
+ }
+}
+
/* Label */
.ui.progress > .label {
position: absolute;
@@ -229,12 +239,6 @@
}
}
-& when (@variationProgressMultiple) {
- /* Multiple */
- .ui.multiple.progress {
- display: flex;
- }
-}
/*******************************
States
@@ -316,6 +320,12 @@
animation: progress-active @activePulseDuration @defaultEasing infinite;
transform-origin: left;
}
+ & when (@variationProgressRightAligned) {
+ .ui.active.right.aligned.progress .bar::after {
+ transform-origin: right;
+ }
+ }
+
@keyframes progress-active {
0% {
opacity: @activePulseMaxOpacity;
@@ -396,7 +406,6 @@
}
.ui.progress.attached,
.ui.progress.attached .bar {
- display: block;
height: @attachedHeight;
padding: 0;
overflow: hidden;
@@ -492,6 +501,7 @@ each(@colors, {
.ui.progress .bar .centered.progress {
text-align: center;
position: relative;
+ right: 0;
}
.ui.indeterminate.progress .bar::before {
content: '';
diff --git a/definitions/modules/rating.less b/definitions/modules/rating.less
index de95043..0c6dd55 100644
--- a/definitions/modules/rating.less
+++ b/definitions/modules/rating.less
@@ -138,6 +138,7 @@ each(@colors, {
/* disabled rating */
.ui.disabled.rating .icon {
cursor: default;
+ pointer-events: none;
}
}
diff --git a/definitions/modules/search.js b/definitions/modules/search.js
index 6f2c7ee..20501ce 100644
--- a/definitions/modules/search.js
+++ b/definitions/modules/search.js
@@ -118,7 +118,7 @@ $.fn.search = function(parameters) {
.on(module.get.inputEvent() + eventNamespace, selector.prompt, module.event.input)
;
$prompt
- .attr('autocomplete', 'off')
+ .attr('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
;
}
$module
@@ -227,9 +227,7 @@ $.fn.search = function(parameters) {
results = module.get.results(),
result = $result.data(metadata.result) || module.get.result(value, results)
;
- if(value) {
- module.set.value(value);
- }
+ var oldValue = module.get.value();
if( $.isFunction(settings.onSelect) ) {
if(settings.onSelect.call(element, result, results) === false) {
module.debug('Custom onSelect callback cancelled default select action');
@@ -238,6 +236,9 @@ $.fn.search = function(parameters) {
}
}
module.hideResults();
+ if(value && module.get.value() === oldValue) {
+ module.set.value(value);
+ }
if(href) {
event.preventDefault();
module.verbose('Opening search link found in result', $link);
@@ -251,16 +252,16 @@ $.fn.search = function(parameters) {
}
}
},
- ensureVisible: function ensureVisible($el) {
+ ensureVisible: function($el) {
var elTop, elBottom, resultsScrollTop, resultsHeight;
-
+ if($el.length === 0) {
+ return;
+ }
elTop = $el.position().top;
elBottom = elTop + $el.outerHeight(true);
resultsScrollTop = $results.scrollTop();
- resultsHeight = $results.height()
- parseInt($results.css('paddingTop'), 0) +
- parseInt($results.css('paddingBottom'), 0);
+ resultsHeight = $results.height();
if (elTop < 0) {
$results.scrollTop(resultsScrollTop + elTop);
@@ -401,6 +402,9 @@ $.fn.search = function(parameters) {
animating: function() {
return $results.hasClass(className.animating);
},
+ chrome: function() {
+ return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
+ },
hidden: function() {
return $results.hasClass(className.hidden);
},
@@ -976,9 +980,7 @@ $.fn.search = function(parameters) {
duration : settings.duration,
onShow : function() {
var $firstResult = $module.find(selector.result).eq(0);
- if($firstResult.length > 0) {
- module.ensureVisible($firstResult);
- }
+ module.ensureVisible($firstResult);
},
onComplete : function() {
callback();
diff --git a/definitions/modules/slider.js b/definitions/modules/slider.js
index 11d8ca3..77c8cbe 100644
--- a/definitions/modules/slider.js
+++ b/definitions/modules/slider.js
@@ -88,6 +88,7 @@ $.fn.slider = function(parameters) {
precision,
isTouch,
gapRatio = 1,
+ previousValue,
initialPosition,
initialLoad,
@@ -205,28 +206,26 @@ $.fn.slider = function(parameters) {
});
},
autoLabel: function() {
- if(module.get.step() != 0) {
- $labels = $module.find('.labels');
- if($labels.length != 0) {
- $labels.empty();
- }
- else {
- $labels = $module.append('
').find('.labels');
- }
- for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
- var
- labelText = module.get.label(i),
- $label = (labelText !== "")
- ? !(i % module.get.gapRatio())
- ? $('
' + labelText + '')
- : $('
')
- : null,
- ratio = i / len
- ;
- if($label) {
- module.update.labelPosition(ratio, $label);
- $labels.append($label);
- }
+ $labels = $module.find('.labels');
+ if($labels.length != 0) {
+ $labels.empty();
+ }
+ else {
+ $labels = $module.append('
').find('.labels');
+ }
+ for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
+ var
+ labelText = module.get.label(i),
+ $label = (labelText !== "")
+ ? !(i % module.get.gapRatio())
+ ? $('
' + labelText + '')
+ : $('
')
+ : null,
+ ratio = i / len
+ ;
+ if($label) {
+ module.update.labelPosition(ratio, $label);
+ $labels.append($label);
}
}
}
@@ -331,7 +330,13 @@ $.fn.slider = function(parameters) {
} else {
$currThumb = module.determine.closestThumb(newPos);
}
+ if (previousValue === undefined) {
+ previousValue = module.get.currentThumbValue();
+ }
+ } else if (previousValue === undefined) {
+ previousValue = module.get.value();
}
+
if(!module.is.disabled()) {
module.bind.slidingEvents();
}
@@ -379,6 +384,9 @@ $.fn.slider = function(parameters) {
var value = module.determine.valueFromEvent(event);
module.set.value(value);
module.unbind.slidingEvents();
+ if (previousValue !== undefined) {
+ previousValue = undefined;
+ }
},
keydown: function(event, first) {
if(settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
@@ -577,7 +585,7 @@ $.fn.slider = function(parameters) {
return settings.step;
},
numLabels: function() {
- var value = Math.round((module.get.max() - module.get.min()) / module.get.step());
+ var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
module.debug('Determined that there should be ' + value + ' labels');
return value;
},
@@ -591,7 +599,7 @@ $.fn.slider = function(parameters) {
switch (settings.labelType) {
case settings.labelTypes.number:
- return Math.round(((value * module.get.step()) + module.get.min()) * precision ) / precision;
+ return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision ) / precision;
case settings.labelTypes.letter:
return alphabet[(value) % 26];
default:
@@ -853,20 +861,31 @@ $.fn.slider = function(parameters) {
},
set: {
- value: function(newValue) {
+ value: function(newValue, fireChange) {
+ fireChange = fireChange !== false;
+ var toReset = previousValue === undefined;
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
module.update.value(newValue, function(value, thumbVal, secondThumbVal) {
- if (!initialLoad || settings.fireOnInit){
- settings.onChange.call(element, value, thumbVal, secondThumbVal);
+ if ((!initialLoad || settings.fireOnInit) && fireChange){
+ if (newValue !== previousValue) {
+ settings.onChange.call(element, value, thumbVal, secondThumbVal);
+ }
settings.onMove.call(element, value, thumbVal, secondThumbVal);
}
+ if (toReset) {
+ previousValue = undefined;
+ }
});
},
- rangeValue: function(first, second) {
+ rangeValue: function(first, second, fireChange) {
+ fireChange = fireChange !== false;
if(module.is.range()) {
var
min = module.get.min(),
- max = module.get.max()
+ max = module.get.max(),
+ toReset = previousValue === undefined
;
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
if (first <= min) {
first = min;
} else if(first >= max){
@@ -882,10 +901,15 @@ $.fn.slider = function(parameters) {
value = Math.abs(module.thumbVal - module.secondThumbVal);
module.update.position(module.thumbVal, $thumb);
module.update.position(module.secondThumbVal, $secondThumb);
- if (!initialLoad || settings.fireOnInit) {
- settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
+ if ((!initialLoad || settings.fireOnInit) && fireChange) {
+ if (value !== previousValue) {
+ settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
+ }
settings.onMove.call(element, value, module.thumbVal, module.secondThumbVal);
}
+ if (toReset) {
+ previousValue = undefined;
+ }
} else {
module.error(error.notrange);
}
diff --git a/definitions/modules/slider.less b/definitions/modules/slider.less
index 7862859..a9f2064 100644
--- a/definitions/modules/slider.less
+++ b/definitions/modules/slider.less
@@ -202,6 +202,7 @@
}
.ui.bottom.aligned.labeled.slider > .labels .label {
+ bottom: 0;
transform: translate(-50%, 100%);
}
& when (@variationSliderTicked) {
@@ -215,10 +216,11 @@
left: 50%;
}
.ui.bottom.aligned.labeled.ticked.slider > .labels .label:after {
- top: -100%;
+ top: auto;
+ bottom: 100%;
}
.ui.labeled.ticked.slider > .labels .halftick.label:after {
- height: @labelHeight / 2;
+ height: (@labelHeight / 2);
}
}
@@ -245,7 +247,7 @@
top: 50%;
}
.ui.labeled.vertical.slider > .labels .halftick.label:after {
- width: @labelHeight / 2;
+ width: (@labelHeight / 2);
height: @labelWidth;
}
@@ -387,7 +389,7 @@ each(@colors, {
height: @@lh;
}
.ui.@{value}.labeled.slider:not(.vertical) > .labels .halftick.label:after {
- height: @@lh / 2;
+ height: (@@lh / 2);
}
}
& when (@variationSliderVertical) {
@@ -406,7 +408,7 @@ each(@colors, {
width: @@lh;
}
.ui.@{value}.labeled.vertical.slider> .labels .halftick.label:after {
- width: @@lh / 2;
+ width: (@@lh / 2);
}
}
}
diff --git a/definitions/modules/toast.js b/definitions/modules/toast.js
index 02064ff..7e3a91e 100644
--- a/definitions/modules/toast.js
+++ b/definitions/modules/toast.js
@@ -144,15 +144,15 @@ $.fn.toast = function(parameters) {
create: {
container: function() {
module.verbose('Creating container');
- $context.append($('
',{class: settings.position + ' ' + className.container}));
+ $context.append($('
',{class: settings.position + ' ' + className.container + ' ' +(settings.horizontal ? className.horizontal : '')}));
},
toast: function() {
$toastBox = $('
', {class: className.box});
+ var iconClass = module.get.iconClass();
if (!isToastComponent) {
module.verbose('Creating toast');
$toast = $('
');
var $content = $('
', {class: className.content});
- var iconClass = module.get.iconClass();
if (iconClass !== '') {
$toast.append($('
', {class: iconClass + ' ' + className.icon}));
}
@@ -170,7 +170,7 @@ $.fn.toast = function(parameters) {
}));
}
- $content.append($('
', {html: module.helpers.escape(settings.message, settings.preserveHTML)}));
+ $content.append($('
', {class: className.message, html: module.helpers.escape(settings.message, settings.preserveHTML)}));
$toast
.addClass(settings.class + ' ' + className.toast)
@@ -189,6 +189,18 @@ $.fn.toast = function(parameters) {
$toast = settings.cloneModule ? $module.clone().removeAttr('id') : $module;
$close = $toast.find('> i'+module.helpers.toClass(className.close));
settings.closeIcon = ($close.length > 0);
+ if (iconClass !== '') {
+ $toast.find(selector.icon).attr('class',iconClass + ' ' + className.icon);
+ }
+ if (settings.showImage) {
+ $toast.find(selector.image).attr('src',settings.showImage);
+ }
+ if (settings.title !== '') {
+ $toast.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML));
+ }
+ if (settings.message !== '') {
+ $toast.find(selector.message).html(module.helpers.escape(settings.message, settings.preserveHTML));
+ }
}
if ($toast.hasClass(className.compact)) {
settings.compact = true;
@@ -391,7 +403,7 @@ $.fn.toast = function(parameters) {
if(settings.transition.closeEasing !== ''){
if($toastBox) {
$toastBox.css('opacity', 0);
- $toastBox.wrap('
').parent().slideUp(500, settings.transition.closeEasing, function () {
+ $toastBox.wrap('
').parent().hide(settings.transition.closeDuration, settings.transition.closeEasing, function () {
if ($toastBox) {
$toastBox.parent().remove();
callback.call($toastBox);
@@ -431,7 +443,7 @@ $.fn.toast = function(parameters) {
has: {
container: function() {
module.verbose('Determining if there is already a container');
- return ($context.find(module.helpers.toClass(settings.position) + selector.container).length > 0);
+ return ($context.find(module.helpers.toClass(settings.position) + selector.container + (settings.horizontal ? module.helpers.toClass(className.horizontal) : '')).length > 0);
},
toast: function(){
return !!module.get.toast();
@@ -750,6 +762,7 @@ $.fn.toast.settings = {
context : 'body',
position : 'top right',
+ horizontal : false,
class : 'neutral',
classProgress : false,
classActions : false,
@@ -780,7 +793,8 @@ $.fn.toast.settings = {
showDuration : 500,
hideMethod : 'scale',
hideDuration : 500,
- closeEasing : 'easeOutCubic' //Set to empty string to stack the closed toast area immediately (old behaviour)
+ closeEasing : 'easeOutCubic', //Set to empty string to stack the closed toast area immediately (old behaviour)
+ closeDuration: 500
},
error: {
@@ -798,6 +812,7 @@ $.fn.toast.settings = {
visible : 'visible',
content : 'content',
title : 'ui header',
+ message : 'message',
actions : 'actions',
extraContent : 'extra content',
button : 'ui button',
@@ -805,6 +820,7 @@ $.fn.toast.settings = {
close : 'close icon',
image : 'ui image',
vertical : 'vertical',
+ horizontal : 'horizontal',
attached : 'attached',
inverted : 'inverted',
compact : 'compact',
@@ -828,6 +844,10 @@ $.fn.toast.settings = {
container : '.ui.toast-container',
box : '.toast-box',
toast : '.ui.toast',
+ title : '.header',
+ message : '.message:not(.ui)',
+ image : '> img.image, > .image > img',
+ icon : '> i.icon',
input : 'input:not([type="hidden"]), textarea, select, button, .ui.button, ui.dropdown',
approve : '.actions .positive, .actions .approve, .actions .ok',
deny : '.actions .negative, .actions .deny, .actions .cancel'
diff --git a/definitions/modules/toast.less b/definitions/modules/toast.less
index 1949afc..6fb8ac2 100644
--- a/definitions/modules/toast.less
+++ b/definitions/modules/toast.less
@@ -25,6 +25,50 @@
.ui.toast-container {
position: fixed;
z-index: 9999;
+ &.ui.attached when (@variationToastAttached) {
+ width: 100%;
+ left: 0;
+ & .vertical.attached when (@variationToastVertical) {
+ border-radius: 0;
+ }
+ &.ui.ui .attached.actions .button when (@variationToastActions) {
+ border-radius: 0;
+ }
+ & .toast-box {
+ margin: 0;
+ width: 100%;
+ border-radius: 0;
+ & > .ui.toast,
+ > .ui.message {
+ margin-left: 0;
+ }
+ & when (@variationToastFloating) {
+ &.floating,
+ &.hoverfloating:hover {
+ border: none;
+ }
+ }
+ & > .vertical > .content when (@variationToastVertical) {
+ flex: 1;
+ }
+ & > * {
+ width: 100%;
+ border-radius: 0;
+ & > .vertical:not(.actions) when (@variationToastVertical) {
+ flex: 1;
+ }
+ }
+ & > .attached.actions when (@variationToastActions) {
+ margin-right: @toastLeftRightMargin;
+ }
+ }
+ &.top when (@variationToastTop) {
+ top: 0;
+ }
+ &.bottom when (@variationToastBottom) {
+ bottom: 0;
+ }
+ }
&.top when (@variationToastTop) {
&.right when (@variationToastRight) {
top: @toastContainerDistance;
@@ -64,6 +108,13 @@
.toast-box {
display: table !important;
}
+ &.horizontal when (@variationToastHorizontal) {
+ display: flex;
+ flex-direction: row;
+ & .toast-box {
+ margin-right: @toastBoxMarginRight;
+ }
+ }
& .toast-box {
margin-bottom: @toastBoxMarginBottom;
border-radius: @defaultBorderRadius;
@@ -81,9 +132,11 @@
border: @toastBoxBorder;
}
}
- &.compact,
- > .compact {
- width: @toastWidth;
+ & when (@variationToastCompact) {
+ &.compact,
+ > .compact {
+ width: @toastWidth;
+ }
}
& > .ui.toast,
> .ui.message {
@@ -341,9 +394,6 @@
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
- & .button:not(:first-child):not(:last-child) {
- margin-left: -@toastLeftRightMargin;
- }
}
&.message.message.message when (@variationToastMessage) {
border-top-right-radius: @toastBorderRadius;
@@ -419,8 +469,15 @@
font-size: @toastIconFontSize;
}
&:not(.vertical) {
+ &:not(.centered):not(.center) {
+ & > i.icon:not(.close) when (@variationToastIcon) {
+ position: absolute;
+ }
+ & > .ui.image when (@variationToastImage) {
+ position: absolute;
+ }
+ }
& > i.icon:not(.close) when (@variationToastIcon) {
- position: absolute;
& + .content {
padding-left: @toastIconContentPadding;
}
@@ -429,7 +486,6 @@
padding-left: @toastCloseDistance;
}
& > .ui.image when (@variationToastImage) {
- position: absolute;
&.avatar + .content {
padding-left: @toastAvatarImageContentPadding;
min-height: @toastAvatarImageHeight;
@@ -447,7 +503,7 @@
min-height: @toastSmallImageHeight;
}
}
- & when (@variationToastImage) or (@variationToastIcon) {
+ &:not(.centered):not(.center) when (@variationToastImage) or (@variationToastIcon) {
& > .centered.image,
> .centered.icon {
transform: translateY(-50%);
@@ -509,6 +565,36 @@
margin-right: auto;
}
+& when (@variationToastCentered) {
+ .ui.ui.toast-container .toast-box .centered.toast,
+ .ui.ui.toast-container .toast-box .center.aligned.toast {
+ text-align: center;
+ display: flex;
+ justify-content: center;
+
+ & > .content,
+ & > .ui.image,
+ & > i.icon:not(.close) {
+ align-self: center;
+ }
+ }
+
+ .ui.toast-container .toast-box .toast .centered.content,
+ .ui.toast-container .toast-box .toast .center.aligned.content {
+ text-align: center;
+ }
+
+ .ui.toast-container .toast-box .centered.actions,
+ .ui.toast-container .toast-box .center.aligned.actions {
+ text-align: center;
+
+ &:not(.attached) > .button:not(.fluid) {
+ margin-left: @toastActionCenteredMargin;
+ margin-right: @toastActionCenteredMargin;
+ }
+ }
+}
+
/*--------------
Colors
-------------- */
diff --git a/definitions/views/card.less b/definitions/views/card.less
index fba8aee..241e5db 100644
--- a/definitions/views/card.less
+++ b/definitions/views/card.less
@@ -419,6 +419,63 @@
color: @extraLinkHoverColor;
}
+/*******************************
+ States
+*******************************/
+
+& when (@variationCardDisabled) {
+ /*--------------
+ Disabled
+ ---------------*/
+
+ .ui.disabled.card {
+ opacity: @disabledOpacity;
+ color: @disabledTextColor;
+ pointer-events: none;
+ }
+}
+
+& when (@variationCardLoading) {
+ /*--------------
+ Loading
+ ---------------*/
+
+ .ui.loading.card {
+ position: relative;
+ cursor: default;
+ pointer-events: none;
+ transition: all 0s linear;
+ }
+ .ui.loading.card:before {
+ position: absolute;
+ content: '';
+ top: 0;
+ left: 0;
+ background: @loaderDimmerColor;
+ width: 100%;
+ height: 100%;
+ border-radius: @borderRadius;
+ z-index: @loaderDimmerZIndex;
+ }
+ .ui.loading.card:after {
+ position: absolute;
+ content: '';
+ top: 50%;
+ left: 50%;
+
+ margin: @loaderMargin;
+ width: @loaderSize;
+ height: @loaderSize;
+
+ animation: loader @loaderSpeed infinite linear;
+ border: @loaderLineWidth solid @loaderLineColor;
+ border-radius: @circularRadius;
+
+ box-shadow: 0 0 0 1px transparent;
+ visibility: visible;
+ z-index: @loaderLineZIndex;
+ }
+}
/*******************************
Variations
@@ -457,7 +514,6 @@
display: -webkit-flex;
display: flex;
width: 100%;
- height: 100%;
border-radius: @defaultBorderRadius 0 0 @defaultBorderRadius;
}
.ui.horizontal.cards > .card > .image:last-child > img,
@@ -465,6 +521,7 @@
border-radius: 0 @defaultBorderRadius @defaultBorderRadius 0;
}
.ui.horizontal.cards > .card > .content, .ui.horizontal.card > .content {
+ border-top: none;
flex-basis: 1px;
}
.ui.horizontal.cards > .card > .extra, .ui.horizontal.card > .extra {
@@ -929,6 +986,13 @@ each(@colors,{
.ui.inverted.card > .content > .header {
color: @invertedHeaderColor;
}
+ .ui.inverted.cards > .card > .content > a.header,
+ .ui.inverted.card > .content > a.header {
+ color: @invertedHeaderLinkColor;
+ &:hover {
+ color: @invertedHeaderLinkHoverColor;
+ }
+ }
/* Description */
.ui.inverted.cards > .card > .content > .description,
@@ -972,6 +1036,16 @@ each(@colors,{
.ui.inverted.link.card:hover {
background: @invertedLinkHoverBackground;
}
+
+ & when (@variationCardLoading) {
+ /* Loading */
+ .ui.inverted.loading.card {
+ color: @invertedLoaderLineColor;
+ }
+ .ui.inverted.loading.card:before {
+ background: @loaderInvertedDimmerColor;
+ }
+ }
}
diff --git a/theme.less b/theme.less
index 2555c43..52952c4 100644
--- a/theme.less
+++ b/theme.less
@@ -61,7 +61,7 @@
-------------------*/
.loadFonts() when (@importGoogleFonts) {
- @import (css) url('@{googleProtocol}fonts.googleapis.com/css?family=@{googleFontRequest}');
+ @import (css) url('@{googleProtocol}fonts.googleapis.com/css2?family=@{googleFontRequest}');
}
/*------------------
diff --git a/themes/default/collections/grid.variables b/themes/default/collections/grid.variables
index d286072..5533f9e 100644
--- a/themes/default/collections/grid.variables
+++ b/themes/default/collections/grid.variables
@@ -74,18 +74,18 @@
/*--------------
Compact
---------------*/
-@compactGutterWidth: @gutterWidth / 2;
-@compactRowSpacing: @rowSpacing / 2;
-@compactCelledRelaxedPadding: @celledRelaxedPadding / 2;
-@compactCelledVeryRelaxedPadding: @celledVeryRelaxedPadding / 2;
+@compactGutterWidth: (@gutterWidth / 2);
+@compactRowSpacing: (@rowSpacing / 2);
+@compactCelledRelaxedPadding: (@celledRelaxedPadding / 2);
+@compactCelledVeryRelaxedPadding: (@celledVeryRelaxedPadding / 2);
/*------------------
Very Compact
------------------*/
-@veryCompactGutterWidth: @compactGutterWidth / 2;
-@veryCompactRowSpacing: @compactRowSpacing / 2;
-@veryCompactCelledRelaxedPadding: @compactCelledRelaxedPadding / 2;
-@veryCompactCelledVeryRelaxedPadding: @compactCelledVeryRelaxedPadding / 2;
+@veryCompactGutterWidth: (@compactGutterWidth / 2);
+@veryCompactRowSpacing: (@compactRowSpacing / 2);
+@veryCompactCelledRelaxedPadding: (@compactCelledRelaxedPadding / 2);
+@veryCompactCelledVeryRelaxedPadding: (@compactCelledVeryRelaxedPadding / 2);
/*******************************
diff --git a/themes/default/collections/table.variables b/themes/default/collections/table.variables
index 03f2b8e..877bbc7 100644
--- a/themes/default/collections/table.variables
+++ b/themes/default/collections/table.variables
@@ -202,7 +202,7 @@
/* Colors */
@coloredBorderSize: 0.2em;
@coloredBorderRadius: 0 0 @borderRadius @borderRadius;
-@coloredBorderSizeCover: @coloredBorderSize / 2;
+@coloredBorderSizeCover: (@coloredBorderSize / 2);
/* Inverted */
@invertedBackground: #333333;
diff --git a/themes/default/elements/header.variables b/themes/default/elements/header.variables
index db32147..c85189b 100644
--- a/themes/default/elements/header.variables
+++ b/themes/default/elements/header.variables
@@ -73,9 +73,9 @@
--------------------*/
/* Sizing */
-@massiveFontSize: unit(32 / 14, em);
+@massiveFontSize: unit((32 / 14), em);
@hugeFontSize : unit(@h1, em);
-@bigFontSize : unit(26 / 14, em);
+@bigFontSize : unit((26 / 14), em);
@largeFontSize : unit(@h2, em);
@mediumFontSize : unit(@h3, em);
@smallFontSize : unit(@h4, em);
diff --git a/themes/default/elements/icon.variables b/themes/default/elements/icon.variables
index 73c88e0..7cc585e 100644
--- a/themes/default/elements/icon.variables
+++ b/themes/default/elements/icon.variables
@@ -70,6 +70,8 @@
@borderedHorizontalPadding: 0;
@borderedShadow: 0 0 0 0.1em rgba(0, 0, 0, 0.1) inset;
+@coloredBoxShadow: 0 0 0 0.1em currentColor inset;
+
@cornerIconSize: 0.45em;
@cornerIconStroke: 1px;
@cornerIconShadow:
@@ -85,6 +87,9 @@
@cornerIconStroke @cornerIconStroke 0 @black
;
+@cornerOffset: 0;
+@borderedGroupCornerOffset: 1.15em;
+
@mini: 0.4em;
@tiny: 0.5em;
@small: 0.75em;
diff --git a/themes/default/elements/list.variables b/themes/default/elements/list.variables
index 13c45e7..1206f30 100644
--- a/themes/default/elements/list.variables
+++ b/themes/default/elements/list.variables
@@ -47,7 +47,7 @@
/* Content */
@contentDistance: 0.5em;
@contentLineHeight: @itemLineHeight;
-@contentLineHeightOffset: (@contentLineHeight - 1em) / 2;
+@contentLineHeightOffset: ((@contentLineHeight - 1em) / 2);
@contentVerticalAlign: top;
@contentColor: @textColor;
diff --git a/themes/default/globals/colors.less b/themes/default/globals/colors.less
index bc2b12c..a010bc8 100644
--- a/themes/default/globals/colors.less
+++ b/themes/default/globals/colors.less
@@ -483,7 +483,7 @@
isDark : true;
isVeryDark : true;
};
-}
+};
/***********************************************************
Color Mapping Base for form components to iterate
@@ -497,6 +497,7 @@
borderRadius: @inputErrorBorderRadius;
boxShadow: @inputErrorBoxShadow;
cornerLabelColor: @white;
+ labelBackground: @formErrorLabelBackground;
dropdownLabelColor: @dropdownErrorLabelColor;
dropdownLabelBackground: @dropdownErrorLabelBackground;
@@ -524,6 +525,7 @@
borderRadius: @inputInfoBorderRadius;
boxShadow: @inputInfoBoxShadow;
cornerLabelColor: @white;
+ labelBackground: @formInfoLabelBackground;
dropdownLabelColor: @dropdownInfoLabelColor;
dropdownLabelBackground: @dropdownInfoLabelBackground;
@@ -551,6 +553,7 @@
borderRadius: @inputSuccessBorderRadius;
boxShadow: @inputSuccessBoxShadow;
cornerLabelColor: @white;
+ labelBackground: @formSuccessLabelBackground;
dropdownLabelColor: @dropdownSuccessLabelColor;
dropdownLabelBackground: @dropdownSuccessLabelBackground;
@@ -578,6 +581,7 @@
borderRadius: @inputWarningBorderRadius;
boxShadow: @inputWarningBoxShadow;
cornerLabelColor: @white;
+ labelBackground: @formWarningLabelBackground;
dropdownLabelColor: @dropdownWarningLabelColor;
dropdownLabelBackground: @dropdownWarningLabelBackground;
@@ -597,7 +601,7 @@
transparentBackground: @transparentFormWarningBackground;
transparentColor: @transparentFormWarningColor;
};
-}
+};
@textStates: {
@error: {
@@ -612,4 +616,4 @@
@warning: {
color: @warningColor;
};
-}
+};
diff --git a/themes/default/globals/site.variables b/themes/default/globals/site.variables
index f2b9935..1ad0394 100644
--- a/themes/default/globals/site.variables
+++ b/themes/default/globals/site.variables
@@ -15,7 +15,7 @@
@googleFontName : @fontName;
@importGoogleFonts : true;
-@googleFontSizes : '400,700,400italic,700italic';
+@googleFontSizes : 'ital,wght@0,400%3B0,700%3B1,400%3B1,700';
@googleSubset : 'latin';
@googleFontDisplay : 'swap';
@@ -645,14 +645,14 @@
This rounds @size values to the closest pixel then expresses that value in (r)em.
This ensures all size values round to exact pixels
*/
-@miniRaw : unit( round(@miniSize * @emSize) / @emSize );
-@tinyRaw : unit( round(@tinySize * @emSize) / @emSize );
-@smallRaw : unit( round(@smallSize * @emSize) / @emSize );
-@mediumRaw : unit( round(@mediumSize * @emSize) / @emSize );
-@largeRaw : unit( round(@largeSize * @emSize) / @emSize );
-@bigRaw : unit( round(@bigSize * @emSize) / @emSize );
-@hugeRaw : unit( round(@hugeSize * @emSize) / @emSize );
-@massiveRaw : unit( round(@massiveSize * @emSize) / @emSize );
+@miniRaw : unit( (round(@miniSize * @emSize) / @emSize ));
+@tinyRaw : unit( (round(@tinySize * @emSize) / @emSize ));
+@smallRaw : unit( (round(@smallSize * @emSize) / @emSize ));
+@mediumRaw : unit( (round(@mediumSize * @emSize) / @emSize ));
+@largeRaw : unit( (round(@largeSize * @emSize) / @emSize ));
+@bigRaw : unit( (round(@bigSize * @emSize) / @emSize ));
+@hugeRaw : unit( (round(@hugeSize * @emSize) / @emSize ));
+@massiveRaw : unit( (round(@massiveSize * @emSize) / @emSize ));
@mini : unit( @miniRaw, rem);
@tiny : unit( @tinyRaw, rem);
@@ -766,7 +766,7 @@
/* Used to match floats with text */
@lineHeightOffset : ((@lineHeight - 1em) / 2);
-@headerLineHeightOffset : (@headerLineHeight - 1em) / 2;
+@headerLineHeightOffset : ((@headerLineHeight - 1em) / 2);
/* Header Spacing */
@headerTopMargin : e(%("calc(2rem - %d)", @headerLineHeightOffset));
@@ -1346,24 +1346,28 @@
@formErrorColor: @negativeTextColor;
@formErrorBorder: @negativeBorderColor;
@formErrorBackground: @negativeBackgroundColor;
+@formErrorLabelBackground: darken(@formErrorBorder, -8);
@transparentFormErrorColor: @formErrorColor;
@transparentFormErrorBackground: @formErrorBackground;
@formInfoColor: @infoTextColor;
@formInfoBorder: @infoBorderColor;
@formInfoBackground: @infoBackgroundColor;
+@formInfoLabelBackground: darken(@formInfoBorder, -8);
@transparentFormInfoColor: @formInfoColor;
@transparentFormInfoBackground: @formInfoBackground;
@formSuccessColor: @positiveTextColor;
@formSuccessBorder: @positiveBorderColor;
@formSuccessBackground: @positiveBackgroundColor;
+@formSuccessLabelBackground: darken(@formSuccessBorder, -8);
@transparentFormSuccessColor: @formSuccessColor;
@transparentFormSuccessBackground: @formSuccessBackground;
@formWarningColor: @warningTextColor;
@formWarningBorder: @warningBorderColor;
@formWarningBackground: @warningBackgroundColor;
+@formWarningLabelBackground: darken(@formWarningBorder, -8);
@transparentFormWarningColor: @formWarningColor;
@transparentFormWarningBackground: @formWarningBackground;
diff --git a/themes/default/globals/variation.variables b/themes/default/globals/variation.variables
index fcef751..bc6e79d 100644
--- a/themes/default/globals/variation.variables
+++ b/themes/default/globals/variation.variables
@@ -26,6 +26,7 @@
@variationButtonFluid: true;
@variationButtonCircular: true;
@variationButtonGroups: true;
+@variationButtonStackable: true;
@variationButtonSizes: @variationAllSizes;
/* Container */
@@ -70,6 +71,7 @@
@variationIconLink: true;
@variationIconCircular: true;
@variationIconBordered: true;
+@variationIconColored: true;
@variationIconRotated: true;
@variationIconFlipped: true;
@variationIconCorner: true;
@@ -273,6 +275,8 @@
@variationMessageIcon: true;
@variationMessageFloating: true;
@variationMessageConsequences: true;
+@variationMessageCentered: true;
+@variationMessageRightAligned: true;
@variationMessageSizes: @variationAllSizes;
/* Table */
@@ -321,6 +325,8 @@
/* Card */
@variationCardInverted: true;
+@variationCardDisabled: true;
+@variationCardLoading: true;
@variationCardHorizontal: true;
@variationCardRaised: true;
@variationCardCentered: true;
@@ -373,12 +379,14 @@
/* Checkbox */
@variationCheckboxBox: false; //.box (instead of label) is an ancient fragment of sui v1 and not even documented in v2.x anymore
@variationCheckboxDisabled: true;
+@variationCheckboxReadonly: true;
@variationCheckboxInverted: true;
@variationCheckboxRadio: true;
@variationCheckboxSlider: true;
@variationCheckboxToggle: true;
@variationCheckboxIndeterminate: true;
@variationCheckboxFitted: true;
+@variationCheckboxRightAligned: true;
@variationCheckboxSizes: @variationAllSizes;
/* Dimmer */
@@ -395,6 +403,7 @@
/* Dropdown */
@variationDropdownInverted: true;
@variationDropdownDisabled: true;
+@variationDropdownReadonly: true;
@variationDropdownLabel: true;
@variationDropdownButton: true;
@variationDropdownSelection: true;
@@ -431,6 +440,14 @@
@variationModalCloseInside: true;
@variationModalSizes: @variationAllSizes;
+/* Nag */
+@variationNagInverted: true;
+@variationNagBottom: true;
+@variationNagOverlay: true;
+@variationNagFixed: true;
+@variationNagGroups: true;
+@variationNagSizes: @variationAllSizes;
+
/* Popup */
@variationPopupInverted: true;
@variationPopupTooltip: true;
@@ -463,6 +480,7 @@
@variationProgressActive: true;
@variationProgressAttached: true;
@variationProgressSpeeds: true;
+@variationProgressRightAligned: true;
@variationProgressSizes: @variationAllSizes;
/* Rating */
@@ -524,6 +542,7 @@
@variationToastWarning: true;
@variationToastSuccess: true;
@variationToastError: true;
+@variationToastHorizontal: true;
@variationToastFloating: true;
@variationToastProgress: true;
@variationToastIcon: true;
@@ -534,6 +553,8 @@
@variationToastActions: true;
@variationToastVertical: true;
@variationToastAttached: true;
+@variationToastCompact: true;
+@variationToastCentered: true;
/* Transition */
@variationTransitionDisabled: true;
diff --git a/themes/default/modules/checkbox.variables b/themes/default/modules/checkbox.variables
index cf441e6..61b9cf8 100644
--- a/themes/default/modules/checkbox.variables
+++ b/themes/default/modules/checkbox.variables
@@ -114,8 +114,9 @@
@sliderLineWidth: 3.5rem;
@sliderTransitionDuration: 0.3s;
-@sliderHandleOffset: (1rem - @sliderHandleSize) / 2;
+@sliderHandleOffset: ((1rem - @sliderHandleSize) / 2);
@sliderHandleTransition: left @sliderTransitionDuration @defaultEasing;
+@sliderHandleTransitionRightAligned: right @sliderTransitionDuration @defaultEasing;
@sliderWidth: @sliderLineWidth;
@sliderHeight: (@sliderHandleSize + @sliderHandleOffset);
@@ -159,6 +160,10 @@
background @sliderTransitionDuration @defaultEasing,
left @sliderTransitionDuration @defaultEasing
;
+@toggleHandleTransitionRightAligned:
+ background @sliderTransitionDuration @defaultEasing,
+ right @sliderTransitionDuration @defaultEasing
+;
@toggleLaneBackground: @transparentBlack;
@toggleLaneHeight: @toggleHandleSize;
@@ -166,7 +171,7 @@
@toggleLaneVerticalOffset: 0;
@toggleOffOffset: -0.05rem;
@toggleOnOffset: (@toggleLaneWidth - @toggleHandleSize) + 0.15rem;
-@toggleCenterOffset: @toggleOnOffset / 2;
+@toggleCenterOffset: (@toggleOnOffset / 2);
@toggleCenterLaneBackground: @veryStrongTransparentBlack;
@toggleLabelDistance: @toggleLaneWidth + 1rem;
@@ -198,23 +203,23 @@
@checkboxInvertedHoverBackground: @black;
@miniCheckboxSize: @relativeMini;
-@miniCheckboxCircleScale: @miniRaw / 2;
-@miniCheckboxCircleLeft: unit((@miniRaw - @miniCheckboxCircleScale) / 2 + 0.05 , em);
+@miniCheckboxCircleScale: (@miniRaw / 2);
+@miniCheckboxCircleLeft: unit(((@miniRaw - @miniCheckboxCircleScale) / 2) + 0.05 , em);
@tinyCheckboxSize: @relativeTiny;
-@tinyCheckboxCircleScale: @tinyRaw / 2;
-@tinyCheckboxCircleLeft: unit((@tinyRaw - @tinyCheckboxCircleScale) / 2 + 0.05 , em);
+@tinyCheckboxCircleScale: (@tinyRaw / 2);
+@tinyCheckboxCircleLeft: unit(((@tinyRaw - @tinyCheckboxCircleScale) / 2) + 0.05 , em);
@smallCheckboxSize: @relativeSmall;
-@smallCheckboxCircleScale: @smallRaw / 2;
-@smallCheckboxCircleLeft: unit((@smallRaw - @smallCheckboxCircleScale) / 2 + 0.05 , em);
+@smallCheckboxCircleScale: (@smallRaw / 2);
+@smallCheckboxCircleLeft: unit(((@smallRaw - @smallCheckboxCircleScale) / 2) + 0.05 , em);
@largeCheckboxSize: @relativeLarge;
-@largeCheckboxCircleScale: @largeRaw / 2;
-@largeCheckboxCircleLeft: unit((@largeRaw - @largeCheckboxCircleScale) / 2 + 0.05 , em);
+@largeCheckboxCircleScale: (@largeRaw / 2);
+@largeCheckboxCircleLeft: unit(((@largeRaw - @largeCheckboxCircleScale) / 2) + 0.05 , em);
@bigCheckboxSize: @relativeBig;
-@bigCheckboxCircleScale: @bigRaw / 2;
-@bigCheckboxCircleLeft: unit((@bigRaw - @bigCheckboxCircleScale) / 2 + 0.05 , em);
+@bigCheckboxCircleScale: (@bigRaw / 2);
+@bigCheckboxCircleLeft: unit(((@bigRaw - @bigCheckboxCircleScale) / 2) + 0.05 , em);
@hugeCheckboxSize: @relativeHuge;
-@hugeCheckboxCircleScale: @hugeRaw / 2;
-@hugeCheckboxCircleLeft: unit((@hugeRaw - @hugeCheckboxCircleScale) / 2 + 0.05 , em);
+@hugeCheckboxCircleScale: (@hugeRaw / 2);
+@hugeCheckboxCircleLeft: unit(((@hugeRaw - @hugeCheckboxCircleScale) / 2) + 0.05 , em);
@massiveCheckboxSize: @relativeMassive;
-@massiveCheckboxCircleScale: @massiveRaw / 2;
-@massiveCheckboxCircleLeft: unit((@massiveRaw - @massiveCheckboxCircleScale) / 2 + 0.05 , em);
+@massiveCheckboxCircleScale: (@massiveRaw / 2);
+@massiveCheckboxCircleLeft: unit(((@massiveRaw - @massiveCheckboxCircleScale) / 2) + 0.05 , em);
diff --git a/themes/default/modules/dropdown.variables b/themes/default/modules/dropdown.variables
index 5ab5349..68f0f23 100644
--- a/themes/default/modules/dropdown.variables
+++ b/themes/default/modules/dropdown.variables
@@ -21,6 +21,7 @@
/* Icon */
@dropdownIconSize: @relative12px;
@dropdownIconMargin: 0 0 0 1em;
+@dropdownIconMinWidth: 1em;
/* Current Text */
@textTransition: none;
@@ -98,12 +99,12 @@
/* Menu Image */
@menuImageMaxHeight: 2em;
-@menuImageVerticalMargin: -(@menuImageMaxHeight - 1em) / 2;
+@menuImageVerticalMargin: (-(@menuImageMaxHeight - 1em) / 2);
/* Item Sub-Element */
@itemElementFloat: none;
@itemElementDistance: @mini;
-@itemElementBottomDistance: @itemElementDistance / 2;
+@itemElementBottomDistance: (@itemElementDistance / 2);
/* Sub-Menu Dropdown Icon */
@itemDropdownIconDistance: 1em;
@@ -165,7 +166,7 @@
@selectionIconZIndex: 3;
@selectionIconHitbox: @selectionVerticalPadding;
@selectionIconMargin: -@selectionIconHitbox;
-@selectionIconPadding: @selectionIconHitbox / @dropdownIconSize;
+@selectionIconPadding: (@selectionIconHitbox / @dropdownIconSize);
@selectionIconTransition: opacity @defaultDuration @defaultEasing;
@selectionMenuBorderRadius: 0 0 @borderRadius @borderRadius;
@@ -310,8 +311,14 @@
@selectedColor: @selectedTextColor;
/* Clearable */
-@clearableIconOpacity: 0.8;
+@clearableIconOpacity: 0.6;
@clearableIconActiveOpacity: 1;
+@clearableTextMargin: 1.5em;
+@clearableIconMargin: 1.5em;
+@clearableIconMarginTop: 1.35em;
+@clearableIconPosition: 2em;
+@clearableIconSelectionPosition: 3em;
+@clearableIconInlinePosition: 2.2em;
/*-------------------
Variations
diff --git a/themes/default/modules/modal.variables b/themes/default/modules/modal.variables
index 15fa630..203d081 100644
--- a/themes/default/modules/modal.variables
+++ b/themes/default/modules/modal.variables
@@ -19,7 +19,7 @@
@closeHitbox: 2.25rem;
@closeDistance: 0.25rem;
-@closeHitBoxOffset: (@closeHitbox - 1rem) / 2;
+@closeHitBoxOffset: ((@closeHitbox - 1rem) / 2);
@closePadding: @closeHitBoxOffset 0 0 0;
@closeTop: -(@closeDistance + @closeHitbox);
@closeRight: -(@closeDistance + @closeHitbox);
@@ -60,6 +60,7 @@
@actionAlign: right;
@buttonDistance: 0.75em;
+@buttonCenteredDistance: 0.5em;
/* Inner Close Position (Tablet/Mobile) */
@innerCloseTop: (@headerVerticalPadding - @closeHitBoxOffset + (@lineHeight - 1em));
@@ -91,7 +92,7 @@
@widescreenMonitorMargin: 0 0 0 0;
@fullScreenWidth: 95%;
-@fullScreenOffset: (100% - @fullScreenWidth) / 2;
+@fullScreenOffset: ((100% - @fullScreenWidth) / 2);
@fullScreenMargin: 1em auto;
/* Coupling */
diff --git a/themes/default/modules/nag.variables b/themes/default/modules/nag.variables
index 25da572..9d38455 100644
--- a/themes/default/modules/nag.variables
+++ b/themes/default/modules/nag.variables
@@ -11,7 +11,7 @@
@zIndex: 999;
@margin: 0;
-@background: #555555;
+@background: #777777;
@opacity: 0.95;
@minHeight: 0;
@padding: 0.75em 1em;
@@ -65,6 +65,8 @@
/* Inverted */
@invertedBackground: @darkWhite;
+@invertedTitleColor: @mutedTextColor;
+@invertedCloseColor: @mutedTextColor;
/*--------------
Plural
diff --git a/themes/default/modules/progress.variables b/themes/default/modules/progress.variables
index 83c14af..eb9f6fe 100644
--- a/themes/default/modules/progress.variables
+++ b/themes/default/modules/progress.variables
@@ -44,6 +44,8 @@
@progressTextShadow: none;
@progressFontWeight: @bold;
@progressTextAlign: left;
+@progressRightAlignedRight: @progressLeft;
+@progressRightAlignedLeft: @progressRight;
/* Label */
@labelWidth: 100%;
diff --git a/themes/default/modules/toast.variables b/themes/default/modules/toast.variables
index 5c73151..c827848 100644
--- a/themes/default/modules/toast.variables
+++ b/themes/default/modules/toast.variables
@@ -12,6 +12,7 @@
@toastMarginBottom: -0.01em;
@toastLeftRightMargin: 1px;
@toastBoxMarginBottom: 0.5em;
+@toastBoxMarginRight: @toastBoxMarginBottom;
@toastMarginProgress: -0.2em;
@toastMargin: 0 -@toastLeftRightMargin @toastMarginBottom;
@toastTextColor: @invertedTextColor;
@@ -80,4 +81,5 @@
@toastActionMarginLeft: 1em;
@toastActionMarginBottom: 0.3em;
@toastActionPadding: 0.5em;
-@toastActionPaddingBottom: 0.75em;
\ No newline at end of file
+@toastActionPaddingBottom: 0.75em;
+@toastActionCenteredMargin: 0.25em;
\ No newline at end of file
diff --git a/themes/default/views/card.variables b/themes/default/views/card.variables
index c99c2c5..bca428f 100644
--- a/themes/default/views/card.variables
+++ b/themes/default/views/card.variables
@@ -73,7 +73,7 @@
@headerMargin: '';
@headerFontWeight: @bold;
@headerFontSize: @relativeBig;
-@headerLineHeightOffset: -(@lineHeight - 1em) / 2;
+@headerLineHeightOffset: (-(@lineHeight - 1em) / 2);
@headerColor: @darkTextColor;
/* Metadata */
@@ -143,6 +143,19 @@
@buttonMargin: 0 -@borderWidth;
@buttonWidth: e(%("calc(100%% + %d)", @borderWidth * 2));
+/*******************************
+ States
+*******************************/
+
+/* Loading Dimmer */
+@loaderDimmerColor: rgba(255, 255, 255, 0.8);
+@loaderInvertedDimmerColor: rgba(0, 0, 0 , 0.85);
+@loaderDimmerZIndex: 100;
+
+/* Loading Spinner */
+@loaderSize: 3em;
+@loaderLineZIndex: 101;
+
/*-------------------
Variations
--------------------*/
@@ -227,6 +240,8 @@
@invertedBackground: @black;
@invertedContentDivider: @borderWidth solid rgba(255, 255, 255, 0.15);
@invertedHeaderColor: @invertedTextColor;
+@invertedHeaderLinkColor: @invertedTextColor;
+@invertedHeaderLinkHoverColor: @linkHoverColor;
@invertedDescriptionColor: @invertedMutedTextColor;
@invertedMetaColor: @invertedLightTextColor;
@invertedMetaLinkColor: @invertedLightTextColor;