-
Notifications
You must be signed in to change notification settings - Fork 902
feat(components): expose ui
in slot props where used
#5207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4
Are you sure you want to change the base?
Conversation
commit: |
export type AccordionSlots<T extends AccordionItem = AccordionItem> = { | ||
leading: SlotProps<T> | ||
default: SlotProps<T> | ||
default(props: { item: T, index: number, open: boolean }): any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default
slot in AccordionSlots
is missing the ui
prop that was added to all other slots in this refactoring.
View Details
π Patch Details
diff --git a/src/runtime/components/Accordion.vue b/src/runtime/components/Accordion.vue
index 70a6f0c9..251c027d 100644
--- a/src/runtime/components/Accordion.vue
+++ b/src/runtime/components/Accordion.vue
@@ -57,7 +57,7 @@ type SlotProps<T extends AccordionItem> = (props: { item: T, index: number, open
export type AccordionSlots<T extends AccordionItem = AccordionItem> = {
leading: SlotProps<T>
- default(props: { item: T, index: number, open: boolean }): any
+ default: SlotProps<T>
trailing: SlotProps<T>
content: SlotProps<T>
body: SlotProps<T>
@@ -109,7 +109,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.accordion ||
</slot>
<span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
- <slot :item="item" :index="index" :open="open">{{ get(item, props.labelKey as string) }}</slot>
+ <slot :item="item" :index="index" :open="open" :ui="ui">{{ get(item, props.labelKey as string) }}</slot>
</span>
<slot name="trailing" :item="item" :index="index" :open="open" :ui="ui">
Analysis
Accordion default slot missing ui prop in type definition and template
What fails: AccordionSlots default slot type definition uses inline type { item: T, index: number, open: boolean }
instead of SlotProps<T>
, missing the ui
prop that all other slots provide. Template also doesn't pass :ui="ui"
to default slot.
How to reproduce:
</div> // TypeScript error: ui doesn't exist
</template>
Result: TypeScript error - Property 'ui' does not exist on type '{ item: T; index: number; open: boolean; }'
Expected: Default slot should have same ui prop as leading/trailing/content/body slots per SlotProps type definition in line 56, and template should pass :ui="ui"
consistently like other slots
π Linked issue
β Type of change
π Description
π Checklist