import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type MeterThresholds = { warning?: number; error?: number; }; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the current amount, in the same units as `max`. * @default 0 */ value?: number; /** * Specify the capacity. * @default 100 */ max?: number; /** * Specify the label text. * @default "" */ labelText?: string; /** * Set to `true` to visually hide the label text. The label remains available to screen readers. * @default false */ hideLabel?: boolean; /** * Specify the helper text, rendered below the track. * @default "" */ helperText?: string; /** * Specify the value text, right-aligned in the label row and used for `aria-valuetext`. * Format it yourself, e.g. "812 GB of 1 TB". * @default "" */ valueText?: string; /** * Specify the text announced and described when the status is `"warning"`. * @default "Warning" */ warningText?: string; /** * Specify the text announced and described when the status is `"error"`. * @default "Error" */ errorText?: string; /** * Override the value text generated for `aria-valuetext` when `valueText` is not set. * Used only when the value is over capacity or the status is `"warning"` or `"error"`. * Receives `locale` as the third argument. */ valueRangeText?: (value: number, max: number, locale?: string) => string; /** * Specify the warning and error thresholds, in the same units as `value`. */ thresholds?: MeterThresholds | undefined; /** * Override the derived status. When unset, the status is derived from `thresholds`. */ status?: "default" | "success" | "warning" | "error" | undefined; /** * Set to `true` to draw a tick at each defined threshold. * @default false */ showThresholds?: boolean; /** * Override the visually hidden threshold description, used when `showThresholds` is `true`. * Return an empty string to omit it. Receives `locale` as the second argument. */ thresholdsText?: (thresholds: MeterThresholds, locale?: string) => string; /** * Specify the locale used to format the numbers in the generated `aria-valuetext` * and threshold description. Defaults to the runtime locale. */ locale?: string | undefined; /** * Specify the size of the meter. * @default "md" */ size?: "sm" | "md"; /** * Set an id for the meter element. * The helper text, thresholds, and status ids derive from it as * `{id}-helper`, `{id}-thresholds`, and `{id}-status`. * @default uniqueId() */ id?: string; labelChildren?: (this: void) => void; valueChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type MeterProps = Omit<$RestProps, keyof $Props> & $Props; export default class Meter extends SvelteComponentTyped< MeterProps, Record, { labelChildren: Record; valueChildren: Record; } > {}