Skip to content

Commit

Permalink
Merge branch 'dev' into pr/162
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac authored Jul 27, 2023
2 parents 5fb527d + 10890e6 commit d5c0259
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

11 changes: 11 additions & 0 deletions docs/components/content/examples/PopoverExampleMode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<UPopover mode="hover">
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" />

<template #panel>
<div class="p-4">
<Placeholder class="h-20 w-48" />
</div>
</template>
</UPopover>
</template>
21 changes: 21 additions & 0 deletions docs/content/6.overlays/3.popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ links:
```
::

### Mode

Use the `mode` prop to switch between `click` and `hover` modes.

::component-example
#default
:popover-example-mode
#code
```vue
<template>
<UPopover mode="hover">
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" />
<template #panel>
<!-- Content -->
</template>
</UPopover>
</template>
```
::

## Props

:component-props
Expand Down
2 changes: 1 addition & 1 deletion docs/content/7.layout/3.skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Use to show a placeholder while content is loading.
```vue
<template>
<div class="flex items-center space-x-4">
<USkeleton class="h-12 w-12 rounded-full" />
<USkeleton class="h-12 w-12" :ui="{ rounded: 'rounded-full' }" />
<div class="space-y-2">
<USkeleton class="h-4 w-[250px]" />
<USkeleton class="h-4 w-[200px]" />
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ const formGroup = {
label: {
wrapper: 'flex content-center items-center justify-between',
base: 'block font-medium text-gray-700 dark:text-gray-200',
required: 'after:content-[\'*\'] after:ms-0.5 after:text-red-500 dark:after:text-red-400'
// eslint-disable-next-line quotes
required: `after:content-['*'] after:ms-0.5 after:text-red-500 dark:after:text-red-400`
},
size: {
'2xs': 'text-xs',
Expand Down
19 changes: 9 additions & 10 deletions src/runtime/components/overlays/Popover.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<HPopover v-slot="{ open, close }" :class="ui.wrapper" @mouseleave="onMouseLeave">
<HPopover ref="popover" v-slot="{ open, close }" :class="ui.wrapper" @mouseleave="onMouseLeave">
<HPopoverButton
ref="trigger"
as="div"
Expand Down Expand Up @@ -85,21 +85,19 @@ export default defineComponent({
const [trigger, container] = usePopper(popper.value)
// https://github.com/tailwindlabs/headlessui/blob/f66f4926c489fc15289d528294c23a3dc2aee7b1/packages/%40headlessui-vue/src/components/popover/popover.ts#L151
const popover = ref<any>(null)
const popoverApi = ref<any>(null)
let openTimeout: NodeJS.Timeout | null = null
let closeTimeout: NodeJS.Timeout | null = null
onMounted(() => {
setTimeout(() => {
// @ts-expect-error internals
const popoverProvides = trigger.value?.$.provides
if (!popoverProvides) {
return
}
const popoverProvidesSymbols = Object.getOwnPropertySymbols(popoverProvides)
popoverApi.value = popoverProvidesSymbols.length && popoverProvides[popoverProvidesSymbols[0]]
}, 200)
const popoverProvides = popover.value?.$.provides
if (!popoverProvides) {
return
}
const popoverProvidesSymbols = Object.getOwnPropertySymbols(popoverProvides)
popoverApi.value = popoverProvidesSymbols.length && popoverProvides[popoverProvidesSymbols[0]]
})
function onMouseOver () {
Expand Down Expand Up @@ -145,6 +143,7 @@ export default defineComponent({
return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
popover,
trigger,
container,
onMouseOver,
Expand Down

0 comments on commit d5c0259

Please sign in to comment.