Invalid demo updates

pull/5838/head
tugcekucukoglu 2024-06-03 11:28:56 +03:00
parent c6e70a973c
commit 27ab8ee07b
16 changed files with 77 additions and 77 deletions

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<AutoComplete v-model="value" :suggestions="items" @complete="search" invalid />
<AutoComplete v-model="value" :suggestions="items" @complete="search" :invalid="value === ''" />
</div>
<DocSectionCode :code="code" />
</template>
@ -16,12 +16,12 @@ export default {
items: [],
code: {
basic: `
<AutoComplete v-model="value" :suggestions="items" @complete="search" invalid />
<AutoComplete v-model="value" :suggestions="items" @complete="search" :invalid="value === ''"/>
`,
options: `
<template>
<div class="card flex justify-center">
<AutoComplete v-model="value" :suggestions="items" @complete="search" invalid />
<AutoComplete v-model="value" :suggestions="items" @complete="search" :invalid="value === ''"/>
</div>
</template>
@ -44,7 +44,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<AutoComplete v-model="value" :suggestions="items" @complete="search" invalid />
<AutoComplete v-model="value" :suggestions="items" @complete="search" :invalid="value === ''"/>
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<CascadeSelect v-model="selectedCity" invalid :options="countries" optionLabel="cname" optionGroupLabel="name" :optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
<CascadeSelect v-model="selectedCity" :invalid="selectedCity === null" :options="countries" optionLabel="cname" optionGroupLabel="name" :optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
</div>
<DocSectionCode :code="code" />
</template>
@ -89,13 +89,13 @@ export default {
],
code: {
basic: `
<CascadeSelect v-model="selectedCity" invalid :options="countries" optionLabel="cname" optionGroupLabel="name"
<CascadeSelect v-model="selectedCity" :invalid="selectedCity === null" :options="countries" optionLabel="cname" optionGroupLabel="name"
:optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
`,
options: `
<template>
<div class="card flex justify-center">
<CascadeSelect v-model="selectedCity" invalid :options="countries" optionLabel="cname" optionGroupLabel="name"
<CascadeSelect v-model="selectedCity" :invalid="selectedCity === null" :options="countries" optionLabel="cname" optionGroupLabel="name"
:optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
</div>
</template>
@ -187,7 +187,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<CascadeSelect v-model="selectedCity" invalid :options="countries" optionLabel="cname" optionGroupLabel="name"
<CascadeSelect v-model="selectedCity" :invalid="selectedCity === null" :options="countries" optionLabel="cname" optionGroupLabel="name"
:optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary />
<Checkbox v-model="checked" :invalid="!checked" binary />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
checked: false,
code: {
basic: `
<Checkbox v-model="checked" invalid binary />
<Checkbox v-model="checked" :invalid="!checked" binary />
`,
options: `
<template>
<div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary />
<Checkbox v-model="checked" :invalid="!checked" binary />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary />
<Checkbox v-model="checked" :invalid="!checked" binary />
</div>
</template>

View File

@ -1,9 +1,9 @@
<template>
<DocSectionText v-bind="$attrs">
<p>DatePicker is used a controlled input component with <i>v-model</i> property.</p>
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<DatePicker v-model="date" invalid />
<DatePicker v-model="date" :invalid="date === null" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
date: null,
code: {
basic: `
<DatePicker v-model="date" invalid />
<DatePicker v-model="date" :invalid="date === null" />
`,
options: `
<template>
<div class="card flex justify-center">
<DatePicker v-model="date" invalid />
<DatePicker v-model="date" :invalid="date === null" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<DatePicker v-model="date" invalid />
<DatePicker v-model="date" :invalid="date === null" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" invalid />
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" :invalid="value === ''" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
value: '',
code: {
basic: `
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" invalid />
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" :invalid="value ===''" />
`,
options: `
<template>
<div class="card flex justify-center">
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" invalid />
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" :invalid="value ===''" />
</div>
</template>
@ -38,7 +38,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" invalid />
<InputMask v-model="value" mask="99-999999" placeholder="99-999999" :invalid="value ===''" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<InputNumber v-model="value" invalid mode="decimal" :minFractionDigits="2" />
<InputNumber v-model="value" :invalid="value === null" mode="decimal" :minFractionDigits="2" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
value: null,
code: {
basic: `
<InputNumber v-model="value" invalid mode="decimal" :minFractionDigits="2" />
<InputNumber v-model="value" :invalid="value === null" mode="decimal" :minFractionDigits="2" />
`,
options: `
<template>
<div class="card flex justify-center">
<InputNumber v-model="value" invalid mode="decimal" :minFractionDigits="2" />
<InputNumber v-model="value" :invalid="value === null" mode="decimal" :minFractionDigits="2" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<InputNumber v-model="value" invalid mode="decimal" :minFractionDigits="2" />
<InputNumber v-model="value" :invalid="value === null" mode="decimal" :minFractionDigits="2" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<InputText v-model="value" invalid />
<InputText v-model="value" :invalid="value === ''" />
</div>
<DocSectionCode :code="code" />
</template>
@ -12,15 +12,15 @@
export default {
data() {
return {
value: null,
value: '',
code: {
basic: `
<InputText v-model="value" invalid />
<InputText v-model="value" :invalid="value === null" />
`,
options: `
<template>
<div class="card flex justify-center">
<InputText v-model="value" invalid />
<InputText v-model="value" :invalid="value === null" />
</div>
</template>
@ -28,7 +28,7 @@ export default {
export default {
data() {
return {
value: null
value: ''
}
}
}
@ -37,14 +37,14 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<InputText v-model="value" invalid />
<InputText v-model="value" :invalid="value === null" />
</div>
</template>
<script setup>
import { ref } from 'vue';
const value = ref(null);
const value = ref('');
<\/script>
`
}

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" invalid class="w-full md:w-56" />
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
<DocSectionCode :code="code" />
</template>
@ -22,12 +22,12 @@ export default {
],
code: {
basic: `
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" invalid class="w-full md:w-56" />
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" :invalid="selectedCity === null" class="w-full md:w-56" />
`,
options: `
<template>
<div class="card flex justify-center">
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" invalid class="w-full md:w-56" />
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
</template>
@ -51,7 +51,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" invalid class="w-full md:w-56" />
<Listbox v-model="selectedCity" :options="cities" optionLabel="name" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities" :maxSelectedLabels="3" invalid class="w-full md:w-80" />
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities" :maxSelectedLabels="3" :invalid="selectedCities?.length === 0" class="w-full md:w-80" />
</div>
<DocSectionCode :code="code" />
</template>
@ -12,7 +12,7 @@
export default {
data() {
return {
selectedCities: null,
selectedCities: [],
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
@ -23,13 +23,13 @@ export default {
code: {
basic: `
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities"
:maxSelectedLabels="3" invalid class="w-full md:w-80" />
:maxSelectedLabels="3" :invalid="selectedCities === null" class="w-full md:w-80" />
`,
options: `
<template>
<div class="card flex justify-center">
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities"
:maxSelectedLabels="3" invalid class="w-full md:w-80" />
:maxSelectedLabels="3" :invalid="selectedCities === null" class="w-full md:w-80" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
export default {
data() {
return {
selectedCities: null,
selectedCities: [],
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
@ -54,14 +54,14 @@ export default {
<template>
<div class="card flex justify-center">
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities"
:maxSelectedLabels="3" invalid class="w-full md:w-80" />
:maxSelectedLabels="3" :invalid="selectedCities === null" class="w-full md:w-80" />
</div>
</template>
<script setup>
import { ref } from "vue";
const selectedCities = ref();
const selectedCities = ref([]);
const cities = ref([
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<Password invalid />
<Password :invalid="value === null" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
value: null,
code: {
basic: `
<Password invalid />
<Password :invalid="value === null" />
`,
options: `
<template>
<div class="card flex justify-center">
<Password invalid />
<Password :invalid="value === null" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<Password invalid />
<Password :invalid="value === null" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" invalid class="w-full md:w-56" />
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
<DocSectionCode :code="code" />
</template>
@ -22,12 +22,12 @@ export default {
],
code: {
basic: `
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" invalid class="w-full md:w-56" />
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" :invalid="selectedCity === null" class="w-full md:w-56" />
`,
options: `
<template>
<div class="card flex justify-center">
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" invalid class="w-full md:w-56" />
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
</template>
@ -51,7 +51,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" invalid class="w-full md:w-56" />
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="Select a City" :invalid="selectedCity === null" class="w-full md:w-56" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<SelectButton v-model="value" :options="options" aria-labelledby="basic" invalid />
<SelectButton v-model="value" :options="options" aria-labelledby="basic" allowEmpty :invalid="value === null" />
</div>
<DocSectionCode :code="code" />
</template>
@ -12,16 +12,16 @@
export default {
data() {
return {
value: 'One-Way',
value: null,
options: ['One-Way', 'Return'],
code: {
basic: `
<SelectButton v-model="value" :options="options" aria-labelledby="basic" invalid />
<SelectButton v-model="value" :options="options" aria-labelledby="basic" allowEmpty :invalid="value === null" />
`,
options: `
<template>
<div class="card flex justify-center">
<SelectButton v-model="value" :options="options" aria-labelledby="basic" invalid />
<SelectButton v-model="value" :options="options" aria-labelledby="basic" allowEmpty :invalid="value === null" />
</div>
</template>
@ -29,7 +29,7 @@ export default {
export default {
data() {
return {
value: 'One-Way',
value: null,
options: ['One-Way', 'Return'],
}
}
@ -39,14 +39,14 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<SelectButton v-model="value" :options="options" aria-labelledby="basic" invalid />
<SelectButton v-model="value" :options="options" aria-labelledby="basic" allowEmpty :invalid="value === null" />
</div>
</template>
<script setup>
import { ref } from 'vue';
const value = ref('One-Way');
const value = ref(null);
const options = ref(['One-Way', 'Return']);
<\/script>
`

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<Textarea v-model="value" rows="5" cols="30" invalid style="resize: none" />
<Textarea v-model="value" rows="5" cols="30" :invalid="value === ''" style="resize: none" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
value: '',
code: {
basic: `
<Textarea v-model="value" rows="5" cols="30" invalid />
<Textarea v-model="value" rows="5" cols="30" :invalid="value ===''" />
`,
options: `
<template>
<div class="card flex justify-center">
<Textarea v-model="value" rows="5" cols="30" invalid />
<Textarea v-model="value" rows="5" cols="30" :invalid="value ===''" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<Textarea v-model="value" rows="5" cols="30" invalid />
<Textarea v-model="value" rows="5" cols="30" :invalid="value ===''" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" invalid class="w-full sm:w-40" aria-label="Confirmation" />
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" :invalid="!checked" class="w-full sm:w-40" aria-label="Confirmation" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
checked: false,
code: {
basic: `
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" invalid class="w-full sm:w-40" aria-label="Confirmation" />
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" :invalid="!checked" class="w-full sm:w-40" aria-label="Confirmation" />
`,
options: `
<template>
<div class="card flex justify-center">
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" invalid class="w-full sm:w-40" aria-label="Confirmation" />
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" :invalid="!checked" class="w-full sm:w-40" aria-label="Confirmation" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" invalid class="w-full sm:w-40" aria-label="Confirmation" />
<ToggleButton v-model="checked" onIcon="pi pi-check" offIcon="pi pi-times" :invalid="!checked" class="w-full sm:w-40" aria-label="Confirmation" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid />
<ToggleSwitch v-model="checked" :invalid="!checked" />
</div>
<DocSectionCode :code="code" />
</template>
@ -15,12 +15,12 @@ export default {
checked: false,
code: {
basic: `
<ToggleSwitch v-model="checked" invalid />
<ToggleSwitch v-model="checked" :invalid="!checked" />
`,
options: `
<template>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid />
<ToggleSwitch v-model="checked" :invalid="!checked" />
</div>
</template>
@ -37,7 +37,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid />
<ToggleSwitch v-model="checked" :invalid="!checked" />
</div>
</template>

View File

@ -3,7 +3,7 @@
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText>
<div class="card flex justify-center">
<TreeSelect v-model="selectedValue" invalid class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
<TreeSelect v-model="selectedValue" :invalid="Object.keys(selectedValue).length === 0" class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
</div>
<DocSectionCode :code="code" :service="['NodeService']" v-bind="$attrs" />
</template>
@ -15,15 +15,15 @@ export default {
data() {
return {
nodes: null,
selectedValue: null,
selectedValue: {},
code: {
basic: `
<TreeSelect v-model="selectedValue" invalid class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
<TreeSelect v-model="selectedValue" :invalid="Object.keys(selectedValue).length === 0" class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
`,
options: `
<template>
<div class="card flex justify-center">
<TreeSelect v-model="selectedValue" invalid class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
<TreeSelect v-model="selectedValue" :invalid="Object.keys(selectedValue).length === 0" class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
</div>
</template>
@ -34,7 +34,7 @@ export default {
data() {
return {
nodes: null,
selectedValue: null,
selectedValue: {},
}
},
mounted() {
@ -46,7 +46,7 @@ export default {
composition: `
<template>
<div class="card flex justify-center">
<TreeSelect v-model="selectedValue" invalid class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
<TreeSelect v-model="selectedValue" :invalid="Object.keys(selectedValue).length === 0" class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
</div>
</template>
@ -55,7 +55,7 @@ import { ref, onMounted } from 'vue';
import { NodeService } from './service/NodeService';
const nodes = ref(null);
const selectedValue = ref(null);
const selectedValue = ref({});
onMounted(() => {
NodeService.getTreeNodes().then((data) => (nodes.value = data));