blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
82 lines (81 loc) • 2.1 kB
TypeScript
import BlazeElement from "./element";
import "./styles/input.css";
export default class BlazeInput extends BlazeElement<HTMLDivElement> {
private name;
private placeholder;
private size;
private value;
private input;
private label;
/**
* Callback that is fired whenever the input's value changes.
*/
onInput: (value: string) => void;
/**
* Create a {@link BlazeInput}.
*
* @param name The input's `name` attribute
* @param placeholder The input's placeholder
* @param size The input's font size in `rem` units
*/
constructor(name: string, placeholder: string, size: number);
/**
* Sets the input's value.
*
* @param value The input's new value
*/
setValue(value: string): void;
/**
* Gets the input's current value.
*
* @returns The input's current value
*/
getValue(): string;
/**
* Sets the input's name.
*
* @param name The input's new `name` attribute
*/
setName(name: string): void;
/**
* Gets the input's `name` attribute.
*
* @returns The input's `name` attribute
*/
getName(): string;
/**
* Sets the input's placeholder.
*
* @param name The input's new `placeholder` attribute
*/
setPlaceholder(placeholder: string): void;
/**
* Gets the input's `placeholder` attribute.
*
* @returns The input's `placeholder` attribute
*/
getPlaceholder(): string;
/**
* Sets the input's font size.
*
* @param size The input's font size in `rem` units
*/
setSize(size: number): void;
/**
* Gets the input's font size.
*
* @returns The input's font size in `rem` units
*/
getSize(): number;
/**
* Add a label above or to the side of the input.
*
* @param label The label's text
* @param aside Wether the label is above or to the side of the input
*/
addLabel(label: string, aside?: boolean): void;
/**
* Remove the input's label.
*/
removeLabel(): void;
}