wave-ui 1.49.2 → 1.50.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "1.49.2",
4
- "description": "An emerging UI framework for Vue.js & Vue 3 with only the bright side. :sunny:",
3
+ "version": "1.50.1",
4
+ "description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "main": "./dist/wave-ui.umd.js",
7
7
  "unpkg": "dist/wave-ui.umd.js",
@@ -16,6 +16,7 @@ export { default as WDrawer } from './w-drawer.vue'
16
16
  export { default as WFlex } from './w-flex.vue'
17
17
  export { default as WForm } from './w-form.vue'
18
18
  export { default as WFormElement } from './w-form-element.vue'
19
+ export { default as WGrid } from './w-grid.vue'
19
20
  export { default as WIcon } from './w-icon.vue'
20
21
  export { default as WImage } from './w-image.vue'
21
22
  export { default as WInput } from './w-input.vue'
@@ -9,7 +9,7 @@ w-overlay.w-dialog(
9
9
  :class="classes")
10
10
  transition(:name="transition" appear @after-leave="onClose")
11
11
  w-card.w-dialog__content(
12
- v-if="showContent"
12
+ v-show="showContent"
13
13
  no-border
14
14
  :color="color"
15
15
  :bg-color="bgColor"
@@ -1,8 +1,5 @@
1
1
  <template lang="pug">
2
- component.w-flex-wrap(v-if="gap" :is="tag")
3
- .w-flex(:class="classes")
4
- slot
5
- component.w-flex(v-else :class="classes" :is="tag")
2
+ component.w-flex(:class="classes" :is="tag")
6
3
  slot
7
4
  </template>
8
5
 
@@ -28,7 +25,7 @@ export default {
28
25
  justifySpaceAround: { type: Boolean },
29
26
  justifySpaceEvenly: { type: Boolean },
30
27
  basisZero: { type: Boolean },
31
- gap: { type: Number, default: 0 }
28
+ gap: { type: [Number, String], default: 0 }
32
29
  },
33
30
 
34
31
  computed: {
@@ -51,7 +48,7 @@ export default {
51
48
  'justify-space-around': this.justifySpaceAround,
52
49
  'justify-space-evenly': this.justifySpaceEvenly,
53
50
  'basis-zero': this.basisZero,
54
- [`w-flex--gap${this.gap}`]: this.gap
51
+ [`gap${this.gap}`]: ~~this.gap
55
52
  }
56
53
  }
57
54
  }
@@ -68,12 +65,5 @@ export default {
68
65
  &.wrap {flex-wrap: wrap;}
69
66
  &.basis-zero > * {flex-basis: 0;flex-grow: 1;}
70
67
  &.basis-zero > .no-grow, &.basis-zero > .shrink {flex-grow: 0;}
71
-
72
- @for $i from 1 through 12 {
73
- // Divide by 2 as there are 2 elements having this space.
74
- $space: round($base-increment * divide($i, 2));
75
- &--gap#{$i} {margin: -$space;}
76
- &--gap#{$i} > * {margin: $space;}
77
- }
78
68
  }
79
69
  </style>
