Skip to content

Commit

Permalink
fix(VStepperVerticalItem): pass through actions props and provided de…
Browse files Browse the repository at this point in the history
…faults
  • Loading branch information
johnleider committed May 10, 2024
1 parent 93e6ab2 commit e440e6a
Showing 1 changed file with 35 additions and 14 deletions.
49 changes: 35 additions & 14 deletions packages/vuetify/src/labs/VStepperVertical/VStepperVerticalItem.tsx
Expand Up @@ -4,6 +4,7 @@ import './VStepperVerticalItem.sass'
// Components
import { VStepperVerticalActions } from './VStepperVerticalActions'
import { VAvatar } from '@/components/VAvatar/VAvatar'
import { VDefaultsProvider } from '@/components/VDefaultsProvider/VDefaultsProvider'
import { VExpansionPanel } from '@/components/VExpansionPanel'
import { makeVExpansionPanelProps } from '@/components/VExpansionPanel/VExpansionPanel'
import { VIcon } from '@/components/VIcon/VIcon'
Expand All @@ -24,7 +25,13 @@ export type VStepperVerticalItemSlots = {
text: StepperItemSlot
prev: StepperItemSlot
next: StepperItemSlot
actions: StepperItemSlot
actions: StepperItemSlot & {
props: {
'onClick:finish': () => void
'onClick:next': () => void
'onClick:prev': () => void
}
}
}

export const makeVStepperVerticalItemProps = propsFactory({
Expand Down Expand Up @@ -164,19 +171,33 @@ export const VStepperVerticalItem = genericComponent<VStepperVerticalItemSlots>(
{ slots.default?.(slotProps.value) ?? props.text }

{ hasActions && (
slots.actions?.(slotProps.value) ?? (
<VStepperVerticalActions
disabled={ disabled.value }
onClick:next={ onClickNext }
onClick:prev={ onClickPrev }
onClick:finish={ onClickFinish }
finish={ groupItem.value?.isLast.value }
v-slots={{
prev: slots.prev ? (slotProps: any) => slots.prev?.(slotProps) : undefined,
next: slots.next ? (slotProps: any) => slots.next?.(slotProps) : undefined,
}}
/>
)
<VDefaultsProvider
defaults={{
VStepperVerticalActions: {
disabled: disabled.value,
finish: groupItem.value?.isLast.value,
},
}}
>
{ slots.actions?.({
...slotProps.value,
props: {
'onClick:finish': onClickFinish,
'onClick:next': onClickNext,
'onClick:prev': onClickPrev,
},
}) ?? (
<VStepperVerticalActions
onClick:next={ onClickNext }
onClick:prev={ onClickPrev }
onClick:finish={ onClickFinish }
v-slots={{
prev: slots.prev ? (slotProps: any) => slots.prev?.(slotProps) : undefined,
next: slots.next ? (slotProps: any) => slots.next?.(slotProps) : undefined,
}}
/>
)}
</VDefaultsProvider>
)}
</>
),
Expand Down

0 comments on commit e440e6a

Please sign in to comment.