wave-ui 2.43.2 → 2.45.0

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.
@@ -33,8 +33,13 @@ component(
33
33
  :class="inputClasses")
34
34
  .w-switch__track(v-if="$slots.track")
35
35
  slot(name="track")
36
- .w-switch__thumb(v-if="$slots.thumb")
37
- slot(name="thumb")
36
+ .w-switch__thumb(v-if="$slots.thumb || loading")
37
+ w-progress(
38
+ v-if="loading"
39
+ circle
40
+ color="inherit"
41
+ v-bind="typeof loading === 'number' ? { 'model-value': loading } : {}")
42
+ slot(v-else name="thumb")
38
43
  template(v-if="hasLabel && !labelOnLeft")
39
44
  label.w-switch__label.w-switch__label--right.w-form-el-shakable(
40
45
  v-if="$slots.default || label"
@@ -57,7 +62,8 @@ export default {
57
62
  color: { type: String, default: 'primary' },
58
63
  labelColor: { type: String, default: 'primary' },
59
64
  thin: { type: Boolean },
60
- noRipple: { type: Boolean }
65
+ noRipple: { type: Boolean },
66
+ loading: { type: [Boolean, Number], default: false }
61
67
  // Props from mixin: name, disabled, readonly, required, tabindex, validators.
62
68
  // Computed from mixin: inputName, isDisabled & isReadonly.
63
69
  },
@@ -88,6 +94,7 @@ export default {
88
94
  'w-switch--ripple': this.ripple.start,
89
95
  'w-switch--custom-thumb': this.$slots.thumb,
90
96
  'w-switch--custom-track': this.$slots.track,
97
+ 'w-switch--loading': this.loading,
91
98
  'w-switch--rippled': this.ripple.end
92
99
  }
93
100
  },
@@ -142,6 +149,7 @@ $disabled-color: #ddd;
142
149
  vertical-align: middle;
143
150
  cursor: pointer;
144
151
 
152
+ &--loading {cursor: wait;}
145
153
  &--disabled, &--readonly {
146
154
  cursor: not-allowed;
147
155
  touch-action: initial;
@@ -234,7 +242,9 @@ $disabled-color: #ddd;
234
242
  background-color: currentColor;
235
243
  }
236
244
  }
237
- &--custom-thumb &__input:after {display: none;}
245
+ &--loading .w-progress {padding: 1px;}
246
+ &--loading.w-switch--thin.w-switch--on .w-progress {color: #fff;}
247
+ &--loading &__input:after, &--custom-thumb &__input:after {display: none;}
238
248
  &__thumb > * {
239
249
  width: inherit;
240
250
  height: inherit;
@@ -247,7 +257,7 @@ $disabled-color: #ddd;
247
257
  left: 0;
248
258
  top: 0;
249
259
  width: $small-form-el-size;
250
- height: $small-form-el-size;
260
+ aspect-ratio: 1;
251
261
  background-color: currentColor;
252
262
  border-radius: 100%;
253
263
  opacity: 0;
@@ -179,8 +179,10 @@ export default {
179
179
 
180
180
  if (!this.fillBar && this.activeTabEl) {
181
181
  const { left, width } = this.activeTabEl.getBoundingClientRect()
182
- const { left: parentLeft } = this.activeTabEl.parentNode.getBoundingClientRect()
183
- this.slider.left = `${left - parentLeft + this.activeTabEl.parentNode.scrollLeft}px`
182
+ const tabsBar = this.activeTabEl.parentNode
183
+ const { left: parentLeft } = tabsBar.getBoundingClientRect()
184
+ const { borderLeftWidth } = getComputedStyle(tabsBar)
185
+ this.slider.left = `${left - parentLeft - parseInt(borderLeftWidth) + tabsBar.scrollLeft}px`
184
186
  this.slider.width = `${width}px`
185
187
  }
186
188
  else {
@@ -52,7 +52,7 @@ export default {
52
52
  border-radius: 1em;
53
53
  border: 1px solid currentColor;
54
54
  width: $base-font-size;
55
- height: $base-font-size;
55
+ aspect-ratio: 1;
56
56
  transform: translateX(-50%);
57
57
  z-index: 1;
58
58
  }
@@ -48,7 +48,8 @@ export default class WaveUI {
48
48
  // if (directives[id]) app.directive(id, directives[id])
49
49
  // }
50
50
  app.directive('focus', {
51
- mounted: el => el.focus()
51
+ // Wait for the next tick to focus the newly mounted element.
52
+ mounted: el => setTimeout(() => el.focus(), 0)
52
53
  })
53
54
  app.directive('scroll', {
54
55
  mounted: (el, binding) => {