wave-ui 3.19.0 → 3.21.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.
Files changed (77) hide show
  1. package/dist/types/$waveui.d.ts +2 -2
  2. package/dist/types/components/WAccordion.d.ts +2 -2
  3. package/dist/types/components/WAlert.d.ts +2 -2
  4. package/dist/types/components/WApp.d.ts +3 -4
  5. package/dist/types/components/WBadge.d.ts +3 -4
  6. package/dist/types/components/WBreadcrumbs.d.ts +3 -4
  7. package/dist/types/components/WButton.d.ts +3 -4
  8. package/dist/types/components/WCard.d.ts +3 -4
  9. package/dist/types/components/WCheckbox.d.ts +2 -2
  10. package/dist/types/components/WCheckboxes.d.ts +2 -2
  11. package/dist/types/components/WConfirm.d.ts +2 -2
  12. package/dist/types/components/WDialog.d.ts +2 -2
  13. package/dist/types/components/WDivider.d.ts +3 -4
  14. package/dist/types/components/WDrawer.d.ts +5 -5
  15. package/dist/types/components/WFlex.d.ts +3 -4
  16. package/dist/types/components/WForm.d.ts +2 -2
  17. package/dist/types/components/WFormElement.d.ts +2 -2
  18. package/dist/types/components/WGrid.d.ts +3 -4
  19. package/dist/types/components/WIcon.d.ts +3 -4
  20. package/dist/types/components/WImage.d.ts +2 -2
  21. package/dist/types/components/WInput.d.ts +2 -2
  22. package/dist/types/components/WList.d.ts +2 -2
  23. package/dist/types/components/WMenu.d.ts +2 -2
  24. package/dist/types/components/WNotification.d.ts +2 -2
  25. package/dist/types/components/WNotificationManager.d.ts +4 -6
  26. package/dist/types/components/WOverlay.d.ts +2 -2
  27. package/dist/types/components/WProgress.d.ts +3 -4
  28. package/dist/types/components/WRadio.d.ts +2 -2
  29. package/dist/types/components/WRadios.d.ts +2 -2
  30. package/dist/types/components/WRating.d.ts +2 -2
  31. package/dist/types/components/WSelect.d.ts +4 -4
  32. package/dist/types/components/WSlider.d.ts +2 -2
  33. package/dist/types/components/WSpinner.d.ts +3 -4
  34. package/dist/types/components/WSteps.d.ts +3 -4
  35. package/dist/types/components/WSwitch.d.ts +2 -2
  36. package/dist/types/components/WTable.d.ts +2 -2
  37. package/dist/types/components/WTabs.d.ts +2 -2
  38. package/dist/types/components/WTag.d.ts +2 -2
  39. package/dist/types/components/WTextarea.d.ts +2 -2
  40. package/dist/types/components/WTimeline.d.ts +3 -4
  41. package/dist/types/components/WToolbar.d.ts +3 -4
  42. package/dist/types/components/WTooltip.d.ts +2 -2
  43. package/dist/types/components/WTree.d.ts +2 -2
  44. package/dist/types/extra-vue-types.d.ts +1 -1
  45. package/dist/types/plugin.d.ts +2 -2
  46. package/dist/wave-ui.cjs.js +1 -1
  47. package/dist/wave-ui.css +1 -1
  48. package/dist/wave-ui.es.js +1215 -1212
  49. package/dist/wave-ui.umd.js +1 -1
  50. package/package.json +25 -30
  51. package/src/wave-ui/components/transitions/w-transition-expand.vue +3 -3
  52. package/src/wave-ui/components/w-autocomplete.vue +3 -3
  53. package/src/wave-ui/components/w-badge.vue +2 -2
  54. package/src/wave-ui/components/w-card.vue +2 -2
  55. package/src/wave-ui/components/w-checkboxes.vue +1 -1
  56. package/src/wave-ui/components/w-icon.vue +1 -1
  57. package/src/wave-ui/components/w-image.vue +1 -1
  58. package/src/wave-ui/components/w-input.vue +2 -2
  59. package/src/wave-ui/components/w-list.vue +2 -2
  60. package/src/wave-ui/components/w-menu.vue +13 -5
  61. package/src/wave-ui/components/w-scrollable.vue +184 -174
  62. package/src/wave-ui/components/w-table.vue +7 -7
  63. package/src/wave-ui/components/w-tabs/index.vue +2 -2
  64. package/src/wave-ui/components/w-textarea.vue +1 -1
  65. package/src/wave-ui/components/w-toolbar.vue +2 -2
  66. package/src/wave-ui/components/w-tooltip.vue +1 -1
  67. package/src/wave-ui/components/w-tree.vue +1 -1
  68. package/src/wave-ui/core.js +25 -5
  69. package/src/wave-ui/index.d.ts +1 -1
  70. package/src/wave-ui/mixins/detachable.js +1 -1
  71. package/src/wave-ui/scss/_base.scss +10 -0
  72. package/src/wave-ui/scss/_colors.scss +7 -0
  73. package/src/wave-ui/scss/_layout.scss +9 -0
  74. package/src/wave-ui/scss/variables/_variables.scss +7 -0
  75. package/src/wave-ui/utils/colors.js +5 -5
  76. package/src/wave-ui/utils/dynamic-css.js +2 -2
  77. package/src/wave-ui/utils/notification-manager.js +1 -1
