semantic-ui-sass 1.7.3.0 → 1.8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/semantic-ui/api.js +22 -11
- data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
- data/app/assets/javascripts/semantic-ui/dropdown.js +204 -105
- data/app/assets/javascripts/semantic-ui/form.js +259 -43
- data/app/assets/javascripts/semantic-ui/popup.js +4 -3
- data/app/assets/javascripts/semantic-ui/search.js +310 -152
- data/app/assets/javascripts/semantic-ui/sidebar.js +18 -7
- data/app/assets/javascripts/semantic-ui/sticky.js +1 -1
- data/app/assets/javascripts/semantic-ui/transition.js +35 -23
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +31 -1
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +21 -20
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +15 -3
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +70 -31
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +11 -8
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +9 -19
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +55 -28
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +5 -2
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1557 -538
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
- data/lib/semantic/ui/sass/version.rb +2 -2
- metadata +2 -2
@@ -40,17 +40,21 @@ $.fn.form = function(fields, parameters) {
|
|
40
40
|
$allModules
|
41
41
|
.each(function() {
|
42
42
|
var
|
43
|
-
$module
|
44
|
-
$field
|
45
|
-
$group
|
46
|
-
$message
|
47
|
-
$prompt
|
48
|
-
$submit = $(this).find(selector.submit),
|
43
|
+
$module = $(this),
|
44
|
+
$field = $(this).find(selector.field),
|
45
|
+
$group = $(this).find(selector.group),
|
46
|
+
$message = $(this).find(selector.message),
|
47
|
+
$prompt = $(this).find(selector.prompt),
|
49
48
|
|
50
|
-
|
49
|
+
$submit = $(this).find(selector.submit),
|
50
|
+
$clear = $(this).find(selector.clear),
|
51
|
+
$reset = $(this).find(selector.reset),
|
51
52
|
|
52
|
-
|
53
|
-
|
53
|
+
formErrors = [],
|
54
|
+
keyHeldDown = false,
|
55
|
+
|
56
|
+
element = this,
|
57
|
+
instance = $module.data(moduleNamespace),
|
54
58
|
module
|
55
59
|
;
|
56
60
|
|
@@ -59,6 +63,7 @@ $.fn.form = function(fields, parameters) {
|
|
59
63
|
initialize: function() {
|
60
64
|
module.verbose('Initializing form validation', $module, validation, settings);
|
61
65
|
module.bindEvents();
|
66
|
+
module.set.defaults();
|
62
67
|
module.instantiate();
|
63
68
|
},
|
64
69
|
|
@@ -101,7 +106,6 @@ $.fn.form = function(fields, parameters) {
|
|
101
106
|
},
|
102
107
|
|
103
108
|
bindEvents: function() {
|
104
|
-
|
105
109
|
if(settings.keyboardShortcuts) {
|
106
110
|
$field
|
107
111
|
.on('keydown' + eventNamespace, module.event.field.keydown)
|
@@ -113,8 +117,11 @@ $.fn.form = function(fields, parameters) {
|
|
113
117
|
$field
|
114
118
|
.on('blur' + eventNamespace, module.event.field.blur)
|
115
119
|
;
|
116
|
-
|
120
|
+
|
121
|
+
// attach events to common elements
|
117
122
|
module.attachEvents($submit, 'submit');
|
123
|
+
module.attachEvents($reset, 'reset');
|
124
|
+
module.attachEvents($clear, 'clear');
|
118
125
|
|
119
126
|
$field
|
120
127
|
.each(function() {
|
@@ -129,6 +136,78 @@ $.fn.form = function(fields, parameters) {
|
|
129
136
|
;
|
130
137
|
},
|
131
138
|
|
139
|
+
clear: function() {
|
140
|
+
$field
|
141
|
+
.each(function () {
|
142
|
+
var
|
143
|
+
$field = $(this),
|
144
|
+
$element = $field.parent(),
|
145
|
+
$fieldGroup = $field.closest($group),
|
146
|
+
$prompt = $fieldGroup.find(selector.prompt),
|
147
|
+
defaultValue = $field.data(metadata.defaultValue) || '',
|
148
|
+
isCheckbox = $element.is(selector.uiCheckbox),
|
149
|
+
isDropdown = $element.is(selector.uiDropdown),
|
150
|
+
isErrored = $fieldGroup.hasClass(className.error)
|
151
|
+
;
|
152
|
+
if(isErrored) {
|
153
|
+
module.verbose('Resetting error on field', $fieldGroup);
|
154
|
+
$fieldGroup.removeClass(className.error);
|
155
|
+
$prompt.remove();
|
156
|
+
}
|
157
|
+
if(isDropdown) {
|
158
|
+
module.verbose('Resetting dropdown value', $element, defaultValue);
|
159
|
+
$element.dropdown('clear');
|
160
|
+
}
|
161
|
+
else if(isCheckbox) {
|
162
|
+
$element.checkbox('uncheck');
|
163
|
+
}
|
164
|
+
else {
|
165
|
+
module.verbose('Resetting field value', $field, defaultValue);
|
166
|
+
$field.val('');
|
167
|
+
}
|
168
|
+
})
|
169
|
+
;
|
170
|
+
},
|
171
|
+
|
172
|
+
reset: function() {
|
173
|
+
$field
|
174
|
+
.each(function () {
|
175
|
+
var
|
176
|
+
$field = $(this),
|
177
|
+
$element = $field.parent(),
|
178
|
+
$fieldGroup = $field.closest($group),
|
179
|
+
$prompt = $fieldGroup.find(selector.prompt),
|
180
|
+
defaultValue = $field.data(metadata.defaultValue) || '',
|
181
|
+
isCheckbox = $element.is(selector.uiCheckbox),
|
182
|
+
isDropdown = $element.is(selector.uiDropdown),
|
183
|
+
isErrored = $fieldGroup.hasClass(className.error)
|
184
|
+
;
|
185
|
+
if(isErrored) {
|
186
|
+
module.verbose('Resetting error on field', $fieldGroup);
|
187
|
+
$fieldGroup.removeClass(className.error);
|
188
|
+
$prompt.remove();
|
189
|
+
}
|
190
|
+
if(isDropdown) {
|
191
|
+
module.verbose('Resetting dropdown value', $element, defaultValue);
|
192
|
+
$element.dropdown('restore defaults');
|
193
|
+
}
|
194
|
+
else if(isCheckbox) {
|
195
|
+
module.verbose('Resetting checkbox value', $element, defaultValue);
|
196
|
+
if(defaultValue === true) {
|
197
|
+
$element.checkbox('check');
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
$element.checkbox('uncheck');
|
201
|
+
}
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
module.verbose('Resetting field value', $field, defaultValue);
|
205
|
+
$field.val(defaultValue);
|
206
|
+
}
|
207
|
+
})
|
208
|
+
;
|
209
|
+
},
|
210
|
+
|
132
211
|
removeEvents: function() {
|
133
212
|
$module
|
134
213
|
.off(eventNamespace)
|
@@ -162,19 +241,22 @@ $.fn.form = function(fields, parameters) {
|
|
162
241
|
;
|
163
242
|
}
|
164
243
|
if(!event.ctrlKey && key == keyCode.enter && $field.is(selector.input) && $field.not(selector.checkbox).length > 0 ) {
|
165
|
-
module.debug('Enter key pressed, submitting form');
|
166
244
|
$submit
|
167
|
-
.addClass(className.
|
168
|
-
;
|
169
|
-
$field
|
170
|
-
.one('keyup' + eventNamespace, module.event.field.keyup)
|
245
|
+
.addClass(className.pressed)
|
171
246
|
;
|
247
|
+
if(!keyHeldDown) {
|
248
|
+
$field
|
249
|
+
.one('keyup' + eventNamespace, module.event.field.keyup)
|
250
|
+
;
|
251
|
+
module.submit();
|
252
|
+
module.debug('Enter pressed on input submitting form');
|
253
|
+
}
|
254
|
+
keyHeldDown = true;
|
172
255
|
}
|
173
256
|
},
|
174
257
|
keyup: function() {
|
175
|
-
|
176
|
-
$submit.removeClass(className.
|
177
|
-
module.submit();
|
258
|
+
keyHeldDown = false;
|
259
|
+
$submit.removeClass(className.pressed);
|
178
260
|
},
|
179
261
|
blur: function() {
|
180
262
|
var
|
@@ -212,14 +294,17 @@ $.fn.form = function(fields, parameters) {
|
|
212
294
|
return 'change';
|
213
295
|
}
|
214
296
|
else {
|
215
|
-
return
|
216
|
-
? 'input'
|
217
|
-
: (document.createElement('input').onpropertychange !== undefined)
|
218
|
-
? 'propertychange'
|
219
|
-
: 'keyup'
|
220
|
-
;
|
297
|
+
return module.get.inputEvent();
|
221
298
|
}
|
222
299
|
},
|
300
|
+
inputEvent: function() {
|
301
|
+
return (document.createElement('input').oninput !== undefined)
|
302
|
+
? 'input'
|
303
|
+
: (document.createElement('input').onpropertychange !== undefined)
|
304
|
+
? 'propertychange'
|
305
|
+
: 'keyup'
|
306
|
+
;
|
307
|
+
},
|
223
308
|
field: function(identifier) {
|
224
309
|
module.verbose('Finding field with identifier', identifier);
|
225
310
|
if( $field.filter('#' + identifier).length > 0 ) {
|
@@ -243,6 +328,59 @@ $.fn.form = function(fields, parameters) {
|
|
243
328
|
}
|
244
329
|
});
|
245
330
|
return rules || false;
|
331
|
+
},
|
332
|
+
value: function (field) {
|
333
|
+
var
|
334
|
+
fields = [],
|
335
|
+
results
|
336
|
+
;
|
337
|
+
fields.push(field);
|
338
|
+
results = module.get.values.call(element, fields);
|
339
|
+
return results[field];
|
340
|
+
},
|
341
|
+
values: function (fields) {
|
342
|
+
var
|
343
|
+
values = {}
|
344
|
+
;
|
345
|
+
// return all fields if no parameters
|
346
|
+
if(!$.isArray(fields)) {
|
347
|
+
fields = $field;
|
348
|
+
}
|
349
|
+
$.each(fields, function(index, field) {
|
350
|
+
var
|
351
|
+
$field = (typeof field === 'string')
|
352
|
+
? module.get.field(field)
|
353
|
+
: $(field),
|
354
|
+
type = $field.prop('type'),
|
355
|
+
name = $field.prop('name'),
|
356
|
+
value = $field.val(),
|
357
|
+
isCheckbox = $field.is(selector.checkbox),
|
358
|
+
isRadio = $field.is(selector.radio),
|
359
|
+
isChecked = (isCheckbox)
|
360
|
+
? $field.is(':checked')
|
361
|
+
: false
|
362
|
+
;
|
363
|
+
if(name) {
|
364
|
+
if(isRadio) {
|
365
|
+
if(isChecked) {
|
366
|
+
values[name] = value;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
else if(isCheckbox) {
|
370
|
+
if(isChecked) {
|
371
|
+
values[name] = true;
|
372
|
+
}
|
373
|
+
else {
|
374
|
+
module.debug('Omitted unchecked checkbox', $field);
|
375
|
+
return true;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
else {
|
379
|
+
values[name] = value;
|
380
|
+
}
|
381
|
+
}
|
382
|
+
});
|
383
|
+
return values;
|
246
384
|
}
|
247
385
|
},
|
248
386
|
|
@@ -350,11 +488,74 @@ $.fn.form = function(fields, parameters) {
|
|
350
488
|
.addClass(className.success)
|
351
489
|
;
|
352
490
|
},
|
491
|
+
defaults: function () {
|
492
|
+
$field
|
493
|
+
.each(function () {
|
494
|
+
var
|
495
|
+
$field = $(this),
|
496
|
+
isCheckbox = ($field.filter(selector.checkbox).length > 0),
|
497
|
+
value = (isCheckbox)
|
498
|
+
? $field.is(':checked')
|
499
|
+
: $field.val()
|
500
|
+
;
|
501
|
+
$field.data(metadata.defaultValue, value);
|
502
|
+
})
|
503
|
+
;
|
504
|
+
},
|
353
505
|
error: function() {
|
354
506
|
$module
|
355
507
|
.removeClass(className.success)
|
356
508
|
.addClass(className.error)
|
357
509
|
;
|
510
|
+
},
|
511
|
+
value: function (field, value) {
|
512
|
+
var
|
513
|
+
fields = {}
|
514
|
+
;
|
515
|
+
fields[field] = value;
|
516
|
+
return module.set.values.call(element, fields);
|
517
|
+
},
|
518
|
+
values: function (fields) {
|
519
|
+
if($.isEmptyObject(fields)) {
|
520
|
+
return;
|
521
|
+
}
|
522
|
+
$.each(fields, function(key, value) {
|
523
|
+
var
|
524
|
+
$field = module.get.field(key),
|
525
|
+
$element = $field.parent(),
|
526
|
+
isCheckbox = $element.is(selector.uiCheckbox),
|
527
|
+
isDropdown = $element.is(selector.uiDropdown),
|
528
|
+
isRadio = $field.is(selector.radio),
|
529
|
+
fieldExists = ($field.length > 0)
|
530
|
+
;
|
531
|
+
if(fieldExists) {
|
532
|
+
if(isRadio && isCheckbox) {
|
533
|
+
module.verbose('Selecting radio value', value, $field);
|
534
|
+
$field.filter('[value="' + value + '"]')
|
535
|
+
.parent(selector.uiCheckbox)
|
536
|
+
.checkbox('check')
|
537
|
+
;
|
538
|
+
}
|
539
|
+
else if(isCheckbox) {
|
540
|
+
module.verbose('Setting checkbox value', value, $element);
|
541
|
+
if(value === true) {
|
542
|
+
$element.checkbox('check');
|
543
|
+
}
|
544
|
+
else {
|
545
|
+
$element.checkbox('uncheck');
|
546
|
+
}
|
547
|
+
}
|
548
|
+
else if(isDropdown) {
|
549
|
+
module.verbose('Setting dropdown value', value, $element);
|
550
|
+
$element.dropdown('set selected', value);
|
551
|
+
}
|
552
|
+
else {
|
553
|
+
module.verbose('Setting field value', value, $field);
|
554
|
+
$field.val(value);
|
555
|
+
}
|
556
|
+
}
|
557
|
+
});
|
558
|
+
module.validate.form();
|
358
559
|
}
|
359
560
|
},
|
360
561
|
|
@@ -365,6 +566,12 @@ $.fn.form = function(fields, parameters) {
|
|
365
566
|
allValid = true,
|
366
567
|
apiRequest
|
367
568
|
;
|
569
|
+
|
570
|
+
// input keydown event will fire submit repeatedly by browser default
|
571
|
+
if(keyHeldDown) {
|
572
|
+
return false;
|
573
|
+
}
|
574
|
+
|
368
575
|
// reset errors
|
369
576
|
formErrors = [];
|
370
577
|
$.each(validation, function(fieldName, field) {
|
@@ -593,7 +800,7 @@ $.fn.form = function(fields, parameters) {
|
|
593
800
|
}
|
594
801
|
});
|
595
802
|
}
|
596
|
-
if
|
803
|
+
if( $.isFunction( found ) ) {
|
597
804
|
response = found.apply(context, passedArguments);
|
598
805
|
}
|
599
806
|
else if(found !== undefined) {
|
@@ -653,31 +860,36 @@ $.fn.form.settings = {
|
|
653
860
|
transition : 'scale',
|
654
861
|
duration : 200,
|
655
862
|
|
656
|
-
|
657
863
|
onValid : function() {},
|
658
864
|
onInvalid : function() {},
|
659
865
|
onSuccess : function() { return true; },
|
660
866
|
onFailure : function() { return false; },
|
661
867
|
|
662
868
|
metadata : {
|
663
|
-
|
869
|
+
defaultValue : 'default',
|
870
|
+
validate : 'validate'
|
664
871
|
},
|
665
872
|
|
666
873
|
selector : {
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
input
|
672
|
-
|
673
|
-
|
874
|
+
checkbox : 'input[type="checkbox"], input[type="radio"]',
|
875
|
+
clear : '.clear',
|
876
|
+
field : 'input, textarea, select',
|
877
|
+
group : '.field',
|
878
|
+
input : 'input',
|
879
|
+
message : '.error.message',
|
880
|
+
prompt : '.prompt.label',
|
881
|
+
radio : 'input[type="radio"]',
|
882
|
+
reset : '.reset',
|
883
|
+
submit : '.submit',
|
884
|
+
uiCheckbox : '.ui.checkbox',
|
885
|
+
uiDropdown : '.ui.dropdown'
|
674
886
|
},
|
675
887
|
|
676
888
|
className : {
|
677
889
|
error : 'error',
|
678
|
-
|
679
|
-
|
680
|
-
|
890
|
+
label : 'ui prompt label',
|
891
|
+
pressed : 'down',
|
892
|
+
success : 'success'
|
681
893
|
},
|
682
894
|
|
683
895
|
error: {
|
@@ -685,6 +897,8 @@ $.fn.form.settings = {
|
|
685
897
|
},
|
686
898
|
|
687
899
|
templates: {
|
900
|
+
|
901
|
+
// template that produces error message
|
688
902
|
error: function(errors) {
|
689
903
|
var
|
690
904
|
html = '<ul class="list">'
|
@@ -695,6 +909,8 @@ $.fn.form.settings = {
|
|
695
909
|
html += '</ul>';
|
696
910
|
return $(html);
|
697
911
|
},
|
912
|
+
|
913
|
+
// template that produces label
|
698
914
|
prompt: function(errors) {
|
699
915
|
return $('<div/>')
|
700
916
|
.addClass('ui red pointing prompt label')
|
@@ -737,20 +953,20 @@ $.fn.form.settings = {
|
|
737
953
|
max,
|
738
954
|
parts
|
739
955
|
;
|
740
|
-
if
|
956
|
+
if(range === undefined || range === '' || range === '..') {
|
741
957
|
// do nothing
|
742
958
|
}
|
743
|
-
else if
|
744
|
-
if
|
959
|
+
else if(range.indexOf('..') == -1) {
|
960
|
+
if(intRegExp.test(range)) {
|
745
961
|
min = max = range - 0;
|
746
962
|
}
|
747
963
|
}
|
748
964
|
else {
|
749
965
|
parts = range.split('..', 2);
|
750
|
-
if
|
966
|
+
if(intRegExp.test(parts[0])) {
|
751
967
|
min = parts[0] - 0;
|
752
968
|
}
|
753
|
-
if
|
969
|
+
if(intRegExp.test(parts[1])) {
|
754
970
|
max = parts[1] - 0;
|
755
971
|
}
|
756
972
|
}
|
@@ -103,18 +103,18 @@ $.fn.popup = function(parameters) {
|
|
103
103
|
|
104
104
|
refresh: function() {
|
105
105
|
if(settings.popup) {
|
106
|
-
$popup = $(settings.popup);
|
106
|
+
$popup = $(settings.popup).eq(0);
|
107
107
|
}
|
108
108
|
else {
|
109
109
|
if(settings.inline) {
|
110
|
-
$popup = $target.next(selector.popup);
|
110
|
+
$popup = $target.next(selector.popup).eq(0);
|
111
111
|
}
|
112
112
|
}
|
113
113
|
if(settings.popup) {
|
114
114
|
$popup.addClass(className.loading);
|
115
115
|
$offsetParent = module.get.offsetParent();
|
116
116
|
$popup.removeClass(className.loading);
|
117
|
-
if(module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
|
117
|
+
if(settings.movePopup && module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
|
118
118
|
module.debug('Moving popup to the same offset parent as activating element');
|
119
119
|
$popup
|
120
120
|
.detach()
|
@@ -1087,6 +1087,7 @@ $.fn.popup.settings = {
|
|
1087
1087
|
},
|
1088
1088
|
|
1089
1089
|
setFluidWidth : true,
|
1090
|
+
movePopup : true,
|
1090
1091
|
|
1091
1092
|
target : false,
|
1092
1093
|
popup : false,
|