wave-ui 1.68.1 → 1.70.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 (42) hide show
  1. package/dist/wave-ui.cjs.js +1 -1
  2. package/dist/wave-ui.css +1 -1
  3. package/dist/wave-ui.es.js +508 -114
  4. package/dist/wave-ui.umd.js +1 -1
  5. package/package.json +14 -14
  6. package/src/wave-ui/components/index.js +1 -0
  7. package/src/wave-ui/components/transitions/w-transition-expand.vue +2 -4
  8. package/src/wave-ui/components/w-accordion.vue +1 -4
  9. package/src/wave-ui/components/w-alert.vue +1 -4
  10. package/src/wave-ui/components/w-autocomplete.vue +404 -0
  11. package/src/wave-ui/components/w-badge.vue +1 -0
  12. package/src/wave-ui/components/w-button/button.vue +7 -9
  13. package/src/wave-ui/components/w-card.vue +2 -0
  14. package/src/wave-ui/components/w-checkbox.vue +3 -2
  15. package/src/wave-ui/components/w-checkboxes.vue +4 -1
  16. package/src/wave-ui/components/w-drawer.vue +2 -8
  17. package/src/wave-ui/components/w-icon.vue +1 -1
  18. package/src/wave-ui/components/w-image.vue +2 -8
  19. package/src/wave-ui/components/w-input.vue +19 -16
  20. package/src/wave-ui/components/w-list.vue +8 -11
  21. package/src/wave-ui/components/w-menu.vue +12 -1
  22. package/src/wave-ui/components/w-notification-manager.vue +3 -3
  23. package/src/wave-ui/components/w-progress.vue +2 -8
  24. package/src/wave-ui/components/w-rating.vue +1 -4
  25. package/src/wave-ui/components/w-select.vue +94 -48
  26. package/src/wave-ui/components/w-slider.vue +6 -5
  27. package/src/wave-ui/components/w-spinner.vue +2 -0
  28. package/src/wave-ui/components/w-switch.vue +1 -1
  29. package/src/wave-ui/components/w-table.vue +221 -211
  30. package/src/wave-ui/components/w-tabs/index.vue +1 -4
  31. package/src/wave-ui/components/w-tag.vue +1 -4
  32. package/src/wave-ui/components/w-textarea.vue +1 -1
  33. package/src/wave-ui/components/w-timeline.vue +1 -0
  34. package/src/wave-ui/components/w-toolbar.vue +1 -2
  35. package/src/wave-ui/components/w-tooltip.vue +44 -10
  36. package/src/wave-ui/components/w-tree.vue +7 -7
  37. package/src/wave-ui/core.js +36 -2
  38. package/src/wave-ui/mixins/detachable.js +27 -6
  39. package/src/wave-ui/scss/_base.scss +18 -0
  40. package/src/wave-ui/scss/_variables.scss +103 -9
  41. package/src/wave-ui/scss/index.scss +0 -1
  42. package/src/wave-ui/utils/dynamic-css.js +19 -8
