wave-ui 1.52.0 → 1.53.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.
- package/dist/wave-ui.cjs.js +1 -1
- package/dist/wave-ui.css +1 -1
- package/dist/wave-ui.es.js +229 -144
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +3 -2
- package/src/wave-ui/components/transitions/w-transition-expand.vue +1 -13
- package/src/wave-ui/components/w-accordion.vue +51 -20
- package/src/wave-ui/components/w-checkbox.vue +11 -6
- package/src/wave-ui/components/w-checkboxes.vue +9 -19
- package/src/wave-ui/components/w-dialog.vue +18 -9
- package/src/wave-ui/components/w-divider.vue +4 -1
- package/src/wave-ui/components/w-drawer.vue +46 -21
- package/src/wave-ui/components/w-form-element.vue +19 -13
- package/src/wave-ui/components/w-form.vue +16 -11
- package/src/wave-ui/components/w-icon.vue +19 -17
- package/src/wave-ui/components/w-input.vue +14 -37
- package/src/wave-ui/components/w-menu.vue +8 -0
- package/src/wave-ui/components/w-notification.vue +3 -1
- package/src/wave-ui/components/w-overlay.vue +21 -15
- package/src/wave-ui/components/w-radio.vue +11 -6
- package/src/wave-ui/components/w-radios.vue +6 -15
- package/src/wave-ui/components/w-select.vue +13 -28
- package/src/wave-ui/components/w-slider.vue +21 -10
- package/src/wave-ui/components/w-switch.vue +44 -16
- package/src/wave-ui/components/w-tabs/index.vue +11 -1
- package/src/wave-ui/components/w-textarea.vue +15 -17
- package/src/wave-ui/components/w-toolbar.vue +2 -2
- package/src/wave-ui/mixins/detachable.js +17 -13
- package/src/wave-ui/mixins/form-elements.js +9 -0
|
@@ -9,9 +9,11 @@ component(
|
|
|
9
9
|
:class="classes")
|
|
10
10
|
//- Left label.
|
|
11
11
|
template(v-if="labelPosition === 'left'")
|
|
12
|
-
label.w-textarea__label.w-textarea__label--left.w-form-el-shakable(
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
label.w-textarea__label.w-textarea__label--left.w-form-el-shakable(
|
|
13
|
+
v-if="$slots.default || label"
|
|
14
|
+
:for="`w-textarea--${_uid}`"
|
|
15
|
+
:class="labelClasses")
|
|
16
|
+
slot {{ label }}
|
|
15
17
|
|
|
16
18
|
//- Input wrapper.
|
|
17
19
|
.w-textarea__textarea-wrap(:class="inputWrapClasses")
|
|
@@ -39,15 +41,10 @@ component(
|
|
|
39
41
|
:tabindex="tabindex || null")
|
|
40
42
|
template(v-if="labelPosition === 'inside' && showLabelInside")
|
|
41
43
|
label.w-textarea__label.w-textarea__label--inside.w-form-el-shakable(
|
|
42
|
-
v-if="$slots.default"
|
|
43
|
-
:for="`w-textarea--${_uid}`"
|
|
44
|
-
:class="isFocused && { [valid === false ? 'error' : this.color]: this.color || valid === false }")
|
|
45
|
-
slot
|
|
46
|
-
label.w-textarea__label.w-textarea__label--inside.w-form-el-shakable(
|
|
47
|
-
v-else-if="label"
|
|
44
|
+
v-if="$slots.default || label"
|
|
48
45
|
:for="`w-textarea--${_uid}`"
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
:class="labelClasses")
|
|
47
|
+
slot {{ label }}
|
|
51
48
|
w-icon.w-textarea__icon.w-textarea__icon--inner-right(
|
|
52
49
|
v-if="innerIconRight"
|
|
53
50
|
tag="label"
|
|
@@ -56,9 +53,11 @@ component(
|
|
|
56
53
|
|
|
57
54
|
//- Right label.
|
|
58
55
|
template(v-if="labelPosition === 'right'")
|
|
59
|
-
label.w-textarea__label.w-textarea__label--right.w-form-el-shakable(
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
label.w-textarea__label.w-textarea__label--right.w-form-el-shakable(
|
|
57
|
+
v-if="$slots.default || label"
|
|
58
|
+
:for="`w-textarea--${_uid}`"
|
|
59
|
+
:class="labelClasses")
|
|
60
|
+
slot {{ label }}
|
|
62
61
|
</template>
|
|
63
62
|
|
|
64
63
|
<script>
|
|
@@ -83,6 +82,7 @@ export default {
|
|
|
83
82
|
placeholder: { type: String },
|
|
84
83
|
color: { type: String, default: 'primary' },
|
|
85
84
|
bgColor: { type: String },
|
|
85
|
+
labelColor: { type: String, default: 'primary' },
|
|
86
86
|
dark: { type: Boolean },
|
|
87
87
|
outline: { type: Boolean },
|
|
88
88
|
shadow: { type: Boolean },
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
},
|
|
143
143
|
inputWrapClasses () {
|
|
144
144
|
return {
|
|
145
|
-
[this.valid === false ?
|
|
145
|
+
[this.valid === false ? this.validationColor : this.color]: this.color || this.valid === false,
|
|
146
146
|
[`${this.bgColor}--bg`]: this.bgColor,
|
|
147
147
|
'w-textarea__textarea-wrap--tile': this.tile,
|
|
148
148
|
// Box adds a padding on input. If there is a bgColor or shadow, a padding is needed.
|
|
@@ -387,8 +387,6 @@ $inactive-color: #777;
|
|
|
387
387
|
.w-textarea--filled.w-textarea--floating-label.w-textarea--inner-icon-left & {left: 0;}
|
|
388
388
|
// Chrome & Safari - Must remain in a separated rule as Firefox discard the whole rule seeing -webkit-.
|
|
389
389
|
.w-textarea--floating-label.w-textarea--inner-icon-left .w-textarea__textarea:-webkit-autofill & {left: 0;}
|
|
390
|
-
|
|
391
|
-
.w-textarea--focused & {color: currentColor;}
|
|
392
390
|
}
|
|
393
391
|
}
|
|
394
392
|
</style>
|
|
@@ -70,11 +70,11 @@ export default {
|
|
|
70
70
|
z-index: 10;
|
|
71
71
|
|
|
72
72
|
&--absolute, &--fixed {top: 0;left: 0;right: 0;}
|
|
73
|
+
&--absolute {position: absolute;}
|
|
74
|
+
&--fixed {position: fixed;}
|
|
73
75
|
&--absolute.w-toolbar--vertical, &--fixed.w-toolbar--vertical {top: 0;bottom: 0;}
|
|
74
76
|
&--absolute.w-toolbar--left, &--fixed.w-toolbar--left {left: 0;right: auto;}
|
|
75
77
|
&--absolute.w-toolbar--right, &--fixed.w-toolbar--right {left: auto;right: 0;}
|
|
76
|
-
&--absolute {position: absolute;}
|
|
77
|
-
&--fixed {position: fixed;}
|
|
78
78
|
|
|
79
79
|
// Horizontal.
|
|
80
80
|
&--top {border-bottom: $border;}
|
|
@@ -9,7 +9,6 @@ import { consoleWarn } from '../utils/console'
|
|
|
9
9
|
export default {
|
|
10
10
|
props: {
|
|
11
11
|
// Position.
|
|
12
|
-
detachTo: { type: [String, Boolean, Object], deprecated: true },
|
|
13
12
|
appendTo: { type: [String, Boolean, Object] },
|
|
14
13
|
fixed: { type: Boolean },
|
|
15
14
|
top: { type: Boolean },
|
|
@@ -26,6 +25,10 @@ export default {
|
|
|
26
25
|
activator: { type: [String, Object, HTMLElement] } // The activator can be a DOM string selector, a ref or a DOM node.
|
|
27
26
|
},
|
|
28
27
|
|
|
28
|
+
inject: {
|
|
29
|
+
detachableDefaultRoot: { default: null }
|
|
30
|
+
},
|
|
31
|
+
|
|
29
32
|
data: () => ({
|
|
30
33
|
// The event listeners handlers have to be removed the exact same way they have been attached.
|
|
31
34
|
// Since the handler functions have variables that change after hot-reload, keep them exactly
|
|
@@ -39,14 +42,15 @@ export default {
|
|
|
39
42
|
// DOM element to attach tooltip/menu to.
|
|
40
43
|
// ! \ This computed uses the DOM - NO SSR (only trigger from beforeMount and later).
|
|
41
44
|
appendToTarget () {
|
|
42
|
-
|
|
45
|
+
let defaultTarget = '.w-app'
|
|
43
46
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// If used inside a w-dialog, w-drawer, or w-menu without an appendTo, default to that open
|
|
48
|
+
// element instead of the w-app.
|
|
49
|
+
if (typeof this.detachableDefaultRoot === 'function') {
|
|
50
|
+
defaultTarget = this.detachableDefaultRoot() || defaultTarget
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
let target = this.appendTo ||
|
|
53
|
+
let target = this.appendTo || defaultTarget
|
|
50
54
|
if (target === true) target = defaultTarget
|
|
51
55
|
else if (this.appendTo === 'activator') target = this.$el.previousElementSibling
|
|
52
56
|
else if (target && !['object', 'string'].includes(typeof target)) target = defaultTarget
|
|
@@ -145,7 +149,7 @@ export default {
|
|
|
145
149
|
// ! \ This function uses the DOM - NO SSR (only trigger from beforeMount and later).
|
|
146
150
|
getActivatorCoordinates () {
|
|
147
151
|
// Get the activator coordinates relative to window.
|
|
148
|
-
const { top, left, width, height } =
|
|
152
|
+
const { top, left, width, height } = this.activatorEl.getBoundingClientRect()
|
|
149
153
|
let coords = { top, left, width, height }
|
|
150
154
|
|
|
151
155
|
// If absolute position, adjust top & left.
|
|
@@ -167,6 +171,11 @@ export default {
|
|
|
167
171
|
// Get the activator coordinates.
|
|
168
172
|
let { top, left, width, height } = this.getActivatorCoordinates()
|
|
169
173
|
|
|
174
|
+
// Prevent error in case the detachable component unmounted hook is fired but the activator
|
|
175
|
+
// is still in the DOM until the end of a transition and the user toggles it.
|
|
176
|
+
// Unmounted is called straight away from beforeLeave: https://github.com/vuejs/core/issues/994
|
|
177
|
+
if (!this.detachableEl) return
|
|
178
|
+
|
|
170
179
|
// 1. First display the menu but hide it (So we can get its dimension).
|
|
171
180
|
// --------------------------------------------------
|
|
172
181
|
this.detachableEl.style.visibility = 'hidden'
|
|
@@ -273,7 +282,6 @@ export default {
|
|
|
273
282
|
this.detachableEl = this.$refs.detachable?.$el || this.$refs.detachable
|
|
274
283
|
|
|
275
284
|
// Move the tooltip/menu elsewhere in the DOM.
|
|
276
|
-
// wrapper.parentNode.insertBefore(this.detachableEl, wrapper)
|
|
277
285
|
if (this.detachableEl) this.appendToTarget.appendChild(this.detachableEl)
|
|
278
286
|
resolve()
|
|
279
287
|
})
|
|
@@ -327,7 +335,7 @@ export default {
|
|
|
327
335
|
// so check it on nextTick.
|
|
328
336
|
else {
|
|
329
337
|
this.$nextTick(() => {
|
|
330
|
-
this.activator
|
|
338
|
+
if (this.activator) this.bindActivatorEvents()
|
|
331
339
|
if (this.value) this.toggle({ type: 'click', target: this.activatorEl })
|
|
332
340
|
})
|
|
333
341
|
}
|
|
@@ -362,10 +370,6 @@ export default {
|
|
|
362
370
|
value (bool) {
|
|
363
371
|
if (!!bool !== this.detachableVisible) this.toggle({ type: 'click', target: this.activatorEl })
|
|
364
372
|
},
|
|
365
|
-
detachTo () {
|
|
366
|
-
this.removeFromDOM()
|
|
367
|
-
this.insertInDOM()
|
|
368
|
-
},
|
|
369
373
|
appendTo () {
|
|
370
374
|
this.removeFromDOM()
|
|
371
375
|
this.insertInDOM()
|
|
@@ -29,6 +29,15 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
isReadonly () {
|
|
31
31
|
return this.readonly || this.formProps.readonly
|
|
32
|
+
},
|
|
33
|
+
validationColor () {
|
|
34
|
+
return this.formProps.validationColor
|
|
35
|
+
},
|
|
36
|
+
labelClasses () {
|
|
37
|
+
return {
|
|
38
|
+
[this.labelColor]: this.labelColor && this.valid !== false,
|
|
39
|
+
[this.validationColor]: this.valid === false
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
},
|
|
34
43
|
|