mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 02:10:40 +01:00
feat(components): handle events in content prop
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
<!-- eslint-disable vue/block-tag-newline -->
|
<!-- eslint-disable vue/block-tag-newline -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps } from 'reka-ui'
|
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuContentEmits } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/context-menu'
|
import theme from '#build/ui/context-menu'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
||||||
import type { DynamicSlots, PartialString } from '../types/utils'
|
import type { DynamicSlots, PartialString, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigContextMenu = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
|
const appConfigContextMenu = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
|
|||||||
icon?: string
|
icon?: string
|
||||||
color?: ContextMenuVariants['color']
|
color?: ContextMenuVariants['color']
|
||||||
avatar?: AvatarProps
|
avatar?: AvatarProps
|
||||||
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ContextMenuContentEmits>>
|
||||||
kbds?: KbdProps['value'][] | KbdProps[]
|
kbds?: KbdProps['value'][] | KbdProps[]
|
||||||
/**
|
/**
|
||||||
* The item type.
|
* The item type.
|
||||||
@@ -67,7 +67,7 @@ export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'> {
|
|||||||
*/
|
*/
|
||||||
externalIcon?: boolean | string
|
externalIcon?: boolean | string
|
||||||
/** The content of the menu. */
|
/** The content of the menu. */
|
||||||
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ContextMenuContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Render the menu in a portal.
|
* Render the menu in a portal.
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
@@ -114,7 +114,7 @@ const emits = defineEmits<ContextMenuEmits>()
|
|||||||
const slots = defineSlots<ContextMenuSlots<T>>()
|
const slots = defineSlots<ContextMenuSlots<T>>()
|
||||||
|
|
||||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'modal'), emits)
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'modal'), emits)
|
||||||
const contentProps = toRef(() => props.content as ContextMenuContentProps)
|
const contentProps = toRef(() => props.content)
|
||||||
const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
|
const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
|
||||||
|
|
||||||
const ui = computed(() => contextMenu({
|
const ui = computed(() => contextMenu({
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
|
import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
|
||||||
import type { DialogContentProps } from 'reka-ui'
|
import type { DialogContentProps, DialogContentEmits } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/drawer'
|
import theme from '#build/ui/drawer'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
|
import type { EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigDrawer = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
|
const appConfigDrawer = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | '
|
|||||||
*/
|
*/
|
||||||
inset?: boolean
|
inset?: boolean
|
||||||
/** The content of the drawer. */
|
/** The content of the drawer. */
|
||||||
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Render an overlay behind the drawer.
|
* Render an overlay behind the drawer.
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<!-- eslint-disable vue/block-tag-newline -->
|
<!-- eslint-disable vue/block-tag-newline -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuArrowProps } from 'reka-ui'
|
import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuContentEmits, DropdownMenuArrowProps } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/dropdown-menu'
|
import theme from '#build/ui/dropdown-menu'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
||||||
import type { DynamicSlots, PartialString } from '../types/utils'
|
import type { DynamicSlots, PartialString, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigDropdownMenu = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
|
const appConfigDropdownMenu = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|||||||
icon?: string
|
icon?: string
|
||||||
color?: DropdownMenuVariants['color']
|
color?: DropdownMenuVariants['color']
|
||||||
avatar?: AvatarProps
|
avatar?: AvatarProps
|
||||||
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>
|
||||||
kbds?: KbdProps['value'][] | KbdProps[]
|
kbds?: KbdProps['value'][] | KbdProps[]
|
||||||
/**
|
/**
|
||||||
* The item type.
|
* The item type.
|
||||||
@@ -70,7 +70,7 @@ export interface DropdownMenuProps<T> extends Omit<DropdownMenuRootProps, 'dir'>
|
|||||||
* The content of the menu.
|
* The content of the menu.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
||||||
*/
|
*/
|
||||||
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the menu.
|
* Display an arrow alongside the menu.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { InputHTMLAttributes } from 'vue'
|
import type { InputHTMLAttributes } from 'vue'
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxArrowProps, AcceptableValue } from 'reka-ui'
|
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps, AcceptableValue } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/input-menu'
|
import theme from '#build/ui/input-menu'
|
||||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||||
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigInputMenu = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
const appConfigInputMenu = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ export interface InputMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends Ma
|
|||||||
* The content of the menu.
|
* The content of the menu.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
||||||
*/
|
*/
|
||||||
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the menu.
|
* Display an arrow alongside the menu.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'reka-ui'
|
import type { DialogRootProps, DialogRootEmits, DialogContentProps, DialogContentEmits } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/modal'
|
import theme from '#build/ui/modal'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { ButtonProps } from '../types'
|
import type { ButtonProps } from '../types'
|
||||||
|
import type { EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigModal = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
const appConfigModal = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ export interface ModalProps extends DialogRootProps {
|
|||||||
title?: string
|
title?: string
|
||||||
description?: string
|
description?: string
|
||||||
/** The content of the modal. */
|
/** The content of the modal. */
|
||||||
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Render an overlay behind the modal.
|
* Render an overlay behind the modal.
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
@@ -97,18 +98,20 @@ const appConfig = useAppConfig()
|
|||||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
||||||
const contentProps = toRef(() => props.content)
|
const contentProps = toRef(() => props.content)
|
||||||
const contentEvents = computed(() => {
|
const contentEvents = computed(() => {
|
||||||
|
const events = {
|
||||||
|
closeAutoFocus: (e: Event) => e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
if (!props.dismissible) {
|
if (!props.dismissible) {
|
||||||
return {
|
return {
|
||||||
pointerDownOutside: (e: Event) => e.preventDefault(),
|
pointerDownOutside: (e: Event) => e.preventDefault(),
|
||||||
interactOutside: (e: Event) => e.preventDefault(),
|
interactOutside: (e: Event) => e.preventDefault(),
|
||||||
escapeKeyDown: (e: Event) => e.preventDefault(),
|
escapeKeyDown: (e: Event) => e.preventDefault(),
|
||||||
closeAutoFocus: (e: Event) => e.preventDefault()
|
...events
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return events
|
||||||
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const ui = computed(() => modal({
|
const ui = computed(() => modal({
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<!-- eslint-disable vue/block-tag-newline -->
|
<!-- eslint-disable vue/block-tag-newline -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, CollapsibleRootProps } from 'reka-ui'
|
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, CollapsibleRootProps } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/navigation-menu'
|
import theme from '#build/ui/navigation-menu'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
||||||
import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString } from '../types/utils'
|
import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigNavigationMenu = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
const appConfigNavigationMenu = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'm
|
|||||||
*/
|
*/
|
||||||
highlightColor?: NavigationMenuVariants['highlightColor']
|
highlightColor?: NavigationMenuVariants['highlightColor']
|
||||||
/** The content of the menu. */
|
/** The content of the menu. */
|
||||||
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<NavigationMenuContentEmits>>
|
||||||
/**
|
/**
|
||||||
* The orientation of the content.
|
* The orientation of the content.
|
||||||
* Only works when `orientation` is `horizontal`.
|
* Only works when `orientation` is `horizontal`.
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'reka-ui'
|
import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverContentEmits, PopoverArrowProps } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/popover'
|
import theme from '#build/ui/popover'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
|
import type { EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigPopover = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
|
const appConfigPopover = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
|
|||||||
* The content of the popover.
|
* The content of the popover.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
||||||
*/
|
*/
|
||||||
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the popover.
|
* Display an arrow alongside the popover.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectArrowProps, AcceptableValue } from 'reka-ui'
|
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps, AcceptableValue } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/select'
|
import theme from '#build/ui/select'
|
||||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||||
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigSelect = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
|
const appConfigSelect = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
|
|||||||
* The content of the menu.
|
* The content of the menu.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
||||||
*/
|
*/
|
||||||
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<SelectContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the menu.
|
* Display an arrow alongside the menu.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxArrowProps, AcceptableValue } from 'reka-ui'
|
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps, AcceptableValue } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/select-menu'
|
import theme from '#build/ui/select-menu'
|
||||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||||
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey, EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigSelectMenu = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
|
const appConfigSelectMenu = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ export interface SelectMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends M
|
|||||||
* The content of the menu.
|
* The content of the menu.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
||||||
*/
|
*/
|
||||||
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the menu.
|
* Display an arrow alongside the menu.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VariantProps } from 'tailwind-variants'
|
import type { VariantProps } from 'tailwind-variants'
|
||||||
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'reka-ui'
|
import type { DialogRootProps, DialogRootEmits, DialogContentProps, DialogContentEmits } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/slideover'
|
import theme from '#build/ui/slideover'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { ButtonProps } from '../types'
|
import type { ButtonProps } from '../types'
|
||||||
|
import type { EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigSlideover = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
|
const appConfigSlideover = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ export interface SlideoverProps extends DialogRootProps {
|
|||||||
title?: string
|
title?: string
|
||||||
description?: string
|
description?: string
|
||||||
/** The content of the slideover. */
|
/** The content of the slideover. */
|
||||||
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Render an overlay behind the slideover.
|
* Render an overlay behind the slideover.
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
@@ -101,18 +102,20 @@ const appConfig = useAppConfig()
|
|||||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
||||||
const contentProps = toRef(() => props.content)
|
const contentProps = toRef(() => props.content)
|
||||||
const contentEvents = computed(() => {
|
const contentEvents = computed(() => {
|
||||||
|
const events = {
|
||||||
|
closeAutoFocus: (e: Event) => e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
if (!props.dismissible) {
|
if (!props.dismissible) {
|
||||||
return {
|
return {
|
||||||
pointerDownOutside: (e: Event) => e.preventDefault(),
|
pointerDownOutside: (e: Event) => e.preventDefault(),
|
||||||
interactOutside: (e: Event) => e.preventDefault(),
|
interactOutside: (e: Event) => e.preventDefault(),
|
||||||
escapeKeyDown: (e: Event) => e.preventDefault(),
|
escapeKeyDown: (e: Event) => e.preventDefault(),
|
||||||
closeAutoFocus: (e: Event) => e.preventDefault()
|
...events
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return events
|
||||||
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const ui = computed(() => slideover({
|
const ui = computed(() => slideover({
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipArrowProps } from 'reka-ui'
|
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipContentEmits, TooltipArrowProps } from 'reka-ui'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/tooltip'
|
import theme from '#build/ui/tooltip'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { KbdProps } from '../types'
|
import type { KbdProps } from '../types'
|
||||||
|
import type { EmitsToProps } from '../types/utils'
|
||||||
|
|
||||||
const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
|
const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export interface TooltipProps extends TooltipRootProps {
|
|||||||
* The content of the tooltip.
|
* The content of the tooltip.
|
||||||
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
||||||
*/
|
*/
|
||||||
content?: Omit<TooltipContentProps, 'as' | 'asChild'>
|
content?: Omit<TooltipContentProps, 'as' | 'asChild'> & Partial<EmitsToProps<TooltipContentEmits>>
|
||||||
/**
|
/**
|
||||||
* Display an arrow alongside the tooltip.
|
* Display an arrow alongside the tooltip.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
|||||||
Reference in New Issue
Block a user