mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 18:00:43 +01:00
chore(Toggle): export ToggleColor type
This commit is contained in:
@@ -27,11 +27,10 @@ import UIcon from '../elements/Icon.vue'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { ToggleSize, Strategy } from '../../types'
|
import type { ToggleSize, ToggleColor, Strategy } from '../../types'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { toggle } from '#ui/ui.config'
|
import { toggle } from '#ui/ui.config'
|
||||||
import colors from '#ui-colors'
|
|
||||||
import { useId } from '#imports'
|
import { useId } from '#imports'
|
||||||
|
|
||||||
const config = mergeConfig<typeof toggle>(appConfig.ui.strategy, appConfig.ui.toggle, toggle)
|
const config = mergeConfig<typeof toggle>(appConfig.ui.strategy, appConfig.ui.toggle, toggle)
|
||||||
@@ -68,7 +67,7 @@ export default defineComponent({
|
|||||||
default: () => config.default.offIcon
|
default: () => config.default.offIcon
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
type: String as PropType<typeof colors[number]>,
|
type: String as PropType<ToggleColor>,
|
||||||
default: () => config.default.color,
|
default: () => config.default.color,
|
||||||
validator (value: string) {
|
validator (value: string) {
|
||||||
return appConfig.ui.colors.includes(value)
|
return appConfig.ui.colors.includes(value)
|
||||||
|
|||||||
2
src/runtime/types/toggle.d.ts
vendored
2
src/runtime/types/toggle.d.ts
vendored
@@ -1,5 +1,7 @@
|
|||||||
import { toggle } from '../ui.config'
|
import { toggle } from '../ui.config'
|
||||||
import type { ExtractDeepKey } from '.'
|
import type { ExtractDeepKey } from '.'
|
||||||
import type { AppConfig } from 'nuxt/schema'
|
import type { AppConfig } from 'nuxt/schema'
|
||||||
|
import colors from '#ui-colors'
|
||||||
|
|
||||||
export type ToggleSize = keyof typeof toggle.size | ExtractDeepKey<AppConfig, ['ui', 'toggle', 'size']>
|
export type ToggleSize = keyof typeof toggle.size | ExtractDeepKey<AppConfig, ['ui', 'toggle', 'size']>
|
||||||
|
export type ToggleColor = typeof colors[number]
|
||||||
|
|||||||
Reference in New Issue
Block a user