import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["figure"]; type $Props = { /** * Text label rendered above the value. */ labelText: string; /** * The primary value to display (the "numerator" of a fraction). */ value?: number | undefined; /** * The number to render after the slash (the "denominator" of a fraction). * Hidden when it formats identically to `value`, or when `percentage` is `true`; * see `forceShowTotal`. */ total?: number | undefined; /** * Set to `true` to format `value` as a percentage and hide `total`. * `value` is the number of percent (`12` renders "12%"), never abbreviated. * The percent sign takes the locale's place and spacing ("%12" in Turkish, * "12 %" in French). * @default false */ percentage?: boolean; /** * Set to `true` to show `total` even when the default visibility rule would hide it. * @default false */ forceShowTotal?: boolean; /** * Specify the assistive text read in place of the slash before `total`. * Screen readers don't reliably read the slash itself. * @default "of" */ totalSeparatorText?: string; /** * Specify the number of fraction digits used when formatting `value` and `total`. * @default 1 */ fractionDigits?: number; /** * Set to `true` to render the full number instead of an abbreviated one (e.g. `1,000` instead of `1K`). * @default false */ fullNumber?: boolean; /** * Render a trend indicator next to the value. */ trend?: "up" | "down" | "flat" | undefined; /** * Override the trend indicator's color. Defaults to `"success"` for `trend="up"`, * `"error"` for `trend="down"`, and `"neutral"` for `trend="flat"` — set this when * the direction's meaning is reversed for the metric (e.g. a falling error rate, * or a rising failure count). */ trendColor?: "success" | "error" | "neutral" | undefined; /** * Specify the size of the big number. * @default "default" */ size?: "default" | "lg" | "xl"; /** * Specify the tooltip text. When set, an information icon renders next to `labelText`. * @default "" */ tooltipDescription?: string; /** * Determines how `value` and `total` are formatted. Defaults to the runtime locale. */ locale?: string | undefined; /** * Set to `true` to render the loading skeleton in place of the value. * @default false */ loading?: boolean; /** * Additional options merged into the `Intl.NumberFormat` options used to format * `value` and `total`. Consumer keys take precedence over the component's defaults. * @example `{ style: "currency", currency: "USD" }` * @example `{ style: "unit", unit: "millisecond" }` */ formatOptions?: Intl.NumberFormatOptions | undefined; /** * Provide a custom formatter for `value` and `total`, replacing Intl formatting * entirely. Non-number inputs still render the dash. */ format?: ((value: number) => string) | undefined; /** * Override the text announced to assistive technology for the trend indicator. * Defaults to "Trending up", "Trending down", or "No change" based on `trend`. */ trendDescription?: string | undefined; /** * The signed change in `value` since the last period. */ delta?: number | undefined; /** * Set to `true` to format `delta` as a percentage instead of a plain number. * `delta` is the number of percent, as for `percentage`. * @default false */ deltaPercentage?: boolean; /** * Trailing context rendered after the formatted `delta`, such as "vs last week". * @default "" */ deltaLabel?: string; /** An inline action after the value, such as an icon-only `Button` or a `Link`. */ action?: (this: void) => void; labelChildren?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type BigNumberProps = Omit<$RestProps, keyof $Props> & $Props; export default class BigNumber extends SvelteComponentTyped< BigNumberProps, Record, { default: Record; /** An inline action after the value, such as an icon-only `Button` or a `Link`. */ action: Record; labelChildren: Record; } > {}