{"version":3,"file":"NumberFormatter.cjs","sources":["../../../src/components/NumberFormatter/NumberFormatter.tsx"],"sourcesContent":["import { NumericFormat } from 'react-number-format';\nimport { ExtendComponent, Factory, RaikouThemeComponent, useProps } from '../../core';\n\nexport interface NumberFormatterProps extends React.ComponentPropsWithoutRef<'span'> {\n  /** Value to format */\n  value?: number | string;\n\n  /** Determines whether negative values are allowed, `true` by default */\n  allowNegative?: boolean;\n\n  /** Limits the number of digits that are displayed after the decimal point, by default there is no limit */\n  decimalScale?: number;\n\n  /** Character used as a decimal separator, `'.'` by default */\n  decimalSeparator?: string;\n\n  /** If set, 0s are added after `decimalSeparator` to match given `decimalScale`. `false` by default */\n  fixedDecimalScale?: boolean;\n\n  /** Prefix added before the value */\n  prefix?: string;\n\n  /** Suffix added after the value */\n  suffix?: string;\n\n  /** Defines the thousand grouping style */\n  thousandsGroupStyle?: 'thousand' | 'lakh' | 'wan' | 'none';\n\n  /** A character used to separate thousands, `','` by default */\n  thousandSeparator?: string | boolean;\n}\n\nexport type NumberFormatterFactory = Factory<{\n  props: NumberFormatterProps;\n  ref: HTMLDivElement;\n}>;\n\nconst defaultProps: Partial<NumberFormatterProps> = {};\n\nexport function NumberFormatter(_props: NumberFormatterProps) {\n  const props = useProps('NumberFormatter', defaultProps, _props);\n  const { value, defaultValue, ...others } = props;\n\n  if (value === undefined) {\n    return null;\n  }\n\n  return <NumericFormat displayType=\"text\" value={value} {...others} />;\n}\n\nconst extendNumberFormatter = (c: ExtendComponent<NumberFormatterFactory>): RaikouThemeComponent =>\n  c;\n\nNumberFormatter.extend = extendNumberFormatter;\nNumberFormatter.displayName = '@raikou/core/NumberFormatter';\n"],"names":["useProps","NumericFormat"],"mappings":";;;;;;;;;;;;AAqCA,MAAM,eAA8C,EAAC;AAE9C,SAAS,gBAAgB,MAA8B,EAAA;AAC5D,EAAA,MAAM,KAAQ,GAAAA,iBAAA,CAAS,iBAAmB,EAAA,YAAA,EAAc,MAAM,CAAA;AAC9D,EAAA,MAAM,EAAE,KAAA,EAAO,YAAc,EAAA,GAAG,QAAW,GAAA,KAAA;AAE3C,EAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,sCAAQC,+BAAc,EAAA,EAAA,WAAA,EAAY,MAAO,EAAA,KAAA,EAAe,GAAG,MAAQ,EAAA,CAAA;AACrE;AAEA,MAAM,qBAAA,GAAwB,CAAC,CAC7B,KAAA,CAAA;AAEF,eAAA,CAAgB,MAAS,GAAA,qBAAA;AACzB,eAAA,CAAgB,WAAc,GAAA,8BAAA;;;;"}