Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doubling attrs in NcPopover and improve docs #3876

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 50 additions & 26 deletions src/components/NcPopover/NcPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,26 @@ open prop on this component;

```vue
<template>
<NcPopover>
<template #trigger>
<NcButton> I am the trigger </NcButton>
</template>
<template>
<form tabindex="0" @submit.prevent>
<h2>this is some content</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. </br>
Vestibulum eget placerat velit.
</p>
<label>
Label element
<input type="text" placehold="input element" />
</label>
</form>
</template>
</NcPopover>
<div style="display: flex">
<NcPopover>
<template #trigger>
<NcButton>I am the trigger</NcButton>
</template>
<template>
<form tabindex="0" @submit.prevent>
<h2>this is some content</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <br/>
Vestibulum eget placerat velit.
</p>
<label>
Label element
<input type="text" placeholder="input element"/>
</label>
</form>
</template>
</NcPopover>
</div>
</template>
```

Expand All @@ -69,14 +71,33 @@ The prop `:focus-trap="false"` help to prevent it when the default behavior is n

```vue
<template>
<NcPopover :focus-trap="false">
<template #trigger>
<NcButton> Click me! </NcButton>
</template>
<template>
Hi! 馃殌
</template>
</NcPopover>
<div style="display: flex">
<NcPopover :focus-trap="false">
<template #trigger>
<NcButton>Click me!</NcButton>
</template>
<template>
Hi! 馃殌
</template>
</NcPopover>
</div>
</template>
```

#### With passing props to `floating-vue`'s `Dropdown`:

```vue
<template>
<div style="display: flex">
<NcPopover container="body" :popper-hide-triggers="(triggers) => [...triggers, 'click']">
<template #trigger>
<NcButton>I am the trigger</NcButton>
</template>
<template #default>
<NcButton>Click on the button will close NcPopover</NcButton>
</template>
</NcPopover>
</div>
</template>
```
</docs>
Expand Down Expand Up @@ -107,10 +128,13 @@ import { getTrapStack } from '../../utils/focusTrap.js'

export default {
name: 'NcPopover',

components: {
Dropdown,
},

inheritAttrs: false,

props: {
popoverBaseClass: {
type: String,
Expand Down