wave-ui 3.28.0 → 4.0.1

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 (93) hide show
  1. package/dist/.nojekyll +0 -0
  2. package/dist/types/types/$waveui.d.ts +15 -1
  3. package/dist/types/types/colors.d.ts +2 -0
  4. package/dist/types/types/components/WAccordion.d.ts +92 -6
  5. package/dist/types/types/components/WAutocomplete.d.ts +437 -0
  6. package/dist/types/types/components/WCheckbox.d.ts +34 -0
  7. package/dist/types/types/components/WCheckboxes.d.ts +30 -0
  8. package/dist/types/types/components/WInput.d.ts +34 -0
  9. package/dist/types/types/components/WMenu.d.ts +14 -7
  10. package/dist/types/types/components/WRadio.d.ts +34 -0
  11. package/dist/types/types/components/WRadios.d.ts +30 -0
  12. package/dist/types/types/components/WSelect.d.ts +34 -0
  13. package/dist/types/types/components/WSwitch.d.ts +34 -0
  14. package/dist/types/types/components/WTable.d.ts +7 -0
  15. package/dist/types/types/components/WTooltip.d.ts +22 -8
  16. package/dist/types/types/components/WTransitions.d.ts +104 -0
  17. package/dist/types/types/components/WTransitions.js +2 -0
  18. package/dist/types/types/components/WTree.d.ts +7 -0
  19. package/dist/types/types/components/index.d.ts +2 -1
  20. package/dist/types/types/index.d.ts +1 -0
  21. package/dist/types/types/mixins/detachable.d.ts +7 -0
  22. package/dist/types/types/mixins/detachable.js +2 -0
  23. package/dist/wave-ui.cjs.js +3 -3
  24. package/dist/wave-ui.css +1 -1
  25. package/dist/wave-ui.esm.js +1743 -1365
  26. package/dist/wave-ui.umd.js +3 -3
  27. package/package.json +1 -1
  28. package/src/wave-ui/components/index.js +0 -1
  29. package/src/wave-ui/components/transitions/w-transition-bounce.vue +2 -1
  30. package/src/wave-ui/components/transitions/w-transition-expand.vue +3 -2
  31. package/src/wave-ui/components/transitions/w-transition-fade.vue +2 -1
  32. package/src/wave-ui/components/transitions/w-transition-scale-fade.vue +2 -1
  33. package/src/wave-ui/components/transitions/w-transition-scale.vue +2 -1
  34. package/src/wave-ui/components/transitions/w-transition-slide-fade.vue +2 -1
  35. package/src/wave-ui/components/transitions/w-transition-slide.vue +2 -1
  36. package/src/wave-ui/components/transitions/w-transition-twist.vue +2 -1
  37. package/src/wave-ui/components/w-accordion/index.vue +10 -5
  38. package/src/wave-ui/components/w-accordion/item.vue +29 -14
  39. package/src/wave-ui/components/w-alert.vue +27 -29
  40. package/src/wave-ui/components/w-autocomplete.vue +626 -192
  41. package/src/wave-ui/components/w-badge.vue +54 -53
  42. package/src/wave-ui/components/w-breadcrumbs.vue +7 -9
  43. package/src/wave-ui/components/w-button/button.vue +21 -23
  44. package/src/wave-ui/components/w-button/index.vue +4 -4
  45. package/src/wave-ui/components/w-card.vue +8 -7
  46. package/src/wave-ui/components/w-checkbox.vue +31 -11
  47. package/src/wave-ui/components/w-checkboxes.vue +21 -3
  48. package/src/wave-ui/components/w-confirm.vue +22 -22
  49. package/src/wave-ui/components/w-dialog.vue +1 -1
  50. package/src/wave-ui/components/w-divider.vue +5 -5
  51. package/src/wave-ui/components/w-drawer.vue +3 -3
  52. package/src/wave-ui/components/w-form-element.vue +2 -2
  53. package/src/wave-ui/components/w-icon.vue +12 -14
  54. package/src/wave-ui/components/w-image.vue +1 -1
  55. package/src/wave-ui/components/w-input.vue +43 -25
  56. package/src/wave-ui/components/w-list.vue +11 -12
  57. package/src/wave-ui/components/w-menu.vue +57 -55
  58. package/src/wave-ui/components/w-notification.vue +4 -4
  59. package/src/wave-ui/components/w-progress.vue +6 -7
  60. package/src/wave-ui/components/w-radio.vue +32 -7
  61. package/src/wave-ui/components/w-radios.vue +28 -3
  62. package/src/wave-ui/components/w-rating.vue +7 -9
  63. package/src/wave-ui/components/w-scrollable.vue +4 -4
  64. package/src/wave-ui/components/w-select.vue +119 -101
  65. package/src/wave-ui/components/w-slider.vue +26 -26
  66. package/src/wave-ui/components/w-spinner.vue +5 -7
  67. package/src/wave-ui/components/w-switch.vue +71 -47
  68. package/src/wave-ui/components/w-table.vue +69 -36
  69. package/src/wave-ui/components/w-tabs/index.vue +21 -24
  70. package/src/wave-ui/components/w-tag.vue +35 -38
  71. package/src/wave-ui/components/w-textarea.vue +22 -22
  72. package/src/wave-ui/components/w-timeline.vue +6 -6
  73. package/src/wave-ui/components/w-toolbar.vue +8 -8
  74. package/src/wave-ui/components/w-tooltip.vue +30 -25
  75. package/src/wave-ui/components/w-tree.vue +35 -16
  76. package/src/wave-ui/core.js +9 -1
  77. package/src/wave-ui/mixins/detachable.js +118 -55
  78. package/src/wave-ui/mixins/ripple.js +2 -2
  79. package/src/wave-ui/scss/_base.scss +82 -17
  80. package/src/wave-ui/scss/_colors.scss +6 -75
  81. package/src/wave-ui/scss/_layout.scss +39 -47
  82. package/src/wave-ui/scss/_ripple.scss +2 -2
  83. package/src/wave-ui/scss/_transitions.scss +19 -19
  84. package/src/wave-ui/scss/_typography.scss +8 -9
  85. package/src/wave-ui/scss/variables/_mixins.scss +24 -25
  86. package/src/wave-ui/scss/variables/_variables.scss +4 -149
  87. package/src/wave-ui/utils/colors.js +7 -4
  88. package/src/wave-ui/utils/config.js +3 -4
  89. package/src/wave-ui/utils/dynamic-css.js +42 -20
  90. package/src/wave-ui/utils/ripple.js +3 -2
  91. package/dist/types/types/components/WApp.d.ts +0 -83
  92. package/src/wave-ui/components/w-app.vue +0 -24
  93. /package/dist/types/types/components/{WApp.js → WAutocomplete.js} +0 -0
