fomantic-ui 2.9.0-beta.317 → 2.9.0-beta.319
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.
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +1 -1
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/api.min.js +1 -1
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +1 -1
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +1 -1
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +1 -1
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +1 -1
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +1 -1
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +1 -1
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +57 -23
- package/dist/components/flyout.js +223 -40
- package/dist/components/flyout.min.css +2 -2
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +1 -1
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +1 -1
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +6 -6
- package/dist/components/modal.js +1 -1
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +1 -1
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +1 -1
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +1 -1
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +1 -1
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +1 -1
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +1 -1
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +1 -1
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +1 -1
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +1 -1
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +1 -1
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +1 -1
- package/dist/components/sidebar.css +11 -3
- package/dist/components/sidebar.js +27 -7
- package/dist/components/sidebar.min.css +2 -2
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.js +1 -1
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +1 -1
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +1 -1
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +1 -1
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +1 -1
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +1 -1
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +1 -1
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +1 -1
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.min.js +1 -1
- package/dist/semantic.css +133 -78
- package/dist/semantic.js +274 -71
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/src/definitions/modules/flyout.js +222 -39
- package/src/definitions/modules/flyout.less +114 -68
- package/src/definitions/modules/modal.less +3 -3
- package/src/definitions/modules/sidebar.js +26 -6
- package/src/definitions/modules/sidebar.less +11 -0
- package/src/themes/default/globals/variation.variables +8 -0
- package/src/themes/default/modules/flyout.variables +56 -1
- package/src/themes/default/modules/modal.variables +2 -2
- package/src/themes/default/modules/sidebar.variables +4 -1
package/package.json
CHANGED
@@ -23,7 +23,7 @@ window = (typeof window != 'undefined' && window.Math == Math)
|
|
23
23
|
: Function('return this')()
|
24
24
|
;
|
25
25
|
|
26
|
-
$.fn.flyout = function(parameters) {
|
26
|
+
$.flyout = $.fn.flyout = function(parameters) {
|
27
27
|
var
|
28
28
|
$allModules = $(this),
|
29
29
|
$window = $(window),
|
@@ -68,15 +68,19 @@ $.fn.flyout = function(parameters) {
|
|
68
68
|
moduleNamespace = 'module-' + namespace,
|
69
69
|
|
70
70
|
$module = $(this),
|
71
|
-
$context = [window,document].indexOf(settings.context) < 0 ? $
|
72
|
-
$
|
71
|
+
$context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
|
72
|
+
$closeIcon = $module.find(selector.close),
|
73
|
+
$inputs,
|
74
|
+
$focusedElement,
|
73
75
|
|
74
76
|
$flyouts = $module.children(selector.flyout),
|
75
77
|
$pusher = $context.children(selector.pusher),
|
76
78
|
$style,
|
77
79
|
|
80
|
+
isFlyoutComponent = $module.hasClass('flyout'),
|
81
|
+
|
78
82
|
element = this,
|
79
|
-
instance =
|
83
|
+
instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined,
|
80
84
|
|
81
85
|
ignoreRepeatedEvents = false,
|
82
86
|
isBody = $context[0] === $body[0],
|
@@ -86,6 +90,7 @@ $.fn.flyout = function(parameters) {
|
|
86
90
|
|
87
91
|
elementNamespace,
|
88
92
|
id,
|
93
|
+
observer,
|
89
94
|
currentScroll,
|
90
95
|
transitionEvent,
|
91
96
|
|
@@ -97,7 +102,8 @@ $.fn.flyout = function(parameters) {
|
|
97
102
|
initialize: function() {
|
98
103
|
module.debug('Initializing flyout', parameters);
|
99
104
|
|
100
|
-
|
105
|
+
module.create.id();
|
106
|
+
if(!isFlyoutComponent) {
|
101
107
|
module.create.flyout();
|
102
108
|
if(!$.isFunction(settings.onHidden)) {
|
103
109
|
settings.onHidden = function () {
|
@@ -105,6 +111,9 @@ $.fn.flyout = function(parameters) {
|
|
105
111
|
$module.remove();
|
106
112
|
};
|
107
113
|
}
|
114
|
+
if(!settings.autoShow) {
|
115
|
+
settings.autoShow = true;
|
116
|
+
}
|
108
117
|
}
|
109
118
|
$module.addClass(settings.class);
|
110
119
|
if (settings.title !== '') {
|
@@ -122,13 +131,14 @@ $.fn.flyout = function(parameters) {
|
|
122
131
|
}
|
123
132
|
settings.actions.forEach(function (el) {
|
124
133
|
var
|
125
|
-
icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
|
134
|
+
icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
|
126
135
|
text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
|
127
136
|
cls = module.helpers.deQuote(el[fields.class] || ''),
|
128
137
|
click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}
|
129
138
|
;
|
130
139
|
$actions.append($('<button/>', {
|
131
140
|
html: icon + text,
|
141
|
+
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
|
132
142
|
class: className.button + ' ' + cls,
|
133
143
|
click: function () {
|
134
144
|
if (click.call(element, $module) === false) {
|
@@ -140,8 +150,6 @@ $.fn.flyout = function(parameters) {
|
|
140
150
|
});
|
141
151
|
}
|
142
152
|
|
143
|
-
module.create.id();
|
144
|
-
|
145
153
|
transitionEvent = module.get.transitionEvent();
|
146
154
|
|
147
155
|
// avoids locking rendering if initialized in onReady
|
@@ -160,6 +168,9 @@ $.fn.flyout = function(parameters) {
|
|
160
168
|
module.setup.heights();
|
161
169
|
module.bind.resize();
|
162
170
|
}
|
171
|
+
module.refreshInputs();
|
172
|
+
module.bind.events();
|
173
|
+
module.observeChanges();
|
163
174
|
module.instantiate();
|
164
175
|
|
165
176
|
if(settings.autoShow){
|
@@ -178,30 +189,37 @@ $.fn.flyout = function(parameters) {
|
|
178
189
|
create: {
|
179
190
|
flyout: function() {
|
180
191
|
module.verbose('Programmaticaly create flyout', $context);
|
181
|
-
$module = $('<div/>', {class: className.flyout});
|
192
|
+
$module = $('<div/>', {class: className.flyout, role: 'dialog', 'aria-modal': settings.dimPage});
|
182
193
|
if (settings.closeIcon) {
|
183
|
-
$
|
184
|
-
$module.append($
|
194
|
+
$closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
|
195
|
+
$module.append($closeIcon);
|
185
196
|
}
|
186
197
|
if (settings.title !== '') {
|
187
|
-
|
198
|
+
var titleId = '_' + module.get.id() + 'title';
|
199
|
+
$module.attr('aria-labelledby', titleId);
|
200
|
+
$('<div/>', {class: className.header, id: titleId}).appendTo($module);
|
188
201
|
}
|
189
202
|
if (settings.content !== '') {
|
190
|
-
|
203
|
+
var descId = '_' + module.get.id() + 'desc';
|
204
|
+
$module.attr('aria-describedby', descId);
|
205
|
+
$('<div/>', {class: className.content, id: descId}).appendTo($module);
|
191
206
|
}
|
192
207
|
if (module.has.configActions()) {
|
193
208
|
$('<div/>', {class: className.actions}).appendTo($module);
|
194
209
|
}
|
195
|
-
$
|
210
|
+
$module.prependTo($context);
|
196
211
|
},
|
197
212
|
id: function() {
|
198
|
-
id = (Math.random().toString(16) + '000000000').
|
213
|
+
id = (Math.random().toString(16) + '000000000').slice(2, 10);
|
199
214
|
elementNamespace = '.' + id;
|
200
215
|
module.verbose('Creating unique id for element', id);
|
201
216
|
}
|
202
217
|
},
|
203
218
|
|
204
219
|
destroy: function() {
|
220
|
+
if (observer) {
|
221
|
+
observer.disconnect();
|
222
|
+
}
|
205
223
|
module.verbose('Destroying previous module for', $module);
|
206
224
|
$module
|
207
225
|
.off(eventNamespace)
|
@@ -210,6 +228,10 @@ $.fn.flyout = function(parameters) {
|
|
210
228
|
if(module.is.ios()) {
|
211
229
|
module.remove.ios();
|
212
230
|
}
|
231
|
+
$closeIcon.off(elementNamespace);
|
232
|
+
if($inputs) {
|
233
|
+
$inputs.off(elementNamespace);
|
234
|
+
}
|
213
235
|
// bound by uuid
|
214
236
|
$context.off(elementNamespace);
|
215
237
|
$window.off(elementNamespace);
|
@@ -217,6 +239,21 @@ $.fn.flyout = function(parameters) {
|
|
217
239
|
},
|
218
240
|
|
219
241
|
event: {
|
242
|
+
keyboard: function(event) {
|
243
|
+
var
|
244
|
+
keyCode = event.which
|
245
|
+
;
|
246
|
+
if(keyCode === settings.keys.escape) {
|
247
|
+
if(settings.closable) {
|
248
|
+
module.debug('Escape key pressed hiding flyout');
|
249
|
+
module.hide();
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
module.debug('Escape key pressed, but closable is set to false');
|
253
|
+
}
|
254
|
+
event.preventDefault();
|
255
|
+
}
|
256
|
+
},
|
220
257
|
resize: function() {
|
221
258
|
module.setup.heights();
|
222
259
|
},
|
@@ -239,6 +276,34 @@ $.fn.flyout = function(parameters) {
|
|
239
276
|
close: function(event) {
|
240
277
|
module.hide();
|
241
278
|
},
|
279
|
+
closeKeyUp: function(event){
|
280
|
+
var
|
281
|
+
keyCode = event.which
|
282
|
+
;
|
283
|
+
if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
|
284
|
+
module.hide();
|
285
|
+
}
|
286
|
+
},
|
287
|
+
inputKeyDown: {
|
288
|
+
first: function(event) {
|
289
|
+
var
|
290
|
+
keyCode = event.which
|
291
|
+
;
|
292
|
+
if (keyCode === settings.keys.tab && event.shiftKey) {
|
293
|
+
$inputs.last().focus();
|
294
|
+
event.preventDefault();
|
295
|
+
}
|
296
|
+
},
|
297
|
+
last: function(event) {
|
298
|
+
var
|
299
|
+
keyCode = event.which
|
300
|
+
;
|
301
|
+
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
302
|
+
$inputs.first().focus();
|
303
|
+
event.preventDefault();
|
304
|
+
}
|
305
|
+
}
|
306
|
+
},
|
242
307
|
approve: function(event) {
|
243
308
|
if (ignoreRepeatedEvents || settings.onApprove.call(module.element, $(this)) === false) {
|
244
309
|
module.verbose('Approve callback returned false cancelling close');
|
@@ -282,16 +347,23 @@ $.fn.flyout = function(parameters) {
|
|
282
347
|
module.verbose('Adding resize event to window', $window);
|
283
348
|
$window.on('resize' + elementNamespace, module.event.resize);
|
284
349
|
},
|
350
|
+
events: function() {
|
351
|
+
module.verbose('Attaching events');
|
352
|
+
$module
|
353
|
+
.on('click' + eventNamespace, selector.close, module.event.close)
|
354
|
+
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
355
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
356
|
+
;
|
357
|
+
$closeIcon
|
358
|
+
.on('keyup' + elementNamespace, module.event.closeKeyUp)
|
359
|
+
;
|
360
|
+
},
|
285
361
|
clickaway: function() {
|
286
362
|
module.verbose('Adding clickaway events to context', $context);
|
287
363
|
$context
|
288
364
|
.on('click' + elementNamespace, module.event.clickaway)
|
289
365
|
.on('touchend' + elementNamespace, module.event.clickaway)
|
290
366
|
;
|
291
|
-
|
292
|
-
$module.on('click' + elementNamespace, settings.selector.close, module.event.close);
|
293
|
-
$module.on('click' + elementNamespace, settings.selector.approve, module.event.approve);
|
294
|
-
$module.on('click' + elementNamespace, settings.selector.deny, module.event.deny);
|
295
367
|
},
|
296
368
|
scrollLock: function() {
|
297
369
|
if(settings.scrollLock) {
|
@@ -378,7 +450,7 @@ $.fn.flyout = function(parameters) {
|
|
378
450
|
if(direction === 'left' || direction === 'right') {
|
379
451
|
module.debug('Adding CSS rules for animation distance', width);
|
380
452
|
style += ''
|
381
|
-
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher
|
453
|
+
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
|
382
454
|
+ ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
|
383
455
|
+ ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
|
384
456
|
+ ' }'
|
@@ -386,7 +458,7 @@ $.fn.flyout = function(parameters) {
|
|
386
458
|
}
|
387
459
|
else if(direction === 'top' || direction == 'bottom') {
|
388
460
|
style += ''
|
389
|
-
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher
|
461
|
+
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
|
390
462
|
+ ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
|
391
463
|
+ ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
|
392
464
|
+ ' }'
|
@@ -394,8 +466,8 @@ $.fn.flyout = function(parameters) {
|
|
394
466
|
}
|
395
467
|
/* opposite sides visible forces content overlay */
|
396
468
|
style += ''
|
397
|
-
+ ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher
|
398
|
-
+ ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher
|
469
|
+
+ ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after,'
|
470
|
+
+ ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after {'
|
399
471
|
+ ' -webkit-transform: translate3d(0, 0, 0);'
|
400
472
|
+ ' transform: translate3d(0, 0, 0);'
|
401
473
|
+ ' }'
|
@@ -406,13 +478,30 @@ $.fn.flyout = function(parameters) {
|
|
406
478
|
.appendTo($head)
|
407
479
|
;
|
408
480
|
module.debug('Adding sizing css to head', $style);
|
481
|
+
},
|
482
|
+
keyboardShortcuts: function() {
|
483
|
+
module.verbose('Adding keyboard shortcuts');
|
484
|
+
$document
|
485
|
+
.on('keydown' + eventNamespace, module.event.keyboard)
|
486
|
+
;
|
487
|
+
}
|
488
|
+
},
|
489
|
+
observeChanges: function() {
|
490
|
+
if('MutationObserver' in window) {
|
491
|
+
observer = new MutationObserver(function(mutations) {
|
492
|
+
module.refreshInputs();
|
493
|
+
});
|
494
|
+
observer.observe(element, {
|
495
|
+
childList : true,
|
496
|
+
subtree : true
|
497
|
+
});
|
498
|
+
module.debug('Setting up mutation observer', observer);
|
409
499
|
}
|
410
500
|
},
|
411
|
-
|
412
501
|
refresh: function() {
|
413
502
|
module.verbose('Refreshing selector cache');
|
414
|
-
$context = [window,document].indexOf(settings.context) < 0 ? $
|
415
|
-
|
503
|
+
$context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
|
504
|
+
module.refreshFlyouts();
|
416
505
|
$pusher = $context.children(selector.pusher);
|
417
506
|
module.clear.cache();
|
418
507
|
},
|
@@ -422,11 +511,24 @@ $.fn.flyout = function(parameters) {
|
|
422
511
|
$flyouts = $context.children(selector.flyout);
|
423
512
|
},
|
424
513
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
514
|
+
refreshInputs: function(){
|
515
|
+
if($inputs){
|
516
|
+
$inputs
|
517
|
+
.off('keydown' + elementNamespace)
|
518
|
+
;
|
519
|
+
}
|
520
|
+
if(!settings.dimPage){
|
521
|
+
return;
|
522
|
+
}
|
523
|
+
$inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
|
524
|
+
return $(this).closest('.disabled').length === 0;
|
525
|
+
});
|
526
|
+
$inputs.first()
|
527
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.first)
|
528
|
+
;
|
529
|
+
$inputs.last()
|
530
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.last)
|
531
|
+
;
|
430
532
|
},
|
431
533
|
|
432
534
|
setup: {
|
@@ -498,7 +600,10 @@ $.fn.flyout = function(parameters) {
|
|
498
600
|
: function(){}
|
499
601
|
;
|
500
602
|
if(module.is.hidden()) {
|
501
|
-
|
603
|
+
if(settings.onShow.call(element) === false) {
|
604
|
+
module.verbose('Show callback returned false cancelling show');
|
605
|
+
return;
|
606
|
+
}
|
502
607
|
module.refresh();
|
503
608
|
if(module.othersActive()) {
|
504
609
|
module.debug('Other flyouts currently visible');
|
@@ -508,12 +613,19 @@ $.fn.flyout = function(parameters) {
|
|
508
613
|
ignoreRepeatedEvents = false;
|
509
614
|
}
|
510
615
|
}
|
616
|
+
module.set.dimmerStyles();
|
511
617
|
module.pushPage(function() {
|
512
618
|
callback.call(element);
|
513
|
-
settings.
|
619
|
+
settings.onVisible.call(element);
|
620
|
+
if(settings.keyboardShortcuts) {
|
621
|
+
module.add.keyboardShortcuts();
|
622
|
+
}
|
623
|
+
module.save.focus();
|
624
|
+
if(settings.autofocus) {
|
625
|
+
module.set.autofocus();
|
626
|
+
}
|
514
627
|
});
|
515
628
|
settings.onChange.call(element);
|
516
|
-
settings.onVisible.call(element);
|
517
629
|
}
|
518
630
|
else {
|
519
631
|
module.debug('Flyout is already visible');
|
@@ -538,6 +650,7 @@ $.fn.flyout = function(parameters) {
|
|
538
650
|
if($.isFunction(settings.onHidden)) {
|
539
651
|
settings.onHidden.call(element);
|
540
652
|
}
|
653
|
+
module.restore.focus();
|
541
654
|
});
|
542
655
|
settings.onChange.call(element);
|
543
656
|
}
|
@@ -591,7 +704,6 @@ $.fn.flyout = function(parameters) {
|
|
591
704
|
: function(){}
|
592
705
|
;
|
593
706
|
module.set.overlay();
|
594
|
-
module.repaint();
|
595
707
|
if(settings.returnScroll) {
|
596
708
|
currentScroll = (isBody ? $window : $context).scrollTop();
|
597
709
|
}
|
@@ -634,18 +746,25 @@ $.fn.flyout = function(parameters) {
|
|
634
746
|
module.unbind.clickaway();
|
635
747
|
if(!module.othersActive()) {
|
636
748
|
module.unbind.scrollLock();
|
749
|
+
if( settings.keyboardShortcuts ) {
|
750
|
+
module.remove.keyboardShortcuts();
|
751
|
+
}
|
637
752
|
}
|
638
753
|
|
754
|
+
|
639
755
|
animate = function() {
|
640
756
|
module.set.overlay();
|
641
757
|
module.set.animating();
|
758
|
+
if(settings.dimPage && !module.othersVisible()) {
|
759
|
+
module.set.closing();
|
760
|
+
}
|
642
761
|
module.remove.visible();
|
643
|
-
|
644
762
|
};
|
645
763
|
transitionEnd = function(event) {
|
646
764
|
if( event.target == $module[0] ) {
|
647
765
|
$module.off(transitionEvent + elementNamespace, transitionEnd);
|
648
766
|
module.remove.animating();
|
767
|
+
module.remove.closing();
|
649
768
|
module.remove.overlay();
|
650
769
|
module.remove.inlineCSS();
|
651
770
|
if(settings.returnScroll) {
|
@@ -681,6 +800,25 @@ $.fn.flyout = function(parameters) {
|
|
681
800
|
},
|
682
801
|
|
683
802
|
set: {
|
803
|
+
autofocus: function() {
|
804
|
+
var
|
805
|
+
$autofocus = $inputs.filter('[autofocus]'),
|
806
|
+
$input = ($autofocus.length > 0)
|
807
|
+
? $autofocus.first()
|
808
|
+
: ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
|
809
|
+
;
|
810
|
+
if($input.length > 0) {
|
811
|
+
$input.focus();
|
812
|
+
}
|
813
|
+
},
|
814
|
+
dimmerStyles: function() {
|
815
|
+
if(settings.blurring) {
|
816
|
+
$pusher.addClass(className.blurring);
|
817
|
+
}
|
818
|
+
else {
|
819
|
+
$pusher.removeClass(className.blurring);
|
820
|
+
}
|
821
|
+
},
|
684
822
|
bodyMargin: function() {
|
685
823
|
var position = module.can.leftBodyScrollbar() ? 'left':'right';
|
686
824
|
$context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
|
@@ -718,6 +856,9 @@ $.fn.flyout = function(parameters) {
|
|
718
856
|
animating: function() {
|
719
857
|
$module.addClass(className.animating);
|
720
858
|
},
|
859
|
+
closing: function() {
|
860
|
+
$pusher.addClass(className.closing);
|
861
|
+
},
|
721
862
|
direction: function(direction) {
|
722
863
|
direction = direction || module.get.direction();
|
723
864
|
$module.addClass(className[direction]);
|
@@ -737,6 +878,12 @@ $.fn.flyout = function(parameters) {
|
|
737
878
|
$style.remove();
|
738
879
|
}
|
739
880
|
},
|
881
|
+
keyboardShortcuts: function() {
|
882
|
+
module.verbose('Removing keyboard shortcuts');
|
883
|
+
$document
|
884
|
+
.off('keydown' + eventNamespace)
|
885
|
+
;
|
886
|
+
},
|
740
887
|
|
741
888
|
// ios scroll on html not document
|
742
889
|
ios: function() {
|
@@ -758,6 +905,9 @@ $.fn.flyout = function(parameters) {
|
|
758
905
|
animating: function() {
|
759
906
|
$module.removeClass(className.animating);
|
760
907
|
},
|
908
|
+
closing: function() {
|
909
|
+
$pusher.removeClass(className.closing);
|
910
|
+
},
|
761
911
|
direction: function(direction) {
|
762
912
|
direction = direction || module.get.direction();
|
763
913
|
$module.removeClass(className[direction]);
|
@@ -771,7 +921,6 @@ $.fn.flyout = function(parameters) {
|
|
771
921
|
},
|
772
922
|
|
773
923
|
get: {
|
774
|
-
|
775
924
|
direction: function() {
|
776
925
|
if($module.hasClass(className.top)) {
|
777
926
|
return className.top;
|
@@ -801,6 +950,12 @@ $.fn.flyout = function(parameters) {
|
|
801
950
|
}
|
802
951
|
}
|
803
952
|
},
|
953
|
+
id: function() {
|
954
|
+
return id;
|
955
|
+
},
|
956
|
+
element: function() {
|
957
|
+
return $module;
|
958
|
+
},
|
804
959
|
settings: function() {
|
805
960
|
return settings;
|
806
961
|
}
|
@@ -816,6 +971,15 @@ $.fn.flyout = function(parameters) {
|
|
816
971
|
},
|
817
972
|
|
818
973
|
save: {
|
974
|
+
focus: function() {
|
975
|
+
var
|
976
|
+
$activeElement = $(document.activeElement),
|
977
|
+
inCurrentFlyout = $activeElement.closest($module).length > 0
|
978
|
+
;
|
979
|
+
if(!inCurrentFlyout) {
|
980
|
+
$focusedElement = $(document.activeElement).blur();
|
981
|
+
}
|
982
|
+
},
|
819
983
|
bodyMargin: function() {
|
820
984
|
initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
|
821
985
|
var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
|
@@ -911,6 +1075,11 @@ $.fn.flyout = function(parameters) {
|
|
911
1075
|
},
|
912
1076
|
|
913
1077
|
restore: {
|
1078
|
+
focus: function() {
|
1079
|
+
if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
|
1080
|
+
$focusedElement.focus();
|
1081
|
+
}
|
1082
|
+
},
|
914
1083
|
bodyMargin: function() {
|
915
1084
|
var position = module.can.leftBodyScrollbar() ? 'left':'right';
|
916
1085
|
$context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
|
@@ -946,7 +1115,7 @@ $.fn.flyout = function(parameters) {
|
|
946
1115
|
}
|
947
1116
|
;
|
948
1117
|
if(shouldEscape.test(string)) {
|
949
|
-
string = string.replace(/&(?![a-z0-9#]{1,
|
1118
|
+
string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, "&");
|
950
1119
|
return string.replace(badChars, escapedChar);
|
951
1120
|
}
|
952
1121
|
return string;
|
@@ -1164,12 +1333,16 @@ $.fn.flyout.settings = {
|
|
1164
1333
|
context : 'body',
|
1165
1334
|
exclusive : false,
|
1166
1335
|
closable : true,
|
1336
|
+
autofocus : true,
|
1337
|
+
restoreFocus : true,
|
1167
1338
|
dimPage : true,
|
1168
1339
|
scrollLock : false,
|
1169
1340
|
returnScroll : false,
|
1170
1341
|
delaySetup : false,
|
1171
1342
|
autoShow : false,
|
1172
1343
|
|
1344
|
+
keyboardShortcuts: true,
|
1345
|
+
|
1173
1346
|
//dynamic content
|
1174
1347
|
title : '',
|
1175
1348
|
content : '',
|
@@ -1198,6 +1371,13 @@ $.fn.flyout.settings = {
|
|
1198
1371
|
onApprove : function(){},
|
1199
1372
|
onDeny : function(){},
|
1200
1373
|
|
1374
|
+
keys : {
|
1375
|
+
space : 32,
|
1376
|
+
enter : 13,
|
1377
|
+
escape : 27,
|
1378
|
+
tab : 9,
|
1379
|
+
},
|
1380
|
+
|
1201
1381
|
className : {
|
1202
1382
|
flyout : 'ui flyout',
|
1203
1383
|
close : 'close icon',
|
@@ -1206,6 +1386,8 @@ $.fn.flyout.settings = {
|
|
1206
1386
|
actions : 'actions',
|
1207
1387
|
active : 'active',
|
1208
1388
|
animating : 'animating',
|
1389
|
+
blurring : 'blurring',
|
1390
|
+
closing : 'closing',
|
1209
1391
|
dimmed : 'dimmed',
|
1210
1392
|
ios : 'ios',
|
1211
1393
|
locked : 'locked',
|
@@ -1254,7 +1436,8 @@ $.fn.flyout.settings = {
|
|
1254
1436
|
|
1255
1437
|
text: {
|
1256
1438
|
ok : 'Ok',
|
1257
|
-
cancel : 'Cancel'
|
1439
|
+
cancel : 'Cancel',
|
1440
|
+
close : 'Close'
|
1258
1441
|
}
|
1259
1442
|
};
|
1260
1443
|
|