fomantic-ui 2.8.8-beta.99 → 2.9.0-beta.100
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/.all-contributorsrc +188 -3
- package/.github/dependabot.yml +17 -0
- package/.github/workflows/ci.yml +1 -1
- package/CHANGELOG.md +139 -0
- package/CONTRIBUTING.md +1 -1
- package/CONTRIBUTORS.md +71 -37
- package/README.md +3 -3
- package/dist/components/accordion.css +50 -6
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +2 -2
- package/dist/components/accordion.min.js +3 -3
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +26 -24
- package/dist/components/api.min.js +4 -4
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +81 -81
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +110 -11
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +4 -4
- package/dist/components/card.css +26 -19
- package/dist/components/card.min.css +2 -2
- package/dist/components/checkbox.css +6 -4
- package/dist/components/checkbox.js +17 -11
- package/dist/components/checkbox.min.css +2 -2
- package/dist/components/checkbox.min.js +4 -4
- package/dist/components/comment.css +11 -11
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +3 -4
- package/dist/components/container.min.css +2 -2
- package/dist/components/dimmer.css +28 -14
- package/dist/components/dimmer.js +15 -12
- package/dist/components/dimmer.min.css +2 -2
- package/dist/components/dimmer.min.js +4 -4
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +54 -7
- package/dist/components/dropdown.js +107 -77
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +4 -4
- 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 +3 -3
- package/dist/components/emoji.css +2 -2
- package/dist/components/feed.css +28 -28
- package/dist/components/feed.min.css +2 -2
- package/dist/components/flag.css +731 -625
- package/dist/components/flag.min.css +2 -2
- package/dist/components/form.css +119 -54
- package/dist/components/form.js +51 -70
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +4 -4
- package/dist/components/grid.css +13 -11
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +3 -3
- package/dist/components/header.min.css +2 -2
- package/dist/components/icon.css +86 -5
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +17 -2
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +13 -13
- 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 +39 -37
- package/dist/components/loader.min.css +2 -2
- package/dist/components/menu.css +37 -11
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +78 -34
- package/dist/components/message.min.css +2 -2
- package/dist/components/modal.css +7 -5
- package/dist/components/modal.js +237 -41
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +4 -4
- package/dist/components/nag.css +168 -16
- package/dist/components/nag.js +131 -65
- package/dist/components/nag.min.css +2 -2
- package/dist/components/nag.min.js +4 -4
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +5 -3
- package/dist/components/popup.js +5 -5
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +4 -4
- package/dist/components/progress.css +2 -1
- package/dist/components/progress.js +3 -3
- package/dist/components/progress.min.css +2 -2
- package/dist/components/progress.min.js +4 -4
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +8 -62
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.min.css +2 -2
- package/dist/components/rating.min.js +3 -3
- package/dist/components/reset.css +2 -3
- package/dist/components/reset.min.css +2 -2
- 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 +15 -13
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +4 -4
- package/dist/components/segment.css +36 -6
- package/dist/components/segment.min.css +2 -2
- 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 +3 -3
- package/dist/components/sidebar.css +4 -2
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.min.css +2 -2
- package/dist/components/sidebar.min.js +3 -3
- package/dist/components/site.css +61 -39
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +2 -2
- package/dist/components/site.min.js +3 -3
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.js +3 -3
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +3 -3
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +4 -4
- package/dist/components/step.min.css +2 -2
- package/dist/components/sticky.css +1 -2
- package/dist/components/sticky.js +2 -2
- package/dist/components/sticky.min.css +2 -2
- package/dist/components/sticky.min.js +4 -4
- 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 +3 -3
- package/dist/components/table.css +5 -3
- package/dist/components/table.min.css +2 -2
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +123 -10
- package/dist/components/toast.js +54 -27
- package/dist/components/toast.min.css +2 -2
- package/dist/components/toast.min.js +4 -4
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +2 -2
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +4 -4
- package/dist/components/visibility.js +2 -2
- package/dist/components/visibility.min.js +3 -3
- package/dist/semantic.css +2004 -1124
- package/dist/semantic.js +789 -377
- package/dist/semantic.min.css +4 -397
- package/dist/semantic.min.js +4 -4
- package/examples/assets/library/iframe-content.js +8 -8
- package/examples/assets/library/iframe.js +3 -3
- package/package.json +5 -5
- package/scripts/nightly-version.js +23 -8
- package/src/definitions/behaviors/api.js +25 -23
- package/src/definitions/behaviors/form.js +50 -69
- package/src/definitions/behaviors/visibility.js +1 -1
- package/src/definitions/collections/form.less +200 -142
- package/src/definitions/collections/grid.less +717 -681
- package/src/definitions/collections/menu.less +177 -128
- package/src/definitions/collections/message.less +77 -44
- package/src/definitions/collections/table.less +255 -242
- package/src/definitions/elements/button.less +360 -347
- package/src/definitions/elements/container.less +16 -8
- package/src/definitions/elements/emoji.less +15 -9
- package/src/definitions/elements/flag.less +7 -17
- package/src/definitions/elements/header.less +44 -37
- package/src/definitions/elements/icon.less +121 -43
- package/src/definitions/elements/input.less +23 -7
- package/src/definitions/elements/label.less +92 -91
- package/src/definitions/elements/list.less +55 -45
- package/src/definitions/elements/loader.less +38 -35
- package/src/definitions/elements/segment.less +51 -23
- package/src/definitions/elements/step.less +52 -48
- package/src/definitions/elements/text.less +17 -15
- package/src/definitions/globals/site.less +23 -2
- package/src/definitions/modules/accordion.less +55 -5
- package/src/definitions/modules/calendar.js +109 -10
- package/src/definitions/modules/checkbox.js +16 -10
- package/src/definitions/modules/checkbox.less +44 -186
- package/src/definitions/modules/dimmer.js +14 -11
- package/src/definitions/modules/dimmer.less +21 -8
- package/src/definitions/modules/dropdown.js +106 -76
- package/src/definitions/modules/dropdown.less +148 -89
- package/src/definitions/modules/modal.js +236 -40
- package/src/definitions/modules/modal.less +6 -4
- package/src/definitions/modules/nag.js +130 -64
- package/src/definitions/modules/nag.less +105 -40
- package/src/definitions/modules/popup.js +4 -4
- package/src/definitions/modules/popup.less +5 -1
- package/src/definitions/modules/progress.js +2 -2
- package/src/definitions/modules/progress.less +20 -18
- package/src/definitions/modules/rating.less +50 -42
- package/src/definitions/modules/search.js +14 -12
- package/src/definitions/modules/search.less +32 -16
- package/src/definitions/modules/sidebar.less +33 -19
- package/src/definitions/modules/slider.less +43 -42
- package/src/definitions/modules/sticky.js +1 -1
- package/src/definitions/modules/toast.js +53 -26
- package/src/definitions/modules/toast.less +139 -25
- package/src/definitions/modules/transition.js +1 -1
- package/src/definitions/views/card.less +402 -361
- package/src/definitions/views/comment.less +92 -81
- package/src/definitions/views/feed.less +164 -144
- package/src/definitions/views/item.less +249 -196
- package/src/definitions/views/statistic.less +90 -88
- package/src/themes/default/collections/grid.variables +8 -8
- package/src/themes/default/collections/menu.variables +6 -0
- package/src/themes/default/collections/table.variables +1 -1
- package/src/themes/default/elements/button.variables +2 -1
- package/src/themes/default/elements/flag.overrides +1635 -986
- package/src/themes/default/elements/flag.variables +7 -5
- package/src/themes/default/elements/header.variables +2 -2
- package/src/themes/default/elements/icon.overrides +35 -28
- package/src/themes/default/elements/icon.variables +4 -0
- package/src/themes/default/elements/list.variables +1 -1
- package/src/themes/default/elements/step.overrides +1 -1
- package/src/themes/default/globals/colors.less +7 -7
- package/src/themes/default/globals/site.variables +19 -9
- package/src/themes/default/globals/variation.variables +119 -6
- package/src/themes/default/modules/accordion.variables +15 -0
- package/src/themes/default/modules/checkbox.variables +16 -16
- package/src/themes/default/modules/dimmer.variables +1 -1
- package/src/themes/default/modules/dropdown.variables +12 -5
- package/src/themes/default/modules/modal.variables +2 -2
- package/src/themes/default/modules/nag.variables +3 -1
- package/src/themes/default/modules/toast.variables +5 -1
- package/src/themes/default/views/card.variables +1 -1
- package/src/themes/famfamfam/elements/flag.overrides +1026 -0
- package/src/themes/famfamfam/elements/flag.variables +13 -0
- package/tasks/admin/components/init.js +2 -2
- package/tasks/admin/distributions/init.js +2 -2
- package/tasks/build/css.js +6 -1
- package/tasks/config/project/release.js +2 -2
- package/tasks/config/tasks.js +13 -9
- package/test/helpers/sinon.js +1 -1
@@ -66,7 +66,8 @@ $.fn.modal = function(parameters) {
|
|
66
66
|
|
67
67
|
$module = $(this),
|
68
68
|
$context = $(settings.context),
|
69
|
-
$
|
69
|
+
$closeIcon = $module.find(selector.closeIcon),
|
70
|
+
$inputs,
|
70
71
|
|
71
72
|
$allModals,
|
72
73
|
$otherModals,
|
@@ -92,6 +93,7 @@ $.fn.modal = function(parameters) {
|
|
92
93
|
module = {
|
93
94
|
|
94
95
|
initialize: function() {
|
96
|
+
module.create.id();
|
95
97
|
if(!$module.hasClass('modal')) {
|
96
98
|
module.create.modal();
|
97
99
|
if(!$.isFunction(settings.onHidden)) {
|
@@ -110,16 +112,23 @@ $.fn.modal = function(parameters) {
|
|
110
112
|
}
|
111
113
|
if(module.has.configActions()){
|
112
114
|
var $actions = $module.find(selector.actions).addClass(settings.classActions);
|
115
|
+
if ($actions.length === 0) {
|
116
|
+
$actions = $('<div/>', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($module);
|
117
|
+
} else {
|
118
|
+
$actions.empty();
|
119
|
+
}
|
113
120
|
settings.actions.forEach(function (el) {
|
114
|
-
var icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
|
121
|
+
var icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
|
115
122
|
text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
|
116
123
|
cls = module.helpers.deQuote(el[fields.class] || ''),
|
117
124
|
click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {};
|
118
125
|
$actions.append($('<button/>', {
|
119
126
|
html: icon + text,
|
127
|
+
'aria-label': $('<div>'+(el[fields.text] || el[fields.icon] || '')+'</div>').text(),
|
120
128
|
class: className.button + ' ' + cls,
|
121
129
|
click: function () {
|
122
|
-
|
130
|
+
var button = $(this);
|
131
|
+
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
|
123
132
|
return;
|
124
133
|
}
|
125
134
|
module.hide();
|
@@ -130,7 +139,6 @@ $.fn.modal = function(parameters) {
|
|
130
139
|
module.cache = {};
|
131
140
|
module.verbose('Initializing dimmer', $context);
|
132
141
|
|
133
|
-
module.create.id();
|
134
142
|
module.create.dimmer();
|
135
143
|
|
136
144
|
if ( settings.allowMultiple ) {
|
@@ -140,12 +148,13 @@ $.fn.modal = function(parameters) {
|
|
140
148
|
$module.addClass('top aligned');
|
141
149
|
}
|
142
150
|
module.refreshModals();
|
143
|
-
|
151
|
+
module.refreshInputs();
|
144
152
|
module.bind.events();
|
145
|
-
|
146
|
-
module.observeChanges();
|
147
|
-
}
|
153
|
+
module.observeChanges();
|
148
154
|
module.instantiate();
|
155
|
+
if(settings.autoShow){
|
156
|
+
module.show();
|
157
|
+
}
|
149
158
|
},
|
150
159
|
|
151
160
|
instantiate: function() {
|
@@ -158,19 +167,23 @@ $.fn.modal = function(parameters) {
|
|
158
167
|
|
159
168
|
create: {
|
160
169
|
modal: function() {
|
161
|
-
$module = $('<div/>', {class: '
|
170
|
+
$module = $('<div/>', {class: className.modal, role: 'dialog', 'aria-modal': true});
|
162
171
|
if (settings.closeIcon) {
|
163
|
-
$
|
164
|
-
$module.append($
|
172
|
+
$closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
|
173
|
+
$module.append($closeIcon);
|
165
174
|
}
|
166
175
|
if (settings.title !== '') {
|
167
|
-
|
176
|
+
var titleId = '_' + module.get.id() + 'title';
|
177
|
+
$module.attr('aria-labelledby', titleId);
|
178
|
+
$('<div/>', {class: className.title, id: titleId}).appendTo($module);
|
168
179
|
}
|
169
180
|
if (settings.content !== '') {
|
170
|
-
|
181
|
+
var descId = '_' + module.get.id() + 'desc';
|
182
|
+
$module.attr('aria-describedby', descId);
|
183
|
+
$('<div/>', {class: className.content, id: descId}).appendTo($module);
|
171
184
|
}
|
172
185
|
if (module.has.configActions()) {
|
173
|
-
$('<div/>', {class:
|
186
|
+
$('<div/>', {class: className.actions}).appendTo($module);
|
174
187
|
}
|
175
188
|
$context.append($module);
|
176
189
|
},
|
@@ -220,15 +233,21 @@ $.fn.modal = function(parameters) {
|
|
220
233
|
;
|
221
234
|
$window.off(elementEventNamespace);
|
222
235
|
$dimmer.off(elementEventNamespace);
|
223
|
-
$
|
236
|
+
$closeIcon.off(elementEventNamespace);
|
237
|
+
if($inputs) {
|
238
|
+
$inputs.off(elementEventNamespace);
|
239
|
+
}
|
224
240
|
$context.dimmer('destroy');
|
225
241
|
},
|
226
242
|
|
227
243
|
observeChanges: function() {
|
228
244
|
if('MutationObserver' in window) {
|
229
245
|
observer = new MutationObserver(function(mutations) {
|
230
|
-
|
231
|
-
|
246
|
+
if(settings.observeChanges) {
|
247
|
+
module.debug('DOM tree modified, refreshing');
|
248
|
+
module.refresh();
|
249
|
+
}
|
250
|
+
module.refreshInputs();
|
232
251
|
});
|
233
252
|
observer.observe(element, {
|
234
253
|
childList : true,
|
@@ -253,6 +272,23 @@ $.fn.modal = function(parameters) {
|
|
253
272
|
$allModals = $otherModals.add($module);
|
254
273
|
},
|
255
274
|
|
275
|
+
refreshInputs: function(){
|
276
|
+
if($inputs){
|
277
|
+
$inputs
|
278
|
+
.off('keydown' + elementEventNamespace)
|
279
|
+
;
|
280
|
+
}
|
281
|
+
$inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
|
282
|
+
return $(this).closest('.disabled').length === 0;
|
283
|
+
});
|
284
|
+
$inputs.first()
|
285
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
|
286
|
+
;
|
287
|
+
$inputs.last()
|
288
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
289
|
+
;
|
290
|
+
},
|
291
|
+
|
256
292
|
attachEvents: function(selector, event) {
|
257
293
|
var
|
258
294
|
$toggle = $(selector)
|
@@ -281,6 +317,9 @@ $.fn.modal = function(parameters) {
|
|
281
317
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
282
318
|
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
283
319
|
;
|
320
|
+
$closeIcon
|
321
|
+
.on('keyup' + elementEventNamespace, module.event.closeKeyUp)
|
322
|
+
;
|
284
323
|
$window
|
285
324
|
.on('resize' + elementEventNamespace, module.event.resize)
|
286
325
|
;
|
@@ -299,7 +338,13 @@ $.fn.modal = function(parameters) {
|
|
299
338
|
|
300
339
|
get: {
|
301
340
|
id: function() {
|
302
|
-
return
|
341
|
+
return id;
|
342
|
+
},
|
343
|
+
element: function() {
|
344
|
+
return $module;
|
345
|
+
},
|
346
|
+
settings: function() {
|
347
|
+
return settings;
|
303
348
|
}
|
304
349
|
},
|
305
350
|
|
@@ -332,10 +377,38 @@ $.fn.modal = function(parameters) {
|
|
332
377
|
close: function() {
|
333
378
|
module.hide();
|
334
379
|
},
|
380
|
+
closeKeyUp: function(event){
|
381
|
+
var
|
382
|
+
keyCode = event.which
|
383
|
+
;
|
384
|
+
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
|
385
|
+
module.hide();
|
386
|
+
}
|
387
|
+
},
|
388
|
+
inputKeyDown: {
|
389
|
+
first: function(event) {
|
390
|
+
var
|
391
|
+
keyCode = event.which
|
392
|
+
;
|
393
|
+
if (keyCode === settings.keys.tab && event.shiftKey) {
|
394
|
+
$inputs.last().focus();
|
395
|
+
event.preventDefault();
|
396
|
+
}
|
397
|
+
},
|
398
|
+
last: function(event) {
|
399
|
+
var
|
400
|
+
keyCode = event.which
|
401
|
+
;
|
402
|
+
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
403
|
+
$inputs.first().focus();
|
404
|
+
event.preventDefault();
|
405
|
+
}
|
406
|
+
}
|
407
|
+
},
|
335
408
|
mousedown: function(event) {
|
336
409
|
var
|
337
410
|
$target = $(event.target),
|
338
|
-
isRtl = module.is.rtl()
|
411
|
+
isRtl = module.is.rtl()
|
339
412
|
;
|
340
413
|
initialMouseDownInModal = ($target.closest(selector.modal).length > 0);
|
341
414
|
if(initialMouseDownInModal) {
|
@@ -383,10 +456,9 @@ $.fn.modal = function(parameters) {
|
|
383
456
|
},
|
384
457
|
keyboard: function(event) {
|
385
458
|
var
|
386
|
-
keyCode = event.which
|
387
|
-
escapeKey = 27
|
459
|
+
keyCode = event.which
|
388
460
|
;
|
389
|
-
if(keyCode
|
461
|
+
if(keyCode === settings.keys.escape) {
|
390
462
|
if(settings.closable) {
|
391
463
|
module.debug('Escape key pressed hiding modal');
|
392
464
|
if ( $module.hasClass(className.front) ) {
|
@@ -477,9 +549,9 @@ $.fn.modal = function(parameters) {
|
|
477
549
|
$module
|
478
550
|
.transition({
|
479
551
|
debug : settings.debug,
|
480
|
-
animation : settings.transition + ' in',
|
552
|
+
animation : (settings.transition.showMethod || settings.transition) + ' in',
|
481
553
|
queue : settings.queue,
|
482
|
-
duration : settings.duration,
|
554
|
+
duration : settings.transition.showDuration || settings.duration,
|
483
555
|
useFailSafe : true,
|
484
556
|
onComplete : function() {
|
485
557
|
settings.onVisible.apply(element);
|
@@ -527,9 +599,9 @@ $.fn.modal = function(parameters) {
|
|
527
599
|
$module
|
528
600
|
.transition({
|
529
601
|
debug : settings.debug,
|
530
|
-
animation : settings.transition + ' out',
|
602
|
+
animation : (settings.transition.hideMethod || settings.transition) + ' out',
|
531
603
|
queue : settings.queue,
|
532
|
-
duration : settings.duration,
|
604
|
+
duration : settings.transition.hideDuration || settings.duration,
|
533
605
|
useFailSafe : true,
|
534
606
|
onStart : function() {
|
535
607
|
if(!module.others.active() && !module.others.animating() && !keepDimmed) {
|
@@ -680,7 +752,12 @@ $.fn.modal = function(parameters) {
|
|
680
752
|
bodyMargin: function() {
|
681
753
|
var position = module.can.leftBodyScrollbar() ? 'left':'right';
|
682
754
|
$body.css('margin-'+position, initialBodyMargin);
|
683
|
-
$body.find(selector.bodyFixed.replace('right',position)).
|
755
|
+
$body.find(selector.bodyFixed.replace('right',position)).each(function(){
|
756
|
+
var el = $(this),
|
757
|
+
attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
|
758
|
+
;
|
759
|
+
el.css(attribute, '');
|
760
|
+
});
|
684
761
|
}
|
685
762
|
},
|
686
763
|
|
@@ -696,7 +773,7 @@ $.fn.modal = function(parameters) {
|
|
696
773
|
$module
|
697
774
|
.off('mousedown' + elementEventNamespace)
|
698
775
|
;
|
699
|
-
}
|
776
|
+
}
|
700
777
|
$dimmer
|
701
778
|
.off('mousedown' + elementEventNamespace)
|
702
779
|
;
|
@@ -881,13 +958,10 @@ $.fn.modal = function(parameters) {
|
|
881
958
|
set: {
|
882
959
|
autofocus: function() {
|
883
960
|
var
|
884
|
-
$inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
|
885
|
-
return $(this).closest('.disabled').length === 0;
|
886
|
-
}),
|
887
961
|
$autofocus = $inputs.filter('[autofocus]'),
|
888
962
|
$input = ($autofocus.length > 0)
|
889
963
|
? $autofocus.first()
|
890
|
-
: $inputs.first()
|
964
|
+
: ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
|
891
965
|
;
|
892
966
|
if($input.length > 0) {
|
893
967
|
$input.focus();
|
@@ -898,7 +972,12 @@ $.fn.modal = function(parameters) {
|
|
898
972
|
if(settings.detachable || module.can.fit()) {
|
899
973
|
$body.css('margin-'+position, tempBodyMargin + 'px');
|
900
974
|
}
|
901
|
-
$body.find(selector.bodyFixed.replace('right',position)).
|
975
|
+
$body.find(selector.bodyFixed.replace('right',position)).each(function(){
|
976
|
+
var el = $(this),
|
977
|
+
attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
|
978
|
+
;
|
979
|
+
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
980
|
+
});
|
902
981
|
},
|
903
982
|
clickaway: function() {
|
904
983
|
if (!settings.detachable) {
|
@@ -925,8 +1004,8 @@ $.fn.modal = function(parameters) {
|
|
925
1004
|
closable : 'auto',
|
926
1005
|
useFlex : module.can.useFlex(),
|
927
1006
|
duration : {
|
928
|
-
show : settings.duration,
|
929
|
-
hide : settings.duration
|
1007
|
+
show : settings.transition.showDuration || settings.duration,
|
1008
|
+
hide : settings.transition.hideDuration || settings.duration
|
930
1009
|
}
|
931
1010
|
},
|
932
1011
|
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
@@ -964,7 +1043,7 @@ $.fn.modal = function(parameters) {
|
|
964
1043
|
? $(document).scrollTop() + settings.padding
|
965
1044
|
: $(document).scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
|
966
1045
|
marginLeft: -(module.cache.width / 2)
|
967
|
-
})
|
1046
|
+
})
|
968
1047
|
;
|
969
1048
|
} else {
|
970
1049
|
$module
|
@@ -973,7 +1052,7 @@ $.fn.modal = function(parameters) {
|
|
973
1052
|
? -(module.cache.height / 2)
|
974
1053
|
: settings.padding / 2,
|
975
1054
|
marginLeft: -(module.cache.width / 2)
|
976
|
-
})
|
1055
|
+
})
|
977
1056
|
;
|
978
1057
|
}
|
979
1058
|
module.verbose('Setting modal offset for legacy mode');
|
@@ -1185,9 +1264,22 @@ $.fn.modal = function(parameters) {
|
|
1185
1264
|
|
1186
1265
|
if(methodInvoked) {
|
1187
1266
|
if(instance === undefined) {
|
1267
|
+
if ($.isFunction(settings.templates[query])) {
|
1268
|
+
settings.autoShow = true;
|
1269
|
+
settings.className.modal = settings.className.template;
|
1270
|
+
settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
|
1271
|
+
|
1272
|
+
// reassign shortcuts
|
1273
|
+
className = settings.className;
|
1274
|
+
namespace = settings.namespace;
|
1275
|
+
fields = settings.fields;
|
1276
|
+
error = settings.error;
|
1277
|
+
}
|
1188
1278
|
module.initialize();
|
1189
1279
|
}
|
1190
|
-
|
1280
|
+
if (!$.isFunction(settings.templates[query])) {
|
1281
|
+
module.invoke(query);
|
1282
|
+
}
|
1191
1283
|
}
|
1192
1284
|
else {
|
1193
1285
|
if(instance !== undefined) {
|
@@ -1225,6 +1317,7 @@ $.fn.modal.settings = {
|
|
1225
1317
|
closable : true,
|
1226
1318
|
autofocus : true,
|
1227
1319
|
restoreFocus : true,
|
1320
|
+
autoShow : false,
|
1228
1321
|
|
1229
1322
|
inverted : false,
|
1230
1323
|
blurring : false,
|
@@ -1285,16 +1378,25 @@ $.fn.modal.settings = {
|
|
1285
1378
|
// called after deny selector match
|
1286
1379
|
onDeny : function(){ return true; },
|
1287
1380
|
|
1381
|
+
keys : {
|
1382
|
+
space : 32,
|
1383
|
+
enter : 13,
|
1384
|
+
escape : 27,
|
1385
|
+
tab : 9,
|
1386
|
+
},
|
1387
|
+
|
1288
1388
|
selector : {
|
1289
1389
|
title : '> .header',
|
1290
1390
|
content : '> .content',
|
1291
1391
|
actions : '> .actions',
|
1292
1392
|
close : '> .close',
|
1393
|
+
closeIcon: '> .close',
|
1293
1394
|
approve : '.actions .positive, .actions .approve, .actions .ok',
|
1294
1395
|
deny : '.actions .negative, .actions .deny, .actions .cancel',
|
1295
1396
|
modal : '.ui.modal',
|
1296
1397
|
dimmer : '> .ui.dimmer',
|
1297
|
-
bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar'
|
1398
|
+
bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
|
1399
|
+
prompt : '.ui.input > input'
|
1298
1400
|
},
|
1299
1401
|
error : {
|
1300
1402
|
dimmer : 'UI Dimmer, a required component is not included in this page',
|
@@ -1312,9 +1414,103 @@ $.fn.modal.settings = {
|
|
1312
1414
|
undetached : 'undetached',
|
1313
1415
|
front : 'front',
|
1314
1416
|
close : 'close icon',
|
1315
|
-
button : 'ui button'
|
1417
|
+
button : 'ui button',
|
1418
|
+
modal : 'ui modal',
|
1419
|
+
title : 'header',
|
1420
|
+
content : 'content',
|
1421
|
+
actions : 'actions',
|
1422
|
+
template : 'ui tiny modal',
|
1423
|
+
ok : 'positive',
|
1424
|
+
cancel : 'negative',
|
1425
|
+
prompt : 'ui fluid input'
|
1426
|
+
},
|
1427
|
+
text: {
|
1428
|
+
ok : 'Ok',
|
1429
|
+
cancel: 'Cancel',
|
1430
|
+
close : 'Close'
|
1316
1431
|
}
|
1317
1432
|
};
|
1318
1433
|
|
1434
|
+
$.fn.modal.settings.templates = {
|
1435
|
+
getArguments: function(args) {
|
1436
|
+
var queryArguments = [].slice.call(args);
|
1437
|
+
if($.isPlainObject(queryArguments[0])){
|
1438
|
+
return $.extend({
|
1439
|
+
handler:function(){},
|
1440
|
+
content:'',
|
1441
|
+
title: ''
|
1442
|
+
}, queryArguments[0]);
|
1443
|
+
} else {
|
1444
|
+
if(!$.isFunction(queryArguments[queryArguments.length-1])) {
|
1445
|
+
queryArguments.push(function() {});
|
1446
|
+
}
|
1447
|
+
return {
|
1448
|
+
handler: queryArguments.pop(),
|
1449
|
+
content: queryArguments.pop() || '',
|
1450
|
+
title: queryArguments.pop() || ''
|
1451
|
+
};
|
1452
|
+
}
|
1453
|
+
},
|
1454
|
+
alert: function () {
|
1455
|
+
var settings = this.get.settings(),
|
1456
|
+
args = settings.templates.getArguments(arguments)
|
1457
|
+
;
|
1458
|
+
return {
|
1459
|
+
title : args.title,
|
1460
|
+
content: args.content,
|
1461
|
+
actions: [{
|
1462
|
+
text : settings.text.ok,
|
1463
|
+
class: settings.className.ok,
|
1464
|
+
click: args.handler
|
1465
|
+
}]
|
1466
|
+
}
|
1467
|
+
},
|
1468
|
+
confirm: function () {
|
1469
|
+
var settings = this.get.settings(),
|
1470
|
+
args = settings.templates.getArguments(arguments)
|
1471
|
+
;
|
1472
|
+
return {
|
1473
|
+
title : args.title,
|
1474
|
+
content: args.content,
|
1475
|
+
actions: [{
|
1476
|
+
text : settings.text.ok,
|
1477
|
+
class: settings.className.ok,
|
1478
|
+
click: function(){args.handler(true)}
|
1479
|
+
},{
|
1480
|
+
text: settings.text.cancel,
|
1481
|
+
class: settings.className.cancel,
|
1482
|
+
click: function(){args.handler(false)}
|
1483
|
+
}]
|
1484
|
+
}
|
1485
|
+
},
|
1486
|
+
prompt: function () {
|
1487
|
+
var $this = this,
|
1488
|
+
settings = this.get.settings(),
|
1489
|
+
args = settings.templates.getArguments(arguments),
|
1490
|
+
input = $($.parseHTML(args.content)).filter('.ui.input')
|
1491
|
+
;
|
1492
|
+
if (input.length === 0) {
|
1493
|
+
args.content += '<p><div class="'+settings.className.prompt+'"><input placeholder="'+this.helpers.deQuote(args.placeholder || '')+'" type="text" value="'+this.helpers.deQuote(args.defaultValue || '')+'"></div></p>';
|
1494
|
+
}
|
1495
|
+
return {
|
1496
|
+
title : args.title,
|
1497
|
+
content: args.content,
|
1498
|
+
actions: [{
|
1499
|
+
text: settings.text.ok,
|
1500
|
+
class: settings.className.ok,
|
1501
|
+
click: function(){
|
1502
|
+
var settings = $this.get.settings(),
|
1503
|
+
inputField = $this.get.element().find(settings.selector.prompt)[0]
|
1504
|
+
;
|
1505
|
+
args.handler($(inputField).val());
|
1506
|
+
}
|
1507
|
+
},{
|
1508
|
+
text: settings.text.cancel,
|
1509
|
+
class: settings.className.cancel,
|
1510
|
+
click: function(){args.handler(null)}
|
1511
|
+
}]
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
}
|
1319
1515
|
|
1320
1516
|
})( jQuery, window, document );
|
@@ -40,9 +40,9 @@
|
|
40
40
|
will-change: top, left, margin, transform, opacity;
|
41
41
|
}
|
42
42
|
|
43
|
-
.ui.modal > :first-child:not(.
|
43
|
+
.ui.modal > :first-child:not(.close):not(.dimmer),
|
44
44
|
.ui.modal > i.icon:first-child + *,
|
45
|
-
.ui.modal > .dimmer:first-child + *:not(.
|
45
|
+
.ui.modal > .dimmer:first-child + *:not(.close),
|
46
46
|
.ui.modal > .dimmer:first-child + i.icon + * {
|
47
47
|
border-top-left-radius: @borderRadius;
|
48
48
|
border-top-right-radius: @borderRadius;
|
@@ -80,8 +80,10 @@
|
|
80
80
|
height: @closeHitbox;
|
81
81
|
padding: @closePadding;
|
82
82
|
}
|
83
|
+
.ui.modal > .close:focus,
|
83
84
|
.ui.modal > .close:hover {
|
84
85
|
opacity: 1;
|
86
|
+
outline: none;
|
85
87
|
}
|
86
88
|
|
87
89
|
/*--------------
|
@@ -477,8 +479,8 @@
|
|
477
479
|
border-radius:0;
|
478
480
|
}
|
479
481
|
}
|
480
|
-
.ui.modal > .close.inside + .header,
|
481
|
-
.ui.fullscreen.modal > .close + .header {
|
482
|
+
.ui.modal > .close.inside + .header:not(.centered):not(.center):not(.icon),
|
483
|
+
.ui.fullscreen.modal > .close + .header:not(.centered):not(.center):not(.icon) {
|
482
484
|
padding-right: @closeHitbox;
|
483
485
|
}
|
484
486
|
.ui.modal > .close.inside,
|