less-rails-semantic_ui 1.6.2.0 → 1.7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/assets/javascripts/semantic_ui/definitions/behaviors/api.js +9 -9
  3. data/assets/javascripts/semantic_ui/definitions/behaviors/form.js +23 -23
  4. data/assets/javascripts/semantic_ui/definitions/behaviors/state.js +6 -6
  5. data/assets/javascripts/semantic_ui/definitions/behaviors/visibility.js +3 -3
  6. data/assets/javascripts/semantic_ui/definitions/behaviors/visit.js +7 -7
  7. data/assets/javascripts/semantic_ui/definitions/globals/site.js +2 -2
  8. data/assets/javascripts/semantic_ui/definitions/modules/accordion.js +12 -12
  9. data/assets/javascripts/semantic_ui/definitions/modules/checkbox.js +14 -13
  10. data/assets/javascripts/semantic_ui/definitions/modules/dimmer.js +9 -9
  11. data/assets/javascripts/semantic_ui/definitions/modules/dropdown.js +98 -58
  12. data/assets/javascripts/semantic_ui/definitions/modules/modal.js +14 -14
  13. data/assets/javascripts/semantic_ui/definitions/modules/popup.js +90 -39
  14. data/assets/javascripts/semantic_ui/definitions/modules/progress.js +12 -6
  15. data/assets/javascripts/semantic_ui/definitions/modules/rating.js +6 -6
  16. data/assets/javascripts/semantic_ui/definitions/modules/search.js +216 -205
  17. data/assets/javascripts/semantic_ui/definitions/modules/shape.js +8 -8
  18. data/assets/javascripts/semantic_ui/definitions/modules/sidebar.js +112 -89
  19. data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +11 -11
  20. data/assets/javascripts/semantic_ui/definitions/modules/tab.js +12 -12
  21. data/assets/javascripts/semantic_ui/definitions/modules/transition.js +9 -9
  22. data/assets/javascripts/semantic_ui/definitions/modules/video.js +4 -4
  23. data/assets/stylesheets/semantic_ui/definitions/collections/grid.less +65 -10
  24. data/assets/stylesheets/semantic_ui/definitions/collections/menu.less +10 -6
  25. data/assets/stylesheets/semantic_ui/definitions/elements/button.less +54 -55
  26. data/assets/stylesheets/semantic_ui/definitions/elements/label.less +4 -4
  27. data/assets/stylesheets/semantic_ui/definitions/elements/list.less +4 -2
  28. data/assets/stylesheets/semantic_ui/definitions/elements/segment.less +0 -7
  29. data/assets/stylesheets/semantic_ui/definitions/elements/step.less +41 -40
  30. data/assets/stylesheets/semantic_ui/definitions/globals/site.less +19 -0
  31. data/assets/stylesheets/semantic_ui/definitions/modules/dropdown.less +108 -23
  32. data/assets/stylesheets/semantic_ui/definitions/modules/popup.less +0 -2
  33. data/assets/stylesheets/semantic_ui/definitions/modules/sidebar.less +109 -27
  34. data/assets/stylesheets/semantic_ui/themes/default/collections/menu.variables +3 -0
  35. data/assets/stylesheets/semantic_ui/themes/default/elements/button.variables +24 -0
  36. data/assets/stylesheets/semantic_ui/themes/default/globals/site.variables +5 -2
  37. data/assets/stylesheets/semantic_ui/themes/default/modules/dropdown.variables +22 -6
  38. data/assets/stylesheets/semantic_ui/themes/default/modules/sidebar.variables +21 -12
  39. data/assets/stylesheets/semantic_ui/themes/material/elements/button.overrides +0 -4
  40. data/assets/stylesheets/semantic_ui/themes/rtl/globals/site.overrides +6 -0
  41. data/assets/stylesheets/semantic_ui/themes/rtl/globals/site.variables +14 -0
  42. data/lib/less/rails/semantic_ui/version.rb +1 -1
  43. metadata +4 -2
