import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
import { ObservableMap } from '@stencil/store';
import type { NanoFormEvent, PlainFormEvent, ValidationState, ValidatorValueStore } from './field-validator-interface';
/**
 * A toolbox to expose a form's data model and validation state
 *
 * @version 3.0.0
 * @status stable
 */
export declare class FieldValidator implements ComponentInterface {
    host: HTMLNanoFieldValidatorElement;
    submitted: boolean;
    userForm: HTMLFormElement;
    userFormChange(): void;
    private get activeForm();
    private set activeForm(value);
    private _activeForm;
    private mo;
    private allFields;
    private nanoFields;
    private plainFields;
    private nanoFieldSelector;
    private hasSetStore;
    private internalValidate;
    /** When should the fields perform validation. Will override / sync all nested `nano-...` controls */
    validateOn?: 'dirty' | 'submit' | 'submitThenDirty';
    /** Sync up validateOn with all fields */
    validateOnChange(): void;
    /** Tries to scroll to the first invalid field on submit */
    scrollToInvalid: boolean;
    /** Returns true if any nested fields have been changed @readonly */
    get dirty(): boolean;
    _dirty: boolean;
    /** Returns true if all the nested fields are currently valid @readonly */
    get valid(): boolean;
    _valid: boolean;
    /** The current form state as a stencil store. */
    get store(): ObservableMap<ValidatorValueStore>;
    _store: ObservableMap<ValidatorValueStore>;
    /** The current form payload as a reactive proxy. @readonly */
    get payload(): ValidatorValueStore;
    /** Returns true if validation errors will be displayed to the user. @readonly */
    get showValidation(): boolean;
    /** Get the current validation state of all form fields. @readonly
     * ```
     {
        fields: NanoFormEles[];
        valid: boolean;
        validityMessage: string;
        dirty: boolean;
        name: string | number;
        value: any;
      }[]
    ```
     */
    get validationState(): ValidationState[];
    /** By default, `nano-field-validator` will also track all native form field elements.
     * You can add extra web-component form fields to listen to
     * (as long as they match the standard form field spec) by using the `fieldSelector` prop.
     */
    extraFieldSelector: string;
    /** A validation callback method.
     * @param field - The field name currently being evaluated
     * @param value - The value of the field currently being evaluated
     * @param fields - an array of all currently observered form fields and values
     * @returns field names mapped to an object of status message and validity e.g.
     * ```js
     * {field1: {msg: `This is invalid!`}, field2: {msg: `This is valid!`, valid: true}}
     * ```
     */
    validation: (field: string, value: string, fields: ValidatorValueStore) => {
        [errorMsg: string]: {
            fields?: string[];
            valid?: boolean;
        };
    };
    /**
     * Sets the state of the form using an object of key / value pairs.
     * @param state - the state to load in the store
     */
    setStore(state: ValidatorValueStore): Promise<void>;
    /**
     * Sets custom validity for all / some form fields.
     * @param validity - a validity object of `{fieldName: errorString}` pairs.
     * Set as an empty string to clear the error.
     * @param scrollToInvalid - whether to scroll to the first invalid field.
     * If not present, will follow the value set on `scrollToInvalid` prop.
     * @returns a promise, resolved when all errors are set
     */
    setCustomValidity(validity: {
        [key: string]: string;
    }, scrollToInvalid?: boolean): Promise<void[]>;
    /**
     * Clear all custom validation.
     * @returns a promise, resolved when all errors are cleared
     */
    resetValidity(): Promise<void[]>;
    /**
     * Scrolls to first invalid form field.
     * @param force - forces the scroll behaviour (default). Otherwise will use the default set in `scrollToInvalid` prop
     */
    scrollToFirstInvalid(force?: boolean): Promise<void>;
    /** Fired whenever the payload changes */
    nanoPayloadChange: EventEmitter<ValidatorValueStore>;
    /**
     * Fired on valid form submission.
     * Note: if you wish to prevent a form from submitting, instead
     * of using / preventing the native `submit` event, use this event
     * ```js
     * ele.addEventListener('nanoSubmit', (e) => {
     *   e.preventDefault()
     * })
     * ```
     */
    nanoSubmit: EventEmitter;
    /** Fire on invalid form submission attempt */
    nanoInvalid: EventEmitter;
    attachSlotObserver(): void;
    /**
     * During spec tests, mockelement props aren't set - only attributes.
     * This irons out that kink
     * @param field
     * @returns the fields name prop or attr
     */
    private getName;
    /** Checks for new `nano-...` fields and adds them to our watch array and value store */
    private setupFields;
    private storeToFields;
    private getValidityTarget;
    /** Loops through all `nano-...` fields and extracts their values into our store */
    private fieldsToStore;
    /**
     * Tries to ascertain whether the current model
     * value is the same as the `nano-file-upload` value
     * @param fieldName - the key to access from the data store
     * @param field - the nano-file-upload field to assess against
     * @returns true for equal, false for not equal
     */
    private fileStateEqual;
    /**
     * Checks for user defined validations
     * @param key - current key of the data model to validate
     * @param newVal - the newly set, incoming value to validate
     */
    private validate;
    /** Loops through all store entries and checks custom validation */
    private validateAllFields;
    /**
     * Utility to smooth out setting error messages
     * (it's a different method on `nano-checkbox` 'cos they don't show errors themselves)
     * @param field
     * @param msg
     */
    private setFieldError;
    private submitForm;
    /**
     * Fired whenever store values change and potentially checks validity
     * @param key - the key of the store that's just changed
     * @param newVal - the incoming, new value
     */
    private handleStoreChange;
    /**
     * Handles nano field value changes and passes to store
     * @param ev - the incoming change event
     */
    handleFieldChange(ev: NanoFormEvent): void;
    /**
     * Handles non-nano field value changes and passes to store
     * @param ev - the incoming change event
     */
    handlePlainFieldChange(ev: PlainFormEvent): void;
    /**
     * Handles default field validation events
     * @param ev - the invalid event
     */
    private handleFormInvalid;
    /**
     * stops default form submission, checks if valid, then submits manually
     * @param e - a submit event from the nested form element
     */
    handleSubmit(e: Event): Promise<void>;
    connectedCallback(): void;
    componentDidLoad(): void;
    disconnectedCallback(): void;
    render(): any;
}
