UNPKG

carbon-components-angular

Version:
195 lines (191 loc) 6.2 kB
/** * * carbon-angular v0.0.0 | number.component.d.ts * * Copyright 2014, 2024 IBM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EventEmitter, TemplateRef } from "@angular/core"; import { ControlValueAccessor } from "@angular/forms"; import { I18n, Overridable } from "carbon-components-angular/i18n"; import { Observable } from "rxjs"; import * as i0 from "@angular/core"; /** * Used to emit changes performed on number input components. */ export declare class NumberChange { /** * Contains the `Number` that has been changed. */ source: NumberComponent; /** * The value of the `Number` field encompassed in the `NumberChange` class. */ value: number; } /** * Get started with importing the module: * * ```typescript * import { NumberModule } from 'carbon-components-angular'; * ``` * * [See demo](../../?path=/story/components-number--basic) */ export declare class NumberComponent implements ControlValueAccessor { protected i18n: I18n; /** * Variable used for creating unique ids for number input components. */ static numberCount: number; containerClass: boolean; /** * @deprecated since v5 - Use `cdsLayer` directive instead * `light` or `dark` number input theme. */ theme: "light" | "dark"; /** * Set to `true` for a disabled number input. */ disabled: boolean; /** * Set to `true` for a loading number component. */ skeleton: boolean; /** * Set to `true` for an invalid number component. */ invalid: boolean; /** * The unique id for the number component. */ id: string; /** * Sets the placeholder attribute on the `input` element. */ placeholder: string; /** * Number input field render size */ size: "sm" | "md" | "lg"; /** * Reflects the required attribute of the `input` element. */ required: boolean; /** * Sets the value attribute on the `input` element. */ set value(v: any); get value(): any; /** * Sets the min attribute on the `input` element. */ min: any; /** * Sets the max attribute on the `input` element. */ max: any; /** * Sets the text inside the `label` tag. */ label: string | TemplateRef<any>; /** * Sets the optional helper text. */ helperText: string | TemplateRef<any>; /** * Sets the invalid text. */ invalidText: string | TemplateRef<any>; /** * Sets the amount the number controls increment and decrement by. */ step: number; /** * If `step` is a decimal, we may want precision to be set to go around floating point precision. */ precision: number; /** * Set to `true` to show a warning (contents set by warningText) */ warn: boolean; /** * Sets the warning text */ warnText: string | TemplateRef<any>; /** * Sets the arialabel for input */ ariaLabel: string; /** * Emits event notifying other classes when a change in state occurs in the input. */ change: EventEmitter<NumberChange>; set decrementLabel(value: string | Observable<string>); get decrementLabel(): string | Observable<string>; set incrementLabel(value: string | Observable<string>); get incrementLabel(): string | Observable<string>; protected _value: number; protected _decrementLabel: Overridable; protected _incrementLabel: Overridable; /** * Creates an instance of `Number`. */ constructor(i18n: I18n); /** * This is the initial value set to the component * @param value The input value. */ writeValue(value: any): void; /** * Sets a method in order to propagate changes back to the form. */ registerOnChange(fn: any): void; /** * Registers a callback to be triggered when the control has been touched. * @param fn Callback to be triggered when the number input is touched. */ registerOnTouched(fn: any): void; focusOut(): void; /** * Sets the disabled state through the model */ setDisabledState(isDisabled: boolean): void; /** * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`. */ onTouched: () => any; /** * Method set in `registerOnChange` to propagate changes back to the form. */ propagateChange: (_: any) => void; /** * Adds `step` to the current `value`. */ onIncrement(): void; /** * Subtracts `step` to the current `value`. */ onDecrement(): void; getDecrementLabel(): Observable<string>; getIncrementLabel(): Observable<string>; /** * Creates a class of `NumberChange` to emit the change in the `Number`. */ emitChangeEvent(): void; onNumberInputChange(event: any): void; isTemplate(value: any): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<NumberComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NumberComponent, "cds-number, ibm-number", never, { "theme": "theme"; "disabled": "disabled"; "skeleton": "skeleton"; "invalid": "invalid"; "id": "id"; "placeholder": "placeholder"; "size": "size"; "required": "required"; "value": "value"; "min": "min"; "max": "max"; "label": "label"; "helperText": "helperText"; "invalidText": "invalidText"; "step": "step"; "precision": "precision"; "warn": "warn"; "warnText": "warnText"; "ariaLabel": "ariaLabel"; "decrementLabel": "decrementLabel"; "incrementLabel": "incrementLabel"; }, { "change": "change"; }, never, never, false>; } export { NumberComponent as Number };