Skip to content

Commit

Permalink
fix(VExpansionPanel): propagate defaults provided by VExpansionPanels
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Jun 12, 2024
1 parent cec2094 commit 666484a
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions packages/vuetify/src/components/VExpansionPanel/VExpansionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { VExpansionPanelSymbol } from './shared'
import { makeVExpansionPanelTextProps, VExpansionPanelText } from './VExpansionPanelText'
import { makeVExpansionPanelTitleProps, VExpansionPanelTitle } from './VExpansionPanelTitle'
import { VDefaultsProvider } from '@/components/VDefaultsProvider'

// Composables
import { useBackgroundColor } from '@/composables/color'
Expand All @@ -11,7 +12,7 @@ import { makeRoundedProps, useRounded } from '@/composables/rounded'
import { makeTagProps } from '@/composables/tag'

// Utilities
import { computed, provide } from 'vue'
import { computed, provide, toRef } from 'vue'
import { genericComponent, propsFactory, useRender } from '@/util'

export const makeVExpansionPanelProps = propsFactory({
Expand Down Expand Up @@ -101,25 +102,30 @@ export const VExpansionPanel = genericComponent<VExpansionPanelSlots>()({
]}
/>

{ hasTitle && (
<VExpansionPanelTitle
key="title"
{ ...expansionPanelTitleProps }
>
{ slots.title ? slots.title() : props.title }
</VExpansionPanelTitle>
)}

{ hasText && (
<VExpansionPanelText
key="text"
{ ...expansionPanelTextProps }
>
{ slots.text ? slots.text() : props.text }
</VExpansionPanelText>
)}

{ slots.default?.() }
<VDefaultsProvider
defaults={{
VExpansionPanelTitle: {
...expansionPanelTitleProps,
},
VExpansionPanelText: {
...expansionPanelTextProps,
},
}}
>
{ hasTitle && (
<VExpansionPanelTitle key="title">
{ slots.title ? slots.title() : props.title }
</VExpansionPanelTitle>
)}

{ hasText && (
<VExpansionPanelText key="text">
{ slots.text ? slots.text() : props.text }
</VExpansionPanelText>
)}

{ slots.default?.() }
</VDefaultsProvider>
</props.tag>
)
})
Expand Down

0 comments on commit 666484a

Please # to comment.