@spark-ui/components
Version:
Spark (Leboncoin design system) components.
101 lines (93 loc) • 3.67 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ButtonHTMLAttributes, Ref, HTMLAttributes } from 'react';
import * as class_variance_authority_types from 'class-variance-authority/types';
import { VariantProps } from 'class-variance-authority';
declare const radioInputVariants: (props?: ({
intent?: "main" | "support" | "accent" | "basic" | "success" | "alert" | "error" | "info" | "neutral" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>;
interface RadioInputProps extends RadioInputVariantsProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {
/**
* Change the component to the HTML tag or custom component of the only child.
*/
asChild?: boolean;
/**
* The value given as data when submitted with a name.
*/
value: string;
/**
* When true, prevents the user from interacting with the radio item.
*/
disabled?: boolean;
/**
* When true, indicates that the user must check the radio item before the owning form can be submitted.
*/
required?: boolean;
ref?: Ref<HTMLButtonElement>;
}
type RadioProps = RadioInputProps & {
ref?: Ref<HTMLButtonElement>;
};
declare const Radio: {
({ className, children, id, disabled: disabledProp, ref, ...others }: RadioProps): react_jsx_runtime.JSX.Element;
displayName: string;
};
declare const radioGroupStyles: (props?: ({
orientation?: "vertical" | "horizontal" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>;
interface RadioGroupProps extends RadioGroupVariantsProps, Pick<RadioInputVariantsProps, 'intent'>, Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {
/**
* Change the component to the HTML tag or custom component of the only child.
*/
asChild?: boolean;
/**
* The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.
*/
defaultValue?: string;
/**
* The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
*/
value?: string;
/**
* Event handler called when the value changes.
*/
onValueChange?: (value: string) => void;
/**
* When true, prevents the user from interacting with radio items.
*/
disabled?: boolean;
/**
* The name of the group. Submitted with its owning form as part of a name/value pair.
*/
name?: string;
/**
* When true, indicates that the user must check a radio item before the owning form can be submitted.
*/
required?: boolean;
/**
* The orientation of the component.
*/
orientation?: 'horizontal' | 'vertical';
/**
* The reading direction of the radio group.
*/
dir?: 'ltr' | 'rtl';
/**
* When true, keyboard navigation will loop from last item to first, and vice versa.
*/
loop?: boolean;
/**
* When true, the label will be placed on the left side of the Radio
*/
reverse?: boolean;
ref?: Ref<HTMLDivElement>;
}
declare const RadioGroup$1: {
({ orientation, loop, intent, disabled, className, required: requiredProp, reverse, ref, ...others }: RadioGroupProps): react_jsx_runtime.JSX.Element;
displayName: string;
};
declare const RadioGroup: typeof RadioGroup$1 & {
Radio: typeof Radio;
};
export { RadioGroup, type RadioGroupProps, type RadioProps };