@oslokommune/punkt-react
Version:
React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo
38 lines (37 loc) • 1.41 kB
TypeScript
import { ChangeEvent, HTMLProps, ReactNode } from 'react';
import { IPktSearchInputSuggestion } from '../../shared-types/searchinput';
/**
* React suggestion item: portable fields from {@link IPktSearchInputSuggestion}
* plus optional rich content and per-row handler.
*/
export type PktSearchInputSuggestion = Omit<IPktSearchInputSuggestion, 'title' | 'text'> & {
title?: string | ReactNode;
text?: string | ReactNode;
onClick?: () => void;
};
interface ISearch extends HTMLProps<HTMLInputElement> {
appearance?: 'local' | 'local-with-button' | 'global';
inputSize?: 'small' | 'medium' | 'xsmall';
disabled?: boolean;
fullwidth?: boolean;
id: string;
label?: string;
name?: string;
placeholder?: string;
suggestions?: PktSearchInputSuggestion[];
value?: string | undefined;
onSearch?: (value: string) => void;
onSuggestionClick?: (index: number) => void;
action?: string;
method?: 'get' | 'post' | 'dialog';
}
interface ISearchForm extends ISearch {
action?: string;
method?: 'get' | 'post' | 'dialog';
}
interface ISearchInput extends ISearch {
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
disabled?: boolean;
}
export declare const PktSearchInput: import('react').ForwardRefExoticComponent<(Omit<ISearchForm, "ref"> | Omit<ISearchInput, "ref">) & import('react').RefAttributes<HTMLInputElement>>;
export {};