@@ -0,0 +1,82 @@
1
+ <template lang="pug">
2
+ component.w-grid(:class="classes" :is="tag")
3
+ slot
4
+ </template>
5
+
6
+ <script>
7
+ export default {
8
+ name: 'w-grid',
9
+ props: {
10
+ tag: { type: String, default: 'div' },
11
+ columns: { type: [Number, Object, String] },
12
+ gap: { type: [Number, Object, String], default: 0 }
13
+ },
14
+
15
+ computed: {
16
+ breakpointsColumns () {
17
+ let columns = { xs: 0, sm: 0, md: 0, lg: 0, xl: 0 }
18
+ switch (typeof this.columns) {
19
+ case 'object':
20
+ columns = Object.assign(columns, this.columns)
21
+ break
22
+ case 'number':
23
+ case 'string':
24
+ columns = Object.keys(columns).reduce((obj, breakpoint) => (obj[breakpoint] = ~~this.columns), {})
25
+ break
26
+ default:
27
+ break
28
+ }
29
+ return columns
30
+ },
31
+
32
+ breakpointsGap () {
33
+ let gap = { xs: 0, sm: 0, md: 0, lg: 0, xl: 0 }
34
+ switch (typeof this.gap) {
35
+ case 'object':
36
+ gap = Object.assign(gap, this.gap)
37
+ break
38
+ case 'number':
39
+ case 'string':
40
+ gap = Object.keys(gap).reduce((obj, breakpoint) => (obj[breakpoint] = ~~this.gap), {})
41
+ break
42
+ default:
43
+ break
44
+ }
45
+ return gap
46
+ },
47
+
48
+ classes () {
49
+ let breakpointsColumns = null
50
+ if (typeof this.columns === 'object') {
51
+ breakpointsColumns = Object.entries(this.breakpointsColumns).reduce((obj, [breakpoint, columns]) => {
52
+ obj[`${breakpoint}-columns${columns}`] = true
53
+ return obj
54
+ }, {})
55
+ }
56
+
57
+ let breakpointsGap = null
58
+ if (typeof this.gap === 'object') {
59
+ breakpointsGap = Object.entries(this.breakpointsGap).reduce((obj, [breakpoint, gap]) => {
60
+ obj[`${breakpoint}-gap${gap}`] = true
61
+ return obj
62
+ }, {})
63
+ }
64
+
65
+ return {
66
+ ...(breakpointsColumns || { [`columns${this.columns}`]: this.columns }),
67
+ ...(breakpointsGap || { [`gap${this.gap}`]: this.gap })
68
+ }
69
+ }
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style lang="scss">
75
+ .w-grid {
76
+ display: grid;
77
+
78
+ @for $i from 1 through 12 {
79
+ &.columns#{$i} {grid-template-columns: repeat($i, 1fr);}
80
+ }
81
+ }
82
+ </style>
@@ -1,7 +1,10 @@
1
1
  <template lang="pug">
2
2
  .w-progress(:class="classes" :style="styles")
3
3
  //- Linear progress.
4
- .w-progress__progress(v-if="!circle" :class="{ full: progressValue === 100 }" :style="`width: ${progressValue}%`")
4
+ .w-progress__progress(
5
+ v-if="!circle"
6
+ :class="{ full: progressValue === 100 }"
7
+ :style="`width: ${progressValue}%`")
5
8
 
6
9
  //- Circular progress.
7
10
  template(v-else)
@@ -79,14 +79,6 @@ export default class WaveUI {
79
79
  // Merge user options into the default config.
80
80
  mergeConfig(options)
81
81
 
82
- // @todo: remove this warning in version 1.40+.
83
- if (config.disableColorShades) {
84
- consoleWarn(
85
- 'WARNING - Since version 1.30, the option `disableColorShades` is replaced with `css.colorShades`.\n' +
86
- 'https://antoniandre.github.io/wave-ui/release-notes'
87
- )
88
- }
89
-
90
82
  // Add color shades for each custom color given in options.
91
83
  if (config.css.colorShades) {
92
84
  config.colorShades = {}
@@ -212,3 +212,8 @@
212
212
  // ----------------------------------------------
213
213
  }
214
214
  }
215
+
216
+ @for $i from 1 through 12 {
217
+ .w-flex.gap#{$i}, .w-grid.gap#{$i} {gap: round($base-increment * $i);}
218
+ }
219
+ .w-flex.gap0, .w-grid.gap0 {gap: 0;}
@@ -6,14 +6,11 @@
6
6
  transition: $duration $delay cubic-bezier(0.18, 0.89, 0.32, 1.28);
7
7
  }
8
8
 
9
- /**
10
- * Generates a triangle arrow on the edge of an element.
11
- *
12
- * @param $color: the color to apply to the triangle.
13
- * @param $selector: the element selector that receives the modifiers (--top, --left, etc.).
14
- * @param $size: the triangle size at the base.
15
- * @param $thickness: the border thickness, 0 to remove the border.
16
- */
9
+ // Generates a triangle arrow on the edge of an element.
10
+ // @param $color: the color to apply to the triangle.
11
+ // @param $selector: the element selector that receives the modifiers (--top, --left, etc.).
12
+ // @param $size: the triangle size at the base.
13
+ // @param $thickness: the border thickness, 0 to remove the border.
17
14
  @mixin triangle($color: white, $selector: '', $size: 7px, $thickness: 1px) {
18
15
  @if ($thickness > 0) {
19
16
  // The underneath border triangle.
@@ -150,7 +150,7 @@ const generateBreakpointSpaces = () => {
150
150
 
151
151
  const genBreakpointLayoutClasses = () => {
152
152
  let styles = ''
153
- const { cssScope } = cssVars
153
+ const { cssScope, baseIncrement } = cssVars
154
154
  const layoutClasses = [
155
155
  'show{display:block}',
156
156
  'hide{display:none}',
@@ -185,6 +185,7 @@ const genBreakpointLayoutClasses = () => {
185
185
  'justify-space-around{justify-content:space-around}',
186
186
  'justify-space-evenly{justify-content:space-evenly}'
187
187
  ]
188
+ const array12 = Array(12).fill()
188
189
 
189
190
  // Define media queries for each breakpoint: xs, sm, md, lg, xl.
190
191
 
@@ -194,6 +195,10 @@ const genBreakpointLayoutClasses = () => {
194
195
  styles +=
195
196
  `@media(min-width:${min}px){` +
196
197
  layoutClasses.map(rule => `${cssScope} .${label}u-${rule}`).join('') +
198
+ // w-grid columns and gap.
199
+ array12.map((item, i) => `.w-grid.${label}u-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
200
+ array12.map((item, i) => `.w-flex.${label}u-gap${i + 1},.w-grid.${label}u-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
201
+ `.w-flex.${label}u-gap0,.w-flex.${label}u-gap0{gap:0}` +
197
202
  '}'
198
203
  }
199
204
  })
@@ -202,6 +207,10 @@ const genBreakpointLayoutClasses = () => {
202
207
  styles +=
203
208
  `@media (min-width:${min}px) and (max-width:${max}px){` +
204
209
  layoutClasses.map(rule => `${cssScope} .${label}-${rule}`).join('') +
210
+ // w-grid columns and gap.
211
+ array12.map((item, i) => `.w-grid.${label}-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
212
+ array12.map((item, i) => `.w-flex.${label}-gap${i + 1},.w-grid.${label}-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
213
+ `.w-flex.${label}-gap0,.w-flex.${label}-gap0{gap:0}` +
205
214
  '}'
206
215
  })
207
216
 
@@ -210,6 +219,10 @@ const genBreakpointLayoutClasses = () => {
210
219
  styles +=
211
220
  `@media (max-width:${max}px){` +
212
221
  layoutClasses.map(rule => `${cssScope} .${label}d-${rule}`).join('') +
222
+ // w-grid columns and gap.
223
+ array12.map((item, i) => `.w-grid.${label}d-columns${i + 1}{grid-template-columns:repeat(${i + 1},1fr);}`).join('') +
224
+ array12.map((item, i) => `.w-flex.${label}d-gap${i + 1},.w-grid.${label}d-gap${i + 1}{gap:${(i + 1) * baseIncrement}px;}`).join('') +
225
+ `.w-flex.${label}d-gap0,.w-flex.${label}d-gap0{gap:0}` +
213
226
  '}'
214
227
  }
215
228
  })