@@ -42,7 +42,14 @@ export default {
42
42
  transition: { type: String },
43
43
  tooltipClass: { type: [String, Object, Array] },
44
44
  persistent: { type: Boolean },
45
- delay: { type: Number }
45
+ delay: { type: Number },
46
+ caption: { type: Boolean }, // Apply the caption class and style (grey, italic, small).
47
+ xs: { type: Boolean },
48
+ sm: { type: Boolean },
49
+ md: { type: Boolean },
50
+ lg: { type: Boolean },
51
+ xl: { type: Boolean },
52
+ enableTouch: { type: Boolean }
46
53
  // Other props in the detachable mixin:
47
54
  // appendTo, fixed, top, bottom, left, right, alignTop, alignBottom, alignLeft,
48
55
  // alignRight, noPosition, zIndex, activator.
@@ -81,6 +88,17 @@ export default {
81
88
  return this.transition || `w-tooltip-slide-fade-${direction}`
82
89
  },
83
90
 
91
+ size () {
92
+ return (
93
+ (this.xs && 'xs') ||
94
+ (this.sm && 'sm') ||
95
+ (this.sm && 'md') ||
96
+ (this.lg && 'lg') ||
97
+ (this.xl && 'xl') ||
98
+ (this.caption ? 'sm' : 'md') // if no size is set put md by default, or sm if caption is on.
99
+ )
100
+ },
101
+
84
102
  classes () {
85
103
  return {
86
104
  [this.color]: this.color,
@@ -90,6 +108,8 @@ export default {
90
108
  [`w-tooltip--align-${this.alignment}`]: !this.noPosition && this.alignment,
91
109
  'w-tooltip--tile': this.tile,
92
110
  'w-tooltip--round': this.round,
111
+ caption: this.caption,
112
+ [`size--${this.size}`]: true,
93
113
  'w-tooltip--shadow': this.shadow,
94
114
  'w-tooltip--fixed': this.fixed,
95
115
  'w-tooltip--no-border': this.noBorder || this.bgColor,
@@ -103,17 +123,21 @@ export default {
103
123
  zIndex: this.zIndex || this.zIndex === 0 || null,
104
124
  top: (this.detachableCoords.top && `${~~this.detachableCoords.top}px`) || null,
105
125
  left: (this.detachableCoords.left && `${~~this.detachableCoords.left}px`) || null,
106
- '--w-tooltip-bg-color': this.$waveui.colors[this.bgColor || 'white']
126
+ '--w-tooltip-bg-color': this.$waveui.colors[this.bgColor] || 'rgb(var(--w-base-bg-color-rgb))'
107
127
  }
108
128
  },
109
129
 
110
130
  activatorEventHandlers () {
111
131
  let handlers = {}
112
- if (this.showOnClick) handlers = { click: this.toggle }
113
- else {
132
+
133
+ // Check the window exists: SSR-proof.
134
+ const isTouchDevice = typeof window !== 'undefined' && 'ontouchstart' in window
135
+
136
+ // Toggling tooltip on mouseenter/mouseout (by default), and also show on focus, hide on blur.
137
+ if (!this.showOnClick && !isTouchDevice) {
114
138
  handlers = {
115
- focus: this.toggle,
116
- blur: this.toggle,
139
+ focus: this.open,
140
+ blur: this.close,
117
141
  mouseenter: e => {
118
142
  this.hoveringActivator = true
119
143
  this.open(e)
@@ -123,10 +147,10 @@ export default {
123
147
  this.close()
124
148
  }
125
149
  }
126
-
127
- // Check the window exists: SSR-proof.
128
- if (typeof window !== 'undefined' && 'ontouchstart' in window) handlers.click = this.toggle
129
150
  }
151
+ // Only bind a click event on mobile, or if showOnClick is set.
152
+ else if (this.enableTouch || this.showOnClick) handlers = { click: this.toggle }
153
+
130
154
  return handlers
131
155
  }
132
156
  },
@@ -146,8 +170,12 @@ export default {
146
170
  // ! \ This function uses the DOM - NO SSR (only trigger from beforeMount and later).
147
171
  toggle (e) {
148
172
  let shouldShowTooltip = this.detachableVisible
173
+
174
+ // For touch devices.
149
175
  if (typeof window !== 'undefined' && 'ontouchstart' in window) {
150
- if (e.type === 'click') shouldShowTooltip = !shouldShowTooltip
176
+ // disable tooltip opening for mouseenter activation.
177
+ if (!this.enableTouch && !this.showOnClick) shouldShowTooltip = false
178
+ else shouldShowTooltip = !shouldShowTooltip
151
179
  }
152
180
  else if (e.type === 'click' && this.showOnClick) shouldShowTooltip = !shouldShowTooltip
153
181
  else if (['mouseenter', 'focus'].includes(e.type) && !this.showOnClick) shouldShowTooltip = true
@@ -226,6 +254,12 @@ export default {
226
254
  &--left {margin-left: -3 * $base-increment;}
227
255
  &--right {margin-left: 3 * $base-increment;}
228
256
 
257
+ &.size--xs {font-size: 0.75rem;}
258
+ &.size--sm {font-size: 0.83rem;}
259
+ &.size--md {font-size: 0.9rem;}
260
+ &.size--lg {font-size: 1rem;}
261
+ &.size--xl {font-size: 1.1rem;}
262
+
229
263
  &--custom-transition {transform: none;}
230
264
 
231
265
  // Tooltip without border.
@@ -214,19 +214,19 @@ export default {
214
214
 
215
215
  onLabelKeydown (item, e) {
216
216
  // Keys: 13 enter, 32 space, 37 arrow left, 38 arrow up, 39 arrow right, 40 arrow down.
217
- if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.which)) {
217
+ if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.keyCode)) {
218
218
  if (item.children || item.branch) {
219
- if ([13, 32].includes(e.which)) this.expandDepth(item) && e.preventDefault()
220
- else if (e.which === 37) this.expandDepth(item, false) && e.preventDefault()
221
- else if (e.which === 39) this.expandDepth(item, true) && e.preventDefault()
219
+ if ([13, 32].includes(e.keyCode)) this.expandDepth(item) && e.preventDefault()
220
+ else if (e.keyCode === 37) this.expandDepth(item, false) && e.preventDefault()
221
+ else if (e.keyCode === 39) this.expandDepth(item, true) && e.preventDefault()
222
222
  }
223
223
 
224
224
  // On arrow up or down, focus the prev or next item.
225
- if ([38, 40].includes(e.which)) {
225
+ if ([38, 40].includes(e.keyCode)) {
226
226
  const treeRoot = this.$el.closest('.w-tree--depth0')
227
227
  const treeTabbableItems = treeRoot.querySelectorAll('.w-tree__item-label[tabindex="0"]')
228
228
  const currLabel = e.target.closest('.w-tree__item-label')
229
- const indexModifier = e.which === 38 ? -1 : 1;
229
+ const indexModifier = e.keyCode === 38 ? -1 : 1;
230
230
 
231
231
  ([...treeTabbableItems]).some((item, i) => {
232
232
  if (item.isSameNode(currLabel)) {
@@ -238,7 +238,7 @@ export default {
238
238
  }
239
239
  }
240
240
 
241
- if (e.which === 13) {
241
+ if (e.keyCode === 13) {
242
242
  if (this.selectable) item.selected = !item.selected
243
243
  // Always emitting on enter keydown, but different event for selection.
244
244
  this.emitItemSelection(item, e)
@@ -1,17 +1,51 @@
1
+ import { consoleWarn } from './utils/console'
1
2
  import { mergeConfig } from './utils/config'
2
3
  import NotificationManager from './utils/notification-manager'
3
4
  import { colorPalette, generateColorShades, flattenColors } from './utils/colors'
4
- // import * as directives from './directives'
5
+
6
+ // const detectOSDarkMode = $waveui => {
7
+ // const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')
8
+ // $waveui.preferredTheme = matchMedia.matches ? 'dark' : 'light'
9
+ // $waveui.switchTheme($waveui.preferredTheme)
10
+
11
+ // matchMedia.addEventListener('change', event => {
12
+ // $waveui.preferredTheme = event.matches ? 'dark' : 'light'
13
+ // $waveui.switchTheme($waveui.preferredTheme)
14
+ // })
15
+ // }
5
16
 
6
17
  /**
7
18
  * Inject presets into a Vue component props defaults before its registration into the app.
19
+ * If a preset is not found in the given component props, try to find it in its mixins, if any.
8
20
  *
21
+ * @todo remove mixins-related code when stopping support for Vue 2.
9
22
  * @param {Object} component the Vue component to inject presets into.
10
23
  * @param {Object} presets the presets to inject. E.g. `{ bgColor: 'green' }`.
11
24
  */
12
25
  const injectPresets = (component, presets) => {
13
26
  for (const preset in presets) {
14
- component.props[preset].default = presets[preset]
27
+ // If we don't have the prop output a warning and continue.
28
+ if (!component.props?.[preset]) {
29
+ let foundProp = false
30
+ // Check to see if the prop exists on a mixin when it doesn't exist on the component.
31
+ // @todo: remove this check when there is no more Vue 2 and mixins: mixins are now deprecated.
32
+ if (Array.isArray(component.mixins) && component.mixins.length) {
33
+ // Loop through the array of mixin, and if we find the prop in one, update its default value.
34
+ for (const mixin of component.mixins) {
35
+ if (mixin?.props?.[preset]) {
36
+ mixin.props[preset].default = presets[preset]
37
+ foundProp = true
38
+ break
39
+ }
40
+ }
41
+
42
+ // If the given prop (= preset) is still not found in the mixins props raise warning.
43
+ if (!foundProp) consoleWarn(`Attempting to set a preset on a prop that doesn't exist: \`${component.name}.${preset}\`.`)
44
+ continue // Continue to the next preset.
45
+ }
46
+ }
47
+
48
+ else component.props[preset].default = presets[preset]
15
49
  }
16
50
  }
17
51
 
@@ -22,7 +22,8 @@ export default {
22
22
  noPosition: { type: Boolean },
23
23
  zIndex: { type: [Number, String, Boolean] },
24
24
  // Optionally designate an external activator.
25
- activator: { type: [String, Object] } // The activator can be a DOM string selector, a ref or a DOM node.
25
+ // The activator can be a DOM string selector, a ref or a DOM node.
26
+ activator: { type: [String, Object] }
26
27
  },
27
28
 
28
29
  inject: {
@@ -35,7 +36,11 @@ export default {
35
36
  // as is in an array so we can delete them on destroy.
36
37
  // This only applies to the activatorEventHandlers, the other events listeners can be removed
37
38
  // normally.
38
- docEventListenersHandlers: []
39
+ docEventListenersHandlers: [],
40
+ // The user may open and close the detachable so fast (like when toggling on hover) that it
41
+ // should not show up at all. Keep the ability to cancel the opening timer (if there is a set
42
+ // delay prop).
43
+ openTimeout: null
39
44
  }),
40
45
 
41
46
  computed: {
@@ -111,6 +116,13 @@ export default {
111
116
  (['left', 'right'].includes(this.position) && this.alignBottom && 'bottom') ||
112
117
  ''
113
118
  )
119
+ },
120
+
121
+ shouldShowOnClick () {
122
+ // For props simplicity, the w-tooltip component has the `showOnHover` prop,
123
+ // whereas the w-menu has `showOnClick`.
124
+ return (this.$options.props.showOnHover && !this.showOnHover) ||
125
+ (this.$options.props.showOnClick && this.showOnClick)
114
126
  }
115
127
  },
116
128
 
@@ -119,7 +131,10 @@ export default {
119
131
  async open (e) {
120
132
  // A tiny delay may help positioning the detachable correctly in case of multiple activators
121
133
  // with different menu contents.
122
- if (this.delay) await new Promise(resolve => setTimeout(resolve, this.delay))
134
+ if (this.delay) await new Promise(resolve => (this.openTimeout = setTimeout(resolve, this.delay)))
135
+
136
+ // Cancel opening if the timeout has been cancelled by blur event (when going fast).
137
+ if (this.delay && !this.openTimeout) return
123
138
 
124
139
  this.detachableVisible = true
125
140
 
@@ -336,7 +351,7 @@ export default {
336
351
  else {
337
352
  this.$nextTick(() => {
338
353
  if (this.activator) this.bindActivatorEvents()
339
- if (this.value) this.toggle({ type: 'click', target: this.activatorEl })
354
+ if (this.value) this.open({ target: this.activatorEl })
340
355
  })
341
356
  }
342
357
 
@@ -346,7 +361,10 @@ export default {
346
361
  wrapper.parentNode.insertBefore(this.overlayEl, wrapper)
347
362
  }
348
363
 
349
- if (this.value && this.activator) this.toggle({ type: 'click', target: this.activatorEl })
364
+ if (this.value && this.activator) {
365
+ this.toggle({ type: this.shouldShowOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
366
+ }
367
+ else if (this.value) this.open({ target: this.activatorEl })
350
368
  },
351
369
 
352
370
  beforeDestroy () {
@@ -368,7 +386,10 @@ export default {
368
386
 
369
387
  watch: {
370
388
  value (bool) {
371
- if (!!bool !== this.detachableVisible) this.toggle({ type: 'click', target: this.activatorEl })
389
+ if (!!bool !== this.detachableVisible) {
390
+ if (bool) this.open({ target: this.activatorEl })
391
+ else this.close()
392
+ }
372
393
  },
373
394
  appendTo () {
374
395
  this.removeFromDOM()
@@ -1,3 +1,21 @@
1
+ @use "sass:map";
2
+
3
+ // The CSS variables are used in the dynamic-css.js file in order to reuse the same SCSS
4
+ // variable presets.
5
+ :root {
6
+ --w-base-increment: #{$base-increment};
7
+ --w-css-scope: #{$css-scope};
8
+ --w-base-bg-color-rgb: #{map.get($theme-light, 'base-bg-color-rgb')};
9
+ --w-base-color-rgb: #{map.get($theme-light, 'base-color-rgb')};
10
+ --w-contrast-bg-color-rgb: #{map.get($theme-light, 'contrast-bg-color-rgb')};
11
+ --w-contrast-color-rgb: #{map.get($theme-light, 'contrast-color-rgb')};
12
+ --w-caption-color-rgb: #{map.get($theme-light, 'caption-color-rgb')};
13
+ --w-disabled-color-rgb: #{map.get($theme-light, 'disabled-color-rgb')};
14
+
15
+ background-color: rgb(var(--w-base-bg-color-rgb));
16
+ color: rgb(var(--w-base-color-rgb));
17
+ }
18
+
1
19
  * {outline: none;margin: 0;padding: 0;}
2
20
 
3
21
  body {overflow-x: hidden;}
@@ -5,6 +5,39 @@
5
5
  // @return $a / $b;
6
6
  }
7
7
 
8
+ // THEME COLORS.
9
+ // ========================================================
10
+ // These colors are defined by a list of RBG channels only, so you can later apply any alpha channel.
11
+ // If you don't need themes, you can leave this as is and override the global defaults.
12
+ $theme-light: (
13
+ base-bg-color-rgb: (255, 255, 255), // #fff.
14
+ base-color-rgb: (0, 0, 0), // #000.
15
+ contrast-bg-color-rgb: (0, 0, 0), // #000.
16
+ contrast-color-rgb: (255, 255, 255), // #fff.
17
+ caption-color-rgb: (80, 80, 80, 0.7), // #505050.
18
+ disabled-color-rgb: (204, 204, 204), // #ccc.
19
+ ) !default;
20
+
21
+ $theme-dark: (
22
+ base-bg-color-rgb: (34, 34, 34), // #222.
23
+ base-color-rgb: (255, 255, 255), // #fff.
24
+ contrast-bg-color-rgb: (255, 255, 255), // #fff.
25
+ contrast-color-rgb: (0, 0, 0), // #000.
26
+ caption-color-rgb: (175, 175, 175, 0.7), // #afafaf.
27
+ disabled-color-rgb: (74, 74, 74), // #4a4a4a.
28
+ ) !default;
29
+
30
+ // These variables are filled up with the current theme colors for you to use.
31
+ $primary: var(--w-primary-color);
32
+ $secondary: var(--w-secondary-color);
33
+ $base-bg-color: rgb(var(--w-base-bg-color-rgb));
34
+ $base-color: rgb(var(--w-base-color-rgb));
35
+ $contrast-bg-color: rgb(var(--w-contrast-bg-color-rgb));
36
+ $contrast-color: rgb(var(--w-contrast-color-rgb));
37
+ $caption-color: rgb(var(--w-caption-color-rgb));
38
+ // When a form element is disabled (checkbox, radio, input, select list).
39
+ $disabled-color: rgb(var(--w-disabled-color-rgb));
40
+
8
41
  // GLOBAL DEFAULTS.
9
42
  // ========================================================
10
43
  $css-scope: '.w-app' !default; // Allows control on CSS rules priority.
@@ -14,8 +47,8 @@ $use-layout-classes: true !default;
14
47
  $base-font-size: 14px !default; // Must be a px unit.
15
48
  $base-increment: round(divide($base-font-size, 4)) !default;
16
49
  $layout-padding: $base-increment * 4 !default; // Applied on the .content-wrap tag.
17
- $border-radius: 3px !default;
18
- $border-color: rgba(0, 0, 0, 0.15);
50
+ $border-radius: 4px !default;
51
+ $border-color: rgba(var(--w-contrast-bg-color-rgb), 0.12) !default;
19
52
  $border: 1px solid $border-color !default;
20
53
  $transition-duration: 0.25s !default;
21
54
  $fast-transition-duration: 0.15s !default;
@@ -28,34 +61,95 @@ $form-field-height: round(2 * $base-font-size) !default;
28
61
  // Always an even number for better vertical alignment. (Used in checkbox, radio, switch)
29
62
  $small-form-el-size: round(divide(1.3 * $base-font-size, 2)) * 2 !default;
30
63
 
64
+ // Detachable elements are: w-tooltip, w-menu, w-confirm.
65
+ $detachable-bg-color: $base-bg-color !default;
66
+ $detachable-color: $base-color !default;
67
+
31
68
  // COMPONENTS DEFAULTS.
32
69
  // ========================================================
70
+ // w-confirm.
71
+ // --------------------------------------------------------
72
+ $confirm-bg-color: $detachable-bg-color !default;
73
+ $confirm-color: $detachable-color !default;
74
+ // --------------------------------------------------------
75
+
76
+ // w-dialog.
77
+ // --------------------------------------------------------
78
+ $dialog-bg-color: $base-bg-color !default;
79
+ // --------------------------------------------------------
80
+
81
+ // w-divider.
82
+ // --------------------------------------------------------
83
+ $divider-color: $border-color !default;
84
+ // --------------------------------------------------------
85
+
33
86
  // w-drawer.
87
+ // --------------------------------------------------------
34
88
  $drawer-max-size: 380px !default;
89
+ $drawer-bg-color: $base-bg-color !default;
90
+ // --------------------------------------------------------
91
+
92
+ // w-menu.
93
+ // --------------------------------------------------------
94
+ $menu-bg-color: $detachable-bg-color !default;
95
+ $menu-color: $detachable-color !default;
96
+ // --------------------------------------------------------
97
+
98
+ // w-progress.
99
+ // --------------------------------------------------------
100
+ $progress-bg-color: rgba(var(--w-contrast-bg-color-rgb), 0.15) !default;
101
+ // --------------------------------------------------------
102
+
103
+ // w-rating.
104
+ // --------------------------------------------------------
105
+ $rating-bg-color: rgba(var(--w-contrast-bg-color-rgb), 0.25) !default;
35
106
  // --------------------------------------------------------
36
107
 
37
108
  // w-slider.
38
109
  // --------------------------------------------------------
39
110
  $slider-height: $base-increment !default;
40
- $slider-track-color: #ddd;
111
+ $slider-track-color: rgba(var(--w-contrast-bg-color-rgb), 0.15) !default;
112
+ $slider-thumb-button-bg-color: $base-bg-color !default;
113
+ $slider-thumb-label-bg-color: $base-bg-color !default;
114
+ $slider-thumb-label-color: rgba(var(--w-base-color-rgb), 0.75) !default;
115
+ $slider-step-label-bg-color: rgba(var(--w-contrast-bg-color-rgb), 0.2) !default;
116
+ $slider-step-label-color: rgba(var(--w-base-color-rgb), 0.5) !default;
117
+
118
+ // w-switch.
119
+ // --------------------------------------------------------
120
+ $switch-inactive-color: rgba(var(--w-contrast-bg-color-rgb), 0.25) !default;
121
+ $switch-thumb-color: #fff !default;
41
122
  // --------------------------------------------------------
42
123
 
43
124
  // w-table.
44
125
  // --------------------------------------------------------
45
- $table-tr-odd-color: rgba(0, 0, 0, 0.02);
46
- $table-tr-hover-color: rgba(0, 0, 0, 0.05);
47
- $table-color: rgba(0, 0, 0, 0.7);
126
+ $table-tr-odd-color: rgba(0, 0, 0, 0.02) !default;
127
+ $table-tr-hover-color: rgba(0, 0, 0, 0.05) !default;
128
+ $table-color: rgba(var(--w-contrast-color-rgb), 0.7) !default;
48
129
  // --------------------------------------------------------
49
130
 
50
131
  // w-textarea.
51
132
  // --------------------------------------------------------
52
- $textarea-line-height: 1.2;
133
+ $textarea-line-height: 1.2 !default;
134
+ // --------------------------------------------------------
135
+
136
+ // w-timeline.
137
+ // --------------------------------------------------------
138
+ $timeline-bullet-color: $base-bg-color !default;
139
+ $timeline-bg-color: rgba(var(--w-contrast-bg-color-rgb), 0.25) !default;
140
+ // --------------------------------------------------------
141
+
142
+ // w-toolbar.
143
+ // --------------------------------------------------------
144
+ $toolbar-max-size: 380px !default;
145
+ $toolbar-bg-color: $base-bg-color !default;
53
146
  // --------------------------------------------------------
54
147
 
55
148
  // w-tooltip.
56
149
  // --------------------------------------------------------
57
- $tooltip-bg-color: #fff;
58
- $tooltip-color: rgba(0, 0, 0, 0.7);
150
+ $tooltip-bg-color: $detachable-bg-color !default;
151
+ $tooltip-color: $detachable-color !default;
152
+ $tooltip-border-color: $border-color !default;
59
153
  // --------------------------------------------------------
60
154
 
61
155
  // Mixins.
@@ -1,4 +1,3 @@
1
- @import './variables';
2
1
  @import './base';
3
2
  @import './typography';
4
3
  @import './layout';
@@ -7,15 +7,18 @@ const cssVars = {
7
7
 
8
8
  const generateColors = config => {
9
9
  let styles = ''
10
+ const cssVariables = {}
10
11
  const { cssScope } = cssVars
11
12
 
12
13
  // Extract status colors and place them after the other colors.
13
14
  const { info, warning, success, error, ...colors } = config.colors
14
15
 
15
- for (const color in colors) {
16
+ // User custom colors.
17
+ // ------------------------------------------------------
18
+ for (const colorName in colors) {
16
19
  styles +=
17
- `${cssScope} .${color}--bg{background-color:${config.colors[color]}}` +
18
- `${cssScope} .${color}{color:${config.colors[color]}}`
20
+ `${cssScope} .${colorName}--bg{background-color:${config.colors[colorName]}}` +
21
+ `${cssScope} .${colorName}{color:${config.colors[colorName]}}`
19
22
  }
20
23
 
21
24
  // Color shades are generated in core.js, if the option is on.
@@ -36,12 +39,19 @@ const generateColors = config => {
36
39
  `${cssScope} .${color}{color:${config.colors[color]}}`
37
40
  }
38
41
 
39
- // Add the primary color to the CSS variables for reuse in components.
40
- const cssVariables = []
41
- cssVariables.push(`--primary: ${config.colors.primary}`)
42
- styles += `:root {${cssVariables.join(';')}}`
42
+ // Creating CSS3 variables.
43
+ // ------------------------------------------------------
44
+ // Create a CSS variable for each color for theming and reuse in components.
45
+ // Status colors must remain after the other colors so they have priority in form validations.
46
+ // That only makes sense when there are 2 colors on the same element: e.g. `span.primary.error`.
47
+ const allColors = { ...colors, info, warning, success, error }
48
+ for (const colorName in allColors) cssVariables[colorName] = allColors[colorName]
49
+ let cssVariablesString = ''
50
+ Object.entries(cssVariables).forEach(([colorName, colorHex]) => {
51
+ cssVariablesString += `--w-${colorName}-color: ${colorHex};`
52
+ })
43
53
 
44
- return styles
54
+ return `:root{${cssVariablesString}}${styles}`
45
55
  }
46
56
 
47
57
  // Generate the layout grid. E.g. xs1, xs2, ..., xl12.
@@ -153,6 +163,7 @@ const genBreakpointLayoutClasses = breakpoints => {
153
163
  'text-nowrap{white-space:nowrap}',
154
164
  'row{flex-direction:row}',
155
165
  'column{flex-direction:column}',
166
+ 'column-reverse{flex-direction:column-reverse}',
156
167
  'grow{flex-grow:1;flex-basis:auto}',
157
168
  'no-grow{flex-grow:0}',
158
169
  'shrink{flex-shrink:1;margin-left:auto;margin-right:auto}',