@synergy-design-system/angular
Version:
Angular wrappers for the Synergy Design System
170 lines (166 loc) • 6.97 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, Output, Input, Component } from '@angular/core';
import '@synergy-design-system/components/components/details/details.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 Details show a brief summary and expand to show additional content.
* @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-details--docs
* @status stable
* @since 2.0
*
* @dependency syn-icon
*
* @slot - The details' main content.
* @slot summary - The details' summary. Alternatively, you can use the `summary` attribute.
* @slot expand-icon - Optional expand icon to use instead of the default. Works best with `<syn-icon>`.
* @slot collapse-icon - Optional collapse icon to use instead of the default. Works best with `<syn-icon>`.
*
* @event syn-show - Emitted when the details opens.
* @event syn-after-show - Emitted after the details opens and all animations are complete.
* @event syn-hide - Emitted when the details closes.
* @event syn-after-hide - Emitted after the details closes and all animations are complete.
*
* @csspart base - The component's base wrapper.
* @csspart header - The header that wraps both the summary and the expand/collapse icon.
* @csspart summary - The container that wraps the summary.
* @csspart summary-icon - The container that wraps the expand/collapse icons.
* @csspart content - The details content.
* @csspart body - The container that wraps the details content.
*
* @animation details.show - The animation to use when showing details. You can use `height: auto` with this animation.
* @animation details.hide - The animation to use when hiding details. You can use `height: auto` with this animation.
*/
class SynDetailsComponent {
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);
});
}
ngAfterContentInit() {
// This is a workaround for this issue: https://github.com/synergy-design-system/synergy-design-system/issues/784
if (this.nativeElement.open) {
this.nativeElement.updateComplete.then(() => {
const animations = this.nativeElement.details.getAnimations({
subtree: true,
});
animations.forEach(animation => {
animation.cancel();
});
});
}
}
/**
* Indicates whether or not the details is open.
* You can toggle this attribute to show and hide the details, or you
can use the `show()` and `hide()` methods and this attribute will reflect the details' open state.
*/
set open(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.open = v === '' || v));
}
get open() {
return this.nativeElement.open;
}
/**
* The summary to show in the header.
* If you need to display HTML, use the `summary` slot instead.
*/
set summary(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.summary = v));
}
get summary() {
return this.nativeElement.summary;
}
/**
* Disables the details so it can't be toggled.
*/
set disabled(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.disabled = v === '' || v));
}
get disabled() {
return this.nativeElement.disabled;
}
/**
* Draws the details as contained element.
*/
set contained(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.contained = v === '' || v));
}
get contained() {
return this.nativeElement.contained;
}
/**
* The details's size.
*/
set size(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v));
}
get size() {
return this.nativeElement.size;
}
/**
* Emitted when the details opens.
*/
synShowEvent = new EventEmitter();
/**
* Emitted after the details opens and all animations are complete.
*/
synAfterShowEvent = new EventEmitter();
/**
* Emitted when the details closes.
*/
synHideEvent = new EventEmitter();
/**
* Emitted after the details closes and all animations are complete.
*/
synAfterHideEvent = new EventEmitter();
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynDetailsComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynDetailsComponent, isStandalone: true, selector: "syn-details", inputs: { open: "open", summary: "summary", disabled: "disabled", contained: "contained", size: "size" }, outputs: { synShowEvent: "synShowEvent", synAfterShowEvent: "synAfterShowEvent", synHideEvent: "synHideEvent", synAfterHideEvent: "synAfterHideEvent" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynDetailsComponent, decorators: [{
type: Component,
args: [{
selector: 'syn-details',
standalone: true,
template: '<ng-content></ng-content>',
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { open: [{
type: Input
}], summary: [{
type: Input
}], disabled: [{
type: Input
}], contained: [{
type: Input
}], size: [{
type: Input
}], synShowEvent: [{
type: Output
}], synAfterShowEvent: [{
type: Output
}], synHideEvent: [{
type: Output
}], synAfterHideEvent: [{
type: Output
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { SynDetailsComponent };
//# sourceMappingURL=synergy-design-system-angular-components-details.mjs.map