material 0.7.6 → 0.7.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/button.js CHANGED
@@ -147,6 +147,16 @@ class Button extends EventEmitter {
147
147
  this.emit('click', ev)
148
148
  }
149
149
 
150
+ select (select) {
151
+ if (select === null) {
152
+ this.element.classList.remove('selected')
153
+ this.selected = null
154
+ } else {
155
+ this.element.classList.add('selected')
156
+ this.selected = true
157
+ }
158
+ }
159
+
150
160
  mousedown (ev) {
151
161
  this.element.classList.add('pushed')
152
162
  }
@@ -50,9 +50,11 @@ export default {
50
50
 
51
51
  setTimeout(() => {
52
52
  dom.destroy(this.element)
53
+ if (this.underlay) dom.destroy(this.underlay)
53
54
  }, this.options.transition)
54
55
  } else {
55
56
  dom.destroy(this.element)
57
+ if (this.underlay) dom.destroy(this.underlay)
56
58
  }
57
59
 
58
60
  this.emit?.('destroy')
@@ -35,8 +35,8 @@ export default {
35
35
 
36
36
  this.ui = this.ui || {}
37
37
 
38
- if (this.options.label) this.buildLabel()
39
38
  if (this.options.icon) this.buildIcon()
39
+ if (this.options.label) this.buildLabel()
40
40
 
41
41
  if (this.options.show === true && this.show) this.show()
42
42
  },
package/src/snackbar.js CHANGED
@@ -17,8 +17,7 @@ class Snackbar extends EventEmitter {
17
17
  close: false,
18
18
  layout: [
19
19
  [Text, 'message', { tag: 'span', class: 'message' }],
20
- [Button, 'action', { class: 'action', type: 'link' }],
21
- [Button, 'close', { class: 'close', type: 'action' }]
20
+ [Button, 'action', { class: 'action', type: 'link' }]
22
21
  ],
23
22
  events: [
24
23
  ['ui.action.click', 'action'],
@@ -72,11 +71,11 @@ class Snackbar extends EventEmitter {
72
71
  if (this.options.action) {
73
72
  this.ui.action.set(this.options.action)
74
73
  this.ui.action.element.classList.add('show')
74
+ } else if (this.options.close) {
75
+ this.ui.action.element.classList.remove('style-link')
76
+ this.ui.action.element.classList.add('style-action')
77
+ this.ui.action.element.classList.add('close')
75
78
  }
76
-
77
- if (this.options.close) this.ui.close.element.classList.add('show')
78
-
79
- return this
80
79
  }
81
80
 
82
81
  action () {