UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

59 lines (58 loc) 2.15 kB
import { HTMLProps, PropGetter } from "../../core/components/index.types.js"; import "../../core/index.js"; import * as react2611 from "react"; import { RefObject } from "react"; //#region src/components/toggle/use-toggle-group.d.ts interface ToggleGroupContext { onChangeMapRef: RefObject<Map<string, (value: boolean) => void>>; disabled?: boolean; readOnly?: boolean; value?: string | string[]; onChange?: <Y extends string = string>(value: undefined | Y) => void; } declare const ToggleGroupContext: react2611.Context<ToggleGroupContext | undefined>, useToggleGroupContext: () => ToggleGroupContext | undefined; interface UseToggleGroupProps<Y extends string | string[] = string> extends Omit<HTMLProps, "defaultValue" | "onChange" | "value"> { /** * The initial value of the toggle button group. */ defaultValue?: Y extends any[] ? Y : undefined | Y; /** * If `true`, all wrapped toggle button will be disabled. * * @default false */ disabled?: boolean; /** * If `true`, all wrapped toggle button will be readonly. * * @default false */ readOnly?: boolean; /** * The value of the toggle button group. */ value?: Y extends any[] ? Y : undefined | Y; /** * The callback fired when any children toggle button is selected or unselected. */ onChange?: (value: Y extends any[] ? Y : undefined | Y) => void; } declare const useToggleGroup: <Y extends string | string[] = string>({ defaultValue, disabled, readOnly, value: valueProp, onChange: onChangeProp, ...rest }: UseToggleGroupProps<Y>) => { disabled: boolean | undefined; readOnly: boolean | undefined; value: Y extends any[] ? Y : Y | undefined; getGroupProps: PropGetter<"div", undefined, undefined>; onChange: <M extends string = (Y extends any[] ? Y[number] : Y)>(value: M | undefined) => void; onChangeMapRef: RefObject<Map<string, (value: boolean) => void>>; }; type UseToggleGroupReturn = ReturnType<typeof useToggleGroup>; //#endregion export { ToggleGroupContext, UseToggleGroupProps, UseToggleGroupReturn, useToggleGroup, useToggleGroupContext }; //# sourceMappingURL=use-toggle-group.d.ts.map