wave-ui 1.45.4 → 1.45.9

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": "wave-ui",
3
- "version": "1.45.4",
3
+ "version": "1.45.9",
4
4
  "description": "An emerging UI framework for Vue.js & Vue 3 with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "main": "./dist/wave-ui.umd.js",
@@ -19,7 +19,8 @@
19
19
  :tabindex="-1"
20
20
  text
21
21
  @keypress.stop
22
- @click.stop="!item._disabled && toggleItem(item, $event)")
22
+ @click.stop="!item._disabled && toggleItem(item, $event)"
23
+ :class="{ 'w-accordion__expand-icon--expanded': item._expanded }")
23
24
  //- Title.
24
25
  slot(
25
26
  v-if="$scopedSlots[`item-title.${item.id || i + 1}`]"
@@ -34,7 +35,8 @@
34
35
  :icon="(item._expanded && collapseIcon) || expandIcon"
35
36
  text
36
37
  @keypress.stop
37
- @click.stop="!item._disabled && toggleItem(item, $event)")
38
+ @click.stop="!item._disabled && toggleItem(item, $event)"
39
+ :class="{ 'w-accordion__expand-icon--expanded': item._expanded }")
38
40
  //- Content.
39
41
  w-transition-expand(y)
40
42
  .w-accordion__item-content(v-if="item._expanded" :class="contentClass")