@@ -9,13 +9,26 @@ const cssVars = {
9
9
  let breakpointsDef = { keys: [], values: [] }
10
10
  let currentBreakpoint = null
11
11
 
12
+ const generatePaletteVariables = colorPalette => {
13
+ let cssVariablesString = ''
14
+
15
+ colorPalette.forEach(({ label, color, shades = [] }) => {
16
+ cssVariablesString += `--w-${label}-color: ${color};`
17
+ shades.forEach(shade => {
18
+ cssVariablesString += `--w-${shade.label}-color: ${shade.color};`
19
+ })
20
+ })
21
+
22
+ return `:root{${cssVariablesString}}`
23
+ }
24
+
12
25
  // Generates the CSS for all the dynamic colors and shades. E.g.
13
26
  // :root {[color1-variable], [color2-variable]}
14
27
  // .color1--bg {background-color: [color1-variable]}
15
28
  // .color1 {color: [color1-variable]}
16
29
  const generateColors = (themeColors, generateShadeCssVariables) => {
17
30
  let styles = ''
18
- const cssVariables = {}
31
+ let cssVariablesString = ''
19
32
 
20
33
  // Extract status colors and place them after the other colors.
21
34
  const { info, warning, success, error, shades, ...colors } = themeColors
@@ -30,9 +43,10 @@ const generateColors = (themeColors, generateShadeCssVariables) => {
30
43
  }
31
44
  // The shades don't need css vars.
32
45
  for (const colorName in shades) {
46
+ const colorValue = generateShadeCssVariables ? `var(--w-${colorName}-color)` : shades[colorName]
33
47
  styles +=
34
- `${cssScope} .${colorName}--bg{background-color:${shades[colorName]}}` +
35
- `${cssScope} .${colorName}{color:${shades[colorName]}}`
48
+ `${cssScope} .${colorName}--bg{background-color:${colorValue}}` +
49
+ `${cssScope} .${colorName}{color:${colorValue}}`
36
50
  }
37
51
 
38
52
  // Creating CSS3 variables.
@@ -41,14 +55,12 @@ const generateColors = (themeColors, generateShadeCssVariables) => {
41
55
  // Status colors must remain after the other colors so they have priority in form validations.
42
56
  // That only makes sense when there are 2 colors on the same element: e.g. `span.primary.error`.
43
57
  const allColors = { ...colors, info, warning, success, error }
44
- for (const colorName in allColors) cssVariables[colorName] = allColors[colorName]?.color ?? allColors[colorName]
58
+ for (const colorName in allColors) {
59
+ cssVariablesString += `--w-${colorName}-color: ${allColors[colorName]?.color ?? allColors[colorName]};`
60
+ }
45
61
  if (generateShadeCssVariables) {
46
- for (const colorName in shades) cssVariables[colorName] = shades[colorName]
62
+ for (const colorName in shades) cssVariablesString += `--w-${colorName}-color: ${shades[colorName]};`
47
63
  }
48
- let cssVariablesString = ''
49
- Object.entries(cssVariables).forEach(([colorName, colorHex]) => {
50
- cssVariablesString += `--w-${colorName}-color: ${colorHex};`
51
- })
52
64
 
53
65
  return `:root{${cssVariablesString}}${styles}`
54
66
  }
@@ -104,7 +116,7 @@ const generateBreakpoints = (breakpoints, grid) => {
104
116
 
105
117
  const generateBreakpointSpaces = breakpoints => {
106
118
  let styles = ''
107
- const { cssScope, baseIncrement } = cssVars
119
+ const { cssScope } = cssVars
108
120
 
109
121
  breakpoints.forEach(({ label, min }) => {
110
122
  // Discard `xs` since the min is 0 (`media query (min-width: 0)`), and leave in _layout.scss.
@@ -148,7 +160,7 @@ const generateBreakpointSpaces = breakpoints => {
148
160
 
149
161
  const genBreakpointLayoutClasses = breakpoints => {
150
162
  let styles = ''
151
- const { cssScope, baseIncrement } = cssVars
163
+ const { cssScope } = cssVars
152
164
  const layoutClasses = [
153
165
  'show{display:block}',
154
166
  'hide{display:none}',
@@ -202,8 +214,8 @@ const genBreakpointLayoutClasses = breakpoints => {
202
214
  `@media(min-width:${min}px){` +
203
215
  layoutClasses.map(rule => `${cssScope} .${label}u-${rule}`).join('') +
204
216
  // w-grid columns and gap.
205
- array12.map((item, i) => `.w-grid.${label}u-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
206
- array12.map((item, i) => `.w-flex.${label}u-gap${i + 1},.w-grid.${label}u-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
217
+ array12.map((_, i) => `.w-grid.${label}u-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
218
+ array12.map((_, i) => `.w-flex.${label}u-gap${i + 1},.w-grid.${label}u-gap${i + 1}{gap:calc(${i + 1} * var(--w-base-increment));}`).join('') +
207
219
  `.w-flex.${label}u-gap0,.w-flex.${label}u-gap0{gap:0}` +
208
220
  '}'
209
221
  }
@@ -214,8 +226,8 @@ const genBreakpointLayoutClasses = breakpoints => {
214
226
  `@media (min-width:${min}px) and (max-width:${max}px){` +
215
227
  layoutClasses.map(rule => `${cssScope} .${label}-${rule}`).join('') +
216
228
  // w-grid columns and gap.
217
- array12.map((item, i) => `.w-grid.${label}-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
218
- array12.map((item, i) => `.w-flex.${label}-gap${i + 1},.w-grid.${label}-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
229
+ array12.map((_, i) => `.w-grid.${label}-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
230
+ array12.map((_, i) => `.w-flex.${label}-gap${i + 1},.w-grid.${label}-gap${i + 1}{gap:calc(${i + 1} * var(--w-base-increment));}`).join('') +
219
231
  `.w-flex.${label}-gap0,.w-flex.${label}-gap0{gap:0}` +
220
232
  '}'
221
233
  })
@@ -226,8 +238,8 @@ const genBreakpointLayoutClasses = breakpoints => {
226
238
  `@media (max-width:${max}px){` +
227
239
  layoutClasses.map(rule => `${cssScope} .${label}d-${rule}`).join('') +
228
240
  // w-grid columns and gap.
229
- array12.map((item, i) => `.w-grid.${label}d-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
230
- array12.map((item, i) => `.w-flex.${label}d-gap${i + 1},.w-grid.${label}d-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
241
+ array12.map((_, i) => `.w-grid.${label}d-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
242
+ array12.map((_, i) => `.w-flex.${label}d-gap${i + 1},.w-grid.${label}d-gap${i + 1}{gap:calc(${i + 1} * var(--w-base-increment));}`).join('') +
231
243
  `.w-flex.${label}d-gap0,.w-flex.${label}d-gap0{gap:0}` +
232
244
  '}'
233
245
  }
@@ -290,11 +302,21 @@ export const injectCSSInDOM = $waveui => {
290
302
  }
291
303
 
292
304
  export const injectColorsCSSInDOM = (themeColors, colorPalette, generateShadeCssVariables) => {
305
+ if (!document.getElementById('wave-ui-palette')) {
306
+ const css = document.createElement('style')
307
+ css.id = 'wave-ui-palette'
308
+ css.innerHTML = generatePaletteVariables(colorPalette)
309
+
310
+ const firstStyle = document.head.querySelectorAll('style,link[rel="stylesheet"]')[0]
311
+ if (firstStyle) firstStyle.before(css)
312
+ else document.head.appendChild(css)
313
+ }
314
+
293
315
  // Inject global dynamic CSS classes in document head.
294
316
  if (!document.getElementById('wave-ui-colors')) {
295
317
  const css = document.createElement('style')
296
318
  css.id = 'wave-ui-colors'
297
- css.innerHTML = generateColors(themeColors, colorPalette, generateShadeCssVariables)
319
+ css.innerHTML = generateColors(themeColors, generateShadeCssVariables)
298
320
 
299
321
  const firstStyle = document.head.querySelectorAll('style,link[rel="stylesheet"]')[0]
300
322
  if (firstStyle) firstStyle.before(css)
@@ -311,8 +333,8 @@ const doDynamicCSS = config => {
311
333
  })
312
334
 
313
335
  const computedStyles = getComputedStyle(document.documentElement)
314
- cssVars.cssScope = computedStyles.getPropertyValue('--w-css-scope')
315
- cssVars.baseIncrement = parseInt(computedStyles.getPropertyValue('--w-base-increment'))
336
+ cssVars.cssScope = (computedStyles.getPropertyValue('--w-css-scope') || '.w-app').trim() || '.w-app'
337
+ cssVars.baseIncrement = parseInt(computedStyles.getPropertyValue('--w-base-increment'), 10)
316
338
 
317
339
  let styles = ''
318
340
  styles += generateBreakpoints(breakpointsDef, config.css.grid)
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @param {HTMLElement} hostEl
6
6
  * @param {PointerEvent|MouseEvent|TouchEvent} event
7
- * @param {{ disabled?: boolean }} [options]
7
+ * @param {{ disabled?: boolean, sizeRect?: DOMRect }} [options]
8
8
  */
9
9
  export function applyRipple (hostEl, event, options = {}) {
10
10
  if (typeof window === 'undefined' || typeof document === 'undefined') return
@@ -20,7 +20,8 @@ export function applyRipple (hostEl, event, options = {}) {
20
20
  if (clientX == null || clientY == null) return
21
21
 
22
22
  const rect = hostEl.getBoundingClientRect()
23
- const maxSide = Math.max(rect.width, rect.height)
23
+ const sizeRect = options.sizeRect || rect
24
+ const maxSide = Math.max(sizeRect.width, sizeRect.height)
24
25
  const size = Math.max(maxSide * 2.5, 48)
25
26
  const x = clientX - rect.left - size / 2
26
27
  const y = clientY - rect.top - size / 2
@@ -1,83 +0,0 @@
1
- import { type ComputedOptions, type DefineComponent, type EmitsOptions, type ExtractDefaultPropTypes, type MethodOptions, type SlotsType } from 'vue';
2
- import type { PublicProps, ResolveProps } from '../extra-vue-types';
3
- export interface WaveAppProps {
4
- /**
5
- * Sets the layout to `display: block`. By default the layout is: `display: flex`, `flex-direction: column`.
6
- * @property {boolean} block
7
- * @see https://antoniandre.github.io/wave-ui/w-app
8
- */
9
- block?: boolean;
10
- /**
11
- * Sets the layout to display in a row when using the default flex layout (column by default).
12
- * @property {boolean} row
13
- * @see https://antoniandre.github.io/wave-ui/w-app
14
- */
15
- row?: boolean;
16
- /**
17
- * Applies the CSS property: `align-items: center;`.
18
- * @property {boolean} alignCenter
19
- * @see https://antoniandre.github.io/wave-ui/w-app
20
- */
21
- alignCenter?: boolean;
22
- /**
23
- * Applies the CSS property: `align-items: flex-end;`.
24
- * @property {boolean} alignEnd
25
- * @see https://antoniandre.github.io/wave-ui/w-app
26
- */
27
- alignEnd?: boolean;
28
- /**
29
- * Applies the CSS property: `justify-content: center;`.
30
- * @property {boolean} justifyCenter
31
- * @see https://antoniandre.github.io/wave-ui/w-app
32
- */
33
- justifyCenter?: boolean;
34
- /**
35
- * Applies the CSS property: `justify-content: end;`.
36
- * @property {boolean} justifyEnd
37
- * @see https://antoniandre.github.io/wave-ui/w-app
38
- */
39
- justifyEnd?: boolean;
40
- /**
41
- * Applies the CSS property: `justify-content: space-between;`.
42
- * @property {boolean} justifySpaceBetween
43
- * @see https://antoniandre.github.io/wave-ui/w-app
44
- */
45
- justifySpaceBetween?: boolean;
46
- /**
47
- * Applies the CSS property: `justify-content: space-around;`.
48
- * @property {boolean} justifySpaceAround
49
- * @see https://antoniandre.github.io/wave-ui/w-app
50
- */
51
- justifySpaceAround?: boolean;
52
- /**
53
- * Applies the CSS property: `justify-content: space-evenly;`.
54
- * @property {boolean} justifySpaceEvenly
55
- * @see https://antoniandre.github.io/wave-ui/w-app
56
- */
57
- justifySpaceEvenly?: boolean;
58
- /**
59
- * Applies the CSS property: `text-align: center;`.
60
- * @property {boolean} textCenter
61
- * @see https://antoniandre.github.io/wave-ui/w-app
62
- */
63
- textCenter?: boolean;
64
- /**
65
- * Applies the CSS property: `text-align: right;`.
66
- * @property {boolean} textRight
67
- * @see https://antoniandre.github.io/wave-ui/w-app
68
- */
69
- textRight?: boolean;
70
- }
71
- export type WaveAppEmits = {};
72
- export interface WaveAppComputeds extends ComputedOptions {
73
- }
74
- export interface WaveAppMethods extends MethodOptions {
75
- }
76
- export type WaveAppSlots = SlotsType<{
77
- /**
78
- * The content of the app.
79
- * @see https://antoniandre.github.io/wave-ui/w-app
80
- */
81
- 'default': () => any;
82
- }>;
83
- export type WApp = DefineComponent<WaveAppProps, {}, {}, WaveAppComputeds, WaveAppMethods, {}, {}, WaveAppEmits & EmitsOptions, string, PublicProps, ResolveProps<WaveAppProps & WaveAppEmits, EmitsOptions>, ExtractDefaultPropTypes<WaveAppProps>, WaveAppSlots>;
@@ -1,24 +0,0 @@
1
- <template lang="pug">
2
- .w-app
3
- slot
4
- </template>
5
-
6
- <script>
7
- export default {
8
- name: 'w-app',
9
- // Keep the props for the API documentation.
10
- props: {
11
- block: { type: Boolean },
12
- row: { type: Boolean },
13
- alignCenter: { type: Boolean },
14
- alignEnd: { type: Boolean },
15
- justifyCenter: { type: Boolean },
16
- justifyEnd: { type: Boolean },
17
- justifySpaceBetween: { type: Boolean },
18
- justifySpaceAround: { type: Boolean },
19
- justifySpaceEvenly: { type: Boolean },
20
- textCenter: { type: Boolean },
21
- textRight: { type: Boolean }
22
- }
23
- }
24
- </script>