rails-active-ui 0.3.0 → 0.3.2

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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/app/javascript/ui/controllers/turbo_modal_controller.js +36 -0
  3. data/config/importmap.rb +1 -0
  4. data/formantic-ui/components/accordion.css +369 -0
  5. data/formantic-ui/components/accordion.js +595 -0
  6. data/formantic-ui/components/accordion.min.css +9 -0
  7. data/formantic-ui/components/accordion.min.js +11 -0
  8. data/formantic-ui/components/ad.css +264 -0
  9. data/formantic-ui/components/ad.min.css +10 -0
  10. data/formantic-ui/components/api.js +1225 -0
  11. data/formantic-ui/components/api.min.js +11 -0
  12. data/formantic-ui/components/breadcrumb.css +135 -0
  13. data/formantic-ui/components/breadcrumb.min.css +9 -0
  14. data/formantic-ui/components/button.css +4058 -0
  15. data/formantic-ui/components/button.min.css +9 -0
  16. data/formantic-ui/components/calendar.css +327 -0
  17. data/formantic-ui/components/calendar.js +2045 -0
  18. data/formantic-ui/components/calendar.min.css +9 -0
  19. data/formantic-ui/components/calendar.min.js +11 -0
  20. data/formantic-ui/components/card.css +1881 -0
  21. data/formantic-ui/components/card.min.css +9 -0
  22. data/formantic-ui/components/checkbox.css +785 -0
  23. data/formantic-ui/components/checkbox.js +888 -0
  24. data/formantic-ui/components/checkbox.min.css +9 -0
  25. data/formantic-ui/components/checkbox.min.js +11 -0
  26. data/formantic-ui/components/comment.css +283 -0
  27. data/formantic-ui/components/comment.min.css +9 -0
  28. data/formantic-ui/components/container.css +300 -0
  29. data/formantic-ui/components/container.min.css +9 -0
  30. data/formantic-ui/components/dimmer.css +367 -0
  31. data/formantic-ui/components/dimmer.js +732 -0
  32. data/formantic-ui/components/dimmer.min.css +9 -0
  33. data/formantic-ui/components/dimmer.min.js +11 -0
  34. data/formantic-ui/components/divider.css +287 -0
  35. data/formantic-ui/components/divider.min.css +9 -0
  36. data/formantic-ui/components/dropdown.css +2087 -0
  37. data/formantic-ui/components/dropdown.js +4432 -0
  38. data/formantic-ui/components/dropdown.min.css +9 -0
  39. data/formantic-ui/components/dropdown.min.js +11 -0
  40. data/formantic-ui/components/embed.css +155 -0
  41. data/formantic-ui/components/embed.js +688 -0
  42. data/formantic-ui/components/embed.min.css +9 -0
  43. data/formantic-ui/components/embed.min.js +11 -0
  44. data/formantic-ui/components/emoji.css +15311 -0
  45. data/formantic-ui/components/emoji.min.css +9 -0
  46. data/formantic-ui/components/feed.css +799 -0
  47. data/formantic-ui/components/feed.min.css +9 -0
  48. data/formantic-ui/components/flag.css +1149 -0
  49. data/formantic-ui/components/flag.min.css +9 -0
  50. data/formantic-ui/components/flyout.css +546 -0
  51. data/formantic-ui/components/flyout.js +1551 -0
  52. data/formantic-ui/components/flyout.min.css +9 -0
  53. data/formantic-ui/components/flyout.min.js +11 -0
  54. data/formantic-ui/components/form.css +1885 -0
  55. data/formantic-ui/components/form.js +2199 -0
  56. data/formantic-ui/components/form.min.css +9 -0
  57. data/formantic-ui/components/form.min.js +11 -0
  58. data/formantic-ui/components/grid.css +1952 -0
  59. data/formantic-ui/components/grid.min.css +9 -0
  60. data/formantic-ui/components/header.css +778 -0
  61. data/formantic-ui/components/header.min.css +9 -0
  62. data/formantic-ui/components/icon.css +7066 -0
  63. data/formantic-ui/components/icon.min.css +9 -0
  64. data/formantic-ui/components/image.css +315 -0
  65. data/formantic-ui/components/image.min.css +9 -0
  66. data/formantic-ui/components/input.css +1566 -0
  67. data/formantic-ui/components/input.min.css +9 -0
  68. data/formantic-ui/components/item.css +534 -0
  69. data/formantic-ui/components/item.min.css +9 -0
  70. data/formantic-ui/components/label.css +2114 -0
  71. data/formantic-ui/components/label.min.css +9 -0
  72. data/formantic-ui/components/list.css +955 -0
  73. data/formantic-ui/components/list.min.css +9 -0
  74. data/formantic-ui/components/loader.css +787 -0
  75. data/formantic-ui/components/loader.min.css +9 -0
  76. data/formantic-ui/components/menu.css +2131 -0
  77. data/formantic-ui/components/menu.min.css +9 -0
  78. data/formantic-ui/components/message.css +619 -0
  79. data/formantic-ui/components/message.min.css +9 -0
  80. data/formantic-ui/components/modal.css +779 -0
  81. data/formantic-ui/components/modal.js +1637 -0
  82. data/formantic-ui/components/modal.min.css +9 -0
  83. data/formantic-ui/components/modal.min.js +11 -0
  84. data/formantic-ui/components/nag.css +290 -0
  85. data/formantic-ui/components/nag.js +566 -0
  86. data/formantic-ui/components/nag.min.css +9 -0
  87. data/formantic-ui/components/nag.min.js +11 -0
  88. data/formantic-ui/components/placeholder.css +228 -0
  89. data/formantic-ui/components/placeholder.min.css +9 -0
  90. data/formantic-ui/components/popup.css +1184 -0
  91. data/formantic-ui/components/popup.js +1561 -0
  92. data/formantic-ui/components/popup.min.css +9 -0
  93. data/formantic-ui/components/popup.min.js +11 -0
  94. data/formantic-ui/components/progress.css +761 -0
  95. data/formantic-ui/components/progress.js +979 -0
  96. data/formantic-ui/components/progress.min.css +9 -0
  97. data/formantic-ui/components/progress.min.js +11 -0
  98. data/formantic-ui/components/rail.css +147 -0
  99. data/formantic-ui/components/rail.min.css +9 -0
  100. data/formantic-ui/components/rating.css +414 -0
  101. data/formantic-ui/components/rating.js +540 -0
  102. data/formantic-ui/components/rating.min.css +9 -0
  103. data/formantic-ui/components/rating.min.js +11 -0
  104. data/formantic-ui/components/reset.css +386 -0
  105. data/formantic-ui/components/reset.min.css +9 -0
  106. data/formantic-ui/components/reveal.css +277 -0
  107. data/formantic-ui/components/reveal.min.css +9 -0
  108. data/formantic-ui/components/search.css +541 -0
  109. data/formantic-ui/components/search.js +1641 -0
  110. data/formantic-ui/components/search.min.css +9 -0
  111. data/formantic-ui/components/search.min.js +11 -0
  112. data/formantic-ui/components/segment.css +1053 -0
  113. data/formantic-ui/components/segment.min.css +9 -0
  114. data/formantic-ui/components/shape.css +144 -0
  115. data/formantic-ui/components/shape.js +797 -0
  116. data/formantic-ui/components/shape.min.css +9 -0
  117. data/formantic-ui/components/shape.min.js +11 -0
  118. data/formantic-ui/components/sidebar.css +539 -0
  119. data/formantic-ui/components/sidebar.js +1054 -0
  120. data/formantic-ui/components/sidebar.min.css +9 -0
  121. data/formantic-ui/components/sidebar.min.js +11 -0
  122. data/formantic-ui/components/site.css +286 -0
  123. data/formantic-ui/components/site.js +455 -0
  124. data/formantic-ui/components/site.min.css +9 -0
  125. data/formantic-ui/components/site.min.js +11 -0
  126. data/formantic-ui/components/slider.css +926 -0
  127. data/formantic-ui/components/slider.js +1546 -0
  128. data/formantic-ui/components/slider.min.css +9 -0
  129. data/formantic-ui/components/slider.min.js +11 -0
  130. data/formantic-ui/components/state.js +697 -0
  131. data/formantic-ui/components/state.min.js +11 -0
  132. data/formantic-ui/components/statistic.css +586 -0
  133. data/formantic-ui/components/statistic.min.css +9 -0
  134. data/formantic-ui/components/step.css +1538 -0
  135. data/formantic-ui/components/step.min.css +9 -0
  136. data/formantic-ui/components/sticky.css +73 -0
  137. data/formantic-ui/components/sticky.js +917 -0
  138. data/formantic-ui/components/sticky.min.css +9 -0
  139. data/formantic-ui/components/sticky.min.js +11 -0
  140. data/formantic-ui/components/tab.css +84 -0
  141. data/formantic-ui/components/tab.js +967 -0
  142. data/formantic-ui/components/tab.min.css +9 -0
  143. data/formantic-ui/components/tab.min.js +11 -0
  144. data/formantic-ui/components/table.css +3473 -0
  145. data/formantic-ui/components/table.min.css +9 -0
  146. data/formantic-ui/components/text.css +155 -0
  147. data/formantic-ui/components/text.min.css +9 -0
  148. data/formantic-ui/components/toast.css +751 -0
  149. data/formantic-ui/components/toast.js +964 -0
  150. data/formantic-ui/components/toast.min.css +9 -0
  151. data/formantic-ui/components/toast.min.js +11 -0
  152. data/formantic-ui/components/transition.css +1148 -0
  153. data/formantic-ui/components/transition.js +1034 -0
  154. data/formantic-ui/components/transition.min.css +9 -0
  155. data/formantic-ui/components/transition.min.js +11 -0
  156. data/formantic-ui/components/visibility.js +1292 -0
  157. data/formantic-ui/components/visibility.min.js +11 -0
  158. data/formantic-ui/semantic.css +78485 -0
  159. data/formantic-ui/semantic.js +31036 -0
  160. data/formantic-ui/semantic.min.css +11 -0
  161. data/formantic-ui/semantic.min.js +11 -0
  162. data/formantic-ui/themes/basic/assets/fonts/LICENSE.txt +91 -0
  163. data/formantic-ui/themes/basic/assets/fonts/icons.woff +0 -0
  164. data/formantic-ui/themes/basic/assets/fonts/icons.woff2 +0 -0
  165. data/formantic-ui/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  166. data/formantic-ui/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  167. data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  168. data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  169. data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  170. data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  171. data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  172. data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  173. data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  174. data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  175. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  176. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  177. data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  178. data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  179. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  180. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  181. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  182. data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  183. data/formantic-ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  184. data/formantic-ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  185. data/formantic-ui/themes/default/assets/fonts/icons.woff +0 -0
  186. data/formantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
  187. data/formantic-ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  188. data/formantic-ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  189. data/formantic-ui/themes/famfamfam/assets/images/flags.png +0 -0
  190. data/formantic-ui/themes/github/assets/fonts/LICENSE.txt +94 -0
  191. data/formantic-ui/themes/github/assets/fonts/octicons.woff +0 -0
  192. data/formantic-ui/themes/github/assets/fonts/octicons.woff2 +0 -0
  193. data/formantic-ui/themes/material/assets/fonts/LICENSE.txt +202 -0
  194. data/formantic-ui/themes/material/assets/fonts/icons.woff +0 -0
  195. data/formantic-ui/themes/material/assets/fonts/icons.woff2 +0 -0
  196. data/lib/ui/version.rb +1 -1
  197. metadata +194 -1
