UNPKG

@synergy-design-system/angular

Version:
310 lines (306 loc) 11 kB
import * as i0 from '@angular/core'; import { EventEmitter, Output, Input, Component } from '@angular/core'; import '@synergy-design-system/components/components/button/button.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 Buttons represent actions that are available to the user. * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-button--docs * @status stable * @since 2.0 * * @dependency syn-icon * @dependency syn-spinner * * @event syn-blur - Emitted when the button loses focus. * @event syn-focus - Emitted when the button gains focus. * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * * @slot - The button's label. * @slot prefix - A presentational prefix icon or similar element. * @slot suffix - A presentational suffix icon or similar element. * * @csspart base - The component's base wrapper. * @csspart prefix - The container that wraps the prefix. * @csspart label - The button's label. * @csspart suffix - The container that wraps the suffix. * @csspart caret - The button's caret icon, an `<syn-icon>` element. * @csspart spinner - The spinner that shows when the button is in the loading state. */ class SynButtonComponent { nativeElement; _ngZone; constructor(e, ngZone) { this.nativeElement = e.nativeElement; this._ngZone = ngZone; this.nativeElement.addEventListener('syn-blur', (e) => { this.synBlurEvent.emit(e); }); this.nativeElement.addEventListener('syn-focus', (e) => { this.synFocusEvent.emit(e); }); this.nativeElement.addEventListener('syn-invalid', (e) => { this.synInvalidEvent.emit(e); }); } set title(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.title = v)); } get title() { return this.nativeElement.title; } /** * The button's theme variant. */ set variant(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.variant = v)); } get variant() { return this.nativeElement.variant; } /** * The button's size. */ set size(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v)); } get size() { return this.nativeElement.size; } /** * Draws the button with a caret. * Used to indicate that the button triggers a dropdown menu or similar behavior. */ set caret(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.caret = v === '' || v)); } get caret() { return this.nativeElement.caret; } /** * Disables the button. */ set disabled(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.disabled = v === '' || v)); } get disabled() { return this.nativeElement.disabled; } /** * Draws the button in a loading state. */ set loading(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.loading = v === '' || v)); } get loading() { return this.nativeElement.loading; } /** * The type of button. * Note that the default value is `button` instead of `submit`, which is opposite of how native `<button>` elements behave. * When the type is `submit`, the button will submit the surrounding form. */ set type(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.type = v)); } get type() { return this.nativeElement.type; } /** * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter. This attribute is ignored when `href` is present. */ set name(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.name = v)); } get name() { return this.nativeElement.name; } /** * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this button is the submitter. * This attribute is ignored when `href` is present. */ set value(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v)); } get value() { return this.nativeElement.value; } /** * When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */ set href(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.href = v)); } get href() { return this.nativeElement.href; } /** * Tells the browser where to open the link. * Only used when `href` is present. */ set target(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.target = v)); } get target() { return this.nativeElement.target; } /** * When using `href`, this attribute will map to the underlying link's `rel` attribute. * Unlike regular links, the default is `noreferrer noopener` to prevent security exploits. * However, if you're using `target` to point to a specific tab/window, this will prevent that from working correctly. * You can remove or change the default value by setting the attribute to an empty string or a value of your choice, respectively. */ set rel(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.rel = v)); } get rel() { return this.nativeElement.rel; } /** * Tells the browser to download the linked file as this filename. * Only used when `href` is present. */ set download(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.download = v)); } get download() { return this.nativeElement.download; } /** * The "form owner" to associate the button with. * If omitted, the closest containing form will be used instead. * The value of this attribute must be an id of a form in the same document or shadow root as the button. */ set form(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.form = v)); } get form() { return this.nativeElement.form; } /** * Used to override the form owner's `action` attribute. */ set formAction(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.formAction = v)); } get formAction() { return this.nativeElement.formAction; } /** * Used to override the form owner's `enctype` attribute. */ set formEnctype(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.formEnctype = v)); } get formEnctype() { return this.nativeElement.formEnctype; } /** * Used to override the form owner's `method` attribute. */ set formMethod(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.formMethod = v)); } get formMethod() { return this.nativeElement.formMethod; } /** * Used to override the form owner's `novalidate` attribute. */ set formNoValidate(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.formNoValidate = v === '' || v)); } get formNoValidate() { return this.nativeElement.formNoValidate; } /** * Used to override the form owner's `target` attribute. */ set formTarget(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.formTarget = v)); } get formTarget() { return this.nativeElement.formTarget; } /** * Emitted when the button loses focus. */ synBlurEvent = new EventEmitter(); /** * Emitted when the button gains focus. */ synFocusEvent = new EventEmitter(); /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ synInvalidEvent = new EventEmitter(); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynButtonComponent, isStandalone: true, selector: "syn-button", inputs: { title: "title", variant: "variant", size: "size", caret: "caret", disabled: "disabled", loading: "loading", type: "type", name: "name", value: "value", href: "href", target: "target", rel: "rel", download: "download", form: "form", formAction: "formAction", formEnctype: "formEnctype", formMethod: "formMethod", formNoValidate: "formNoValidate", formTarget: "formTarget" }, outputs: { synBlurEvent: "synBlurEvent", synFocusEvent: "synFocusEvent", synInvalidEvent: "synInvalidEvent" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynButtonComponent, decorators: [{ type: Component, args: [{ selector: 'syn-button', standalone: true, template: '<ng-content></ng-content>', }] }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { title: [{ type: Input }], variant: [{ type: Input }], size: [{ type: Input }], caret: [{ type: Input }], disabled: [{ type: Input }], loading: [{ type: Input }], type: [{ type: Input }], name: [{ type: Input }], value: [{ type: Input }], href: [{ type: Input }], target: [{ type: Input }], rel: [{ type: Input }], download: [{ type: Input }], form: [{ type: Input }], formAction: [{ type: Input }], formEnctype: [{ type: Input }], formMethod: [{ type: Input }], formNoValidate: [{ type: Input }], formTarget: [{ type: Input }], synBlurEvent: [{ type: Output }], synFocusEvent: [{ type: Output }], synInvalidEvent: [{ type: Output }] } }); /** * Generated bundle index. Do not edit. */ export { SynButtonComponent }; //# sourceMappingURL=synergy-design-system-angular-components-button.mjs.map