@synergy-design-system/angular
Version:
Angular wrappers for the Synergy Design System
571 lines (563 loc) • 21.6 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, Output, Input, Component } from '@angular/core';
import '@synergy-design-system/components/components/input/input.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 Inputs collect data from the user.
* @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-input--docs
* @status stable
* @since 2.0
*
* @dependency syn-icon
* @dependency syn-divider
*
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
* @slot prefix - Used to prepend a presentational icon or similar element to the input.
* @slot suffix - Used to append a presentational icon or similar element to the input.
* @slot clear-icon - An icon to use in lieu of the default clear icon.
* @slot show-password-icon - An icon to use in lieu of the default show password icon.
* @slot hide-password-icon - An icon to use in lieu of the default hide password icon.
* @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.
* @slot increment-number-stepper - An icon to use in lieu of the default increment number stepper icon.
* @slot decrement-number-stepper - An icon to use in lieu of the default decrement number stepper icon.
*
* @event syn-blur - Emitted when the control loses focus.
* @event syn-change - Emitted when an alteration to the control's value is committed by the user.
* @event syn-clear - Emitted when the clear button is activated.
* @event syn-focus - Emitted when the control gains focus.
* @event syn-input - Emitted when the control receives input.
* @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
* @event syn-clamp - Emitted if the numeric strategy allows autoClamp and the value is clamped to the min or max attribute.
*
* @csspart form-control - The form control that wraps the label, input, and help text.
* @csspart form-control-label - The label's wrapper.
* @csspart form-control-input - The input's wrapper.
* @csspart form-control-help-text - The help text's wrapper.
* @csspart base - The component's base wrapper.
* @csspart input - The internal `<input>` control.
* @csspart prefix - The container that wraps the prefix.
* @csspart clear-button - The clear button.
* @csspart password-toggle-button - The password toggle button.
* @csspart suffix - The container that wraps the suffix.
* @csspart stepper - The container that wraps the number stepper.
* @csspart decrement-number-stepper - The decrement number stepper button.
* @csspart increment-number-stepper - The increment number stepper button.
* @csspart divider - The divider between the increment and decrement number stepper buttons.
*
* @cssproperty --syn-input-autofill-shadow - The shadow to apply when the input is autofilled.
* @cssproperty --syn-input-autofill-readonly-shadow - The shadow to apply when the input is readonly and autofilled.
* @cssproperty --syn-input-autofill-text-fill-color - The text fill color to apply when the input is autofilled.
* @cssproperty --syn-input-autofill-caret-color - The caret color to apply when the input is autofilled.
*/
class SynInputComponent {
nativeElement;
_ngZone;
modelSignal = new AbortController();
constructor(e, ngZone) {
this.nativeElement = e.nativeElement;
this._ngZone = ngZone;
this.nativeElement.addEventListener('syn-blur', (e) => {
this.synBlurEvent.emit(e);
});
this.nativeElement.addEventListener('syn-change', (e) => {
this.synChangeEvent.emit(e);
});
this.nativeElement.addEventListener('syn-clear', (e) => {
this.synClearEvent.emit(e);
});
this.nativeElement.addEventListener('syn-focus', (e) => {
this.synFocusEvent.emit(e);
});
this.nativeElement.addEventListener('syn-input', (e) => {
this.synInputEvent.emit(e);
});
this.nativeElement.addEventListener('syn-invalid', (e) => {
this.synInvalidEvent.emit(e);
});
this.nativeElement.addEventListener('syn-clamp', (e) => {
this.synClampEvent.emit(e);
});
this.ngModelUpdateOn = 'syn-input';
}
/**
* The event that will trigger the ngModel update.
* By default, this is set to "syn-input".
*/
set ngModelUpdateOn(v) {
this.modelSignal.abort();
this.modelSignal = new AbortController();
const option = v || 'syn-input';
this.nativeElement.addEventListener(option, () => {
this.valueChange.emit(this.value);
}, {
signal: this.modelSignal.signal,
});
}
get ngModelUpdateOn() {
return this.ngModelUpdateOn;
}
set title(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.title = v));
}
get title() {
return this.nativeElement.title;
}
/**
* The type of input.
* Works the same as a native `<input>` element, but only a subset of types are supported.
* Defaults
to `text`.
*/
set type(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.type = v));
}
get type() {
return this.nativeElement.type;
}
/**
* The name of the input, submitted as a name/value pair with form data.
*/
set name(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.name = v));
}
get name() {
return this.nativeElement.name;
}
/**
* The current value of the input, submitted as a name/value pair with form data.
*/
set value(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v));
}
get value() {
return this.nativeElement.value;
}
/**
* The input's size.
*/
set size(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v));
}
get size() {
return this.nativeElement.size;
}
/**
* The input's label.
* 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;
}
/**
* The input's help text.
* If you need to display HTML, use the `help-text` slot instead.
*/
set helpText(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.helpText = v));
}
get helpText() {
return this.nativeElement.helpText;
}
/**
* Adds a clear button when the input is not empty.
*/
set clearable(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.clearable = v === '' || v));
}
get clearable() {
return this.nativeElement.clearable;
}
/**
* Disables the input.
*/
set disabled(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.disabled = v === '' || v));
}
get disabled() {
return this.nativeElement.disabled;
}
/**
* Placeholder text to show as a hint when the input is empty.
*/
set placeholder(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.placeholder = v));
}
get placeholder() {
return this.nativeElement.placeholder;
}
/**
* Makes the input readonly.
*/
set readonly(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.readonly = v === '' || v));
}
get readonly() {
return this.nativeElement.readonly;
}
/**
* Adds a button to toggle the password's visibility.
* Only applies to password types.
*/
set passwordToggle(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.passwordToggle = v === '' || v));
}
get passwordToggle() {
return this.nativeElement.passwordToggle;
}
/**
* Determines whether or not the password is currently visible.
* Only applies to password input types.
*/
set passwordVisible(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.passwordVisible = v === '' || v));
}
get passwordVisible() {
return this.nativeElement.passwordVisible;
}
/**
* Hides the increment/decrement spin buttons for number inputs.
*/
set noSpinButtons(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.noSpinButtons = v === '' || v));
}
get noSpinButtons() {
return this.nativeElement.noSpinButtons;
}
/**
* By default, form controls are associated with the nearest containing `<form>` element.
* This attribute allows you
to place the form control outside of a form and associate it with the form that has this `id`.
* The form must be in
the same document or shadow root for this to work.
*/
set form(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.form = v));
}
get form() {
return this.nativeElement.form;
}
/**
* Makes the input a required field.
*/
set required(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.required = v === '' || v));
}
get required() {
return this.nativeElement.required;
}
/**
* A regular expression pattern to validate input against.
*/
set pattern(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.pattern = v));
}
get pattern() {
return this.nativeElement.pattern;
}
/**
* The minimum length of input that will be considered valid.
*/
set minlength(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.minlength = v));
}
get minlength() {
return this.nativeElement.minlength;
}
/**
* The maximum length of input that will be considered valid.
*/
set maxlength(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.maxlength = v));
}
get maxlength() {
return this.nativeElement.maxlength;
}
/**
* The input's minimum value.
* Only applies to date and number input types.
*/
set min(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.min = v));
}
get min() {
return this.nativeElement.min;
}
/**
* The input's maximum value.
* Only applies to date and number input types.
*/
set max(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.max = v));
}
get max() {
return this.nativeElement.max;
}
/**
* Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is
implied, allowing any numeric value.
* Only applies to date and number input types.
*/
set step(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.step = v));
}
get step() {
return this.nativeElement.step;
}
/**
* Controls whether and how text input is automatically capitalized as it is entered by the user.
*/
set autocapitalize(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.autocapitalize = v));
}
get autocapitalize() {
return this.nativeElement.autocapitalize;
}
/**
* Indicates whether the browser's autocorrect feature is on or off.
*/
set autocorrect(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.autocorrect = v));
}
get autocorrect() {
return this.nativeElement.autocorrect;
}
/**
* Specifies what permission the browser has to provide assistance in filling out form field values.
* Refer to
[this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.
*/
set autocomplete(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.autocomplete = v));
}
get autocomplete() {
return this.nativeElement.autocomplete;
}
/**
* Indicates that the input should receive focus on page load.
*/
set autofocus(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.autofocus = v === '' || v));
}
get autofocus() {
return this.nativeElement.autofocus;
}
/**
* Used to customize the label or icon of the Enter key on virtual keyboards.
*/
set enterkeyhint(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.enterkeyhint = v));
}
get enterkeyhint() {
return this.nativeElement.enterkeyhint;
}
/**
* Enables spell checking on the input.
*/
set spellcheck(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.spellcheck = v === '' || v));
}
get spellcheck() {
return this.nativeElement.spellcheck;
}
/**
* Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual
keyboard on supportive devices.
*/
set inputmode(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.inputmode = v));
}
get inputmode() {
return this.nativeElement.inputmode;
}
/**
* The minimal amount of fraction digits to use for numeric values.
Used to format the number when the input type is `number`.
*/
set minFractionDigits(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.minFractionDigits = v));
}
get minFractionDigits() {
return this.nativeElement.minFractionDigits;
}
/**
* The maximal amount of fraction digits to use for numeric values.
Used to format the number when the input type is `number`.
*/
set maxFractionDigits(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.maxFractionDigits = v));
}
get maxFractionDigits() {
return this.nativeElement.maxFractionDigits;
}
/**
* Defines the strategy for handling numbers in the numeric input.
This is used to determine how the input behaves when the user interacts with it.
Includes the following configuration options:
- **autoClamp**: If true, the input will clamp the value to the min and max attributes.
- **noStepAlign**: If true, the input will not align the value to the step attribute.
- **noStepValidation**: If true, the input will not validate the value against the step attribute.
You may provide this as one of the following values:
- 'native': Uses the native browser implementation.
- 'modern': Uses a more intuitive implementation:
- Values are clamped to the nearest min or max value.
- Stepping is inclusive to the provided min and max values.
- Provided stepping is no longer used in validation.
- An object that matches the `NumericStrategy` type.
* Note this can only be set via `property`, not as an `attribute`!
*/
set numericStrategy(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.numericStrategy = v));
}
get numericStrategy() {
return this.nativeElement.numericStrategy;
}
/**
* Optional options that should be passed to the `NumberFormatter` when formatting the value.
This is used to format the number when the input type is `number`.
Note this can only be set via `property`, not as an `attribute`!
*/
set numberFormatterOptions(v) {
this._ngZone.runOutsideAngular(() => (this.nativeElement.numberFormatterOptions = v));
}
get numberFormatterOptions() {
return this.nativeElement.numberFormatterOptions;
}
/**
* Emitted when the control loses focus.
*/
synBlurEvent = new EventEmitter();
/**
* Emitted when an alteration to the control's value is committed by the user.
*/
synChangeEvent = new EventEmitter();
/**
* Emitted when the clear button is activated.
*/
synClearEvent = new EventEmitter();
/**
* Emitted when the control gains focus.
*/
synFocusEvent = new EventEmitter();
/**
* Emitted when the control receives input.
*/
synInputEvent = new EventEmitter();
/**
* Emitted when the form control has been checked for validity and its constraints aren't satisfied.
*/
synInvalidEvent = new EventEmitter();
/**
* Emitted if the numeric strategy allows autoClamp and the value is clamped to the min or max attribute.
*/
synClampEvent = new EventEmitter();
/**
* Support for two way data binding
*/
valueChange = new EventEmitter();
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynInputComponent, isStandalone: true, selector: "syn-input", inputs: { ngModelUpdateOn: "ngModelUpdateOn", title: "title", type: "type", name: "name", value: "value", size: "size", label: "label", helpText: "helpText", clearable: "clearable", disabled: "disabled", placeholder: "placeholder", readonly: "readonly", passwordToggle: "passwordToggle", passwordVisible: "passwordVisible", noSpinButtons: "noSpinButtons", form: "form", required: "required", pattern: "pattern", minlength: "minlength", maxlength: "maxlength", min: "min", max: "max", step: "step", autocapitalize: "autocapitalize", autocorrect: "autocorrect", autocomplete: "autocomplete", autofocus: "autofocus", enterkeyhint: "enterkeyhint", spellcheck: "spellcheck", inputmode: "inputmode", minFractionDigits: "minFractionDigits", maxFractionDigits: "maxFractionDigits", numericStrategy: "numericStrategy", numberFormatterOptions: "numberFormatterOptions" }, outputs: { synBlurEvent: "synBlurEvent", synChangeEvent: "synChangeEvent", synClearEvent: "synClearEvent", synFocusEvent: "synFocusEvent", synInputEvent: "synInputEvent", synInvalidEvent: "synInvalidEvent", synClampEvent: "synClampEvent", valueChange: "valueChange" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynInputComponent, decorators: [{
type: Component,
args: [{
selector: 'syn-input',
standalone: true,
template: '<ng-content></ng-content>',
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { ngModelUpdateOn: [{
type: Input
}], title: [{
type: Input
}], type: [{
type: Input
}], name: [{
type: Input
}], value: [{
type: Input
}], size: [{
type: Input
}], label: [{
type: Input
}], helpText: [{
type: Input
}], clearable: [{
type: Input
}], disabled: [{
type: Input
}], placeholder: [{
type: Input
}], readonly: [{
type: Input
}], passwordToggle: [{
type: Input
}], passwordVisible: [{
type: Input
}], noSpinButtons: [{
type: Input
}], form: [{
type: Input
}], required: [{
type: Input
}], pattern: [{
type: Input
}], minlength: [{
type: Input
}], maxlength: [{
type: Input
}], min: [{
type: Input
}], max: [{
type: Input
}], step: [{
type: Input
}], autocapitalize: [{
type: Input
}], autocorrect: [{
type: Input
}], autocomplete: [{
type: Input
}], autofocus: [{
type: Input
}], enterkeyhint: [{
type: Input
}], spellcheck: [{
type: Input
}], inputmode: [{
type: Input
}], minFractionDigits: [{
type: Input
}], maxFractionDigits: [{
type: Input
}], numericStrategy: [{
type: Input
}], numberFormatterOptions: [{
type: Input
}], synBlurEvent: [{
type: Output
}], synChangeEvent: [{
type: Output
}], synClearEvent: [{
type: Output
}], synFocusEvent: [{
type: Output
}], synInputEvent: [{
type: Output
}], synInvalidEvent: [{
type: Output
}], synClampEvent: [{
type: Output
}], valueChange: [{
type: Output
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { SynInputComponent };
//# sourceMappingURL=synergy-design-system-angular-components-input.mjs.map