File tree Expand file tree Collapse file tree 12 files changed +13
-30
lines changed Expand file tree Collapse file tree 12 files changed +13
-30
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ export default function DBButton(props: DBButtonProps) {
23
23
const state = useStore < DBButtonState > ( {
24
24
handleClick : ( event : ClickEvent < HTMLButtonElement > ) => {
25
25
if ( props . onClick ) {
26
- event . stopPropagation ( ) ;
27
26
props . onClick ( event ) ;
28
27
}
29
28
}
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ export default function DBCard(props: DBCardProps) {
18
18
const state = useStore < DBCardState > ( {
19
19
handleClick : ( event : ClickEvent < HTMLElement > ) => {
20
20
if ( props . onClick ) {
21
- event . stopPropagation ( ) ;
22
21
props . onClick ( event ) ;
23
22
}
24
23
}
Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ export default function DBCheckbox(props: DBCheckboxProps) {
85
85
}
86
86
} ,
87
87
handleChange : ( event : ChangeEvent < HTMLInputElement > ) => {
88
- event . stopPropagation ( ) ;
89
88
if ( props . onChange ) {
90
89
props . onChange ( event ) ;
91
90
}
@@ -98,13 +97,11 @@ export default function DBCheckbox(props: DBCheckboxProps) {
98
97
state . handleValidation ( ) ;
99
98
} ,
100
99
handleBlur : ( event : InteractionEvent < HTMLInputElement > | any ) => {
101
- event . stopPropagation ( ) ;
102
100
if ( props . onBlur ) {
103
101
props . onBlur ( event ) ;
104
102
}
105
103
} ,
106
104
handleFocus : ( event : InteractionEvent < HTMLInputElement > | any ) => {
107
- event . stopPropagation ( ) ;
108
105
if ( props . onFocus ) {
109
106
props . onFocus ( event ) ;
110
107
}
Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ export default function DBDrawer(props: DBDrawerProps) {
21
21
const dialogContainerRef = useRef < HTMLDivElement | any > ( null ) ;
22
22
const state = useStore < DBDrawerState > ( {
23
23
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- handleClose : ( event : any ) => {
24
+ handleClose : ( event : any , forceClose ?: boolean ) => {
25
25
if ( event . key === 'Escape' ) {
26
26
event . preventDefault ( ) ;
27
27
}
28
28
29
+ if ( forceClose ) {
30
+ event . stopPropagation ( ) ;
31
+ }
32
+
29
33
if (
30
- event === 'close' ||
34
+ forceClose ||
31
35
event . key === 'Escape' ||
32
36
( event . target . nodeName === 'DIALOG' &&
33
37
event . type === 'click' &&
@@ -103,7 +107,7 @@ export default function DBDrawer(props: DBDrawerProps) {
103
107
icon = "cross"
104
108
variant = "ghost"
105
109
noText
106
- onClick = { ( ) => state . handleClose ( 'close' ) } >
110
+ onClick = { ( event ) => state . handleClose ( event , true ) } >
107
111
{ props . closeButtonText ?? DEFAULT_CLOSE_BUTTON }
108
112
</ DBButton >
109
113
</ header >
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ export default function DBHeader(props: DBHeaderProps) {
25
25
_id : DEFAULT_ID ,
26
26
initialized : false ,
27
27
forcedToMobile : false ,
28
- handleToggle : ( ) => {
28
+ handleToggle : ( event ?: any ) => {
29
+ if ( event && event . stopPropagation ) {
30
+ event . stopPropagation ( ) ;
31
+ }
32
+
29
33
const open = ! getBoolean ( props . drawerOpen , 'drawerOpen' ) ;
30
34
31
35
if ( props . onToggle ) {
Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ export default function DBInput(props: DBInputProps) {
101
101
}
102
102
} ,
103
103
handleInput : ( event : InputEvent < HTMLInputElement > ) => {
104
- event . stopPropagation ( ) ;
105
104
useTarget ( {
106
105
vue : ( ) => {
107
106
if ( props . input ) {
@@ -125,7 +124,6 @@ export default function DBInput(props: DBInputProps) {
125
124
state . handleValidation ( ) ;
126
125
} ,
127
126
handleChange : ( event : ChangeEvent < HTMLInputElement > ) => {
128
- event . stopPropagation ( ) ;
129
127
if ( props . onChange ) {
130
128
props . onChange ( event ) ;
131
129
}
@@ -137,13 +135,11 @@ export default function DBInput(props: DBInputProps) {
137
135
state . handleValidation ( ) ;
138
136
} ,
139
137
handleBlur : ( event : InteractionEvent < HTMLInputElement > | any ) => {
140
- event . stopPropagation ( ) ;
141
138
if ( props . onBlur ) {
142
139
props . onBlur ( event ) ;
143
140
}
144
141
} ,
145
142
handleFocus : ( event : InteractionEvent < HTMLInputElement > | any ) => {
146
- event . stopPropagation ( ) ;
147
143
if ( props . onFocus ) {
148
144
props . onFocus ( event ) ;
149
145
}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export default function DBLink(props: DBLinkProps) {
19
19
const state = useStore < DBLinkState > ( {
20
20
handleClick : ( event : ClickEvent < HTMLAnchorElement > ) => {
21
21
if ( props . onClick ) {
22
- event . stopPropagation ( ) ;
23
22
props . onClick ( event ) ;
24
23
}
25
24
}
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ export default function DBRadio(props: DBRadioProps) {
30
30
initialized : false ,
31
31
_id : undefined ,
32
32
handleChange : ( event : ChangeEvent < HTMLInputElement > | any ) => {
33
- event . stopPropagation ( ) ;
34
33
if ( props . onChange ) {
35
34
props . onChange ( event ) ;
36
35
}
@@ -41,13 +40,11 @@ export default function DBRadio(props: DBRadioProps) {
41
40
} ) ;
42
41
} ,
43
42
handleBlur : ( event : InteractionEvent < HTMLInputElement > | any ) => {
44
- event . stopPropagation ( ) ;
45
43
if ( props . onBlur ) {
46
44
props . onBlur ( event ) ;
47
45
}
48
46
} ,
49
47
handleFocus : ( event : InteractionEvent < HTMLInputElement > | any ) => {
50
- event . stopPropagation ( ) ;
51
48
if ( props . onFocus ) {
52
49
props . onFocus ( event ) ;
53
50
}
Original file line number Diff line number Diff line change @@ -96,12 +96,10 @@ export default function DBSelect(props: DBSelectProps) {
96
96
} ,
97
97
handleClick : ( event : ClickEvent < HTMLSelectElement > | any ) => {
98
98
if ( props . onClick ) {
99
- event . stopPropagation ( ) ;
100
99
props . onClick ( event ) ;
101
100
}
102
101
} ,
103
102
handleInput : ( event : InputEvent < HTMLSelectElement > | any ) => {
104
- event . stopPropagation ( ) ;
105
103
useTarget ( {
106
104
vue : ( ) => {
107
105
if ( props . input ) {
@@ -125,7 +123,6 @@ export default function DBSelect(props: DBSelectProps) {
125
123
state . handleValidation ( ) ;
126
124
} ,
127
125
handleChange : ( event : ChangeEvent < HTMLSelectElement > | any ) => {
128
- event . stopPropagation ( ) ;
129
126
if ( props . onChange ) {
130
127
props . onChange ( event ) ;
131
128
}
@@ -137,13 +134,11 @@ export default function DBSelect(props: DBSelectProps) {
137
134
state . handleValidation ( ) ;
138
135
} ,
139
136
handleBlur : ( event : InteractionEvent < HTMLSelectElement > | any ) => {
140
- event . stopPropagation ( ) ;
141
137
if ( props . onBlur ) {
142
138
props . onBlur ( event ) ;
143
139
}
144
140
} ,
145
141
handleFocus : ( event : InteractionEvent < HTMLSelectElement > | any ) => {
146
- event . stopPropagation ( ) ;
147
142
if ( props . onFocus ) {
148
143
props . onFocus ( event ) ;
149
144
}
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ export default function DBSwitch(props: DBSwitchProps) {
40
40
default : false
41
41
} ) ,
42
42
handleChange : ( event : ChangeEvent < HTMLInputElement > ) => {
43
- event . stopPropagation ( ) ;
44
43
if ( props . onChange ) {
45
44
props . onChange ( event ) ;
46
45
}
@@ -55,13 +54,11 @@ export default function DBSwitch(props: DBSwitchProps) {
55
54
} ) ;
56
55
} ,
57
56
handleBlur : ( event : InteractionEvent < HTMLInputElement > ) => {
58
- event . stopPropagation ( ) ;
59
57
if ( props . onBlur ) {
60
58
props . onBlur ( event ) ;
61
59
}
62
60
} ,
63
61
handleFocus : ( event : InteractionEvent < HTMLInputElement > ) => {
64
- event . stopPropagation ( ) ;
65
62
if ( props . onFocus ) {
66
63
props . onFocus ( event ) ;
67
64
}
Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ export default function DBTextarea(props: DBTextareaProps) {
89
89
}
90
90
} ,
91
91
handleInput : ( event : InputEvent < HTMLTextAreaElement > ) => {
92
- event . stopPropagation ( ) ;
93
92
useTarget ( {
94
93
vue : ( ) => {
95
94
if ( props . input ) {
@@ -112,7 +111,6 @@ export default function DBTextarea(props: DBTextareaProps) {
112
111
state . handleValidation ( ) ;
113
112
} ,
114
113
handleChange : ( event : ChangeEvent < HTMLTextAreaElement > ) => {
115
- event . stopPropagation ( ) ;
116
114
if ( props . onChange ) {
117
115
props . onChange ( event ) ;
118
116
}
@@ -123,13 +121,11 @@ export default function DBTextarea(props: DBTextareaProps) {
123
121
state . handleValidation ( ) ;
124
122
} ,
125
123
handleBlur : ( event : InteractionEvent < HTMLTextAreaElement > | any ) => {
126
- event . stopPropagation ( ) ;
127
124
if ( props . onBlur ) {
128
125
props . onBlur ( event ) ;
129
126
}
130
127
} ,
131
128
handleFocus : ( event : InteractionEvent < HTMLTextAreaElement > | any ) => {
132
- event . stopPropagation ( ) ;
133
129
if ( props . onFocus ) {
134
130
props . onFocus ( event ) ;
135
131
}
Original file line number Diff line number Diff line change @@ -591,7 +591,7 @@ export type CloseEventProps = {
591
591
} ;
592
592
593
593
export type CloseEventState = {
594
- handleClose : ( event : any ) => void ;
594
+ handleClose : ( event : any , forceClose ?: boolean ) => void ;
595
595
} ;
596
596
597
597
export const AlignmentList = [ 'start' , 'center' ] as const ;
You can’t perform that action at this time.
0 commit comments