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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -16,12 +16,12 @@ export default {
items: [], items: [],
code: { code: {
basic: ` basic: `
<AutoComplete v-model="value" :suggestions="items" @complete="search" invalid /> <AutoComplete v-model="value" :suggestions="items" @complete="search" :invalid="value === ''"/>
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -44,7 +44,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -89,13 +89,13 @@ export default {
], ],
code: { code: {
basic: ` 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" /> :optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <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" /> :optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
</div> </div>
</template> </template>
@ -187,7 +187,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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" /> :optionGroupChildren="['states', 'cities']" style="min-width: 14rem" placeholder="Select a City" />
</div> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary /> <Checkbox v-model="checked" :invalid="!checked" binary />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
checked: false, checked: false,
code: { code: {
basic: ` basic: `
<Checkbox v-model="checked" invalid binary /> <Checkbox v-model="checked" :invalid="!checked" binary />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary /> <Checkbox v-model="checked" :invalid="!checked" binary />
</div> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Checkbox v-model="checked" invalid binary /> <Checkbox v-model="checked" :invalid="!checked" binary />
</div> </div>
</template> </template>

View File

@ -1,9 +1,9 @@
<template> <template>
<DocSectionText v-bind="$attrs"> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<DatePicker v-model="date" invalid /> <DatePicker v-model="date" :invalid="date === null" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
date: null, date: null,
code: { code: {
basic: ` basic: `
<DatePicker v-model="date" invalid /> <DatePicker v-model="date" :invalid="date === null" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<DatePicker v-model="date" invalid /> <DatePicker v-model="date" :invalid="date === null" />
</div> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<DatePicker v-model="date" invalid /> <DatePicker v-model="date" :invalid="date === null" />
</div> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
value: '', value: '',
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -38,7 +38,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
value: null, value: null,
code: { code: {
basic: ` basic: `
<InputNumber v-model="value" invalid mode="decimal" :minFractionDigits="2" /> <InputNumber v-model="value" :invalid="value === null" mode="decimal" :minFractionDigits="2" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<InputText v-model="value" invalid /> <InputText v-model="value" :invalid="value === ''" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -12,15 +12,15 @@
export default { export default {
data() { data() {
return { return {
value: null, value: '',
code: { code: {
basic: ` basic: `
<InputText v-model="value" invalid /> <InputText v-model="value" :invalid="value === null" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<InputText v-model="value" invalid /> <InputText v-model="value" :invalid="value === null" />
</div> </div>
</template> </template>
@ -28,7 +28,7 @@ export default {
export default { export default {
data() { data() {
return { return {
value: null value: ''
} }
} }
} }
@ -37,14 +37,14 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<InputText v-model="value" invalid /> <InputText v-model="value" :invalid="value === null" />
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
const value = ref(null); const value = ref('');
<\/script> <\/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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -22,12 +22,12 @@ export default {
], ],
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -51,7 +51,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -12,7 +12,7 @@
export default { export default {
data() { data() {
return { return {
selectedCities: null, selectedCities: [],
cities: [ cities: [
{ name: 'New York', code: 'NY' }, { name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' }, { name: 'Rome', code: 'RM' },
@ -23,13 +23,13 @@ export default {
code: { code: {
basic: ` basic: `
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities" <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: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities" <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> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
export default { export default {
data() { data() {
return { return {
selectedCities: null, selectedCities: [],
cities: [ cities: [
{ name: 'New York', code: 'NY' }, { name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' }, { name: 'Rome', code: 'RM' },
@ -54,14 +54,14 @@ export default {
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" filter placeholder="Select Cities" <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> </div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const selectedCities = ref(); const selectedCities = ref([]);
const cities = ref([ const cities = ref([
{ name: 'New York', code: 'NY' }, { name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' }, { 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> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password invalid /> <Password :invalid="value === null" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
value: null, value: null,
code: { code: {
basic: ` basic: `
<Password invalid /> <Password :invalid="value === null" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password invalid /> <Password :invalid="value === null" />
</div> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Password invalid /> <Password :invalid="value === null" />
</div> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -22,12 +22,12 @@ export default {
], ],
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -51,7 +51,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -12,16 +12,16 @@
export default { export default {
data() { data() {
return { return {
value: 'One-Way', value: null,
options: ['One-Way', 'Return'], options: ['One-Way', 'Return'],
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -29,7 +29,7 @@ export default {
export default { export default {
data() { data() {
return { return {
value: 'One-Way', value: null,
options: ['One-Way', 'Return'], options: ['One-Way', 'Return'],
} }
} }
@ -39,14 +39,14 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
const value = ref('One-Way'); const value = ref(null);
const options = ref(['One-Way', 'Return']); const options = ref(['One-Way', 'Return']);
<\/script> <\/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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
value: '', value: '',
code: { code: {
basic: ` basic: `
<Textarea v-model="value" rows="5" cols="30" invalid /> <Textarea v-model="value" rows="5" cols="30" :invalid="value ===''" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
checked: false, checked: false,
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid /> <ToggleSwitch v-model="checked" :invalid="!checked" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -15,12 +15,12 @@ export default {
checked: false, checked: false,
code: { code: {
basic: ` basic: `
<ToggleSwitch v-model="checked" invalid /> <ToggleSwitch v-model="checked" :invalid="!checked" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid /> <ToggleSwitch v-model="checked" :invalid="!checked" />
</div> </div>
</template> </template>
@ -37,7 +37,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<ToggleSwitch v-model="checked" invalid /> <ToggleSwitch v-model="checked" :invalid="!checked" />
</div> </div>
</template> </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> <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> </DocSectionText>
<div class="card flex justify-center"> <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> </div>
<DocSectionCode :code="code" :service="['NodeService']" v-bind="$attrs" /> <DocSectionCode :code="code" :service="['NodeService']" v-bind="$attrs" />
</template> </template>
@ -15,15 +15,15 @@ export default {
data() { data() {
return { return {
nodes: null, nodes: null,
selectedValue: null, selectedValue: {},
code: { code: {
basic: ` 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: ` options: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -34,7 +34,7 @@ export default {
data() { data() {
return { return {
nodes: null, nodes: null,
selectedValue: null, selectedValue: {},
} }
}, },
mounted() { mounted() {
@ -46,7 +46,7 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <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> </div>
</template> </template>
@ -55,7 +55,7 @@ import { ref, onMounted } from 'vue';
import { NodeService } from './service/NodeService'; import { NodeService } from './service/NodeService';
const nodes = ref(null); const nodes = ref(null);
const selectedValue = ref(null); const selectedValue = ref({});
onMounted(() => { onMounted(() => {
NodeService.getTreeNodes().then((data) => (nodes.value = data)); NodeService.getTreeNodes().then((data) => (nodes.value = data));