wave-ui 3.27.1 → 3.27.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "3.27.1",
3
+ "version": "3.27.2",
4
4
  "description": "A UI framework for Vue.js 3 (and 2) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -49,12 +49,16 @@ component(
49
49
  </template>
50
50
 
51
51
  <script>
52
- import FormElementMixin from '../mixins/form-elements'
52
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
53
53
 
54
54
  export default {
55
55
  name: 'w-checkbox',
56
56
  mixins: [FormElementMixin],
57
57
 
58
+ setup () {
59
+ return useWaveUiFormIds()
60
+ },
61
+
58
62
  inject: {
59
63
  wCheckboxes: { default: null }
60
64
  },
@@ -31,12 +31,16 @@ component(
31
31
 
32
32
  <script>
33
33
  import { reactive } from 'vue'
34
- import FormElementMixin from '../mixins/form-elements'
34
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
35
35
 
36
36
  export default {
37
37
  name: 'w-checkboxes',
38
38
  mixins: [FormElementMixin],
39
39
 
40
+ setup () {
41
+ return useWaveUiFormIds()
42
+ },
43
+
40
44
  props: {
41
45
  items: { type: Array, required: true }, // All the possible options.
42
46
  modelValue: { type: Array }, // v-model on selected option.
@@ -128,7 +128,7 @@ component(
128
128
  * - option to fit to the content using contenteditable div
129
129
  **/
130
130
 
131
- import FormElementMixin from '../mixins/form-elements'
131
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
132
132
  import { reactive } from 'vue'
133
133
 
134
134
  export default {
@@ -136,6 +136,10 @@ export default {
136
136
  mixins: [FormElementMixin],
137
137
  inheritAttrs: false, // The attrs should only be added to the input not the wrapper.
138
138
 
139
+ setup () {
140
+ return useWaveUiFormIds()
141
+ },
142
+
139
143
  props: {
140
144
  modelValue: { default: '' },
141
145
  type: { type: String, default: 'text' },
@@ -47,11 +47,16 @@ component(
47
47
  </template>
48
48
 
49
49
  <script>
50
- import FormElementMixin from '../mixins/form-elements'
50
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
51
51
 
52
52
  export default {
53
53
  name: 'w-radio',
54
54
  mixins: [FormElementMixin],
55
+
56
+ setup () {
57
+ return useWaveUiFormIds()
58
+ },
59
+
55
60
  inject: { wRadios: { default: null } },
56
61
 
57
62
  props: {
@@ -30,12 +30,16 @@ component(
30
30
  </template>
31
31
 
32
32
  <script>
33
- import FormElementMixin from '../mixins/form-elements'
33
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
34
34
 
35
35
  export default {
36
36
  name: 'w-radios',
37
37
  mixins: [FormElementMixin],
38
38
 
39
+ setup () {
40
+ return useWaveUiFormIds()
41
+ },
42
+
39
43
  props: {
40
44
  items: { type: Array, required: true }, // All the possible options.
41
45
  modelValue: { type: [String, Number, Boolean] }, // v-model on selected option.
@@ -29,12 +29,16 @@ component(
29
29
  </template>
30
30
 
31
31
  <script>
32
- import FormElementMixin from '../mixins/form-elements'
32
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
33
33
 
34
34
  export default {
35
35
  name: 'w-rating',
36
36
  mixins: [FormElementMixin],
37
37
 
38
+ setup () {
39
+ return useWaveUiFormIds()
40
+ },
41
+
38
42
  props: {
39
43
  modelValue: {},
40
44
  max: { type: [Number, String], default: 5 },
@@ -108,12 +108,21 @@ component(
108
108
  * @todo Share the common parts between w-input, w-textarea & w-select.
109
109
  **/
110
110
 
111
- import FormElementMixin from '../mixins/form-elements'
111
+ import { computed } from 'vue'
112
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
112
113
 
113
114
  export default {
114
115
  name: 'w-select',
115
116
  mixins: [FormElementMixin],
116
117
 
118
+ setup (props) {
119
+ const { waveUiUseId } = useWaveUiFormIds()
120
+ const selectListId = computed(() =>
121
+ props.id ? `${props.id}__listbox` : `w-select-menu--${waveUiUseId}`
122
+ )
123
+ return { waveUiUseId, selectListId }
124
+ },
125
+
117
126
  props: {
118
127
  items: { type: Array, required: true },
119
128
  modelValue: {}, // v-model on selected item if any.
@@ -147,7 +156,7 @@ export default {
147
156
  light: { type: Boolean },
148
157
  fitToContent: { type: Boolean }
149
158
  // Props from mixin: id, name, disabled, readonly, required, tabindex, validators.
150
- // Computed from mixin: inputId, selectListId, inputName, isDisabled & isReadonly.
159
+ // Computed from mixin: inputId, inputName, isDisabled & isReadonly. `selectListId` from setup.
151
160
  },
152
161
 
153
162
  emits: ['input', 'update:modelValue', 'focus', 'blur', 'item-click', 'item-select', 'click:inner-icon-left', 'click:inner-icon-right'],
@@ -166,11 +175,6 @@ export default {
166
175
  }),
167
176
 
168
177
  computed: {
169
- /** Prefix for w-list item ids (`id_item-N`) and ARIA listbox linkage; stable with SSR. */
170
- selectListId () {
171
- return this.id ? `${this.id}__listbox` : `w-select-menu--${this.waveUiUseId}`
172
- },
173
-
174
178
  // Check all the items and add a `value` if missing, containing either: value, label or index
175
179
  // in this order.
176
180
  selectItems () {
@@ -78,12 +78,16 @@ component(
78
78
  </template>
79
79
 
80
80
  <script>
81
- import FormElementMixin from '../mixins/form-elements'
81
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
82
82
 
83
83
  export default {
84
84
  name: 'w-slider',
85
85
  mixins: [FormElementMixin],
86
86
 
87
+ setup () {
88
+ return useWaveUiFormIds()
89
+ },
90
+
87
91
  props: {
88
92
  modelValue: { type: Number, default: 0 },
89
93
  color: { type: String, default: 'primary' },
@@ -53,13 +53,17 @@ component(
53
53
  </template>
54
54
 
55
55
  <script>
56
- import FormElementMixin from '../mixins/form-elements'
56
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
57
57
 
58
58
  export default {
59
59
  name: 'w-switch',
60
60
  mixins: [FormElementMixin],
61
61
  inheritAttrs: false, // The attrs should only be added to the input not the wrapper.
62
62
 
63
+ setup () {
64
+ return useWaveUiFormIds()
65
+ },
66
+
63
67
  props: {
64
68
  modelValue: { default: false }, // v-model.
65
69
  label: { type: String, default: '' },
@@ -67,13 +67,17 @@ component(
67
67
  * @todo Share the common parts between w-input, w-textarea & w-select.
68
68
  **/
69
69
 
70
- import FormElementMixin from '../mixins/form-elements'
70
+ import FormElementMixin, { useWaveUiFormIds } from '../mixins/form-elements'
71
71
 
72
72
  export default {
73
73
  name: 'w-textarea',
74
74
  mixins: [FormElementMixin],
75
75
  inheritAttrs: false, // The attrs should only be added to the textarea not the wrapper.
76
76
 
77
+ setup () {
78
+ return useWaveUiFormIds()
79
+ },
80
+
77
81
  props: {
78
82
  modelValue: { default: '' },
79
83
  label: { type: String },
@@ -1,5 +1,10 @@
1
1
  import { useId } from 'vue'
2
2
 
3
+ /** SSR-safe id suffix; call from each component's `setup()` (mixin `setup` is not reliably merged). */
4
+ export function useWaveUiFormIds () {
5
+ return { waveUiUseId: useId() }
6
+ }
7
+
3
8
  export default {
4
9
  inject: {
5
10
  // Used in each form component to determine whether to use the w-form-element wrap or not.
@@ -9,14 +14,6 @@ export default {
9
14
  formProps: { default: () => ({ disabled: false, readonly: false }) }
10
15
  },
11
16
 
12
- setup () {
13
- return {
14
- // SSR-safe unique suffix (Vue 3.5+). Must not start with `_`/`$` or Vue omits it from the
15
- // render context and template/slot access can warn or fail (see exposeSetupStateOnRenderContext).
16
- waveUiUseId: useId()
17
- }
18
- },
19
-
20
17
  props: {
21
18
  /** When set, used as the DOM `id` and for associated labels (`for`). SSR-safe when provided. */
22
19
  id: { type: String },