@@ -262,7 +262,7 @@ export default {
262
262
  type: [Boolean, Object, String],
263
263
  validator: object => {
264
264
  if (!object) return true // Accept any falsy value.
265
- else if (typeof object === 'object' && (!object.itemsPerPage || (object.page && isNaN(object.page)))) {
265
+ if (typeof object === 'object' && (!object.itemsPerPage || (object.page && isNaN(object.page)))) {
266
266
  consoleError(
267
267
  'Wrong pagination config received in the w-table\'s `pagination` prop (received: `' + JSON.stringify(object) + '`). ' +
268
268
  '\nExpected object: { itemsPerPage: Integer, page: Integer } or { itemsPerPage: Integer, start: Integer }.'
@@ -539,8 +539,8 @@ export default {
539
539
  const newNextColWidth = nextColWidth - deltaX
540
540
 
541
541
  // 1. Apply the change of width.
542
- columnEl.style.width = colWidth + deltaX + 'px'
543
- nextColumnEl.style.width = nextColWidth - deltaX + 'px'
542
+ columnEl.style.width = `${colWidth + deltaX}px`
543
+ nextColumnEl.style.width = `${nextColWidth - deltaX}px`
544
544
 
545
545
  // 2. Check if we went too far (the width applied is different than the browser-computed one).
546
546
  const minWidthReached = (deltaX < 0 && columnEl.offsetWidth > newColWidth) ||
@@ -551,13 +551,13 @@ export default {
551
551
  // Make sure we don't shrink enough to push other left cells.
552
552
  if (minWidthReached) {
553
553
  const newWidth = Math.max(columnEl.offsetWidth, minColumnWidth)
554
- columnEl.style.width = newWidth + 'px'
555
- nextColumnEl.style.width = maxWidth - newWidth + 'px'
554
+ columnEl.style.width = `${newWidth}px`
555
+ nextColumnEl.style.width = `${maxWidth - newWidth}px`
556
556
  }
557
557
  // Make sure we don't grow enough to push other right cells.
558
558
  else if (maxWidthReached) {
559
- columnEl.style.width = maxWidth - nextColumnEl.offsetWidth + 'px'
560
- nextColumnEl.style.width = nextColumnEl.offsetWidth + 'px'
559
+ columnEl.style.width = `${maxWidth - nextColumnEl.offsetWidth}px`
560
+ nextColumnEl.style.width = `${nextColumnEl.offsetWidth}px`
561
561
  }
562
562
  },
563
563
 
@@ -257,7 +257,7 @@ export default {
257
257
  updateSlider (domLookup = true) {
258
258
  if (domLookup) {
259
259
  const ref = this.$refs['tabs-bar']
260
- this.activeTabEl = ref && ref.querySelector('.w-tabs__bar-item--active')
260
+ this.activeTabEl = ref?.querySelector('.w-tabs__bar-item--active')
261
261
  }
262
262
 
263
263
  if (!this.fillBar && this.activeTabEl) {
@@ -285,7 +285,7 @@ export default {
285
285
  // Scroll the new active tab item title into view if needed.
286
286
  this.$nextTick(() => {
287
287
  const ref = this.$refs['tabs-bar']
288
- this.activeTabEl = ref && ref.querySelector(`.w-tabs__bar-item:nth-child(${index + 1})`)
288
+ this.activeTabEl = ref?.querySelector(`.w-tabs__bar-item:nth-child(${index + 1})`)
289
289
  if (this.activeTabEl) {
290
290
  this.activeTabEl.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' })
291
291
  }
@@ -191,7 +191,7 @@ export default {
191
191
  this.$refs.textarea.style.height = ''
192
192
  const linesCount = (this.$refs.textarea.scrollHeight - this.paddingY) / this.lineHeight
193
193
  const height = Math.max(linesCount, this.rows) * this.lineHeight + this.paddingY
194
- this.$refs.textarea.style.height = height + 'px'
194
+ this.$refs.textarea.style.height = `${height}px`
195
195
  },
196
196
  getLineHeight () {
197
197
  const computedStyles = window.getComputedStyle(this.$refs.textarea, null)
@@ -31,13 +31,13 @@ export default {
31
31
  toolbarHeight () {
32
32
  const h = this.height
33
33
  // If a number is passed without units, append `px`.
34
- return h && parseInt(h) == h ? h + 'px' : h
34
+ return h && parseInt(h) === h ? `${h}px` : h
35
35
  },
36
36
  // Return the width value if defined, or false otherwise.
37
37
  toolbarWidth () {
38
38
  const w = this.width
39
39
  // If a number is passed without units, append `px`.
40
- return w && parseInt(w) == w ? w + 'px' : w
40
+ return w && parseInt(w) === w ? `${w}px` : w
41
41
  },
42
42
  classes () {
43
43
  return {
@@ -136,7 +136,7 @@ export default {
136
136
  this.hoveringActivator = true
137
137
  this.open(e)
138
138
  },
139
- mouseleave: e => {
139
+ mouseleave: () => {
140
140
  this.hoveringActivator = false
141
141
  this.close()
142
142
  }
@@ -295,7 +295,7 @@ export default {
295
295
  },
296
296
 
297
297
  focusTreeItem (liNode) {
298
- liNode && liNode.querySelector('.w-tree__item-label').focus()
298
+ liNode?.querySelector('.w-tree__item-label').focus()
299
299
  },
300
300
 
301
301
  itemIcon (item) {
@@ -45,7 +45,6 @@ const injectPresets = (component, presets) => {
45
45
 
46
46
  // If the given prop (= preset) is still not found in the mixins props raise warning.
47
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
48
  }
50
49
  }
51
50
 
@@ -74,19 +73,40 @@ export default class WaveUI {
74
73
  theme: null, // The current theme (light or dark).
75
74
  _notificationManager: null,
76
75
 
77
- // Callable from this.$waveui.
76
+ /**
77
+ * Notify the user. (Callable from this.$waveui)
78
+ *
79
+ * @param {...any} args - The arguments to pass to the notification manager.
80
+ */
78
81
  notify (...args) {
79
82
  this._notificationManager.notify(...args)
80
83
  },
81
84
 
82
- // Callable from this.$waveui.
83
- switchTheme (theme, skipFlatten = false) {
85
+ /**
86
+ * Switch the theme. (Callable from this.$waveui)
87
+ *
88
+ * @param {string} theme - The theme to switch to.
89
+ */
90
+ switchTheme (theme) {
84
91
  this.theme = theme
85
92
  document.documentElement.setAttribute('data-theme', theme)
86
93
  document.head.querySelector('#wave-ui-colors')?.remove?.()
87
94
  const themeColors = this.config.colors[this.theme]
88
95
  injectColorsCSSInDOM(themeColors, this.config.css.colorShadeCssVariables)
89
96
  this.colors = flattenColors(themeColors, colorPalette)
97
+ },
98
+
99
+ /**
100
+ * Set the classes of the app element. (Callable from this.$waveui)
101
+ *
102
+ * @param {string} classes - The classes to set.
103
+ */
104
+ setAppClasses (...classes) {
105
+ const wApp = document.querySelector('.w-app')
106
+ if (wApp) {
107
+ wApp.className = 'w-app' // First reset the classes.
108
+ wApp.classList.add(...classes)
109
+ }
90
110
  }
91
111
  }
92
112
 
@@ -134,7 +154,7 @@ export default class WaveUI {
134
154
  injectNotifManagerInDOM(app)
135
155
 
136
156
  // This mixin must only run once, we can delete it.
137
- app._context.mixins.find(mixin => mixin.mounted && delete mixin.mounted)
157
+ app._context.mixins.find(mixin => mixin.mounted && (mixin.mounted = undefined))
138
158
  }
139
159
  }
140
160
  })
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/ban-types */
2
2
  declare module 'wave-ui/src/wave-ui' {
3
- import { App } from 'vue'
3
+ import type { App } from 'vue'
4
4
 
5
5
  import type { $waveui } from '@/types/$waveui'
6
6
  import type { ConstructorOptions } from '@/types/plugin'
@@ -306,7 +306,7 @@ export default {
306
306
  removeFromDOM () {
307
307
  document.removeEventListener('mousedown', this.onOutsideMousedown)
308
308
  window.removeEventListener('resize', this.onResize)
309
- if (this.detachableEl && this.detachableEl.parentNode) {
309
+ if (this.detachableEl?.parentNode) {
310
310
  this.detachableVisible = false
311
311
  this.detachableEl.remove()
312
312
  this.detachableEl = null
@@ -6,6 +6,16 @@
6
6
  :root {
7
7
  --w-base-increment: #{$base-increment};
8
8
  --w-css-scope: #{$css-scope};
9
+ --w-contrast-bg-o05-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 5%, transparent)};
10
+ --w-contrast-bg-o1-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 10%, transparent)};
11
+ --w-contrast-bg-o2-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 20%, transparent)};
12
+ --w-contrast-bg-o3-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 30%, transparent)};
13
+ --w-contrast-bg-o4-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 40%, transparent)};
14
+ --w-contrast-bg-o5-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 50%, transparent)};
15
+ --w-contrast-bg-o6-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 60%, transparent)};
16
+ --w-contrast-bg-o7-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 70%, transparent)};
17
+ --w-contrast-bg-o8-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 80%, transparent)};
18
+ --w-contrast-bg-o9-color: #{color-mix(in srgb, var(--w-contrast-bg-color) 90%, transparent)};
9
19
 
10
20
  background-color: var(--w-base-bg-color);
11
21
  color: var(--w-base-color);
@@ -126,6 +126,13 @@
126
126
  .base-color--bg {background-color: var(--w-base-bg-color);}
127
127
  .contrast-color {color: color-mix(in srgb, var(--w-contrast-color) 75%, transparent);}
128
128
  .contrast-color--bg {background-color: var(--w-contrast-bg-color);}
129
+
130
+ .contrast-o05 {color: var(--w-contrast-bg-o05-color);}
131
+ .contrast-o05--bg {background-color: var(--w-contrast-bg-o05-color);}
132
+ @for $i from 1 through 9 {
133
+ .contrast-o#{$i} {color: var(--w-contrast-bg-o#{$i}-color);}
134
+ .contrast-o#{$i}--bg {background-color: var(--w-contrast-bg-o#{$i}-color);}
135
+ }
129
136
  // ------------------------------------------------------
130
137
 
131
138
  // Status colors - must stay last and have highest priority.
@@ -52,6 +52,15 @@
52
52
  .d-iflex {display: inline-flex;}
53
53
  .d-block {display: block;}
54
54
  .d-iblock {display: inline-block;}
55
+
56
+ .ovh {overflow: hidden;}
57
+ .ovv {overflow: visible;}
58
+ .ova {overflow: auto;}
59
+
60
+ .op05 {opacity: 0.05;}
61
+ @for $i from 0 through 9 {
62
+ .op#{$i} {opacity: $i * 0.1;}
63
+ }
55
64
  // ----------------------------------------------
56
65
 
57
66
  // Borders (from 0 to 6), radii (from 0 to 6 + `m` for max).
@@ -148,3 +148,10 @@ $tooltip-bg-color: $detachable-bg-color !default;
148
148
  $tooltip-color: $detachable-color !default;
149
149
  $tooltip-border-color: $border-color !default;
150
150
  // --------------------------------------------------------
151
+
152
+ // w-scrollable.
153
+ // --------------------------------------------------------
154
+ $scrollbar-size: 8px !default;
155
+ $scrollbar-bg-color: color-mix(in srgb, var(--w-contrast-bg-color) 8%, var(--w-base-bg-color)) !default;
156
+ $scrollbar-thumb-color: color-mix(in srgb, var(--w-contrast-bg-color) 25%, var(--w-base-bg-color)) !default;
157
+ // --------------------------------------------------------
@@ -20,7 +20,7 @@ export const generateColorShades = config => {
20
20
  const color = { label, color: (themeOfColors[label]?.color ?? themeOfColors[label])?.replace?.('#', '') }
21
21
  const col = color.color
22
22
  if (!col) continue // Don't break if a color is only set for one of the themes.
23
- if (col.length === 3) color.color = col[0] + '' + col[0] + col[1] + col[1] + col[2] + col[2]
23
+ if (col.length === 3) color.color = `${col[0]}${col[0]}${col[1]}${col[1]}${col[2]}${col[2]}`
24
24
 
25
25
  for (let i = 1; i <= 6; i++) {
26
26
  const lighterColor = lighten(`#${color.color}`, i * (colorInfo?.lightIncrement ?? 16) + (colorInfo?.lightOffset ?? 0))
@@ -205,12 +205,12 @@ export function mixColors (color1, color2, weight = 50) {
205
205
  const red = clamp(Math.round(c1.red * c1Weight + c2.red * c2Weight), 0, 255)
206
206
  const green = clamp(Math.round(c1.green * c1Weight + c2.green * c2Weight), 0, 255)
207
207
  const blue = clamp(Math.round(c1.blue * c1Weight + c2.blue * c2Weight), 0, 255)
208
-
209
208
  const alpha = c1.alpha * percentage + c2.alpha * (1 - percentage)
210
209
 
211
- return c1.hasAlpha || c2.hasAlpha || alpha !== 1
212
- ? hexFromRGB(red, green, blue, alpha)
213
- : hexFromRGB(red, green, blue)
210
+ const channels = [red, green, blue]
211
+ if (c1.hasAlpha || c2.hasAlpha || alpha !== 1) channels.push(alpha)
212
+
213
+ return hexFromRGB(...channels)
214
214
  }
215
215
 
216
216
  /**
@@ -1,5 +1,5 @@
1
- // Defaults CSS variables. Will be overridden in the main function of this file (the export default)
2
- // which fetches the CSS :root variables generated by _layout.scss.
1
+ // Defaults CSS variables. Will be overridden in the doDynamicCSS() function
2
+ // which fetches the CSS :root variables generated by _base.scss.
3
3
  const cssVars = {
4
4
  cssScope: '.w-app',
5
5
  baseIncrement: 4
@@ -4,7 +4,7 @@ import WNotificationManager from '../components/w-notification-manager.vue'
4
4
  export class NotificationManager {
5
5
  static #instance
6
6
  notifications
7
- // Private fields.
7
+ // Private fields.
8
8
  _uid // A unique ID for each notification.
9
9
  _notificationDefaults
10
10