uniform-ui 3.0.0.beta8 → 3.0.0.beta10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/javascripts/uniform/checkbox.js +12 -12
  3. data/lib/assets/javascripts/uniform/component.js +17 -13
  4. data/lib/assets/javascripts/uniform/dropdown.js +54 -54
  5. data/lib/assets/javascripts/uniform/dropzone.js +107 -0
  6. data/lib/assets/javascripts/uniform/floating-label-input.js +8 -8
  7. data/lib/assets/javascripts/uniform/modal.js +12 -12
  8. data/lib/assets/javascripts/uniform/popover.js +54 -33
  9. data/lib/assets/javascripts/uniform/resizer.js +20 -20
  10. data/lib/assets/javascripts/uniform/select.js +186 -162
  11. data/lib/assets/javascripts/uniform/sticker.js +26 -0
  12. data/lib/assets/javascripts/uniform/tooltip.js +29 -16
  13. data/lib/assets/javascripts/uniform.js +12 -10
  14. data/lib/assets/stylesheets/uniform/base.scss +20 -5
  15. data/lib/assets/stylesheets/uniform/components/buttons.scss +4 -5
  16. data/lib/assets/stylesheets/uniform/components/checkbox.scss +2 -0
  17. data/lib/assets/stylesheets/uniform/components/container.scss +8 -7
  18. data/lib/assets/stylesheets/uniform/components/dropzone.scss +40 -0
  19. data/lib/assets/stylesheets/uniform/components/pointer.scss +4 -4
  20. data/lib/assets/stylesheets/uniform/components/select.scss +7 -2
  21. data/lib/assets/stylesheets/uniform/components/thumb.scss +0 -1
  22. data/lib/assets/stylesheets/uniform/components/z-input.scss +1 -1
  23. data/lib/assets/stylesheets/uniform/config.scss +156 -0
  24. data/lib/assets/stylesheets/uniform/defaults.scss +2 -23
  25. data/lib/assets/stylesheets/uniform/functions/icons.scss +29 -0
  26. data/lib/assets/stylesheets/uniform/functions/map.scss +95 -0
  27. data/lib/assets/stylesheets/uniform/functions/string.scss +15 -0
  28. data/lib/assets/stylesheets/uniform/functions.scss +4 -79
  29. data/lib/assets/stylesheets/uniform/mixins.scss +34 -26
  30. data/lib/assets/stylesheets/uniform/utilities/effects.scss +31 -0
  31. data/lib/assets/stylesheets/uniform/utilities/layout.scss +13 -20
  32. data/lib/assets/stylesheets/uniform/utilities/position.scss +4 -0
  33. data/lib/assets/stylesheets/uniform/utilities/text.scss +1 -0
  34. data/lib/assets/stylesheets/uniform/utilities.scss +6 -0
  35. data/lib/uniform/version.rb +1 -1
  36. metadata +9 -3
  37. data/lib/assets/stylesheets/uniform/variables.scss +0 -145
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 412523e9eff8e56b4f3874670f9b43dd0fe8deea00dc41fc59d9ca57e1f4b808
4
- data.tar.gz: 91e4e049712982119860f56e3942f02d6bbc622bc9af779027100b7eeab6c66a
3
+ metadata.gz: b7bdc92171e497d800d00558b6fa1bc980d2664aea204a005379b3bf13a17156
4
+ data.tar.gz: 607b3652e660dbf9ee784fa1faaa0702dd35786c910dac92747d720a3bae5024
5
5
  SHA512:
