@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
115 lines (114 loc) • 4.13 kB
TypeScript
/**
* Web NumberFormat Component
*
* This is a legacy component.
* For referencing while developing new features, please use a Functional component.
*/
import React from 'react';
import { SpacingProps } from '../space/types';
import type { NumberFormatOptions } from './NumberUtils';
import { SkeletonShow } from '../Skeleton';
export { default as useNumberFormat } from './useNumberFormat';
export { default as useNumberFormatWithParts } from './useNumberFormatWithParts';
export type { NumberFormatOptions } from './NumberUtils';
export type NumberFormatValue = number | string;
export type NumberFormatPrefix = React.ReactNode | ((...args: any[]) => any);
export type NumberFormatSuffix = React.ReactNode | ((...args: any[]) => any);
export type NumberFormatCurrency = string | boolean;
export type NumberFormatCurrencyPosition = 'auto' | 'before' | 'after';
export type NumberFormatCompact = 'short' | 'long' | boolean;
export type NumberFormatLink = 'tel' | 'sms';
export type NumberFormatSignDisplay = 'auto' | 'always' | 'exceptZero' | 'negative' | 'never';
export type NumberFormatDecimals = number;
export type NumberFormatElement = string;
export type NumberFormatTooltip = string | ((...args: any[]) => any) | React.ReactNode;
export type NumberFormatChildren = React.ReactNode | ((...args: any[]) => any);
export type NumberFormatProps = {
id?: string;
value?: NumberFormatValue;
locale?: string;
prefix?: NumberFormatPrefix;
suffix?: NumberFormatSuffix;
currency?: NumberFormatCurrency;
currency_display?: 'code' | 'name' | 'symbol' | 'narrowSymbol' | '' | false;
currency_position?: NumberFormatCurrencyPosition;
compact?: NumberFormatCompact;
ban?: boolean;
nin?: boolean;
phone?: boolean;
org?: boolean;
percent?: boolean;
link?: NumberFormatLink;
monospace?: boolean;
options?: NumberFormatOptions;
decimals?: NumberFormatDecimals;
selectall?: boolean;
always_selectall?: boolean;
copy_selection?: boolean;
clean_copy_value?: boolean;
omit_rounding?: boolean;
rounding?: 'omit' | 'half-even' | 'half-up';
signDisplay?: NumberFormatSignDisplay;
clean?: boolean;
srLabel?: React.ReactNode;
element?: NumberFormatElement;
tooltip?: NumberFormatTooltip;
skeleton?: SkeletonShow;
className?: string;
children?: NumberFormatChildren;
style?: React.CSSProperties;
lang?: string;
};
export type NumberFormatAllProps = NumberFormatProps & Omit<React.HTMLProps<HTMLElement>, 'prefix' | 'label' | 'placeholder' | 'children'> & SpacingProps;
export declare const COPY_TOOLTIP_TIMEOUT = 3000;
export default class NumberFormat extends React.PureComponent<NumberFormatAllProps> {
static contextType: React.Context<import("../../shared/Context").ContextProps>;
static defaultProps: {
id: any;
value: any;
locale: any;
prefix: any;
suffix: any;
currency: any;
currency_display: any;
currency_position: any;
compact: any;
ban: any;
nin: any;
phone: any;
org: any;
percent: any;
link: any;
monospace: boolean;
options: any;
decimals: any;
selectall: boolean;
always_selectall: boolean;
copy_selection: boolean;
clean_copy_value: boolean;
omit_rounding: any;
rounding: any;
clean: any;
srLabel: any;
element: string;
tooltip: any;
skeleton: any;
className: any;
children: any;
};
constructor(props: any);
componentDidMount(): void;
clearCopyTooltipTimeout: () => void;
showCopyTooltip: (message: any) => void;
shortcutHandler: () => void;
onBlurHandler: () => void;
onContextMenuHandler: () => void;
onClickHandler: () => void;
componentWillUnmount(): void;
setFocus(): void;
selectAll(): void;
runFix(comp: any, className: any): import("react/jsx-runtime").JSX.Element;
onMouseEnter: () => void;
onMouseLeave: () => void;
render(): import("react/jsx-runtime").JSX.Element;
}