@synergy-design-system/angular
Version:
Angular wrappers for the Synergy Design System
182 lines (178 loc) • 8.97 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, Output, Input, Component } from '@angular/core';
import '@synergy-design-system/components/components/dialog/dialog.js';
// ---------------------------------------------------------------------
// 🔒 AUTOGENERATED @synergy-design-system/angular wrappers for @synergy-design-system/components
// Please do not edit this file directly!
// It will get recreated when running pnpm build.
// ---------------------------------------------------------------------
/**
* @summary Dialogs, sometimes called "modals", appear above the page and require the user's immediate attention.
* @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-dialog--docs
* @status stable
* @since 2.0
*
* @dependency syn-icon-button
*
* @slot - The dialog's main content.
* @slot label - The dialog's label. Alternatively, you can use the `label` attribute.
* @slot header-actions - Optional actions to add to the header. Works best with `<syn-icon-button>`.
* @slot footer - The dialog's footer, usually one or more buttons representing various options.
*
* @event syn-show - Emitted when the dialog opens.
* @event syn-after-show - Emitted after the dialog opens and all animations are complete.
* @event syn-hide - Emitted when the dialog closes.
* @event syn-after-hide - Emitted after the dialog closes and all animations are complete.
* @event syn-initial-focus - Emitted when the dialog opens and is ready to receive focus. Calling
* `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
* @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} syn-request-close - Emitted when the user attempts to
* close the dialog by clicking the close button, clicking the overlay, or pressing escape. Calling
* `event.preventDefault()` will keep the dialog open. Avoid using this unless closing the dialog will result in
* destructive behavior such as data loss.
*
* @csspart base - The component's base wrapper.
* @csspart overlay - The overlay that covers the screen behind the dialog.
* @csspart panel - The dialog's panel (where the dialog and its content are rendered).
* @csspart header - The dialog's header. This element wraps the title and header actions.
* @csspart header-actions - Optional actions to add to the header. Works best with `<syn-icon-button>`.
* @csspart title - The dialog's title.
* @csspart close-button - The close button, an `<syn-icon-button>`.
* @csspart close-button__base - The close button's exported `base` part.
* @csspart body - The dialog's body.
* @csspart footer - The dialog's footer.
*
* @cssproperty --width - The preferred width of the dialog. Note that the dialog will shrink to accommodate smaller screens.
* @cssproperty --header-spacing - The amount of padding to use for the header.
* @cssproperty --body-spacing - The amount of padding to use for the body.
* @cssproperty --footer-spacing - The amount of padding to use for the footer.
*
* @animation dialog.show - The animation to use when showing the dialog.
* @animation dialog.hide - The animation to use when hiding the dialog.
* @animation dialog.denyClose - The animation to use when a request to close the dialog is denied.
* @animation dialog.overlay.show - The animation to use when showing the dialog's overlay.
* @animation dialog.overlay.hide - The animation to use when hiding the dialog's overlay.
*
* @property modal - Exposes the internal modal utility that controls focus trapping. To temporarily disable focus
* trapping and allow third-party modals spawned from an active Synergy modal, call `modal.activateExternal()` when
* the third-party modal opens. Upon closing, call `modal.deactivateExternal()` to restore Synergy's focus trapping.
*/
class SynDialogComponent {
nativeElement;
_ngZone;
constructor(e, ngZone) {
this.nativeElement = e.nativeElement;
this._ngZone = ngZone;
this.nativeElement.addEventListener('syn-show', (e) => {
this.synShowEvent.emit(e);
});
this.nativeElement.addEventListener('syn-after-show', (e) => {
this.synAfterShowEvent.emit(e);
});
this.nativeElement.addEventListener('syn-hide', (e) => {
this.synHideEvent.emit(e);
});
this.nativeElement.addEventListener('syn-after-hide', (e) => {
this.synAfterHideEvent.emit(e);
});
this.nativeElement.addEventListener('syn-initial-focus', (e) => {
this.synInitialFocusEvent.emit(e);
});
this.nativeElement.addEventListener('syn-request-close', (e) => {
this.synRequestCloseEvent.emit(e);
});
}
/**
* Indicates whether or not the dialog is open.
* You can toggle this attribute to show and hide the dialog, or you can
use the `show()` and `hide()` methods and this attribute will reflect the dialog's open state.
*/
set open(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.open = v === '' || v));
}
get open() {
return this.nativeElement.open;
}
/**
* The dialog's label as displayed in the header.
* You should always include a relevant label even when using
`no-header`, as it is required for proper accessibility.
* If you need to display HTML, use the `label` slot instead.
*/
set label(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.label = v));
}
get label() {
return this.nativeElement.label;
}
/**
* Disables the header.
* This will also remove the default close button, so please ensure you provide an easy,
accessible way for users to dismiss the dialog.
*/
set noHeader(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.noHeader = v === '' || v));
}
get noHeader() {
return this.nativeElement.noHeader;
}
/**
* Emitted when the dialog opens.
*/
synShowEvent = new EventEmitter();
/**
* Emitted after the dialog opens and all animations are complete.
*/
synAfterShowEvent = new EventEmitter();
/**
* Emitted when the dialog closes.
*/
synHideEvent = new EventEmitter();
/**
* Emitted after the dialog closes and all animations are complete.
*/
synAfterHideEvent = new EventEmitter();
/**
* Emitted when the dialog opens and is ready to receive focus.
* Calling `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
*/
synInitialFocusEvent = new EventEmitter();
/**
* Emitted when the user attempts to close the dialog by clicking the close button, clicking the overlay, or pressing escape.
* Calling `event.preventDefault()` will keep the dialog open.
* Avoid using this unless closing the dialog will result in destructive behavior such as data loss.
*/
synRequestCloseEvent = new EventEmitter();
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynDialogComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynDialogComponent, isStandalone: true, selector: "syn-dialog", inputs: { open: "open", label: "label", noHeader: "noHeader" }, outputs: { synShowEvent: "synShowEvent", synAfterShowEvent: "synAfterShowEvent", synHideEvent: "synHideEvent", synAfterHideEvent: "synAfterHideEvent", synInitialFocusEvent: "synInitialFocusEvent", synRequestCloseEvent: "synRequestCloseEvent" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynDialogComponent, decorators: [{
type: Component,
args: [{
selector: 'syn-dialog',
standalone: true,
template: '<ng-content></ng-content>',
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { open: [{
type: Input
}], label: [{
type: Input
}], noHeader: [{
type: Input
}], synShowEvent: [{
type: Output
}], synAfterShowEvent: [{
type: Output
}], synHideEvent: [{
type: Output
}], synAfterHideEvent: [{
type: Output
}], synInitialFocusEvent: [{
type: Output
}], synRequestCloseEvent: [{
type: Output
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { SynDialogComponent };
//# sourceMappingURL=synergy-design-system-angular-components-dialog.mjs.map