UNPKG

@hhgtech/hhg-components

Version:
41 lines (40 loc) 1.42 kB
import { FieldPath, FieldValues, RegisterOptions } from 'react-hook-form'; import { ButtonProps } from "../../../mantine"; import { HealthToolFormWrapperProps } from "../healthTools/formWrapper"; export type BmiObjective = 'lose-weight' | 'maintain-weight' | 'gain-weight'; export type BmiFormValue = { gender?: 'male' | 'female'; age?: number; weight?: number; height?: number; objective?: BmiObjective; bmi?: number; }; export type BmiFormValueKeys = keyof BmiFormValue; export type Rule = Omit<RegisterOptions<FieldValues, FieldPath<FieldValues>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>; export type BMIUnit = { minAge: number; maxAge: number; minHeight: number; maxHeight: number; minWeight: number; maxWeight: number; heightConvert: (val: number) => number; weightConvert: (val: number) => number; }; export type BmiFormProps = { value?: BmiFormValue; onChange?: (value: BmiFormValue) => void; onSubmit?: (value: BmiFormValue) => void; className?: string; bmiGenerated: Record<keyof BmiFormValue, { label: string; rule?: Rule | undefined; }>; bmiUnit: BMIUnit; submitProps?: ButtonProps; } & HealthToolFormWrapperProps; export declare function getBmi({ weight: weightProps, height: heightProps, }: { weight: number; height: number; }): number;