fomantic-ui 2.9.0-beta.93 → 2.9.0-beta.97

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 (152) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +1 -1
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +1 -1
  8. package/dist/components/api.min.js +1 -1
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +1 -1
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +1 -1
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +1 -1
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +1 -1
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +1 -1
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +1 -1
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -1
  34. package/dist/components/dropdown.js +1 -1
  35. package/dist/components/dropdown.min.css +1 -1
  36. package/dist/components/dropdown.min.js +1 -1
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +1 -1
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +1 -1
  41. package/dist/components/feed.css +1 -1
  42. package/dist/components/feed.min.css +1 -1
  43. package/dist/components/flag.css +1 -1
  44. package/dist/components/flag.min.css +1 -1
  45. package/dist/components/form.css +1 -1
  46. package/dist/components/form.js +1 -1
  47. package/dist/components/form.min.css +1 -1
  48. package/dist/components/form.min.js +1 -1
  49. package/dist/components/grid.css +1 -1
  50. package/dist/components/grid.min.css +1 -1
  51. package/dist/components/header.css +1 -1
  52. package/dist/components/header.min.css +1 -1
  53. package/dist/components/icon.css +1 -1
  54. package/dist/components/icon.min.css +1 -1
  55. package/dist/components/image.css +1 -1
  56. package/dist/components/image.min.css +1 -1
  57. package/dist/components/input.css +1 -1
  58. package/dist/components/input.min.css +1 -1
  59. package/dist/components/item.css +1 -1
  60. package/dist/components/item.min.css +1 -1
  61. package/dist/components/label.css +1 -1
  62. package/dist/components/label.min.css +1 -1
  63. package/dist/components/list.css +1 -1
  64. package/dist/components/list.min.css +1 -1
  65. package/dist/components/loader.css +1 -1
  66. package/dist/components/loader.min.css +1 -1
  67. package/dist/components/message.css +1 -1
  68. package/dist/components/message.min.css +1 -1
  69. package/dist/components/modal.css +1 -1
  70. package/dist/components/modal.js +1 -1
  71. package/dist/components/modal.min.css +1 -1
  72. package/dist/components/modal.min.js +1 -1
  73. package/dist/components/nag.css +1 -1
  74. package/dist/components/nag.js +1 -1
  75. package/dist/components/nag.min.css +1 -1
  76. package/dist/components/nag.min.js +1 -1
  77. package/dist/components/placeholder.css +1 -1
  78. package/dist/components/placeholder.min.css +1 -1
  79. package/dist/components/popup.css +1 -1
  80. package/dist/components/popup.js +1 -1
  81. package/dist/components/popup.min.css +1 -1
  82. package/dist/components/popup.min.js +1 -1
  83. package/dist/components/progress.css +1 -1
  84. package/dist/components/progress.js +1 -1
  85. package/dist/components/progress.min.css +1 -1
  86. package/dist/components/progress.min.js +1 -1
  87. package/dist/components/rail.css +1 -1
  88. package/dist/components/rail.min.css +1 -1
  89. package/dist/components/rating.css +1 -1
  90. package/dist/components/rating.js +1 -1
  91. package/dist/components/rating.min.css +1 -1
  92. package/dist/components/rating.min.js +1 -1
  93. package/dist/components/reset.css +1 -1
  94. package/dist/components/reset.min.css +1 -1
  95. package/dist/components/reveal.css +1 -1
  96. package/dist/components/reveal.min.css +1 -1
  97. package/dist/components/search.css +1 -1
  98. package/dist/components/search.js +1 -1
  99. package/dist/components/search.min.css +1 -1
  100. package/dist/components/search.min.js +1 -1
  101. package/dist/components/segment.css +1 -1
  102. package/dist/components/segment.min.css +1 -1
  103. package/dist/components/shape.css +1 -1
  104. package/dist/components/shape.js +1 -1
  105. package/dist/components/shape.min.css +1 -1
  106. package/dist/components/shape.min.js +1 -1
  107. package/dist/components/sidebar.css +1 -1
  108. package/dist/components/sidebar.js +1 -1
  109. package/dist/components/sidebar.min.css +1 -1
  110. package/dist/components/sidebar.min.js +1 -1
  111. package/dist/components/site.css +1 -1
  112. package/dist/components/site.js +1 -1
  113. package/dist/components/site.min.css +1 -1
  114. package/dist/components/site.min.js +1 -1
  115. package/dist/components/slider.js +1 -1
  116. package/dist/components/slider.min.js +1 -1
  117. package/dist/components/state.js +1 -1
  118. package/dist/components/state.min.js +1 -1
  119. package/dist/components/statistic.css +1 -1
  120. package/dist/components/statistic.min.css +1 -1
  121. package/dist/components/step.css +1 -1
  122. package/dist/components/step.min.css +1 -1
  123. package/dist/components/sticky.css +1 -1
  124. package/dist/components/sticky.js +1 -1
  125. package/dist/components/sticky.min.css +1 -1
  126. package/dist/components/sticky.min.js +1 -1
  127. package/dist/components/tab.css +1 -1
  128. package/dist/components/tab.js +1 -1
  129. package/dist/components/tab.min.css +1 -1
  130. package/dist/components/tab.min.js +1 -1
  131. package/dist/components/table.css +1 -1
  132. package/dist/components/table.min.css +1 -1
  133. package/dist/components/text.css +1 -1
  134. package/dist/components/text.min.css +1 -1
  135. package/dist/components/toast.css +33 -1
  136. package/dist/components/toast.js +50 -24
  137. package/dist/components/toast.min.css +2 -2
  138. package/dist/components/toast.min.js +2 -2
  139. package/dist/components/transition.css +1 -1
  140. package/dist/components/transition.js +1 -1
  141. package/dist/components/transition.min.css +1 -1
  142. package/dist/components/transition.min.js +1 -1
  143. package/dist/components/visibility.js +1 -1
  144. package/dist/components/visibility.min.js +1 -1
  145. package/dist/semantic.css +89 -49
  146. package/dist/semantic.js +74 -48
  147. package/dist/semantic.min.css +2 -2
  148. package/dist/semantic.min.js +2 -2
  149. package/package.json +1 -1
  150. package/src/definitions/modules/toast.js +49 -23
  151. package/src/definitions/modules/toast.less +29 -0
  152. package/src/themes/default/modules/toast.variables +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fomantic-ui",
