wave-ui 3.0.4 → 3.1.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 +19 -16
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +8 -7
- package/src/wave-ui/components/w-input.vue +4 -1
- package/src/wave-ui/components/w-list.vue +4 -1
- package/src/wave-ui/components/w-select.vue +27 -16
- package/src/wave-ui/components/w-textarea.vue +1 -0
- package/src/wave-ui/components/w-tree.vue +2 -1
- package/src/wave-ui/core.js +0 -1
- package/src/wave-ui/scss/_base.scss +2 -0
- package/src/wave-ui/scss/_typography.scss +1 -1
- package/src/wave-ui/scss/_variables.scss +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"./package.json": "./package.json",
|
|
24
24
|
"./dist/*": "./dist/*",
|
|
25
25
|
"./src/wave-ui": "./src/wave-ui/index.js",
|
|
26
|
+
"./src/wave-ui/components": "./src/wave-ui/components/index.js",
|
|
26
27
|
"./src/wave-ui/*": "./src/wave-ui/*"
|
|
27
28
|
},
|
|
28
29
|
"type": "module",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"lint": "vite lint"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.
|
|
52
|
+
"@babel/core": "^7.21.0",
|
|
52
53
|
"@babel/eslint-parser": "^7.19.1",
|
|
53
54
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
54
55
|
"@mdi/font": "^5.9.55",
|
|
@@ -57,21 +58,21 @@
|
|
|
57
58
|
"autoprefixer": "^10.4.13",
|
|
58
59
|
"axios": "^0.25.0",
|
|
59
60
|
"eslint": "^7.32.0",
|
|
60
|
-
"eslint-plugin-vue": "^9.
|
|
61
|
+
"eslint-plugin-vue": "^9.9.0",
|
|
61
62
|
"font-awesome": "^4.7.0",
|
|
62
|
-
"gsap": "^3.11.
|
|
63
|
+
"gsap": "^3.11.4",
|
|
63
64
|
"ionicons": "^4.6.3",
|
|
64
65
|
"material-design-icons": "^3.0.1",
|
|
65
|
-
"postcss": "^8.4.
|
|
66
|
+
"postcss": "^8.4.21",
|
|
66
67
|
"pug": "^3.0.2",
|
|
67
68
|
"rollup-plugin-delete": "^2.0.0",
|
|
68
|
-
"sass": "^1.
|
|
69
|
+
"sass": "^1.58.3",
|
|
69
70
|
"simple-syntax-highlighter": "^2.2.5",
|
|
70
71
|
"splitpanes": "^3.1.5",
|
|
71
72
|
"standard": "^17.0.0",
|
|
72
73
|
"vite": "^3.2.5",
|
|
73
74
|
"vite-svg-loader": "^4.0.0",
|
|
74
|
-
"vue": "^3.2.
|
|
75
|
+
"vue": "^3.2.47",
|
|
75
76
|
"vue-router": "^4.1.6",
|
|
76
77
|
"vueperslides": "^3.5.1",
|
|
77
78
|
"vuex": "^4.1.0"
|
|
@@ -119,7 +119,9 @@ component(
|
|
|
119
119
|
|
|
120
120
|
<script>
|
|
121
121
|
/**
|
|
122
|
-
* @todo
|
|
122
|
+
* @todo
|
|
123
|
+
* - Share the common parts between w-input, w-textarea & w-select.
|
|
124
|
+
* - option to fit to the content using contenteditable div
|
|
123
125
|
**/
|
|
124
126
|
|
|
125
127
|
import FormElementMixin from '../mixins/form-elements'
|
|
@@ -581,6 +583,7 @@ $inactive-color: #777;
|
|
|
581
583
|
top: 50%;
|
|
582
584
|
left: 0;
|
|
583
585
|
padding-left: 2 * $base-increment;
|
|
586
|
+
white-space: nowrap;
|
|
584
587
|
transform: translateY(-50%);
|
|
585
588
|
pointer-events: none;
|
|
586
589
|
|
|
@@ -348,7 +348,10 @@ export default {
|
|
|
348
348
|
if (!this.isMultipleSelect) this.listItems.forEach(item => (item._selected = false))
|
|
349
349
|
|
|
350
350
|
this.checkSelection(selection) // Create an array with the selected values.
|
|
351
|
-
.forEach(val =>
|
|
351
|
+
.forEach(val => {
|
|
352
|
+
const foundItem = this.listItems.find(item => item._value === val)
|
|
353
|
+
if (foundItem) foundItem._selected = true
|
|
354
|
+
})
|
|
352
355
|
}
|
|
353
356
|
},
|
|
354
357
|
|
|
@@ -40,21 +40,19 @@ component(
|
|
|
40
40
|
.w-select__selection-slot(v-if="$slots.selection")
|
|
41
41
|
//- inputValue is always an array.
|
|
42
42
|
slot(name="selection" :item="multiple ? inputValue : inputValue[0]")
|
|
43
|
-
|
|
43
|
+
.w-select__selection(
|
|
44
44
|
ref="selection-input"
|
|
45
|
-
|
|
46
|
-
:value="$slots.selection ? '' : selectionString"
|
|
45
|
+
:contenteditable="isDisabled || isReadonly ? 'false' : 'true'"
|
|
47
46
|
@focus="!isDisabled && !isReadonly && onFocus($event)"
|
|
48
47
|
@blur="onBlur"
|
|
49
48
|
@keydown="!isDisabled && !isReadonly && onKeydown($event)"
|
|
50
49
|
:id="`w-select--${_.uid}`"
|
|
51
|
-
:
|
|
50
|
+
:class="{ 'w-select__selection--placeholder': !$slots.selection && !selectionString && placeholder }"
|
|
52
51
|
:disabled="isDisabled || null"
|
|
53
52
|
readonly
|
|
54
53
|
aria-readonly="true"
|
|
55
|
-
:required="required || null"
|
|
56
54
|
:tabindex="tabindex || null"
|
|
57
|
-
|
|
55
|
+
v-html="$slots.selection ? '' : selectionString || placeholder")
|
|
58
56
|
//- For standard HTML form submission.
|
|
59
57
|
input(
|
|
60
58
|
v-for="(val, i) in (inputValue.length ? inputValue : [{}])"
|
|
@@ -149,7 +147,8 @@ export default {
|
|
|
149
147
|
noUnselect: { type: Boolean },
|
|
150
148
|
menuProps: { type: Object }, // Allow passing down an object of props to the w-menu component.
|
|
151
149
|
dark: { type: Boolean },
|
|
152
|
-
light: { type: Boolean }
|
|
150
|
+
light: { type: Boolean },
|
|
151
|
+
fitToContent: { type: Boolean }
|
|
153
152
|
// Props from mixin: name, disabled, readonly, required, tabindex, validators.
|
|
154
153
|
// Computed from mixin: inputName, isDisabled & isReadonly.
|
|
155
154
|
},
|
|
@@ -200,6 +199,7 @@ export default {
|
|
|
200
199
|
'w-select--dark': this.dark,
|
|
201
200
|
'w-select--light': this.light,
|
|
202
201
|
'w-select--disabled': this.isDisabled,
|
|
202
|
+
'w-select--fit-to-content': this.fitToContent,
|
|
203
203
|
'w-select--readonly': this.isReadonly,
|
|
204
204
|
[`w-select--${this.hasValue ? 'filled' : 'empty'}`]: true,
|
|
205
205
|
'w-select--focused': (this.isFocused || this.showMenu) && !this.isReadonly,
|
|
@@ -230,6 +230,7 @@ export default {
|
|
|
230
230
|
onFocus (e) {
|
|
231
231
|
this.isFocused = true
|
|
232
232
|
this.$emit('focus', e)
|
|
233
|
+
return false
|
|
233
234
|
},
|
|
234
235
|
|
|
235
236
|
onBlur (e) {
|
|
@@ -238,6 +239,11 @@ export default {
|
|
|
238
239
|
},
|
|
239
240
|
|
|
240
241
|
onKeydown (e) {
|
|
242
|
+
// Forbid typing in contenteditable element.
|
|
243
|
+
// Note: using contenteditable rather than input in order to be able to fit the select list
|
|
244
|
+
// to its content with CSS. Only contenteditable divs/non-interactive elements can react to focus/blur ).
|
|
245
|
+
e.preventDefault()
|
|
246
|
+
|
|
241
247
|
if ([13, 27, 38, 40].includes(e.keyCode)) e.preventDefault()
|
|
242
248
|
|
|
243
249
|
if (e.keyCode === 27) this.closeMenu() // Escape.
|
|
@@ -300,7 +306,6 @@ export default {
|
|
|
300
306
|
// Also accept objects if returnObject is true.
|
|
301
307
|
// In any case, always end up with an array.
|
|
302
308
|
checkSelection (items) {
|
|
303
|
-
console.log(items)
|
|
304
309
|
items = Array.isArray(items) ? items : (items !== undefined ? [items] : [])
|
|
305
310
|
// `selectItems` items always have a value.
|
|
306
311
|
const allValues = this.selectItems.map(item => item.value)
|
|
@@ -368,6 +373,11 @@ export default {
|
|
|
368
373
|
-webkit-tap-highlight-color: transparent;
|
|
369
374
|
}
|
|
370
375
|
|
|
376
|
+
&--fit-to-content {
|
|
377
|
+
display: inline-flex;
|
|
378
|
+
flex-grow: 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
371
381
|
// Selection wrapper.
|
|
372
382
|
// ------------------------------------------------------
|
|
373
383
|
&__selection-wrap {
|
|
@@ -423,21 +433,21 @@ export default {
|
|
|
423
433
|
}
|
|
424
434
|
}
|
|
425
435
|
|
|
426
|
-
//
|
|
436
|
+
// Selection (contenteditable) field.
|
|
437
|
+
// Using contenteditable instead of readonly input in order to be able to fit to content.
|
|
438
|
+
// Then disable typing and hide caret.
|
|
427
439
|
// ------------------------------------------------------
|
|
428
440
|
&__selection {
|
|
429
441
|
width: 100%;
|
|
430
442
|
height: 100%;
|
|
431
443
|
min-height: inherit;
|
|
432
|
-
font: inherit;
|
|
433
|
-
color: inherit;
|
|
434
|
-
text-align: inherit;
|
|
435
|
-
background: none;
|
|
436
|
-
border: none;
|
|
437
444
|
outline: none;
|
|
438
445
|
padding-left: 2 * $base-increment;
|
|
439
446
|
padding-right: 2 * $base-increment;
|
|
447
|
+
display: flex;
|
|
448
|
+
align-items: center;
|
|
440
449
|
cursor: pointer;
|
|
450
|
+
caret-color: transparent;
|
|
441
451
|
|
|
442
452
|
.w-select__selection-slot + & {
|
|
443
453
|
position: absolute;
|
|
@@ -463,9 +473,9 @@ export default {
|
|
|
463
473
|
-webkit-tap-highlight-color: transparent;
|
|
464
474
|
}
|
|
465
475
|
|
|
466
|
-
.w-select--disabled input::placeholder {color: inherit;}
|
|
467
|
-
|
|
468
476
|
.w-select--readonly & {cursor: auto;}
|
|
477
|
+
|
|
478
|
+
&--placeholder {color: #888;}
|
|
469
479
|
}
|
|
470
480
|
|
|
471
481
|
&__selection-slot {
|
|
@@ -529,6 +539,7 @@ export default {
|
|
|
529
539
|
top: 50%;
|
|
530
540
|
left: 0;
|
|
531
541
|
right: 0;
|
|
542
|
+
white-space: nowrap;
|
|
532
543
|
// Use margin instead of padding as the scale transformation below decreases the real padding
|
|
533
544
|
// size and misaligns the label.
|
|
534
545
|
margin-left: 2 * $base-increment;
|
|
@@ -78,6 +78,7 @@ export default {
|
|
|
78
78
|
counts: { type: Boolean },
|
|
79
79
|
itemIconKey: { type: String, default: 'icon' }, // Support a different icon per item.
|
|
80
80
|
iconColor: { type: String }, // Applies a color on all the label item icons.
|
|
81
|
+
itemLabelKey: { type: String, default: 'label' }, // Specify a different key for the item label.
|
|
81
82
|
itemIconColorKey: { type: String, default: 'iconColor' }, // Applies a specific color on each label item icons.
|
|
82
83
|
itemRouteKey: { type: String, default: 'route' }, // Uses a router link if the item has the `route` key.
|
|
83
84
|
itemDisabledKey: { type: String, default: 'disabled' }, // Disables the item click and selection.
|
|
@@ -117,7 +118,7 @@ export default {
|
|
|
117
118
|
this.currentDepthItems.push({
|
|
118
119
|
originalItem: item, // Store the original item to return it on event emits.
|
|
119
120
|
_uid: this.depth.toString() + (i + 1),
|
|
120
|
-
label: item.
|
|
121
|
+
label: item[this.itemLabelKey],
|
|
121
122
|
children: !!item.children, // The children tree remains available in originalItem.
|
|
122
123
|
branch: item.branch,
|
|
123
124
|
route: item[this.itemRouteKey],
|
package/src/wave-ui/core.js
CHANGED
|
@@ -103,7 +103,6 @@ export default class WaveUI {
|
|
|
103
103
|
const wApp = document.querySelector(config.on) || document.body
|
|
104
104
|
wApp.classList.add('w-app')
|
|
105
105
|
|
|
106
|
-
let themeColors = config.colors[config.theme]
|
|
107
106
|
if (config.theme === 'auto') detectOSDarkMode($waveui) // Also switches the theme.
|
|
108
107
|
else $waveui.switchTheme(config.theme, true)
|
|
109
108
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
--w-base-color-rgb: #{map.get($theme-light, 'base-color-rgb')};
|
|
16
16
|
--w-contrast-bg-color-rgb: #{map.get($theme-light, 'contrast-bg-color-rgb')};
|
|
17
17
|
--w-contrast-color-rgb: #{map.get($theme-light, 'contrast-color-rgb')};
|
|
18
|
+
--w-caption-color-rgb: #{map.get($theme-light, 'caption-color-rgb')};
|
|
18
19
|
--w-disabled-color-rgb: #{map.get($theme-light, 'disabled-color-rgb')};
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
--w-base-color-rgb: #{map.get($theme-dark, 'base-color-rgb')};
|
|
24
25
|
--w-contrast-bg-color-rgb: #{map.get($theme-dark, 'contrast-bg-color-rgb')};
|
|
25
26
|
--w-contrast-color-rgb: #{map.get($theme-dark, 'contrast-color-rgb')};
|
|
27
|
+
--w-caption-color-rgb: #{map.get($theme-dark, 'caption-color-rgb')};
|
|
26
28
|
--w-disabled-color-rgb: #{map.get($theme-dark, 'disabled-color-rgb')};
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -14,6 +14,7 @@ $theme-light: (
|
|
|
14
14
|
base-color-rgb: (0, 0, 0), // #000.
|
|
15
15
|
contrast-bg-color-rgb: (0, 0, 0), // #000.
|
|
16
16
|
contrast-color-rgb: (255, 255, 255), // #fff.
|
|
17
|
+
caption-color-rgb: (80, 80, 80, 0.7), // #505050.
|
|
17
18
|
disabled-color-rgb: (204, 204, 204), // #ccc.
|
|
18
19
|
) !default;
|
|
19
20
|
|
|
@@ -22,6 +23,7 @@ $theme-dark: (
|
|
|
22
23
|
base-color-rgb: (255, 255, 255), // #fff.
|
|
23
24
|
contrast-bg-color-rgb: (255, 255, 255), // #fff.
|
|
24
25
|
contrast-color-rgb: (0, 0, 0), // #000.
|
|
26
|
+
caption-color-rgb: (175, 175, 175, 0.7), // #afafaf.
|
|
25
27
|
disabled-color-rgb: (74, 74, 74), // #4a4a4a.
|
|
26
28
|
) !default;
|
|
27
29
|
|
|
@@ -32,6 +34,7 @@ $base-bg-color: rgb(var(--w-base-bg-color-rgb));
|
|
|
32
34
|
$base-color: rgb(var(--w-base-color-rgb));
|
|
33
35
|
$contrast-bg-color: rgb(var(--w-contrast-bg-color-rgb));
|
|
34
36
|
$contrast-color: rgb(var(--w-contrast-color-rgb));
|
|
37
|
+
$caption-color: rgb(var(--w-caption-color-rgb));
|
|
35
38
|
// When a form element is disabled (checkbox, radio, input, select list).
|
|
36
39
|
$disabled-color: rgb(var(--w-disabled-color-rgb));
|
|
37
40
|
|