Label support for DatePicker

pull/6449/head
Cagatay Civici 2024-09-20 13:47:24 +03:00
parent 927d156df6
commit 8e3a20d2c6
4 changed files with 96 additions and 8 deletions

View File

@ -2,10 +2,20 @@
<DocSectionText v-bind="$attrs">
<p>A floating label appears on top of the input field when focused. Visit <PrimeVueNuxtLink to="/floatlabel">FloatLabel</PrimeVueNuxtLink> documentation for more information.</p>
</DocSectionText>
<div class="card flex justify-center">
<div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel>
<DatePicker v-model="date" inputId="birth_date" />
<label for="birth_date">Birth Date</label>
<DatePicker v-model="value1" inputId="over_label" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<DatePicker v-model="value3" inputId="on_label" />
<label for="on_label">On Label</label>
</FloatLabel>
</div>
<DocSectionCode :code="code" />
@ -15,7 +25,9 @@
export default {
data() {
return {
date: null,
value1: null,
value2: null,
value3: null,
code: {
basic: `
<FloatLabel>
@ -37,8 +49,10 @@ export default {
export default {
data() {
return {
date: null
};
value1: null,
value2: null,
value3: null,
}
}
};
<\/script>
@ -56,7 +70,9 @@ export default {
<script setup>
import { ref } from "vue";
const date = ref();
const value1 = ref(null);
const value2 = ref(null);
const value3 = ref(null);
<\/script>
`
}

View File

@ -0,0 +1,66 @@
<template>
<DocSectionText v-bind="$attrs">
<p>IftaLabel is used to create infield top aligned labels. Visit <PrimeVueNuxtLink to="/iftalabel">IftaLabel</PrimeVueNuxtLink> documentation for more information.</p>
</DocSectionText>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value: null,
code: {
basic: `
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
`,
options: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
</template>
<script setup>
export default {
data() {
return {
value: null
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
</template>
<script setup>
import { ref } from 'vue';
const value = ref(null);
<\/script>
`
}
};
}
};
</script>

View File

@ -12,6 +12,7 @@ import FilledDoc from '@/doc/datepicker/FilledDoc.vue';
import FloatLabelDoc from '@/doc/datepicker/FloatLabelDoc.vue';
import FormatDoc from '@/doc/datepicker/FormatDoc.vue';
import IconDoc from '@/doc/datepicker/IconDoc.vue';
import IftaLabelDoc from '@/doc/datepicker/IftaLabelDoc.vue';
import ImportDoc from '@/doc/datepicker/ImportDoc.vue';
import InlineDoc from '@/doc/datepicker/InlineDoc.vue';
import InvalidDoc from '@/doc/datepicker/InvalidDoc.vue';
@ -110,6 +111,11 @@ export default {
label: 'Float Label',
component: FloatLabelDoc
},
{
id: 'iftalabel',
label: 'Ifta Label',
component: IftaLabelDoc
},
{
id: 'filled',
label: 'Filled',

View File

@ -375,7 +375,7 @@ const classes = {
{
'p-invalid': props.invalid,
'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': state.focused,
'p-inputwrapper-focus': state.focused || state.overlayVisible,
'p-focus': state.focused || state.overlayVisible,
'p-datepicker-fluid': instance.hasFluid
}