wave-ui 3.28.0 → 4.0.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 (89) hide show
  1. package/dist/types/types/$waveui.d.ts +15 -1
  2. package/dist/types/types/colors.d.ts +2 -0
  3. package/dist/types/types/components/WAccordion.d.ts +92 -6
  4. package/dist/types/types/components/WAutocomplete.d.ts +437 -0
  5. package/dist/types/types/components/WCheckbox.d.ts +34 -0
  6. package/dist/types/types/components/WCheckboxes.d.ts +30 -0
  7. package/dist/types/types/components/WInput.d.ts +34 -0
  8. package/dist/types/types/components/WMenu.d.ts +12 -6
  9. package/dist/types/types/components/WRadio.d.ts +34 -0
  10. package/dist/types/types/components/WRadios.d.ts +30 -0
  11. package/dist/types/types/components/WSelect.d.ts +34 -0
  12. package/dist/types/types/components/WSwitch.d.ts +34 -0
  13. package/dist/types/types/components/WTable.d.ts +7 -0
  14. package/dist/types/types/components/WTooltip.d.ts +20 -7
  15. package/dist/types/types/components/WTransitions.d.ts +104 -0
  16. package/dist/types/types/components/WTransitions.js +2 -0
  17. package/dist/types/types/components/WTree.d.ts +7 -0
  18. package/dist/types/types/components/index.d.ts +2 -1
  19. package/dist/wave-ui.cjs.js +3 -3
  20. package/dist/wave-ui.css +1 -1
  21. package/dist/wave-ui.esm.js +1711 -1338
  22. package/dist/wave-ui.umd.js +3 -3
  23. package/package.json +1 -1
  24. package/src/wave-ui/components/index.js +0 -1
  25. package/src/wave-ui/components/transitions/w-transition-bounce.vue +2 -1
  26. package/src/wave-ui/components/transitions/w-transition-expand.vue +3 -2
  27. package/src/wave-ui/components/transitions/w-transition-fade.vue +2 -1
  28. package/src/wave-ui/components/transitions/w-transition-scale-fade.vue +2 -1
  29. package/src/wave-ui/components/transitions/w-transition-scale.vue +2 -1
  30. package/src/wave-ui/components/transitions/w-transition-slide-fade.vue +2 -1
  31. package/src/wave-ui/components/transitions/w-transition-slide.vue +2 -1
  32. package/src/wave-ui/components/transitions/w-transition-twist.vue +2 -1
  33. package/src/wave-ui/components/w-accordion/index.vue +10 -5
  34. package/src/wave-ui/components/w-accordion/item.vue +29 -14
  35. package/src/wave-ui/components/w-alert.vue +27 -29
  36. package/src/wave-ui/components/w-autocomplete.vue +626 -192
  37. package/src/wave-ui/components/w-badge.vue +54 -53
  38. package/src/wave-ui/components/w-breadcrumbs.vue +7 -9
  39. package/src/wave-ui/components/w-button/button.vue +21 -23
  40. package/src/wave-ui/components/w-button/index.vue +4 -4
  41. package/src/wave-ui/components/w-card.vue +8 -7
  42. package/src/wave-ui/components/w-checkbox.vue +31 -11
  43. package/src/wave-ui/components/w-checkboxes.vue +21 -3
  44. package/src/wave-ui/components/w-confirm.vue +22 -22
  45. package/src/wave-ui/components/w-dialog.vue +1 -1
  46. package/src/wave-ui/components/w-divider.vue +5 -5
  47. package/src/wave-ui/components/w-drawer.vue +3 -3
  48. package/src/wave-ui/components/w-form-element.vue +2 -2
  49. package/src/wave-ui/components/w-icon.vue +12 -14
  50. package/src/wave-ui/components/w-image.vue +1 -1
  51. package/src/wave-ui/components/w-input.vue +43 -25
  52. package/src/wave-ui/components/w-list.vue +11 -12
  53. package/src/wave-ui/components/w-menu.vue +57 -55
  54. package/src/wave-ui/components/w-notification.vue +4 -4
  55. package/src/wave-ui/components/w-progress.vue +6 -7
  56. package/src/wave-ui/components/w-radio.vue +32 -7
  57. package/src/wave-ui/components/w-radios.vue +28 -3
  58. package/src/wave-ui/components/w-rating.vue +7 -9
  59. package/src/wave-ui/components/w-scrollable.vue +4 -4
  60. package/src/wave-ui/components/w-select.vue +119 -101
  61. package/src/wave-ui/components/w-slider.vue +26 -26
  62. package/src/wave-ui/components/w-spinner.vue +5 -7
  63. package/src/wave-ui/components/w-switch.vue +71 -47
  64. package/src/wave-ui/components/w-table.vue +69 -36
  65. package/src/wave-ui/components/w-tabs/index.vue +21 -24
  66. package/src/wave-ui/components/w-tag.vue +35 -38
  67. package/src/wave-ui/components/w-textarea.vue +22 -22
  68. package/src/wave-ui/components/w-timeline.vue +6 -6
  69. package/src/wave-ui/components/w-toolbar.vue +8 -8
  70. package/src/wave-ui/components/w-tooltip.vue +30 -25
  71. package/src/wave-ui/components/w-tree.vue +35 -16
  72. package/src/wave-ui/core.js +9 -1
  73. package/src/wave-ui/mixins/detachable.js +98 -43
  74. package/src/wave-ui/mixins/ripple.js +2 -2
  75. package/src/wave-ui/scss/_base.scss +82 -17
  76. package/src/wave-ui/scss/_colors.scss +6 -75
  77. package/src/wave-ui/scss/_layout.scss +39 -47
  78. package/src/wave-ui/scss/_ripple.scss +2 -2
  79. package/src/wave-ui/scss/_transitions.scss +19 -19
  80. package/src/wave-ui/scss/_typography.scss +8 -9
  81. package/src/wave-ui/scss/variables/_mixins.scss +24 -25
  82. package/src/wave-ui/scss/variables/_variables.scss +4 -149
  83. package/src/wave-ui/utils/colors.js +7 -4
  84. package/src/wave-ui/utils/config.js +3 -4
  85. package/src/wave-ui/utils/dynamic-css.js +42 -20
  86. package/src/wave-ui/utils/ripple.js +3 -2
  87. package/dist/types/types/components/WApp.d.ts +0 -83
  88. package/src/wave-ui/components/w-app.vue +0 -24
  89. /package/dist/types/types/components/{WApp.js → WAutocomplete.js} +0 -0
