material 0.7.0 → 0.7.2

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 (148) hide show
  1. package/README.md +1 -5
  2. package/dist/demo-bundle.js +2281 -2
  3. package/dist/demo-bundle.js.map +7 -1
  4. package/dist/demo.js +13 -13
  5. package/esbuild.js +22 -0
  6. package/esbuild.watch.js +25 -0
  7. package/form.js +27 -0
  8. package/index.js +59 -58
  9. package/list.js +35 -0
  10. package/package.json +8 -17
  11. package/src/appbar.js +7 -204
  12. package/src/badge.js +27 -0
  13. package/src/button.js +127 -177
  14. package/src/calendar.js +53 -55
  15. package/src/card.js +1 -3
  16. package/src/checkbox.js +5 -55
  17. package/src/component.js +0 -2
  18. package/src/container.js +0 -2
  19. package/src/datehour.js +38 -0
  20. package/src/dialog.js +104 -151
  21. package/src/divider.js +1 -3
  22. package/src/drawer.js +1 -19
  23. package/src/element/attribute.js +7 -10
  24. package/src/element/build.js +6 -7
  25. package/src/element/create.js +3 -6
  26. package/src/element/event.js +2 -2
  27. package/src/element/insert.js +6 -17
  28. package/src/element/observer.js +22 -0
  29. package/src/element/offset.js +2 -2
  30. package/src/element/style.js +12 -12
  31. package/src/element.js +2 -2
  32. package/src/field/email.js +9 -44
  33. package/src/field/image.js +17 -51
  34. package/src/{control/file.js → file.js} +15 -45
  35. package/src/form/build.js +7 -7
  36. package/src/form/controller.js +8 -8
  37. package/src/form/create.js +1 -1
  38. package/src/form/data.js +9 -9
  39. package/src/form/delete.js +1 -1
  40. package/src/form/render.js +9 -9
  41. package/src/form/set.js +1 -1
  42. package/src/form/submit.js +6 -6
  43. package/src/form/update.js +3 -3
  44. package/src/form/verify.js +6 -6
  45. package/src/form.js +9 -11
  46. package/src/icon.js +4 -6
  47. package/src/image.js +39 -106
  48. package/src/item.js +1 -3
  49. package/src/layout.js +14 -14
  50. package/src/{control/link.js → link.js} +13 -32
  51. package/src/list/build.js +10 -10
  52. package/src/list/click.js +3 -3
  53. package/src/list/collection.js +1 -1
  54. package/src/list/filter.js +11 -11
  55. package/src/list/image.js +3 -3
  56. package/src/list/render.js +15 -15
  57. package/src/list/request.js +8 -8
  58. package/src/list/search.js +12 -12
  59. package/src/list/select.js +18 -18
  60. package/src/list/status.js +1 -1
  61. package/src/list/update.js +6 -6
  62. package/src/list/virtual.js +20 -20
  63. package/src/list/virtual.new.js +5 -5
  64. package/src/list.js +29 -217
  65. package/src/loading.js +73 -0
  66. package/src/map/build.js +2 -2
  67. package/src/map/countries.js +8 -8
  68. package/src/map/display.js +13 -13
  69. package/src/map/focus.js +7 -7
  70. package/src/map/select.js +2 -2
  71. package/src/map/set.js +3 -3
  72. package/src/map/viewport.js +11 -11
  73. package/src/menu.js +59 -115
  74. package/src/mixin/control.js +3 -3
  75. package/src/mixin/controller.js +5 -5
  76. package/src/mixin/create.js +1 -1
  77. package/src/mixin/display.js +1 -2
  78. package/src/mixin/events.js +4 -16
  79. package/src/mixin/focus.js +1 -1
  80. package/src/mixin/icon.js +2 -2
  81. package/src/mixin/init.js +2 -2
  82. package/src/mixin/insert.js +7 -29
  83. package/src/mixin/label.js +2 -2
  84. package/src/mixin/settings.js +5 -5
  85. package/src/module/attach.js +35 -49
  86. package/src/{control/module → module}/attributes.js +4 -4
  87. package/src/module/build.js +12 -12
  88. package/src/module/classify.js +4 -4
  89. package/src/module/controller.js +5 -32
  90. package/src/module/css.js +12 -84
  91. package/src/module/dataset.js +1 -1
  92. package/src/module/dom.js +8 -3
  93. package/src/module/dot.js +4 -4
  94. package/src/module/emitter.js +1 -1
  95. package/src/module/event.js +2 -2
  96. package/src/module/events.js +29 -35
  97. package/src/module/extract.js +10 -10
  98. package/src/module/last.js +18 -0
  99. package/src/module/mediator.js +1 -13
  100. package/src/module/object.js +4 -4
  101. package/src/module/observer.js +43 -16
  102. package/src/module/remove.js +10 -10
  103. package/src/module/ripple.js +19 -24
  104. package/src/module/scrollbar.js +10 -14
  105. package/src/module/smoothscroll.js +5 -9
  106. package/src/module/utils.js +14 -23
  107. package/src/module/viewport.js +5 -5
  108. package/src/navigation.js +19 -0
  109. package/src/progress.js +1 -11
  110. package/src/search.js +66 -0
  111. package/src/select.js +58 -273
  112. package/src/{control/selecter.js → selecter.js} +42 -42
  113. package/src/selector.js +3 -3
  114. package/src/skin/material/component/navigation.sass +9 -0
  115. package/src/skin/material/control/button.sass +10 -0
  116. package/src/slider.js +1 -3
  117. package/src/snackbar.js +72 -50
  118. package/src/switch.js +111 -103
  119. package/src/{control/switcher.js → switcher.js} +28 -31
  120. package/src/tabs.js +4 -5
  121. package/src/tabview.js +26 -46
  122. package/src/text.js +25 -74
  123. package/src/textfield.js +97 -234
  124. package/src/toolbar.js +12 -12
  125. package/src/tooltip.js +7 -7
  126. package/src/tree.js +10 -66
  127. package/src/view/build.js +2 -2
  128. package/src/view/dataset.js +1 -1
  129. package/src/view.js +9 -74
  130. package/rollup.config.js +0 -34
  131. package/src/banner.js +0 -231
  132. package/src/control/button.js +0 -239
  133. package/src/control/button.new.js +0 -190
  134. package/src/control/datehour.js +0 -65
  135. package/src/control/dialog.js +0 -175
  136. package/src/control/image.js +0 -92
  137. package/src/control/list.js +0 -67
  138. package/src/control/loading.js +0 -128
  139. package/src/control/menu.js +0 -85
  140. package/src/control/module/addclass.js +0 -16
  141. package/src/control/search.js +0 -98
  142. package/src/control/select.js +0 -130
  143. package/src/control/snackbar.js +0 -91
  144. package/src/control/switch.js +0 -272
  145. package/src/control/text.js +0 -70
  146. package/src/control/textfield.js +0 -177
  147. package/src/element/ripple.js +0 -90
  148. package/src/tabs/setup.js +0 -0
