diff --git a/docs/components/content/examples/PopoverExampleOverlay.vue b/docs/components/content/examples/PopoverExampleOverlay.vue new file mode 100644 index 00000000..c829d78c --- /dev/null +++ b/docs/components/content/examples/PopoverExampleOverlay.vue @@ -0,0 +1,13 @@ + diff --git a/docs/content/6.overlays/3.popover.md b/docs/content/6.overlays/3.popover.md index 11ad891e..d55767d2 100644 --- a/docs/content/6.overlays/3.popover.md +++ b/docs/content/6.overlays/3.popover.md @@ -25,6 +25,14 @@ Use the `open` prop to manually control showing the panel. :component-example{component="popover-example-open"} +### Overlay :u-badge{label="New" class="align-middle ml-2 !rounded-full" variant="subtle"} + +:component-example{component="popover-example-overlay"} + +::callout{icon="i-heroicons-light-bulb"} + Clicking on the `overlay` emits `update:open`. If you are manually controlling the `open` prop, you will need to use a [`v-model` argument](https://vuejs.org/guide/components/v-model.html#v-model-arguments) (`v-model:open`). +:: + ## Popper Use the `popper` prop to customize the popper instance. diff --git a/src/runtime/components/overlays/Popover.vue b/src/runtime/components/overlays/Popover.vue index ce39fb46..e886aa90 100644 --- a/src/runtime/components/overlays/Popover.vue +++ b/src/runtime/components/overlays/Popover.vue @@ -15,6 +15,10 @@ + +
+ +
@@ -72,6 +76,10 @@ export default defineComponent({ type: Number, default: 0 }, + overlay: { + type: Boolean, + default: false + }, popper: { type: Object as PropType, default: () => ({}) @@ -85,6 +93,7 @@ export default defineComponent({ default: undefined } }, + emits: ['update:open'], setup (props) { const { ui, attrs } = useUI('popover', toRef(props, 'ui'), config, toRef(props, 'class')) diff --git a/src/runtime/ui.config/overlays/popover.ts b/src/runtime/ui.config/overlays/popover.ts index 2c38d32e..822130c5 100644 --- a/src/runtime/ui.config/overlays/popover.ts +++ b/src/runtime/ui.config/overlays/popover.ts @@ -2,7 +2,7 @@ import arrow from '../_popperArrow' export default { wrapper: 'relative', - container: 'z-20 group', + container: 'z-50 group', width: '', background: 'bg-white dark:bg-gray-900', shadow: 'shadow-lg', @@ -18,8 +18,20 @@ export default { leaveFromClass: 'opacity-100 translate-y-0', leaveToClass: 'opacity-0 translate-y-1' }, + overlay: { + base: 'fixed inset-0 transition-opacity z-50', + background: 'bg-gray-200/75 dark:bg-gray-800/75', + transition: { + enterActiveClass: 'ease-out duration-200', + enterFromClass: 'opacity-0', + enterToClass: 'opacity-100', + leaveActiveClass: 'ease-in duration-150', + leaveFromClass: 'opacity-100', + leaveToClass: 'opacity-0' + } + }, popper: { strategy: 'fixed' }, arrow -} \ No newline at end of file +}