From c34df13e65bbca3facee5a8f04bd65a21934fa74 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 15 Feb 2024 11:56:21 +0100 Subject: [PATCH] chore(Toggle): export `ToggleColor` type --- src/runtime/components/forms/Toggle.vue | 5 ++--- src/runtime/types/toggle.d.ts | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/runtime/components/forms/Toggle.vue b/src/runtime/components/forms/Toggle.vue index ebb40cbe..e825daf3 100644 --- a/src/runtime/components/forms/Toggle.vue +++ b/src/runtime/components/forms/Toggle.vue @@ -27,11 +27,10 @@ import UIcon from '../elements/Icon.vue' import { useUI } from '../../composables/useUI' import { useFormGroup } from '../../composables/useFormGroup' import { mergeConfig } from '../../utils' -import type { ToggleSize, Strategy } from '../../types' +import type { ToggleSize, ToggleColor, Strategy } from '../../types' // @ts-expect-error import appConfig from '#build/app.config' import { toggle } from '#ui/ui.config' -import colors from '#ui-colors' import { useId } from '#imports' const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.toggle, toggle) @@ -68,7 +67,7 @@ export default defineComponent({ default: () => config.default.offIcon }, color: { - type: String as PropType, + type: String as PropType, default: () => config.default.color, validator (value: string) { return appConfig.ui.colors.includes(value) diff --git a/src/runtime/types/toggle.d.ts b/src/runtime/types/toggle.d.ts index f341bafd..02bc619e 100644 --- a/src/runtime/types/toggle.d.ts +++ b/src/runtime/types/toggle.d.ts @@ -1,5 +1,7 @@ import { toggle } from '../ui.config' import type { ExtractDeepKey } from '.' import type { AppConfig } from 'nuxt/schema' +import colors from '#ui-colors' export type ToggleSize = keyof typeof toggle.size | ExtractDeepKey +export type ToggleColor = typeof colors[number]