fomantic-ui 2.9.1-beta.21 → 2.9.1-beta.23

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 (258) hide show
  1. package/.eslintrc.js +95 -75
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.github/workflows/nightly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/.stylelintrc.js +6 -7
  6. package/dist/components/accordion.css +1 -1
  7. package/dist/components/accordion.js +7 -7
  8. package/dist/components/accordion.min.css +1 -1
  9. package/dist/components/accordion.min.js +2 -2
  10. package/dist/components/ad.css +1 -1
  11. package/dist/components/ad.min.css +1 -1
  12. package/dist/components/api.js +54 -53
  13. package/dist/components/api.min.js +2 -2
  14. package/dist/components/breadcrumb.css +1 -1
  15. package/dist/components/breadcrumb.min.css +1 -1
  16. package/dist/components/button.css +1 -1
  17. package/dist/components/button.min.css +1 -1
  18. package/dist/components/calendar.css +3 -3
  19. package/dist/components/calendar.js +119 -99
  20. package/dist/components/calendar.min.css +2 -2
  21. package/dist/components/calendar.min.js +2 -2
  22. package/dist/components/card.css +1 -1
  23. package/dist/components/card.min.css +1 -1
  24. package/dist/components/checkbox.css +1 -1
  25. package/dist/components/checkbox.js +8 -8
  26. package/dist/components/checkbox.min.css +1 -1
  27. package/dist/components/checkbox.min.js +2 -2
  28. package/dist/components/comment.css +1 -1
  29. package/dist/components/comment.min.css +1 -1
  30. package/dist/components/container.css +1 -1
  31. package/dist/components/container.min.css +1 -1
  32. package/dist/components/dimmer.css +1 -1
  33. package/dist/components/dimmer.js +16 -18
  34. package/dist/components/dimmer.min.css +1 -1
  35. package/dist/components/dimmer.min.js +2 -2
  36. package/dist/components/divider.css +1 -1
  37. package/dist/components/divider.min.css +1 -1
  38. package/dist/components/dropdown.css +1 -1
  39. package/dist/components/dropdown.js +87 -87
  40. package/dist/components/dropdown.min.css +1 -1
  41. package/dist/components/dropdown.min.js +2 -2
  42. package/dist/components/embed.css +1 -1
  43. package/dist/components/embed.js +17 -23
  44. package/dist/components/embed.min.css +1 -1
  45. package/dist/components/embed.min.js +2 -2
  46. package/dist/components/feed.css +1 -1
  47. package/dist/components/feed.min.css +1 -1
  48. package/dist/components/flag.css +1 -1
  49. package/dist/components/flag.min.css +1 -1
  50. package/dist/components/flyout.css +2 -2
  51. package/dist/components/flyout.js +32 -30
  52. package/dist/components/flyout.min.css +1 -1
  53. package/dist/components/flyout.min.js +2 -2
  54. package/dist/components/form.css +2 -2
  55. package/dist/components/form.js +113 -89
  56. package/dist/components/form.min.css +2 -2
  57. package/dist/components/form.min.js +2 -2
  58. package/dist/components/grid.css +1 -1
  59. package/dist/components/grid.min.css +1 -1
  60. package/dist/components/header.css +1 -1
  61. package/dist/components/header.min.css +1 -1
  62. package/dist/components/icon.css +1 -1
  63. package/dist/components/icon.min.css +1 -1
  64. package/dist/components/image.css +1 -1
  65. package/dist/components/image.min.css +1 -1
  66. package/dist/components/input.css +1 -1
  67. package/dist/components/input.min.css +1 -1
  68. package/dist/components/item.css +1 -1
  69. package/dist/components/item.min.css +1 -1
  70. package/dist/components/label.css +1 -1
  71. package/dist/components/label.min.css +1 -1
  72. package/dist/components/list.css +1 -1
  73. package/dist/components/list.min.css +1 -1
  74. package/dist/components/loader.css +1 -1
  75. package/dist/components/loader.min.css +1 -1
  76. package/dist/components/message.css +1 -1
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +1 -1
  79. package/dist/components/modal.js +22 -22
  80. package/dist/components/modal.min.css +1 -1
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +1 -1
  83. package/dist/components/nag.js +18 -16
  84. package/dist/components/nag.min.css +1 -1
  85. package/dist/components/nag.min.js +2 -2
  86. package/dist/components/placeholder.css +1 -1
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +1 -1
  89. package/dist/components/popup.js +30 -30
  90. package/dist/components/popup.min.css +1 -1
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +1 -1
  93. package/dist/components/progress.js +23 -21
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +2 -2
  96. package/dist/components/rail.css +1 -1
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +1 -1
  99. package/dist/components/rating.js +8 -8
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +2 -2
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +1 -1
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +1 -1
  107. package/dist/components/search.js +41 -46
  108. package/dist/components/search.min.css +1 -1
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +1 -1
  111. package/dist/components/segment.min.css +1 -1
  112. package/dist/components/shape.css +1 -1
  113. package/dist/components/shape.js +9 -9
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +2 -2
  116. package/dist/components/sidebar.css +1 -1
  117. package/dist/components/sidebar.js +21 -19
  118. package/dist/components/sidebar.min.css +1 -1
  119. package/dist/components/sidebar.min.js +2 -2
  120. package/dist/components/site.css +1 -1
  121. package/dist/components/site.js +11 -10
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.js +39 -42
  125. package/dist/components/slider.min.js +2 -2
  126. package/dist/components/state.js +7 -7
  127. package/dist/components/state.min.js +2 -2
  128. package/dist/components/statistic.css +1 -1
  129. package/dist/components/statistic.min.css +1 -1
  130. package/dist/components/step.css +1 -1
  131. package/dist/components/step.min.css +1 -1
  132. package/dist/components/sticky.css +1 -1
  133. package/dist/components/sticky.js +7 -7
  134. package/dist/components/sticky.min.css +1 -1
  135. package/dist/components/sticky.min.js +2 -2
  136. package/dist/components/tab.css +1 -1
  137. package/dist/components/tab.js +36 -38
  138. package/dist/components/tab.min.css +1 -1
  139. package/dist/components/tab.min.js +2 -2
  140. package/dist/components/table.css +1 -1
  141. package/dist/components/table.min.css +1 -1
  142. package/dist/components/text.css +1 -1
  143. package/dist/components/text.min.css +1 -1
  144. package/dist/components/toast.css +1 -1
  145. package/dist/components/toast.js +20 -17
  146. package/dist/components/toast.min.css +1 -1
  147. package/dist/components/toast.min.js +2 -2
  148. package/dist/components/transition.css +7 -7
  149. package/dist/components/transition.js +27 -21
  150. package/dist/components/transition.min.css +1 -1
  151. package/dist/components/transition.min.js +2 -2
  152. package/dist/components/visibility.js +8 -8
  153. package/dist/components/visibility.min.js +2 -2
  154. package/dist/semantic.css +60 -60
  155. package/dist/semantic.js +780 -735
  156. package/dist/semantic.min.css +2 -2
  157. package/dist/semantic.min.js +2 -2
  158. package/examples/.eslintrc.js +6 -0
  159. package/examples/responsive.html +1 -1
  160. package/gulpfile.js +1 -1
  161. package/package.json +5 -4
  162. package/scripts/nightly-version.js +3 -3
  163. package/src/definitions/behaviors/api.js +53 -52
  164. package/src/definitions/behaviors/form.js +112 -88
  165. package/src/definitions/behaviors/state.js +6 -6
  166. package/src/definitions/behaviors/visibility.js +7 -7
  167. package/src/definitions/collections/menu.less +2 -2
  168. package/src/definitions/elements/button.less +2 -2
  169. package/src/definitions/elements/loader.less +4 -4
  170. package/src/definitions/elements/step.less +1 -1
  171. package/src/definitions/globals/site.js +10 -9
  172. package/src/definitions/modules/accordion.js +6 -6
  173. package/src/definitions/modules/calendar.js +118 -98
  174. package/src/definitions/modules/calendar.less +2 -2
  175. package/src/definitions/modules/checkbox.js +7 -7
  176. package/src/definitions/modules/dimmer.js +15 -17
  177. package/src/definitions/modules/dimmer.less +10 -10
  178. package/src/definitions/modules/dropdown.js +86 -86
  179. package/src/definitions/modules/embed.js +16 -22
  180. package/src/definitions/modules/flyout.js +31 -29
  181. package/src/definitions/modules/flyout.less +1 -1
  182. package/src/definitions/modules/modal.js +21 -21
  183. package/src/definitions/modules/nag.js +17 -15
  184. package/src/definitions/modules/popup.js +29 -29
  185. package/src/definitions/modules/progress.js +22 -20
  186. package/src/definitions/modules/rating.js +7 -7
  187. package/src/definitions/modules/search.js +40 -45
  188. package/src/definitions/modules/shape.js +8 -8
  189. package/src/definitions/modules/sidebar.js +20 -18
  190. package/src/definitions/modules/slider.js +38 -41
  191. package/src/definitions/modules/sticky.js +6 -6
  192. package/src/definitions/modules/tab.js +35 -37
  193. package/src/definitions/modules/toast.js +19 -16
  194. package/src/definitions/modules/transition.js +26 -20
  195. package/src/themes/amazon/elements/button.overrides +7 -7
  196. package/src/themes/default/collections/form.variables +1 -1
  197. package/src/themes/default/elements/reveal.variables +1 -1
  198. package/src/themes/default/globals/site.variables +1 -1
  199. package/src/themes/default/modules/dimmer.variables +6 -6
  200. package/src/themes/default/modules/modal.variables +1 -1
  201. package/src/themes/default/modules/slider.variables +4 -4
  202. package/src/themes/default/modules/toast.variables +2 -2
  203. package/src/themes/default/modules/transition.overrides +12 -12
  204. package/src/themes/flat/collections/form.overrides +2 -2
  205. package/src/themes/flat/globals/site.variables +1 -1
  206. package/src/themes/github/collections/form.overrides +2 -2
  207. package/src/themes/github/collections/menu.variables +1 -1
  208. package/src/themes/github/collections/message.overrides +3 -3
  209. package/src/themes/github/elements/input.overrides +2 -2
  210. package/src/themes/timeline/views/feed.overrides +3 -3
  211. package/src/themes/twitter/elements/button.overrides +2 -2
  212. package/tasks/.eslintrc.js +9 -0
  213. package/tasks/README.md +1 -3
  214. package/tasks/admin/components/create.js +9 -16
  215. package/tasks/admin/components/init.js +7 -7
  216. package/tasks/admin/components/update.js +7 -7
  217. package/tasks/admin/distributions/create.js +15 -17
  218. package/tasks/admin/distributions/init.js +7 -7
  219. package/tasks/admin/distributions/update.js +7 -7
  220. package/tasks/admin/publish.js +1 -1
  221. package/tasks/admin/register.js +2 -2
  222. package/tasks/admin/release.js +1 -1
  223. package/tasks/build/assets.js +2 -2
  224. package/tasks/build/css.js +8 -3
  225. package/tasks/build/javascript.js +3 -1
  226. package/tasks/build.js +1 -1
  227. package/tasks/check-install.js +1 -1
  228. package/tasks/clean.js +1 -1
  229. package/tasks/collections/README.md +3 -5
  230. package/tasks/collections/admin.js +1 -1
  231. package/tasks/collections/docs.js +1 -1
  232. package/tasks/collections/install.js +1 -1
  233. package/tasks/collections/rtl.js +1 -1
  234. package/tasks/collections/various.js +1 -1
  235. package/tasks/config/admin/github.js +5 -6
  236. package/tasks/config/admin/templates/css-package.js +1 -1
  237. package/tasks/config/admin/templates/less-package.js +1 -1
  238. package/tasks/config/npm/gulpfile.js +7 -7
  239. package/tasks/config/project/config.js +9 -16
  240. package/tasks/config/project/install.js +26 -25
  241. package/tasks/config/project/release.js +12 -14
  242. package/tasks/config/tasks.js +17 -19
  243. package/tasks/config/user.js +1 -1
  244. package/tasks/docs/build.js +5 -3
  245. package/tasks/docs/metadata.js +7 -8
  246. package/tasks/docs/serve.js +5 -3
  247. package/tasks/install.js +38 -38
  248. package/tasks/rtl/build.js +1 -1
  249. package/tasks/rtl/watch.js +1 -1
  250. package/tasks/version.js +1 -1
  251. package/tasks/watch.js +1 -1
  252. package/test/.eslintrc.js +23 -0
  253. package/test/meteor/assets.js +1 -1
  254. package/test/modules/module.spec.js +15 -15
  255. package/test/modules/popup.spec.js +1 -1
  256. package/test/modules/search.spec.js +1 -1
  257. package/test/modules/tab.spec.js +1 -1
  258. package/test/modules/transition.spec.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.21+2722e1b - Calendar
