/**
 * Copyright (c) OpenLens Maintainers. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */
import type { InputProps } from "./input";
import type { SetRequired } from "type-fest";
import type { StrictReactNode } from "@openlens/utilities";
export type InputValidationResult<IsAsync extends boolean> = IsAsync extends true ? Promise<void> : boolean;
export type InputValidation<IsAsync extends boolean> = (value: string, props?: InputProps) => InputValidationResult<IsAsync>;
export type SyncValidationMessage = StrictReactNode | ((value: string, props?: InputProps) => StrictReactNode);
/**
 * @deprecated This type is not as type safe as it is possible to specify an async input validator without specifying a `debounce` time.
 *
 * Use {@link asyncInputValidator} or {@link inputValidator} instead to create validators
 */
export interface LegacyInputValidator {
    /**
     * Filters itself based on the input props
     */
    condition?: (props: InputProps) => any;
    validate: InputValidation<boolean>;
    message?: SyncValidationMessage;
    debounce?: number;
}
export interface AsyncInputValidator {
    /**
     * Filters itself based on the input props
     */
    condition?: (props: InputProps) => any;
    validate: InputValidation<true>;
    message?: SyncValidationMessage;
    debounce: number;
}
export interface SyncInputValidator {
    /**
     * Filters itself based on the input props
     */
    condition?: (props: InputProps) => any;
    validate: InputValidation<false>;
    message: SyncValidationMessage;
    debounce?: undefined;
}
export type InputValidator<IsAsync extends boolean = boolean> = SyncInputValidator | AsyncInputValidator | (IsAsync extends boolean ? LegacyInputValidator : never);
export declare function isAsyncValidator(validator: InputValidator): validator is AsyncInputValidator;
/**
 * A helper function to create an {@link AsyncInputValidator}
 */
export declare function asyncInputValidator(validator: AsyncInputValidator): AsyncInputValidator;
/**
 * A helper function to create an {@link SyncInputValidator}
 */
export declare function inputValidator(validator: SyncInputValidator): SyncInputValidator;
/**
 * Create a new input validator from a list of syncronous input validators. Will match as valid if
 * one of the input validators matches the input
 */
export declare function unionInputValidators(baseValidator: Pick<SyncInputValidator, "condition" | "message">, ...validators: SyncInputValidator[]): SyncInputValidator;
/**
 * Create a new input validator from a list of syncronous or async input validators. Will match as
 * valid if one of the input validators matches the input
 */
export declare function unionInputValidatorsAsync(baseValidator: SetRequired<Pick<InputValidator, "condition" | "message">, "message">, ...validators: InputValidator[]): AsyncInputValidator;
export declare const isRequired: SyncInputValidator;
export declare const isEmail: SyncInputValidator;
export declare const isNumber: SyncInputValidator;
export declare const isUrl: SyncInputValidator;
/**
 * NOTE: this cast is needed because of two bugs in the typed regex package
 * - https://github.com/phenax/typed-regex/issues/6
 * - https://github.com/phenax/typed-regex/issues/7
 */
export declare const isExtensionNameInstallRegex: {
    isMatch(val: string): boolean;
    captures(val: string): undefined | {
        name: string;
        version?: string;
    };
};
export declare const isExtensionNameInstall: SyncInputValidator;
export declare const isPath: AsyncInputValidator;
export declare const minLength: SyncInputValidator;
export declare const maxLength: SyncInputValidator;
export declare const systemName: SyncInputValidator;
export declare const accountId: SyncInputValidator;
export declare const conditionalValidators: SyncInputValidator[];