3
- "version": "2.9.0-beta.93",
3
+ "version": "2.9.0-beta.97",
4
4
  "description": "Fomantic empowers designers and developers by creating a shared vocabulary for UI.",
5
5
  "keywords": [
6
6
  "fomantic-ui",
@@ -69,12 +69,14 @@ $.fn.toast = function(parameters) {
69
69
  element = this,
70
70
  instance = isToastComponent ? $module.data(moduleNamespace) : undefined,
71
71
 
72
+ id,
72
73
  module
73
74
  ;
74
75
  module = {
75
76
 
76
77
  initialize: function() {
77
78
  module.verbose('Initializing element');
79
+ module.create.id();
78
80
  if (!module.has.container()) {
79
81
  module.create.container();
80
82
  }
@@ -124,17 +126,22 @@ $.fn.toast = function(parameters) {
124
126
  },
125
127
 
126
128
  show: function(callback) {
127
- callback = callback || function(){};
128
- module.debug('Showing toast');
129
129
  if(settings.onShow.call($toastBox, element) === false) {
130
130
  module.debug('onShow callback returned false, cancelling toast animation');
131
131
  return;
132
132
  }
133
+ callback = callback || function(){};
134
+ module.debug('Showing toast');
133
135
  module.animate.show(callback);
134
136
  },
135
137
 
136
138
  close: function(callback) {
139
+ if(settings.onHide.call($toastBox, element) === false) {
140
+ module.debug('onHide callback returned false, cancelling toast animation');
141
+ return;
142
+ }
137
143
  callback = callback || function(){};
144
+ module.debug('Closing toast');
138
145
  module.remove.visible();
139
146
  module.unbind.events();
140
147
  module.animate.close(callback);
@@ -146,12 +153,16 @@ $.fn.toast = function(parameters) {
146
153
  module.verbose('Creating container');
147
154
  $context.append($('<div/>',{class: settings.position + ' ' + className.container + ' ' +(settings.horizontal ? className.horizontal : '')}));
148
155
  },
156
+ id: function() {
157
+ id = (Math.random().toString(16) + '000000000').substr(2, 8);
158
+ module.verbose('Creating unique id for element', id);
159
+ },
149
160
  toast: function() {
150
161
  $toastBox = $('<div/>', {class: className.box});
151
162
  var iconClass = module.get.iconClass();
152
163
  if (!isToastComponent) {
153
164
  module.verbose('Creating toast');
154
- $toast = $('<div/>');
165
+ $toast = $('<div/>', {role: 'alert'});
155
166
  var $content = $('<div/>', {class: className.content});
156
167
  if (iconClass !== '') {
157
168
  $toast.append($('<i/>', {class: iconClass + ' ' + className.icon}));
@@ -164,13 +175,21 @@ $.fn.toast = function(parameters) {
164
175
  }));
165
176
  }
166
177
  if (settings.title !== '') {
178
+ var titleId = '_' + module.get.id() + 'title';
179
+ $toast.attr('aria-labelledby', titleId);
167
180
  $content.append($('<div/>', {
168
181
  class: className.title,
169
- text: settings.title
182
+ id: titleId,
183
+ html: module.helpers.escape(settings.title, settings.preserveHTML)
170
184
  }));
171
185
  }
172
-
173
- $content.append($('<div/>', {class: className.message, html: module.helpers.escape(settings.message, settings.preserveHTML)}));
186
+ var descId = '_' + module.get.id() + 'desc';
187
+ $toast.attr('aria-describedby', descId);
188
+ $content.append($('<div/>', {
189
+ class: className.message,
190
+ id: descId,
191
+ html: module.helpers.escape(settings.message, settings.preserveHTML)
192
+ }));
174
193
 
175
194
  $toast
176
195
  .addClass(settings.class + ' ' + className.toast)
@@ -178,7 +197,7 @@ $.fn.toast = function(parameters) {
178
197
  ;
179
198
  $toast.css('opacity', settings.opacity);
180
199
  if (settings.closeIcon) {
181
- $close = $('<i/>', {class: className.close + ' ' + (typeof settings.closeIcon === 'string' ? settings.closeIcon : '')});
200
+ $close = $('<i/>', {class: className.close + ' ' + (typeof settings.closeIcon === 'string' ? settings.closeIcon : ''), role: 'button', tabindex: 0, 'aria-label': settings.text.close});
182
201
  if($close.hasClass(className.left)) {
183
202
  $toast.prepend($close);
184
203
  } else {
@@ -221,12 +240,13 @@ $.fn.toast = function(parameters) {
221
240
  }
222
241
  }
223
242
  settings.actions.forEach(function (el) {
224
- var icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
243
+ var icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
225
244
  text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
226
245
  cls = module.helpers.deQuote(el[fields.class] || ''),
227
246
  click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {};
228
247
  $actions.append($('<button/>', {
229
248
  html: icon + text,
249
+ 'aria-label': $('<div>'+(el[fields.text] || el[fields.icon] || '')+'</div>').text(),
230
250
  class: className.button + ' ' + cls,
231
251
  click: function () {
232
252
  var button = $(this);
@@ -330,13 +350,12 @@ $.fn.toast = function(parameters) {
330
350
  bind: {
331
351
  events: function() {
332
352
  module.debug('Binding events to toast');
333
- if(settings.closeOnClick || settings.closeIcon) {
334
- (settings.closeIcon ? $close : $toast)
335
- .on('click' + eventNamespace, module.event.click)
336
- ;
353
+ if(settings.closeIcon) {
354
+ $close.on('click' + eventNamespace, module.event.close);
337
355
  }
356
+ $toast.on('click' + eventNamespace, module.event.click);
338
357
  if($animationObject) {
339
- $animationObject.on('animationend' + eventNamespace, module.close);
358
+ $animationObject.on('animationend' + eventNamespace, module.event.close);
340
359
  }
341
360
  $toastBox
342
361
  .on('click' + eventNamespace, selector.approve, module.event.approve)
@@ -348,11 +367,10 @@ $.fn.toast = function(parameters) {
348
367
  unbind: {
349
368
  events: function() {
350
369
  module.debug('Unbinding events to toast');
351
- if(settings.closeOnClick || settings.closeIcon) {
352
- (settings.closeIcon ? $close : $toast)
353
- .off('click' + eventNamespace)
354
- ;
370
+ if(settings.closeIcon) {
371
+ $close.off('click' + eventNamespace);
355
372
  }
373
+ $toast.off('click' + eventNamespace);
356
374
  if($animationObject) {
357
375
  $animationObject.off('animationend' + eventNamespace);
358
376
  }
@@ -384,11 +402,6 @@ $.fn.toast = function(parameters) {
384
402
  },
385
403
  close: function(callback) {
386
404
  callback = $.isFunction(callback) ? callback : function(){};
387
- module.debug('Closing toast');
388
- if(settings.onHide.call($toastBox, element) === false) {
389
- module.debug('onHide callback returned false, cancelling toast animation');
390
- return;
391
- }
392
405
  if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
393
406
  $toastBox
394
407
  .transition({
@@ -458,6 +471,9 @@ $.fn.toast = function(parameters) {
458
471
  },
459
472
 
460
473
  get: {
474
+ id: function() {
475
+ return id;
476
+ },
461
477
  container: function() {
462
478
  return ($context.find(module.helpers.toClass(settings.position) + selector.container + (settings.horizontal ? module.helpers.toClass(className.horizontal) : ':not('+module.helpers.toClass(className.horizontal)+')'))[0]);
463
479
  },
@@ -491,9 +507,15 @@ $.fn.toast = function(parameters) {
491
507
  },
492
508
 
493
509
  event: {
510
+ close: function(){
511
+ module.close();
512
+ },
494
513
  click: function(event) {
495
514
  if($(event.target).closest('a').length === 0) {
496
- settings.onClick.call($toastBox, element);
515
+ if(settings.onClick.call($toastBox, element) === false || !settings.closeOnClick) {
516
+ module.verbose('Click callback returned false or close denied by setting cancelling close');
517
+ return;
518
+ }
497
519
  module.close();
498
520
  }
499
521
  },
@@ -834,6 +856,10 @@ $.fn.toast.settings = {
834
856
  unclickable : 'unclickable'
835
857
  },
836
858
 
859
+ text: {
860
+ close : 'Close'
861
+ },
862
+
837
863
  icons : {
838
864
  info : 'info',
839
865
  success : 'checkmark',
@@ -523,6 +523,12 @@
523
523
  }
524
524
  }
525
525
  &.vertical when (@variationToastVertical) {
526
+ & > .content {
527
+ flex-grow: 1;
528
+ }
529
+ &.attached when (@variationToastAttached){
530
+ flex-grow: 1;
531
+ }
526
532
  & > .close.icon + .content when (@variationToastClose){
527
533
  padding-left: @toastCloseDistanceVertical;
528
534
  }
@@ -554,6 +560,29 @@
554
560
  border-bottom-right-radius: 0;
555
561
  }
556
562
  }
563
+
564
+ &.ui.ui.ui.image when (@variationToastImage) {
565
+ padding: 0;
566
+ & > .content {
567
+ padding-top: @inputVerticalPadding;
568
+ padding-bottom: @inputVerticalPadding;
569
+ padding-right: @inputHorizontalPadding;
570
+ }
571
+ & > .actions when (@variationToastActions) {
572
+ margin: 0;
573
+ }
574
+ & > .ui.image {
575
+ border-top-left-radius: @defaultBorderRadius;
576
+ border-bottom-left-radius: @defaultBorderRadius;
577
+ &.mini {
578
+ min-width: @toastImageMiniImageAdjustment;
579
+ & + .content {
580
+ min-height: @toastImageMiniImageAdjustment;
581
+ padding-left: @toastImageMiniImagePadding;
582
+ }
583
+ }
584
+ }
585
+ }
557
586
  }
558
587
 
559
588
 
@@ -58,6 +58,9 @@
58
58
  @toastIconCenteredAdjustment: 1.2em;
59
59
  @toastImageCenteredAdjustment: 2em;
60
60
 
61
+ @toastImageMiniImageAdjustment: e(%("calc(%d + %d)", @inputVerticalPadding, @toastMiniImageHeight));
62
+ @toastImageMiniImagePadding: 4.4em;
63
+
61
64
  /* Progressbar Colors */
62
65
  @toastInfoProgressColor: darken(@toastInfoColor,15);
63
66
  @toastWarningProgressColor: darken(@toastWarningColor,15);