wave-ui 1.58.0 → 1.59.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.
@@ -295,7 +295,7 @@ export default {
295
295
  transform: translateX(-50%);
296
296
  top: 0;
297
297
  width: $base-increment;
298
- height: $base-increment;
298
+ aspect-ratio: 1;
299
299
  background-color: rgba(0, 0, 0, 0.2);
300
300
  border-radius: 99em;
301
301
  // box-shadow: 0 0 0 1px #fff;
@@ -358,7 +358,7 @@ export default {
358
358
  &__thumb {
359
359
  position: absolute;
360
360
  width: 3 * $base-increment;
361
- height: 3 * $base-increment;
361
+ aspect-ratio: 1;
362
362
  left: 100%;
363
363
  top: 50%;
364
364
  transform: translate(-50%, -50%);
@@ -373,7 +373,7 @@ export default {
373
373
  left: 0;
374
374
  top: 0;
375
375
  width: 100%;
376
- height: 100%;
376
+ aspect-ratio: 1;
377
377
  border: none;
378
378
  border-radius: 99em;
379
379
  cursor: pointer;
@@ -452,7 +452,7 @@ export default {
452
452
  transform: translateX(-50%) rotate(-45deg);
453
453
  border-radius: 99em 99em 99em 0;
454
454
  width: 2.8em;
455
- height: 2.8em;
455
+ aspect-ratio: 1;
456
456
 
457
457
  & > div {
458
458
  position: absolute;
@@ -61,7 +61,7 @@ export default {
61
61
  align-self: center;
62
62
  font-size: 2rem;
63
63
  width: 1em;
64
- height: 1em;
64
+ aspect-ratio: 1;
65
65
 
66
66
  &.size--xs {font-size: round(0.9 * divide($base-font-size, 2)) * 2;}
67
67
  &.size--sm {font-size: round(1.5 * $base-font-size);}
@@ -73,7 +73,7 @@ export default {
73
73
  content: '';
74
74
  position: absolute;
75
75
  width: 100%;
76
- height: 100%;
76
+ aspect-ratio: 1;
77
77
  top: 0;
78
78
  left: 0;
79
79
  background-color: currentColor;
@@ -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;
@@ -178,8 +178,10 @@ export default {
178
178
 
179
179
  if (!this.fillBar && this.activeTabEl) {
180
180
  const { left, width } = this.activeTabEl.getBoundingClientRect()
181
- const { left: parentLeft } = this.activeTabEl.parentNode.getBoundingClientRect()
182
- this.slider.left = `${left - parentLeft + this.activeTabEl.parentNode.scrollLeft}px`
181
+ const tabsBar = this.activeTabEl.parentNode
182
+ const { left: parentLeft } = tabsBar.getBoundingClientRect()
183
+ const { borderLeftWidth } = getComputedStyle(tabsBar)
184
+ this.slider.left = `${left - parentLeft - parseInt(borderLeftWidth) + tabsBar.scrollLeft}px`
183
185
  this.slider.width = `${width}px`
184
186
  }
185
187
  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
  }
@@ -1,7 +1,6 @@
1
1
  import config, { mergeConfig } from './utils/config'
2
2
  import NotificationManager from './utils/notification-manager'
3
3
  import colors from './utils/colors'
4
- import { consoleWarn } from './utils/console'
5
4
  // import * as directives from './directives'
6
5
 
7
6
  const shadeColor = (col, amt) => {
@@ -42,8 +41,8 @@ export default class WaveUI {
42
41
  // if (directives[id]) Vue.directive(id, directives[id])
43
42
  // }
44
43
  Vue.directive('focus', {
45
- // When the bound element is inserted into the DOM.
46
- inserted: el => el.focus()
44
+ // Wait for the next tick to focus the newly mounted element.
45
+ inserted: el => setTimeout(() => el.focus(), 0)
47
46
  })
48
47
  Vue.directive('scroll', {
49
48
  inserted: (el, binding) => {