vueless 0.0.655 → 0.0.656
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
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -3,6 +3,7 @@ import { computed, ref } from "vue";
|
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
6
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
7
|
|
|
7
8
|
import defaultConfig from "./config.ts";
|
|
8
9
|
import { COMPONENT_NAME, PLACEMENT } from "./constants.ts";
|
|
@@ -87,8 +88,14 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
87
88
|
</div>
|
|
88
89
|
|
|
89
90
|
<!-- `v-bind` isn't assigned, because the div is system -->
|
|
90
|
-
<div v-if="label || error || description">
|
|
91
|
-
<label
|
|
91
|
+
<div v-if="label || hasSlotContent($slots['label']) || error || description">
|
|
92
|
+
<label
|
|
93
|
+
v-if="label || hasSlotContent($slots['label'])"
|
|
94
|
+
ref="labelRef"
|
|
95
|
+
:for="props.for"
|
|
96
|
+
v-bind="labelAttrs"
|
|
97
|
+
:data-test="`${dataTest}-label`"
|
|
98
|
+
>
|
|
92
99
|
<!--
|
|
93
100
|
@slot Use this to add custom content instead of the label.
|
|
94
101
|
@binding {string} label
|
|
@@ -113,7 +120,13 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
113
120
|
</div>
|
|
114
121
|
|
|
115
122
|
<div v-else v-bind="wrapperAttrs">
|
|
116
|
-
<label
|
|
123
|
+
<label
|
|
124
|
+
v-if="label || hasSlotContent($slots['label'])"
|
|
125
|
+
v-bind="labelAttrs"
|
|
126
|
+
ref="labelRef"
|
|
127
|
+
:for="props.for"
|
|
128
|
+
:data-test="`${dataTest}-label`"
|
|
129
|
+
>
|
|
117
130
|
<!--
|
|
118
131
|
@slot Use this to add custom content instead of the label.
|
|
119
132
|
@binding {string} label
|
|
@@ -61,7 +61,7 @@ const slots = useSlots();
|
|
|
61
61
|
const elementId = props.id || useId();
|
|
62
62
|
|
|
63
63
|
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
64
|
-
const labelComponentRef = ref<
|
|
64
|
+
const labelComponentRef = ref<InstanceType<typeof ULabel> | null>(null);
|
|
65
65
|
const leftSlotWrapperRef = ref<HTMLElement | null>(null);
|
|
66
66
|
const wrapperRef = ref<HTMLElement | null>(null);
|
|
67
67
|
|