fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64

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 (209) hide show
  1. package/.eslintrc.js +0 -1
  2. package/changelog-setup.js +10 -10
  3. package/dist/components/accordion.css +1 -1
  4. package/dist/components/accordion.js +40 -41
  5. package/dist/components/accordion.min.css +1 -1
  6. package/dist/components/accordion.min.js +2 -2
  7. package/dist/components/ad.css +1 -1
  8. package/dist/components/ad.min.css +1 -1
  9. package/dist/components/api.js +57 -61
  10. package/dist/components/api.min.js +2 -2
  11. package/dist/components/breadcrumb.css +1 -1
  12. package/dist/components/breadcrumb.min.css +1 -1
  13. package/dist/components/button.css +1 -1
  14. package/dist/components/button.min.css +1 -1
  15. package/dist/components/calendar.css +1 -1
  16. package/dist/components/calendar.js +186 -187
  17. package/dist/components/calendar.min.css +1 -1
  18. package/dist/components/calendar.min.js +2 -2
  19. package/dist/components/card.css +1 -1
  20. package/dist/components/card.min.css +1 -1
  21. package/dist/components/checkbox.css +1 -1
  22. package/dist/components/checkbox.js +29 -30
  23. package/dist/components/checkbox.min.css +1 -1
  24. package/dist/components/checkbox.min.js +2 -2
  25. package/dist/components/comment.css +1 -1
  26. package/dist/components/comment.min.css +1 -1
  27. package/dist/components/container.css +1 -1
  28. package/dist/components/container.min.css +1 -1
  29. package/dist/components/dimmer.css +1 -1
  30. package/dist/components/dimmer.js +22 -23
  31. package/dist/components/dimmer.min.css +1 -1
  32. package/dist/components/dimmer.min.js +2 -2
  33. package/dist/components/divider.css +1 -1
  34. package/dist/components/divider.min.css +1 -1
  35. package/dist/components/dropdown.css +1 -1
  36. package/dist/components/dropdown.js +293 -337
  37. package/dist/components/dropdown.min.css +1 -1
  38. package/dist/components/dropdown.min.js +2 -2
  39. package/dist/components/embed.css +1 -1
  40. package/dist/components/embed.js +33 -35
  41. package/dist/components/embed.min.css +1 -1
  42. package/dist/components/embed.min.js +2 -2
  43. package/dist/components/emoji.css +1 -1
  44. package/dist/components/emoji.min.css +1 -1
  45. package/dist/components/feed.css +1 -1
  46. package/dist/components/feed.min.css +1 -1
  47. package/dist/components/flag.css +1 -1
  48. package/dist/components/flag.min.css +1 -1
  49. package/dist/components/flyout.css +1 -1
  50. package/dist/components/flyout.js +74 -81
  51. package/dist/components/flyout.min.css +1 -1
  52. package/dist/components/flyout.min.js +2 -2
  53. package/dist/components/form.css +1 -1
  54. package/dist/components/form.js +141 -146
  55. package/dist/components/form.min.css +1 -1
  56. package/dist/components/form.min.js +2 -2
  57. package/dist/components/grid.css +1 -1
  58. package/dist/components/grid.min.css +1 -1
  59. package/dist/components/header.css +1 -1
  60. package/dist/components/header.min.css +1 -1
  61. package/dist/components/icon.css +1 -1
  62. package/dist/components/icon.min.css +1 -1
  63. package/dist/components/image.css +1 -1
  64. package/dist/components/image.min.css +1 -1
  65. package/dist/components/input.css +1 -1
  66. package/dist/components/input.min.css +1 -1
  67. package/dist/components/item.css +1 -1
  68. package/dist/components/item.min.css +1 -1
  69. package/dist/components/label.css +1 -1
  70. package/dist/components/label.min.css +1 -1
  71. package/dist/components/list.css +1 -1
  72. package/dist/components/list.min.css +1 -1
  73. package/dist/components/loader.css +1 -1
  74. package/dist/components/loader.min.css +1 -1
  75. package/dist/components/menu.css +1 -1
  76. package/dist/components/menu.min.css +1 -1
  77. package/dist/components/message.css +1 -1
  78. package/dist/components/message.min.css +1 -1
  79. package/dist/components/modal.css +1 -1
  80. package/dist/components/modal.js +80 -81
  81. package/dist/components/modal.min.css +1 -1
  82. package/dist/components/modal.min.js +2 -2
  83. package/dist/components/nag.css +1 -1
  84. package/dist/components/nag.js +27 -28
  85. package/dist/components/nag.min.css +1 -1
  86. package/dist/components/nag.min.js +2 -2
  87. package/dist/components/placeholder.css +1 -1
  88. package/dist/components/placeholder.min.css +1 -1
  89. package/dist/components/popup.css +1 -1
  90. package/dist/components/popup.js +62 -72
  91. package/dist/components/popup.min.css +1 -1
  92. package/dist/components/popup.min.js +2 -2
  93. package/dist/components/progress.css +1 -1
  94. package/dist/components/progress.js +51 -55
  95. package/dist/components/progress.min.css +1 -1
  96. package/dist/components/progress.min.js +2 -2
  97. package/dist/components/rail.css +1 -1
  98. package/dist/components/rail.min.css +1 -1
  99. package/dist/components/rating.css +1 -1
  100. package/dist/components/rating.js +33 -34
  101. package/dist/components/rating.min.css +1 -1
  102. package/dist/components/rating.min.js +2 -2
  103. package/dist/components/reset.css +1 -1
  104. package/dist/components/reset.min.css +1 -1
  105. package/dist/components/reveal.css +1 -1
  106. package/dist/components/reveal.min.css +1 -1
  107. package/dist/components/search.css +1 -1
  108. package/dist/components/search.js +96 -109
  109. package/dist/components/search.min.css +1 -1
  110. package/dist/components/search.min.js +2 -2
  111. package/dist/components/segment.css +1 -1
  112. package/dist/components/segment.min.css +1 -1
  113. package/dist/components/shape.css +1 -1
  114. package/dist/components/shape.js +44 -45
  115. package/dist/components/shape.min.css +1 -1
  116. package/dist/components/shape.min.js +2 -2
  117. package/dist/components/sidebar.css +1 -1
  118. package/dist/components/sidebar.js +56 -64
  119. package/dist/components/sidebar.min.css +1 -1
  120. package/dist/components/sidebar.min.js +2 -2
  121. package/dist/components/site.css +1 -1
  122. package/dist/components/site.js +16 -17
  123. package/dist/components/site.min.css +1 -1
  124. package/dist/components/site.min.js +2 -2
  125. package/dist/components/slider.css +1 -1
  126. package/dist/components/slider.js +143 -148
  127. package/dist/components/slider.min.css +1 -1
  128. package/dist/components/slider.min.js +2 -2
  129. package/dist/components/state.js +24 -25
  130. package/dist/components/state.min.js +2 -2
  131. package/dist/components/statistic.css +1 -1
  132. package/dist/components/statistic.min.css +1 -1
  133. package/dist/components/step.css +1 -1
  134. package/dist/components/step.min.css +1 -1
  135. package/dist/components/sticky.css +1 -1
  136. package/dist/components/sticky.js +42 -43
  137. package/dist/components/sticky.min.css +1 -1
  138. package/dist/components/sticky.min.js +2 -2
  139. package/dist/components/tab.css +1 -1
  140. package/dist/components/tab.js +57 -66
  141. package/dist/components/tab.min.css +1 -1
  142. package/dist/components/tab.min.js +2 -2
  143. package/dist/components/table.css +1 -1
  144. package/dist/components/table.min.css +1 -1
  145. package/dist/components/text.css +1 -1
  146. package/dist/components/text.min.css +1 -1
  147. package/dist/components/toast.css +1 -1
  148. package/dist/components/toast.js +32 -33
  149. package/dist/components/toast.min.css +1 -1
  150. package/dist/components/toast.min.js +2 -2
  151. package/dist/components/transition.css +1 -1
  152. package/dist/components/transition.js +38 -45
  153. package/dist/components/transition.min.css +1 -1
  154. package/dist/components/transition.min.js +2 -2
  155. package/dist/components/visibility.js +76 -77
  156. package/dist/components/visibility.min.js +2 -2
  157. package/dist/semantic.css +53 -53
  158. package/dist/semantic.js +1753 -1884
  159. package/dist/semantic.min.css +1 -1
  160. package/dist/semantic.min.js +2 -2
  161. package/package.json +1 -1
  162. package/scripts/nightly-version.js +3 -3
  163. package/src/definitions/behaviors/api.js +56 -60
  164. package/src/definitions/behaviors/form.js +140 -145
  165. package/src/definitions/behaviors/state.js +23 -24
  166. package/src/definitions/behaviors/visibility.js +75 -76
  167. package/src/definitions/globals/site.js +15 -16
  168. package/src/definitions/modules/accordion.js +39 -40
  169. package/src/definitions/modules/calendar.js +185 -186
  170. package/src/definitions/modules/checkbox.js +28 -29
  171. package/src/definitions/modules/dimmer.js +21 -22
  172. package/src/definitions/modules/dropdown.js +292 -336
  173. package/src/definitions/modules/embed.js +32 -34
  174. package/src/definitions/modules/flyout.js +73 -80
  175. package/src/definitions/modules/modal.js +79 -80
  176. package/src/definitions/modules/nag.js +26 -27
  177. package/src/definitions/modules/popup.js +61 -71
  178. package/src/definitions/modules/progress.js +50 -54
  179. package/src/definitions/modules/rating.js +32 -33
  180. package/src/definitions/modules/search.js +95 -108
  181. package/src/definitions/modules/shape.js +43 -44
  182. package/src/definitions/modules/sidebar.js +55 -63
  183. package/src/definitions/modules/slider.js +142 -147
  184. package/src/definitions/modules/sticky.js +41 -42
  185. package/src/definitions/modules/tab.js +56 -65
  186. package/src/definitions/modules/toast.js +31 -32
  187. package/src/definitions/modules/transition.js +37 -44
  188. package/tasks/admin/components/create.js +11 -11
  189. package/tasks/admin/components/init.js +11 -12
  190. package/tasks/admin/components/update.js +19 -20
  191. package/tasks/admin/distributions/create.js +24 -36
  192. package/tasks/admin/distributions/init.js +11 -12
  193. package/tasks/admin/distributions/update.js +18 -19
  194. package/tasks/admin/register.js +7 -7
  195. package/tasks/build/assets.js +1 -1
  196. package/tasks/build/css.js +1 -1
  197. package/tasks/build/javascript.js +1 -1
  198. package/tasks/config/admin/github.js +1 -1
  199. package/tasks/config/admin/templates/css-package.js +1 -1
  200. package/tasks/config/admin/templates/less-package.js +1 -1
  201. package/tasks/config/project/config.js +6 -6
  202. package/tasks/config/project/install.js +12 -12
  203. package/tasks/config/project/release.js +5 -11
  204. package/tasks/config/tasks.js +5 -5
  205. package/tasks/config/user.js +1 -4
  206. package/tasks/docs/metadata.js +11 -12
  207. package/tasks/install.js +9 -9
  208. package/test/meteor/assets.js +1 -1
  209. package/test/modules/module.spec.js +18 -18
