Skip to content

Commit daeef6d

Browse files
saraparsa13Sara.Parsaee
and
Sara.Parsaee
authored
feat: add onclose event to the bottom sheet (#184)
* feat: add onclose event to the bottom sheet * fix: change custom event to dispatch event * fix: add close event to the doc * chore: remove unused property * fix: remove dispatch event wrapper function --------- Co-authored-by: Sara.Parsaee <Sara.Parsaee@Tapsi.cab>
1 parent 27ed118 commit daeef6d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/bottom-sheet/bottom-sheet.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,16 @@ export class BottomSheet extends LitElement {
135135
}
136136
}
137137
};
138-
138+
139139
private handleDismiss = (): void => {
140140
this.disappear = true;
141+
142+
this.dispatchEvent(
143+
new CustomEvent('close', {
144+
bubbles: true,
145+
composed: true,
146+
}),
147+
);
141148
};
142149

143150
private handleAnimationEnd = () => {

src/bottom-sheet/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import styles from './bottom-sheet.style';
2424
* @cssprop [--tap-bottom-sheet-header-padding=12px]
2525
* @cssprop [--tap-bottom-sheet-background=--tap-sys-color-surface-primary]
2626
* @cssprop [--tap-bottom-sheet-content-overflow-y=scroll]
27+
*
28+
* @fires close - Fires when the bottom sheet closes.
2729
*/
2830
@customElement('tap-bottom-sheet')
2931
export class TapBottomSheet extends BottomSheet {

0 commit comments

Comments
 (0)