mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 19:30:37 +01:00
@@ -7,6 +7,7 @@ import theme from '#build/ui/toast'
|
|||||||
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
import type { AvatarProps, ButtonProps } from '../types'
|
import type { AvatarProps, ButtonProps } from '../types'
|
||||||
|
import type { StringOrVNode } from '../types/utils'
|
||||||
|
|
||||||
const appConfigToast = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
|
const appConfigToast = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
|
||||||
|
|
||||||
@@ -20,8 +21,8 @@ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open'
|
|||||||
* @defaultValue 'li'
|
* @defaultValue 'li'
|
||||||
*/
|
*/
|
||||||
as?: any
|
as?: any
|
||||||
title?: string
|
title?: StringOrVNode
|
||||||
description?: string
|
description?: StringOrVNode
|
||||||
icon?: string
|
icon?: string
|
||||||
avatar?: AvatarProps
|
avatar?: AvatarProps
|
||||||
color?: ToastVariants['color']
|
color?: ToastVariants['color']
|
||||||
@@ -124,12 +125,20 @@ defineExpose({
|
|||||||
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
||||||
<ToastTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
<ToastTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
||||||
<slot name="title">
|
<slot name="title">
|
||||||
{{ title }}
|
<component :is="title()" v-if="typeof title === 'function'" />
|
||||||
|
<component :is="title" v-else-if="typeof title === 'object'" />
|
||||||
|
<template v-else>
|
||||||
|
{{ title }}
|
||||||
|
</template>
|
||||||
</slot>
|
</slot>
|
||||||
</ToastTitle>
|
</ToastTitle>
|
||||||
<ToastDescription v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
<ToastDescription v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
||||||
<slot name="description">
|
<slot name="description">
|
||||||
{{ description }}
|
<component :is="description()" v-if="typeof description === 'function'" />
|
||||||
|
<component :is="description" v-else-if="typeof description === 'object'" />
|
||||||
|
<template v-else>
|
||||||
|
{{ description }}
|
||||||
|
</template>
|
||||||
</slot>
|
</slot>
|
||||||
</ToastDescription>
|
</ToastDescription>
|
||||||
|
|
||||||
|
|||||||
@@ -33,3 +33,8 @@ export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string
|
|||||||
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
||||||
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>]
|
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type StringOrVNode =
|
||||||
|
| string
|
||||||
|
| VNode
|
||||||
|
| (() => VNode)
|
||||||
|
|||||||
Reference in New Issue
Block a user