@@ -76,6 +78,7 @@ export default {
76
78
  computed: {
77
79
  accordionItems () {
78
80
  const items = typeof this.items === 'number' ? Array(this.items).fill({}) : this.items || []
81
+ // eslint-disable-next-line new-cap
79
82
  return items.map((item, _index) => new Vue.observable({
80
83
  ...item,
81
84
  _index,
@@ -148,8 +151,8 @@ export default {
148
151
  margin-right: $base-increment;
149
152
 
150
153
  .w-accordion--rotate-icon & {@include default-transition;}
151
- .w-accordion--rotate-icon .w-accordion__item--expanded & {transform: rotate(-180deg);}
152
- .w-accordion--rotate-icon.w-accordion--icon-right .w-accordion__item--expanded & {transform: rotate(180deg);}
154
+ &--expanded {transform: rotate(-180deg);}
155
+ .w-accordion--icon-right &--expanded {transform: rotate(180deg);}
153
156
 
154
157
  .w-icon:before {font-size: 1.1em;}
155
158
  }
@@ -40,7 +40,7 @@ export default {
40
40
  classes () {
41
41
  return {
42
42
  'd-block': this.block,
43
- 'row': this.row,
43
+ row: this.row,
44
44
  'align-center': this.alignCenter,
45
45
  'align-end': this.alignEnd,
46
46
  'justify-center': this.justifyCenter,
@@ -26,6 +26,7 @@ export default {
26
26
  justifyEnd: { type: Boolean },
27
27
  justifySpaceBetween: { type: Boolean },
28
28
  justifySpaceAround: { type: Boolean },
29
+ justifySpaceEvenly: { type: Boolean },
29
30
  basisZero: { type: Boolean },
30
31
  gap: { type: Number, default: 0 }
31
32
  },
@@ -48,6 +49,7 @@ export default {
48
49
  'justify-end': this.justifyEnd,
49
50
  'justify-space-between': this.justifySpaceBetween,
50
51
  'justify-space-around': this.justifySpaceAround,
52
+ 'justify-space-evenly': this.justifySpaceEvenly,
51
53
  'basis-zero': this.basisZero,
52
54
  [`w-flex--gap${this.gap}`]: this.gap
53
55
  }
@@ -23,8 +23,10 @@ component(
23
23
  tag="label"
24
24
  :for="`w-input--${_uid}`"
25
25
  @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
26
+ //- All types of input except file.
26
27
  input.w-input__input(
27
28
  v-if="type !== 'file'"
29
+ ref="input"
28
30
  v-model="inputValue"
29
31
  v-on="listeners"
30
32
  @input="onInput"
@@ -45,8 +47,10 @@ component(
45
47
  :required="required || null"
46
48
  :tabindex="tabindex || null"
47
49
  v-bind="attrs")
48
- template(v-if="type === 'file'")
50
+ //- Input type file.
51
+ template(v-else)
49
52
  input(
53
+ ref="input"
50
54
  :id="`w-input--${_uid}`"
51
55
  type="file"
52
56
  :name="name || null"
@@ -148,7 +152,8 @@ export default {
148
152
  inputNumberError: false,
149
153
  isFocused: false,
150
154
  inputFiles: [], // For input type file.
151
- fileReader: null // For input type file.
155
+ fileReader: null, // For input type file.
156
+ isAutofilled: false
152
157
  }
153
158
  },
154
159
 
@@ -169,7 +174,8 @@ export default {
169
174
 
170
175
  hasValue () {
171
176
  return (
172
- this.inputValue !== undefined ||
177
+ this.inputValue ||
178
+ this.inputValue === 0 ||
173
179
  ['date', 'time'].includes(this.type) ||
174
180
  (this.type === 'number' && this.inputNumberError) ||
175
181
  (this.type === 'file' && this.inputFiles.length)
@@ -190,7 +196,7 @@ export default {
190
196
  'w-input--file': this.type === 'file',
191
197
  'w-input--disabled': this.isDisabled,
192
198
  'w-input--readonly': this.isReadonly,
193
- [`w-input--${this.hasValue ? 'filled' : 'empty'}`]: true,
199
+ [`w-input--${this.hasValue || this.isAutofilled ? 'filled' : 'empty'}`]: true,
194
200
  'w-input--focused': this.isFocused && !this.isReadonly,
195
201
  'w-input--dark': this.dark,
196
202
  'w-input--floating-label': this.hasLabel && this.labelPosition === 'inside' && !this.staticLabel,
@@ -272,7 +278,6 @@ export default {
272
278
  reader.addEventListener('progress', event => {
273
279
  if (event.loaded && event.total) {
274
280
  this.$set(file, 'progress', event.loaded * 100 / event.total)
275
- console.log(`Progress: ${Math.round(file.progress)}`)
276
281
  }
277
282
  })
278
283
 
@@ -280,9 +285,18 @@ export default {
280
285
  }
281
286
  },
282
287
 
288
+ mounted () {
289
+ // On page load, check if the field is autofilled by the browser.
290
+ this.$nextTick(() => {
291
+ if (this.$refs.input.value) this.isAutofilled = true
292
+ })
293
+ },
294
+
283
295
  watch: {
284
296
  value (value) {
285
297
  this.inputValue = value
298
+ // When clearing the field value, also reset the isAutofilled var for the CSS class.
299
+ if (!value && value !== 0) this.isAutofilled = false
286
300
  }
287
301
  }
288
302
  }
@@ -106,6 +106,7 @@ export default {
106
106
  tabsItems () {
107
107
  const items = typeof this.items === 'number' ? Array(this.items).fill({}) : this.items
108
108
 
109
+ // eslint-disable-next-line new-cap
109
110
  return items.map((item, _index) => new Vue.observable({
110
111
  ...item,
111
112
  _index,
@@ -116,7 +116,7 @@ export default {
116
116
  return listeners
117
117
  },
118
118
  hasValue () {
119
- return this.inputValue !== undefined
119
+ return this.inputValue || this.inputValue === 0
120
120
  },
121
121
  hasLabel () {
122
122
  return this.label || this.$slots.default
@@ -6,6 +6,6 @@
6
6
  */
7
7
  export const objectifyClasses = (classes = {}) => {
8
8
  if (typeof classes === 'string') classes = { [classes]: true }
9
- else if (typeof classes === 'array') classes = { [classes.join(' ')]: true }
9
+ else if (Array.isArray(classes)) classes = { [classes.join(' ')]: true }
10
10
  return classes
11
11
  }