UNPKG

@synergy-design-system/angular

Version:
320 lines (316 loc) 12.4 kB
import * as i0 from '@angular/core'; import { EventEmitter, Output, Input, Component } from '@angular/core'; import '@synergy-design-system/components/components/range/range.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 Ranges allow the user to select values within a given range using one or two thumbs. * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-range--docs * @status stable * * @dependency syn-tooltip * * @slot label - The range's label. Alternatively, you can use the `label` attribute. * @slot prefix - Used to prepend a presentational icon or similar element to the range. * @slot suffix - Used to append a presentational icon or similar element to the range. * @slot help-text - Text that describes how to use the range. * Alternatively, you can use the `help-text` attribute. * @slot ticks - Used to display tick marks at specific intervals along the range. * * @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-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-move - Emitted when the user moves a thumb, either via touch or keyboard. * Use `Event.preventDefault()` to prevent movement. * * @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-help-text - The help text's wrapper. * @csspart base - The component's base wrapper. * @csspart input-wrapper - The container that wraps the input track and ticks. * @csspart track-wrapper - The wrapper for the track. * @csspart track - The inactive track. * @csspart active-track - The active track. * @csspart prefix - The container that wraps the prefix. * @csspart suffix - The container that wraps the suffix. * @csspart ticks - The container that wraps the tick marks. * @csspart thumb - The thumb(s) that the user can drag to change the range. * * @csspart tooltip__base - The base of the tooltip * @csspart tooltip__arrow - The arrow of the tooltip * @csspart tooltip__popup - The popup of the tooltip * @csspart tooltip__body - The body of the tooltip * * @cssproperty --thumb-size - The size of a thumb. * @cssproperty --thumb-hit-area-size - The clickable area around the thumb. * Per default this is set to 140% of the thumb size. Must be a scale css value (defaults to 1.4). * @cssproperty --track-hit-area-size - The clickable area around the track (top and left). * @cssproperty --track-color-active - Color of the track representing the current value. * @cssproperty --track-color-inactive - Color of the track that represents the remaining value. * @cssproperty --track-height - The height of the track. * @cssproperty --track-active-offset - The point of origin of the active track, * starting at the left side of the range. */ class SynRangeComponent { 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-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-move', (e) => { this.synMoveEvent.emit(e); }); this.ngModelUpdateOn = 'syn-change'; } /** * The event that will trigger the ngModel update. * By default, this is set to "syn-change". */ set ngModelUpdateOn(v) { this.modelSignal.abort(); this.modelSignal = new AbortController(); const option = v || 'syn-change'; this.nativeElement.addEventListener(option, () => { this.valueChange.emit(this.value); }, { signal: this.modelSignal.signal, }); } get ngModelUpdateOn() { return this.ngModelUpdateOn; } /** * The name of the range, 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 range'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 range'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; } /** * Disables the range. */ set disabled(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.disabled = v === '' || v)); } get disabled() { return this.nativeElement.disabled; } /** * The minimum acceptable value of the range. */ set min(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.min = v)); } get min() { return this.nativeElement.min; } /** * The maximum acceptable value of the range. */ set max(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.max = v)); } get max() { return this.nativeElement.max; } /** * The interval at which the range will increase and decrease. */ set step(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.step = v)); } get step() { return this.nativeElement.step; } /** * The range's size. */ set size(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v)); } get size() { return this.nativeElement.size; } /** * The preferred placement of the range's tooltip. * Use "none" to disable the tooltip */ set tooltipPlacement(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.tooltipPlacement = v)); } get tooltipPlacement() { return this.nativeElement.tooltipPlacement; } /** * The current values of the input (in ascending order) as a string of space separated values */ set value(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v)); } get value() { return this.nativeElement.value; } /** * Set to true to restrict the movement of a thumb to its next and previous thumb. This only affects multi range components */ set restrictMovement(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.restrictMovement = v === '' || v)); } get restrictMovement() { return this.nativeElement.restrictMovement; } /** * 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; } /** * A function used to format the tooltip's value. The value of the thumb is passed as the only argument. The function should return a string to display in the tooltip. */ set tooltipFormatter(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.tooltipFormatter = v)); } get tooltipFormatter() { return this.nativeElement.tooltipFormatter; } /** * 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 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 when the user moves a thumb, either via touch or keyboard. * Use `Event.preventDefault()` to prevent movement. */ synMoveEvent = 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: SynRangeComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynRangeComponent, isStandalone: true, selector: "syn-range", inputs: { ngModelUpdateOn: "ngModelUpdateOn", name: "name", label: "label", helpText: "helpText", disabled: "disabled", min: "min", max: "max", step: "step", size: "size", tooltipPlacement: "tooltipPlacement", value: "value", restrictMovement: "restrictMovement", form: "form", tooltipFormatter: "tooltipFormatter" }, outputs: { synBlurEvent: "synBlurEvent", synChangeEvent: "synChangeEvent", synFocusEvent: "synFocusEvent", synInputEvent: "synInputEvent", synInvalidEvent: "synInvalidEvent", synMoveEvent: "synMoveEvent", valueChange: "valueChange" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynRangeComponent, decorators: [{ type: Component, args: [{ selector: 'syn-range', standalone: true, template: '<ng-content></ng-content>', }] }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { ngModelUpdateOn: [{ type: Input }], name: [{ type: Input }], label: [{ type: Input }], helpText: [{ type: Input }], disabled: [{ type: Input }], min: [{ type: Input }], max: [{ type: Input }], step: [{ type: Input }], size: [{ type: Input }], tooltipPlacement: [{ type: Input }], value: [{ type: Input }], restrictMovement: [{ type: Input }], form: [{ type: Input }], tooltipFormatter: [{ type: Input }], synBlurEvent: [{ type: Output }], synChangeEvent: [{ type: Output }], synFocusEvent: [{ type: Output }], synInputEvent: [{ type: Output }], synInvalidEvent: [{ type: Output }], synMoveEvent: [{ type: Output }], valueChange: [{ type: Output }] } }); /** * Generated bundle index. Do not edit. */ export { SynRangeComponent }; //# sourceMappingURL=synergy-design-system-angular-components-range.mjs.map