juvo-rafa-library
Version:
A comprehensive Angular component library featuring real-world components and validators extracted from the Juvo Rafa backoffice application. Now with improved select components and bug fixes.
157 lines (156 loc) • 5.34 kB
TypeScript
import { EventEmitter } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import * as i0 from "@angular/core";
/**
* Input types supported by JuvoInputComponent
* @type InputType
* @since 2.1.0
*/
export type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'textarea' | 'select';
/**
* Input sizes
* @type InputSize
* @since 2.1.0
*/
export type InputSize = 'small' | 'medium' | 'large';
/**
* Select option interface
* @interface SelectOption
* @since 2.1.0
*/
export interface SelectOption {
label: string;
value: any;
disabled?: boolean;
}
/**
* Input Component
*
* @description
* A comprehensive input component supporting various input types and form integration.
* Includes support for text, email, password, number, textarea, and select inputs.
* Originally designed for backoffice applications with extensive form requirements.
*
* @example
* ```html
* <!-- Basic text input -->
* <juvo-input
* label="Full Name"
* placeholder="Enter your full name"
* [(ngModel)]="name">
* </juvo-input>
*
* <!-- Email input with validation -->
* <juvo-input
* type="email"
* label="Email Address"
* placeholder="user@example.com"
* [required]="true"
* [error]="emailError"
* [(ngModel)]="email">
* </juvo-input>
*
* <!-- Select dropdown -->
* <juvo-input
* type="select"
* label="Country"
* [options]="countryOptions"
* [(ngModel)]="selectedCountry">
* </juvo-input>
*
* <!-- Textarea -->
* <juvo-input
* type="textarea"
* label="Description"
* [rows]="4"
* placeholder="Enter description..."
* [(ngModel)]="description">
* </juvo-input>
* ```
*
* @selector juvo-input
* @since 2.1.0
* @author Juvo Rafa Team
*/
export declare class JuvoInputComponent implements ControlValueAccessor {
/** Input label */
label?: string;
/** Input placeholder text */
placeholder: string;
/** Input type @default "text" */
type: InputType;
/** Input size @default "medium" */
size: InputSize;
/** Whether input is disabled @default false */
disabled: boolean;
/** Whether input is readonly @default false */
readonly: boolean;
/** Whether input is required @default false */
required: boolean;
/** Error message to display */
error?: string;
/** Hint text to display */
hint?: string;
/** Maximum length for text inputs */
maxLength?: number;
/** Minimum value for number inputs */
min?: number;
/** Maximum value for number inputs */
max?: number;
/** Step value for number inputs */
step?: number;
/** Number of rows for textarea @default 3 */
rows: number;
/** Options for select input */
options: SelectOption[];
/** Prefix text or icon */
prefix?: string;
/** Suffix text or icon */
suffix?: string;
/** Whether to show character counter @default false */
showCounter: boolean;
/** Emitted when value changes */
valueChange: EventEmitter<any>;
/** Emitted when input receives focus */
onFocus: EventEmitter<void>;
/** Emitted when input loses focus */
onBlur: EventEmitter<void>;
private _value;
private _onChange;
private _onTouched;
get value(): any;
set value(val: any);
/**
* Gets CSS classes for the input container
* @returns Combined CSS classes
*/
get containerClasses(): string;
/**
* Gets CSS classes for the input element
* @returns Combined CSS classes
*/
get inputClasses(): string;
/**
* Handles input value changes
*/
onInput(event: Event): void;
/**
* Handles input focus
*/
handleFocus(): void;
/**
* Handles input blur
*/
handleBlur(): void;
/**
* Gets the character count for display
* @returns Current character count
*/
get characterCount(): number;
writeValue(value: any): void;
registerOnChange(fn: (value: any) => void): void;
registerOnTouched(fn: () => void): void;
setDisabledState(isDisabled: boolean): void;
static ɵfac: i0.ɵɵFactoryDeclaration<JuvoInputComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<JuvoInputComponent, "juvo-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "type": { "alias": "type"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "required": { "alias": "required"; "required": false; }; "error": { "alias": "error"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "step": { "alias": "step"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "options": { "alias": "options"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "suffix": { "alias": "suffix"; "required": false; }; "showCounter": { "alias": "showCounter"; "required": false; }; }, { "valueChange": "valueChange"; "onFocus": "onFocus"; "onBlur": "onBlur"; }, never, never, true, never>;
}