69 lines
3.2 KiB
TypeScript
69 lines
3.2 KiB
TypeScript
import * as React from 'react';
|
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
|
|
|
|
type Scope<C = any> = {
|
|
[scopeName: string]: React.Context<C>[];
|
|
} | undefined;
|
|
type ScopeHook = (scope: Scope) => {
|
|
[__scopeProp: string]: Scope;
|
|
};
|
|
interface CreateScope {
|
|
scopeName: string;
|
|
(): ScopeHook;
|
|
}
|
|
|
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
interface RadioProps$1 extends PrimitiveButtonProps {
|
|
checked?: boolean;
|
|
required?: boolean;
|
|
onCheck?(): void;
|
|
}
|
|
declare const Radio: React.ForwardRefExoticComponent<RadioProps$1 & React.RefAttributes<HTMLButtonElement>>;
|
|
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
interface RadioIndicatorProps$1 extends PrimitiveSpanProps {
|
|
/**
|
|
* Used to force mounting when more control is needed. Useful when
|
|
* controlling animation with React animation libraries.
|
|
*/
|
|
forceMount?: true;
|
|
}
|
|
declare const RadioIndicator: React.ForwardRefExoticComponent<RadioIndicatorProps$1 & React.RefAttributes<HTMLSpanElement>>;
|
|
|
|
declare const createRadioGroupScope: CreateScope;
|
|
type RadioGroupContextValue = {
|
|
name?: string;
|
|
required: boolean;
|
|
disabled: boolean;
|
|
value?: string;
|
|
onValueChange(value: string): void;
|
|
};
|
|
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
interface RadioGroupProps extends PrimitiveDivProps {
|
|
name?: RadioGroupContextValue['name'];
|
|
required?: React.ComponentPropsWithoutRef<typeof Radio>['required'];
|
|
disabled?: React.ComponentPropsWithoutRef<typeof Radio>['disabled'];
|
|
dir?: RovingFocusGroupProps['dir'];
|
|
orientation?: RovingFocusGroupProps['orientation'];
|
|
loop?: RovingFocusGroupProps['loop'];
|
|
defaultValue?: string;
|
|
value?: RadioGroupContextValue['value'];
|
|
onValueChange?: RadioGroupContextValue['onValueChange'];
|
|
}
|
|
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
type RadioProps = React.ComponentPropsWithoutRef<typeof Radio>;
|
|
interface RadioGroupItemProps extends Omit<RadioProps, 'onCheck' | 'name'> {
|
|
value: string;
|
|
}
|
|
declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
type RadioIndicatorProps = React.ComponentPropsWithoutRef<typeof RadioIndicator>;
|
|
interface RadioGroupIndicatorProps extends RadioIndicatorProps {
|
|
}
|
|
declare const RadioGroupIndicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
declare const Root: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
declare const Item: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
declare const Indicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
|
|
export { Indicator, Item, RadioGroup, RadioGroupIndicator, type RadioGroupIndicatorProps, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, Root, createRadioGroupScope };
|