/** * Copyright (c) Microblink Ltd. All rights reserved. */ import { Component, Element, Event, EventEmitter, Host, h, Prop } from '@stencil/core'; import { getWebComponentParts, setWebComponentParts, classNames } from '../../../utils/generic.helpers'; @Component({ tag: 'mb-modal', styleUrl: 'mb-modal.scss', shadow: true, }) export class MbModal { /** * Show modal content */ @Prop() visible: boolean = false; /** * Show shadow drop */ @Prop() elevated: boolean = false; /** * Center component */ @Prop() centered: boolean = false; /** * Passed title content from parent component */ @Prop() modalTitle: string = ""; /** * Passed body content from parent component */ @Prop() content: string = ""; /** * Center content inside modal */ @Prop() contentCentered: boolean = true; /** * Whether to show back arrow or not */ @Prop() showBackButton: boolean = false; /** * Whether to hide the footer or not */ @Prop() hideFooter: boolean = false; /** * Emitted when user clicks on 'X' button. */ @Event() close: EventEmitter; /** * Emitted when user clicks on 'Back Arrow' button. */ @Event() back: EventEmitter; /** * Host element as variable for manipulation */ @Element() hostEl: HTMLElement; componentDidLoad() { setWebComponentParts(this.hostEl); const parts = getWebComponentParts(this.hostEl.shadowRoot); this.hostEl.setAttribute('exportparts', parts.join(', ')); } render() { return (
this.close.emit() }>
{this.showBackButton ? (
this.back.emit() }>
) : null}
{ this.modalTitle }
{ this.content }
{this.hideFooter ? null : ( )}
); } }