Update focus trap demo

pull/4683/head
Cagatay Civici 2023-10-24 00:04:45 +03:00
parent df1874fd35
commit c514b31652
1 changed files with 39 additions and 112 deletions

View File

@ -2,10 +2,13 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>FocusTrap is enabled by attaching the directive with the v- prefix.</p> <p>FocusTrap is enabled by attaching the directive with the v- prefix.</p>
</DocSectionText> </DocSectionText>
<div class="flex justify-content-center p-fluid"> <div class="card flex justify-content-center p-fluid">
<div v-focustrap class="card"> <div v-focustrap class="w-full" style="max-width: 20rem">
<div class="field"> <div class="field">
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus /> <div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
</div> </div>
<div class="field"> <div class="field">
<div class="p-input-icon-right"> <div class="p-input-icon-right">
@ -13,29 +16,9 @@
<InputText id="email" v-model="email" type="email" placeholder="Email" /> <InputText id="email" v-model="email" type="email" placeholder="Email" />
</div> </div>
</div> </div>
<div class="field">
<div class="p-float-label">
<Password v-model="password">
<template #header>
<h6>Pick a password</h6>
</template>
<template #footer>
<Divider />
<p class="mt-2">Suggestions</p>
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li>
<li>At least one uppercase</li>
<li>At least one numeric</li>
<li>Minimum 8 characters</li>
</ul>
</template>
</Password>
<label for="password">Password</label>
</div>
</div>
<div class="field-checkbox"> <div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" /> <Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions*</label> <label for="accept">I agree to the terms and conditions.</label>
</div> </div>
<Button type="submit" label="Submit" class="mt-2" /> <Button type="submit" label="Submit" class="mt-2" />
</div> </div>
@ -49,55 +32,38 @@ export default {
return { return {
name: null, name: null,
email: null, email: null,
password: null, accept: false,
accept: null,
code: { code: {
basic: ` basic: `
<div class="flex justify-content-center p-fluid"> <div v-focustrap class="w-full" style="max-width: 20rem">
<div v-focustrap class="card"> <div class="field">
<div class="field"> <div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus /> <InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div> </div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
</div>
</div>
<div class="field">
<div class="p-float-label">
<Password v-model="password">
<template #header>
<h6>Pick a password</h6>
</template>
<template #footer>
<Divider />
<p class="mt-2">Suggestions</p>
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li>
<li>At least one uppercase</li>
<li>At least one numeric</li>
<li>Minimum 8 characters</li>
</ul>
</template>
</Password>
<label for="password">Password</label>
</div>
</div>
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions*</label>
</div>
<Button type="submit" label="Submit" class="mt-2" />
</div> </div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
</div>
</div>
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions.</label>
</div>
<Button type="submit" label="Submit" class="mt-2" />
</div> </div>
`, `,
options: ` options: `
<template> <template>
<div class="flex justify-content-center p-fluid"> <div class="card flex justify-content-center p-fluid">
<div v-focustrap class="card"> <div v-focustrap class="w-full" style="max-width: 20rem">
<div class="field"> <div class="field">
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus /> <div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
</div> </div>
<div class="field"> <div class="field">
<div class="p-input-icon-right"> <div class="p-input-icon-right">
@ -105,29 +71,9 @@ export default {
<InputText id="email" v-model="email" type="email" placeholder="Email" /> <InputText id="email" v-model="email" type="email" placeholder="Email" />
</div> </div>
</div> </div>
<div class="field">
<div class="p-float-label">
<Password v-model="password">
<template #header>
<h6>Pick a password</h6>
</template>
<template #footer>
<Divider />
<p class="mt-2">Suggestions</p>
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li>
<li>At least one uppercase</li>
<li>At least one numeric</li>
<li>Minimum 8 characters</li>
</ul>
</template>
</Password>
<label for="password">Password</label>
</div>
</div>
<div class="field-checkbox"> <div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" /> <Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions*</label> <label for="accept">I agree to the terms and conditions.</label>
</div> </div>
<Button type="submit" label="Submit" class="mt-2" /> <Button type="submit" label="Submit" class="mt-2" />
</div> </div>
@ -140,8 +86,7 @@ export default {
return { return {
name: null, name: null,
email: null, email: null,
password: null, accept: false
accept: null
}; };
} }
}; };
@ -149,10 +94,13 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="flex justify-content-center p-fluid"> <div class="card flex justify-content-center p-fluid">
<div v-focustrap class="card"> <div v-focustrap class="w-full" style="max-width: 20rem">
<div class="field"> <div class="field">
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus /> <div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
</div> </div>
<div class="field"> <div class="field">
<div class="p-input-icon-right"> <div class="p-input-icon-right">
@ -160,29 +108,9 @@ export default {
<InputText id="email" v-model="email" type="email" placeholder="Email" /> <InputText id="email" v-model="email" type="email" placeholder="Email" />
</div> </div>
</div> </div>
<div class="field">
<div class="p-float-label">
<Password v-model="password">
<template #header>
<h6>Pick a password</h6>
</template>
<template #footer>
<Divider />
<p class="mt-2">Suggestions</p>
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
<li>At least one lowercase</li>
<li>At least one uppercase</li>
<li>At least one numeric</li>
<li>Minimum 8 characters</li>
</ul>
</template>
</Password>
<label for="password">Password</label>
</div>
</div>
<div class="field-checkbox"> <div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" /> <Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions*</label> <label for="accept">I agree to the terms and conditions.</label>
</div> </div>
<Button type="submit" label="Submit" class="mt-2" /> <Button type="submit" label="Submit" class="mt-2" />
</div> </div>
@ -194,8 +122,7 @@ import { ref } from 'vue';
const name = ref(); const name = ref();
const email = ref(); const email = ref();
const password = ref(); const accept = ref(false);
const accept = ref();
<\/script> <\/script>
` `
} }