1
- import { ReactElement , ReactNode , SyntheticEvent } from 'react'
1
+ import { PropsWithChildren , ReactElement , ReactNode , SyntheticEvent } from 'react'
2
2
import { ButtonProps } from '../Button'
3
3
4
4
export enum ConfirmationModalVariantType {
@@ -13,7 +13,7 @@ type CommonButtonProps<isConfig extends boolean, isCustomVariant extends boolean
13
13
( isConfig extends false ? { onClick : ( ...args : Partial < Parameters < ButtonProps [ 'onClick' ] > > ) => void } : { } ) &
14
14
( isCustomVariant extends true ? Pick < ButtonProps , 'style' > : { } )
15
15
16
- interface CustomInputConfig {
16
+ interface ConfirmationConfigType {
17
17
identifier : string
18
18
confirmationKeyword : string
19
19
}
@@ -32,20 +32,6 @@ type ButtonConfig<isConfig extends boolean, isCustomVariant extends boolean> =
32
32
secondaryButtonConfig ?: CommonButtonProps < isConfig , isCustomVariant >
33
33
}
34
34
35
- type CustomInputConfigOrChildrenType =
36
- | {
37
- customInputConfig : CustomInputConfig
38
- children ?: never
39
- }
40
- | {
41
- customInputConfig ?: never
42
- children : ReactNode
43
- }
44
- | {
45
- customInputConfig ?: never
46
- children ?: never
47
- }
48
-
49
35
type ButtonConfigAndVariantType < isConfig extends boolean > =
50
36
| {
51
37
variant : Exclude < ConfirmationModalVariantType , ConfirmationModalVariantType . custom >
@@ -58,15 +44,16 @@ type ButtonConfigAndVariantType<isConfig extends boolean> =
58
44
buttonConfig : ButtonConfig < isConfig , true >
59
45
}
60
46
61
- export type ConfirmationModalProps < isConfig extends boolean = false > = {
47
+ export type ConfirmationModalProps < isConfig extends boolean = false > = PropsWithChildren < {
62
48
title : string
63
49
subtitle : ReactNode
64
50
/**
65
51
* @default true
66
52
*/
67
53
shouldCloseOnEscape ?: boolean
68
- } & ButtonConfigAndVariantType < isConfig > &
69
- CustomInputConfigOrChildrenType &
54
+ confirmationConfig ?: ConfirmationConfigType
55
+ } > &
56
+ ButtonConfigAndVariantType < isConfig > &
70
57
( isConfig extends false
71
58
? {
72
59
handleClose : ( e ?: SyntheticEvent ) => void
0 commit comments