@@ -0,0 +1,1054 @@
1
+ /*!
2
+ * # Fomantic-UI 2.9.4 - Sidebar
3
+ * https://github.com/fomantic/Fomantic-UI/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * https://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ (function ($, window, document) {
12
+ 'use strict';
13
+
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
17
+
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
21
+
22
+ $.fn.sidebar = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $body = $('body'),
28
+ $html = $('html'),
29
+ $head = $('head'),
30
+
31
+ time = Date.now(),
32
+ performance = [],
33
+
34
+ query = arguments[0],
35
+ methodInvoked = typeof query === 'string',
36
+ queryArguments = [].slice.call(arguments, 1),
37
+ contextCheck = function (context, win) {
38
+ var $context;
39
+ if ([window, document].indexOf(context) >= 0) {
40
+ $context = $body;
41
+ } else {
42
+ $context = $(win.document).find(context);
43
+ if ($context.length === 0) {
44
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
45
+ }
46
+ }
47
+
48
+ return $context;
49
+ },
50
+ returnedValue;
51
+
52
+ $allModules.each(function () {
53
+ var
54
+ settings = $.isPlainObject(parameters)
55
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
56
+ : $.extend({}, $.fn.sidebar.settings),
57
+
58
+ selector = settings.selector,
59
+ className = settings.className,
60
+ namespace = settings.namespace,
61
+ regExp = settings.regExp,
62
+ error = settings.error,
63
+
64
+ eventNamespace = '.' + namespace,
65
+ moduleNamespace = 'module-' + namespace,
66
+
67
+ $module = $(this),
68
+ $context = contextCheck(settings.context, window),
69
+ isBody = $context[0] === $body[0],
70
+
71
+ $sidebars = $module.children(selector.sidebar),
72
+ $fixed = $context.children(selector.fixed),
73
+ $pusher = $context.children(selector.pusher),
74
+ $style,
75
+
76
+ element = this,
77
+ instance = $module.data(moduleNamespace),
78
+
79
+ elementNamespace,
80
+ id,
81
+ currentScroll,
82
+ initialBodyMargin = '',
83
+ tempBodyMargin = '',
84
+ hadScrollbar = false,
85
+
86
+ module
87
+ ;
88
+
89
+ module = {
90
+
91
+ initialize: function () {
92
+ module.debug('Initializing sidebar', parameters);
93
+
94
+ module.create.id();
95
+
96
+ // avoids locking rendering if initialized in onReady
97
+ if (settings.delaySetup) {
98
+ requestAnimationFrame(module.setup.layout);
99
+ } else {
100
+ module.setup.layout();
101
+ }
102
+
103
+ requestAnimationFrame(function () {
104
+ module.setup.cache();
105
+ });
106
+
107
+ module.instantiate();
108
+ },
109
+
110
+ instantiate: function () {
111
+ module.verbose('Storing instance of module', module);
112
+ instance = module;
113
+ $module
114
+ .data(moduleNamespace, module)
115
+ ;
116
+ },
117
+
118
+ create: {
119
+ id: function () {
120
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
121
+ elementNamespace = '.' + id;
122
+ module.verbose('Creating unique id for element', id);
123
+ },
124
+ },
125
+
126
+ destroy: function () {
127
+ module.verbose('Destroying previous module for', $module);
128
+ $module
129
+ .off(eventNamespace)
130
+ .removeData(moduleNamespace)
131
+ ;
132
+ // bound by uuid
133
+ $context.off(elementNamespace);
134
+ $window.off(elementNamespace);
135
+ $document.off(elementNamespace);
136
+ },
137
+
138
+ event: {
139
+ clickaway: function (event) {
140
+ if (settings.closable) {
141
+ var
142
+ clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
143
+ clickedContext = $context.is(event.target)
144
+ ;
145
+ if (clickedInPusher) {
146
+ module.verbose('User clicked on dimmed page');
147
+ module.hide();
148
+ }
149
+ if (clickedContext) {
150
+ module.verbose('User clicked on dimmable context (scaled out page)');
151
+ module.hide();
152
+ }
153
+ }
154
+ },
155
+ touch: function (event) {
156
+ // event.stopPropagation();
157
+ },
158
+ containScroll: function (event) {
159
+ if (element.scrollTop <= 0) {
160
+ element.scrollTop = 1;
161
+ }
162
+ if ((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
163
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
164
+ }
165
+ },
166
+ scroll: function (event) {
167
+ if ($(event.target).closest(selector.sidebar).length === 0) {
168
+ event.preventDefault();
169
+ }
170
+ },
171
+ },
172
+
173
+ bind: {
174
+ clickaway: function () {
175
+ module.verbose('Adding clickaway events to context', $context);
176
+ $context
177
+ .on('click' + elementNamespace, module.event.clickaway)
178
+ .on('touchend' + elementNamespace, module.event.clickaway)
179
+ ;
180
+ },
181
+ scrollLock: function () {
182
+ if (settings.scrollLock) {
183
+ module.debug('Disabling page scroll');
184
+ hadScrollbar = module.has.scrollbar();
185
+ if (hadScrollbar) {
186
+ module.save.bodyMargin();
187
+ module.set.bodyMargin();
188
+ }
189
+ $context.addClass(className.locked);
190
+ }
191
+ module.verbose('Adding events to contain sidebar scroll');
192
+ $document
193
+ .on('touchmove' + elementNamespace, module.event.touch)
194
+ ;
195
+ $module
196
+ .on('scroll' + eventNamespace, module.event.containScroll)
197
+ ;
198
+ },
199
+ },
200
+ unbind: {
201
+ clickaway: function () {
202
+ module.verbose('Removing clickaway events from context', $context);
203
+ $context.off(elementNamespace);
204
+ },
205
+ scrollLock: function () {
206
+ module.verbose('Removing scroll lock from page');
207
+ if (hadScrollbar) {
208
+ module.restore.bodyMargin();
209
+ }
210
+ $context.removeClass(className.locked);
211
+ $document.off(elementNamespace);
212
+ $module.off('scroll' + eventNamespace);
213
+ },
214
+ },
215
+
216
+ add: {
217
+ inlineCSS: function () {
218
+ var
219
+ width = module.cache.width || $module.outerWidth(),
220
+ height = module.cache.height || $module.outerHeight(),
221
+ isRTL = module.is.rtl(),
222
+ direction = module.get.direction(),
223
+ distance = {
224
+ left: width,
225
+ right: -width,
226
+ top: height,
227
+ bottom: -height,
228
+ },
229
+ style
230
+ ;
231
+
232
+ if (isRTL) {
233
+ module.verbose('RTL detected, flipping widths');
234
+ distance.left = -width;
235
+ distance.right = width;
236
+ }
237
+
238
+ style = '<style>';
239
+
240
+ if (direction === 'left' || direction === 'right') {
241
+ module.debug('Adding CSS rules for animation distance', width);
242
+ style += ''
243
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
244
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
245
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
246
+ + ' }';
247
+ } else if (direction === 'top' || direction === 'bottom') {
248
+ style += ''
249
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
250
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
251
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
252
+ + ' }';
253
+ }
254
+
255
+ /* IE is only browser not to create context with transforms */
256
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
257
+ if (module.is.ie()) {
258
+ if (direction === 'left' || direction === 'right') {
259
+ module.debug('Adding CSS rules for animation distance', width);
260
+ style += ''
261
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
262
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
263
+ + ' }';
264
+ } else if (direction === 'top' || direction === 'bottom') {
265
+ style += ''
266
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
267
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
268
+ + ' }';
269
+ }
270
+ /* opposite sides visible forces content overlay */
271
+ style += ''
272
+ + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher::after,'
273
+ + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher::after {'
274
+ + ' transform: translate3d(0, 0, 0);'
275
+ + ' }';
276
+ }
277
+ style += '</style>';
278
+ $style = $(style)
279
+ .appendTo($head)
280
+ ;
281
+ module.debug('Adding sizing css to head', $style);
282
+ },
283
+ },
284
+
285
+ refresh: function () {
286
+ module.verbose('Refreshing selector cache');
287
+ $context = contextCheck(settings.context, window);
288
+ module.refreshSidebars();
289
+ $pusher = $context.children(selector.pusher);
290
+ $fixed = $context.children(selector.fixed);
291
+ module.clear.cache();
292
+ },
293
+
294
+ refreshSidebars: function () {
295
+ module.verbose('Refreshing other sidebars');
296
+ $sidebars = $context.children(selector.sidebar);
297
+ },
298
+
299
+ repaint: function () {
300
+ module.verbose('Forcing repaint event');
301
+ element.style.display = 'none';
302
+ var ignored = element.offsetHeight;
303
+ element.scrollTop = element.scrollTop; // eslint-disable-line no-self-assign
304
+ element.style.display = '';
305
+ },
306
+
307
+ setup: {
308
+ cache: function () {
309
+ module.cache = {
310
+ width: $module.outerWidth(),
311
+ height: $module.outerHeight(),
312
+ };
313
+ },
314
+ layout: function () {
315
+ if ($context.children(selector.pusher).length === 0) {
316
+ module.debug('Adding wrapper element for sidebar');
317
+ module.error(error.pusher);
318
+ $pusher = $('<div class="pusher" />');
319
+ $context
320
+ .children()
321
+ .not(selector.omitted)
322
+ .not($sidebars)
323
+ .wrapAll($pusher)
324
+ ;
325
+ module.refresh();
326
+ }
327
+ if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
328
+ module.debug('Moved sidebar to correct parent element');
329
+ module.error(error.movedSidebar, element);
330
+ $module.detach().prependTo($context);
331
+ module.refresh();
332
+ }
333
+ module.clear.cache();
334
+ module.set.pushable();
335
+ module.set.direction();
336
+ },
337
+ },
338
+
339
+ attachEvents: function (selector, event) {
340
+ var
341
+ $toggle = $(selector)
342
+ ;
343
+ event = isFunction(module[event])
344
+ ? module[event]
345
+ : module.toggle;
346
+ if ($toggle.length > 0) {
347
+ module.debug('Attaching sidebar events to element', selector, event);
348
+ $toggle
349
+ .on('click' + eventNamespace, event)
350
+ ;
351
+ } else {
352
+ module.error(error.notFound, selector);
353
+ }
354
+ },
355
+ can: {
356
+ leftBodyScrollbar: function () {
357
+ if (module.cache.leftBodyScrollbar === undefined) {
358
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
359
+ }
360
+
361
+ return module.cache.leftBodyScrollbar;
362
+ },
363
+ },
364
+ save: {
365
+ bodyMargin: function () {
366
+ initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
367
+ var
368
+ bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
369
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
370
+ ;
371
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
372
+ },
373
+ },
374
+ show: function (callback) {
375
+ callback = isFunction(callback)
376
+ ? callback
377
+ : function () {};
378
+ if (module.is.hidden()) {
379
+ if (settings.onShow.call(element) === false) {
380
+ module.verbose('Show callback returned false cancelling show');
381
+
382
+ return;
383
+ }
384
+ if (settings.overlay) {
385
+ module.error(error.overlay);
386
+ settings.transition = 'overlay';
387
+ }
388
+ module.refresh();
389
+ if (module.othersActive()) {
390
+ module.debug('Other sidebars currently visible');
391
+ if (settings.exclusive) {
392
+ // if not overlay queue animation after hide
393
+ if (settings.transition !== 'overlay') {
394
+ module.hideOthers(module.show);
395
+
396
+ return;
397
+ }
398
+
399
+ module.hideOthers();
400
+ } else {
401
+ settings.transition = 'overlay';
402
+ }
403
+ }
404
+ module.set.dimmerStyles();
405
+ module.pushPage(function () {
406
+ callback.call(element);
407
+ settings.onVisible.call(element);
408
+ });
409
+ settings.onChange.call(element);
410
+ } else {
411
+ module.debug('Sidebar is already visible');
412
+ }
413
+ },
414
+
415
+ hide: function (callback) {
416
+ callback = isFunction(callback)
417
+ ? callback
418
+ : function () {};
419
+ if ((module.is.visible() || module.is.animating()) && settings.onHide.call(element) !== false) {
420
+ module.debug('Hiding sidebar', callback);
421
+ module.refreshSidebars();
422
+ module.pullPage(function () {
423
+ callback.call(element);
424
+ settings.onHidden.call(element);
425
+ });
426
+ settings.onChange.call(element);
427
+ }
428
+ },
429
+
430
+ othersAnimating: function () {
431
+ return $sidebars.not($module).filter('.' + className.animating).length > 0;
432
+ },
433
+ othersVisible: function () {
434
+ return $sidebars.not($module).filter('.' + className.visible).length > 0;
435
+ },
436
+ othersActive: function () {
437
+ return module.othersVisible() || module.othersAnimating();
438
+ },
439
+
440
+ hideOthers: function (callback) {
441
+ var
442
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
443
+ sidebarCount = $otherSidebars.length,
444
+ callbackCount = 0
445
+ ;
446
+ callback = callback || function () {};
447
+ $otherSidebars
448
+ .sidebar('hide', function () {
449
+ callbackCount++;
450
+ if (callbackCount === sidebarCount) {
451
+ callback();
452
+ }
453
+ })
454
+ ;
455
+ },
456
+
457
+ toggle: function () {
458
+ module.verbose('Determining toggled direction');
459
+ if (module.is.hidden()) {
460
+ module.show();
461
+ } else {
462
+ module.hide();
463
+ }
464
+ },
465
+
466
+ pushPage: function (callback) {
467
+ var
468
+ transition = module.get.transition(),
469
+ $transition = transition === 'overlay' || module.othersActive()
470
+ ? $module
471
+ : $pusher,
472
+ animate,
473
+ dim,
474
+ transitionEnd
475
+ ;
476
+ callback = isFunction(callback)
477
+ ? callback
478
+ : function () {};
479
+ if (settings.returnScroll) {
480
+ currentScroll = (isBody ? $window : $context).scrollTop();
481
+ }
482
+ if (settings.transition === 'scale down') {
483
+ module.scrollToTop();
484
+ }
485
+ module.bind.scrollLock();
486
+ module.set.transition(transition);
487
+ module.repaint();
488
+ animate = function () {
489
+ module.bind.clickaway();
490
+ module.add.inlineCSS();
491
+ module.set.animating();
492
+ module.set.visible();
493
+ };
494
+ dim = function () {
495
+ module.set.dimmed();
496
+ };
497
+ transitionEnd = function (event) {
498
+ if (event.target === $transition[0]) {
499
+ $transition.off('transitionend' + elementNamespace, transitionEnd);
500
+ module.remove.animating();
501
+ callback.call(element);
502
+ }
503
+ };
504
+ $transition.off('transitionend' + elementNamespace);
505
+ $transition.on('transitionend' + elementNamespace, transitionEnd);
506
+ requestAnimationFrame(animate);
507
+ if (settings.dimPage && !module.othersVisible()) {
508
+ requestAnimationFrame(dim);
509
+ }
510
+ },
511
+
512
+ pullPage: function (callback) {
513
+ var
514
+ transition = module.get.transition(),
515
+ $transition = transition === 'overlay' || module.othersActive()
516
+ ? $module
517
+ : $pusher,
518
+ animate,
519
+ transitionEnd
520
+ ;
521
+ callback = isFunction(callback)
522
+ ? callback
523
+ : function () {};
524
+ module.verbose('Removing context push state', module.get.direction());
525
+
526
+ module.unbind.clickaway();
527
+ module.unbind.scrollLock();
528
+
529
+ animate = function () {
530
+ module.set.transition(transition);
531
+ module.set.animating();
532
+ if (settings.dimPage && !module.othersVisible()) {
533
+ module.set.closing();
534
+ }
535
+ module.remove.visible();
536
+ };
537
+ transitionEnd = function (event) {
538
+ if (event.target === $transition[0]) {
539
+ $transition.off('transitionend' + elementNamespace, transitionEnd);
540
+ module.remove.animating();
541
+ module.remove.closing();
542
+ module.remove.transition();
543
+ module.remove.inlineCSS();
544
+ if (transition === 'scale down' || settings.returnScroll) {
545
+ module.scrollBack();
546
+ }
547
+ if (settings.dimPage && !module.othersVisible()) {
548
+ $pusher.removeClass(className.dimmed);
549
+ }
550
+ callback.call(element);
551
+ }
552
+ };
553
+ $transition.off('transitionend' + elementNamespace);
554
+ $transition.on('transitionend' + elementNamespace, transitionEnd);
555
+ requestAnimationFrame(animate);
556
+ },
557
+
558
+ scrollToTop: function () {
559
+ module.verbose('Scrolling to top of page to avoid animation issues');
560
+ $module.scrollTop(0);
561
+ (isBody ? $window : $context)[0].scrollTo(0, 0);
562
+ },
563
+
564
+ scrollBack: function () {
565
+ module.verbose('Scrolling back to original page position');
566
+ (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
567
+ },
568
+
569
+ clear: {
570
+ cache: function () {
571
+ module.verbose('Clearing cached dimensions');
572
+ module.cache = {};
573
+ },
574
+ },
575
+
576
+ set: {
577
+ bodyMargin: function () {
578
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
579
+ $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
580
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
581
+ var
582
+ el = $(this),
583
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
584
+ ;
585
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
586
+ });
587
+ },
588
+ dimmerStyles: function () {
589
+ if (settings.blurring) {
590
+ $pusher.addClass(className.blurring);
591
+ } else {
592
+ $pusher.removeClass(className.blurring);
593
+ }
594
+ },
595
+
596
+ // container
597
+ pushed: function () {
598
+ $context.addClass(className.pushed);
599
+ },
600
+ pushable: function () {
601
+ $context.addClass(className.pushable);
602
+ },
603
+
604
+ // pusher
605
+ dimmed: function () {
606
+ $pusher.addClass(className.dimmed);
607
+ },
608
+
609
+ // sidebar
610
+ active: function () {
611
+ $module.addClass(className.active);
612
+ },
613
+ animating: function () {
614
+ $module.addClass(className.animating);
615
+ },
616
+ closing: function () {
617
+ $pusher.addClass(className.closing);
618
+ },
619
+ transition: function (transition) {
620
+ transition = transition || module.get.transition();
621
+ $module.addClass(transition);
622
+ },
623
+ direction: function (direction) {
624
+ direction = direction || module.get.direction();
625
+ $module.addClass(className[direction]);
626
+ },
627
+ visible: function () {
628
+ $module.addClass(className.visible);
629
+ },
630
+ overlay: function () {
631
+ $module.addClass(className.overlay);
632
+ },
633
+ },
634
+ remove: {
635
+
636
+ inlineCSS: function () {
637
+ module.debug('Removing inline css styles', $style);
638
+ if ($style && $style.length > 0) {
639
+ $style.remove();
640
+ }
641
+ },
642
+
643
+ // context
644
+ pushed: function () {
645
+ $context.removeClass(className.pushed);
646
+ },
647
+ pushable: function () {
648
+ $context.removeClass(className.pushable);
649
+ },
650
+
651
+ // sidebar
652
+ active: function () {
653
+ $module.removeClass(className.active);
654
+ },
655
+ animating: function () {
656
+ $module.removeClass(className.animating);
657
+ },
658
+ closing: function () {
659
+ $pusher.removeClass(className.closing);
660
+ },
661
+ transition: function (transition) {
662
+ transition = transition || module.get.transition();
663
+ $module.removeClass(transition);
664
+ },
665
+ direction: function (direction) {
666
+ direction = direction || module.get.direction();
667
+ $module.removeClass(className[direction]);
668
+ },
669
+ visible: function () {
670
+ $module.removeClass(className.visible);
671
+ },
672
+ overlay: function () {
673
+ $module.removeClass(className.overlay);
674
+ },
675
+ },
676
+ restore: {
677
+ bodyMargin: function () {
678
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
679
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
680
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
681
+ var
682
+ el = $(this),
683
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
684
+ ;
685
+ el.css(attribute, '');
686
+ });
687
+ },
688
+ },
689
+ get: {
690
+ direction: function () {
691
+ if ($module.hasClass(className.top)) {
692
+ return className.top;
693
+ }
694
+ if ($module.hasClass(className.right)) {
695
+ return className.right;
696
+ }
697
+ if ($module.hasClass(className.bottom)) {
698
+ return className.bottom;
699
+ }
700
+
701
+ return className.left;
702
+ },
703
+ transition: function () {
704
+ var
705
+ direction = module.get.direction(),
706
+ transition
707
+ ;
708
+ transition = module.is.mobile()
709
+ ? (settings.mobileTransition === 'auto'
710
+ ? settings.defaultTransition.mobile[direction]
711
+ : settings.mobileTransition)
712
+ : (settings.transition === 'auto'
713
+ ? settings.defaultTransition.computer[direction]
714
+ : settings.transition);
715
+ module.verbose('Determined transition', transition);
716
+
717
+ return transition;
718
+ },
719
+ },
720
+ has: {
721
+ scrollbar: function () {
722
+ return isBody || $context.css('overflow-y') !== 'hidden';
723
+ },
724
+ },
725
+ is: {
726
+ safari: function () {
727
+ if (module.cache.isSafari === undefined) {
728
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
729
+ }
730
+
731
+ return module.cache.isSafari;
732
+ },
733
+ edge: function () {
734
+ if (module.cache.isEdge === undefined) {
735
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
736
+ }
737
+
738
+ return module.cache.isEdge;
739
+ },
740
+ firefox: function () {
741
+ if (module.cache.isFirefox === undefined) {
742
+ module.cache.isFirefox = !!window.InstallTrigger;
743
+ }
744
+
745
+ return module.cache.isFirefox;
746
+ },
747
+ iframe: function () {
748
+ return !(self === top);
749
+ },
750
+ ie: function () {
751
+ if (module.cache.isIE === undefined) {
752
+ var
753
+ isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
754
+ isIE = 'ActiveXObject' in window
755
+ ;
756
+ module.cache.isIE = isIE11 || isIE;
757
+ }
758
+
759
+ return module.cache.isIE;
760
+ },
761
+
762
+ mobile: function () {
763
+ var
764
+ userAgent = navigator.userAgent,
765
+ isMobile = userAgent.match(regExp.mobile)
766
+ ;
767
+ if (isMobile) {
768
+ module.verbose('Browser was found to be mobile', userAgent);
769
+
770
+ return true;
771
+ }
772
+
773
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
774
+
775
+ return false;
776
+ },
777
+ hidden: function () {
778
+ return !module.is.visible();
779
+ },
780
+ visible: function () {
781
+ return $module.hasClass(className.visible);
782
+ },
783
+ // alias
784
+ open: function () {
785
+ return module.is.visible();
786
+ },
787
+ closed: function () {
788
+ return module.is.hidden();
789
+ },
790
+ vertical: function () {
791
+ return $module.hasClass(className.top);
792
+ },
793
+ animating: function () {
794
+ return $context.hasClass(className.animating);
795
+ },
796
+ rtl: function () {
797
+ if (module.cache.isRTL === undefined) {
798
+ module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
799
+ }
800
+
801
+ return module.cache.isRTL;
802
+ },
803
+ },
804
+
805
+ setting: function (name, value) {
806
+ module.debug('Changing setting', name, value);
807
+ if ($.isPlainObject(name)) {
808
+ $.extend(true, settings, name);
809
+ } else if (value !== undefined) {
810
+ if ($.isPlainObject(settings[name])) {
811
+ $.extend(true, settings[name], value);
812
+ } else {
813
+ settings[name] = value;
814
+ }
815
+ } else {
816
+ return settings[name];
817
+ }
818
+ },
819
+ internal: function (name, value) {
820
+ if ($.isPlainObject(name)) {
821
+ $.extend(true, module, name);
822
+ } else if (value !== undefined) {
823
+ module[name] = value;
824
+ } else {
825
+ return module[name];
826
+ }
827
+ },
828
+ debug: function () {
829
+ if (!settings.silent && settings.debug) {
830
+ if (settings.performance) {
831
+ module.performance.log(arguments);
832
+ } else {
833
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
834
+ module.debug.apply(console, arguments);
835
+ }
836
+ }
837
+ },
838
+ verbose: function () {
839
+ if (!settings.silent && settings.verbose && settings.debug) {
840
+ if (settings.performance) {
841
+ module.performance.log(arguments);
842
+ } else {
843
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
844
+ module.verbose.apply(console, arguments);
845
+ }
846
+ }
847
+ },
848
+ error: function () {
849
+ if (!settings.silent) {
850
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
851
+ module.error.apply(console, arguments);
852
+ }
853
+ },
854
+ performance: {
855
+ log: function (message) {
856
+ var
857
+ currentTime,
858
+ executionTime,
859
+ previousTime
860
+ ;
861
+ if (settings.performance) {
862
+ currentTime = Date.now();
863
+ previousTime = time || currentTime;
864
+ executionTime = currentTime - previousTime;
865
+ time = currentTime;
866
+ performance.push({
867
+ Name: message[0],
868
+ Arguments: [].slice.call(message, 1) || '',
869
+ Element: element,
870
+ 'Execution Time': executionTime,
871
+ });
872
+ }
873
+ clearTimeout(module.performance.timer);
874
+ module.performance.timer = setTimeout(function () {
875
+ module.performance.display();
876
+ }, 500);
877
+ },
878
+ display: function () {
879
+ var
880
+ title = settings.name + ':',
881
+ totalTime = 0
882
+ ;
883
+ time = false;
884
+ clearTimeout(module.performance.timer);
885
+ $.each(performance, function (index, data) {
886
+ totalTime += data['Execution Time'];
887
+ });
888
+ title += ' ' + totalTime + 'ms';
889
+ if (performance.length > 0) {
890
+ console.groupCollapsed(title);
891
+ if (console.table) {
892
+ console.table(performance);
893
+ } else {
894
+ $.each(performance, function (index, data) {
895
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
896
+ });
897
+ }
898
+ console.groupEnd();
899
+ }
900
+ performance = [];
901
+ },
902
+ },
903
+ invoke: function (query, passedArguments, context) {
904
+ var
905
+ object = instance,
906
+ maxDepth,
907
+ found,
908
+ response
909
+ ;
910
+ passedArguments = passedArguments || queryArguments;
911
+ context = context || element;
912
+ if (typeof query === 'string' && object !== undefined) {
913
+ query = query.split(/[ .]/);
914
+ maxDepth = query.length - 1;
915
+ $.each(query, function (depth, value) {
916
+ var camelCaseValue = depth !== maxDepth
917
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
918
+ : query
919
+ ;
920
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
921
+ object = object[camelCaseValue];
922
+ } else if (object[camelCaseValue] !== undefined) {
923
+ found = object[camelCaseValue];
924
+
925
+ return false;
926
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
927
+ object = object[value];
928
+ } else if (object[value] !== undefined) {
929
+ found = object[value];
930
+
931
+ return false;
932
+ } else {
933
+ module.error(error.method, query);
934
+
935
+ return false;
936
+ }
937
+ });
938
+ }
939
+ if (isFunction(found)) {
940
+ response = found.apply(context, passedArguments);
941
+ } else if (found !== undefined) {
942
+ response = found;
943
+ }
944
+ if (Array.isArray(returnedValue)) {
945
+ returnedValue.push(response);
946
+ } else if (returnedValue !== undefined) {
947
+ returnedValue = [returnedValue, response];
948
+ } else if (response !== undefined) {
949
+ returnedValue = response;
950
+ }
951
+
952
+ return found;
953
+ },
954
+ };
955
+
956
+ if (methodInvoked) {
957
+ if (instance === undefined) {
958
+ module.initialize();
959
+ }
960
+ module.invoke(query);
961
+ } else {
962
+ if (instance !== undefined) {
963
+ module.invoke('destroy');
964
+ }
965
+ module.initialize();
966
+ }
967
+ });
968
+
969
+ return returnedValue !== undefined
970
+ ? returnedValue
971
+ : this;
972
+ };
973
+
974
+ $.fn.sidebar.settings = {
975
+
976
+ name: 'Sidebar',
977
+ namespace: 'sidebar',
978
+
979
+ silent: false,
980
+ debug: false,
981
+ verbose: false,
982
+ performance: true,
983
+
984
+ transition: 'auto',
985
+ mobileTransition: 'auto',
986
+
987
+ defaultTransition: {
988
+ computer: {
989
+ left: 'uncover',
990
+ right: 'uncover',
991
+ top: 'overlay',
992
+ bottom: 'overlay',
993
+ },
994
+ mobile: {
995
+ left: 'uncover',
996
+ right: 'uncover',
997
+ top: 'overlay',
998
+ bottom: 'overlay',
999
+ },
1000
+ },
1001
+
1002
+ context: 'body',
1003
+ exclusive: false,
1004
+ closable: true,
1005
+ dimPage: true,
1006
+ scrollLock: false,
1007
+ returnScroll: false,
1008
+ delaySetup: false,
1009
+
1010
+ onChange: function () {},
1011
+ onShow: function () {},
1012
+ onHide: function () {},
1013
+
1014
+ onHidden: function () {},
1015
+ onVisible: function () {},
1016
+
1017
+ className: {
1018
+ active: 'active',
1019
+ animating: 'animating',
1020
+ blurring: 'blurring',
1021
+ closing: 'closing',
1022
+ dimmed: 'dimmed',
1023
+ locked: 'locked',
1024
+ pushable: 'pushable',
1025
+ pushed: 'pushed',
1026
+ right: 'right',
1027
+ top: 'top',
1028
+ left: 'left',
1029
+ bottom: 'bottom',
1030
+ visible: 'visible',
1031
+ },
1032
+
1033
+ selector: {
1034
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1035
+ fixed: '.fixed',
1036
+ omitted: 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1037
+ pusher: '.pusher',
1038
+ sidebar: '.ui.sidebar',
1039
+ },
1040
+
1041
+ regExp: {
1042
+ mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g,
1043
+ },
1044
+
1045
+ error: {
1046
+ method: 'The method you called is not defined.',
1047
+ pusher: 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1048
+ movedSidebar: 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1049
+ overlay: 'The overlay setting is no longer supported, use animation: overlay',
1050
+ notFound: 'There were no elements that matched the specified selector',
1051
+ },
1052
+
1053
+ };
1054
+ })(jQuery, window, document);