import React, { InputHTMLAttributes } from "react";
import type { AkselStatusColorRole } from "@navikt/ds-tokens/types";
import { AkselColor } from "../../types";
import { FormFieldProps } from "../useFormField";
import { SearchButtonType } from "./SearchButton";
export type SearchNativeProps = Omit, "size" | "onChange" | "type">;
export type SearchClearEvent = {
trigger: "Click";
event: React.MouseEvent;
} | {
trigger: "Escape";
event: React.KeyboardEvent;
};
export interface SearchProps extends Omit, SearchNativeProps {
children?: React.ReactNode;
/**
* Search label.
*
* Will be hidden by default and is required for WCAG compliance.
*/
label: React.ReactNode;
/**
* Shows label and description for screenreaders only.
* @default true
*/
hideLabel?: boolean;
/**
* Callback for value-change in input.
*/
onChange?: (value: string) => void;
/**
* Callback for click on clear-button or Escape keydown.
*/
onClear?: (e: SearchClearEvent) => void;
/**
* Callback for Search-button submit.
*/
onSearchClick?: (value: string) => void;
/**
* Sets the `aria-label` for the clear button.
* @default "Tøm feltet"
* @deprecated Use ``-component
*/
clearButtonLabel?: string;
/**
* Removes clear-button if `false`.
* @default true
*/
clearButton?: boolean;
/**
* Changes button-variant.
*
* - "primary": When this is the main function of the page.
* - "secondary": This is probably the one you want if in doubt.
* - "simple": Removes the search button.
* @default "primary"
*/
variant?: "primary" | "secondary" | "simple";
/**
* HTML size attribute. Specifies the width of the input, in characters.
*/
htmlSize?: number | string;
/**
* @private
*/
"data-color"?: Exclude;
}
interface SearchComponent extends React.ForwardRefExoticComponent> {
Button: SearchButtonType;
}
/**
* A component that displays a search input field.
*
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/search)
* @see 🏷️ {@link SearchProps}
*
* @example
* ```jsx
*
* ```
*/
export declare const Search: SearchComponent;
export default Search;