UNPKG

@prokodo/ui

Version:

UI components for production-grade Next.js + Headless CMS (Strapi, Contentful, Headless WordPress) websites by prokodo – built for Core Web Vitals & SEO.

28 lines (27 loc) 1.08 kB
import type { IconName } from "../icon"; import type { LabelProps } from "../label"; import type { ChangeEvent, HTMLAttributes, FocusEvent } from "react"; export type SwitchColor = "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning"; export type SwitchProps = Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & { name: string; label?: string; required?: boolean; variant?: SwitchColor; icon?: IconName; checkedIcon?: IconName; checked?: boolean; disabled?: boolean; errorText?: string; helperText?: string; onChange?: (event: ChangeEvent<HTMLInputElement>, checked: boolean) => void; className?: string; labelProps?: Omit<LabelProps, "label" | "htmlFor" | "required">; hideLabel?: boolean; }; export interface SwitchViewProps extends SwitchProps { isChecked: boolean; isFocused: boolean; onChangeInternal: (e: ChangeEvent<HTMLInputElement>) => void; onFocusInternal: (e: FocusEvent<HTMLInputElement>) => void; onBlurInternal: (e: FocusEvent<HTMLInputElement>) => void; }