wave-ui 3.4.7 → 3.5.1

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": "3.4.7",
3
+ "version": "3.5.1",
4
4
  "description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -6,6 +6,8 @@ component(v-if="tooltip" is="w-tooltip" v-bind="tooltipProps || {}")
6
6
  div(v-html="tooltip")
7
7
  button-partial(v-else v-bind="buttonProps")
8
8
  slot
9
+ template(#loading)
10
+ slot(name="loading")
9
11
  </template>
10
12
 
11
13
  <script>
@@ -2,7 +2,7 @@
2
2
  component(
3
3
  ref="formEl"
4
4
  :is="formRegister && !wCheckboxes ? 'w-form-element' : 'div'"
5
- v-bind="formRegister && { validators, inputValue: isChecked, disabled: isDisabled }"
5
+ v-bind="formRegister && { validators, inputValue: isChecked, disabled: isDisabled, readonly: isReadonly }"
6
6
  v-model:valid="valid"
7
7
  @reset="$emit('update:modelValue', isChecked = null);$emit('input', null)"
8
8
  :class="classes")
@@ -12,12 +12,12 @@ component(
12
12
  type="checkbox"
13
13
  :name="inputName"
14
14
  :checked="isChecked || null"
15
- :disabled="isDisabled || null"
15
+ :disabled="isDisabled || isReadonly || null"
16
16
  :required="required || null"
17
17
  :tabindex="tabindex || null"
18
18
  @focus="$emit('focus', $event)"
19
19
  @blur="$emit('blur', $event)"
20
- @change="onInput() /* Edge doesn't fire input on checkbox/radio/select change */"
20
+ @change="onInput() /* Edge doesn't emit an `input` event on checkbox/radio/select change */"
21
21
  @keypress.enter="onInput"
22
22
  :aria-checked="isChecked || 'false'"
23
23
  role="checkbox")
@@ -98,6 +98,7 @@ export default {
98
98
  return {
99
99
  [`w-checkbox w-checkbox--${this.isChecked ? 'checked' : 'unchecked'}`]: true,
100
100
  'w-checkbox--disabled': this.isDisabled,
101
+ 'w-checkbox--readonly': this.isReadonly,
101
102
  'w-checkbox--indeterminate': this.indeterminate,
102
103
  'w-checkbox--ripple': this.ripple.start,
103
104
  'w-checkbox--rippled': this.ripple.end,
@@ -149,13 +150,10 @@ $inactive-color: #666;
149
150
  vertical-align: middle;
150
151
  // Contain the hidden radio button, so browser doesn't pan to it when outside of the screen.
151
152
  position: relative;
152
- cursor: pointer;
153
153
  -webkit-tap-highlight-color: transparent;
154
154
 
155
155
  @include themeable;
156
156
 
157
- &--disabled {cursor: not-allowed;}
158
-
159
157
  // The hidden real checkbox.
160
158
  input[type="checkbox"] {
161
159
  position: absolute;
@@ -173,8 +171,10 @@ $inactive-color: #666;
173
171
  flex: 0 0 auto; // Prevent stretching width or height.
174
172
  align-items: center;
175
173
  justify-content: center;
176
- cursor: inherit;
174
+ cursor: pointer;
177
175
  z-index: 0;
176
+
177
+ .w-checkbox--disabled & {cursor: not-allowed;}
178
178
  }
179
179
 
180
180
  // The checkmark - visible when checked.
@@ -202,6 +202,7 @@ $inactive-color: #666;
202
202
  .w-checkbox--indeterminate & {opacity: 0;}
203
203
  .w-checkbox--disabled & {stroke: rgba(var(--w-contrast-color-rgb), 0.4);}
204
204
  }
205
+
205
206
  &__input:after {
206
207
  content: '';
207
208
  position: absolute;
@@ -252,7 +253,7 @@ $inactive-color: #666;
252
253
  }
253
254
 
254
255
  :focus ~ &__input:before,
255
- :active ~ &__input:before {
256
+ &:not(.w-checkbox--disabled) :active ~ &__input:before {
256
257
  transform: scale(1.8);
257
258
  opacity: 0.2;
258
259
  }
@@ -268,10 +269,13 @@ $inactive-color: #666;
268
269
  &__label {
269
270
  display: flex;
270
271
  align-items: center;
271
- cursor: inherit;
272
+ cursor: pointer;
272
273
  user-select: none;
273
274
 
274
- .w-checkbox--disabled & {opacity: 0.7;}
275
+ .w-checkbox--disabled & {
276
+ cursor: not-allowed;
277
+ opacity: 0.7;
278
+ }
275
279
  }
276
280
  }
277
281
 
@@ -2,7 +2,7 @@
2
2
  component(
3
3
  ref="formEl"
4
4
  :is="formRegister && !wRadios ? 'w-form-element' : 'div'"
5
- v-bind="formRegister && { validators, inputValue, disabled: isDisabled }"
5
+ v-bind="formRegister && { validators, inputValue, disabled: isDisabled, readonly: isReadonly }"
6
6
  v-model:valid="valid"
7
7
  @reset="$emit('update:modelValue', inputValue = null);$emit('input', null)"
8
8
  :class="classes")
@@ -12,11 +12,11 @@ component(
12
12
  type="radio"
13
13
  :name="inputName"
14
14
  :checked="inputValue || null"
15
- :disabled="isDisabled || null"
15
+ :disabled="isDisabled || isReadonly || null"
16
16
  :required="required || null"
17
17
  :tabindex="tabindex || null"
18
18
  @focus="$emit('focus', $event)"
19
- @change="onInput($event) /* Edge doesn't fire input on checkbox/radio/select change */"
19
+ @change="onInput($event) /* Edge doesn't emit an `input` event on checkbox/radio/select change */"
20
20
  :aria-checked="inputValue || 'false'"
21
21
  role="radio")
22
22
  template(v-if="hasLabel && labelOnLeft")
@@ -89,6 +89,7 @@ export default {
89
89
  return {
90
90
  [`w-radio w-radio--${this.inputValue ? 'checked' : 'unchecked'}`]: true,
91
91
  'w-radio--disabled': this.isDisabled,
92
+ 'w-radio--readonly': this.isReadonly,
92
93
  'w-radio--ripple': this.ripple.start,
93
94
  'w-radio--rippled': this.ripple.end,
94
95
  'w-radio--dark': this.ripple.dark,
@@ -77,7 +77,7 @@ component(
77
77
  @update:model-value="onInput"
78
78
  @item-click="$emit('item-click', $event)"
79
79
  @item-select="onListItemSelect"
80
- @keydown:enter="noUnselect && !multiple && closeMenu('la3')"
80
+ @keydown:enter="noUnselect && !multiple && closeMenu()"
81
81
  @keydown:escape="showMenu && (this.showMenu = false) /* Will call closeMenu() from w-menu(@close). */"
82
82
  :items="selectItems"
83
83
  :multiple="multiple"
@@ -252,8 +252,8 @@ export default {
252
252
  // still allow meta key & ctrl key combinations and the tab key (9).
253
253
  if (!e.metaKey && !e.ctrlKey && e.keyCode !== 9) e.preventDefault()
254
254
 
255
- if (e.keyCode === 27 && this.showMenu) this.closeMenu('la5') // Escape.
256
- else if (e.keyCode === 13) this.openMenu() // Enter.
255
+ if (e.keyCode === 27 && this.showMenu) this.closeMenu() // Escape.
256
+ else if ([13, 32].includes(e.keyCode)) this.openMenu() // Enter or Space.
257
257
 
258
258
  // Up & down arrows.
259
259
  else if ([38, 40].includes(e.keyCode)) {
@@ -322,7 +322,7 @@ export default {
322
322
 
323
323
  return items.map(item => {
324
324
  let value = item
325
- if (typeof item === 'object') {
325
+ if (item && typeof item === 'object') { // `null` is also an object!
326
326
  value = item[this.itemValueKey] !== undefined ? item[this.itemValueKey] : (item[this.itemLabelKey] !== undefined ? item[this.itemLabelKey] : item)
327
327
  }
328
328