import { Container, DestroyOptions, Graphics, NineSliceSprite, Optional, Size, Sprite, Texture } from 'pixi.js';
import { Signal } from 'typed-signals';
import { PixiText, PixiTextClass, PixiTextStyle } from './utils/helpers/text';
import { ALIGN, type Padding } from './utils/HelpTypes';
type ViewType = Sprite | Graphics | Texture | string;
export type InputAlign = typeof ALIGN[number];
export type InputOptions = {
bg: ViewType;
textStyle?: PixiTextStyle;
TextClass?: PixiTextClass;
placeholder?: string;
value?: string;
maxLength?: number;
secure?: boolean;
align?: InputAlign;
padding?: Padding;
cleanOnFocus?: boolean;
nineSliceSprite?: [number, number, number, number];
addMask?: boolean;
};
/**
* Container-based component that creates an input to read the user's text.
* @example
* new Input({
* bg: Sprite.from('input.png'),
* placeholder: 'Enter text',
* padding: {
* top: 11,
* right: 11,
* bottom: 11,
* left: 11
* } // alternatively you can use [11, 11, 11, 11] or [11, 11] or just 11
* });
*/
export declare class Input extends Container {
protected _bg?: Container | NineSliceSprite | Graphics;
protected inputMask: Container | NineSliceSprite | Graphics | undefined;
protected _cursor: Sprite | undefined;
protected _value: string;
protected _secure: boolean;
protected inputField: PixiText | undefined;
protected placeholder: PixiText | undefined;
protected editing: boolean;
protected tick: number;
protected lastInputData: string;
protected activation: boolean;
protected readonly options: InputOptions;
protected input: HTMLInputElement | undefined;
protected handleActivationBinding: () => void;
protected onKeyUpBinding: (e: KeyboardEvent) => void;
protected stopEditingBinding: () => void;
protected onInputBinding: (e: InputEvent) => void;
protected onPasteBinding: (e: ClipboardEvent) => void;
/** Fires when input loses focus. */
onEnter: Signal<(text: string) => void>;
/** Fires every time input string is changed. */
onChange: Signal<(text: string) => void>;
/** Top side padding */
paddingTop: number;
/** Right side padding */
paddingRight: number;
/** Bottom side padding */
paddingBottom: number;
/** Left side padding */
paddingLeft: number;
/**
* Creates an input.
* @param { number } options - Options object to use.
* @param { Sprite | Graphics | Texture | string } options.bg - Background of the Input.
*
Can be a string (name of texture) or an instance of Texture, Sprite or Graphics.
*
If you want to use NineSliceSprite, you have to pass a text (name of texture)
* or an instance of Texture as a parameter.
* @param { PixiTextStyle } options.textStyle - Text style of the Input.
* @param { string } options.placeholder - Placeholder of the Input.
* @param { string } options.value - Value of the Input.
* @param { number } options.maxLength - Max length of the Input.
* @param { 'left' | 'center' | 'right' } options.align - Align of the Input.
* @param { Padding } options.padding - Padding of the Input.
* @param { number } options.padding.top - Top padding of the Input.
* @param { number } options.padding.right - Right padding of the Input.
* @param { number } options.padding.bottom - Bottom padding of the Input.
* @param { number } options.padding.left - Left padding of the Input.
* @param { boolean } options.cleanOnFocus - Clean Input on focus.
* @param { boolean } options.addMask - Add mask to the Input text, so it is cut off when it does not fit.
* @param { Array } options.nineSliceSprite - NineSliceSprite values for bg and fill ([number, number, number, number]).
*
!!! IMPORTANT: To make it work, you have to pass a texture name or texture instance as a bg parameter.
*/
constructor(options: InputOptions);
protected onInput(e: InputEvent): void;
protected onKeyUp(e: KeyboardEvent): void;
protected init(): void;
set bg(bg: ViewType);
get bg(): Container | NineSliceSprite | Graphics | undefined;
protected _add(key: string): void;
protected _delete(): void;
protected _startEditing(): void;
protected createInputField(): void;
protected handleActivation(): void;
protected stopEditing(): void;
protected update(dt: number): void;
protected align(): void;
protected getAlign(): 0 | 1 | 0.5;
protected getCursorPosX(): number;
/** Sets the input text. */
set value(text: string);
/** Return text of the input. */
get value(): string;
set secure(val: boolean);
get secure(): boolean;
/**
* Set paddings
* @param value - number, array of 4 numbers or object with keys: top, right, bottom, left
* or: [top, right, bottom, left]
* or: [top&bottom, right&left]
* or: {
* left: 10,
* right: 10,
* top: 10,
* bottom: 10,
* }
*/
set padding(value: Padding);
get padding(): [number, number, number, number];
destroy(options?: DestroyOptions | boolean): void;
/**
* Sets width of a Input.
* If nineSliceSprite is set, then width will be set to nineSliceSprite.
* If nineSliceSprite is not set, then width will control components width as Container.
* @param width - Width value.
*/
set width(width: number);
/** Gets width of Input. */
get width(): number;
/**
* Sets height of a Input.
* If nineSliceSprite is set, then height will be set to nineSliceSprite.
* If nineSliceSprite is not set, then height will control components height as Container.
* @param height - Height value.
*/
set height(height: number);
/** Gets height of Input. */
get height(): number;
setSize(value: number | Optional, height?: number): void;
protected createInputMask(bg: ViewType): void;
protected updateInputMaskSize(): void;
protected onPaste(e: ClipboardEvent): void;
}
export {};
//# sourceMappingURL=Input.d.ts.map