@@ -172,7 +172,7 @@ $.fn.modal = function(parameters) {
172
172
  ? module[event]
173
173
  : module.toggle
174
174
  ;
175
- if($toggle.size() > 0) {
175
+ if($toggle.length > 0) {
176
176
  module.debug('Attaching modal events to element', selector, event);
177
177
  $toggle
178
178
  .off(eventNamespace)
@@ -205,7 +205,7 @@ $.fn.modal = function(parameters) {
205
205
  close: function() {
206
206
  module.verbose('Closing element pressed');
207
207
  if( $(this).is(selector.approve) ) {
208
- if($.proxy(settings.onApprove, element)() !== false) {
208
+ if(settings.onApprove.call(element) !== false) {
209
209
  module.hide();
210
210
  }
211
211
  else {
@@ -213,7 +213,7 @@ $.fn.modal = function(parameters) {
213
213
  }
214
214
  }
215
215
  else if( $(this).is(selector.deny) ) {
216
- if($.proxy(settings.onDeny, element)() !== false) {
216
+ if(settings.onDeny.call(element) !== false) {
217
217
  module.hide();
218
218
  }
219
219
  else {
@@ -225,7 +225,7 @@ $.fn.modal = function(parameters) {
225
225
  }
226
226
  },
227
227
  click: function(event) {
228
- if( $(event.target).closest($module).size() === 0 ) {
228
+ if( $(event.target).closest($module).length === 0 ) {
229
229
  module.debug('Dimmer clicked, hiding all modals');
230
230
  if( module.is.active() ) {
231
231
  module.remove.clickaway();
@@ -306,12 +306,12 @@ $.fn.modal = function(parameters) {
306
306
  module.set.type();
307
307
  module.set.clickaway();
308
308
 
309
- if( !settings.allowMultiple && $otherModals.filter(':visible').size() > 0) {
309
+ if( !settings.allowMultiple && $otherModals.filter(':visible').length > 0) {
310
310
  module.debug('Other modals visible, queueing show animation');
311
311
  module.hideOthers(module.showModal);
312
312
  }
313
313
  else {
314
- $.proxy(settings.onShow, element)();
314
+ settings.onShow.call(element);
315
315
  if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
316
316
  module.debug('Showing modal with css animations');
317
317
  $module
@@ -322,7 +322,7 @@ $.fn.modal = function(parameters) {
322
322
  duration : settings.duration,
323
323
  useFailSafe : true,
324
324
  onComplete : function() {
325
- $.proxy(settings.onVisible, element)();
325
+ settings.onVisible.apply(element);
326
326
  module.add.keyboardShortcuts();
327
327
  module.save.focus();
328
328
  module.set.active();
@@ -336,7 +336,7 @@ $.fn.modal = function(parameters) {
336
336
  module.debug('Showing modal with javascript');
337
337
  $module
338
338
  .fadeIn(settings.duration, settings.easing, function() {
339
- $.proxy(settings.onVisible, element)();
339
+ settings.onVisible.apply(element);
340
340
  module.add.keyboardShortcuts();
341
341
  module.save.focus();
342
342
  module.set.active();
@@ -357,7 +357,7 @@ $.fn.modal = function(parameters) {
357
357
  : function(){}
358
358
  ;
359
359
  module.debug('Hiding modal');
360
- $.proxy(settings.onHide, element)();
360
+ settings.onHide.call(element);
361
361
 
362
362
  if( module.is.animating() || module.is.active() ) {
363
363
  if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
@@ -376,7 +376,7 @@ $.fn.modal = function(parameters) {
376
376
  module.remove.keyboardShortcuts();
377
377
  },
378
378
  onComplete : function() {
379
- $.proxy(settings.onHidden, element)();
379
+ settings.onHidden.call(element);
380
380
  module.restore.focus();
381
381
  callback();
382
382
  }
@@ -391,7 +391,7 @@ $.fn.modal = function(parameters) {
391
391
  module.remove.keyboardShortcuts();
392
392
  $module
393
393
  .fadeOut(settings.duration, settings.easing, function() {
394
- $.proxy(settings.onHidden, element)();
394
+ settings.onHidden.call(element);
395
395
  module.restore.focus();
396
396
  callback();
397
397
  })
@@ -455,7 +455,7 @@ $.fn.modal = function(parameters) {
455
455
  },
456
456
 
457
457
  othersActive: function() {
458
- return ($otherModals.filter('.' + className.active).size() > 0);
458
+ return ($otherModals.filter('.' + className.active).length > 0);
459
459
  },
460
460
 
461
461
  add: {
@@ -475,7 +475,7 @@ $.fn.modal = function(parameters) {
475
475
 
476
476
  restore: {
477
477
  focus: function() {
478
- if($focusedElement && $focusedElement.size() > 0) {
478
+ if($focusedElement && $focusedElement.length > 0) {
479
479
  $focusedElement.focus();
480
480
  }
481
481
  }
@@ -559,7 +559,7 @@ $.fn.modal = function(parameters) {
559
559
  var
560
560
  $inputs = $module.find(':input:visible'),
561
561
  $autofocus = $inputs.filter('[autofocus]'),
562
- $input = ($autofocus.size() > 0)
562
+ $input = ($autofocus.length > 0)
563
563
  ? $autofocus
564
564
  : $inputs
565
565
  ;
@@ -70,7 +70,6 @@ $.fn.popup = function(parameters) {
70
70
  // binds events
71
71
  initialize: function() {
72
72
  module.debug('Initializing module', $module);
73
- module.refresh();
74
73
  if(settings.on == 'click') {
75
74
  $module
76
75
  .on('click' + eventNamespace, module.toggle)
@@ -88,12 +87,9 @@ $.fn.popup = function(parameters) {
88
87
  $window
89
88
  .on('resize' + eventNamespace, module.event.resize)
90
89
  ;
91
- if( !module.exists() ) {
90
+ if( !module.exists() && settings.preserve) {
92
91
  module.create();
93
92
  }
94
- else if(settings.hoverable) {
95
- module.bind.popup();
96
- }
97
93
  module.instantiate();
98
94
  },
99
95
 
@@ -111,29 +107,31 @@ $.fn.popup = function(parameters) {
111
107
  }
112
108
  else {
113
109
  if(settings.inline) {
114
- $popup = $target.next(settings.selector.popup);
110
+ $popup = $target.next(selector.popup);
115
111
  }
116
112
  }
117
113
  if(settings.popup) {
118
114
  $popup.addClass(className.loading);
119
- $offsetParent = $module.offsetParent();
120
- if($popup.offsetParent()[0] !== $offsetParent[0]) {
115
+ $offsetParent = module.get.offsetParent();
116
+ $popup.removeClass(className.loading);
117
+ if(module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
121
118
  module.debug('Moving popup to the same offset parent as activating element');
122
119
  $popup
123
120
  .detach()
124
121
  .appendTo($offsetParent)
125
122
  ;
126
123
  }
127
- $popup.removeClass(className.loading);
128
124
  }
129
125
  else {
130
126
  $offsetParent = (settings.inline)
131
- ? $target.offsetParent()
132
- : $body
127
+ ? module.get.offsetParent($target)
128
+ : module.has.popup()
129
+ ? module.get.offsetParent($popup)
130
+ : $body
133
131
  ;
134
132
  }
135
133
  if( $offsetParent.is('html') ) {
136
- module.debug('Page is popups offset parent');
134
+ module.debug('Setting page as offset parent');
137
135
  $offsetParent = $body;
138
136
  }
139
137
  },
@@ -228,14 +226,23 @@ $.fn.popup = function(parameters) {
228
226
  .appendTo( $context )
229
227
  ;
230
228
  }
229
+ module.refresh();
231
230
  if(settings.hoverable) {
232
231
  module.bind.popup();
233
232
  }
234
- $.proxy(settings.onCreate, $popup)(element);
233
+ settings.onCreate.call($popup, element);
235
234
  }
236
- else if($target.next(settings.selector.popup).size() !== 0) {
237
- module.verbose('Pre-existing popup found, reverting to inline');
235
+ else if($target.next(selector.popup).length !== 0) {
236
+ module.verbose('Pre-existing popup found');
238
237
  settings.inline = true;
238
+ settings.popup = $target.next(selector.popup);
239
+ module.refresh();
240
+ if(settings.hoverable) {
241
+ module.bind.popup();
242
+ }
243
+ }
244
+ else if(settings.popup) {
245
+ module.verbose('Used popup specified in settings');
239
246
  module.refresh();
240
247
  if(settings.hoverable) {
241
248
  module.bind.popup();
@@ -264,12 +271,12 @@ $.fn.popup = function(parameters) {
264
271
  show: function(callback) {
265
272
  callback = $.isFunction(callback) ? callback : function(){};
266
273
  module.debug('Showing pop-up', settings.transition);
267
- if(!settings.preserve && !settings.popup) {
268
- module.refresh();
269
- }
270
274
  if( !module.exists() ) {
271
275
  module.create();
272
276
  }
277
+ else if(!settings.preserve && !settings.popup) {
278
+ module.refresh();
279
+ }
273
280
  if( $popup && module.set.position() ) {
274
281
  module.save.conditions();
275
282
  module.animate.show(callback);
@@ -290,13 +297,13 @@ $.fn.popup = function(parameters) {
290
297
  hideAll: function() {
291
298
  $(selector.popup)
292
299
  .filter(':visible')
293
- .popup('hide')
300
+ .transition('hide')
294
301
  ;
295
302
  },
296
303
 
297
304
  hideGracefully: function(event) {
298
305
  // don't close on clicks inside popup
299
- if(event && $(event.target).closest(selector.popup).size() === 0) {
306
+ if(event && $(event.target).closest(selector.popup).length === 0) {
300
307
  module.debug('Click occurred outside popup hiding popup');
301
308
  module.hide();
302
309
  }
@@ -313,7 +320,7 @@ $.fn.popup = function(parameters) {
313
320
  return ( module.has.popup() );
314
321
  }
315
322
  else {
316
- return ( $popup.closest($context).size() > 1 )
323
+ return ( $popup.closest($context).length >= 1 )
317
324
  ? true
318
325
  : false
319
326
  ;
@@ -322,10 +329,11 @@ $.fn.popup = function(parameters) {
322
329
 
323
330
  removePopup: function() {
324
331
  module.debug('Removing popup', $popup);
325
- if( module.has.popup() ) {
332
+ if( module.has.popup() && !settings.popup) {
326
333
  $popup.remove();
334
+ $popup = undefined;
327
335
  }
328
- $.proxy(settings.onRemove, $popup)(element);
336
+ settings.onRemove.call($popup, element);
329
337
  },
330
338
 
331
339
  save: {
@@ -341,7 +349,6 @@ $.fn.popup = function(parameters) {
341
349
  },
342
350
  restore: {
343
351
  conditions: function() {
344
- element.blur();
345
352
  if(module.cache && module.cache.title) {
346
353
  $module.attr('title', module.cache.title);
347
354
  module.verbose('Restoring original attributes', module.cache.title);
@@ -363,8 +370,8 @@ $.fn.popup = function(parameters) {
363
370
  duration : settings.duration,
364
371
  onComplete : function() {
365
372
  module.bind.close();
366
- $.proxy(callback, $popup)(element);
367
- $.proxy(settings.onVisible, $popup)(element);
373
+ callback.call($popup, element);
374
+ settings.onVisible.call($popup, element);
368
375
  }
369
376
  })
370
377
  ;
@@ -375,11 +382,12 @@ $.fn.popup = function(parameters) {
375
382
  .stop()
376
383
  .fadeIn(settings.duration, settings.easing, function() {
377
384
  module.bind.close();
378
- $.proxy(callback, element)();
385
+ callback.call($popup, element);
386
+ settings.onVisible.call($popup, element);
379
387
  })
380
388
  ;
381
389
  }
382
- $.proxy(settings.onShow, $popup)(element);
390
+ settings.onShow.call($popup, element);
383
391
  },
384
392
  hide: function(callback) {
385
393
  callback = $.isFunction(callback) ? callback : function(){};
@@ -394,8 +402,8 @@ $.fn.popup = function(parameters) {
394
402
  verbose : settings.verbose,
395
403
  onComplete : function() {
396
404
  module.reset();
397
- $.proxy(callback, $popup)(element);
398
- $.proxy(settings.onHidden, $popup)(element);
405
+ callback.call($popup, element);
406
+ settings.onHidden.call($popup, element);
399
407
  }
400
408
  })
401
409
  ;
@@ -405,11 +413,12 @@ $.fn.popup = function(parameters) {
405
413
  .stop()
406
414
  .fadeOut(settings.duration, settings.easing, function() {
407
415
  module.reset();
408
- callback();
416
+ callback.call($popup, element);
417
+ settings.onHidden.call($popup, element);
409
418
  })
410
419
  ;
411
420
  }
412
- $.proxy(settings.onHide, $popup)(element);
421
+ settings.onHide.call($popup, element);
413
422
  }
414
423
  },
415
424
 
@@ -432,9 +441,35 @@ $.fn.popup = function(parameters) {
432
441
  }
433
442
  return false;
434
443
  },
444
+ offsetParent: function($target) {
445
+ var
446
+ element = ($target !== undefined)
447
+ ? $target[0]
448
+ : $module[0],
449
+ parentNode = element.parentNode,
450
+ $node = $(parentNode)
451
+ ;
452
+ if(parentNode) {
453
+ var
454
+ is2D = ($node.css('transform') === 'none'),
455
+ isStatic = ($node.css('position') === 'static'),
456
+ isHTML = $node.is('html')
457
+ ;
458
+ while(parentNode && !isHTML && isStatic && is2D) {
459
+ parentNode = parentNode.parentNode;
460
+ $node = $(parentNode);
461
+ is2D = ($node.css('transform') === 'none');
462
+ isStatic = ($node.css('position') === 'static');
463
+ isHTML = $node.is('html');
464
+ }
465
+ }
466
+ return ($node && $node.length > 0)
467
+ ? $node
468
+ : $()
469
+ ;
470
+ },
435
471
  offstagePosition: function(position) {
436
472
  var
437
- position = position || false,
438
473
  boundary = {
439
474
  top : $(window).scrollTop(),
440
475
  bottom : $(window).scrollTop() + $(window).height(),
@@ -449,6 +484,7 @@ $.fn.popup = function(parameters) {
449
484
  offstage = {},
450
485
  offstagePositions = []
451
486
  ;
487
+ position = position || false;
452
488
  if(popup.offset && position) {
453
489
  module.verbose('Checking if outside viewable area', popup.offset);
454
490
  offstage = {
@@ -563,13 +599,14 @@ $.fn.popup = function(parameters) {
563
599
  ? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-top'), 10)
564
600
  : 0,
565
601
  marginLeft = (settings.inline)
566
- ? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10)
602
+ ? parseInt( window.getComputedStyle(targetElement).getPropertyValue(module.is.rtl() ? 'margin-right' : 'margin-left'), 10)
567
603
  : 0,
568
604
 
569
605
  target = (settings.inline || settings.popup)
570
606
  ? $target.position()
571
607
  : $target.offset(),
572
608
 
609
+ computedPosition,
573
610
  positioning,
574
611
  offstagePosition
575
612
  ;
@@ -597,7 +634,18 @@ $.fn.popup = function(parameters) {
597
634
  }
598
635
  }
599
636
  module.debug('Calculating popup positioning', position);
600
- switch(position) {
637
+
638
+ computedPosition = position;
639
+ if (module.is.rtl()) {
640
+ computedPosition = computedPosition.replace(/left|right/g, function (match) {
641
+ return (match == 'left')
642
+ ? 'right'
643
+ : 'left'
644
+ ;
645
+ });
646
+ module.debug('RTL: Popup positioning updated', computedPosition);
647
+ }
648
+ switch (computedPosition) {
601
649
  case 'top left':
602
650
  positioning = {
603
651
  top : 'auto',
@@ -759,7 +807,7 @@ $.fn.popup = function(parameters) {
759
807
  $document
760
808
  .on('click' + eventNamespace, function(event) {
761
809
  module.verbose('Pop-up clickaway intent detected');
762
- $.proxy(module.hideGracefully, element)(event);
810
+ module.hideGracefully.call(element, event);
763
811
  })
764
812
  ;
765
813
  }
@@ -787,7 +835,7 @@ $.fn.popup = function(parameters) {
787
835
 
788
836
  has: {
789
837
  popup: function() {
790
- return ($popup.size() > 0);
838
+ return ($popup && $popup.length > 0);
791
839
  }
792
840
  },
793
841
 
@@ -806,12 +854,15 @@ $.fn.popup = function(parameters) {
806
854
  },
807
855
  hidden: function() {
808
856
  return !module.is.visible();
857
+ },
858
+ rtl: function () {
859
+ return $module.css('direction') == 'rtl';
809
860
  }
810
861
  },
811
862
 
812
863
  reset: function() {
813
864
  module.remove.visible();
814
- if(settings.preserve || settings.popup) {
865
+ if(settings.preserve) {
815
866
  if($.fn.transition !== undefined) {
816
867
  $popup
817
868
  .transition('remove transition')
@@ -1040,7 +1091,7 @@ $.fn.popup.settings = {
1040
1091
  target : false,
1041
1092
  popup : false,
1042
1093
  inline : false,
1043
- preserve : true,
1094
+ preserve : false,
1044
1095
  hoverable : false,
1045
1096
 
1046
1097
  duration : 200,
@@ -185,12 +185,16 @@ $.fn.progress = function(parameters) {
185
185
  total = module.total || 0,
186
186
  percent = (module.is.visible() && animating)
187
187
  ? module.get.displayPercent()
188
- : module.percent || 0
188
+ : module.percent || 0,
189
+ left = (module.total > 0)
190
+ ? (total - value)
191
+ : (100 - percent)
189
192
  ;
190
193
  templateText = templateText || '';
191
194
  templateText = templateText
192
195
  .replace('{value}', value)
193
196
  .replace('{total}', total)
197
+ .replace('{left}', left)
194
198
  .replace('{percent}', percent)
195
199
  ;
196
200
  module.debug('Adding variables to progress bar text', templateText);
@@ -363,7 +367,7 @@ $.fn.progress = function(parameters) {
363
367
  if(module.total) {
364
368
  module.value = Math.round( (percent / 100) * module.total);
365
369
  }
366
- if(settings.limitValues) {
370
+ else if(settings.limitValues) {
367
371
  module.value = (module.value > 100)
368
372
  ? 100
369
373
  : (module.value < 0)
@@ -379,15 +383,17 @@ $.fn.progress = function(parameters) {
379
383
  settings.onChange.call(element, percent, module.value, module.total);
380
384
  },
381
385
  labelInterval: function() {
382
- clearInterval(module.interval);
383
- $bar
384
- .one(transitionEnd + eventNamespace, function() {
386
+ var
387
+ animationCallback = function() {
385
388
  module.verbose('Bar finished animating, removing continuous label updates');
386
389
  clearInterval(module.interval);
387
390
  animating = false;
388
391
  module.set.labels();
389
- })
392
+ }
390
393
  ;
394
+ clearInterval(module.interval);
395
+ $bar.one(transitionEnd + eventNamespace, animationCallback);
396
+ module.timer = setTimeout(animationCallback, settings.duration + 100);
391
397
  animating = true;
392
398
  module.interval = setInterval(module.set.labels, settings.framerate);
393
399
  },