import { LitElement } from "lit"; export type UnitInputUnit = { /** Stable id, reported in events. */ readonly id: string; /** Text shown in the unit picker. */ readonly label: string; /** How many base units one of this unit is (default 1). */ readonly factor?: number; }; /** Byte sizes: base unit is the byte. */ export declare const SIZE_UNITS: readonly UnitInputUnit[]; /** Durations: base unit is the minute. */ export declare const AGE_UNITS: readonly UnitInputUnit[]; export type UnitInputChangeDetail = { /** The number as typed, or `null` when empty or not a number. */ readonly value: number | null; /** Id of the selected unit. */ readonly unit: string; /** `value` times the unit's `factor`, or `null` when `value` is. */ readonly baseValue: number | null; }; export type UnitInputChangeEvent = CustomEvent; /** `value` expressed in base units. */ export declare function toBase(value: number | null, unit: UnitInputUnit | undefined): number | null; /** * The largest unit in `units` that `baseValue` is a whole number of (or the * smallest unit when none fits), with the value in that unit. */ export declare function bestUnit(baseValue: number, units: readonly UnitInputUnit[]): { value: number; unit: string; } | undefined; /** * One control for a number with a unit: a number field joined to a unit * picker, styled as a single input. * * @fires {UnitInputChangeEvent} change — when the number or the unit changes * * @example * ```ts * el.units = SIZE_UNITS; * el.unit = 'MB'; * el.addEventListener('change', e => console.log(e.detail.baseValue)); * ``` */ export declare class UnitInputElement extends LitElement { #private; /** The number, in the selected unit. `null` for empty. */ value: number | null; /** Id of the selected unit. Defaults to the first of `units`. */ unit: string; /** Units to choose from. */ units: readonly UnitInputUnit[]; min: number | undefined; max: number | undefined; step: number | undefined; placeholder: string; disabled: boolean; /** The value in base units (see `UnitInputUnit.factor`), or `null` when empty. */ get baseValue(): number | null; /** Set the control from a base-unit amount, choosing the largest unit it divides into evenly. */ setBaseValue(baseValue: number | null): void; focus(options?: FocusOptions): void; protected render(): import("lit").TemplateResult<1>; static styles: import("lit").CSSResult[]; } declare global { interface HTMLElementTagNameMap { 'ixfx-unit-input': UnitInputElement; } } export interface UnitInputElementEventMap { change: UnitInputChangeEvent; } export interface UnitInputElement { addEventListener: ((type: K, listener: (this: UnitInputElement, event: UnitInputElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); }