import { CortexFormControl, default as CortexElement } from '../../../../base/src/cortex-element.ts';
import { ButtonVariant } from '../../../../types/src/button';
import { CSSResultGroup } from 'lit';
import { default as CxIcon } from '../icon/icon';

/**
 * @summary Inputs collect data from the user.
 *
 * @slot label - The input’s label. Alternatively, you can use the `label` attribute.
 * @slot prefix - Used to prepend a presentational icon or similar element to the input.
 * @slot suffix - Used to append a presentational icon or similar element to the input.
 * @slot clear-icon - An icon to use in lieu of the default clear icon.
 * @slot show-password-icon - An icon to use in lieu of the default show password icon.
 * @slot hide-password-icon - An icon to use in lieu of the default hide password icon.
 * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.
 * @slot file-button - The button that opens the file picker. Alternatively, you can use the `file-button-label` attribute.
 *
 * @event cx-blur - Emitted when the control loses focus.
 * @event cx-change - Emitted when an alteration to the control's value is committed by the user.
 * @event cx-clear - Emitted when the clear button is activated.
 * @event cx-focus - Emitted when the control gains focus.
 * @event cx-input - Emitted when the control receives input.
 * @event cx-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
 * @event cx-keydown - Emitted when a key is pressed down on the control.
 *
 * @csspart form-control - The form control that wraps the label, input, and help text.
 * @csspart form-control-label - The label’s wrapper.
 * @csspart form-control-input - The input’s wrapper.
 * @csspart form-control-help-text - The help text’s wrapper.
 * @csspart base - The component’s base wrapper.
 * @csspart input - The internal `<input>` control.
 * @csspart prefix - The container that wraps the prefix.
 * @csspart clear-button - The clear button.
 * @csspart password-toggle-button - The password toggle button.
 * @csspart suffix - The container that wraps the suffix.
 * @csspart character-count - The character count display (shown when canShowLength is true).
 * @csspart file-control - The container that wraps the file input.
 * @csspart file-button - The 'Choose file' button.
 * @csspart file-result - The text that displays the selected file name.
 * @csspart character-count-text - The text that displays the character count.
 * @cssproperty [--cx-input-auto-grow-min-width=0] - The minimum width used when `auto-grow` is enabled.
 */
export default class CxInput extends CortexElement implements CortexFormControl {
    #private;
    static readonly styles: CSSResultGroup;
    static readonly dependencies: {
        'cx-icon': typeof CxIcon;
    };
    private readonly formControlController;
    private readonly hasSlotController;
    private readonly localize;
    private readonly autoGrowController;
    input: HTMLInputElement;
    autoGrowMirror: HTMLSpanElement;
    inputContainer: HTMLElement;
    labelElement: HTMLElement;
    private hasFocus;
    private maskInstance;
    private containerClicked;
    title: string;
    private readonly __numberInput;
    private readonly __dateInput;
    /**
     * The type of input. Works the same as a native `<input>` element, but only a subset of types are supported. Defaults
     * to `text`.
     */
    type: 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'file' | 'url';
    /** The name of the input, submitted as a name/value pair with form data. */
    name: string;
    /** The current value of the input, submitted as a name/value pair with form data. */
    value: string;
    /**
     * When enabled, the input width grows and shrinks with its current value.
     * This only applies to non-file input types.
     */
    autoGrow: boolean;
    /** If used with mask, this stores the input's value, with fixed strings omitted. */
    unmaskedValue: string;
    /** The default value of the form control. Primarily used for resetting the form control. */
    defaultValue: string;
    /** The input's size. */
    size: 'small' | 'medium' | 'large';
    /** Draws a filled input. */
    filled: boolean;
    /** Draws a pill-style input with rounded edges. */
    pill: boolean;
    /** The input's label. If you need to display HTML, use the `label` slot instead. */
    label: string;
    /** The input's help text. If you need to display HTML, use the `help-text` slot instead. */
    helpText: string;
    /** Adds a clear button when the input is not empty. */
    clearable: boolean;
    /** Disables the input. */
    disabled: boolean;
    /** Placeholder text to show as a hint when the input is empty. */
    placeholder: string;
    /** Makes the input readonly. */
    readonly: boolean;
    /** Adds a button to toggle the password's visibility. Only applies to password types. */
    passwordToggle: boolean;
    /** Determines whether or not the password is currently visible. Only applies to password input types. */
    passwordVisible: boolean;
    /** Hides the browser's built-in increment/decrement spin buttons for number inputs. */
    noSpinButtons: boolean;
    /**
     * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
     * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in
     * the same document or shadow root for this to work.
     */
    form: string | HTMLElement | undefined;
    /** Makes the input a required field. */
    required: boolean;
    /** A regular expression pattern to validate input against. */
    pattern: string;
    /** The minimum length of input that will be considered valid. */
    minlength: number;
    /** The maximum length of input that will be considered valid. */
    maxlength: number;
    /** Show total characters in the input. */
    showLength: boolean;
    /** The input's minimum value. Only applies to date and number input types. */
    min: number | string;
    /** The input's maximum value. Only applies to date and number input types. */
    max: number | string;
    /**
     * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is
     * implied, allowing any numeric value. Only applies to date and number input types.
     */
    step: number | 'any';
    /** Controls whether and how text input is automatically capitalized as it is entered by the user. */
    autoCapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
    /** Indicates whether the browser's autocorrect feature is on or off. */
    autoCorrect: 'off' | 'on';
    /**
     * Specifies what permission the browser has to provide assistance in filling out form field values. Refer to
     * [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.
     */
    autocomplete: HTMLInputElement['autocomplete'];
    /** Indicates that the input should receive focus on page load. */
    autoFocus: boolean;
    /** Used to customize the label or icon of the Enter key on virtual keyboards. */
    enterKeyHint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
    /** Enables spell checking on the input. */
    spellCheck: boolean;
    /**
     * Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual
     * keyboard on supportive devices.
     */
    inputMode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
    /**
     * The mask pattern to apply to the input.
     */
    mask: string;
    /**
     * The character to use as a placeholder when the input is empty. Defaults to '_'.
     */
    maskPlaceholder: string;
    /**
     * Whether or not to lazy mask the input. When `true`, the mask will only be applied after the user starts typing.
     */
    maskLazy: boolean;
    /**
     * Enables characters overwriting instead of inserting.
     */
    maskOverwrite: 'shift' | boolean;
    /**
     * A map of mask blocks to use with the input mask. This allows you to define custom blocks for the mask.
     */
    maskBlocks: Record<string, any> | undefined;
    /**
     * The `accept` attribute of the file input. This attribute contains a comma-separated list of unique file type
     * For example, `accept="image/png, image/jpeg"`.
     */
    accept: string;
    /**
     * The `multiple` attribute of the file input. This attribute indicates that the user can enter more than one value.
     */
    multiple: boolean;
    /**
     *   The variant of the "Choose File" button.
     */
    variant: ButtonVariant;
    /**
     * Label of file button
     */
    fileButtonLabel: string;
    /**
     * Only button mode
     */
    buttonOnly: boolean;
    /**
     * The label for the file name. This attribute can be either a string or a function that takes a "FileList" or "null" as an argument and returns a string.
     */
    fileResultLabel: (files: FileList | null) => string;
    /**
     * Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use the native `<input type="{{type}}">` implementation and may result in an error.
     */
    get valueAsDate(): Date | null;
    set valueAsDate(newValue: Date | null);
    /** Gets or sets the current value as a number. Returns `NaN` if the value can't be converted. */
    get valueAsNumber(): number;
    set valueAsNumber(newValue: number);
    /** Gets the validity state object */
    get validity(): ValidityState;
    /** Gets the validation message */
    get validationMessage(): string;
    constructor();
    connectedUpdatedCallback(): void;
    disconnectedCallback(): void;
    initMaskInstance(): Promise<void>;
    private handleBlur;
    private handleChange;
    private handleClearClick;
    private handleFocus;
    private handleMaskAccept;
    private handleInput;
    private handleInvalid;
    private handleKeyDown;
    private handlePasswordToggle;
    private handleFileButtonClick;
    private handleContainerMouseDown;
    handleDisabledChange(): void;
    handleStepChange(): void;
    handleValueChange(): Promise<void>;
    handleAutoGrowChange(): Promise<void>;
    /** Sets focus on the input. */
    focus(options?: FocusOptions): void;
    /** Removes focus from the input. */
    blur(): void;
    /** Selects all the text in the input. */
    select(): void;
    /** Sets the start and end positions of the text selection (0-based). */
    setSelectionRange(selectionStart: number, selectionEnd: number, selectionDirection?: 'forward' | 'backward' | 'none'): void;
    /** Replaces a range of text with a new string. */
    setRangeText(replacement: string, start?: number, end?: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void;
    /** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
    showPicker(): void;
    /** Increments the value of a numeric input type by the value of the step attribute. */
    stepUp(): void;
    /** Decrements the value of a numeric input type by the value of the step attribute. */
    stepDown(): void;
    /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
    checkValidity(): boolean;
    /** Gets the associated form, if one exists. */
    getForm(): HTMLFormElement | null;
    /** Checks for validity and shows the browser's validation message if the control is invalid. */
    reportValidity(): boolean;
    /** Sets a custom validation message. Pass an empty string to restore validity. */
    setCustomValidity(message: string): void;
    render(): import('lit').TemplateResult<1>;
}
declare global {
    interface HTMLElementTagNameMap {
        'cx-input': CxInput;
    }
}
