Skip to content

Commit d96798a

Browse files
committed
refactor(VDatePickerMonth): remove VDefaultsProvider usage
1 parent ea25366 commit d96798a

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

packages/vuetify/src/components/VDatePicker/VDatePickerMonth.tsx

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import './VDatePickerMonth.sass'
33

44
// Components
55
import { VBtn } from '@/components/VBtn'
6-
import { VDefaultsProvider } from '@/components/VDefaultsProvider'
76

87
// Composables
98
import { makeCalendarProps, useCalendar } from '@/composables/calendar'
@@ -12,7 +11,7 @@ import { MaybeTransition } from '@/composables/transition'
1211

1312
// Utilities
1413
import { computed, ref, shallowRef, watch } from 'vue'
15-
import { genericComponent, omit, propsFactory } from '@/util'
14+
import { genericComponent, omit, propsFactory, useRender } from '@/util'
1615

1716
// Types
1817
import type { PropType } from 'vue'
@@ -152,7 +151,7 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
152151
}
153152
}
154153

155-
return () => (
154+
useRender(() => (
156155
<div class="v-date-picker-month">
157156
{ props.showWeek && (
158157
<div key="weeks" class="v-date-picker-month__weeks">
@@ -188,6 +187,13 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
188187
{ daysInMonth.value.map((item, i) => {
189188
const slotProps = {
190189
props: {
190+
class: 'v-date-picker-month__day-btn',
191+
color: item.isSelected || item.isToday ? props.color : undefined,
192+
disabled: item.isDisabled,
193+
icon: true,
194+
ripple: false,
195+
text: item.localized,
196+
variant: item.isSelected ? 'flat' : item.isToday ? 'outlined' : 'text',
191197
onClick: () => onClick(item.date),
192198
},
193199
item,
@@ -212,38 +218,16 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
212218
]}
213219
data-v-date={ !item.isDisabled ? item.isoDate : undefined }
214220
>
215-
216221
{ (props.showAdjacentMonths || !item.isAdjacent) && (
217-
<VDefaultsProvider
218-
defaults={{
219-
VBtn: {
220-
class: 'v-date-picker-month__day-btn',
221-
color: (item.isSelected || item.isToday) && !item.isDisabled
222-
? props.color
223-
: undefined,
224-
disabled: item.isDisabled,
225-
icon: true,
226-
ripple: false,
227-
text: item.localized,
228-
variant: item.isDisabled
229-
? item.isToday ? 'outlined' : 'text'
230-
: item.isToday && !item.isSelected ? 'outlined' : 'flat',
231-
onClick: () => onClick(item.date),
232-
},
233-
}}
234-
>
235-
{ slots.day?.(slotProps) ?? (
236-
<VBtn { ...slotProps.props } />
237-
)}
238-
</VDefaultsProvider>
222+
slots.day?.(slotProps) ?? (<VBtn { ...slotProps.props } />)
239223
)}
240224
</div>
241225
)
242226
})}
243227
</div>
244228
</MaybeTransition>
245229
</div>
246-
)
230+
))
247231
},
248232
})
249233

0 commit comments

Comments
 (0)