@@ -20,22 +20,22 @@
20
20
  : globalThis;
21
21
 
22
22
  $.fn.popup = function (...args) {
23
- let $allModules = $(this);
24
- let $document = $(document);
25
- let $window = $(window);
26
- let $body = $('body');
23
+ const $allModules = $(this);
24
+ const $document = $(document);
25
+ const $window = $(window);
26
+ const $body = $('body');
27
27
 
28
- let clickEvent = 'ontouchstart' in document.documentElement
28
+ const clickEvent = 'ontouchstart' in document.documentElement
29
29
  ? 'touchstart'
30
30
  : 'click';
31
31
 
32
32
  let time = Date.now();
33
33
  let performance = [];
34
34
 
35
- let parameters = args[0];
36
- let methodInvoked = typeof parameters === 'string';
37
- let queryArguments = args.slice(1);
38
- let contextCheck = function (context, win) {
35
+ const parameters = args[0];
36
+ const methodInvoked = typeof parameters === 'string';
37
+ const queryArguments = args.slice(1);
38
+ const contextCheck = function (context, win) {
39
39
  let $context;
40
40
  if ([window, document].includes(context)) {
41
41
  $context = $(context);
@@ -51,24 +51,24 @@
51
51
 
52
52
  let returnedValue;
53
53
  $allModules.each(function () {
54
- let settings = $.isPlainObject(parameters)
54
+ const settings = $.isPlainObject(parameters)
55
55
  ? $.extend(true, {}, $.fn.popup.settings, parameters)
56
56
  : $.extend({}, $.fn.popup.settings);
57
57
 
58
- let selector = settings.selector;
59
- let className = settings.className;
60
- let error = settings.error;
61
- let metadata = settings.metadata;
62
- let namespace = settings.namespace;
58
+ const selector = settings.selector;
59
+ const className = settings.className;
60
+ const error = settings.error;
61
+ const metadata = settings.metadata;
62
+ const namespace = settings.namespace;
63
63
 
64
- let eventNamespace = '.' + settings.namespace;
65
- let moduleNamespace = 'module-' + namespace;
64
+ const eventNamespace = '.' + settings.namespace;
65
+ const moduleNamespace = 'module-' + namespace;
66
66
 
67
- let $module = $(this);
68
- let $context = contextCheck(settings.context, window);
69
- let $scrollContext = contextCheck(settings.scrollContext, window);
70
- let $boundary = contextCheck(settings.boundary, window);
71
- let $target = settings.target ? contextCheck(settings.target, window) : $module;
67
+ const $module = $(this);
68
+ const $context = contextCheck(settings.context, window);
69
+ const $scrollContext = contextCheck(settings.scrollContext, window);
70
+ const $boundary = contextCheck(settings.boundary, window);
71
+ const $target = settings.target ? contextCheck(settings.target, window) : $module;
72
72
 
73
73
  let $popup;
74
74
  let $offsetParent;
@@ -77,15 +77,14 @@
77
77
  let triedPositions = false;
78
78
  let openedWithTouch = false;
79
79
 
80
- let element = this;
80
+ const element = this;
81
81
  let instance = $module.data(moduleNamespace);
82
82
 
83
83
  let documentObserver;
84
84
  let elementNamespace;
85
85
  let id;
86
- let module;
87
86
 
88
- module = {
87
+ const module = {
89
88
 
90
89
  // binds events
91
90
  initialize: function () {
@@ -176,7 +175,7 @@
176
175
 
177
176
  event: {
178
177
  start: function (event) {
179
- let delay = $.isPlainObject(settings.delay)
178
+ const delay = $.isPlainObject(settings.delay)
180
179
  ? settings.delay.show
181
180
  : settings.delay;
182
181
  clearTimeout(module.hideTimer);
@@ -187,7 +186,7 @@
187
186
  }
188
187
  },
189
188
  end: function () {
190
- let delay = $.isPlainObject(settings.delay)
189
+ const delay = $.isPlainObject(settings.delay)
191
190
  ? settings.delay.hide
192
191
  : settings.delay;
193
192
  clearTimeout(module.showTimer);
@@ -219,9 +218,9 @@
219
218
  });
220
219
  },
221
220
  hideGracefully: function (event) {
222
- let $target = $(event.target);
223
- let isInDOM = document.documentElement.contains(event.target);
224
- let inPopup = $target.closest(selector.popup).length > 0;
221
+ const $target = $(event.target);
222
+ const isInDOM = document.documentElement.contains(event.target);
223
+ const inPopup = $target.closest(selector.popup).length > 0;
225
224
  // don't close on clicks inside popup
226
225
  if (event && !inPopup && isInDOM) {
227
226
  module.debug('Click occurred outside popup hiding popup');
@@ -234,11 +233,11 @@
234
233
 
235
234
  // generates popup html from metadata
236
235
  create: function () {
237
- let targetSibling = $target.next(selector.popup);
238
- let contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false;
236
+ const targetSibling = $target.next(selector.popup);
237
+ const contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false;
239
238
  let html = module.get.html();
240
- let title = module.get.title();
241
- let content = module.get.content(contentFallback);
239
+ const title = module.get.title();
240
+ const content = module.get.content(contentFallback);
242
241
 
243
242
  if (html || content || title) {
244
243
  module.debug('Creating pop-up html');
@@ -479,22 +478,20 @@
479
478
  return $popup.offset();
480
479
  },
481
480
  calculations: function () {
482
- let $popupOffsetParent = module.get.offsetParent($popup);
483
- let targetElement = $target[0];
484
- let isWindowEl = $boundary[0] === window;
485
- let targetOffset = $target.offset();
486
- let parentOffset = settings.inline || (settings.popup && settings.movePopup)
481
+ const $popupOffsetParent = module.get.offsetParent($popup);
482
+ const targetElement = $target[0];
483
+ const isWindowEl = $boundary[0] === window;
484
+ const targetOffset = $target.offset();
485
+ const parentOffset = settings.inline || (settings.popup && settings.movePopup)
487
486
  ? $target.offsetParent().offset()
488
487
  : { top: 0, left: 0 };
489
- let screenPosition = isWindowEl
488
+ const screenPosition = isWindowEl
490
489
  ? { top: 0, left: 0 }
491
490
  : $boundary.offset();
492
- let calculations = {};
493
- let scroll = isWindowEl
491
+ const scroll = isWindowEl
494
492
  ? { top: $window.scrollTop(), left: $window.scrollLeft() }
495
493
  : { top: 0, left: 0 };
496
- let screen;
497
- calculations = {
494
+ const calculations = {
498
495
  // element which is launching popup
499
496
  target: {
500
497
  element: $target[0],
@@ -529,7 +526,7 @@
529
526
 
530
527
  // if popup offset context is different from target, then adjust calculations
531
528
  if ($popupOffsetParent[0] !== $offsetParent[0]) {
532
- let popupOffset = $popupOffsetParent.offset();
529
+ const popupOffset = $popupOffsetParent.offset();
533
530
  calculations.target.top -= popupOffset.top;
534
531
  calculations.target.left -= popupOffset.left;
535
532
  calculations.parent.width = $popupOffsetParent.outerWidth();
@@ -554,7 +551,7 @@
554
551
  : parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10))
555
552
  : 0;
556
553
  // calculate screen boundaries
557
- screen = calculations.screen;
554
+ const screen = calculations.screen;
558
555
  calculations.boundary = {
559
556
  top: screen.top + screen.scroll.top,
560
557
  bottom: screen.top + screen.scroll.top + screen.height,
@@ -592,12 +589,10 @@
592
589
  },
593
590
  distanceFromBoundary: function (offset, calculations = module.get.calculations()) {
594
591
  let distanceFromBoundary = {};
595
- let popup;
596
- let boundary;
597
592
 
598
593
  // shorthand
599
- popup = calculations.popup;
600
- boundary = calculations.boundary;
594
+ const popup = calculations.popup;
595
+ const boundary = calculations.boundary;
601
596
 
602
597
  if (offset) {
603
598
  distanceFromBoundary = {
@@ -612,7 +607,7 @@
612
607
  return distanceFromBoundary;
613
608
  },
614
609
  offsetParent: function ($element) {
615
- let element = $element !== undefined
610
+ const element = $element !== undefined
616
611
  ? $element[0]
617
612
  : $target[0];
618
613
  let parentNode = element.parentNode;
@@ -647,21 +642,21 @@
647
642
  };
648
643
  },
649
644
  nextPosition: function (position) {
650
- let positions = position.split(' ');
651
- let verticalPosition = positions[0];
652
- let horizontalPosition = positions[1];
653
- let opposite = {
645
+ const positions = position.split(' ');
646
+ const verticalPosition = positions[0];
647
+ const horizontalPosition = positions[1];
648
+ const opposite = {
654
649
  top: 'bottom',
655
650
  bottom: 'top',
656
651
  left: 'right',
657
652
  right: 'left',
658
653
  };
659
- let adjacent = {
654
+ const adjacent = {
660
655
  left: 'center',
661
656
  center: 'right',
662
657
  right: 'left',
663
658
  };
664
- let backup = {
659
+ const backup = {
665
660
  'top left': 'top center',
666
661
  'top center': 'top right',
667
662
  'top right': 'right center',
@@ -671,7 +666,7 @@
671
666
  'bottom left': 'left center',
672
667
  'left center': 'top left',
673
668
  };
674
- let adjacentsAvailable = verticalPosition === 'top' || verticalPosition === 'bottom';
669
+ const adjacentsAvailable = verticalPosition === 'top' || verticalPosition === 'bottom';
675
670
  let oppositeTried = false;
676
671
  let adjacentTried = false;
677
672
  let nextPosition = false;
@@ -714,20 +709,15 @@
714
709
  }
715
710
  let offset;
716
711
  let distanceAway;
717
- let target;
718
- let popup;
719
- let parent;
720
712
  let positioning;
721
- let popupOffset;
722
- let distanceFromBoundary;
723
713
 
724
714
  offset = $module.data(metadata.offset) || settings.offset;
725
715
  distanceAway = settings.distanceAway;
726
716
 
727
717
  // shorthand
728
- target = calculations.target;
729
- popup = calculations.popup;
730
- parent = calculations.parent;
718
+ const target = calculations.target;
719
+ const popup = calculations.popup;
720
+ const parent = calculations.parent;
731
721
 
732
722
  if (module.should.centerArrow(calculations)) {
733
723
  module.verbose('Adjusting offset to center arrow on small target element');
@@ -873,10 +863,10 @@
873
863
  .addClass(position);
874
864
  module.set.invisible();
875
865
 
876
- popupOffset = module.get.popupOffset();
866
+ const popupOffset = module.get.popupOffset();
877
867
 
878
868
  // see if any boundaries are surpassed with this tentative position
879
- distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);
869
+ const distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);
880
870
 
881
871
  if (!settings.forcePosition && module.is.offstage(distanceFromBoundary, position)) {
882
872
  module.debug('Position is outside viewport', position);
@@ -1069,7 +1059,7 @@
1069
1059
  return settings.closable;
1070
1060
  },
1071
1061
  offstage: function (distanceFromBoundary, position) {
1072
- let offstage = [];
1062
+ const offstage = [];
1073
1063
  // return boundaries that have been surpassed
1074
1064
  $.each(distanceFromBoundary, function (direction, distance) {
1075
1065
  if (distance < -settings.jitter) {
@@ -1213,7 +1203,7 @@
1213
1203
  query = query.split(/[ .]/);
1214
1204
  maxDepth = query.length - 1;
1215
1205
  $.each(query, function (depth, value) {
1216
- let camelCaseValue = depth !== maxDepth
1206
+ const camelCaseValue = depth !== maxDepth
1217
1207
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1218
1208
  : query;
1219
1209
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
@@ -1449,7 +1439,7 @@
1449
1439
  },
1450
1440
  popup: function (text) {
1451
1441
  let html = '';
1452
- let escape = $.fn.popup.settings.templates.escape;
1442
+ const escape = $.fn.popup.settings.templates.escape;
1453
1443
  if (text !== undefined) {
1454
1444
  if (text.title) {
1455
1445
  text.title = escape(text.title);
@@ -20,42 +20,41 @@
20
20
  : globalThis;
21
21
 
22
22
  $.fn.progress = function (...args) {
23
- let $allModules = $(this);
23
+ const $allModules = $(this);
24
24
 
25
25
  let time = Date.now();
26
26
  let performance = [];
27
27
 
28
- let parameters = args[0];
29
- let methodInvoked = typeof parameters === 'string';
30
- let queryArguments = args.slice(1);
28
+ const parameters = args[0];
29
+ const methodInvoked = typeof parameters === 'string';
30
+ const queryArguments = args.slice(1);
31
31
 
32
32
  let returnedValue;
33
33
 
34
34
  $allModules.each(function () {
35
- let settings = $.isPlainObject(parameters)
35
+ const settings = $.isPlainObject(parameters)
36
36
  ? $.extend(true, {}, $.fn.progress.settings, parameters)
37
37
  : $.extend({}, $.fn.progress.settings);
38
38
 
39
- let className = settings.className;
40
- let metadata = settings.metadata;
41
- let namespace = settings.namespace;
42
- let selector = settings.selector;
43
- let error = settings.error;
39
+ const className = settings.className;
40
+ const metadata = settings.metadata;
41
+ const namespace = settings.namespace;
42
+ const selector = settings.selector;
43
+ const error = settings.error;
44
44
 
45
- let eventNamespace = '.' + namespace;
46
- let moduleNamespace = 'module-' + namespace;
45
+ const eventNamespace = '.' + namespace;
46
+ const moduleNamespace = 'module-' + namespace;
47
47
 
48
- let $module = $(this);
49
- let $bars = $(this).find(selector.bar);
50
- let $progresses = $(this).find(selector.progress);
51
- let $label = $(this).find(selector.label);
48
+ const $module = $(this);
49
+ const $bars = $(this).find(selector.bar);
50
+ const $progresses = $(this).find(selector.progress);
51
+ const $label = $(this).find(selector.label);
52
52
 
53
- let element = this;
53
+ const element = this;
54
54
  let instance = $module.data(moduleNamespace);
55
55
 
56
56
  let animating = false;
57
- let module;
58
- module = {
57
+ const module = {
59
58
  helper: {
60
59
  sum: function (nums) {
61
60
  return Array.isArray(nums) ? nums.reduce(function (left, right) {
@@ -146,7 +145,7 @@
146
145
 
147
146
  read: {
148
147
  metadata: function () {
149
- let data = {
148
+ const data = {
150
149
  percent: module.helper.forceArray($module.data(metadata.percent)),
151
150
  total: $module.data(metadata.total),
152
151
  value: module.helper.forceArray($module.data(metadata.value)),
@@ -212,7 +211,7 @@
212
211
  module.set.progress(newValue);
213
212
  },
214
213
  decrement: function (decrementValue) {
215
- let total = module.get.total();
214
+ const total = module.get.total();
216
215
  let startValue;
217
216
  let newValue;
218
217
  if (total) {
@@ -241,12 +240,12 @@
241
240
 
242
241
  get: {
243
242
  text: function (templateText = '', index = 0) {
244
- let value = module.get.value(index);
245
- let total = module.get.total();
246
- let percent = animating
243
+ const value = module.get.value(index);
244
+ const total = module.get.total();
245
+ const percent = animating
247
246
  ? module.get.displayPercent(index)
248
247
  : module.get.percent(index);
249
- let left = total !== false
248
+ const left = total !== false
250
249
  ? Math.max(0, total - value)
251
250
  : 100 - percent;
252
251
  templateText = templateText
@@ -305,11 +304,11 @@
305
304
 
306
305
  // gets current displayed percentage (if animating values, this is the intermediary value)
307
306
  displayPercent: function (index) {
308
- let $bar = $($bars[index]);
309
- let barWidth = $bar.width();
310
- let totalWidth = $module.width();
311
- let minDisplay = parseInt($bar.css('min-width'), 10);
312
- let displayPercent = barWidth > minDisplay
307
+ const $bar = $($bars[index]);
308
+ const barWidth = $bar.width();
309
+ const totalWidth = $module.width();
310
+ const minDisplay = parseInt($bar.css('min-width'), 10);
311
+ const displayPercent = barWidth > minDisplay
313
312
  ? (barWidth / totalWidth) * 100
314
313
  : module.percent;
315
314
 
@@ -401,12 +400,12 @@
401
400
  values = module.helper.forceArray(values);
402
401
  let firstNonZeroIndex = -1;
403
402
  let lastNonZeroIndex = -1;
404
- let valuesSum = module.helper.sum(values);
405
- let barCounts = $bars.length;
406
- let isMultiple = barCounts > 1;
407
- let percents = values.map(function (value, index) {
408
- let allZero = index === barCounts - 1 && valuesSum === 0;
409
- let $bar = $($bars[index]);
403
+ const valuesSum = module.helper.sum(values);
404
+ const barCounts = $bars.length;
405
+ const isMultiple = barCounts > 1;
406
+ const percents = values.map(function (value, index) {
407
+ const allZero = index === barCounts - 1 && valuesSum === 0;
408
+ const $bar = $($bars[index]);
410
409
  if (value === 0 && isMultiple && !allZero) {
411
410
  $bar.css('display', 'none');
412
411
  } else {
@@ -426,7 +425,7 @@
426
425
  return parseFloat(value);
427
426
  });
428
427
  values.forEach(function (_, index) {
429
- let $bar = $($bars[index]);
428
+ const $bar = $($bars[index]);
430
429
  $bar.css({
431
430
  borderTopLeftRadius: index === firstNonZeroIndex ? '' : '0',
432
431
  borderBottomLeftRadius: index === firstNonZeroIndex ? '' : '0',
@@ -457,10 +456,10 @@
457
456
  ? Math.max(0, Math.min(100, percent))
458
457
  : percent;
459
458
  });
460
- let hasTotal = module.has.total();
461
- let totalPercent = module.helper.sum(percents);
462
- let isMultipleValues = percents.length > 1 && hasTotal;
463
- let sumTotal = module.helper.sum(module.helper.forceArray(module.value));
459
+ const hasTotal = module.has.total();
460
+ const totalPercent = module.helper.sum(percents);
461
+ const isMultipleValues = percents.length > 1 && hasTotal;
462
+ const sumTotal = module.helper.sum(module.helper.forceArray(module.value));
464
463
  if (isMultipleValues && sumTotal > module.total) {
465
464
  // Sum values instead of percents to avoid precision issues when summing floats
466
465
  module.error(error.sumExceedsTotal, sumTotal, module.total);
@@ -470,14 +469,14 @@
470
469
  } else if (totalPercent < 0) {
471
470
  module.error(error.tooLow, totalPercent);
472
471
  } else {
473
- let autoPrecision = settings.precision > 0
472
+ const autoPrecision = settings.precision > 0
474
473
  ? settings.precision
475
474
  : (isMultipleValues
476
475
  ? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
477
476
  : 0);
478
477
 
479
478
  // round display percentage
480
- let roundedPercents = percents.map(function (percent) {
479
+ const roundedPercents = percents.map(function (percent) {
481
480
  return autoPrecision > 0
482
481
  ? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
483
482
  : Math.round(percent);
@@ -496,7 +495,7 @@
496
495
  settings.onChange.call(element, percents, module.value, module.total);
497
496
  },
498
497
  labelInterval: function () {
499
- let animationCallback = function () {
498
+ const animationCallback = function () {
500
499
  module.verbose('Bar finished animating, removing continuous label updates');
501
500
  clearInterval(module.interval);
502
501
  animating = false;
@@ -506,7 +505,7 @@
506
505
  module.bind.transitionEnd(animationCallback);
507
506
  animating = true;
508
507
  module.interval = setInterval(function () {
509
- let isInDOM = document.documentElement.contains(element);
508
+ const isInDOM = document.documentElement.contains(element);
510
509
  if (!isInDOM) {
511
510
  clearInterval(module.interval);
512
511
  animating = false;
@@ -526,10 +525,7 @@
526
525
  $label.text(text);
527
526
  }
528
527
  },
529
- state: function (percent) {
530
- percent = percent !== undefined
531
- ? percent
532
- : module.helper.sum(module.percent);
528
+ state: function (percent = module.helper.sum(module.percent)) {
533
529
  if (percent === 100) {
534
530
  if (settings.autoSuccess && $bars.length === 1 && !(module.is.warning() || module.is.error() || module.is.success())) {
535
531
  module.set.success();
@@ -552,7 +548,7 @@
552
548
  },
553
549
  barLabel: function (text) {
554
550
  $progresses.each(function (index, element) {
555
- let $progress = $(element);
551
+ const $progress = $(element);
556
552
  if (text !== undefined) {
557
553
  $progress.text(module.get.text(text, index));
558
554
  } else if (settings.label === 'ratio' && module.has.total()) {
@@ -651,7 +647,7 @@
651
647
 
652
648
  update: {
653
649
  toNextValue: function () {
654
- let nextValue = module.nextValue;
650
+ const nextValue = module.nextValue;
655
651
  if (nextValue) {
656
652
  module.debug('Update interval complete using last updated value', nextValue);
657
653
  module.update.progress(nextValue);
@@ -659,11 +655,11 @@
659
655
  }
660
656
  },
661
657
  progress: function (values) {
662
- let hasTotal = module.has.total();
658
+ const hasTotal = module.has.total();
663
659
  if (hasTotal) {
664
660
  module.set.value(values);
665
661
  }
666
- let percentCompletes = module.helper.forceArray(values).map(function (value) {
662
+ const percentCompletes = module.helper.forceArray(values).map(function (value) {
667
663
  let percentComplete;
668
664
  value = module.get.numericValue(value);
669
665
  if (value === false) {
@@ -781,7 +777,7 @@
781
777
  query = query.split(/[ .]/);
782
778
  maxDepth = query.length - 1;
783
779
  $.each(query, function (depth, value) {
784
- let camelCaseValue = depth !== maxDepth
780
+ const camelCaseValue = depth !== maxDepth
785
781
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
786
782
  : query;
787
783
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {