Skip to content

Commit 666484a

Browse files
committed
fix(VExpansionPanel): propagate defaults provided by VExpansionPanels
1 parent cec2094 commit 666484a

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

packages/vuetify/src/components/VExpansionPanel/VExpansionPanel.tsx

+26-20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { VExpansionPanelSymbol } from './shared'
33
import { makeVExpansionPanelTextProps, VExpansionPanelText } from './VExpansionPanelText'
44
import { makeVExpansionPanelTitleProps, VExpansionPanelTitle } from './VExpansionPanelTitle'
5+
import { VDefaultsProvider } from '@/components/VDefaultsProvider'
56

67
// Composables
78
import { useBackgroundColor } from '@/composables/color'
@@ -11,7 +12,7 @@ import { makeRoundedProps, useRounded } from '@/composables/rounded'
1112
import { makeTagProps } from '@/composables/tag'
1213

1314
// Utilities
14-
import { computed, provide } from 'vue'
15+
import { computed, provide, toRef } from 'vue'
1516
import { genericComponent, propsFactory, useRender } from '@/util'
1617

1718
export const makeVExpansionPanelProps = propsFactory({
@@ -101,25 +102,30 @@ export const VExpansionPanel = genericComponent<VExpansionPanelSlots>()({
101102
]}
102103
/>
103104

104-
{ hasTitle && (
105-
<VExpansionPanelTitle
106-
key="title"
107-
{ ...expansionPanelTitleProps }
108-
>
109-
{ slots.title ? slots.title() : props.title }
110-
</VExpansionPanelTitle>
111-
)}
112-
113-
{ hasText && (
114-
<VExpansionPanelText
115-
key="text"
116-
{ ...expansionPanelTextProps }
117-
>
118-
{ slots.text ? slots.text() : props.text }
119-
</VExpansionPanelText>
120-
)}
121-
122-
{ slots.default?.() }
105+
<VDefaultsProvider
106+
defaults={{
107+
VExpansionPanelTitle: {
108+
...expansionPanelTitleProps,
109+
},
110+
VExpansionPanelText: {
111+
...expansionPanelTextProps,
112+
},
113+
}}
114+
>
115+
{ hasTitle && (
116+
<VExpansionPanelTitle key="title">
117+
{ slots.title ? slots.title() : props.title }
118+
</VExpansionPanelTitle>
119+
)}
120+
121+
{ hasText && (
122+
<VExpansionPanelText key="text">
123+
{ slots.text ? slots.text() : props.text }
124+
</VExpansionPanelText>
125+
)}
126+
127+
{ slots.default?.() }
128+
</VDefaultsProvider>
123129
</props.tag>
124130
)
125131
})

0 commit comments

Comments
 (0)