UNPKG

solid-number-flow

Version:

A SolidJS component to transition, format, and localize numbers. Forked from @barvian/number-flow.

33 lines (30 loc) 1.47 kB
import { NumberFlowLite, Value, Format, Props } from 'number-flow'; export { Format, Trend, Value } from 'number-flow'; import { VoidProps, FlowProps, Accessor } from 'solid-js'; import { JSX } from 'solid-js/jsx-runtime'; declare const OBSERVED_ATTRIBUTES: readonly ["data", "digits"]; type ObservedAttribute = (typeof OBSERVED_ATTRIBUTES)[number]; declare class NumberFlowElement extends NumberFlowLite { static observedAttributes: readonly ["data", "digits"]; attributeChangedCallback(_attr: ObservedAttribute, _oldValue: string, _newValue: string): void; } type BaseProps = JSX.HTMLAttributes<NumberFlowElement> & Partial<Props> & { isolate?: boolean; willChange?: boolean; onAnimationsStart?: (e: CustomEvent<undefined>) => void; onAnimationsFinish?: (e: CustomEvent<undefined>) => void; }; type NumberFlowProps = BaseProps & { value: Value; locales?: Intl.LocalesArgument; format?: Format; prefix?: string; suffix?: string; }; declare function NumberFlow(props: VoidProps<NumberFlowProps>): JSX.Element; declare function NumberFlowGroup(props: FlowProps): JSX.Element; /** Untested, but based on the implementation in https://github.com/barvian/number-flow/blob/main/packages/svelte/src/lib/index.ts. */ declare function useCanAnimate(props?: { respectMotionPreference: boolean; }): Accessor<boolean | void>; export { NumberFlowElement, NumberFlowGroup, type NumberFlowProps, NumberFlow as default, useCanAnimate };