2
+ * # Fomantic-UI 2.9.1-beta.23+27384cb - Calendar
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -15,7 +15,7 @@
15
15
  return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
16
  }
17
17
 
18
- window = (typeof window != 'undefined' && window.Math == Math)
18
+ window = (window !== undefined && window.Math === Math)
19
19
  ? window
20
20
  : globalThis;
21
21
 
@@ -26,11 +26,11 @@
26
26
 
27
27
  moduleSelector = $allModules.selector || '',
28
28
 
29
- time = new Date().getTime(),
29
+ time = Date.now(),
30
30
  performance = [],
31
31
 
32
32
  query = arguments[0],
33
- methodInvoked = (typeof query == 'string'),
33
+ methodInvoked = (typeof query === 'string'),
34
34
  queryArguments = [].slice.call(arguments, 1),
35
35
  returnedValue,
36
36
  timeGapTable = {
@@ -124,9 +124,9 @@
124
124
  if (settings.inline) {
125
125
  return;
126
126
  }
127
- if (!$activator.length) {
127
+ if ($activator.length === 0) {
128
128
  $activator = $module.children().first();
129
- if (!$activator.length) {
129
+ if ($activator.length === 0) {
130
130
  return;
131
131
  }
132
132
  }
@@ -135,7 +135,7 @@
135
135
 
136
136
  return;
137
137
  }
138
- if (!$container.length) {
138
+ if ($container.length === 0) {
139
139
  if (settings.context) {
140
140
  module.popupId = namespace + '_popup_' + (Math.random().toString(16) + '000000000').slice(2, 10);
141
141
  $container = $('<div/>', { id: module.popupId }).addClass(className.popup).appendTo($document.find(settings.context));
@@ -144,7 +144,7 @@
144
144
  // the styling (eg input action button needs to be the last child to have correct border radius)
145
145
  var
146
146
  $activatorParent = $activator.parent(),
147
- domPositionFunction = $activatorParent.closest(selector.append).length !== 0 ? 'appendTo' : 'prependTo'
147
+ domPositionFunction = $activatorParent.closest(selector.append).length > 0 ? 'appendTo' : 'prependTo'
148
148
  ;
149
149
  $container = $('<div/>').addClass(className.popup)[domPositionFunction]($activatorParent);
150
150
  }
@@ -163,7 +163,7 @@
163
163
 
164
164
  return settings.onHidden.apply($container, arguments);
165
165
  };
166
- if (!$input.length) {
166
+ if ($input.length === 0) {
167
167
  // no input, $container has to handle focus/blur
168
168
  $container.attr('tabindex', '0');
169
169
  onVisible = function () {
@@ -195,17 +195,17 @@
195
195
  module.popup(options);
196
196
  },
197
197
  inline: function () {
198
- if ($activator.length && !settings.inline) {
198
+ if ($activator.length > 0 && !settings.inline) {
199
199
  return;
200
200
  }
201
201
  settings.inline = true;
202
202
  $container = $('<div/>').addClass(className.calendar).appendTo($module);
203
- if (!$input.length) {
203
+ if ($input.length === 0) {
204
204
  $container.attr('tabindex', '0');
205
205
  }
206
206
  },
207
207
  input: function () {
208
- if (settings.touchReadonly && $input.length && isTouch) {
208
+ if (settings.touchReadonly && $input.length > 0 && isTouch) {
209
209
  $input.prop('readonly', true);
210
210
  }
211
211
  module.check.disabled();
@@ -216,7 +216,7 @@
216
216
  date = parser.date(settings.initialDate, settings);
217
217
  } else if ($module.data(metadata.date) !== undefined) {
218
218
  date = parser.date($module.data(metadata.date), settings);
219
- } else if ($input.length) {
219
+ } else if ($input.length > 0) {
220
220
  date = parser.date($input.val(), settings);
221
221
  }
222
222
  module.set.date(date, settings.formatInput, false);
@@ -301,7 +301,7 @@
301
301
  }
302
302
 
303
303
  var month = startMonth + p;
304
- var firstMonthDayColumn = (new Date(year, month, 1).getDay() - settings.firstDayOfWeek % 7 + 7) % 7;
304
+ var firstMonthDayColumn = (new Date(year, month, 1).getDay() - (settings.firstDayOfWeek % 7) + 7) % 7;
305
305
  if (!settings.constantHeight && isDay) {
306
306
  var requiredCells = new Date(year, month + 1, 0).getDate() + firstMonthDayColumn;
307
307
  rows = Math.ceil(requiredCells / 7);
@@ -334,7 +334,8 @@
334
334
  if (isDay && settings.showWeekNumbers) {
335
335
  tempMode += ' andweek';
336
336
  }
337
- var table = $('<table/>').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column').appendTo(container);
337
+ var table = $('<table/>').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column')
338
+ .appendTo(container);
338
339
  if (isInverted) {
339
340
  table.addClass(className.inverted);
340
341
  }
@@ -546,7 +547,7 @@
546
547
  var winWidth = $(window).width();
547
548
  $container.find('td[data-position]').each(function () {
548
549
  var $cell = $(this);
549
- var tooltipWidth = window.getComputedStyle($cell[0], '::after').width.replace(/[^0-9\.]/g, '');
550
+ var tooltipWidth = window.getComputedStyle($cell[0], '::after').width.replace(/[^\d.]/g, '');
550
551
  var tooltipPosition = $cell.attr('data-position');
551
552
  // use a fallback width of 250 (calendar width) for IE/Edge (which return "auto")
552
553
  var calcPosition = (winWidth - $cell.width() - (parseInt(tooltipWidth, 10) || 250)) > $cell.offset().left ? 'right' : 'left';
@@ -564,7 +565,7 @@
564
565
  $container.on('mouseup' + eventNamespace, module.event.mouseup);
565
566
  $container.on('touchend' + eventNamespace, module.event.mouseup);
566
567
  $container.on('mouseover' + eventNamespace, module.event.mouseover);
567
- if ($input.length) {
568
+ if ($input.length > 0) {
568
569
  $input.on('input' + eventNamespace, module.event.inputChange);
569
570
  $input.on('focus' + eventNamespace, module.event.inputFocus);
570
571
  $input.on('blur' + eventNamespace, module.event.inputBlur);
@@ -579,7 +580,7 @@
579
580
  events: function () {
580
581
  module.debug('Unbinding events');
581
582
  $container.off(eventNamespace);
582
- if ($input.length) {
583
+ if ($input.length > 0) {
583
584
  $input.off(eventNamespace);
584
585
  }
585
586
  },
@@ -595,7 +596,7 @@
595
596
  }
596
597
  },
597
598
  mousedown: function (event) {
598
- if ($input.length) {
599
+ if ($input.length > 0) {
599
600
  // prevent the mousedown on the calendar causing the input to lose focus
600
601
  event.preventDefault();
601
602
  }
@@ -642,38 +643,51 @@
642
643
 
643
644
  if (module.popup('is visible')) {
644
645
  var mode = module.get.mode();
645
- if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
646
+ switch (keyCode) {
646
647
  // arrow keys
647
- var bigIncrement = mode === 'day' ? 7 : mode === 'hour' ? 4 : mode === 'minute' ? timeGap.column : 3;
648
- var increment = keyCode === 37 ? -1 : keyCode === 38 ? -bigIncrement : keyCode == 39 ? 1 : bigIncrement;
649
- increment *= mode === 'minute' ? settings.minTimeGap : 1;
650
- var focusDate = module.get.focusDate() || module.get.date() || new Date();
651
- var year = focusDate.getFullYear() + (mode === 'year' ? increment : 0);
652
- var month = focusDate.getMonth() + (mode === 'month' ? increment : 0);
653
- var day = focusDate.getDate() + (mode === 'day' ? increment : 0);
654
- var hour = focusDate.getHours() + (mode === 'hour' ? increment : 0);
655
- var minute = focusDate.getMinutes() + (mode === 'minute' ? increment : 0);
656
- var newFocusDate = new Date(year, month, day, hour, minute);
657
- if (settings.type === 'time') {
658
- newFocusDate = module.helper.mergeDateTime(focusDate, newFocusDate);
659
- }
660
- if (module.helper.isDateInRange(newFocusDate, mode)) {
661
- module.set.focusDate(newFocusDate);
648
+ case 37:
649
+ case 38:
650
+ case 39:
651
+ case 40: {
652
+ var bigIncrement = mode === 'day' ? 7 : mode === 'hour' ? 4 : mode === 'minute' ? timeGap.column : 3;
653
+ var increment = keyCode === 37 ? -1 : keyCode === 38 ? -bigIncrement : keyCode == 39 ? 1 : bigIncrement;
654
+ increment *= mode === 'minute' ? settings.minTimeGap : 1;
655
+ var focusDate = module.get.focusDate() || module.get.date() || new Date();
656
+ var year = focusDate.getFullYear() + (mode === 'year' ? increment : 0);
657
+ var month = focusDate.getMonth() + (mode === 'month' ? increment : 0);
658
+ var day = focusDate.getDate() + (mode === 'day' ? increment : 0);
659
+ var hour = focusDate.getHours() + (mode === 'hour' ? increment : 0);
660
+ var minute = focusDate.getMinutes() + (mode === 'minute' ? increment : 0);
661
+ var newFocusDate = new Date(year, month, day, hour, minute);
662
+ if (settings.type === 'time') {
663
+ newFocusDate = module.helper.mergeDateTime(focusDate, newFocusDate);
664
+ }
665
+ if (module.helper.isDateInRange(newFocusDate, mode)) {
666
+ module.set.focusDate(newFocusDate);
667
+ }
668
+
669
+ break;
662
670
  }
663
- } else if (keyCode === 13) {
664
- // enter
665
- var date = module.get.focusDate();
666
- if (date && !settings.isDisabled(date, mode) && !module.helper.isDisabled(date, mode) && module.helper.isEnabled(date, mode)) {
667
- if (settings.onSelect.call(element, date, module.get.mode()) !== false) {
668
- module.selectDate(date);
671
+ // enter key
672
+ case 13: {
673
+ var date = module.get.focusDate();
674
+ if (date && !settings.isDisabled(date, mode) && !module.helper.isDisabled(date, mode) && module.helper.isEnabled(date, mode)) {
675
+ if (settings.onSelect.call(element, date, module.get.mode()) !== false) {
676
+ module.selectDate(date);
677
+ }
669
678
  }
679
+ // disable form submission:
680
+ event.preventDefault();
681
+ event.stopPropagation();
682
+
683
+ break;
670
684
  }
671
- // disable form submission:
672
- event.preventDefault();
673
- event.stopPropagation();
674
- } else if (keyCode === 27) {
675
- module.popup('hide');
676
- event.stopPropagation();
685
+ // escape key
686
+ case 27:
687
+ module.popup('hide');
688
+ event.stopPropagation();
689
+
690
+ break;
677
691
  }
678
692
  }
679
693
 
@@ -724,7 +738,7 @@
724
738
 
725
739
  disconnect: {
726
740
  classObserver: function () {
727
- if ($input.length && classObserver) {
741
+ if ($input.length > 0 && classObserver) {
728
742
  classObserver.disconnect();
729
743
  }
730
744
  },
@@ -732,7 +746,7 @@
732
746
 
733
747
  observe: {
734
748
  class: function () {
735
- if ($input.length && classObserver) {
749
+ if ($input.length > 0 && classObserver) {
736
750
  classObserver.observe($module[0], {
737
751
  attributes: true,
738
752
  });
@@ -758,6 +772,7 @@
758
772
  var ms1d = 864e5, // milliseconds in a day
759
773
  ms7d = 7 * ms1d; // milliseconds in a week
760
774
 
775
+ // eslint-disable-next-line wrap-iife
761
776
  return function () { // return a closure so constants get calculated only once
762
777
  var DC3 = Date.UTC(weekYear, weekMonth, weekDay + 3) / ms1d, // an Absolute Day Number
763
778
  AWN = Math.floor(DC3 / 7), // an Absolute Week Number
@@ -889,7 +904,7 @@
889
904
  }
890
905
  module.set.dataKeyValue(metadata.date, date);
891
906
 
892
- if (updateInput && $input.length) {
907
+ if (updateInput && $input.length > 0) {
893
908
  $input.val(text);
894
909
  }
895
910
 
@@ -1030,14 +1045,14 @@
1030
1045
  },
1031
1046
 
1032
1047
  focus: function () {
1033
- if ($input.length) {
1048
+ if ($input.length > 0) {
1034
1049
  $input.trigger('focus');
1035
1050
  } else {
1036
1051
  $container.trigger('focus');
1037
1052
  }
1038
1053
  },
1039
1054
  blur: function () {
1040
- if ($input.length) {
1055
+ if ($input.length > 0) {
1041
1056
  $input.trigger('blur');
1042
1057
  } else {
1043
1058
  $container.trigger('blur');
@@ -1088,7 +1103,7 @@
1088
1103
  ss: ('0' + s).slice(-2),
1089
1104
  a: a,
1090
1105
  A: a.toUpperCase(),
1091
- S: ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D % 100 - D % 10 !== 10) * D % 10],
1106
+ S: ['th', 'st', 'nd', 'rd'][(D % 10) > 3 ? 0 : (((D % 100) - (D % 10) === 10) ? 0 : D % 10)],
1092
1107
  w: w,
1093
1108
  ww: ('0' + w).slice(-2),
1094
1109
  }
@@ -1197,9 +1212,9 @@
1197
1212
 
1198
1213
  return enabled;
1199
1214
  });
1200
- } else {
1201
- return true;
1202
1215
  }
1216
+
1217
+ return true;
1203
1218
  },
1204
1219
  findDayAsObject: function (date, mode, dates) {
1205
1220
  if (mode === 'day' || mode === 'month' || mode === 'year') {
@@ -1214,11 +1229,13 @@
1214
1229
  dateObject[metadata.date] = d;
1215
1230
 
1216
1231
  return dateObject;
1217
- } else if (d !== null && typeof d === 'object') {
1232
+ }
1233
+ if (d !== null && typeof d === 'object') {
1218
1234
  if (d[metadata.year]) {
1219
1235
  if (typeof d[metadata.year] === 'number' && date.getFullYear() == d[metadata.year]) {
1220
1236
  return d;
1221
- } else if (Array.isArray(d[metadata.year])) {
1237
+ }
1238
+ if (Array.isArray(d[metadata.year])) {
1222
1239
  if (d[metadata.year].indexOf(date.getFullYear()) > -1) {
1223
1240
  return d;
1224
1241
  }
@@ -1226,7 +1243,8 @@
1226
1243
  } else if (d[metadata.month]) {
1227
1244
  if (typeof d[metadata.month] === 'number' && date.getMonth() == d[metadata.month]) {
1228
1245
  return d;
1229
- } else if (Array.isArray(d[metadata.month])) {
1246
+ }
1247
+ if (Array.isArray(d[metadata.month])) {
1230
1248
  if (d[metadata.month].indexOf(date.getMonth()) > -1) {
1231
1249
  return d;
1232
1250
  }
@@ -1239,7 +1257,8 @@
1239
1257
  } else if (d[metadata.date] && mode === 'day') {
1240
1258
  if (d[metadata.date] instanceof Date && module.helper.dateEqual(date, module.helper.sanitiseDate(d[metadata.date]), mode)) {
1241
1259
  return d;
1242
- } else if (Array.isArray(d[metadata.date])) {
1260
+ }
1261
+ if (Array.isArray(d[metadata.date])) {
1243
1262
  if (d[metadata.date].some(function (idate) {
1244
1263
  return module.helper.dateEqual(date, idate, mode);
1245
1264
  })) {
@@ -1260,7 +1279,8 @@
1260
1279
  if (d[metadata.hours]) {
1261
1280
  if (typeof d[metadata.hours] === 'number' && date.getHours() == d[metadata.hours]) {
1262
1281
  return d;
1263
- } else if (Array.isArray(d[metadata.hours])) {
1282
+ }
1283
+ if (Array.isArray(d[metadata.hours])) {
1264
1284
  if (d[metadata.hours].indexOf(date.getHours()) > -1) {
1265
1285
  return d;
1266
1286
  }
@@ -1271,11 +1291,13 @@
1271
1291
  d = hours[i];
1272
1292
  if (typeof d === 'number' && date.getHours() == d) {
1273
1293
  return null;
1274
- } else if (d !== null && typeof d === 'object') {
1294
+ }
1295
+ if (d !== null && typeof d === 'object') {
1275
1296
  if (d[metadata.days] && hourCheck(date, d)) {
1276
1297
  if (typeof d[metadata.days] === 'number' && date.getDay() == d[metadata.days]) {
1277
1298
  return d;
1278
- } else if (Array.isArray(d[metadata.days])) {
1299
+ }
1300
+ if (Array.isArray(d[metadata.days])) {
1279
1301
  if (d[metadata.days].indexOf(date.getDay()) > -1) {
1280
1302
  return d;
1281
1303
  }
@@ -1283,7 +1305,8 @@
1283
1305
  } else if (d[metadata.date] && hourCheck(date, d)) {
1284
1306
  if (d[metadata.date] instanceof Date && module.helper.dateEqual(date, module.helper.sanitiseDate(d[metadata.date]))) {
1285
1307
  return d;
1286
- } else if (Array.isArray(d[metadata.date])) {
1308
+ }
1309
+ if (Array.isArray(d[metadata.date])) {
1287
1310
  if (d[metadata.date].some(function (idate) {
1288
1311
  return module.helper.dateEqual(date, idate, mode);
1289
1312
  })) {
@@ -1310,7 +1333,10 @@
1310
1333
  return date;
1311
1334
  },
1312
1335
  dateDiff: function (date1, date2, mode) {
1313
- mode = mode || 'day';
1336
+ if (!mode) {
1337
+ mode = 'day';
1338
+ }
1339
+
1314
1340
  var isTimeOnly = settings.type === 'time';
1315
1341
  var isYear = mode === 'year';
1316
1342
  var isYearOrMonth = isYear || mode === 'month';
@@ -1433,7 +1459,7 @@
1433
1459
  previousTime
1434
1460
  ;
1435
1461
  if (settings.performance) {
1436
- currentTime = new Date().getTime();
1462
+ currentTime = Date.now();
1437
1463
  previousTime = time || currentTime;
1438
1464
  executionTime = currentTime - previousTime;
1439
1465
  time = currentTime;
@@ -1484,8 +1510,8 @@
1484
1510
  ;
1485
1511
  passedArguments = passedArguments || queryArguments;
1486
1512
  context = context || element;
1487
- if (typeof query == 'string' && object !== undefined) {
1488
- query = query.split(/[\. ]/);
1513
+ if (typeof query === 'string' && object !== undefined) {
1514
+ query = query.split(/[ .]/);
1489
1515
  maxDepth = query.length - 1;
1490
1516
  $.each(query, function (depth, value) {
1491
1517
  var camelCaseValue = (depth != maxDepth)
@@ -1633,8 +1659,7 @@
1633
1659
  today: function (settings) {
1634
1660
  return settings.type === 'date' ? settings.text.today : settings.text.now;
1635
1661
  },
1636
- cell: function (cell, date, cellOptions) {
1637
- },
1662
+ cell: function (cell, date, cellOptions) {},
1638
1663
  },
1639
1664
 
1640
1665
  parser: {
@@ -1645,17 +1670,18 @@
1645
1670
  if (!text) {
1646
1671
  return null;
1647
1672
  }
1648
- text = String(text).trim().replace(/([.:\/\-])\s+/g, '$1').replace(/\s+([.:\/-])/g, '$1').replace(/\s+/g, ' ');
1673
+ text = String(text).trim().replace(/([./:-])\s+/g, '$1').replace(/\s+([./:-])/g, '$1')
1674
+ .replace(/\s+/g, ' ');
1649
1675
  if (text.length === 0) {
1650
1676
  return null;
1651
1677
  }
1652
- if (text.match(/^[0-9]{4}[\/\-\.][0-9]{1,2}[\/\-\.][0-9]{1,2}$/)) {
1653
- text = text.replace(/[\/\-\.]/g, '/') + ' 00:00:00';
1678
+ if (/^\d{4}(?:[./-]\d{1,2}){2}$/.test(text)) {
1679
+ text = text.replace(/[./-]/g, '/') + ' 00:00:00';
1654
1680
  }
1655
1681
  // Reverse date and month in some cases
1656
- text = settings.monthFirst || !text.match(/^[0-9]{1,2}[\/\-\.]/) ? text : text.replace(/[\/\-\.]/g, '/').replace(/([0-9]+)\/([0-9]+)/, '$2/$1');
1682
+ text = settings.monthFirst || !/^\d{1,2}[./-]/.test(text) ? text : text.replace(/[./-]/g, '/').replace(/(\d+)\/(\d+)/, '$2/$1');
1657
1683
  var textDate = new Date(text);
1658
- var numberOnly = text.match(/^[0-9]+$/) !== null;
1684
+ var numberOnly = text.match(/^\d+$/) !== null;
1659
1685
  if (!numberOnly && !isNaN(textDate.getDate())) {
1660
1686
  return textDate;
1661
1687
  }
@@ -1673,7 +1699,7 @@
1673
1699
  month = -1,
1674
1700
  year = -1
1675
1701
  ;
1676
- var isAm = undefined;
1702
+ var isAm;
1677
1703
 
1678
1704
  var isTimeOnly = settings.type === 'time';
1679
1705
  var isDateOnly = settings.type.indexOf('time') < 0;
@@ -1703,7 +1729,7 @@
1703
1729
  if (hour < 0 || minute < 0) {
1704
1730
  parts = number.split(':');
1705
1731
  for (k = 0; k < Math.min(2, parts.length); k++) {
1706
- j = parseInt(parts[k]);
1732
+ j = parseInt(parts[k], 10);
1707
1733
  if (isNaN(j)) {
1708
1734
  j = 0;
1709
1735
  }
@@ -1742,7 +1768,7 @@
1742
1768
 
1743
1769
  // year > settings.centuryBreak
1744
1770
  for (i = 0; i < numbers.length; i++) {
1745
- j = parseInt(numbers[i]);
1771
+ j = parseInt(numbers[i], 10);
1746
1772
  if (isNaN(j)) {
1747
1773
  continue;
1748
1774
  }
@@ -1761,11 +1787,11 @@
1761
1787
  if (month < 0) {
1762
1788
  for (i = 0; i < numbers.length; i++) {
1763
1789
  k = i > 1 || settings.monthFirst ? i : i === 1 ? 0 : 1;
1764
- j = parseInt(numbers[k]);
1790
+ j = parseInt(numbers[k], 10);
1765
1791
  if (isNaN(j)) {
1766
1792
  continue;
1767
1793
  }
1768
- if (1 <= j && j <= 12) {
1794
+ if (j >= 1 && j <= 12) {
1769
1795
  month = j;
1770
1796
  numbers.splice(k, 1);
1771
1797
 
@@ -1776,11 +1802,11 @@
1776
1802
 
1777
1803
  // day
1778
1804
  for (i = 0; i < numbers.length; i++) {
1779
- j = parseInt(numbers[i]);
1805
+ j = parseInt(numbers[i], 10);
1780
1806
  if (isNaN(j)) {
1781
1807
  continue;
1782
1808
  }
1783
- if (1 <= j && j <= 31) {
1809
+ if (j >= 1 && j <= 31) {
1784
1810
  day = j;
1785
1811
  numbers.splice(i, 1);
1786
1812
 
@@ -1791,7 +1817,7 @@
1791
1817
  // year <= settings.centuryBreak
1792
1818
  if (year < 0) {
1793
1819
  for (i = numbers.length - 1; i >= 0; i--) {
1794
- j = parseInt(numbers[i]);
1820
+ j = parseInt(numbers[i], 10);
1795
1821
  if (isNaN(j)) {
1796
1822
  continue;
1797
1823
  }
@@ -1810,11 +1836,11 @@
1810
1836
  // hour
1811
1837
  if (hour < 0) {
1812
1838
  for (i = 0; i < numbers.length; i++) {
1813
- j = parseInt(numbers[i]);
1839
+ j = parseInt(numbers[i], 10);
1814
1840
  if (isNaN(j)) {
1815
1841
  continue;
1816
1842
  }
1817
- if (0 <= j && j <= 23) {
1843
+ if (j >= 0 && j <= 23) {
1818
1844
  hour = j;
1819
1845
  numbers.splice(i, 1);
1820
1846
 
@@ -1826,11 +1852,11 @@
1826
1852
  // minute
1827
1853
  if (minute < 0) {
1828
1854
  for (i = 0; i < numbers.length; i++) {
1829
- j = parseInt(numbers[i]);
1855
+ j = parseInt(numbers[i], 10);
1830
1856
  if (isNaN(j)) {
1831
1857
  continue;
1832
1858
  }
1833
- if (0 <= j && j <= 59) {
1859
+ if (j >= 0 && j <= 59) {
1834
1860
  minute = j;
1835
1861
  numbers.splice(i, 1);
1836
1862
 
@@ -1886,28 +1912,22 @@
1886
1912
  },
1887
1913
 
1888
1914
  // callback when date changes
1889
- onChange: function (date, text, mode) {
1890
- },
1915
+ onChange: function (date, text, mode) {},
1891
1916
 
1892
1917
  // callback before show animation, return false to prevent show
1893
- onShow: function () {
1894
- },
1918
+ onShow: function () {},
1895
1919
 
1896
1920
  // callback after show animation
1897
- onVisible: function () {
1898
- },
1921
+ onVisible: function () {},
1899
1922
 
1900
1923
  // callback before hide animation, return false to prevent hide
1901
- onHide: function () {
1902
- },
1924
+ onHide: function () {},
1903
1925
 
1904
1926
  // callback after hide animation
1905
- onHidden: function () {
1906
- },
1927
+ onHidden: function () {},
1907
1928
 
1908
1929
  // callback before item is selected, return false to prevent selection
1909
- onSelect: function (date, mode) {
1910
- },
1930
+ onSelect: function (date, mode) {},
1911
1931
 
1912
1932
  // is the given date disabled?
1913
1933
  isDisabled: function (date, mode) {
@@ -1924,7 +1944,7 @@
1924
1944
  regExp: {
1925
1945
  dateWords: /[^A-Za-z\u00C0-\u024F]+/g,
1926
1946
  dateNumbers: /[^\d:]+/g,
1927
- token: /d{1,4}|D{1,2}|M{1,4}|YY(?:YY)?|([Hhmsw])\1?|[SAaY]|"[^"]*"|'[^']*'/g,
1947
+ token: /d{1,4}|D{1,2}|M{1,4}|YY(?:YY)?|([Hhmsw])\1?|[ASYa]|"[^"]*"|'[^']*'/g,
1928
1948
  },
1929
1949
 
1930
1950
  error: {
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.21+2722e1b - Calendar
2
+ * # Fomantic-UI 2.9.1-beta.23+27384cb - Calendar
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
6
6
  * Released under the MIT license
7
7
  * https://opensource.org/licenses/MIT
8
8
  *
9
- */.ui.calendar.popup{max-width:none;padding:0;border:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ui.calendar.popup.inverted::before{background:#2b2b2b}.ui.calendar .calendar:focus,.ui.calendar.popup:focus{outline:0}.ui.calendar.popup .ui.grid{display:block;white-space:nowrap}.ui.calendar.popup .ui.grid>.column{width:auto}.ui.calendar .ui.table.minute,.ui.calendar .ui.table.month,.ui.calendar .ui.table.year{min-width:15em}.ui.calendar .ui.table.day{min-width:18em}.ui.calendar .ui.table.day.andweek{min-width:22em}.ui.calendar .ui.table.hour{min-width:20em}.ui.calendar .ui.table tr td,.ui.calendar .ui.table tr th{padding:.5em;white-space:nowrap}.ui.calendar .ui.table tr th{border-left:none}.ui.calendar .ui.table tr th i.icon{margin:0}.ui.calendar .ui.table tr:first-child th{position:relative;padding-left:0;padding-right:0}.ui.calendar .ui.table.day tr:first-child th{border:none}.ui.calendar .ui.table.day tr:nth-child(2) th{padding-top:.2em;padding-bottom:.3em}.ui.calendar .ui.table tr td{padding-left:.1em;padding-right:.1em}.ui.calendar .ui.table tr .link{cursor:pointer}.ui.calendar .ui.table tr .prev.link{width:14.28571429%;position:absolute;left:0}.ui.calendar .ui.table tr .next.link{width:14.28571429%;position:absolute;right:0}.ui.ui.calendar .ui.table tr .disabled{pointer-events:auto;cursor:default;color:rgba(40,40,40,.3)}.ui.calendar .ui.table tr .adjacent:not(.disabled):not(.active){color:rgba(0,0,0,.6);background:rgba(0,0,0,.03)}.ui.calendar .ui.table tr td.today{font-weight:700}.ui.calendar .ui.table tr td.range{background:rgba(0,0,0,.05);color:rgba(0,0,0,.95);-webkit-box-shadow:none;box-shadow:none}.ui.calendar:not(.disabled).popup.active .ui.table tbody tr td.focus,.ui.calendar:not(.disabled):focus .ui.table tbody tr td.focus{-webkit-box-shadow:inset 0 0 0 1px #85b7d9;box-shadow:inset 0 0 0 1px #85b7d9}.ui.inverted.calendar .ui.table.inverted tr td.range{background:rgba(255,255,255,.08);color:#fff;-webkit-box-shadow:none;box-shadow:none}.ui.inverted.calendar:not(.disabled) .calendar:focus .ui.table.inverted tbody tr td.focus,.ui.inverted.calendar:not(.disabled).popup.active .ui.table.inverted tbody tr td.focus{-webkit-box-shadow:inset 0 0 0 1px #85b7d9;box-shadow:inset 0 0 0 1px #85b7d9}.ui.inverted.calendar .ui.ui.ui.inverted.table tr .disabled{color:rgba(225,225,225,.3)}.ui.inverted.calendar .ui.inverted.table tr .adjacent:not(.disabled):not(.active){color:rgba(255,255,255,.8);background:rgba(255,255,255,.02)}.ui.calendar.popup>.ui.ui.grid{margin:-1rem}.ui.calendar.popup>.ui.ui.grid>.column:not(:first-child){padding-left:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:first-child)>.ui.table{border-top-left-radius:0;border-bottom-left-radius:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:last-child){padding-right:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:last-child)>.ui.table{border-top-right-radius:0;border-bottom-right-radius:0}.ui.disabled.calendar{opacity:.45}.ui.disabled.calendar .ui.table tr .link,.ui.disabled.calendar>.input{pointer-events:none}
9
+ */.ui.calendar.popup{max-width:none;padding:0;border:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ui.calendar.popup.inverted::before{background:#2b2b2b}.ui.calendar .calendar:focus,.ui.calendar.popup:focus{outline:0}.ui.calendar.popup .ui.grid{display:block;white-space:nowrap}.ui.calendar.popup .ui.grid>.column{width:auto}.ui.calendar .ui.table.minute,.ui.calendar .ui.table.month,.ui.calendar .ui.table.year{min-width:15em}.ui.calendar .ui.table.day{min-width:18em}.ui.calendar .ui.table.day.andweek{min-width:22em}.ui.calendar .ui.table.hour{min-width:20em}.ui.calendar .ui.table tr td,.ui.calendar .ui.table tr th{padding:.5em;white-space:nowrap}.ui.calendar .ui.table tr th{border-left:none}.ui.calendar .ui.table tr th i.icon{margin:0}.ui.calendar .ui.table tr:first-child th{position:relative;padding-left:0;padding-right:0}.ui.calendar .ui.table.day tr:first-child th{border:none}.ui.calendar .ui.table.day tr:nth-child(2) th{padding-top:.2em;padding-bottom:.3em}.ui.calendar .ui.table tr td{padding-left:.1em;padding-right:.1em}.ui.calendar .ui.table tr .link{cursor:pointer}.ui.calendar .ui.table tr .prev.link{width:14.28571%;position:absolute;left:0}.ui.calendar .ui.table tr .next.link{width:14.28571%;position:absolute;right:0}.ui.ui.calendar .ui.table tr .disabled{pointer-events:auto;cursor:default;color:rgba(40,40,40,.3)}.ui.calendar .ui.table tr .adjacent:not(.disabled):not(.active){color:rgba(0,0,0,.6);background:rgba(0,0,0,.03)}.ui.calendar .ui.table tr td.today{font-weight:700}.ui.calendar .ui.table tr td.range{background:rgba(0,0,0,.05);color:rgba(0,0,0,.95);-webkit-box-shadow:none;box-shadow:none}.ui.calendar:not(.disabled).popup.active .ui.table tbody tr td.focus,.ui.calendar:not(.disabled):focus .ui.table tbody tr td.focus{-webkit-box-shadow:inset 0 0 0 1px #85b7d9;box-shadow:inset 0 0 0 1px #85b7d9}.ui.inverted.calendar .ui.table.inverted tr td.range{background:rgba(255,255,255,.08);color:#fff;-webkit-box-shadow:none;box-shadow:none}.ui.inverted.calendar:not(.disabled) .calendar:focus .ui.table.inverted tbody tr td.focus,.ui.inverted.calendar:not(.disabled).popup.active .ui.table.inverted tbody tr td.focus{-webkit-box-shadow:inset 0 0 0 1px #85b7d9;box-shadow:inset 0 0 0 1px #85b7d9}.ui.inverted.calendar .ui.ui.ui.inverted.table tr .disabled{color:rgba(225,225,225,.3)}.ui.inverted.calendar .ui.inverted.table tr .adjacent:not(.disabled):not(.active){color:rgba(255,255,255,.8);background:rgba(255,255,255,.02)}.ui.calendar.popup>.ui.ui.grid{margin:-1rem}.ui.calendar.popup>.ui.ui.grid>.column:not(:first-child){padding-left:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:first-child)>.ui.table{border-top-left-radius:0;border-bottom-left-radius:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:last-child){padding-right:0}.ui.calendar.popup>.ui.ui.grid>.column:not(:last-child)>.ui.table{border-top-right-radius:0;border-bottom-right-radius:0}.ui.disabled.calendar{opacity:.45}.ui.disabled.calendar .ui.table tr .link,.ui.disabled.calendar>.input{pointer-events:none}