|
2 | 2 | import type { RadioGroupRootProps, RadioGroupRootEmits } from 'reka-ui' |
3 | 3 | import type { AppConfig } from '@nuxt/schema' |
4 | 4 | import theme from '#build/ui/radio-group' |
5 | | -import type { AcceptableValue, GetItemKeys, GetModelValue } from '../types/utils' |
| 5 | +import type { AcceptableValue, GetItemKeys, GetModelValue, GetModelValueEmits } from '../types/utils' |
6 | 6 | import type { ComponentConfig } from '../types/tv' |
7 | 7 |
|
8 | 8 | type RadioGroup = ComponentConfig<typeof theme, AppConfig, 'radioGroup'> |
@@ -71,9 +71,9 @@ export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[], |
71 | 71 | ui?: RadioGroup['slots'] |
72 | 72 | } |
73 | 73 |
|
74 | | -export type RadioGroupEmits = RadioGroupRootEmits & { |
| 74 | +export type RadioGroupEmits<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> = Omit<RadioGroupRootEmits, 'update:modelValue'> & { |
75 | 75 | change: [event: Event] |
76 | | -} |
| 76 | +} & GetModelValueEmits<T, VK, false> |
77 | 77 |
|
78 | 78 | type NormalizeItem<T extends RadioGroupItem> = Exclude<T & { id: string }, RadioGroupValue> |
79 | 79 |
|
@@ -101,7 +101,7 @@ const props = withDefaults(defineProps<RadioGroupProps<T, VK>>(), { |
101 | 101 | descriptionKey: 'description', |
102 | 102 | orientation: 'vertical' |
103 | 103 | }) |
104 | | -const emits = defineEmits<RadioGroupEmits>() |
| 104 | +const emits = defineEmits<RadioGroupEmits<T, VK>>() |
105 | 105 | const slots = defineSlots<RadioGroupSlots<T>>() |
106 | 106 |
|
107 | 107 | const appConfig = useAppConfig() as RadioGroup['AppConfig'] |
|
0 commit comments