Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- [Fixed generic modal event warning](https://github.com/multiversx/mx-sdk-dapp-core-ui/pull/23)
- [Added custom notification support](https://github.com/multiversx/mx-sdk-dapp-core-ui/pull/21)

## [[0.0.0-alpha.1](https://github.com/multiversx/mx-sdk-dapp-core-ui/pull/16)] - 2025-01-20
Expand Down
6 changes: 3 additions & 3 deletions src/common/generic-modal/generic-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Prop, VNode, h } from '@stencil/core';
import { Component, Event, EventEmitter, Prop, VNode, h } from '@stencil/core';

@Component({
tag: 'generic-modal',
Expand All @@ -9,14 +9,14 @@ export class GenericModal {
@Prop() body: VNode;
@Prop() modalTitle: string | VNode;
@Prop() modalSubtitle?: string | VNode;
@Prop() onClose: () => void;
@Event() close: EventEmitter<void>;

render() {
return (
<div class="modal">
<div class="modal-content">
<div class="modal-header">
<span class="close" onClick={this.onClose}>
<span class="close" onClick={() => this.close.emit()}>
</span>
<h2>{this.modalTitle}</h2>
Expand Down
8 changes: 7 additions & 1 deletion src/common/generic-modal/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
| `body` | -- | | `VNode` | `undefined` |
| `modalSubtitle` | `modal-subtitle` | | `VNode \| string` | `undefined` |
| `modalTitle` | `modal-title` | | `VNode \| string` | `undefined` |
| `onClose` | -- | | `() => void` | `undefined` |


## Events

| Event | Description | Type |
| ------- | ----------- | ------------------- |
| `close` | | `CustomEvent<void>` |


## Dependencies
Expand Down
18 changes: 16 additions & 2 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export namespace Components {
"body": VNode;
"modalSubtitle"?: string | VNode;
"modalTitle": string | VNode;
"onClose": () => void;
}
interface GenericSpinner {
}
Expand Down Expand Up @@ -132,6 +131,10 @@ export interface CustomToastCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCustomToastElement;
}
export interface GenericModalCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLGenericModalElement;
}
export interface GenericToastCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLGenericToastElement;
Expand Down Expand Up @@ -184,7 +187,18 @@ declare global {
prototype: HTMLFungibleComponentElement;
new (): HTMLFungibleComponentElement;
};
interface HTMLGenericModalElementEventMap {
"close": void;
}
interface HTMLGenericModalElement extends Components.GenericModal, HTMLStencilElement {
addEventListener<K extends keyof HTMLGenericModalElementEventMap>(type: K, listener: (this: HTMLGenericModalElement, ev: GenericModalCustomEvent<HTMLGenericModalElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLGenericModalElementEventMap>(type: K, listener: (this: HTMLGenericModalElement, ev: GenericModalCustomEvent<HTMLGenericModalElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
var HTMLGenericModalElement: {
prototype: HTMLGenericModalElement;
Expand Down Expand Up @@ -387,7 +401,7 @@ declare namespace LocalJSX {
"body"?: VNode;
"modalSubtitle"?: string | VNode;
"modalTitle"?: string | VNode;
"onClose"?: () => void;
"onClose"?: (event: GenericModalCustomEvent<void>) => void;
}
interface GenericSpinner {
}
Expand Down
Loading