analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
60 lines (57 loc) • 2.54 kB
TypeScript
import * as react from 'react';
import { ReactNode, ButtonHTMLAttributes, HTMLAttributes } from 'react';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { StoreApi } from 'zustand';
interface SelectStore {
open: boolean;
setOpen: (open: boolean) => void;
value: string;
setValue: (value: string) => void;
selectedLabel: ReactNode;
setSelectedLabel: (label: ReactNode) => void;
onValueChange?: (value: string) => void;
}
type SelectStoreApi = StoreApi<SelectStore>;
declare function createSelectStore(onValueChange?: (value: string) => void): SelectStoreApi;
declare const useSelectStore: (externalStore?: SelectStoreApi) => SelectStoreApi;
declare function getLabelAsNode(children: ReactNode): ReactNode;
interface SelectProps {
className?: string;
children: ReactNode;
defaultValue?: string;
value?: string;
onValueChange?: (value: string) => void;
size?: 'small' | 'medium' | 'large' | 'extra-large';
label?: string;
helperText?: string;
errorMessage?: string;
id?: string;
}
declare const Select: ({ children, defaultValue, className, value: propValue, onValueChange, size, label, helperText, errorMessage, id, }: SelectProps) => react_jsx_runtime.JSX.Element;
declare const SelectValue: ({ placeholder, store: externalStore, }: {
placeholder?: string;
store?: SelectStoreApi;
}) => react_jsx_runtime.JSX.Element;
interface SelectTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
className?: string;
invalid?: boolean;
variant?: 'outlined' | 'underlined' | 'rounded';
store?: SelectStoreApi;
size?: 'small' | 'medium' | 'large' | 'extra-large';
selectId?: string;
}
declare const SelectTrigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
interface SelectContentProps extends HTMLAttributes<HTMLDivElement> {
className?: string;
align?: 'start' | 'center' | 'end';
side?: 'top' | 'right' | 'bottom' | 'left';
store?: SelectStoreApi;
}
declare const SelectContent: react.ForwardRefExoticComponent<SelectContentProps & react.RefAttributes<HTMLDivElement>>;
interface SelectItemProps extends HTMLAttributes<HTMLDivElement> {
value: string;
disabled?: boolean;
store?: SelectStoreApi;
}
declare const SelectItem: react.ForwardRefExoticComponent<SelectItemProps & react.RefAttributes<HTMLDivElement>>;
export { SelectContent, SelectItem, SelectTrigger, SelectValue, createSelectStore, Select as default, getLabelAsNode, useSelectStore };