primevue-mirror/apps/showcase/doc/popover/BasicDoc.vue

230 lines
9.8 KiB
Vue
Raw Permalink Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2024-04-18 14:22:30 +00:00
<p>Popover is accessed via its ref and visibility is controlled using <i>toggle</i>, <i>show</i> and <i>hide</i> functions with an event of the target.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-01-24 10:00:53 +00:00
<Button type="button" icon="pi pi-share-alt" label="Share" @click="toggle" />
2023-02-28 08:29:30 +00:00
2024-04-18 14:22:30 +00:00
<Popover ref="op">
2024-05-20 12:14:38 +00:00
<div class="flex flex-col gap-4 w-[25rem]">
2024-01-24 10:00:53 +00:00
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Share this document</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-20 12:14:38 +00:00
<InputText value="https://primevue.org/12323ff26t2g243g423g234gg52hy25XADXAG3" readonly class="w-[25rem]"></InputText>
2024-01-24 10:00:53 +00:00
<InputGroupAddon>
<i class="pi pi-copy"></i>
</InputGroupAddon>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Invite Member</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-14 07:48:57 +00:00
<InputText disabled></InputText>
2024-01-24 10:00:53 +00:00
<Button label="Invite" icon="pi pi-users"></Button>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Team Members</span>
2024-05-20 12:14:38 +00:00
<ul class="list-none p-0 m-0 flex flex-col gap-4">
<li v-for="member in members" :key="member.name" class="flex items-center gap-2">
2024-01-24 10:29:08 +00:00
<img :src="`https://primefaces.org/cdn/primevue/images/avatar/${member.image}`" style="width: 32px" />
2024-01-24 10:00:53 +00:00
<div>
2024-01-24 10:29:08 +00:00
<span class="font-medium">{{ member.name }}</span>
2024-05-20 12:14:38 +00:00
<div class="text-sm text-surface-500 dark:text-surface-400">{{ member.email }}</div>
2024-01-24 10:00:53 +00:00
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-2 text-surface-500 dark:text-surface-400 ml-auto text-sm">
2024-01-24 10:29:08 +00:00
<span>{{ member.role }}</span>
2024-01-24 10:00:53 +00:00
<i class="pi pi-angle-down"></i>
</div>
</li>
</ul>
</div>
</div>
2024-04-18 14:22:30 +00:00
</Popover>
2023-02-28 08:29:30 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
2024-01-24 10:29:08 +00:00
members: [
{ name: 'Amy Elsner', image: 'amyelsner.png', email: 'amy@email.com', role: 'Owner' },
{ name: 'Bernardo Dominic', image: 'bernardodominic.png', email: 'bernardo@email.com', role: 'Editor' },
{ name: 'Ioni Bowcher', image: 'ionibowcher.png', email: 'ioni@email.com', role: 'Viewer' }
],
2023-02-28 08:29:30 +00:00
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Button type="button" icon="pi pi-share-alt" label="Share" @click="toggle" />
2023-02-28 08:29:30 +00:00
2024-04-18 14:22:30 +00:00
<Popover ref="op">
2024-05-20 12:14:38 +00:00
<div class="flex flex-col gap-4 w-[25rem]">
2024-01-24 10:00:53 +00:00
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Share this document</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-20 12:14:38 +00:00
<InputText value="https://primevue.org/12323ff26t2g243g423g234gg52hy25XADXAG3" readonly class="w-[25rem]"></InputText>
2024-01-24 10:00:53 +00:00
<InputGroupAddon>
<i class="pi pi-copy"></i>
</InputGroupAddon>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Invite Member</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-14 07:48:57 +00:00
<InputText disabled />
2024-01-24 10:00:53 +00:00
<Button label="Invite" icon="pi pi-users"></Button>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Team Members</span>
2024-05-20 12:14:38 +00:00
<ul class="list-none p-0 m-0 flex flex-col gap-4">
<li v-for="member in members" :key="member.name" class="flex items-center gap-2">
2024-01-24 10:29:08 +00:00
<img :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${member.image}\`" style="width: 32px" />
2024-01-24 10:00:53 +00:00
<div>
2024-01-24 10:29:08 +00:00
<span class="font-medium">{{ member.name }}</span>
2024-05-20 12:14:38 +00:00
<div class="text-sm text-surface-500 dark:text-surface-400">{{ member.email }}</div>
2024-01-24 10:00:53 +00:00
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-2 text-surface-500 dark:text-surface-400 ml-auto text-sm">
2024-01-24 10:29:08 +00:00
<span>{{ member.role }}</span>
2024-01-24 10:00:53 +00:00
<i class="pi pi-angle-down"></i>
</div>
</li>
</ul>
</div>
</div>
2024-04-18 14:22:30 +00:00
</Popover>
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
<Button type="button" icon="pi pi-share-alt" label="Share" @click="toggle" />
2023-02-28 08:29:30 +00:00
2024-04-18 14:22:30 +00:00
<Popover ref="op">
2024-05-20 12:14:38 +00:00
<div class="flex flex-col gap-4 w-[25rem]">
2024-01-24 10:00:53 +00:00
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Share this document</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-20 12:14:38 +00:00
<InputText value="https://primevue.org/12323ff26t2g243g423g234gg52hy25XADXAG3" readonly class="w-[25rem]"></InputText>
2024-01-24 10:00:53 +00:00
<InputGroupAddon>
<i class="pi pi-copy"></i>
</InputGroupAddon>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Invite Member</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-14 07:48:57 +00:00
<InputText disabled />
2024-01-24 10:00:53 +00:00
<Button label="Invite" icon="pi pi-users"></Button>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Team Members</span>
2024-05-20 12:14:38 +00:00
<ul class="list-none p-0 m-0 flex flex-col gap-4">
<li v-for="member in members" :key="member.name" class="flex items-center gap-2">
2024-01-24 10:29:08 +00:00
<img :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${member.image}\`" style="width: 32px" />
2024-01-24 10:00:53 +00:00
<div>
2024-01-24 10:29:08 +00:00
<span class="font-medium">{{ member.name }}</span>
2024-05-20 12:14:38 +00:00
<div class="text-sm text-surface-500 dark:text-surface-400">{{ member.email }}</div>
2024-01-24 10:00:53 +00:00
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-2 text-surface-500 dark:text-surface-400 ml-auto text-sm">
2024-01-24 10:29:08 +00:00
<span>{{ member.role }}</span>
2024-01-24 10:00:53 +00:00
<i class="pi pi-angle-down"></i>
</div>
</li>
</ul>
</div>
</div>
2024-04-18 14:22:30 +00:00
</Popover>
2023-02-28 08:29:30 +00:00
</div>
</template>
<script>
export default {
2024-01-24 10:29:08 +00:00
data() {
return {
members: [
{ name: 'Amy Elsner', image: 'amyelsner.png', email: 'amy@email.com', role: 'Owner' },
{ name: 'Bernardo Dominic', image: 'bernardodominic.png', email: 'bernardo@email.com', role: 'Editor' },
{ name: 'Ioni Bowcher', image: 'ionibowcher.png', email: 'ioni@email.com', role: 'Viewer' }
]
}
},
2023-02-28 08:29:30 +00:00
methods: {
toggle(event) {
this.$refs.op.toggle(event);
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
<Button type="button" icon="pi pi-share-alt" label="Share" @click="toggle" />
2023-02-28 08:29:30 +00:00
2024-04-18 14:22:30 +00:00
<Popover ref="op">
2024-05-20 12:14:38 +00:00
<div class="flex flex-col gap-4 w-[25rem]">
2024-01-24 10:00:53 +00:00
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Share this document</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-20 12:14:38 +00:00
<InputText value="https://primevue.org/12323ff26t2g243g423g234gg52hy25XADXAG3" readonly class="w-[25rem]"></InputText>
2024-01-24 10:00:53 +00:00
<InputGroupAddon>
<i class="pi pi-copy"></i>
</InputGroupAddon>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Invite Member</span>
2024-01-24 10:00:53 +00:00
<InputGroup>
2024-05-14 07:48:57 +00:00
<InputText disabled />
2024-01-24 10:00:53 +00:00
<Button label="Invite" icon="pi pi-users"></Button>
</InputGroup>
</div>
<div>
2024-05-21 11:17:35 +00:00
<span class="font-medium block mb-2">Team Members</span>
2024-05-20 12:14:38 +00:00
<ul class="list-none p-0 m-0 flex flex-col gap-4">
<li v-for="member in members" :key="member.name" class="flex items-center gap-2">
2024-01-24 10:29:08 +00:00
<img :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${member.image}\`" style="width: 32px" />
2024-01-24 10:00:53 +00:00
<div>
2024-01-24 10:29:08 +00:00
<span class="font-medium">{{ member.name }}</span>
2024-05-20 12:14:38 +00:00
<div class="text-sm text-surface-500 dark:text-surface-400">{{ member.email }}</div>
2024-01-24 10:00:53 +00:00
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-2 text-surface-500 dark:text-surface-400 ml-auto text-sm">
2024-01-24 10:29:08 +00:00
<span>{{ member.role }}</span>
2024-01-24 10:00:53 +00:00
<i class="pi pi-angle-down"></i>
</div>
</li>
</ul>
</div>
</div>
2024-04-18 14:22:30 +00:00
</Popover>
2023-02-28 08:29:30 +00:00
</div>
</template>
<script setup>
import { ref } from "vue";
const op = ref();
2024-01-24 10:29:08 +00:00
const members = ref([
{ name: 'Amy Elsner', image: 'amyelsner.png', email: 'amy@email.com', role: 'Owner' },
{ name: 'Bernardo Dominic', image: 'bernardodominic.png', email: 'bernardo@email.com', role: 'Editor' },
{ name: 'Ioni Bowcher', image: 'ionibowcher.png', email: 'ioni@email.com', role: 'Viewer' }
]);
2023-11-02 06:54:55 +00:00
2023-02-28 08:29:30 +00:00
const toggle = (event) => {
op.value.toggle(event);
}
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
methods: {
toggle(event) {
this.$refs.op.toggle(event);
}
}
};
</script>