package/src/snackbar.js CHANGED
@@ -1,69 +1,91 @@
1
- 'use strict'
2
-
3
- // import modules
4
- import init from './mixin/init'
5
- import create from './element/create'
6
- import insert from './mixin/insert'
7
- import classify from './module/classify'
8
- // import components
9
- import Layout from './layout'
10
-
11
- let defaults = {
12
- prefix: 'material',
13
- class: 'snackbar',
14
- delay: 2000,
15
- theme: 'dark'
16
- }
1
+ // base class
2
+ import EventEmitter from './mixin/emitter'
3
+ // related modules
4
+ import build from './module/build'
5
+ import bindEvents from './module/events'
6
+ import display from './mixin/display'
7
+ // ui element
8
+ import Text from './text'
9
+ import Button from './button'
10
+
11
+ class Snackbar extends EventEmitter {
12
+ static defaults = {
13
+ class: 'snackbar',
14
+ transition: 225,
15
+ duration: 4000,
16
+ close: false,
17
+ layout: [
18
+ [Text, 'text', { tag: 'span', class: 'text' }],
19
+ [Button, 'action', { class: 'action', type: 'link' }],
20
+ [Button, 'close', { class: 'close', type: 'action' }]
21
+ ],
22
+ events: [
23
+ ['ui.action.click', 'action'],
24
+ ['ui.close.click', 'destroy']
25
+ ]
26
+ }
17
27
 
18
- class Snackbar {
19
- /**
20
- * Constructor
21
- * @param {Object} options - Component options
22
- * @return {Object} Class instance
23
- */
24
28
  constructor (options) {
25
- this.options = Object.assign({}, defaults, options || {})
29
+ super()
26
30
 
27
- this.init()
28
- this.build()
31
+ this.init(options)
32
+ this.build(this.constructor)
33
+ this.render()
34
+ this.bindEvents()
29
35
  this.show()
36
+
37
+ if (this.options.duration) {
38
+ setTimeout(() => {
39
+ this.destroy()
40
+ }, this.options.duration)
41
+ }
30
42
  }
31
43
 
32
- init () {
33
- Object.assign(this, insert)
44
+ init (options) {
45
+ this.options = Object.assign({}, Snackbar.defaults, options || {})
46
+ Object.assign(this, build, bindEvents, display)
47
+
48
+ this.buildSnackbarContainer(this.options.container)
34
49
  }
35
50
 
36
- /**
37
- * build the component using the super method
38
- * @return {Object} The class instance
39
- */
40
- build () {
41
- var tag = this.options.tag || 'div'
51
+ buildSnackbarContainer (container = document.body) {
52
+ // console.log('buildSnackbarContainer', container)
42
53
 
43
- this.element = create(tag)
44
- classify(this.element, this.options)
54
+ const snackbarContainer = container.querySelector('.snackbars')
45
55
 
46
- this.layout = new Layout(this.options.layout, this.element)
56
+ // console.log('snackbarContainer', snackbarContainer)
57
+
58
+ if (!snackbarContainer) {
59
+ this.options.container = document.createElement('div')
60
+ this.options.container.classList.add('snackbars')
61
+ container.appendChild(this.options.container)
62
+ } else {
63
+ this.options.container = snackbarContainer
64
+ }
47
65
  }
48
66
 
49
- /**
50
- *
51
- * @return {[type]} [description]
52
- */
53
- show () {
54
- setTimeout(() => {
55
- this.element.classList.add('show')
56
- }, 10)
67
+ render () {
68
+ this.ui.text.set(this.options.text)
57
69
 
58
- if (this.options.delay) {
59
- setTimeout(() => {
60
- this.hide()
61
- }, this.options.delay)
70
+ if (this.options.action) {
71
+ this.ui.action.set(this.options.action)
72
+ this.ui.action.element.classList.add('show')
62
73
  }
74
+
75
+ if (this.options.close) this.ui.close.element.classList.add('show')
76
+
77
+ return this
78
+ }
79
+
80
+ action () {
81
+ // console.log('action')
82
+ this.emit('action')
83
+ this.destroy()
63
84
  }
64
85
 
65
- hide () {
66
- this.element.classList.remove('show')
86
+ close () {
87
+ // console.log('close')
88
+ this.destroy()
67
89
  }
68
90
  }
69
91
 
package/src/switch.js CHANGED
@@ -1,106 +1,125 @@
1
- 'use strict'
1
+ import EventEmitter from './mixin/emitter'
2
2
 
3
- // import control from '../control';
4
- // import control from './mixin/control'
5
- import build from './element/build'
6
- import emitter from './module/emitter'
7
- import insert from './mixin/insert'
3
+ // module
4
+ import build from './module/build'
5
+ import dataset from './module/dataset'
8
6
  import attach from './module/attach'
9
- import classify from './module/classify'
10
-
11
- let defaults = {
12
- prefix: 'material',
13
- class: 'switch',
14
- type: 'control',
15
- label: null,
16
- checked: false,
17
- error: false,
18
- value: false,
19
- disabled: false,
20
- build: ['$root.material-switch', {},
21
- ['input$input$switch-input', { type: 'checkbox' }],
22
- ['span$control.switch-control', {},
23
- ['span$track.switch-track', {},
24
- ['span$knob.switch-knob', {}]
7
+ import attributes from './module/attributes'
8
+
9
+ // ui
10
+ import Layout from './layout'
11
+ import Element from './element'
12
+
13
+ class Switch extends EventEmitter {
14
+ static defaults = {
15
+ class: 'switch',
16
+ attributes: ['type', 'name', 'required', 'checked'],
17
+ layout: [
18
+ [Element, 'input', { class: 'input', type: 'checkbox' }],
19
+ [Element, 'control', { class: 'control' },
20
+ [Element, 'track', { class: 'track' },
21
+ [Element, 'knob', { class: 'knob' }]
22
+ ]
25
23
  ]
26
24
  ],
27
- ['label$label.switch-label']
28
- ],
29
- events: [
30
- ['element.control.click', 'toggle'],
31
- // ['element.label.click', 'toggle'],
32
- // for accessibility purpose
33
- ['element.input.click', 'toggle'],
34
- ['element.input.focus', 'focus'],
35
- ['element.input.blur', 'blur']
36
- // ['element.input.keydown', 'keydown']
37
- ]
38
- }
25
+ events: [
26
+ ['ui.control.click', 'toggle'],
27
+ // ['ui.label.click', 'toggle'],
28
+ // for accessibility purpose
29
+ ['ui.input.click', 'toggle'],
30
+ ['ui.input.focus', 'focus'],
31
+ ['ui.input.blur', 'blur']
32
+ ]
33
+ }
39
34
 
40
- /**
41
- * Switch class
42
- * @class
43
- * @extends Control
44
- */
45
- class Switch {
46
- /**
47
- * Constructor
48
- * @param {Object} options
49
- - Component options
50
- * @return {Object} Class instance
51
- */
52
35
  constructor (options) {
36
+ super()
37
+
53
38
  this.init(options)
54
39
  this.build()
40
+ this.setup()
55
41
  this.attach()
56
-
57
- return this
58
42
  }
59
43
 
60
- /**
61
- * Constructor
62
- * @param {Object} options The class options
63
- * @return {Object} This class instance
64
- */
65
44
  init (options) {
66
- this.options = Object.assign({}, defaults, options || {})
67
- Object.assign(this, emitter, attach, insert)
45
+ this.options = Object.assign({}, Switch.defaults, options || {})
46
+ Object.assign(this, build, attach, dataset)
68
47
 
69
48
  this.value = this.options.value
70
-
71
- return this
72
49
  }
73
50
 
74
- /**
75
- * build method
76
- * @return {Object} The class instance
77
- */
78
- build () {
79
- this.element = build(this.options.build)
80
- this.element = this.element.root
51
+ setup () {
52
+ this.styleAttributes()
81
53
 
82
- classify(this.element, this.options)
54
+ this.buildIcon()
55
+ this.buildLabel()
83
56
 
84
- if (this.options.disabled) {
85
- this.disable()
57
+ if (this.options.data) {
58
+ dataset(this.element, this.options.data)
59
+ }
60
+
61
+ // console.log('attribute', this.ui.input, this.options)
62
+ attributes(this.ui.input, this.options)
63
+
64
+ if (this.options.checked) {
65
+ this.check(true)
86
66
  }
87
67
 
88
68
  if (this.value) {
89
69
  this.element.input.setAttribute('checked', 'checked')
90
70
  }
91
71
 
92
- this.element.input.setAttribute('aria-label', this.options.name)
72
+ if (this.options.tooltip) {
73
+ this.element.setAttribute('data-tooltip', this.options.tooltip)
74
+ }
93
75
 
94
- let text = this.options.label || this.options.text || ''
76
+ this.ui.input.setAttribute('aria-label', this.options.name)
95
77
 
96
- this.element.label.textContent = text
97
- this.element.label.setAttribute('for', this.options.name)
98
- if (this.options.checked) {
99
- this.check(true)
78
+ if (this.options.case) {
79
+ this.element.classList.add(this.options.case + '-case')
100
80
  }
81
+ }
82
+
83
+ buildLabel () {
84
+ // console.log('buildLabel', this.options.label)
85
+ if (!this.options.label) return
101
86
 
102
- if (this.options.container) {
103
- this.insert(this.options.container)
87
+ this.ui.label = document.createElement('label')
88
+ this.ui.label.classList.add('label')
89
+ this.ui.label.innerHTML = this.options.label
90
+
91
+ if (this.options.name) {
92
+ this.ui.label.setAttribute('for', this.options.name)
93
+ }
94
+
95
+ this.element.insertBefore(this.ui.label, this.ui.input)
96
+ }
97
+
98
+ buildIcon () {
99
+ if (!this.options.icon) return
100
+
101
+ this.ui.icon = document.createElement('i')
102
+ this.ui.icon.classList.add('icon')
103
+ this.ui.icon.innerHTML = this.options.icon
104
+
105
+ this.element.insertBefore(this.ui.icon, this.ui.input)
106
+ }
107
+
108
+ styleAttributes () {
109
+ if (this.options.style) {
110
+ this.element.classList.add('style-' + this.options.style)
111
+ }
112
+
113
+ if (this.options.size) {
114
+ this.element.classList.add(this.options.size + '-size')
115
+ }
116
+
117
+ if (this.options.color) {
118
+ this.element.classList.add('color-' + this.options.color)
119
+ }
120
+
121
+ if (this.options.bold) {
122
+ this.element.classList.add('bold')
104
123
  }
105
124
  }
106
125
 
@@ -115,6 +134,9 @@ class Switch {
115
134
  case 'value':
116
135
  this.setValue(value, silent)
117
136
  break
137
+ case 'text':
138
+ this.setValue(value)
139
+ break
118
140
  case 'disabled':
119
141
  if (value === true) {
120
142
  this.disable()
@@ -129,31 +151,29 @@ class Switch {
129
151
  return this
130
152
  }
131
153
 
154
+ setLabel (value) {
155
+ // console.log('setLabel', value)
156
+ if (this.ui.label) {
157
+ this.ui.label.innerHTML = value
158
+ }
159
+ }
160
+
161
+ setText (value) {
162
+ this.setLabel(value)
163
+ }
164
+
132
165
  get () {
133
166
  return this.value
134
167
  }
135
168
 
136
- /**
137
- * set switch value
138
- * @param {boolean} value [description]
139
- */
140
169
  getValue () {
141
170
  return this.value
142
171
  }
143
172
 
144
- /**
145
- * set switch value
146
- * @param {boolean} value [description]
147
- */
148
173
  setValue (value, silent) {
149
- // console.log('setValue', value)
150
174
  this.check(value, silent)
151
175
  }
152
176
 
153
- /**
154
- * [toggle description]
155
- * @return {Object} The class instance
156
- */
157
177
  toggle () {
158
178
  if (this.disabled) return
159
179
 
@@ -168,15 +188,11 @@ class Switch {
168
188
  return this
169
189
  }
170
190
 
171
- /**
172
- * Set checkbox value
173
- * @param {boolean} value [description]
174
- */
175
191
  check (checked, silent) {
176
192
  // console.log('check', checked, silent)
177
193
  if (checked === true) {
178
194
  this.element.classList.add('is-checked')
179
- this.element.input.checked = true
195
+ this.ui.input.checked = true
180
196
  this.checked = true
181
197
  this.value = true
182
198
  if (!silent) {
@@ -184,7 +200,7 @@ class Switch {
184
200
  }
185
201
  } else {
186
202
  this.element.classList.remove('is-checked')
187
- this.element.input.checked = false
203
+ this.ui.input.checked = false
188
204
  this.checked = false
189
205
  this.value = false
190
206
  if (!silent) {
@@ -194,22 +210,14 @@ class Switch {
194
210
  return this
195
211
  }
196
212
 
197
- /**
198
- * [_onInputFocus description]
199
- * @return {?} [description]
200
- */
201
213
  focus () {
202
214
  if (this.disabled === true) return this
203
215
 
204
216
  this.element.classList.add('is-focused')
205
- if (this.element.input !== document.activeElement) { this.element.input.focus() }
217
+ if (this.ui.input !== document.activeElement) { this.ui.input.focus() }
206
218
  return this
207
219
  }
208
220
 
209
- /**
210
- * [_onInputBlur description]
211
- * @return {?} [description]
212
- */
213
221
  blur () {
214
222
  this.element.classList.remove('is-focused')
215
223
  return this
@@ -1,32 +1,29 @@
1
- import emitter from '../module/emitter'
2
-
3
- const defaults = {
4
- class: 'switcher',
5
- tag: 'div',
6
- list: [],
7
- first: false,
8
- mode: 'unique',
9
- allowEmpty: false
10
- }
1
+ import EventEmitter from './mixin/emitter'
2
+
3
+ class Switcher extends EventEmitter {
4
+ static defaults = {
5
+ class: 'switcher',
6
+ tag: 'div',
7
+ list: [],
8
+ first: false,
9
+ mode: 'unique',
10
+ allowEmpty: false
11
+ }
11
12
 
12
- class Switcher {
13
- /**
14
- * Constructor
15
- * @param {Object} options - Component options
16
- * @return {Object} Class instance
17
- */
18
13
  constructor (options) {
19
- this.options = Object.assign({}, defaults, options || {})
20
- Object.assign(this, emitter)
14
+ super()
21
15
 
16
+ this.init(options)
22
17
  this.build()
23
18
  this.attach()
24
19
 
25
20
  if (this.options.default) {
26
21
  this.selectByName(this.options.default, true)
27
22
  }
23
+ }
28
24
 
29
- return this
25
+ init (options) {
26
+ this.options = Object.assign({}, Switcher.defaults, options || {})
30
27
  }
31
28
 
32
29
  build () {
@@ -88,8 +85,8 @@ class Switcher {
88
85
  if (item) {
89
86
  item.classList.add('preselected')
90
87
  } else {
91
- var items = this.list.childNodes
92
- for (var i = 0; i < items.length; i++) {
88
+ const items = this.list.childNodes
89
+ for (let i = 0; i < items.length; i++) {
93
90
  items[i].classList.remove('preselected')
94
91
  }
95
92
  }
@@ -97,7 +94,7 @@ class Switcher {
97
94
 
98
95
  selectByName (name) {
99
96
  // console.log('selectByName', name)
100
- var item = this.element.querySelector('[data-switcher="' + name + '"]')
97
+ const item = this.element.querySelector('[data-switcher="' + name + '"]')
101
98
  // console.log('item', item)
102
99
  if (item) {
103
100
  this.select(item)
@@ -106,7 +103,7 @@ class Switcher {
106
103
 
107
104
  preSelectByName (name) {
108
105
  // console.log('selectByName', name)
109
- var item = this.element.querySelector('[data-switcher="' + name + '"]')
106
+ const item = this.element.querySelector('[data-switcher="' + name + '"]')
110
107
  // console.log('item', item)
111
108
  this.preselect(item)
112
109
  }
@@ -114,9 +111,9 @@ class Switcher {
114
111
  unique (option) {
115
112
  // console.log('option', option)
116
113
  if (!option.classList.contains('selected')) {
117
- var options = this.list.childNodes
114
+ const options = this.list.childNodes
118
115
 
119
- for (var i = 0; i < options.length; i++) {
116
+ for (let i = 0; i < options.length; i++) {
120
117
  options[i].classList.remove('selected')
121
118
  }
122
119
 
@@ -135,7 +132,7 @@ class Switcher {
135
132
  multiple (option) {
136
133
  if (option.classList.contains('selected')) {
137
134
  if (this.selected.length === 1) return
138
- var i = this.selected.indexOf(option.dataset.switcher)
135
+ const i = this.selected.indexOf(option.dataset.switcher)
139
136
  this.selected.splice(i, 1)
140
137
  option.classList.remove('selected')
141
138
  } else {
@@ -166,7 +163,7 @@ class Switcher {
166
163
 
167
164
  setValue (value) {
168
165
  // console.log('value', value, this.options.list, this.element)
169
- var list = this.options.list
166
+ const list = this.options.list
170
167
  if (this.options.mode === 'unique') {
171
168
  for (var i = 0; i < list.length; i++) {
172
169
  this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
@@ -193,7 +190,7 @@ class Switcher {
193
190
 
194
191
  if (!list) return
195
192
 
196
- for (var i = 0; i < list.length; i++) {
193
+ for (let i = 0; i < list.length; i++) {
197
194
  this.addOption(list[i])
198
195
  }
199
196
  }
@@ -205,19 +202,19 @@ class Switcher {
205
202
 
206
203
  if (this.options.list.length < 1) this.options.list = list
207
204
 
208
- for (var i = 0; i < list.length; i++) {
205
+ for (let i = 0; i < list.length; i++) {
209
206
  this.addOption(list[i])
210
207
  }
211
208
  }
212
209
 
213
210
  addOption (value) {
214
211
  // console.log('addOption', value)
215
- var item = document.createElement('li')
212
+ const item = document.createElement('li')
216
213
  item.classList.add('item')
217
214
  item.dataset.switcher = value
218
215
  item.innerHTML = value
219
216
  this.list.appendChild(item)
220
- // this.options.list.push(list[i])
217
+ // this.options.list.push(list[i])
221
218
  }
222
219
 
223
220
  setLabel (value) {
package/src/tabs.js CHANGED
@@ -48,7 +48,6 @@ class Tabs {
48
48
  this.tab = { }
49
49
  if (this.options.list) {
50
50
  this.list = new List({
51
- // root: this.element,
52
51
  tag: 'div',
53
52
  list: this.options.list,
54
53
  target: '.material-button',
@@ -56,7 +55,7 @@ class Tabs {
56
55
  label: 'Flat',
57
56
 
58
57
  render: (info) => {
59
- var item
58
+ let item
60
59
  if (info.type === 'divider') {
61
60
  item = new Divider()
62
61
  } else {
@@ -91,13 +90,13 @@ class Tabs {
91
90
  select (tab) {
92
91
  // console.log('select', tab, this.tab)
93
92
  this.selected = this.tab[tab]
94
- this.click(this.selected.root, true)
93
+ this.click(this.selected.element, true)
95
94
  }
96
95
 
97
96
  click (item, silent) {
98
97
  // console.log('clickitem', item, this.element);
99
- var or = offset(this.element)
100
- var o = offset(item)
98
+ const or = offset(this.element)
99
+ const o = offset(item)
101
100
  this.indicator.setAttribute('style', 'width: ' + o.width + 'px; left: ' + (o.left - or.left) + 'px;')
102
101
 
103
102
  if (!silent) { this.emit('select', item.dataset.name) }