6
- metadata.gz: dfe6402b702439be8cfe35a287d7dcffcb2eab8fa899a9bd2dceb0a10e4fc937e40580379242a7e94d62c57e2bf6bfb65aea1b4b9b2bf5a7a8d0b4c7e60d628f
7
- data.tar.gz: e8394e0e62e9d03691ff63799387101f9b892e6715cead997885e530c73da034532422fc71fe07e6c0413fb924f88cec2f06cf90016dc5b7a68b4942025e542c
6
+ metadata.gz: 1e92685de1a592984b81e8b619364f5fd61be992af20d616bf84001b7ef6edc9f534699e6c26a1bf3a5e4bb484e15cbcd1aa57f4cbd9048b154872a2569460af
7
+ data.tar.gz: d72fcaaa3702f68f0558f57b876def3e96cd670e1f0c04c5c1c81af88da31be9e4b9be5e0e1a015aa9ff58a7a9efa84353bc0b6a658bd4c60ca56d222fe68dd7
@@ -7,11 +7,11 @@ export class Checkbox extends Component {
7
7
 
8
8
  initialize (options) {
9
9
  if(options.input instanceof Element) {
10
- this.input = options.input
10
+ this.input = options.input
11
11
  } else {
12
- this.input = createElement('input', Object.assign({}, {
13
- type: this.constructor.type
14
- }, options.input)) // TODO filter options to dolla.HTML_ATTRIBUTES
12
+ this.input = createElement('input', Object.assign({}, {
13
+ type: this.constructor.type
14
+ }, options.input)) // TODO filter options to dolla.HTML_ATTRIBUTES
15
15
  }
16
16
 
17
17
  if(!options.tabindex) this.el.tabIndex = 0;
@@ -27,9 +27,9 @@ export class Checkbox extends Component {
27
27
  this.input.style.display = "none";
28
28
 
29
29
  if(this.input.parentNode){
30
- this.input.parentNode.insertBefore(this.el, this.input.nextSibling);
30
+ this.input.parentNode.insertBefore(this.el, this.input.nextSibling);
31
31
  } else {
32
- this.el.append(this.input);
32
+ this.el.append(this.input);
33
33
  }
34
34
 
35
35
  this.change()
@@ -58,17 +58,17 @@ export class Checkbox extends Component {
58
58
  }
59
59
 
60
60
  keydown(e) {
61
- if(e.keyCode == 32 && document.activeElement == this.el) {
62
- // Prevent Page Scroll
63
- e.preventDefault();
64
- }
61
+ if(e.keyCode == 32 && document.activeElement == this.el) {
62
+ // Prevent Page Scroll
63
+ e.preventDefault();
64
+ }
65
65
  }
66
66
  }
67
67
 
68
68
  export class Radio extends Checkbox {
69
- static CSSClass = "uniformRadio";
69
+ static CSSClass = "uniformRadio";
70
70
  }
71
71
 
72
72
  export class Toggle extends Checkbox {
73
- static CSSClass = "uniformToggle";
73
+ static CSSClass = "uniformToggle";
74
74
  }
@@ -1,4 +1,4 @@
1
- import {hasClass, HTML_ATTRIBUTES, createElement} from 'dolla';
1
+ import { HTML_ATTRIBUTES, createElement} from 'dolla';
2
2
 
3
3
  function uniqueId(prefix){
4
4
  window.idCounter || (window.idCounter = 0);
@@ -14,9 +14,9 @@ export default class Component {
14
14
  this.eventListeners = new Array();
15
15
  const htmlAttributes = {}
16
16
  Object.keys(options).forEach(key => {
17
- if (HTML_ATTRIBUTES.includes(key)) {
18
- htmlAttributes[key] = options[key]
19
- }
17
+ if (HTML_ATTRIBUTES.includes(key)) {
18
+ htmlAttributes[key] = options[key]
19
+ }
20
20
  })
21
21
  delete htmlAttributes.content;
22
22
  this.el = options.el || createElement('div', htmlAttributes);
@@ -36,11 +36,15 @@ export default class Component {
36
36
  });
37
37
  }.bind(this);
38
38
 
39
- this.trigger = function (event_key) {
39
+ this.trigger = function (event_key, ...args) {
40
40
  if(!this.eventListeners) return;
41
- this.eventListeners.forEach(function(listener){
42
- if(listener.type == "*" || listener.type == "all" || event_key == listener.type){
43
- listener.handler(event_key, this);
41
+ this.eventListeners.forEach(listener => {
42
+ if (listener.type == "*" || listener.type == "all" || event_key == listener.type){
43
+ args.push(this);
44
+ if (event_key != listener.type) {
45
+ args.unshift(event_key)
46
+ }
47
+ listener.handler(...args);
44
48
  }
45
49
  })
46
50
  };
@@ -49,11 +53,11 @@ export default class Component {
49
53
  }
50
54
 
51
55
  addEventListener () {
52
- this.on.apply(this, arguments);
56
+ this.on.apply(this, arguments);
53
57
  }
54
58
 
55
59
  removeEventListener () {
56
- this.off.apply(this, arguments);
60
+ this.off.apply(this, arguments);
57
61
  }
58
62
 
59
63
  pick (object, keys) {
@@ -66,8 +70,8 @@ export default class Component {
66
70
  }
67
71
 
68
72
  /*
69
- listenTo(el, 'click', '.inner_class', f(), this)
70
- listenTo(el, 'click', f(), this)
73
+ listenTo(el, 'click', '.inner_class', f(), this)
74
+ listenTo(el, 'click', f(), this)
71
75
  */
72
76
  listenTo(node, event, scope, callback, context){
73
77
  // scope is optional param
@@ -82,7 +86,7 @@ export default class Component {
82
86
  event,
83
87
  function(e){
84
88
  if(!scope || (e.target.matches(scope) || e.target.closest(scope))) {
85
- return callback.bind(context)(...arguments);
89
+ return callback.bind(context)(...arguments);
86
90
  }
87
91
  }.bind(context)
88
92
  ]
@@ -18,69 +18,69 @@ import {createElement} from 'dolla';
18
18
  */
19
19
  export default class Dropdown extends Component {
20
20
 
21
- initialize (options) {
22
- this.el = options.anchor;
23
- options = options || {}
24
- this.options = {
25
- align: 'center bottom',
26
- container: document.body
27
- };
28
- Object.assign(this.options, this.pick(options, Object.keys(this.options)));
21
+ initialize (options) {
22
+ this.el = options.anchor;
23
+ options = options || {}
24
+ this.options = {
25
+ align: 'center bottom',
26
+ container: document.body
27
+ };
28
+ Object.assign(this.options, this.pick(options, Object.keys(this.options)));
29
29
 
30
- this.enabled = true;
31
- this.active = false;
32
- this.content = options.content;
33
- this.el.dropdown = this;
30
+ this.enabled = true;
31
+ this.active = false;
32
+ this.content = options.content;
33
+ this.el.dropdown = this;
34
34
 
35
- this.listenTo(this.el, 'click', this.toggle);
36
- }
35
+ this.listenTo(this.el, 'click', this.toggle);
36
+ }
37
37
 
38
- render () {
39
- return this;
40
- }
38
+ render () {
39
+ return this;
40
+ }
41
41
 
42
- toggle () {
43
- this.active = !this.active
44
- if(this.active) {
45
- this.show()
46
- } else {
47
- this.hide()
42
+ toggle () {
43
+ this.active = !this.active
44
+ if(this.active) {
45
+ this.show()
46
+ } else {
47
+ this.hide()
48
+ }
48
49
  }
49
- }
50
50
 
51
- show () {
52
- if(!this.enabled) return;
53
- this.active = true;
54
- this.el.classList.add('-active');
55
- if (this.popup) {
56
- this.popup.show()
57
- } else {
58
- this.popup = new Popover({
59
- content: this.content,
60
- anchor: this.el,
61
- align: this.options.align,
62
- container: this.options.container
63
- }).render();
64
- this.listenToOnce(this.popup, 'hidden', this.hidden)
51
+ show () {
52
+ if(!this.enabled) return;
53
+ this.active = true;
54
+ this.el.classList.add('-active');
55
+ if (this.popup) {
56
+ this.popup.show()
57
+ } else {
58
+ this.popup = new Popover({
59
+ content: this.content,
60
+ anchor: this.el,
61
+ align: this.options.align,
62
+ container: this.options.container
63
+ }).render();
64
+ this.listenToOnce(this.popup, 'hidden', this.hidden)
65
+ }
65
66
  }
66
- }
67
67
 
68
- hide () {
69
- this.popup.remove();
70
- delete this.popup;
71
- this.hidden();
72
- }
68
+ hide () {
69
+ this.popup.remove();
70
+ delete this.popup;
71
+ this.hidden();
72
+ }
73
73
 
74
- hidden () {
75
- this.active = false;
76
- this.el.classList.remove('-active');
77
- }
74
+ hidden () {
75
+ this.active = false;
76
+ this.el.classList.remove('-active');
77
+ }
78
78
 
79
- disable () {
80
- this.enabled = false;
81
- }
79
+ disable () {
80
+ this.enabled = false;
81
+ }
82
82
 
83
- enabled () {
84
- this.enabled = true;
85
- }
83
+ enabled () {
84
+ this.enabled = true;
85
+ }
86
86
  }
@@ -0,0 +1,107 @@
1
+ import Component from './component';
2
+ import { remove, append } from 'dolla';
3
+
4
+ /*
5
+ Options
6
+ ===
7
+ content: string|$el|function
8
+ el: element
9
+
10
+ */
11
+ export default class Dropzone extends Component {
12
+
13
+ enabled = true;
14
+
15
+ initialize (options) {
16
+ this.el.classList.add('uniformDropzone');
17
+ if (getComputedStyle(this.el)['position'] == "static") {
18
+ this.el.classList.add('relative');
19
+ }
20
+ if (typeof options.enabled == "boolean") {
21
+ this.enabled = options.enabled
22
+ }
23
+
24
+ this.windowDragEnter = this.windowDragEnter.bind(this)
25
+ this.windowDragLeave = this.windowDragLeave.bind(this)
26
+ this.windowDrop = this.windowDrop.bind(this)
27
+ this.el.addEventListener('drop', this.drop.bind(this))
28
+ this.el.addEventListener('dragover', this.dragOver.bind(this))
29
+ this.el.addEventListener('dragenter', this.dragEnter.bind(this))
30
+ this.el.addEventListener('dragleave', this.dragLeave.bind(this))
31
+ window.addEventListener('dragenter', this.windowDragEnter);
32
+ window.addEventListener('dragleave', this.windowDragLeave);
33
+ window.addEventListener('drop', this.windowDrop);
34
+
35
+ }
36
+
37
+ remove () {
38
+ window.removeEventListener('dragenter', this.windowDragEnter);
39
+ window.removeEventListener('dragleave', this.windowDragLeave);
40
+ window.removeEventListener('drop', this.windowDrop);
41
+ super.remove()
42
+ }
43
+
44
+ /*--------------------
45
+ This Events
46
+ --------------------*/
47
+ dragEnter (e) {
48
+ if (!this.enabled) return;
49
+ e.preventDefault();
50
+
51
+ this.el.classList.add('-active');
52
+ }
53
+
54
+ dragLeave (e) {
55
+ if (!this.enabled) return;
56
+ e.preventDefault();
57
+
58
+ // relatedTarget is what drag is going to, deals with dragging inside dropzone
59
+ if (!this.el.contains(e.relatedTarget)) {
60
+ this.el.classList.remove('-active');
61
+ }
62
+ }
63
+
64
+ drop (e) {
65
+ if (!this.enabled) return;
66
+ e.preventDefault();
67
+ ([...e.dataTransfer.files]).forEach(file => {
68
+ this.trigger('drop', file)
69
+ });
70
+ }
71
+
72
+ // Enables Dropzone
73
+ dragOver (e) {
74
+ if (!this.enabled) return;
75
+ e.preventDefault();
76
+ }
77
+
78
+
79
+ /*--------------------
80
+ Window Events
81
+ --------------------*/
82
+ windowDragEnter (e) {
83
+ if (!this.enabled) return;
84
+ e.preventDefault();
85
+
86
+ // Meaning it came from not in window
87
+ if (!e.relatedTarget) {
88
+ this.el.classList.add('-show')
89
+ }
90
+ }
91
+
92
+ windowDragLeave (e) {
93
+ if (!this.enabled) return;
94
+ e.preventDefault();
95
+
96
+ // Meaning it came from not in window
97
+ if (!e.relatedTarget) {
98
+ this.el.classList.remove('-show')
99
+ }
100
+ }
101
+
102
+ windowDrop (e) {
103
+ if (!this.enabled) return;
104
+ e.preventDefault();
105
+ this.el.classList.remove('-show')
106
+ }
107
+ }
@@ -5,15 +5,15 @@ export default class FloatingLabel extends Component {
5
5
 
6
6
  initialize(options){
7
7
  if(options.input instanceof Element) {
8
- this.input = options.input
8
+ this.input = options.input
9
9
  } else {
10
- this.input = createElement('input', Object.assign({}, {
11
- type: this.constructor.type
12
- }, options.input)) // TODO filter options to dolla.HTML_ATTRIBUTES
10
+ this.input = createElement('input', Object.assign({}, {
11
+ type: this.constructor.type
12
+ }, options.input)) // TODO filter options to dolla.HTML_ATTRIBUTES
13
13
  }
14
14
  this.label = createElement('label', {
15
- for: this.input.id,
16
- children: [options.label]
15
+ for: this.input.id,
16
+ children: [options.label]
17
17
  });
18
18
  this.input.setAttribute('aria-label', options.label);
19
19
 
@@ -47,7 +47,7 @@ export default class FloatingLabel extends Component {
47
47
  this.el.append(this.label);
48
48
 
49
49
  if(this.input.value != ""){
50
- this.focus()
50
+ this.focus()
51
51
  }
52
52
 
53
53
  return this;
@@ -59,7 +59,7 @@ export default class FloatingLabel extends Component {
59
59
 
60
60
  blur (e) {
61
61
  if(this.input.value == ""){
62
- this.el.classList.remove('present');
62
+ this.el.classList.remove('present');
63
63
  }
64
64
  }
65
65
  }
@@ -45,11 +45,11 @@ export default class Modal extends Component {
45
45
 
46
46
  let next_element = document.body.children[0]
47
47
  while(next_element){
48
- const element = next_element;
49
- next_element = element.nextElementSibling;
50
- if(!element.matches('[blurrable="false"]')) {
51
- this.blur.appendChild(element)
52
- }
48
+ const element = next_element;
49
+ next_element = element.nextElementSibling;
50
+ if(!element.matches('[blurrable="false"]')) {
51
+ this.blur.appendChild(element)
52
+ }
53
53
  }
54
54
 
55
55
  document.body.classList.add('uniformModal-active');
@@ -60,15 +60,15 @@ export default class Modal extends Component {
60
60
  this.listenTo(this.overlay, 'click', this.close);
61
61
 
62
62
  const container = createElement('div', {
63
- class: 'uniformModal-container',
64
- children: this.content
63
+ class: 'uniformModal-container',
64
+ children: this.content
65
65
  });
66
66
 
67
67
  const closeButton = createElement('div', {
68
- class: 'uniformModal-close-container',
69
- children: {
70
- class: 'uniformModal-close'
71
- }
68
+ class: 'uniformModal-close-container',
69
+ children: {
70
+ class: 'uniformModal-close'
71
+ }
72
72
  });
73
73
 
74
74
  this.el.append(this.overlay);
@@ -84,7 +84,7 @@ export default class Modal extends Component {
84
84
 
85
85
  checkCloseButton (e) {
86
86
  if(e.target.classList.contains('uniformModal-close')){
87
- this.close();
87
+ this.close();
88
88
  }
89
89
  }
90
90
 
@@ -1,5 +1,5 @@
1
1
  import Component from './component';
2
- import { offset, outerWidth, outerHeight, append } from 'dolla';
2
+ import { offset, outerWidth, outerHeight, append, css } from 'dolla';
3
3
 
4
4
  /*
5
5
  Requirements
@@ -13,6 +13,7 @@ import { offset, outerWidth, outerHeight, append } from 'dolla';
13
13
  zIndex: # | default: unset
14
14
  offset: {left: 0, top: 0}
15
15
  container: element to append popover to. default: document
16
+ transition: string (reference transition classes in utilities)
16
17
  */
17
18
  export default class Popover extends Component {
18
19
  initialize (options) {
@@ -24,7 +25,8 @@ export default class Popover extends Component {
24
25
  align: 'center bottom',
25
26
  anchor: document.body,
26
27
  content: 'needs content',
27
- offset: {left: 0, top: 0}
28
+ offset: {left: 0, top: 0},
29
+ transition: false
28
30
  };
29
31
  Object.assign(this.options, this.pick(options, Object.keys(this.options)));
30
32
  this.el.removeAttribute('content');
@@ -34,11 +36,11 @@ export default class Popover extends Component {
34
36
  this.listenTo(document, 'focusin', this.checkFocus);
35
37
  this.listenTo(document, 'keyup', this.checkEscape);
36
38
  this.listenTo(window, 'resize', () => {
37
- this.resize.bind(this)()
39
+ this.resize.bind(this)()
38
40
  });
39
41
 
40
42
  if(typeof this.options.container == "string"){
41
- this.options.container = this.options.anchor.closest(this.options.container)
43
+ this.options.container = this.options.anchor.closest(this.options.container)
42
44
  }
43
45
  this.options.container = this.options.container || document.body
44
46
 
@@ -48,11 +50,21 @@ export default class Popover extends Component {
48
50
  this.showing = true;
49
51
  this.el.style.position = 'absolute';
50
52
  this.el.style.zIndex = this.options.zIndex;
51
-
52
- append(this.el, this.options.content)
53
+ this.content = document.createElement('div')
54
+ if (this.options.transition) {
55
+ this.content.classList.add(this.options.transition, '-out')
56
+ }
57
+ append(this.el, this.content)
58
+ append(this.content, this.options.content);
53
59
 
54
60
  this.options.container.appendChild(this.el);
55
61
  this.resize();
62
+
63
+ if (this.options.transition) {
64
+ this.content.classList.remove('-out')
65
+ this.transitionDuration = Math.max(...css(this.content, 'transition-duration').split(", ").map(x => parseFloat(x))) * 1000
66
+ }
67
+
56
68
  this.trigger('shown');
57
69
 
58
70
  return this;
@@ -63,37 +75,37 @@ export default class Popover extends Component {
63
75
  let bounds = this.el.getBoundingClientRect();
64
76
  const body_bounds = document.body.getBoundingClientRect();
65
77
  const window_bounds = {
66
- top: 0,
67
- bottom: window.innerHeight,
68
- left: 0,
69
- right: window.innerWidth
78
+ top: 0,
79
+ bottom: window.innerHeight,
80
+ left: 0,
81
+ right: window.innerWidth
70
82
  };
71
83
 
72
84
  var reposition = false;
73
85
  if (bounds.bottom > Math.max(body_bounds.bottom, window_bounds.bottom)) {
74
- var [leftAlign, topAlign] = this.options.align.split(" ");
75
- this.setPosition(`${leftAlign} top`);
76
- bounds = this.el.getBoundingClientRect()
77
- if(bounds.top < 0) {
78
- this.setPosition(`${leftAlign} bottom`);
79
- }
80
- bounds = this.el.getBoundingClientRect()
86
+ var [leftAlign, topAlign] = this.options.align.split(" ");
87
+ this.setPosition(`${leftAlign} top`);
88
+ bounds = this.el.getBoundingClientRect()
89
+ if(bounds.top < 0) {
90
+ this.setPosition(`${leftAlign} bottom`);
91
+ }
92
+ bounds = this.el.getBoundingClientRect()
81
93
  }
82
94
  if (bounds.top < body_bounds.top) {
83
95
  const difference = body_bounds.top - bounds.top
84
96
  if(this.el.style.top != null) this.el.style.top = parseInt(this.el.style.top) + difference + "px"
85
- if(this.el.style.bottom != null) this.el.style.bottom = parseInt(this.el.style.bottom) - difference + "px"
97
+ if(this.el.style.bottom != null) this.el.style.bottom = parseInt(this.el.style.bottom) - difference + "px"
86
98
  }
87
99
  if (bounds.left < body_bounds.left) {
88
100
  const difference = body_bounds.left - bounds.left
89
101
  if(this.el.style.left != null) this.el.style.left = parseInt(this.el.style.left) + difference + "px"
90
- if(this.el.style.right != null) this.el.style.right = parseInt(this.el.style.right) - difference + "px"
91
- bounds = this.el.getBoundingClientRect()
102
+ if(this.el.style.right != null) this.el.style.right = parseInt(this.el.style.right) - difference + "px"
103
+ bounds = this.el.getBoundingClientRect()
92
104
  }
93
105
  if (bounds.right > body_bounds.right) {
94
106
  const difference = body_bounds.right - bounds.right
95
107
  if(this.el.style.left != null) this.el.style.left = parseInt(this.el.style.left) + difference + "px"
96
- if(this.el.style.right != null) this.el.style.right = parseInt(this.el.style.right) - difference + "px"
108
+ if(this.el.style.right != null) this.el.style.right = parseInt(this.el.style.right) - difference + "px"
97
109
  }
98
110
  }
99
111
 
@@ -128,9 +140,9 @@ export default class Popover extends Component {
128
140
  if(topAlign == 'top'){
129
141
  let height = outerHeight(container);
130
142
  if(container == document.body && getComputedStyle(container)['position'] == "static"){
131
- height = window.innerHeight;
143
+ height = window.innerHeight;
132
144
  } else if (container == document.body) {
133
- height = Math.max(height, document.body.clientHeight);
145
+ height = Math.max(height, document.body.clientHeight);
134
146
  }
135
147
  position.bottom = height - anchorOffset.top;
136
148
  } else if(topAlign == 'center'){
@@ -183,31 +195,40 @@ export default class Popover extends Component {
183
195
 
184
196
  hide (options) {
185
197
  options = options || {};
186
- if(!this.showing) return;
187
- this.el.style.display = 'none';
198
+ if (!this.showing) return;
199
+
200
+ this.content.classList.add('-out')
188
201
  this.showing = false;
189
- if(options.silent !== true) {
190
- this.trigger('hidden');
191
- }
202
+ setTimeout(() => {
203
+ this.el.zIndexWas = this.el.style.zIndex
204
+ this.el.style.zIndex = '-99';
205
+ if (options.silent !== true) {
206
+ this.trigger('hidden');
207
+ }
208
+ }, this.transitionDuration || 0)
192
209
  }
193
210
 
194
211
  show () {
195
212
  if(this.showing) return;
196
- this.el.style.display = 'block';
213
+
214
+ this.el.style.zIndex = this.el.zIndexWas
215
+ this.content.classList.remove('-out');
197
216
  this.showing = true;
198
- this.trigger('shown');
217
+ setTimeout(() => {
218
+ this.trigger('shown');
219
+ }, this.transitionDuration || 0)
199
220
  }
200
221
 
201
222
  toggle(flag) {
202
223
  flag = flag || this.showing;
203
- if(flag) this.hide(); else this.show();
224
+ if (flag) this.hide(); else this.show();
204
225
  }
205
226
 
206
227
  persist() {
207
- this.persisting = true;
228
+ this.persisting = true;
208
229
  }
209
230
 
210
231
  unpersist() {
211
- this.persisting = false;
232
+ this.persisting = false;
212
233
  }
213
234
  }