wave-ui 3.5.0 → 3.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
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",
@@ -6,6 +6,8 @@ component(v-if="tooltip" is="w-tooltip" v-bind="tooltipProps || {}")
6
6
  div(v-html="tooltip")
7
7
  button-partial(v-else v-bind="buttonProps")
8
8
  slot
9
+ template(#loading)
10
+ slot(name="loading")
9
11
  </template>
10
12
 
11
13
  <script>
@@ -150,13 +150,10 @@ $inactive-color: #666;
150
150
  vertical-align: middle;
151
151
  // Contain the hidden radio button, so browser doesn't pan to it when outside of the screen.
152
152
  position: relative;
153
- cursor: pointer;
154
153
  -webkit-tap-highlight-color: transparent;
155
154
 
156
155
  @include themeable;
157
156
 
158
- &--disabled {cursor: not-allowed;}
159
-
160
157
  // The hidden real checkbox.
161
158
  input[type="checkbox"] {
162
159
  position: absolute;
@@ -174,8 +171,10 @@ $inactive-color: #666;
174
171
  flex: 0 0 auto; // Prevent stretching width or height.
175
172
  align-items: center;
176
173
  justify-content: center;
177
- cursor: inherit;
174
+ cursor: pointer;
178
175
  z-index: 0;
176
+
177
+ .w-checkbox--disabled & {cursor: not-allowed;}
179
178
  }
180
179
 
181
180
  // The checkmark - visible when checked.
@@ -270,10 +269,13 @@ $inactive-color: #666;
270
269
  &__label {
271
270
  display: flex;
272
271
  align-items: center;
273
- cursor: inherit;
272
+ cursor: pointer;
274
273
  user-select: none;
275
274
 
276
- .w-checkbox--disabled & {opacity: 0.7;}
275
+ .w-checkbox--disabled & {
276
+ cursor: not-allowed;
277
+ opacity: 0.7;
278
+ }
277
279
  }
278
280
  }
279
281
 
@@ -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"
@@ -77,7 +77,7 @@ component(
77
77
  @update:model-value="onInput"
78
78
  @item-click="$emit('item-click', $event)"
79
79
  @item-select="onListItemSelect"
80
- @keydown:enter="noUnselect && !multiple && closeMenu('la3')"
80
+ @keydown:enter="noUnselect && !multiple && closeMenu()"
81
81
  @keydown:escape="showMenu && (this.showMenu = false) /* Will call closeMenu() from w-menu(@close). */"
82
82
  :items="selectItems"
83
83
  :multiple="multiple"
@@ -252,8 +252,8 @@ export default {
252
252
  // still allow meta key & ctrl key combinations and the tab key (9).
253
253
  if (!e.metaKey && !e.ctrlKey && e.keyCode !== 9) e.preventDefault()
254
254
 
255
- if (e.keyCode === 27 && this.showMenu) this.closeMenu('la5') // Escape.
256
- else if (e.keyCode === 13) this.openMenu() // Enter.
255
+ if (e.keyCode === 27 && this.showMenu) this.closeMenu() // Escape.
256
+ else if ([13, 32].includes(e.keyCode)) this.openMenu() // Enter or Space.
257
257
 
258
258
  // Up & down arrows.
259
259
  else if ([38, 40].includes(e.keyCode)) {
@@ -322,7 +322,7 @@ export default {
322
322
 
323
323
  return items.map(item => {
324
324
  let value = item
325
- if (typeof item === 'object') {
325
+ if (item && typeof item === 'object') { // `null` is also an object!
326
326
  value = item[this.itemValueKey] !== undefined ? item[this.itemValueKey] : (item[this.itemLabelKey] !== undefined ? item[this.itemLabelKey] : item)
327
327
  }
328
328
 
@@ -67,7 +67,7 @@ export default {
67
67
  .w-toolbar {
68
68
  position: relative;
69
69
  display: flex;
70
- flex: 1 1 auto;
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
 
@@ -1,8 +1,9 @@
1
1
  import { reactive, inject } from 'vue'
2
2
  import { mergeConfig } from './utils/config'
3
- import { injectNotifManagerInDOM, NotificationManager } from './utils/notification-manager'
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
- component.props[preset].default = presets[preset]
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
 
@@ -1,4 +1,3 @@
1
- @import './variables';
2
1
  @import './base';
3
2
  @import './typography';
4
3
  @import './layout';