mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 13:17:57 +01:00
chore(RadioGroup): expose modeValue in label / description slots
This commit is contained in:
@@ -28,7 +28,7 @@ export interface RadioGroupProps<T> extends Omit<RadioGroupRootProps, 'asChild'
|
|||||||
|
|
||||||
export interface RadioGroupEmits extends RadioGroupRootEmits {}
|
export interface RadioGroupEmits extends RadioGroupRootEmits {}
|
||||||
|
|
||||||
type SlotProps<T> = (props: { item: T }) => any
|
type SlotProps<T> = (props: { item: T, modelValue?: string }) => any
|
||||||
|
|
||||||
export interface RadioGroupSlots<T> {
|
export interface RadioGroupSlots<T> {
|
||||||
legend(): any
|
legend(): any
|
||||||
@@ -84,6 +84,7 @@ const normalizedItems = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<RadioGroupRoot
|
<RadioGroupRoot
|
||||||
:id="id"
|
:id="id"
|
||||||
|
v-slot="{ modelValue }"
|
||||||
v-bind="rootProps"
|
v-bind="rootProps"
|
||||||
:name="name"
|
:name="name"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@@ -110,10 +111,10 @@ const normalizedItems = computed(() => {
|
|||||||
|
|
||||||
<div :class="ui.wrapper()">
|
<div :class="ui.wrapper()">
|
||||||
<Label :class="ui.label()" :for="item.id">
|
<Label :class="ui.label()" :for="item.id">
|
||||||
<slot name="label" :item="item">{{ item.label }}</slot>
|
<slot name="label" :item="item" :model-value="modelValue">{{ item.label }}</slot>
|
||||||
</Label>
|
</Label>
|
||||||
<p v-if="item.description || !!slots.description" :class="ui.description()">
|
<p v-if="item.description || !!slots.description" :class="ui.description()">
|
||||||
<slot name="description" :item="item">
|
<slot name="description" :item="item" :model-value="modelValue">
|
||||||
{{ item.description }}
|
{{ item.description }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user