wave-ui 3.26.1 → 3.27.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.
@@ -2,7 +2,7 @@
2
2
  component(
3
3
  ref="formEl"
4
4
  :is="formRegister ? 'w-form-element' : 'div'"
5
- v-bind="formRegister && { validators, inputValue, disabled: isDisabled, readonly: isReadonly, isFocused }"
5
+ v-bind="formRegister && { validators, inputValue, disabled: isDisabled, readonly: isReadonly, isFocused, noBlurValidation }"
6
6
  v-model:valid="valid"
7
7
  :wrap="hasLabel && labelPosition !== 'inside'"
8
8
  @reset="$emit('update:modelValue', inputValue = '');$emit('input', '')"
@@ -12,17 +12,17 @@ component(
12
12
  template(v-if="labelPosition === 'left'")
13
13
  label.w-textarea__label.w-textarea__label--left.w-form-el-shakable(
14
14
  v-if="$slots.default || label"
15
- :for="`w-textarea--${_.uid}`"
15
+ :for="inputId"
16
16
  :class="labelClasses")
17
17
  slot {{ label }}
18
18
 
19
19
  //- Input wrapper.
20
20
  .w-textarea__textarea-wrap(:class="inputWrapClasses")
21
- slot(name="icon-left" :input-id="`w-textarea--${_.uid}`")
21
+ slot(name="icon-left" :input-id="inputId")
22
22
  w-icon.w-textarea__icon.w-textarea__icon--inner-left(
23
23
  v-if="innerIconLeft"
24
24
  tag="label"
25
- :for="`w-textarea--${_.uid}`"
25
+ :for="inputId"
26
26
  @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
27
27
  textarea.w-textarea__textarea(
28
28
  ref="textarea"
@@ -31,7 +31,7 @@ component(
31
31
  @input="onInput"
32
32
  @focus="onFocus"
33
33
  @blur="onBlur"
34
- :id="`w-textarea--${_.uid}`"
34
+ :id="inputId"
35
35
  :name="inputName"
36
36
  :placeholder="placeholder || null"
37
37
  :rows="rows || null"
@@ -46,18 +46,18 @@ component(
46
46
  v-if="$slots.default || label"
47
47
  :class="labelClasses")
48
48
  slot {{ label }}
49
- slot(name="icon-right" :input-id="`w-textarea--${_.uid}`")
49
+ slot(name="icon-right" :input-id="inputId")
50
50
  w-icon.w-textarea__icon.w-textarea__icon--inner-right(
51
51
  v-if="innerIconRight"
52
52
  tag="label"
53
- :for="`w-textarea--${_.uid}`"
53
+ :for="inputId"
54
54
  @click="$emit('click:inner-icon-right', $event)") {{ innerIconRight }}
55
55
 
56
56
  //- Right label.
57
57
  template(v-if="labelPosition === 'right'")
58
58
  label.w-textarea__label.w-textarea__label--right.w-form-el-shakable(
59
59
  v-if="$slots.default || label"
60
- :for="`w-textarea--${_.uid}`"
60
+ :for="inputId"
61
61
  :class="labelClasses")
62
62
  slot {{ label }}
63
63
  </template>
@@ -95,8 +95,8 @@ export default {
95
95
  cols: { type: [Number, String] },
96
96
  dark: { type: Boolean },
97
97
  light: { type: Boolean }
98
- // Props from mixin: name, disabled, readonly, required, tabindex, validators.
99
- // Computed from mixin: inputName, isDisabled & isReadonly.
98
+ // Props from mixin: id, name, disabled, readonly, required, tabindex, validators.
99
+ // Computed from mixin: inputId, inputName, isDisabled & isReadonly.
100
100
  },
101
101
 
102
102
  emits: ['input', 'update:modelValue', 'focus', 'blur', 'click:inner-icon-left', 'click:inner-icon-right'],
@@ -4,13 +4,14 @@ transition(:name="transitionName" appear @after-leave="onAfterLeave")
4
4
  .w-tooltip(
5
5
  v-if="detachableVisible"
6
6
  ref="detachable"
7
- :key="_.uid"
7
+ :key="_tooltipInstanceId"
8
8
  :class="classes"
9
9
  :style="styles")
10
10
  slot
11
11
  </template>
12
12
 
13
13
  <script>
14
+ import { useId } from 'vue'
14
15
  import { objectifyClasses } from '../utils/index'
15
16
  import DetachableMixin from '../mixins/detachable'
16
17
 
@@ -18,6 +19,10 @@ export default {
18
19
  name: 'w-tooltip',
19
20
  mixins: [DetachableMixin],
20
21
 
22
+ setup () {
23
+ return { _tooltipInstanceId: useId() }
24
+ },
25
+
21
26
  props: {
22
27
  modelValue: {},
23
28
  showOnClick: { type: Boolean },
@@ -1,3 +1,5 @@
1
+ import { useId } from 'vue'
2
+
1
3
  export default {
2
4
  inject: {
3
5
  // Used in each form component to determine whether to use the w-form-element wrap or not.
@@ -7,13 +9,24 @@ export default {
7
9
  formProps: { default: () => ({ disabled: false, readonly: false }) }
8
10
  },
9
11
 
12
+ setup () {
13
+ return {
14
+ // SSR-safe unique suffix (Vue 3.5+). Exposed on `this` for Options API templates.
15
+ _waveUiUseId: useId()
16
+ }
17
+ },
18
+
10
19
  props: {
20
+ /** When set, used as the DOM `id` and for associated labels (`for`). SSR-safe when provided. */
21
+ id: { type: String },
11
22
  name: { type: String }, // When sending data through form.
12
23
  disabled: { type: Boolean },
13
24
  readonly: { type: Boolean },
14
25
  required: { type: Boolean },
15
26
  tabindex: { type: String },
16
- validators: { type: Array }
27
+ validators: { type: Array },
28
+ /** Per-field blur validation: `true` skips blur, `false` forces blur even when `w-form` sets `no-blur-validation`, unset inherits the form. */
29
+ noBlurValidation: { type: Boolean }
17
30
  },
18
31
 
19
32
  data: () => ({
@@ -21,8 +34,14 @@ export default {
21
34
  }),
22
35
 
23
36
  computed: {
37
+ /** Stable DOM id for the control (and labels), including SSR/hydration. */
38
+ inputId () {
39
+ const componentName = this.$options.name || 'w-field'
40
+ return this.id || `${componentName}--${this._waveUiUseId}`
41
+ },
42
+
24
43
  inputName () {
25
- return this.name || `${this.$options.name}--${this._.uid}`
44
+ return this.name || `${this.$options.name}--${this._waveUiUseId}`
26
45
  },
27
46
  isDisabled () {
28
47
  return this.disabled || this.formProps.disabled