wave-ui 2.35.0 → 2.36.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.
@@ -13,15 +13,10 @@ component(
13
13
  //- Left label.
14
14
  template(v-if="labelPosition === 'left'")
15
15
  label.w-input__label.w-input__label--left.w-form-el-shakable(
16
- v-if="$slots.default"
16
+ v-if="$slots.default || label"
17
17
  :for="`w-input--${_.uid}`"
18
- :class="validationClasses")
19
- slot
20
- label.w-input__label.w-input__label--left.w-form-el-shakable(
21
- v-else-if="label"
22
- :for="`w-input--${_.uid}`"
23
- :class="validationClasses"
24
- v-html="label")
18
+ :class="labelClasses")
19
+ slot {{ label }}
25
20
 
26
21
  //- Input wrapper.
27
22
  .w-input__input-wrap(:class="inputWrapClasses")
@@ -81,15 +76,10 @@ component(
81
76
 
82
77
  template(v-if="labelPosition === 'inside' && showLabelInside")
83
78
  label.w-input__label.w-input__label--inside.w-form-el-shakable(
84
- v-if="$slots.default"
85
- :for="`w-input--${_.uid}`"
86
- :class="validationClasses")
87
- slot
88
- label.w-input__label.w-input__label--inside.w-form-el-shakable(
89
- v-else-if="label"
79
+ v-if="$slots.default || label"
90
80
  :for="`w-input--${_.uid}`"
91
- v-html="label"
92
- :class="validationClasses")
81
+ :class="labelClasses")
82
+ slot {{ label }}
93
83
  w-icon.w-input__icon.w-input__icon--inner-right(
94
84
  v-if="innerIconRight"
95
85
  tag="label"
@@ -121,15 +111,10 @@ component(
121
111
  //- Right label.
122
112
  template(v-if="labelPosition === 'right'")
123
113
  label.w-input__label.w-input__label--right.w-form-el-shakable(
124
- v-if="$slots.default"
125
- :for="`w-input--${_.uid}`"
126
- :class="validationClasses")
127
- slot
128
- label.w-input__label.w-input__label--right.w-form-el-shakable(
129
- v-else-if="label"
114
+ v-if="$slots.default || label"
130
115
  :for="`w-input--${_.uid}`"
131
- :class="validationClasses"
132
- v-html="label")
116
+ :class="labelClasses")
117
+ slot {{ label }}
133
118
  </template>
134
119
 
135
120
  <script>
@@ -151,12 +136,12 @@ export default {
151
136
  labelPosition: { type: String, default: 'inside' },
152
137
  innerIconLeft: { type: String },
153
138
  innerIconRight: { type: String },
154
- // When label is inside, allows to move the label above on focus or when filled.
155
- staticLabel: { type: Boolean },
139
+ staticLabel: { type: Boolean }, // When label is inside, fix the label above.
156
140
  placeholder: { type: String },
157
141
  color: { type: String, default: 'primary' },
158
- progressColor: { type: String },
159
142
  bgColor: { type: String },
143
+ labelColor: { type: String, default: 'primary' },
144
+ progressColor: { type: String },
160
145
  minlength: { type: [Number, String] },
161
146
  maxlength: { type: [Number, String] },
162
147
  step: { type: [Number, String] },
@@ -248,7 +233,7 @@ export default {
248
233
  },
249
234
 
250
235
  overallFilesProgress () {
251
- const progress = this.inputFiles.reduce((total, file) => total + file.progress, 0)
236
+ const progress = +this.inputFiles.reduce((total, file) => total + file.progress, 0)
252
237
  const total = progress / this.inputFiles.length
253
238
  this.$emit('update:overallProgress', this.inputFiles.length ? total : undefined)
254
239
 
@@ -280,15 +265,9 @@ export default {
280
265
  }
281
266
  },
282
267
 
283
- validationClasses () {
284
- return this.isFocused && {
285
- [this.valid === false ? 'error' : this.color]: this.color || this.valid === false
286
- }
287
- },
288
-
289
268
  inputWrapClasses () {
290
269
  return {
291
- [this.valid === false ? 'error' : this.color]: this.color || this.valid === false,
270
+ [this.valid === false ? this.validationColor : this.color]: this.color || this.valid === false,
292
271
  [`${this.bgColor}--bg`]: this.bgColor,
293
272
  'w-input__input-wrap--file': this.type === 'file',
294
273
  'w-input__input-wrap--round': this.round,
@@ -645,8 +624,6 @@ $inactive-color: #777;
645
624
  .w-input--filled.w-input--floating-label.w-input--inner-icon-left & {left: 0;}
646
625
  // Chrome & Safari - Must remain in a separated rule as Firefox discard the whole rule seeing -webkit-.
647
626
  .w-input--floating-label.w-input--inner-icon-left .w-input__input:-webkit-autofill & {left: 0;}
648
-
649
- .w-input--focused & {color: currentColor;}
650
627
  }
651
628
  }
652
629
  </style>
@@ -1,57 +1,47 @@
1
1
  <template lang="pug">
2
- .w-menu-wrap
3
- slot(name="activator" :on="activatorEventHandlers")
4
- transition(:name="transitionName" appear)
5
- .w-menu(
6
- v-if="custom && detachableVisible"
7
- ref="detachable"
8
- v-bind="$attrs"
9
- @click="hideOnMenuClick && close(true)"
10
- @mouseenter="showOnHover && (hoveringMenu = true)"
11
- @mouseleave="showOnHover && ((hoveringMenu = false), close())"
12
- :class="classes"
13
- :style="styles")
14
- slot
15
- w-card.w-menu(
16
- v-else-if="detachableVisible"
17
- ref="detachable"
18
- v-bind="$attrs"
19
- @click.native="hideOnMenuClick && close(true)"
20
- @mouseenter.native="showOnHover && (hoveringMenu = true)"
21
- @mouseleave.native="showOnHover && ((hoveringMenu = false), close())"
22
- :tile="tile"
23
- :title-class="titleClasses"
24
- :content-class="contentClasses"
25
- :shadow="shadow"
26
- :no-border="noBorder"
27
- :class="classes"
28
- :style="styles")
29
- template(v-if="$slots.title" #title)
30
- slot(name="title")
31
- template(v-if="$slots.actions" #actions)
32
- slot(name="actions")
33
- slot
34
- w-overlay(
35
- v-if="overlay"
36
- ref="overlay"
37
- :model-value="detachableVisible"
38
- :persistent="persistent"
39
- :class="overlayClasses"
40
- v-bind="overlayProps"
41
- :z-index="(zIndex || 200) - 1"
42
- @update:model-value="detachableVisible = false")
2
+ slot(name="activator" :on="activatorEventHandlers")
3
+ transition(:name="transitionName" appear)
4
+ .w-menu(
5
+ v-if="custom && detachableVisible"
6
+ ref="detachable"
7
+ v-bind="$attrs"
8
+ @click="hideOnMenuClick && close(true)"
9
+ @mouseenter="showOnHover && (hoveringMenu = true)"
10
+ @mouseleave="showOnHover && ((hoveringMenu = false), close())"
11
+ :class="classes"
12
+ :style="styles")
13
+ slot
14
+ w-card.w-menu(
15
+ v-else-if="detachableVisible"
16
+ ref="detachable"
17
+ v-bind="$attrs"
18
+ @click.native="hideOnMenuClick && close(true)"
19
+ @mouseenter.native="showOnHover && (hoveringMenu = true)"
20
+ @mouseleave.native="showOnHover && ((hoveringMenu = false), close())"
21
+ :tile="tile"
22
+ :title-class="titleClasses"
23
+ :content-class="contentClasses"
24
+ :shadow="shadow"
25
+ :no-border="noBorder"
26
+ :class="classes"
27
+ :style="styles")
28
+ template(v-if="$slots.title" #title)
29
+ slot(name="title")
30
+ template(v-if="$slots.actions" #actions)
31
+ slot(name="actions")
32
+ slot
33
+ w-overlay(
34
+ v-if="overlay"
35
+ ref="overlay"
36
+ :model-value="detachableVisible"
37
+ :persistent="persistent"
38
+ :class="overlayClasses"
39
+ v-bind="overlayProps"
40
+ :z-index="(zIndex || 200) - 1"
41
+ @update:model-value="detachableVisible = false")
43
42
  </template>
44
43
 
45
44
  <script>
46
- /**
47
- * Complexity of this component: Vue 2.x can only mount 1 single root element, but we don't
48
- * want to wrap the activator as it may break the layout.
49
- * Another simpler way would be to append the menu inside the activator, but some HTML tags
50
- * can't have children like <input>.
51
- * So a solution is to mount both the activator element and the menu in a wrapper then unwrap
52
- * and move the menu elsewhere in the DOM.
53
- */
54
-
55
45
  import { objectifyClasses } from '../utils/index'
56
46
  import DetachableMixin from '../mixins/detachable'
57
47
 
@@ -88,6 +78,14 @@ export default {
88
78
  // alignRight, noPosition, zIndex, activator.
89
79
  },
90
80
 
81
+ provide () {
82
+ return {
83
+ // If a detachable is used inside a w-menu without an appendTo, default to the menu element
84
+ // instead of the w-app.
85
+ detachableDefaultRoot: () => this.$refs.detachable?.$el || this.$refs.detachable || null
86
+ }
87
+ },
88
+
91
89
  emits: ['input', 'update:modelValue', 'open', 'close'],
92
90
 
93
91
  data: () => ({
@@ -1,7 +1,9 @@
1
1
  <template lang="pug">
2
2
  transition(:name="transitionName" appear)
3
3
  .w-notification(v-if="show" :class="classes" :style="styles")
4
- w-alert.white--bg(v-bind="alertProps" @update:model-value="$emit('update:modelValue', false);$emit('input', false)")
4
+ w-alert.white--bg(
5
+ v-bind="alertProps"
6
+ @update:model-value="$emit('update:modelValue', false);$emit('input', false)")
5
7
  slot
6
8
  </template>
7
9
 
@@ -1,8 +1,9 @@
1
1
  <template lang="pug">
2
- transition(name="fade" appear @after-leave="onClosed")
2
+ transition(name="fade" appear @after-leave="onClose")
3
3
  .w-overlay(
4
- v-if="showOverlay"
5
- v-show="modelValue"
4
+ v-if="modelValue"
5
+ v-show="showOverlay"
6
+ ref="overlay"
6
7
  :style="(modelValue && styles) || null"
7
8
  @keydown.escape.stop="onClick"
8
9
  @click="onClick"
@@ -25,7 +26,15 @@ export default {
25
26
  persistentNoAnimation: { type: Boolean }
26
27
  },
27
28
 
28
- emits: ['input', 'update:modelValue', 'click', 'close', 'closed'],
29
+ provide () {
30
+ return {
31
+ // If a detachable is used inside a w-overlay without an appendTo, default to the overlay element
32
+ // instead of the w-app.
33
+ detachableDefaultRoot: () => this.$refs.overlay || null
34
+ }
35
+ },
36
+
37
+ emits: ['input', 'update:modelValue', 'click', 'before-close', 'close'],
29
38
 
30
39
  data: () => ({
31
40
  persistentAnimate: false,
@@ -60,21 +69,19 @@ export default {
60
69
  setTimeout(() => (this.persistentAnimate = false), 150) // Must match CSS animation duration.
61
70
  }
62
71
  else if (!this.persistent) {
63
- this.$emit('update:modelValue', false)
64
- this.$emit('input', false)
65
- this.$emit('close')
72
+ this.showOverlay = false
73
+ this.$emit('before-close')
66
74
  }
67
75
 
68
76
  this.$emit('click', e)
69
77
  },
70
78
 
71
- // Wait until the end of the closing transition to unmount the components it contains.
72
- // This way, in case of w-select in w-dialog, the w-select will only remove its activator
73
- // element from the DOM once the dialog is completely closed.
74
- // https://github.com/antoniandre/wave-ui/issues/82
75
- onClosed () {
76
- this.showOverlay = false
77
- this.$emit('closed')
79
+ // Wait until the end of the closing transition (v-show) to completely unmount (v-if).
80
+ // The onClose method is called twice from the transition: once for the v-show, and once for the v-if.
81
+ onClose () {
82
+ this.$emit('update:modelValue', false)
83
+ this.$emit('input', false)
84
+ if (!this.modelValue) this.$emit('close') // Only emit once.
78
85
  }
79
86
  },
80
87
 
@@ -20,16 +20,20 @@ component(
20
20
  :aria-checked="inputValue || 'false'"
21
21
  role="radio")
22
22
  template(v-if="hasLabel && labelOnLeft")
23
- label.w-radio__label.w-form-el-shakable.pr2(v-if="$slots.default" :for="`w-radio--${_.uid}`")
24
- slot
25
- label.w-radio__label.w-form-el-shakable.pr2(v-else-if="label" :for="`w-radio--${_.uid}`" v-html="label")
23
+ label.w-radio__label.w-form-el-shakable.pr2(
24
+ v-if="$slots.default || label"
25
+ :for="`w-radio--${_.uid}`"
26
+ :class="labelClasses")
27
+ slot {{ label }}
26
28
  .w-radio__input(
27
29
  @click="$refs.input.focus();$refs.input.click()"
28
30
  :class="this.color")
29
31
  template(v-if="hasLabel && !labelOnLeft")
30
- label.w-radio__label.w-form-el-shakable.pl2(v-if="$slots.default" :for="`w-radio--${_.uid}`")
31
- slot
32
- label.w-radio__label.w-form-el-shakable.pl2(v-else-if="label" :for="`w-radio--${_.uid}`" v-html="label")
32
+ label.w-radio__label.w-form-el-shakable.pl2(
33
+ v-if="$slots.default || label"
34
+ :for="`w-radio--${_.uid}`"
35
+ :class="labelClasses")
36
+ slot {{ label }}
33
37
  </template>
34
38
 
35
39
  <script>
@@ -48,6 +52,7 @@ export default {
48
52
  label: { type: String },
49
53
  labelOnLeft: { type: Boolean },
50
54
  color: { type: String, default: 'primary' },
55
+ labelColor: { type: String, default: 'primary' },
51
56
  noRipple: { type: Boolean }
52
57
  // Props from mixin: name, disabled, readonly, required, tabindex, validators.
53
58
  // Computed from mixin: inputName, isDisabled & isReadonly.
@@ -15,22 +15,13 @@ component(
15
15
  @update:model-value="onInput(item)"
16
16
  @focus="$emit('focus', $event)"
17
17
  :name="inputName"
18
- :label="item.label"
19
- :label-on-left="labelOnLeft"
20
- :color="item.color"
18
+ v-bind="{ label: item.label, color: item.color, labelOnLeft, labelColor }"
21
19
  :disabled="isDisabled || null"
22
20
  :readonly="isReadonly || null"
23
21
  :class="{ mt1: !inline && i }")
24
22
  slot(
25
- v-if="$slots[`item.${i + 1}`]"
26
- :name="`item.${i + 1}`"
27
- :item="getOriginalItem(item)"
28
- :index="i + 1"
29
- :checked="item.value === modelValue"
30
- v-html="item.label")
31
- slot(
32
- v-else-if="$slots.item"
33
- name="item"
23
+ v-if="$slots[`item.${i + 1}`] || $slots.item"
24
+ :name="$slots[`item.${i + 1}`] ? `item.${i + 1}` : 'item'"
34
25
  :item="getOriginalItem(item)"
35
26
  :index="i + 1"
36
27
  :checked="item.value === modelValue"
@@ -53,7 +44,8 @@ export default {
53
44
  itemValueKey: { type: String, default: 'value' },
54
45
  itemColorKey: { type: String, default: 'color' }, // Support a different color per item.
55
46
  inline: { type: Boolean },
56
- color: { type: String, default: 'primary' }
47
+ color: { type: String, default: 'primary' },
48
+ labelColor: { type: String, default: 'primary' }
57
49
  // Props from mixin: name, disabled, readonly, required, validators.
58
50
  // Computed from mixin: inputName, isDisabled & isReadonly.
59
51
  },
@@ -9,24 +9,19 @@ component(
9
9
  :class="classes")
10
10
  template(v-if="labelPosition === 'left'")
11
11
  label.w-select__label.w-select__label--left.w-form-el-shakable(
12
- v-if="$slots.default"
13
- :for="`w-select--${_.uid}`")
14
- slot
15
- label.w-select__label.w-select__label--left.w-form-el-shakable(
16
- v-else-if="label"
12
+ v-if="$slots.default || label"
17
13
  :for="`w-select--${_.uid}`"
18
- v-html="label")
14
+ :class="labelClasses")
15
+ slot {{ label }}
19
16
 
20
17
  w-menu(
21
18
  v-model="showMenu"
22
19
  :menu-class="`w-select__menu ${menuClass || ''}`"
23
20
  transition="slide-fade-down"
24
- :append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo : '.w-app'"
21
+ :append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo : undefined"
25
22
  align-left
26
23
  custom
27
24
  min-width="activator"
28
- @mousedown="isFocused = true, selectingItem = true"
29
- @mouseup="isFocused = true, selectingItem = false"
30
25
  v-bind="menuProps || {}")
31
26
  template(#activator="{ on }")
32
27
  //- Input wrapper.
@@ -69,15 +64,10 @@ component(
69
64
  :name="inputName + (multiple ? '[]' : '')")
70
65
  template(v-if="labelPosition === 'inside' && showLabelInside")
71
66
  label.w-select__label.w-select__label--inside.w-form-el-shakable(
72
- v-if="$slots.default"
73
- :for="`w-select--${_.uid}`"
74
- :class="isFocused && { [valid === false ? 'error' : color]: color || valid === false }")
75
- slot
76
- label.w-select__label.w-select__label--inside.w-form-el-shakable(
77
- v-else-if="label"
67
+ v-if="$slots.default || label"
78
68
  :for="`w-select--${_.uid}`"
79
- v-html="label"
80
- :class="isFocused && { [valid === false ? 'error' : color]: color || valid === false }")
69
+ :class="labelClasses")
70
+ slot {{ label }}
81
71
  w-icon.w-select__icon.w-select__icon--inner-right(
82
72
  v-if="innerIconRight"
83
73
  tag="label"
@@ -112,13 +102,10 @@ component(
112
102
 
113
103
  template(v-if="labelPosition === 'right'")
114
104
  label.w-select__label.w-select__label--right.w-form-el-shakable(
115
- v-if="$slots.default"
116
- :for="`w-select--${_.uid}`")
117
- slot
118
- label.w-select__label.w-select__label--right.w-form-el-shakable(
119
- v-else-if="label"
105
+ v-if="$slots.default || label"
120
106
  :for="`w-select--${_.uid}`"
121
- v-html="label")
107
+ :class="labelClasses")
108
+ slot {{ label }}
122
109
  </template>
123
110
 
124
111
  <script>
@@ -149,8 +136,9 @@ export default {
149
136
  itemClass: { type: String },
150
137
  menuClass: { type: String },
151
138
  color: { type: String, default: 'primary' }, // Applies to all the items.
152
- selectionColor: { type: String, default: 'primary' }, // Applies to the selected items only.
153
139
  bgColor: { type: String }, // Applies to all the items.
140
+ labelColor: { type: String, default: 'primary' },
141
+ selectionColor: { type: String, default: 'primary' }, // Applies to the selected items only.
154
142
  outline: { type: Boolean },
155
143
  round: { type: Boolean },
156
144
  shadow: { type: Boolean },
@@ -174,7 +162,6 @@ export default {
174
162
  showMenu: false,
175
163
  menuMinWidth: 0,
176
164
  isFocused: false,
177
- selectingItem: false,
178
165
  selectionWrapRef: undefined
179
166
  }),
180
167
 
@@ -212,7 +199,7 @@ export default {
212
199
  'w-select--disabled': this.isDisabled,
213
200
  'w-select--readonly': this.isReadonly,
214
201
  [`w-select--${this.hasValue ? 'filled' : 'empty'}`]: true,
215
- 'w-select--focused': (this.isFocused || this.selectingItem) && !this.isReadonly,
202
+ 'w-select--focused': (this.isFocused || this.showMenu) && !this.isReadonly,
216
203
  'w-select--dark': this.dark,
217
204
  'w-select--floating-label': this.hasLabel && this.labelPosition === 'inside' && !this.staticLabel,
218
205
  'w-select--no-padding': !this.outline && !this.bgColor && !this.shadow && !this.round,
@@ -578,8 +565,6 @@ export default {
578
565
  .w-select--filled.w-select--floating-label.w-select--inner-icon-left & {left: 0;}
579
566
  // Chrome & Safari - Must remain in a separated rule as Firefox discard the whole rule seeing -webkit-.
580
567
  .w-select--floating-label.w-select--inner-icon-left .w-select__select:-webkit-autofill & {left: 0;}
581
-
582
- .w-select--focused &, .w-select--open & {color: currentColor;}
583
568
  }
584
569
 
585
570
  // Menu.
@@ -5,15 +5,17 @@ component(
5
5
  v-bind="formRegister && { validators, inputValue: rangeValueScaled, disabled: isDisabled, readonly: isReadonly }"
6
6
  v-model:valid="valid"
7
7
  @reset="rangeValuePercent = 0;updateRangeValueScaled()"
8
- wrap
8
+ :wrap="formRegister || null"
9
9
  :class="wrapperClasses")
10
10
  label.w-slider__label.w-slider__label--left.w-form-el-shakable(
11
11
  v-if="$slots['label-left']"
12
- :for="`button--${_.uid}`")
12
+ :for="`button--${_.uid}`"
13
+ :class="labelClasses")
13
14
  slot(name="label-left")
14
15
  label.w-slider__label.w-slider__label--left.w-form-el-shakable(
15
16
  v-else-if="labelLeft"
16
17
  :for="`button--${_.uid}`"
18
+ :class="labelClasses"
17
19
  v-html="labelLeft")
18
20
  .w-slider__track-wrap
19
21
  .w-slider__track(
@@ -39,6 +41,7 @@ component(
39
41
  :disabled="isDisabled || null"
40
42
  :readonly="isReadonly || null"
41
43
  :aria-readonly="isReadonly ? 'true' : 'false'"
44
+ :tabindex="isDisabled || isReadonly ? -1 : null"
42
45
  @keydown.left="onKeyDown($event, -1)"
43
46
  @keydown.right="onKeyDown($event, 1)"
44
47
  @focus="$emit('focus', $event)"
@@ -64,11 +67,13 @@ component(
64
67
  style="left: 100%") {{ this.maxVal }}
65
68
  label.w-slider__label.w-slider__label--right.w-form-el-shakable(
66
69
  v-if="$slots['label-right']"
67
- :for="`button--${_.uid}`")
70
+ :for="`button--${_.uid}`"
71
+ :class="labelClasses")
68
72
  slot(name="label-right")
69
73
  label.w-slider__label.w-slider__label--right.w-form-el-shakable(
70
74
  v-else-if="labelRight"
71
75
  :for="`button--${_.uid}`"
76
+ :class="labelClasses"
72
77
  v-html="labelRight")
73
78
  </template>
74
79
 
@@ -83,6 +88,7 @@ export default {
83
88
  modelValue: { type: Number, default: 0 },
84
89
  color: { type: String, default: 'primary' },
85
90
  bgColor: { type: String },
91
+ labelColor: { type: String, default: 'primary' },
86
92
  stepLabels: { type: [Boolean, Array] },
87
93
  thumbLabel: { type: [Boolean, String] }, // One of true, false, 'droplet'.
88
94
  thumbLabelClass: { type: String },
@@ -378,16 +384,17 @@ export default {
378
384
  &:before, &:after {
379
385
  content: '';
380
386
  position: absolute;
387
+ border-radius: inherit;
388
+ @include default-transition;
381
389
  }
390
+ // Colored border on thumb when hover and active - but with a transparency.
382
391
  &:before {
383
392
  left: 0;
384
393
  right: 0;
385
394
  top: 0;
386
395
  bottom: 0;
387
396
  opacity: 0.5;
388
- border-radius: inherit;
389
397
  border: 1px solid currentColor;
390
- @include default-transition;
391
398
  }
392
399
  &:hover:before, &:focus:before {opacity: 0.7;}
393
400
  &:active:before, .w-slider--dragging &:before {
@@ -398,13 +405,17 @@ export default {
398
405
  .w-slider--disabled &:before,
399
406
  .w-slider--readonly &:before {box-shadow: none;opacity: 0.4;}
400
407
 
401
- // For fat fingers.
408
+ // The outline when focused, but also a bigger reactive zone for fat fingers when not.
402
409
  &:after {
403
- left: -6px;
404
- right: -6px;
405
- top: -6px;
406
- bottom: -6px;
410
+ left: -2 * $base-increment;
411
+ right: -2 * $base-increment;
412
+ top: -2 * $base-increment;
413
+ bottom: -2 * $base-increment;
414
+ opacity: 0;
415
+ background-color: currentColor;
407
416
  }
417
+ &:focus:after {opacity: 0.15;}
418
+ .w-slider--dragging &:after, &:active:after {opacity: 0.1;transform: scale(1.2);}
408
419
  }
409
420
 
410
421
  // Thumb label.
@@ -22,9 +22,11 @@ component(
22
22
  :aria-checked="isOn || 'false'"
23
23
  role="switch")
24
24
  template(v-if="hasLabel && labelOnLeft")
25
- label.w-switch__label.w-form-el-shakable(v-if="$slots.default" :for="`w-switch--${_.uid}`")
26
- slot
27
- label.w-switch__label.w-form-el-shakable(v-else-if="label" :for="`w-switch--${_.uid}`" v-html="label")
25
+ label.w-switch__label.w-switch__label--left.w-form-el-shakable(
26
+ v-if="$slots.default || label"
27
+ :for="`w-switch--${_.uid}`"
28
+ :class="labelClasses")
29
+ slot {{ label }}
28
30
  .w-switch__input(
29
31
  @click="$refs.input.focus();$refs.input.click()"
30
32
  v-on="$attrs"
@@ -34,9 +36,11 @@ component(
34
36
  .w-switch__thumb(v-if="$slots.thumb")
35
37
  slot(name="thumb")
36
38
  template(v-if="hasLabel && !labelOnLeft")
37
- label.w-switch__label.w-form-el-shakable(v-if="$slots.default" :for="`w-switch--${_.uid}`")
38
- slot
39
- label.w-switch__label.w-form-el-shakable(v-else-if="label" :for="`w-switch--${_.uid}`" v-html="label")
39
+ label.w-switch__label.w-switch__label--right.w-form-el-shakable(
40
+ v-if="$slots.default || label"
41
+ :for="`w-switch--${_.uid}`"
42
+ :class="labelClasses")
43
+ slot {{ label }}
40
44
  </template>
41
45
 
42
46
  <script>
@@ -51,6 +55,7 @@ export default {
51
55
  label: { type: String, default: '' },
52
56
  labelOnLeft: { type: Boolean },
53
57
  color: { type: String, default: 'primary' },
58
+ labelColor: { type: String, default: 'primary' },
54
59
  thin: { type: Boolean },
55
60
  noRipple: { type: Boolean }
56
61
  // Props from mixin: name, disabled, readonly, required, tabindex, validators.