wave-ui 3.5.1 → 3.6.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 +803 -775
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +1 -1
- package/src/wave-ui/components/w-button/button.vue +4 -1
- package/src/wave-ui/components/w-input.vue +2 -0
- package/src/wave-ui/components/w-menu.vue +2 -2
- package/src/wave-ui/components/w-select.vue +1 -0
- package/src/wave-ui/components/w-textarea.vue +1 -0
- package/src/wave-ui/components/w-toolbar.vue +1 -2
- package/src/wave-ui/components/w-tooltip.vue +46 -12
- package/src/wave-ui/core.js +26 -2
- package/src/wave-ui/mixins/detachable.js +6 -3
- package/src/wave-ui/scss/index.scss +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
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",
|
|
@@ -282,7 +282,10 @@ $spinner-size: 40;
|
|
|
282
282
|
|
|
283
283
|
// Active state.
|
|
284
284
|
&:active {transform: scale(1.02);}
|
|
285
|
-
&:active:before {
|
|
285
|
+
&:active:before {
|
|
286
|
+
opacity: 0.3;
|
|
287
|
+
@include default-transition($fast-transition-duration);
|
|
288
|
+
}
|
|
286
289
|
&--dark:active:before, &.primary--bg:active:before {opacity: 0.35;}
|
|
287
290
|
|
|
288
291
|
// Disable visual feedback on loading and disabled buttons.
|
|
@@ -61,6 +61,7 @@ component(
|
|
|
61
61
|
@change="onFileChange"
|
|
62
62
|
:multiple="multiple || null"
|
|
63
63
|
v-bind="attrs"
|
|
64
|
+
:disabled="isDisabled || null"
|
|
64
65
|
:data-progress="overallFilesProgress /* Needed to emit the overallProgress. */")
|
|
65
66
|
transition-group.w-input__input.w-input__input--file(
|
|
66
67
|
tag="label"
|
|
@@ -570,6 +571,7 @@ $inactive-color: #777;
|
|
|
570
571
|
&__label {
|
|
571
572
|
transition: color $transition-duration;
|
|
572
573
|
cursor: pointer;
|
|
574
|
+
user-select: none;
|
|
573
575
|
|
|
574
576
|
&--left {margin-right: 2 * $base-increment;}
|
|
575
577
|
&--right {margin-left: 2 * $base-increment;}
|
|
@@ -168,7 +168,7 @@ export default {
|
|
|
168
168
|
top: (this.detachableCoords.top && `${~~this.detachableCoords.top}px`) || null,
|
|
169
169
|
left: (this.detachableCoords.left && `${~~this.detachableCoords.left}px`) || null,
|
|
170
170
|
minWidth: (this.minWidth && this.menuMinWidth) || null,
|
|
171
|
-
'--w-menu-bg-color': this.arrow && this.$waveui.colors[this.bgColor || '
|
|
171
|
+
'--w-menu-bg-color': this.arrow && (this.$waveui.colors[this.bgColor] || 'rgb(var(--w-base-bg-color-rgb))')
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
174
|
|
|
@@ -300,7 +300,7 @@ export default {
|
|
|
300
300
|
&.w-menu--left {margin-left: -4 * $base-increment;}
|
|
301
301
|
&.w-menu--right {margin-left: 4 * $base-increment;}
|
|
302
302
|
|
|
303
|
-
@include triangle(
|
|
303
|
+
@include triangle(var(--w-menu-bg-color), '.w-menu', 9px);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
</style>
|
|
@@ -67,7 +67,7 @@ export default {
|
|
|
67
67
|
.w-toolbar {
|
|
68
68
|
position: relative;
|
|
69
69
|
display: flex;
|
|
70
|
-
flex:
|
|
70
|
+
flex: 0 1 auto; // No grow, so it doesn't stretch vertically in flex column.
|
|
71
71
|
align-items: center;
|
|
72
72
|
padding: (2 * $base-increment) (3 * $base-increment);
|
|
73
73
|
background-color: $toolbar-bg-color;
|
|
@@ -94,7 +94,6 @@ export default {
|
|
|
94
94
|
&--vertical {
|
|
95
95
|
padding: (2 * $base-increment);
|
|
96
96
|
flex-direction: column;
|
|
97
|
-
flex-grow: 0;
|
|
98
97
|
flex-shrink: 0;
|
|
99
98
|
}
|
|
100
99
|
|
|
@@ -34,7 +34,14 @@ export default {
|
|
|
34
34
|
persistent: { type: Boolean },
|
|
35
35
|
delay: { type: Number },
|
|
36
36
|
dark: { type: Boolean },
|
|
37
|
-
light: { type: Boolean }
|
|
37
|
+
light: { type: Boolean },
|
|
38
|
+
caption: { type: Boolean }, // Apply the caption class and style (grey, italic, small).
|
|
39
|
+
xs: { type: Boolean },
|
|
40
|
+
sm: { type: Boolean },
|
|
41
|
+
md: { type: Boolean },
|
|
42
|
+
lg: { type: Boolean },
|
|
43
|
+
xl: { type: Boolean },
|
|
44
|
+
enableTouch: { type: Boolean }
|
|
38
45
|
// Other props in the detachable mixin:
|
|
39
46
|
// detachTo, appendTo, fixed, top, bottom, left, right, alignTop, alignBottom, alignLeft,
|
|
40
47
|
// alignRight, noPosition, zIndex, activator.
|
|
@@ -73,6 +80,17 @@ export default {
|
|
|
73
80
|
return this.transition || `w-tooltip-slide-fade-${direction}`
|
|
74
81
|
},
|
|
75
82
|
|
|
83
|
+
size () {
|
|
84
|
+
return (
|
|
85
|
+
(this.xs && 'xs') ||
|
|
86
|
+
(this.sm && 'sm') ||
|
|
87
|
+
(this.sm && 'md') ||
|
|
88
|
+
(this.lg && 'lg') ||
|
|
89
|
+
(this.xl && 'xl') ||
|
|
90
|
+
(this.caption ? 'sm' : 'md') // if no size is set put md by default, or sm if caption is on.
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
|
|
76
94
|
classes () {
|
|
77
95
|
return {
|
|
78
96
|
[this.color]: this.color,
|
|
@@ -84,6 +102,8 @@ export default {
|
|
|
84
102
|
'w-tooltip--light': this.light,
|
|
85
103
|
'w-tooltip--tile': this.tile,
|
|
86
104
|
'w-tooltip--round': this.round,
|
|
105
|
+
caption: this.caption,
|
|
106
|
+
[`size--${this.size}`]: true,
|
|
87
107
|
'w-tooltip--shadow': this.shadow,
|
|
88
108
|
'w-tooltip--fixed': this.fixed,
|
|
89
109
|
'w-tooltip--no-border': this.noBorder || this.bgColor,
|
|
@@ -97,17 +117,21 @@ export default {
|
|
|
97
117
|
zIndex: this.zIndex || this.zIndex === 0 || null,
|
|
98
118
|
top: (this.detachableCoords.top && `${~~this.detachableCoords.top}px`) || null,
|
|
99
119
|
left: (this.detachableCoords.left && `${~~this.detachableCoords.left}px`) || null,
|
|
100
|
-
'--w-tooltip-bg-color': this.$waveui.colors[this.bgColor || '
|
|
120
|
+
'--w-tooltip-bg-color': this.$waveui.colors[this.bgColor] || 'rgb(var(--w-base-bg-color-rgb))'
|
|
101
121
|
}
|
|
102
122
|
},
|
|
103
123
|
|
|
104
124
|
activatorEventHandlers () {
|
|
105
125
|
let handlers = {}
|
|
106
|
-
|
|
107
|
-
|
|
126
|
+
|
|
127
|
+
// Check the window exists: SSR-proof.
|
|
128
|
+
const isTouchDevice = typeof window !== 'undefined' && 'ontouchstart' in window
|
|
129
|
+
|
|
130
|
+
// Toggling tooltip on mouseenter/mouseout (by default), and also show on focus, hide on blur.
|
|
131
|
+
if (!this.showOnClick && !isTouchDevice) {
|
|
108
132
|
handlers = {
|
|
109
|
-
focus: this.
|
|
110
|
-
blur: this.
|
|
133
|
+
focus: this.open,
|
|
134
|
+
blur: this.close,
|
|
111
135
|
mouseenter: e => {
|
|
112
136
|
this.hoveringActivator = true
|
|
113
137
|
this.open(e)
|
|
@@ -117,10 +141,10 @@ export default {
|
|
|
117
141
|
this.close()
|
|
118
142
|
}
|
|
119
143
|
}
|
|
120
|
-
|
|
121
|
-
// Check the window exists: SSR-proof.
|
|
122
|
-
if (typeof window !== 'undefined' && 'ontouchstart' in window) handlers.click = this.toggle
|
|
123
144
|
}
|
|
145
|
+
// Only bind a click event on mobile, or if showOnClick is set.
|
|
146
|
+
else if (this.enableTouch || this.showOnClick) handlers = { click: this.toggle }
|
|
147
|
+
|
|
124
148
|
return handlers
|
|
125
149
|
}
|
|
126
150
|
},
|
|
@@ -140,8 +164,12 @@ export default {
|
|
|
140
164
|
// ! \ This function uses the DOM - NO SSR (only trigger from beforeMount and later).
|
|
141
165
|
toggle (e) {
|
|
142
166
|
let shouldShowTooltip = this.detachableVisible
|
|
167
|
+
|
|
168
|
+
// For touch devices.
|
|
143
169
|
if (typeof window !== 'undefined' && 'ontouchstart' in window) {
|
|
144
|
-
|
|
170
|
+
// disable tooltip opening for mouseenter activation.
|
|
171
|
+
if (!this.enableTouch && !this.showOnClick) shouldShowTooltip = false
|
|
172
|
+
else shouldShowTooltip = !shouldShowTooltip
|
|
145
173
|
}
|
|
146
174
|
else if (e.type === 'click' && this.showOnClick) shouldShowTooltip = !shouldShowTooltip
|
|
147
175
|
else if (['mouseenter', 'focus'].includes(e.type) && !this.showOnClick) shouldShowTooltip = true
|
|
@@ -220,16 +248,22 @@ export default {
|
|
|
220
248
|
&--left {margin-left: -3 * $base-increment;}
|
|
221
249
|
&--right {margin-left: 3 * $base-increment;}
|
|
222
250
|
|
|
251
|
+
&.size--xs {font-size: 0.75rem;}
|
|
252
|
+
&.size--sm {font-size: 0.83rem;}
|
|
253
|
+
&.size--md {font-size: 0.9rem;}
|
|
254
|
+
&.size--lg {font-size: 1rem;}
|
|
255
|
+
&.size--xl {font-size: 1.1rem;}
|
|
256
|
+
|
|
223
257
|
&--custom-transition {transform: none;}
|
|
224
258
|
|
|
225
259
|
// Tooltip without border.
|
|
226
260
|
&--no-border {
|
|
227
|
-
@include triangle(
|
|
261
|
+
@include triangle(var(--w-tooltip-bg-color), '.w-tooltip', 7px, 0);
|
|
228
262
|
}
|
|
229
263
|
|
|
230
264
|
// Tooltip with border.
|
|
231
265
|
&:not(&--no-border) {
|
|
232
|
-
@include triangle(
|
|
266
|
+
@include triangle(var(--w-tooltip-bg-color), '.w-tooltip', 7px);
|
|
233
267
|
}
|
|
234
268
|
}
|
|
235
269
|
|
package/src/wave-ui/core.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { reactive, inject } from 'vue'
|
|
2
2
|
import { mergeConfig } from './utils/config'
|
|
3
|
-
import {
|
|
3
|
+
import { consoleWarn } from './utils/console'
|
|
4
4
|
import { colorPalette, generateColorShades, flattenColors } from './utils/colors'
|
|
5
5
|
import { injectColorsCSSInDOM, injectCSSInDOM } from './utils/dynamic-css'
|
|
6
|
+
import { injectNotifManagerInDOM, NotificationManager } from './utils/notification-manager'
|
|
6
7
|
import './scss/index.scss'
|
|
7
8
|
|
|
8
9
|
let mounted = false
|
|
@@ -19,13 +20,36 @@ const detectOSDarkMode = $waveui => {
|
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Inject presets into a Vue component props defaults before its registration into the app.
|
|
23
|
+
* If a preset is not found in the given component props, try to find it in its mixins, if any.
|
|
22
24
|
*
|
|
25
|
+
* @todo remove mixins-related code when stopping support for Vue 2.
|
|
23
26
|
* @param {Object} component the Vue component to inject presets into.
|
|
24
27
|
* @param {Object} presets the presets to inject. E.g. `{ bgColor: 'green' }`.
|
|
25
28
|
*/
|
|
26
29
|
const injectPresets = (component, presets) => {
|
|
27
30
|
for (const preset in presets) {
|
|
28
|
-
|
|
31
|
+
// If we don't have the prop output a warning and continue.
|
|
32
|
+
if (!component.props?.[preset]) {
|
|
33
|
+
let foundProp = false
|
|
34
|
+
// Check to see if the prop exists on a mixin when it doesn't exist on the component.
|
|
35
|
+
// @todo: remove this check when there is no more Vue 2 and mixins: mixins are now deprecated.
|
|
36
|
+
if (Array.isArray(component.mixins) && component.mixins.length) {
|
|
37
|
+
// Loop through the array of mixin, and if we find the prop in one, update its default value.
|
|
38
|
+
for (const mixin of component.mixins) {
|
|
39
|
+
if (mixin?.props?.[preset]) {
|
|
40
|
+
mixin.props[preset].default = presets[preset]
|
|
41
|
+
foundProp = true
|
|
42
|
+
break
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// If the given prop (= preset) is still not found in the mixins props raise warning.
|
|
47
|
+
if (!foundProp) consoleWarn(`Attempting to set a preset on a prop that doesn't exist: \`${component.name}.${preset}\`.`)
|
|
48
|
+
continue // Continue to the next preset.
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
else component.props[preset].default = presets[preset]
|
|
29
53
|
}
|
|
30
54
|
}
|
|
31
55
|
|
|
@@ -331,14 +331,17 @@ export default {
|
|
|
331
331
|
else {
|
|
332
332
|
this.$nextTick(() => {
|
|
333
333
|
if (this.activator) this.bindActivatorEvents()
|
|
334
|
-
if (this.modelValue) this.
|
|
334
|
+
if (this.modelValue) this.open({ target: this.activatorEl })
|
|
335
335
|
})
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
// Unwrap the overlay if any.
|
|
339
339
|
if (this.overlay) this.overlayEl = this.$refs.overlay?.$el
|
|
340
340
|
|
|
341
|
-
if (this.modelValue && this.activator)
|
|
341
|
+
if (this.modelValue && this.activator) {
|
|
342
|
+
this.toggle({ type: this.showOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
|
|
343
|
+
}
|
|
344
|
+
else if (this.modelValue) this.open({ target: this.activatorEl })
|
|
342
345
|
},
|
|
343
346
|
|
|
344
347
|
unmounted () {
|
|
@@ -357,7 +360,7 @@ export default {
|
|
|
357
360
|
|
|
358
361
|
watch: {
|
|
359
362
|
modelValue (bool) {
|
|
360
|
-
if (!!bool !== this.detachableVisible) this.toggle({ type: 'click', target: this.activatorEl })
|
|
363
|
+
if (!!bool !== this.detachableVisible) this.toggle({ type: this.showOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
|
|
361
364
|
},
|
|
362
365
|
appendTo () {
|
|
363
366
|
this.removeFromDOM()
|