mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
fix(components): declare ui prop with PartialString when arrays in theme slots
This commit is contained in:
@@ -5,6 +5,7 @@ import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/button'
|
||||
import type { LinkProps } from './Link.vue'
|
||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||
import type { PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
|
||||
|
||||
@@ -22,7 +23,7 @@ export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'ra
|
||||
/** Render the button full width. */
|
||||
block?: boolean
|
||||
class?: any
|
||||
ui?: Partial<typeof button.slots>
|
||||
ui?: PartialString<typeof button.slots>
|
||||
}
|
||||
|
||||
export interface ButtonSlots {
|
||||
|
||||
@@ -8,7 +8,7 @@ import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/command-palette'
|
||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
|
||||
import type { DynamicSlots } from '../types/utils'
|
||||
import type { DynamicSlots, PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface CommandPaletteProps<G, T> extends Pick<ComboboxRootProps, 'mult
|
||||
*/
|
||||
fuse?: UseFuseOptions<T>
|
||||
class?: any
|
||||
ui?: Partial<typeof commandPalette.slots>
|
||||
ui?: PartialString<typeof commandPalette.slots>
|
||||
}
|
||||
|
||||
export type CommandPaletteEmits<T> = ComboboxRootEmits<T>
|
||||
|
||||
@@ -7,7 +7,7 @@ import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/input-menu'
|
||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||
import type { AcceptableValue, ArrayOrWrapped } from '../types/utils'
|
||||
import type { AcceptableValue, ArrayOrWrapped, PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
||||
|
||||
@@ -82,7 +82,7 @@ export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValu
|
||||
filter?: boolean | string[]
|
||||
items?: T[] | T[][]
|
||||
class?: any
|
||||
ui?: Partial<typeof inputMenu.slots>
|
||||
ui?: PartialString<typeof inputMenu.slots>
|
||||
}
|
||||
|
||||
export type InputMenuEmits<T> = ComboboxRootEmits<T> & {
|
||||
|
||||
@@ -6,7 +6,7 @@ import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/select'
|
||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||
import type { AcceptableValue } from '../types/utils'
|
||||
import type { AcceptableValue, PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
|
||||
|
||||
@@ -60,7 +60,7 @@ export interface SelectProps<T> extends Omit<SelectRootProps, 'dir'>, UseCompone
|
||||
portal?: boolean
|
||||
items?: T[] | T[][]
|
||||
class?: any
|
||||
ui?: Partial<typeof select.slots>
|
||||
ui?: PartialString<typeof select.slots>
|
||||
}
|
||||
|
||||
export type SelectEmits = SelectRootEmits & {
|
||||
|
||||
@@ -6,7 +6,7 @@ import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/select-menu'
|
||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
||||
import type { AcceptableValue, ArrayOrWrapped } from '../types/utils'
|
||||
import type { AcceptableValue, ArrayOrWrapped, PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
|
||||
|
||||
@@ -69,7 +69,7 @@ export interface SelectMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelVal
|
||||
filter?: boolean | string[]
|
||||
items?: T[] | T[][]
|
||||
class?: any
|
||||
ui?: Partial<typeof selectMenu.slots>
|
||||
ui?: PartialString<typeof selectMenu.slots>
|
||||
}
|
||||
|
||||
export type SelectMenuEmits<T> = ComboboxRootEmits<T> & {
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { SwitchRootProps } from 'radix-vue'
|
||||
import type { AppConfig } from '@nuxt/schema'
|
||||
import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/switch'
|
||||
import type { PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
|
||||
|
||||
@@ -35,7 +36,7 @@ export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | '
|
||||
/** The state of the switch when it is initially rendered. Use when you do not need to control its state. */
|
||||
defaultValue?: boolean
|
||||
class?: any
|
||||
ui?: Partial<typeof switchTv.slots>
|
||||
ui?: PartialString<typeof switchTv.slots>
|
||||
}
|
||||
|
||||
export interface SwitchEmits {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { AppConfig } from '@nuxt/schema'
|
||||
import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/tabs'
|
||||
import type { AvatarProps } from '../types'
|
||||
import type { DynamicSlots } from '../types/utils'
|
||||
import type { DynamicSlots, PartialString } from '../types/utils'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface TabsProps<T> extends Pick<TabsRootProps, 'defaultValue' | 'mode
|
||||
*/
|
||||
content?: boolean | Omit<TabsContentProps, 'as' | 'asChild' | 'value'>
|
||||
class?: any
|
||||
ui?: Partial<typeof tabs.slots>
|
||||
ui?: PartialString<typeof tabs.slots>
|
||||
}
|
||||
|
||||
export interface TabsEmits extends TabsRootEmits {}
|
||||
|
||||
@@ -12,3 +12,7 @@ export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extend
|
||||
export type AcceptableValue = string | number | boolean | Record<string, any>
|
||||
|
||||
export type ArrayOrWrapped<T> = T extends any[] ? T : Array<T>
|
||||
|
||||
export type PartialString<T> = {
|
||||
[K in keyof T]?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user