import type { ReactElement, HTMLAttributes, Ref } from "react";
import type SlRatingElement from "@shoelace-style/shoelace/dist/components/rating/rating.js";
import { SlChangeEvent, SlHoverEvent } from "../events";
export type { SlRatingElement };
export type SlRatingChangeEvent = SlChangeEvent;
export type SlRatingHoverEventDetail = {
phase: "start" | "move" | "end";
value: number;
};
export type SlRatingHoverEvent = SlHoverEvent<
SlRatingElement,
SlHoverEventDetail
>;
export interface SlRatingProps extends HTMLAttributes {
ref?: Ref;
/**
* A label that describes the rating to assistive devices.
*/
label?: string;
/**
* The current rating.
*/
value?: number;
/**
* The highest rating to show.
*/
max?: number;
/**
* The precision at which the rating will increase and decrease. For example, to allow half-star ratings, set this
* attribute to `0.5`.
*/
precision?: number;
/**
* Makes the rating readonly.
*/
readonly?: boolean;
/**
* Disables the rating.
*/
disabled?: boolean;
/**
* A function that customizes the symbol to be rendered. The first and only argument is the rating's current value.
* The function should return a string containing trusted HTML of the symbol to render at the specified value. Works
* well with `` elements.
*/
getSymbol?: (value: number) => string;
/**
* Emitted when the rating's value changes.
*/
onSlChange?: (event: SlRatingChangeEvent) => void;
/**
* Emitted when the rating's value changes.
*/
onSlChangeCapture?: (event: SlRatingChangeEvent) => void;
/**
* Emitted when the user hovers over a value. The `phase` property indicates when hovering starts, moves to a new value, or ends. The `value` property tells what the rating's value would be if the user were to commit to the hovered value.
*/
onSlHover?: (event: SlRatingHoverEvent) => void;
/**
* Emitted when the user hovers over a value. The `phase` property indicates when hovering starts, moves to a new value, or ends. The `value` property tells what the rating's value would be if the user were to commit to the hovered value.
*/
onSlHoverCapture?: (event: SlRatingHoverEvent) => void;
}
/**
* Ratings give users a way to quickly view and provide feedback.
*/
export default function SlRating(
props: SlRatingProps,
): ReactElement;