Label support for AutoComplete

pull/6449/head
Cagatay Civici 2024-09-20 14:02:15 +03:00
parent 3ed723787f
commit 4033c34309
4 changed files with 150 additions and 15 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>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Float Label</label>
<AutoComplete v-model="value1" inputId="over_label" :suggestions="items" @complete="search" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<AutoComplete v-model="value2" inputId="in_label" :suggestions="items" @complete="search" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<AutoComplete v-model="value3" inputId="on_label" :suggestions="items" @complete="search" />
<label for="on_label">On Label</label>
</FloatLabel>
</div>
<DocSectionCode :code="code" />
@ -15,21 +25,43 @@
export default {
data() {
return {
value: '',
value1: '',
value2: '',
value3: '',
items: [],
code: {
basic: `
<FloatLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Float Label</label>
<AutoComplete v-model="value1" inputId="over_label" :suggestions="items" @complete="search" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<AutoComplete v-model="value2" inputId="in_label" :suggestions="items" @complete="search" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<AutoComplete v-model="value3" inputId="on_label" :suggestions="items" @complete="search" />
<label for="on_label">On Label</label>
</FloatLabel>
`,
options: `
<template>
<div class="card flex justify-center">
<div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Float Label</label>
<AutoComplete v-model="value1" inputId="over_label" :suggestions="items" @complete="search" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<AutoComplete v-model="value2" inputId="in_label" :suggestions="items" @complete="search" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<AutoComplete v-model="value3" inputId="on_label" :suggestions="items" @complete="search" />
<label for="on_label">On Label</label>
</FloatLabel>
</div>
</template>
@ -38,7 +70,9 @@ export default {
export default {
data() {
return {
value: '',
value1: '',
value2: '',
value3: '',
items: []
};
},
@ -52,10 +86,20 @@ export default {
`,
composition: `
<template>
<div class="card flex justify-center">
<div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Float Label</label>
<AutoComplete v-model="value1" inputId="over_label" :suggestions="items" @complete="search" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<AutoComplete v-model="value2" inputId="in_label" :suggestions="items" @complete="search" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<AutoComplete v-model="value3" inputId="on_label" :suggestions="items" @complete="search" />
<label for="on_label">On Label</label>
</FloatLabel>
</div>
</template>
@ -63,7 +107,9 @@ export default {
<script setup>
import { ref } from "vue";
const value = ref("");
const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
const items = ref([]);
const search = (event) => {

View File

@ -0,0 +1,83 @@
<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>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Identifier</label>
</IftaLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value: '',
items: [],
code: {
basic: `
<IftaLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Identifier</label>
</IftaLabel>
`,
options: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Identifier</label>
</IftaLabel>
</div>
</template>
<script>
export default {
data() {
return {
value: '',
items: []
};
},
methods: {
search(event) {
this.items = [...Array(10).keys()].map((item) => event.query + '-' + item);
}
}
};
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<AutoComplete v-model="value" inputId="ac" :suggestions="items" @complete="search" />
<label for="ac">Identifier</label>
</IftaLabel>
</div>
</template>
<script setup>
import { ref } from "vue";
const value = ref("");
const items = ref([]);
const search = (event) => {
items.value = [...Array(10).keys()].map((item) => event.query + '-' + item);
}
<\/script>
`
}
};
},
methods: {
search(event) {
this.items = [...Array(10).keys()].map((item) => event.query + '-' + item);
}
}
};
</script>

View File

@ -27,7 +27,7 @@ export default {
<template>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date"showIcon iconDisplay="input" />
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" />
<label for="date">Date</label>
</IftaLabel>
</div>

View File

@ -19,6 +19,7 @@ import FilledDoc from '@/doc/autocomplete/FilledDoc.vue';
import FloatLabelDoc from '@/doc/autocomplete/FloatLabelDoc.vue';
import ForceSelectionDoc from '@/doc/autocomplete/ForceSelectionDoc.vue';
import GroupDoc from '@/doc/autocomplete/GroupDoc.vue';
import IftaLabelDoc from '@/doc/autocomplete/IftaLabelDoc.vue';
import ImportDoc from '@/doc/autocomplete/ImportDoc.vue';
import InvalidDoc from '@/doc/autocomplete/InvalidDoc.vue';
import MultipleDoc from '@/doc/autocomplete/MultipleDoc.vue';
@ -82,6 +83,11 @@ export default {
label: 'Float Label',
component: FloatLabelDoc
},
{
id: 'iftalabel',
label: 'Ifta Label',
component: IftaLabelDoc
},
{
id: 'filled',
label: 'Filled',