@@ -1,11 +1,11 @@
1
1
  @use 'variables' as *;
2
2
 
3
- $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
3
+ $fast-out-slow-in: var(--w-transition-timing-fast-out-slow-in);
4
4
 
5
5
  // Fade.
6
6
  // --------------------------------------------------------
7
- .fade-enter-active {animation: w-fade $transition-duration;}
8
- .fade-leave-active {animation: w-fade $transition-duration reverse;}
7
+ .fade-enter-active {animation: w-fade var(--w-transition-duration);}
8
+ .fade-leave-active {animation: w-fade var(--w-transition-duration) reverse;}
9
9
  @keyframes w-fade {
10
10
  0% {opacity: 0;}
11
11
  100% {opacity: 1;}
@@ -15,7 +15,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
15
15
  // Slide-right: translate x from left to right.
16
16
  // --------------------------------------------------------
17
17
  .slide-right-enter-active, .slide-right-leave-active {
18
- transition: $transition-duration $fast-out-slow-in;
18
+ transition: var(--w-transition-duration) $fast-out-slow-in;
19
19
  transition-property: transform, left, margin-left;
20
20
  transform: translateX(0%);
21
21
  }
@@ -29,7 +29,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
29
29
  // Slide-left: translate x from right to left.
30
30
  // --------------------------------------------------------
31
31
  .slide-left-enter-active, .slide-left-leave-active {
32
- transition: $transition-duration;
32
+ transition: var(--w-transition-duration);
33
33
  transition-property: transform, right, margin-right;
34
34
  transform: translateX(0%);
35
35
  }
@@ -43,7 +43,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
43
43
  // Slide-down: translate y from top to bottom.
44
44
  // --------------------------------------------------------
45
45
  .slide-down-enter-active, .slide-down-leave-active {
46
- transition: transform $transition-duration $fast-out-slow-in;
46
+ transition: transform var(--w-transition-duration) $fast-out-slow-in;
47
47
  transition-property: transform, top, margin-top;
48
48
  transform: translateY(0%);
49
49
  }
@@ -57,7 +57,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
57
57
  // Slide-up: translate y from bottom to top.
58
58
  // --------------------------------------------------------
59
59
  .slide-up-enter-active, .slide-up-leave-active {
60
- transition: transform $transition-duration $fast-out-slow-in;
60
+ transition: transform var(--w-transition-duration) $fast-out-slow-in;
61
61
  transition-property: transform, bottom, margin-bottom;
62
62
  transform: translateY(0%);
63
63
  }
@@ -71,7 +71,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
71
71
  // Slide-fade-left.
72
72
  // --------------------------------------------------------
73
73
  .slide-fade-left-enter-active, .slide-fade-left-leave-active {
74
- transition: all $transition-duration $fast-out-slow-in;
74
+ transition: all var(--w-transition-duration) $fast-out-slow-in;
75
75
  }
76
76
  .slide-fade-left-enter-from, .slide-fade-left-leave-to {
77
77
  transform: translateX(12px);
@@ -81,7 +81,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
81
81
  // Slide-fade-right.
82
82
  // --------------------------------------------------------
83
83
  .slide-fade-right-enter-active, .slide-fade-right-leave-active {
84
- transition: all $transition-duration $fast-out-slow-in;
84
+ transition: all var(--w-transition-duration) $fast-out-slow-in;
85
85
  }
86
86
  .slide-fade-right-enter-from, .slide-fade-right-leave-to {
87
87
  transform: translateX(-12px);
@@ -92,7 +92,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
92
92
  // Slide-fade-up.
93
93
  // --------------------------------------------------------
94
94
  .slide-fade-up-enter-active, .slide-fade-up-leave-active {
95
- transition: all $transition-duration $fast-out-slow-in;
95
+ transition: all var(--w-transition-duration) $fast-out-slow-in;
96
96
  }
97
97
  .slide-fade-up-enter-from, .slide-fade-up-leave-to {
98
98
  transform: translateY(12px);
@@ -103,7 +103,7 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
103
103
  // Slide-fade-down.
104
104
  // --------------------------------------------------------
105
105
  .slide-fade-down-enter-active, .slide-fade-down-leave-active {
106
- transition: all $transition-duration $fast-out-slow-in;
106
+ transition: all var(--w-transition-duration) $fast-out-slow-in;
107
107
  }
108
108
  .slide-fade-down-enter-from, .slide-fade-down-leave-to {
109
109
  transform: translateY(-12px);
@@ -113,8 +113,8 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
113
113
 
114
114
  // Scale.
115
115
  // --------------------------------------------------------
116
- .scale-enter-active {animation: w-scale $transition-duration;}
117
- .scale-leave-active {animation: w-scale $transition-duration reverse;}
116
+ .scale-enter-active {animation: w-scale var(--w-transition-duration);}
117
+ .scale-leave-active {animation: w-scale var(--w-transition-duration) reverse;}
118
118
  @keyframes w-scale {
119
119
  0% {transform: scale(0);}
120
120
  100% {transform: scale(1);}
@@ -123,8 +123,8 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
123
123
 
124
124
  // Scale-fade.
125
125
  // --------------------------------------------------------
126
- .scale-fade-enter-active {animation: w-scale-fade $transition-duration;}
127
- .scale-fade-leave-active {animation: w-scale-fade $transition-duration reverse;}
126
+ .scale-fade-enter-active {animation: w-scale-fade var(--w-transition-duration);}
127
+ .scale-fade-leave-active {animation: w-scale-fade var(--w-transition-duration) reverse;}
128
128
  @keyframes w-scale-fade {
129
129
  0% {transform: scale(0.8);opacity: 0;}
130
130
  100% {transform: scale(1);opacity: 1;}
@@ -133,8 +133,8 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
133
133
 
134
134
  // Bounce.
135
135
  // --------------------------------------------------------
136
- .bounce-enter-active {animation: w-bounce ($transition-duration + 0.05s);}
137
- .bounce-leave-active {animation: w-bounce ($transition-duration + 0.05s) reverse;}
136
+ .bounce-enter-active {animation: w-bounce calc(var(--w-transition-duration) + 0.05s);}
137
+ .bounce-leave-active {animation: w-bounce calc(var(--w-transition-duration) + 0.05s) reverse;}
138
138
  @keyframes w-bounce {
139
139
  0% {transform: scale(0.7);opacity: 0;}
140
140
  60% {transform: scale(1.1);opacity: 1;}
@@ -144,8 +144,8 @@ $fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1);
144
144
 
145
145
  // Twist.
146
146
  // --------------------------------------------------------
147
- .twist-enter-active {animation: w-twist ($transition-duration + 0.25s);}
148
- .twist-leave-active {animation: w-twist ($transition-duration + 0.25s) reverse;}
147
+ .twist-enter-active {animation: w-twist calc(var(--w-transition-duration) + 0.25s);}
148
+ .twist-leave-active {animation: w-twist calc(var(--w-transition-duration) + 0.25s) reverse;}
149
149
  @keyframes w-twist {
150
150
  0% {transform: scale(0) rotate(-70deg);}
151
151
  60% {transform: scale(1.03) rotate(6deg);}
@@ -1,41 +1,40 @@
1
- @use "sass:math";
2
1
  @use 'variables' as *;
3
2
 
4
3
  #{$css-scope} {
5
4
  .headline, .title1 {
6
- font-size: math.round(2.2 * $base-font-size);
5
+ font-size: calc(2.2 * var(--w-base-font-size));
7
6
  font-weight: 100;
8
7
  }
9
8
 
10
9
  .title2 {
11
- font-size: math.round(1.7 * $base-font-size);
10
+ font-size: calc(1.7 * var(--w-base-font-size));
12
11
  font-weight: 400;
13
12
  }
14
13
 
15
14
  .title3 {
16
- font-size: math.round(1.4 * $base-font-size);
15
+ font-size: calc(1.4 * var(--w-base-font-size));
17
16
  font-weight: 400;
18
17
  }
19
18
 
20
19
  .title4 {
21
- font-size: math.round(1.25 * $base-font-size);
20
+ font-size: calc(1.25 * var(--w-base-font-size));
22
21
  font-weight: 400;
23
22
  }
24
23
 
25
24
  .title5 {
26
- font-size: math.round(1.1 * $base-font-size);
25
+ font-size: calc(1.1 * var(--w-base-font-size));
27
26
  font-weight: 600;
28
27
  }
29
28
 
30
29
  .body {
31
- font-size: $base-font-size;
30
+ font-size: var(--w-base-font-size);
32
31
  font-weight: normal;
33
32
  }
34
33
 
35
34
  .caption {
36
- font-size: math.round(0.85 * $base-font-size);
35
+ font-size: calc(0.85 * var(--w-base-font-size));
37
36
  font-style: italic;
38
- color: $caption-color;
37
+ color: var(--w-caption-color);
39
38
  }
40
39
 
41
40
  .text-upper {text-transform: uppercase;}
@@ -1,33 +1,32 @@
1
- @use "sass:map";
2
- @use "variables" as *;
3
-
4
1
  // This allows each UI component to be used in dark or light theme regardless of the global theme.
5
2
  @mixin themeable {
6
3
  // Will force the light style on this component.
7
4
  &--light {
8
- --w-base-bg-color: #{map.get($theme-light, 'base-bg-color')};
9
- --w-base-color: #{map.get($theme-light, 'base-color')};
10
- --w-contrast-bg-color: #{map.get($theme-light, 'contrast-bg-color')};
11
- --w-contrast-color: #{map.get($theme-light, 'contrast-color')};
12
- --w-disabled-color: #{map.get($theme-light, 'disabled-color')};
13
- color: rgba(var(--w-base-color), 0.7);
5
+ --w-base-bg-color: #fff;
6
+ --w-base-color: #000;
7
+ --w-contrast-bg-color: #000;
8
+ --w-contrast-color: #fff;
9
+ --w-caption-color: #a0a0a0;
10
+ --w-disabled-color: #ccc;
11
+ color: var(--w-base-color-muted);
14
12
  }
15
13
  // Will force the dark style on this component.
16
14
  &--dark {
17
- --w-base-bg-color: #{map.get($theme-dark, 'base-bg-color')};
18
- --w-base-color: #{map.get($theme-dark, 'base-color')};
19
- --w-contrast-bg-color: #{map.get($theme-dark, 'contrast-bg-color')};
20
- --w-contrast-color: #{map.get($theme-dark, 'contrast-color')};
21
- --w-disabled-color: #{map.get($theme-dark, 'disabled-color')};
22
- color: rgba(var(--w-base-color), 0.7);
15
+ --w-base-bg-color: #222;
16
+ --w-base-color: #fff;
17
+ --w-contrast-bg-color: #fff;
18
+ --w-contrast-color: #000;
19
+ --w-caption-color: #6e6e6e;
20
+ --w-disabled-color: #4a4a4a;
21
+ color: var(--w-base-color-muted);
23
22
  }
24
23
  }
25
24
 
26
- @mixin default-transition($duration: $transition-duration, $delay: 0s) {
25
+ @mixin default-transition($duration: var(--w-transition-duration), $delay: 0s) {
27
26
  transition: $duration $delay ease-in-out;
28
27
  }
29
28
 
30
- @mixin out-back-transition($duration: $transition-duration, $delay: 0s) {
29
+ @mixin out-back-transition($duration: var(--w-transition-duration), $delay: 0s) {
31
30
  transition: $duration $delay cubic-bezier(0.18, 0.89, 0.32, 1.28);
32
31
  }
33
32
 
@@ -78,21 +77,21 @@
78
77
 
79
78
  &#{$selector}--align-top:before {
80
79
  transform: none;
81
- top: (2 * $base-increment) - 1px;
80
+ top: calc(2 * var(--w-base-increment) - 1px);
82
81
  }
83
82
  &#{$selector}--align-bottom:before {
84
83
  transform: none;
85
84
  top: auto;
86
- bottom: (2 * $base-increment) - 1px;
85
+ bottom: calc(2 * var(--w-base-increment) - 1px);
87
86
  }
88
87
  &#{$selector}--align-left:before {
89
88
  transform: none;
90
- left: (2 * $base-increment) - 1px;
89
+ left: calc(2 * var(--w-base-increment) - 1px);
91
90
  }
92
91
  &#{$selector}--align-right:before {
93
92
  transform: none;
94
93
  left: auto;
95
- right: (2 * $base-increment) - 1px;
94
+ right: calc(2 * var(--w-base-increment) - 1px);
96
95
  }
97
96
  }
98
97
 
@@ -129,8 +128,8 @@
129
128
  transform: translateY(-50%);
130
129
  }
131
130
 
132
- &#{$selector}--align-top:after {transform: none;top: 2 * $base-increment;}
133
- &#{$selector}--align-bottom:after {transform: none;top: auto;bottom: 2 * $base-increment;}
134
- &#{$selector}--align-left:after {transform: none;left: 2 * $base-increment;}
135
- &#{$selector}--align-right:after {transform: none;left: auto;right: 2 * $base-increment;}
131
+ &#{$selector}--align-top:after {transform: none;top: calc(2 * var(--w-base-increment));}
132
+ &#{$selector}--align-bottom:after {transform: none;top: auto;bottom: calc(2 * var(--w-base-increment));}
133
+ &#{$selector}--align-left:after {transform: none;left: calc(2 * var(--w-base-increment));}
134
+ &#{$selector}--align-right:after {transform: none;left: auto;right: calc(2 * var(--w-base-increment));}
136
135
  }
@@ -1,155 +1,10 @@
1
- @use "sass:math";
2
- @use "sass:map";
3
-
4
- @function divide($a, $b) {
5
- @return math.div($a, $b);
6
- }
7
-
8
- // THEME COLORS.
9
- // ========================================================
10
- // If you don't need themes, you can leave this as is and override the global defaults.
11
- $theme-light: (
12
- base-bg-color: #fff,
13
- base-color: #000,
14
- contrast-bg-color: #000,
15
- contrast-color: #fff,
16
- caption-color: #a0a0a0,
17
- disabled-color: #ccc
18
- ) !default;
19
-
20
- $theme-dark: (
21
- base-bg-color: #222,
22
- base-color: #fff,
23
- contrast-bg-color: #fff,
24
- contrast-color: #000,
25
- caption-color: #6e6e6e,
26
- disabled-color: #4a4a4a
27
- ) !default;
28
-
29
- // These variables are filled up with the current theme colors for you to use.
30
- $primary: var(--w-primary-color);
31
- $secondary: var(--w-secondary-color);
32
- $base-bg-color: var(--w-base-bg-color);
33
- $base-color: var(--w-base-color);
34
- $contrast-bg-color: var(--w-contrast-bg-color);
35
- $contrast-color: var(--w-contrast-color);
36
- $caption-color: var(--w-caption-color);
37
- // When a form element is disabled (checkbox, radio, input, select list).
38
- $disabled-color: var(--w-disabled-color);
1
+ // Theme palette defaults live as plain CSS on :root[data-theme] in _base.scss
2
+ // and in the themeable mixin (_mixins.scss). Override with CSS, e.g.
3
+ // :root { --w-base-font-size: 16px; } (also drives --w-base-increment on :root)
4
+ // :root[data-theme="light"] { --w-base-bg-color: #fafafa; }
39
5
 
40
6
  // GLOBAL DEFAULTS.
41
7
  // ========================================================
42
8
  $css-scope: '.w-app' !default; // Allows control on CSS rules priority.
43
9
  // True by default. False allows you to use an external CSS library (like Tailwind).
44
10
  $use-layout-classes: true !default;
45
-
46
- $base-font-size: 14px !default; // Must be a px unit.
47
- $base-increment: math.round(divide($base-font-size, 4)) !default;
48
- $layout-padding: $base-increment * 4 !default; // Applied on the .content-wrap tag.
49
- $border-radius: 4px !default;
50
- $border-color: color-mix(in srgb, var(--w-contrast-bg-color) 12%, transparent) !default;
51
- $border: 1px solid $border-color !default;
52
- $transition-duration: 0.25s !default;
53
- $fast-transition-duration: 0.15s !default;
54
- $box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
55
- 0 2px 2px 0 rgba(0, 0, 0, 0.15),
56
- 0 1px 5px 0 rgba(0, 0, 0, 0.15) !default;
57
- $form-field-height: math.round(2 * $base-font-size) !default;
58
- // Always an even number for better vertical alignment. (Used in checkbox, radio, switch)
59
- $small-form-el-size: math.round(divide(1.3 * $base-font-size, 2)) * 2 !default;
60
-
61
- // Detachable elements are: w-tooltip, w-menu, w-confirm.
62
- $detachable-bg-color: $base-bg-color !default;
63
- $detachable-color: $base-color !default;
64
-
65
- // COMPONENTS DEFAULTS.
66
- // ========================================================
67
- // w-confirm.
68
- // --------------------------------------------------------
69
- $confirm-bg-color: $detachable-bg-color !default;
70
- $confirm-color: $detachable-color !default;
71
- // --------------------------------------------------------
72
-
73
- // w-dialog.
74
- // --------------------------------------------------------
75
- $dialog-bg-color: $base-bg-color !default;
76
- // --------------------------------------------------------
77
-
78
- // w-divider.
79
- // --------------------------------------------------------
80
- $divider-color: $border-color !default;
81
- // --------------------------------------------------------
82
-
83
- // w-drawer.
84
- // --------------------------------------------------------
85
- $drawer-max-size: 380px !default;
86
- $drawer-bg-color: $base-bg-color !default;
87
- // --------------------------------------------------------
88
-
89
- // w-menu.
90
- // --------------------------------------------------------
91
- $menu-bg-color: $detachable-bg-color !default;
92
- $menu-color: $detachable-color !default;
93
- // --------------------------------------------------------
94
-
95
- // w-progress.
96
- // --------------------------------------------------------
97
- $progress-bg-color: color-mix(in srgb, var(--w-contrast-bg-color) 15%, transparent) !default;
98
- // --------------------------------------------------------
99
-
100
- // w-rating.
101
- // --------------------------------------------------------
102
- $rating-bg-color: color-mix(in srgb, var(--w-contrast-bg-color) 25%, transparent) !default;
103
- // --------------------------------------------------------
104
-
105
- // w-slider.
106
- // --------------------------------------------------------
107
- $slider-height: $base-increment !default;
108
- $slider-track-color: color-mix(in srgb, var(--w-contrast-bg-color) 15%, transparent) !default;
109
- $slider-thumb-button-bg-color: $base-bg-color !default;
110
- $slider-thumb-label-bg-color: $base-bg-color !default;
111
- $slider-thumb-label-color: color-mix(in srgb, var(--w-base-color) 75%, transparent) !default;
112
- $slider-step-label-bg-color: color-mix(in srgb, var(--w-contrast-bg-color) 20%, transparent) !default;
113
- $slider-step-label-color: color-mix(in srgb, var(--w-base-color) 50%, transparent) !default;
114
-
115
- // w-switch.
116
- // --------------------------------------------------------
117
- $switch-inactive-color: color-mix(in srgb, var(--w-contrast-bg-color) 25%, transparent) !default;
118
- $switch-thumb-color: $base-bg-color !default;
119
- // --------------------------------------------------------
120
-
121
- // w-table.
122
- // --------------------------------------------------------
123
- $table-tr-odd-color: color-mix(in srgb, var(--w-contrast-bg-color) 2%, transparent) !default;
124
- $table-tr-hover-color: color-mix(in srgb, var(--w-contrast-bg-color) 5%, transparent) !default;
125
- $table-color: color-mix(in srgb, var(--w-contrast-color) 70%, transparent) !default;
126
- // --------------------------------------------------------
127
-
128
- // w-textarea.
129
- // --------------------------------------------------------
130
- $textarea-line-height: 1.2 !default;
131
- // --------------------------------------------------------
132
-
133
- // w-timeline.
134
- // --------------------------------------------------------
135
- $timeline-bullet-color: $base-bg-color !default;
136
- $timeline-bg-color: color-mix(in srgb, var(--w-contrast-bg-color) 25%, transparent) !default;
137
- // --------------------------------------------------------
138
-
139
- // w-toolbar.
140
- // --------------------------------------------------------
141
- $toolbar-max-size: 380px !default;
142
- $toolbar-bg-color: $base-bg-color !default;
143
- // --------------------------------------------------------
144
-
145
- // w-tooltip.
146
- // --------------------------------------------------------
147
- $tooltip-bg-color: $detachable-bg-color !default;
148
- $tooltip-color: $detachable-color !default;
149
- $tooltip-border-color: $border-color !default;
150
- // --------------------------------------------------------
151
-
152
- // w-scrollable.
153
- // --------------------------------------------------------
154
- $scrollbar-size: 8px !default;
155
- // --------------------------------------------------------
@@ -1,5 +1,9 @@
1
1
  import { consoleError } from './console'
2
2
 
3
+ // The built-in palette remains the single source for exact legacy shade values.
4
+ // dynamic-css.js exposes these colors as --w-*-color variables; SCSS color
5
+ // utility classes only reference those variables.
6
+
3
7
  /**
4
8
  * Generates the color shades for each custom color and status colors for the current theme (only),
5
9
  * and save it in the config object.
@@ -37,11 +41,10 @@ export const flattenColors = (themeColors, colorPalette) => {
37
41
  const colors = {
38
42
  ...colorPalette.reduce((obj, color) => {
39
43
  obj[color.label] = color.color
40
- const shades = (color.shades || []).reduce((obj, color) => {
44
+ ;(color.shades || []).forEach(color => {
41
45
  obj[color.label] = color.color
42
- return obj
43
- }, {})
44
- return { ...obj, ...shades }
46
+ })
47
+ return obj
45
48
  }, { ...themeColors, ...themeColors.shades })
46
49
  }
47
50
  delete colors.shades
@@ -19,15 +19,14 @@ const config = reactive({
19
19
  // Note: colorShades must be enabled for this to work.
20
20
  colorShadeCssVariables: false,
21
21
 
22
- // Generate palette colors and palette color shades.
23
- // Can't have this option: color palette is generated via SCSS in colors.scss.
24
- // colorPalette: true,
22
+ // Built-in palette colors and shades always generate CSS variables.
25
23
 
26
24
  breakpointSpaces: false, // Generate margin & padding classes for each breakpoint. E.g. `sm-ma2`.
27
25
  // Generate helper classes for each breakpoint.
28
26
  // E.g. `sm-text-left`, `xs-hide`.
29
27
  breakpointLayoutClasses: true,
30
- grid: 12
28
+ grid: 12,
29
+ appClasses: '' // Custom CSS classes to add to the .w-app element.
31
30
  },
32
31
  colors: {
33
32
  // Default colors of Wave UI. Can be overridden from the Wave UI user config on init.
@@ -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