Label support for InputNumber

pull/6449/head
Cagatay Civici 2024-09-20 14:22:33 +03:00
parent 4033c34309
commit 4d0ada54b5
3 changed files with 132 additions and 14 deletions

View File

@ -2,10 +2,20 @@
<DocSectionText v-bind="$attrs"> <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> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel> <FloatLabel>
<InputNumber id="number-input" v-model="value" /> <InputNumber v-model="value1" inputId="over_label" mode="currency" currency="USD" locale="en-US" />
<label for="number-input">Number</label> <label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<InputNumber v-model="value2" inputId="in_label" mode="currency" currency="USD" locale="en-US" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<InputNumber v-model="value3" inputId="on_label" mode="currency" currency="USD" locale="en-US" />
<label for="on_label">On Label</label>
</FloatLabel> </FloatLabel>
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
@ -15,20 +25,42 @@
export default { export default {
data() { data() {
return { return {
value: null, value1: null,
value2: null,
value3: null,
code: { code: {
basic: ` basic: `
<FloatLabel> <FloatLabel>
<InputNumber id="number-input" v-model="value" /> <InputNumber v-model="value1" inputId="over_label" mode="currency" currency="USD" locale="en-US" />
<label for="number-input">Number</label> <label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<InputNumber v-model="value2" inputId="in_label" mode="currency" currency="USD" locale="en-US" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<InputNumber v-model="value3" inputId="on_label" mode="currency" currency="USD" locale="en-US" />
<label for="on_label">On Label</label>
</FloatLabel> </FloatLabel>
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel> <FloatLabel>
<InputNumber id="number-input" v-model="value" /> <InputNumber v-model="value1" inputId="over_label" mode="currency" currency="USD" locale="en-US" />
<label for="number-input">Number</label> <label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<InputNumber v-model="value2" inputId="in_label" mode="currency" currency="USD" locale="en-US" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<InputNumber v-model="value3" inputId="on_label" mode="currency" currency="USD" locale="en-US" />
<label for="on_label">On Label</label>
</FloatLabel> </FloatLabel>
</div> </div>
</template> </template>
@ -37,7 +69,9 @@ export default {
export default { export default {
data() { data() {
return { return {
value: null value1: null,
value2: null,
value3: null
}; };
} }
}; };
@ -45,10 +79,20 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel> <FloatLabel>
<InputNumber id="number-input" v-model="value" /> <InputNumber v-model="value1" inputId="over_label" mode="currency" currency="USD" locale="en-US" />
<label for="number-input">Number</label> <label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<InputNumber v-model="value2" inputId="in_label" mode="currency" currency="USD" locale="en-US" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<InputNumber v-model="value3" inputId="on_label" mode="currency" currency="USD" locale="en-US" />
<label for="on_label">On Label</label>
</FloatLabel> </FloatLabel>
</div> </div>
</template> </template>
@ -56,7 +100,9 @@ export default {
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const value = ref(); const value1 = ref(null);
const value2 = ref(null);
const value3 = ref(null);
<\/script> <\/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>
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" />
<label for="price_input">Price</label>
</IftaLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value: 1,
code: {
basic: `
<IftaLabel>
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" />
<label for="price_input">Price</label>
</IftaLabel>
`,
options: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" />
<label for="price_input">Price</label>
</IftaLabel>
</div>
</template>
<script>
export default {
data() {
return {
value: 1
};
}
};
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" />
<label for="price_input">Price</label>
</IftaLabel>
</div>
</template>
<script setup>
import { ref } from "vue";
const value = ref(1);
<\/script>
`
}
};
}
};
</script>

View File

@ -17,6 +17,7 @@ import CurrencyDoc from '@/doc/inputnumber/CurrencyDoc.vue';
import DisabledDoc from '@/doc/inputnumber/DisabledDoc.vue'; import DisabledDoc from '@/doc/inputnumber/DisabledDoc.vue';
import FilledDoc from '@/doc/inputnumber/FilledDoc.vue'; import FilledDoc from '@/doc/inputnumber/FilledDoc.vue';
import FloatLabelDoc from '@/doc/inputnumber/FloatLabelDoc.vue'; import FloatLabelDoc from '@/doc/inputnumber/FloatLabelDoc.vue';
import IftaLabelDoc from '@/doc/inputnumber/IftaLabelDoc.vue';
import ImportDoc from '@/doc/inputnumber/ImportDoc.vue'; import ImportDoc from '@/doc/inputnumber/ImportDoc.vue';
import InvalidDoc from '@/doc/inputnumber/InvalidDoc.vue'; import InvalidDoc from '@/doc/inputnumber/InvalidDoc.vue';
import LocaleDoc from '@/doc/inputnumber/LocaleDoc.vue'; import LocaleDoc from '@/doc/inputnumber/LocaleDoc.vue';
@ -70,6 +71,11 @@ export default {
label: 'Float Label', label: 'Float Label',
component: FloatLabelDoc component: FloatLabelDoc
}, },
{
id: 'iftalabel',
label: 'Ifta Label',
component: IftaLabelDoc
},
{ {
id: 'filled', id: 'filled',
label: 'Filled', label: 'Filled',