wave-ui 3.26.1 → 3.27.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.
@@ -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,11 @@ export default {
18
19
  name: 'w-tooltip',
19
20
  mixins: [DetachableMixin],
20
21
 
22
+ setup () {
23
+ // No leading `_`/`$`: Vue omits those from the render context (setup() reserved prefixes).
24
+ return { tooltipInstanceId: useId() }
25
+ },
26
+
21
27
  props: {
22
28
  modelValue: {},
23
29
  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,25 @@ 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+). 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
+
10
20
  props: {
21
+ /** When set, used as the DOM `id` and for associated labels (`for`). SSR-safe when provided. */
22
+ id: { type: String },
11
23
  name: { type: String }, // When sending data through form.
12
24
  disabled: { type: Boolean },
13
25
  readonly: { type: Boolean },
14
26
  required: { type: Boolean },
15
27
  tabindex: { type: String },
16
- validators: { type: Array }
28
+ validators: { type: Array },
29
+ /** Per-field blur validation: `true` skips blur, `false` forces blur even when `w-form` sets `no-blur-validation`, unset inherits the form. */
30
+ noBlurValidation: { type: Boolean }
17
31
  },
18
32
 
19
33
  data: () => ({
@@ -21,8 +35,14 @@ export default {
21
35
  }),
22
36
 
23
37
  computed: {
38
+ /** Stable DOM id for the control (and labels), including SSR/hydration. */
39
+ inputId () {
40
+ const componentName = this.$options.name || 'w-field'
41
+ return this.id || `${componentName}--${this.waveUiUseId}`
42
+ },
43
+
24
44
  inputName () {
25
- return this.name || `${this.$options.name}--${this._.uid}`
45
+ return this.name || `${this.$options.name}--${this.waveUiUseId}`
26
46
  },
27
47
  isDisabled () {
28
48
  return this.disabled || this.formProps.disabled